Debian Codegraph @

tests/unit_tests/synthetic/libraries/cusparse2rocsparse_7050.cu

raw
1 // RUN: %run_test hipify "%s" "%t" %hipify_args 3 --skip-excluded-preprocessor-conditional-blocks --experimental --roc %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.7050. 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_operation opA, opB, opX;
24 cusparseOperation_t opA, opB, opX;
25
26 int batchCount = 0;
27 int m = 0;
28 int n = 0;
29 int innz = 0;
30 int algo = 0;
31 int bufferSizeInBytes = 0;
32 double dds = 0.f;
33 double ddl = 0.f;
34 double dd = 0.f;
35 double ddu = 0.f;
36 double ddw = 0.f;
37 double dx = 0.f;
38 float fds = 0.f;
39 float fdl = 0.f;
40 float fd = 0.f;
41 float fdu = 0.f;
42 float fdw = 0.f;
43 float fx = 0.f;
44 size_t bufferSize = 0;
45 void *pBuffer = nullptr;
46
47 #if CUDA_VERSION >= 7050
48 // CUDA: cusparseStatus_t CUSPARSEAPI cusparseZgemvi_bufferSize(cusparseHandle_t handle, cusparseOperation_t transA, int m, int n, int nnz, int* pBufferSize);
49 // ROC: ROCSPARSE_EXPORT rocsparse_status rocsparse_zgemvi_buffer_size(rocsparse_handle handle, rocsparse_operation trans, rocsparse_int m, rocsparse_int n, rocsparse_int nnz, size_t* buffer_size);
50 // CHECK: status_t = rocsparse_zgemvi_buffer_size(handle_t, opA, m, n, innz, reinterpret_cast<size_t*>(&bufferSizeInBytes));
51 status_t = cusparseZgemvi_bufferSize(handle_t, opA, m, n, innz, &bufferSizeInBytes);
52
53 // CUDA: cusparseStatus_t CUSPARSEAPI cusparseCgemvi_bufferSize(cusparseHandle_t handle, cusparseOperation_t transA, int m, int n, int nnz, int* pBufferSize);
54 // ROC: ROCSPARSE_EXPORT rocsparse_status rocsparse_cgemvi_buffer_size(rocsparse_handle handle, rocsparse_operation trans, rocsparse_int m, rocsparse_int n, rocsparse_int nnz, size_t* buffer_size);
55 // CHECK: status_t = rocsparse_cgemvi_buffer_size(handle_t, opA, m, n, innz, reinterpret_cast<size_t*>(&bufferSizeInBytes));
56 status_t = cusparseCgemvi_bufferSize(handle_t, opA, m, n, innz, &bufferSizeInBytes);
57
58 // CUDA: cusparseStatus_t CUSPARSEAPI cusparseDgemvi_bufferSize(cusparseHandle_t handle, cusparseOperation_t transA, int m, int n, int nnz, int* pBufferSize);
59 // ROC: ROCSPARSE_EXPORT rocsparse_status rocsparse_dgemvi_buffer_size(rocsparse_handle handle, rocsparse_operation trans, rocsparse_int m, rocsparse_int n, rocsparse_int nnz, size_t* buffer_size);
60 // CHECK: status_t = rocsparse_dgemvi_buffer_size(handle_t, opA, m, n, innz, reinterpret_cast<size_t*>(&bufferSizeInBytes));
61 status_t = cusparseDgemvi_bufferSize(handle_t, opA, m, n, innz, &bufferSizeInBytes);
62
63 // CUDA: cusparseStatus_t CUSPARSEAPI cusparseSgemvi_bufferSize(cusparseHandle_t handle, cusparseOperation_t transA, int m, int n, int nnz, int* pBufferSize);
64 // ROC: ROCSPARSE_EXPORT rocsparse_status rocsparse_sgemvi_buffer_size(rocsparse_handle handle, rocsparse_operation trans, rocsparse_int m, rocsparse_int n, rocsparse_int nnz, size_t* buffer_size);
65 // CHECK: status_t = rocsparse_sgemvi_buffer_size(handle_t, opA, m, n, innz, reinterpret_cast<size_t*>(&bufferSizeInBytes));
66 status_t = cusparseSgemvi_bufferSize(handle_t, opA, m, n, innz, &bufferSizeInBytes);
67 #endif
68
69 return 0;
70 }