imate
C++/CUDA Reference
cusparse_types.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright 2021, Siavash Ameli <sameli@berkeley.edu>
3  * SPDX-License-Identifier: BSD-3-Clause
4  * SPDX-FileType: SOURCE
5  *
6  * This program is free software: you can redistribute it and/or modify it
7  * under the terms of the license found in the LICENSE.txt file in the root
8  * directory of this source tree.
9  */
10 
11 
12 #ifndef _CUDA_DYNAMIC_LOADING_CUSPARSE_TYPES_H_
13 #define _CUDA_DYNAMIC_LOADING_CUSPARSE_TYPES_H_
14 
15 // =======
16 // Headers
17 // =======
18 
19 #include <cusparse.h> // cusparseSpMatDescr_t, cusparseConstSpMatDescr_t,
20  // cusparseDnVecDescr_t, cusparseConstDnVecDescr_t,
21  // CusparseStatus_t, CUSPARSE_STATUS_SUCCESS,
22  // cusparseCreateCsr, cusparseCreateDnVec,
23  // cusparseDestroySpMat, cusparseDestroyDnVec,
24  // CUDA_R_32F, CUDA_R_64F, CUSPARSE_INDEX_32I,
25  // CUSPARSE_INDEX_BASE_ZERO, cusparseHandle_t,
26  // cusparseSpMVAlg_t, cusparseSpMV_buffer_size
27 
28 // CUDA Version Considerations
29 #if CUSPARSE_VER_MAJOR < 12
30  // These types were defined n cusparse version 12, but do not exist in
31  // earlier versions.
32  #define CUSPARSE_SPMV_ALG_DEFAULT CUSPARSE_MV_ALG_DEFAULT
33  #define cusparseConstSpMatDescr_t cusparseSpMatDescr_t
34  #define cusparseConstDnVecDescr_t cusparseDnVecDescr_t
35 #endif
36 
37 
38 // =====
39 // Types
40 // =====
41 
42 // cusparse Create
43 typedef cusparseStatus_t (*cusparseCreate_type)(cusparseHandle_t* handle);
44 
45 // cusparse Destroy
46 typedef cusparseStatus_t (*cusparseDestroy_type)(cusparseHandle_t handle);
47 
48 // cusparseCreateCsr
49 typedef cusparseStatus_t (*cusparseCreateCsr_type)(
50  cusparseSpMatDescr_t* spMatDescr,
51  int64_t rows,
52  int64_t cols,
53  int64_t nnz,
54  void* csrRowOffsets,
55  void* csrColInd,
56  void* csrValues,
57  cusparseIndexType_t csrRowOffsetsType,
58  cusparseIndexType_t csrColIndType,
59  cusparseIndexBase_t idxBase,
60  cudaDataType valueType);
61 
62 // cusparseCreateDnVec
63 typedef cusparseStatus_t (*cusparseCreateDnVec_type)(
64  cusparseDnVecDescr_t* dnVecDescr,
65  int64_t size,
66  void* values,
67  cudaDataType valueType);
68 
69 // cusparseDestroySpMat
70 typedef cusparseStatus_t (*cusparseDestroySpMat_type)(
71  cusparseConstSpMatDescr_t spMatDescr);
72 
73 // cusparseDestroyDnVec
74 typedef cusparseStatus_t (*cusparseDestroyDnVec_type)(
75  cusparseConstDnVecDescr_t dnVecDescr);
76 
77 // cusparseSpMV_buffer_size
78 typedef cusparseStatus_t (*cusparseSpMV_bufferSize_type)(
79  cusparseHandle_t handle,
80  cusparseOperation_t opA,
81  const void* alpha,
84  const void* beta,
85  cusparseDnVecDescr_t vecY,
86  cudaDataType computeType,
87  cusparseSpMVAlg_t alg,
88  size_t* bufferSize);
89 
90 // cusparseSpMV
91 typedef cusparseStatus_t (*cusparseSpMV_type)(
92  cusparseHandle_t handle,
93  cusparseOperation_t opA,
94  const void* alpha,
97  const void* beta,
98  cusparseDnVecDescr_t vecY,
99  cudaDataType computeType,
100  cusparseSpMVAlg_t alg,
101  void* externalBuffer);
102 
103 
104 #endif // _CUDA_DYNAMIC_LOADING_CUSPARSE_TYPES_H_
cusparseStatus_t(* cusparseSpMV_type)(cusparseHandle_t handle, cusparseOperation_t opA, const void *alpha, cusparseConstSpMatDescr_t matA, cusparseConstDnVecDescr_t vecX, const void *beta, cusparseDnVecDescr_t vecY, cudaDataType computeType, cusparseSpMVAlg_t alg, void *externalBuffer)
cusparseStatus_t(* cusparseCreate_type)(cusparseHandle_t *handle)
cusparseStatus_t(* cusparseDestroy_type)(cusparseHandle_t handle)
cusparseStatus_t(* cusparseCreateDnVec_type)(cusparseDnVecDescr_t *dnVecDescr, int64_t size, void *values, cudaDataType valueType)
#define cusparseConstDnVecDescr_t
cusparseStatus_t(* cusparseDestroyDnVec_type)(cusparseConstDnVecDescr_t dnVecDescr)
#define cusparseConstSpMatDescr_t
cusparseStatus_t(* cusparseSpMV_bufferSize_type)(cusparseHandle_t handle, cusparseOperation_t opA, const void *alpha, cusparseConstSpMatDescr_t matA, cusparseConstDnVecDescr_t vecX, const void *beta, cusparseDnVecDescr_t vecY, cudaDataType computeType, cusparseSpMVAlg_t alg, size_t *bufferSize)
cusparseStatus_t(* cusparseDestroySpMat_type)(cusparseConstSpMatDescr_t spMatDescr)
cusparseStatus_t(* cusparseCreateCsr_type)(cusparseSpMatDescr_t *spMatDescr, int64_t rows, int64_t cols, int64_t nnz, void *csrRowOffsets, void *csrColInd, void *csrValues, cusparseIndexType_t csrRowOffsetsType, cusparseIndexType_t csrColIndType, cusparseIndexBase_t idxBase, cudaDataType valueType)