imate
C++/CUDA Reference
Loading...
Searching...
No Matches
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, cusparseCreateCsc,
23 // cusparseCreateDnVec, cusparseDestroySpMat,
24 // cusparseDestroyDnVec, CUDA_R_32F, CUDA_R_64F,
25 // CUSPARSE_INDEX_32I, CUSPARSE_INDEX_BASE_ZERO,
26 // cusparseHandle_t, cusparseSpMVAlg_t,
27 // cusparseSpMV_buffer_size
28
29// CUDA Version Considerations
30#if CUSPARSE_VER_MAJOR < 12
31 // These types were defined n cusparse version 12, but do not exist in
32 // earlier versions.
33 #define CUSPARSE_SPMV_ALG_DEFAULT CUSPARSE_MV_ALG_DEFAULT
34 #define cusparseConstSpMatDescr_t cusparseSpMatDescr_t
35 #define cusparseConstDnVecDescr_t cusparseDnVecDescr_t
36#endif
37
38
39// =====
40// Types
41// =====
42
43// cusparse Create
44typedef cusparseStatus_t (*cusparseCreate_type)(cusparseHandle_t* handle);
45
46// cusparse Destroy
47typedef cusparseStatus_t (*cusparseDestroy_type)(cusparseHandle_t handle);
48
49// cusparseCreateCsr
50typedef cusparseStatus_t (*cusparseCreateCsr_type)(
51 cusparseSpMatDescr_t* spMatDescr,
52 int64_t rows,
53 int64_t cols,
54 int64_t nnz,
55 void* csrRowOffsets,
56 void* csrColInd,
57 void* csrValues,
58 cusparseIndexType_t csrRowOffsetsType,
59 cusparseIndexType_t csrColIndType,
60 cusparseIndexBase_t idxBase,
61 cudaDataType valueType);
62
63// cusparseCreateCsc
64typedef cusparseStatus_t (*cusparseCreateCsc_type)(
65 cusparseSpMatDescr_t* spMatDescr,
66 int64_t rows,
67 int64_t cols,
68 int64_t nnz,
69 void* cscRowOffsets,
70 void* cscColInd,
71 void* cscValues,
72 cusparseIndexType_t cscRowOffsetsType,
73 cusparseIndexType_t cscColIndType,
74 cusparseIndexBase_t idxBase,
75 cudaDataType valueType);
76
77// cusparseCreateDnVec
78typedef cusparseStatus_t (*cusparseCreateDnVec_type)(
79 cusparseDnVecDescr_t* dnVecDescr,
80 int64_t size,
81 void* values,
82 cudaDataType valueType);
83
84// cusparseDestroySpMat
85typedef cusparseStatus_t (*cusparseDestroySpMat_type)(
86 cusparseConstSpMatDescr_t spMatDescr);
87
88// cusparseDestroyDnVec
89typedef cusparseStatus_t (*cusparseDestroyDnVec_type)(
90 cusparseConstDnVecDescr_t dnVecDescr);
91
92// cusparseSpMV_buffer_size
93typedef cusparseStatus_t (*cusparseSpMV_bufferSize_type)(
94 cusparseHandle_t handle,
95 cusparseOperation_t opA,
96 const void* alpha,
99 const void* beta,
100 cusparseDnVecDescr_t vecY,
101 cudaDataType computeType,
102 cusparseSpMVAlg_t alg,
103 size_t* bufferSize);
104
105// cusparseSpMV
106typedef cusparseStatus_t (*cusparseSpMV_type)(
107 cusparseHandle_t handle,
108 cusparseOperation_t opA,
109 const void* alpha,
112 const void* beta,
113 cusparseDnVecDescr_t vecY,
114 cudaDataType computeType,
115 cusparseSpMVAlg_t alg,
116 void* externalBuffer);
117
118
119#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)
cusparseStatus_t(* cusparseCreateCsc_type)(cusparseSpMatDescr_t *spMatDescr, int64_t rows, int64_t cols, int64_t nnz, void *cscRowOffsets, void *cscColInd, void *cscValues, cusparseIndexType_t cscRowOffsetsType, cusparseIndexType_t cscColIndType, cusparseIndexBase_t idxBase, 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)