Debian Codegraph @

tests/unit_tests/synthetic/libraries/cusparse2rocsparse_10010_12000.cu

raw
1 // RUN: %run_test hipify "%s" "%t" %hipify_args 4 --skip-excluded-preprocessor-conditional-blocks --experimental --roc --amap %clang_args -ferror-limit=500
2
3 // CHECK: #include <hip/hip_runtime.h>
4 #include <cuda_runtime.h>
5 // CHECK: #include "hip/hip_complex.h"
6 #include "cuComplex.h"
7 #include <stdio.h>
8 // CHECK: #include "rocsparse.h"
9 #include "cusparse.h"
10 // CHECK-NOT: #include "rocsparse.h"
11
12 int main() {
13 printf("18.10010.12000. cuSPARSE API to rocSPARSE API synthetic test\n");
14
15 // CHECK: _rocsparse_handle *handle = nullptr;
16 // CHECK-NEXT: rocsparse_handle handle_t;
17 cusparseContext *handle = nullptr;
18 cusparseHandle_t handle_t;
19
20 // CHECK: rocsparse_status status_t;
21 cusparseStatus_t status_t;
22
23 // CHECK: _rocsparse_mat_descr *matDescr = nullptr;
24 // CHECK-NEXT: rocsparse_mat_descr matDescr_t, matDescr_t_2, matDescr_A, matDescr_B, matDescr_C, matDescr_D;
25 cusparseMatDescr *matDescr = nullptr;
26 cusparseMatDescr_t matDescr_t, matDescr_t_2, matDescr_A, matDescr_B, matDescr_C, matDescr_D;
27
28 // CHECK: rocsparse_action action_t;
29 cusparseAction_t action_t;
30
31 // CHECK: rocsparse_index_base indexBase_t;
32 cusparseIndexBase_t indexBase_t;
33
34 int m = 0;
35 int n = 0;
36 int innz = 0;
37 int csrRowPtrA = 0;
38 int csrRowPtrB = 0;
39 int csrRowPtrC = 0;
40 int cscRowIndA = 0;
41 int csrColIndA = 0;
42 int csrColIndB = 0;
43 int csrColIndC = 0;
44 int cscColPtrA = 0;
45 size_t bufferSize = 0;
46 void *pcsrVal = nullptr;
47 void *pcscVal = nullptr;
48 void *alpha = nullptr;
49 void *beta = nullptr;
50 void *tempBuffer = nullptr;
51 void* result = nullptr;
52
53 // CHECK: rocsparse_operation opA, opB, opX;
54 cusparseOperation_t opA, opB, opX;
55
56 #if CUDA_VERSION >= 8000
57 // TODO: [#899] There should be rocsparse_datatype instead of hipDataType
58 cudaDataType_t dataType_t;
59 cudaDataType dataType;
60 #endif
61
62 #if CUDA_VERSION >= 10010
63
64 #if (CUSPARSE_VER_MAJOR == 10 && CUSPARSE_VER_MINOR == 2) || CUSPARSE_VERSION >= 10300
65 // TODO: cusparseCsr2CscAlg_t has no analogue in rocSPARSE. The deletion of declaration and usage is needed to be implemented
66 cusparseCsr2CscAlg_t Csr2CscAlg_t;
67
68 // CHECK: _rocsparse_spvec_descr *spVecDescr = nullptr;
69 // CHECK-NEXT: rocsparse_spvec_descr spVecDescr_t;
70 cusparseSpVecDescr *spVecDescr = nullptr;
71 cusparseSpVecDescr_t spVecDescr_t;
72
73 // CHECK: _rocsparse_dnvec_descr *dnVecDescr = nullptr;
74 // CHECK-NEXT: rocsparse_dnvec_descr dnVecDescr_t, vecX, vecY;
75 cusparseDnVecDescr *dnVecDescr = nullptr;
76 cusparseDnVecDescr_t dnVecDescr_t, vecX, vecY;
77 #endif
78
79 #if (CUDA_VERSION < 11000 && !defined(_WIN32)) || CUDA_VERSION >= 11000
80 // CHECK: rocsparse_spmat_descr spMatDescr_t, spmatA, spmatB, spmatC;
81 cusparseSpMatDescr_t spMatDescr_t, spmatA, spmatB, spmatC;
82
83 // CHECK: rocsparse_dnmat_descr dnMatDescr_t, dnmatA, dnmatB, dnmatC;
84 cusparseDnMatDescr_t dnMatDescr_t, dnmatA, dnmatB, dnmatC;
85
86 // CHECK: rocsparse_spmm_alg spMMAlg_t;
87 cusparseSpMMAlg_t spMMAlg_t;
88 #endif
89
90 #endif
91
92 return 0;
93 }