From 39bf61514641cd5e37f4479063cb8ebcd01db25e Mon Sep 17 00:00:00 2001 From: bmedishe Date: Tue, 23 Apr 2024 18:04:47 +0000 Subject: [PATCH 01/30] include cusparse in cupy build --- install/cupy_builder/_features.py | 1 + 1 file changed, 1 insertion(+) diff --git a/install/cupy_builder/_features.py b/install/cupy_builder/_features.py index f2f91cdf258..6b99ed84a44 100644 --- a/install/cupy_builder/_features.py +++ b/install/cupy_builder/_features.py @@ -166,6 +166,7 @@ def get_features(ctx: Context) -> Dict[str, Feature]: 'cupy_backends.cuda.libs.cublas_hip', 'cupy_backends.cuda.libs.curand_hip', 'cupy_backends.cuda.libs.nvrtc_hip', + 'cupy_backends.cuda.libs.cusparse_hip', ], 'include': [ 'hip/hip_runtime_api.h', From 60c8a731790e4f42d7ea96913b9e48f869a369e4 Mon Sep 17 00:00:00 2001 From: bmedishe Date: Wed, 24 Apr 2024 19:30:50 +0000 Subject: [PATCH 02/30] make cusparse.pyx use cusparse_hip --- cupy_backends/cuda/libs/cusparse.pyx | 10292 +++++++++++++------------ 1 file changed, 5147 insertions(+), 5145 deletions(-) diff --git a/cupy_backends/cuda/libs/cusparse.pyx b/cupy_backends/cuda/libs/cusparse.pyx index ad499ffe4ca..aa4d3877f53 100644 --- a/cupy_backends/cuda/libs/cusparse.pyx +++ b/cupy_backends/cuda/libs/cusparse.pyx @@ -9,5168 +9,5170 @@ from cupy_backends.cuda.api.runtime cimport _is_hip_environment from cupy_backends.cuda cimport stream as stream_module from cupy_backends.cuda._softlink cimport SoftLink - -cdef extern from '../../cupy_complex.h': - ctypedef struct cuComplex 'cuComplex': - float x, y - - ctypedef struct cuDoubleComplex 'cuDoubleComplex': - double x, y - -cdef extern from '../../cupy_sparse.h' nogil: - ctypedef void* Stream 'cudaStream_t' - - # Version - cusparseStatus_t cusparseGetVersion(cusparseHandle_t handle, int* version) - - # Error handling - const char* cusparseGetErrorName(Status status) - const char* cusparseGetErrorString(Status status) - - # cuSPARSE Helper Function - Status cusparseCreate(Handle *handle) - Status cusparseCreateMatDescr(MatDescr descr) - Status cusparseDestroy(Handle handle) - Status cusparseDestroyMatDescr(MatDescr descr) - Status cusparseSetMatIndexBase(MatDescr descr, IndexBase base) - Status cusparseSetMatType(MatDescr descr, MatrixType type) - Status cusparseSetMatFillMode(MatDescr descrA, FillMode fillMode) - Status cusparseSetMatDiagType(MatDescr descrA, DiagType diagType) - Status cusparseSetPointerMode(Handle handle, PointerMode mode) - - # Stream - Status cusparseSetStream(Handle handle, Stream streamId) - Status cusparseGetStream(Handle handle, Stream* streamId) - - # cuSPARSE Level1 Function - Status cusparseSgthr( - Handle handle, int nnz, const float *y, float *xVal, const int *xInd, - IndexBase idxBase) - - Status cusparseDgthr( - Handle handle, int nnz, const double *y, double *xVal, const int *xInd, - IndexBase idxBase) - - Status cusparseCgthr( - Handle handle, int nnz, const cuComplex *y, cuComplex *xVal, - const int *xInd, - IndexBase idxBase) - - Status cusparseZgthr( - Handle handle, int nnz, const cuDoubleComplex *y, - cuDoubleComplex *xVal, const int *xInd, - IndexBase idxBase) - - # cuSPARSE Level2 Function - Status cusparseScsrmv( - Handle handle, Operation transA, int m, int n, int nnz, - const float *alpha, MatDescr descrA, const float *csrSortedValA, - const int *csrSortedRowPtrA, const int *csrSortedColIndA, - const float *x, const float *beta, float *y) - - Status cusparseDcsrmv( - Handle handle, Operation transA, int m, int n, int nnz, - const double *alpha, MatDescr descrA, const double *csrSortedValA, - const int *csrSortedRowPtrA, const int *csrSortedColIndA, - const double *x, const double *beta, double *y) - - Status cusparseCcsrmv( - Handle handle, Operation transA, int m, int n, int nnz, - const cuComplex *alpha, MatDescr descrA, - const cuComplex *csrSortedValA, - const int *csrSortedRowPtrA, const int *csrSortedColIndA, - const cuComplex *x, const cuComplex *beta, cuComplex *y) - - Status cusparseZcsrmv( - Handle handle, Operation transA, int m, int n, int nnz, - const cuDoubleComplex *alpha, MatDescr descrA, - const cuDoubleComplex *csrSortedValA, - const int *csrSortedRowPtrA, const int *csrSortedColIndA, - const cuDoubleComplex *x, const cuDoubleComplex *beta, - cuDoubleComplex *y) - - Status cusparseCsrmvEx_bufferSize( - Handle handle, AlgMode alg, Operation transA, int m, int n, - int nnz, const void *alpha, DataType alphatype, - MatDescr descrA, const void *csrValA, DataType csrValAtype, - const int *csrRowPtrA, const int *csrColIndA, - const void *x, DataType xtype, const void *beta, - DataType betatype, void *y, DataType ytype, - DataType executiontype, size_t *bufferSizeInBytes) - - Status cusparseCsrmvEx( - Handle handle, AlgMode alg, Operation transA, int m, int n, - int nnz, const void *alpha, DataType alphatype, - MatDescr descrA, const void *csrValA, DataType csrValAtype, - const int *csrRowPtrA, const int *csrColIndA, - const void *x, DataType xtype, const void *beta, - DataType betatype, void *y, DataType ytype, - DataType executiontype, void* buffer) - - Status cusparseCreateCsrsv2Info(csrsv2Info_t* info) - Status cusparseDestroyCsrsv2Info(csrsv2Info_t info) - - Status cusparseScsrsv2_bufferSize( - Handle handle, Operation transA, int m, int nnz, const MatDescr descrA, - float* csrSortedValA, const int* csrSortedRowPtrA, - const int* csrSortedColIndA, csrsv2Info_t info, - int* pBufferSizeInBytes) - Status cusparseDcsrsv2_bufferSize( - Handle handle, Operation transA, int m, int nnz, const MatDescr descrA, - double* csrSortedValA, const int* csrSortedRowPtrA, - const int* csrSortedColIndA, csrsv2Info_t info, - int* pBufferSizeInBytes) - Status cusparseCcsrsv2_bufferSize( - Handle handle, Operation transA, int m, int nnz, const MatDescr descrA, - cuComplex* csrSortedValA, const int* csrSortedRowPtrA, - const int* csrSortedColIndA, csrsv2Info_t info, - int* pBufferSizeInBytes) - Status cusparseZcsrsv2_bufferSize( - Handle handle, Operation transA, int m, int nnz, const MatDescr descrA, - cuDoubleComplex* csrSortedValA, const int* csrSortedRowPtrA, - const int* csrSortedColIndA, csrsv2Info_t info, - int* pBufferSizeInBytes) - - Status cusparseScsrsv2_analysis( - Handle handle, Operation transA, int m, int nnz, const MatDescr descrA, - const float* csrSortedValA, const int* csrSortedRowPtrA, - const int* csrSortedColIndA, csrsv2Info_t info, - cusparseSolvePolicy_t policy, void* pBuffer) - Status cusparseDcsrsv2_analysis( - Handle handle, Operation transA, int m, int nnz, const MatDescr descrA, - const double* csrSortedValA, const int* csrSortedRowPtrA, - const int* csrSortedColIndA, csrsv2Info_t info, - cusparseSolvePolicy_t policy, void* pBuffer) - Status cusparseCcsrsv2_analysis( - Handle handle, Operation transA, int m, int nnz, const MatDescr descrA, - const cuComplex* csrSortedValA, const int* csrSortedRowPtrA, - const int* csrSortedColIndA, csrsv2Info_t info, - cusparseSolvePolicy_t policy, void* pBuffer) - Status cusparseZcsrsv2_analysis( - Handle handle, Operation transA, int m, int nnz, const MatDescr descrA, - const cuDoubleComplex* csrSortedValA, const int* csrSortedRowPtrA, - const int* csrSortedColIndA, csrsv2Info_t info, - cusparseSolvePolicy_t policy, void* pBuffer) - - Status cusparseScsrsv2_solve( - Handle handle, Operation transA, int m, int nnz, - const float* alpha, const MatDescr descrA, - const float* csrSortedValA, const int* csrSortedRowPtrA, - const int* csrSortedColIndA, csrsv2Info_t info, - const float* x, float* y, - cusparseSolvePolicy_t policy, void* pBuffer) - Status cusparseDcsrsv2_solve( - Handle handle, Operation transA, int m, int nnz, - const double* alpha, const MatDescr descrA, - const double* csrSortedValA, const int* csrSortedRowPtrA, - const int* csrSortedColIndA, csrsv2Info_t info, - const double* x, double* y, - cusparseSolvePolicy_t policy, void* pBuffer) - Status cusparseCcsrsv2_solve( - Handle handle, Operation transA, int m, int nnz, - const cuComplex* alpha, const MatDescr descrA, - const cuComplex* csrSortedValA, const int* csrSortedRowPtrA, - const int* csrSortedColIndA, csrsv2Info_t info, - const cuComplex* x, cuComplex* y, - cusparseSolvePolicy_t policy, void* pBuffer) - Status cusparseZcsrsv2_solve( - Handle handle, Operation transA, int m, int nnz, - const cuDoubleComplex* alpha, const MatDescr descrA, - const cuDoubleComplex* csrSortedValA, const int* csrSortedRowPtrA, - const int* csrSortedColIndA, csrsv2Info_t info, - const cuDoubleComplex* x, cuDoubleComplex* y, - cusparseSolvePolicy_t policy, void* pBuffer) - - Status cusparseXcsrsv2_zeroPivot( - Handle handle, csrsv2Info_t info, int* position) - - # cuSPARSE Level3 Function - Status cusparseScsrmm( - Handle handle, Operation transA, int m, int n, int k, int nnz, - const float *alpha, const MatDescr descrA, const float *csrSortedValA, - const int *csrSortedRowPtrA, const int *csrSortedColIndA, - const float *B, int ldb, const float *beta, float *C, int ldc) - - Status cusparseDcsrmm( - Handle handle, Operation transA, int m, int n, int k, int nnz, - const double *alpha, const MatDescr descrA, - const double *csrSortedValA, - const int *csrSortedRowPtrA, const int *csrSortedColIndA, - const double *B, int ldb, const double *beta, double *C, int ldc) - - Status cusparseCcsrmm( - Handle handle, Operation transA, int m, int n, int k, int nnz, - const cuComplex *alpha, const MatDescr descrA, - const cuComplex *csrSortedValA, - const int *csrSortedRowPtrA, const int *csrSortedColIndA, - const cuComplex *B, int ldb, const cuComplex *beta, - cuComplex *C, int ldc) - - Status cusparseZcsrmm( - Handle handle, Operation transA, int m, int n, int k, int nnz, - const cuDoubleComplex *alpha, const MatDescr descrA, - const cuDoubleComplex *csrSortedValA, - const int *csrSortedRowPtrA, const int *csrSortedColIndA, - const cuDoubleComplex *B, int ldb, - const cuDoubleComplex *beta, cuDoubleComplex *C, int ldc) - - Status cusparseScsrmm2( - Handle handle, Operation transA, Operation transB, int m, int n, int k, - int nnz, const float *alpha, const MatDescr descrA, - const float *csrValA, const int *csrRowPtrA, const int *csrColIndA, - const float *B, int ldb, const float *beta, float *C, int ldc) - - Status cusparseDcsrmm2( - Handle handle, Operation transA, Operation transB, int m, int n, int k, - int nnz, const double *alpha, const MatDescr descrA, - const double *csrValA, const int *csrRowPtrA, const int *csrColIndA, - const double *B, int ldb, const double *beta, double *C, int ldc) - - Status cusparseCcsrmm2( - Handle handle, Operation transA, Operation transB, int m, int n, int k, - int nnz, const cuComplex *alpha, const MatDescr descrA, - const cuComplex *csrValA, const int *csrRowPtrA, const int *csrColIndA, - const cuComplex *B, int ldb, const cuComplex *beta, - cuComplex *C, int ldc) - - Status cusparseZcsrmm2( - Handle handle, Operation transA, Operation transB, int m, int n, int k, - int nnz, const cuDoubleComplex *alpha, const MatDescr descrA, - const cuDoubleComplex *csrValA, - const int *csrRowPtrA, const int *csrColIndA, - const cuDoubleComplex *B, int ldb, const cuDoubleComplex *beta, - cuDoubleComplex *C, int ldc) - - Status cusparseCreateCsrsm2Info(csrsm2Info_t* info) - Status cusparseDestroyCsrsm2Info(csrsm2Info_t info) - - Status cusparseScsrsm2_bufferSizeExt( - Handle handle, int algo, Operation transA, Operation transB, int m, - int nrhs, int nnz, const float* alpha, const MatDescr descrA, - const float* csrSortedValA, const int* csrSortedRowPtrA, - const int* csrSortedColIndA, const float* B, - int ldb, csrsm2Info_t info, cusparseSolvePolicy_t policy, - size_t* pBufferSize) - Status cusparseDcsrsm2_bufferSizeExt( - Handle handle, int algo, Operation transA, Operation transB, int m, - int nrhs, int nnz, const double* alpha, const MatDescr descrA, - const double* csrSortedValA, const int* csrSortedRowPtrA, - const int* csrSortedColIndA, const double* B, - int ldb, csrsm2Info_t info, cusparseSolvePolicy_t policy, - size_t* pBufferSize) - Status cusparseCcsrsm2_bufferSizeExt( - Handle handle, int algo, Operation transA, Operation transB, int m, - int nrhs, int nnz, const cuComplex* alpha, const MatDescr descrA, - const cuComplex* csrSortedValA, const int* csrSortedRowPtrA, - const int* csrSortedColIndA, const cuComplex* B, - int ldb, csrsm2Info_t info, cusparseSolvePolicy_t policy, - size_t* pBufferSize) - Status cusparseZcsrsm2_bufferSizeExt( - Handle handle, int algo, Operation transA, Operation transB, int m, - int nrhs, int nnz, const cuDoubleComplex* alpha, const MatDescr descrA, - const cuDoubleComplex* csrSortedValA, const int* csrSortedRowPtrA, - const int* csrSortedColIndA, const cuDoubleComplex* B, - int ldb, csrsm2Info_t info, cusparseSolvePolicy_t policy, - size_t* pBufferSize) - - Status cusparseScsrsm2_analysis( - Handle handle, int algo, Operation transA, Operation transB, int m, - int nrhs, int nnz, const float* alpha, const MatDescr descrA, - const float* csrSortedValA, const int* csrSortedRowPtrA, - const int* csrSortedColIndA, const float* B, - int ldb, csrsm2Info_t info, cusparseSolvePolicy_t policy, - void* pBuffer) - Status cusparseDcsrsm2_analysis( - Handle handle, int algo, Operation transA, Operation transB, int m, - int nrhs, int nnz, const double* alpha, const MatDescr descrA, - const double* csrSortedValA, const int* csrSortedRowPtrA, - const int* csrSortedColIndA, const double* B, - int ldb, csrsm2Info_t info, cusparseSolvePolicy_t policy, - void* pBuffer) - Status cusparseCcsrsm2_analysis( - Handle handle, int algo, Operation transA, Operation transB, int m, - int nrhs, int nnz, const cuComplex* alpha, const MatDescr descrA, - const cuComplex* csrSortedValA, const int* csrSortedRowPtrA, - const int* csrSortedColIndA, const cuComplex* B, - int ldb, csrsm2Info_t info, cusparseSolvePolicy_t policy, - void* pBuffer) - Status cusparseZcsrsm2_analysis( - Handle handle, int algo, Operation transA, Operation transB, int m, - int nrhs, int nnz, const cuDoubleComplex* alpha, const MatDescr descrA, - const cuDoubleComplex* csrSortedValA, const int* csrSortedRowPtrA, - const int* csrSortedColIndA, const cuDoubleComplex* B, - int ldb, csrsm2Info_t info, cusparseSolvePolicy_t policy, - void* pBuffer) - - Status cusparseScsrsm2_solve( - Handle handle, int algo, Operation transA, Operation transB, int m, - int nrhs, int nnz, const float* alpha, const MatDescr descrA, - const float* csrSortedValA, const int* csrSortedRowPtrA, - const int* csrSortedColIndA, float* B, - int ldb, csrsm2Info_t info, cusparseSolvePolicy_t policy, - void* pBuffer) - Status cusparseDcsrsm2_solve( - Handle handle, int algo, Operation transA, Operation transB, int m, - int nrhs, int nnz, const double* alpha, const MatDescr descrA, - const double* csrSortedValA, const int* csrSortedRowPtrA, - const int* csrSortedColIndA, double* B, - int ldb, csrsm2Info_t info, cusparseSolvePolicy_t policy, - void* pBuffer) - Status cusparseCcsrsm2_solve( - Handle handle, int algo, Operation transA, Operation transB, int m, - int nrhs, int nnz, const cuComplex* alpha, const MatDescr descrA, - const cuComplex* csrSortedValA, const int* csrSortedRowPtrA, - const int* csrSortedColIndA, cuComplex* B, - int ldb, csrsm2Info_t info, cusparseSolvePolicy_t policy, - void* pBuffer) - Status cusparseZcsrsm2_solve( - Handle handle, int algo, Operation transA, Operation transB, int m, - int nrhs, int nnz, const cuDoubleComplex* alpha, const MatDescr descrA, - const cuDoubleComplex* csrSortedValA, const int* csrSortedRowPtrA, - const int* csrSortedColIndA, cuDoubleComplex* B, - int ldb, csrsm2Info_t info, cusparseSolvePolicy_t policy, - void* pBuffer) - - Status cusparseXcsrsm2_zeroPivot( - Handle handle, csrsm2Info_t info, int* position) - - # cuSPARSE Extra Function - Status cusparseXcsrgeamNnz( - Handle handle, int m, int n, const MatDescr descrA, int nnzA, - const int *csrRowPtrA, const int *csrColIndA, const MatDescr descrB, - int nnzB, const int *csrRowPtrB, const int *csrColIndB, - const MatDescr descrC, int *csrRowPtrC, int *nnzTotalDevHostPtr) - - Status cusparseScsrgeam( - Handle handle, int m, int n, const float *alpha, const MatDescr descrA, - int nnzA, const float *csrValA, const int *csrRowPtrA, - const int *csrColIndA, const float *beta, const MatDescr descrB, - int nnzB, const float *csrValB, const int *csrRowPtrB, - const int *csrColIndB, const MatDescr descrC, float *csrValC, - int *csrRowPtrC, int *csrColIndC) - - Status cusparseDcsrgeam( - Handle handle, int m, int n, const double *alpha, - const MatDescr descrA, - int nnzA, const double *csrValA, const int *csrRowPtrA, - const int *csrColIndA, const double *beta, const MatDescr descrB, - int nnzB, const double *csrValB, const int *csrRowPtrB, - const int *csrColIndB, const MatDescr descrC, double *csrValC, - int *csrRowPtrC, int *csrColIndC) - - Status cusparseCcsrgeam( - Handle handle, int m, int n, const cuComplex *alpha, - const MatDescr descrA, - int nnzA, const cuComplex *csrValA, const int *csrRowPtrA, - const int *csrColIndA, const cuComplex *beta, const MatDescr descrB, - int nnzB, const cuComplex *csrValB, const int *csrRowPtrB, - const int *csrColIndB, const MatDescr descrC, cuComplex *csrValC, - int *csrRowPtrC, int *csrColIndC) - - Status cusparseZcsrgeam( - Handle handle, int m, int n, const cuDoubleComplex *alpha, - const MatDescr descrA, - int nnzA, const cuDoubleComplex *csrValA, const int *csrRowPtrA, - const int *csrColIndA, const cuDoubleComplex *beta, - const MatDescr descrB, - int nnzB, const cuDoubleComplex *csrValB, const int *csrRowPtrB, - const int *csrColIndB, const MatDescr descrC, - cuDoubleComplex *csrValC, int *csrRowPtrC, int *csrColIndC) - - Status cusparseScsrgeam2_bufferSizeExt( - Handle handle, int m, int n, const float *alpha, const MatDescr descrA, - int nnzA, const float *csrValA, const int *csrRowPtrA, - const int *csrColIndA, const float *beta, const MatDescr descrB, - int nnzB, const float *csrValB, const int *csrRowPtrB, - const int *csrColIndB, const MatDescr descrC, float *csrValC, - int *csrRowPtrC, int *csrColIndC, size_t *pBufferSize) - - Status cusparseDcsrgeam2_bufferSizeExt( - Handle handle, int m, int n, const double *alpha, - const MatDescr descrA, - int nnzA, const double *csrValA, const int *csrRowPtrA, - const int *csrColIndA, const double *beta, const MatDescr descrB, - int nnzB, const double *csrValB, const int *csrRowPtrB, - const int *csrColIndB, const MatDescr descrC, double *csrValC, - int *csrRowPtrC, int *csrColIndC, size_t *pBufferSize) - - Status cusparseCcsrgeam2_bufferSizeExt( - Handle handle, int m, int n, const cuComplex *alpha, - const MatDescr descrA, - int nnzA, const cuComplex *csrValA, const int *csrRowPtrA, - const int *csrColIndA, const cuComplex *beta, const MatDescr descrB, - int nnzB, const cuComplex *csrValB, const int *csrRowPtrB, - const int *csrColIndB, const MatDescr descrC, cuComplex *csrValC, - int *csrRowPtrC, int *csrColIndC, size_t *pBufferSize) - - Status cusparseZcsrgeam2_bufferSizeExt( - Handle handle, int m, int n, const cuDoubleComplex *alpha, - const MatDescr descrA, - int nnzA, const cuDoubleComplex *csrValA, const int *csrRowPtrA, - const int *csrColIndA, const cuDoubleComplex *beta, - const MatDescr descrB, - int nnzB, const cuDoubleComplex *csrValB, const int *csrRowPtrB, - const int *csrColIndB, const MatDescr descrC, - cuDoubleComplex *csrValC, int *csrRowPtrC, int *csrColIndC, - size_t *pBufferSize) - - Status cusparseXcsrgeam2Nnz( - Handle handle, int m, int n, const MatDescr descrA, int nnzA, - const int *csrRowPtrA, const int *csrColIndA, const MatDescr descrB, - int nnzB, const int *csrRowPtrB, const int *csrColIndB, - const MatDescr descrC, int *csrRowPtrC, int *nnzTotalDevHostPtr, - void *workspace) - - Status cusparseScsrgeam2( - Handle handle, int m, int n, const float *alpha, const MatDescr descrA, - int nnzA, const float *csrValA, const int *csrRowPtrA, - const int *csrColIndA, const float *beta, const MatDescr descrB, - int nnzB, const float *csrValB, const int *csrRowPtrB, - const int *csrColIndB, const MatDescr descrC, float *csrValC, - int *csrRowPtrC, int *csrColIndC, void *pBuffer) - - Status cusparseDcsrgeam2( - Handle handle, int m, int n, const double *alpha, - const MatDescr descrA, - int nnzA, const double *csrValA, const int *csrRowPtrA, - const int *csrColIndA, const double *beta, const MatDescr descrB, - int nnzB, const double *csrValB, const int *csrRowPtrB, - const int *csrColIndB, const MatDescr descrC, double *csrValC, - int *csrRowPtrC, int *csrColIndC, void *pBuffer) - - Status cusparseCcsrgeam2( - Handle handle, int m, int n, const cuComplex *alpha, - const MatDescr descrA, - int nnzA, const cuComplex *csrValA, const int *csrRowPtrA, - const int *csrColIndA, const cuComplex *beta, const MatDescr descrB, - int nnzB, const cuComplex *csrValB, const int *csrRowPtrB, - const int *csrColIndB, const MatDescr descrC, cuComplex *csrValC, - int *csrRowPtrC, int *csrColIndC, void *pBuffer) - - Status cusparseZcsrgeam2( - Handle handle, int m, int n, const cuDoubleComplex *alpha, - const MatDescr descrA, - int nnzA, const cuDoubleComplex *csrValA, const int *csrRowPtrA, - const int *csrColIndA, const cuDoubleComplex *beta, - const MatDescr descrB, - int nnzB, const cuDoubleComplex *csrValB, const int *csrRowPtrB, - const int *csrColIndB, const MatDescr descrC, - cuDoubleComplex *csrValC, int *csrRowPtrC, int *csrColIndC, - void *pBuffer) - - Status cusparseXcsrgemmNnz( - Handle handle, Operation transA, Operation transB, int m, int n, int k, - const MatDescr descrA, const int nnzA, const int *csrRowPtrA, - const int *csrColIndA, const MatDescr descrB, const int nnzB, - const int *csrRowPtrB, const int *csrColIndB, - const MatDescr descrC, int *csrRowPtrC, int *nnzTotalDevHostPtr) - - Status cusparseScsrgemm( - Handle handle, Operation transA, Operation transB, int m, int n, int k, - const MatDescr descrA, const int nnzA, const float *csrValA, - const int *csrRowPtrA, const int *csrColIndA, const MatDescr descrB, - const int nnzB, const float *csrValB, const int *csrRowPtrB, - const int *csrColIndB, const MatDescr descrC, float *csrValC, - const int *csrRowPtrC, int *csrColIndC) - - Status cusparseDcsrgemm( - Handle handle, Operation transA, Operation transB, int m, int n, int k, - const MatDescr descrA, const int nnzA, const double *csrValA, - const int *csrRowPtrA, const int *csrColIndA, const MatDescr descrB, - const int nnzB, const double *csrValB, const int *csrRowPtrB, - const int *csrColIndB, const MatDescr descrC, double *csrValC, - const int *csrRowPtrC, int *csrColIndC) - - Status cusparseCcsrgemm( - Handle handle, Operation transA, Operation transB, int m, int n, int k, - const MatDescr descrA, const int nnzA, const cuComplex *csrValA, - const int *csrRowPtrA, const int *csrColIndA, const MatDescr descrB, - const int nnzB, const cuComplex *csrValB, const int *csrRowPtrB, - const int *csrColIndB, const MatDescr descrC, cuComplex *csrValC, - const int *csrRowPtrC, int *csrColIndC) - - Status cusparseZcsrgemm( - Handle handle, Operation transA, Operation transB, int m, int n, int k, - const MatDescr descrA, const int nnzA, const cuDoubleComplex *csrValA, - const int *csrRowPtrA, const int *csrColIndA, const MatDescr descrB, - const int nnzB, const cuDoubleComplex *csrValB, const int *csrRowPtrB, - const int *csrColIndB, const MatDescr descrC, cuDoubleComplex *csrValC, - const int *csrRowPtrC, int *csrColIndC) - - cusparseStatus_t cusparseCreateCsrgemm2Info(csrgemm2Info_t *info) - cusparseStatus_t cusparseDestroyCsrgemm2Info(csrgemm2Info_t info) - - Status cusparseScsrgemm2_bufferSizeExt( - Handle handle, int m, int n, int k, const float *alpha, - const MatDescr descrA, int nnzA, const int *csrRowPtrA, - const int *csrColIndA, const MatDescr descrB, int nnzB, - const int *csrRowPtrB, const int *csrColIndB, const float *beta, - const MatDescr descrD, int nnzD, const int *csrRowPtrD, - const int *csrColIndD, const csrgemm2Info_t info, size_t* pBufferSize) - - Status cusparseDcsrgemm2_bufferSizeExt( - Handle handle, int m, int n, int k, const double *alpha, - const MatDescr descrA, int nnzA, const int *csrRowPtrA, - const int *csrColIndA, const MatDescr descrB, int nnzB, - const int *csrRowPtrB, const int *csrColIndB, const double *beta, - const MatDescr descrD, int nnzD, const int *csrRowPtrD, - const int *csrColIndD, const csrgemm2Info_t info, size_t* pBufferSize) - - Status cusparseCcsrgemm2_bufferSizeExt( - Handle handle, int m, int n, int k, const cuComplex *alpha, - const MatDescr descrA, int nnzA, const int *csrRowPtrA, - const int *csrColIndA, const MatDescr descrB, int nnzB, - const int *csrRowPtrB, const int *csrColIndB, const cuComplex *beta, - const MatDescr descrD, int nnzD, const int *csrRowPtrD, - const int *csrColIndD, const csrgemm2Info_t info, size_t* pBufferSize) - - Status cusparseZcsrgemm2_bufferSizeExt( - Handle handle, int m, int n, int k, const cuDoubleComplex *alpha, - const MatDescr descrA, int nnzA, const int *csrRowPtrA, - const int *csrColIndA, const MatDescr descrB, int nnzB, - const int *csrRowPtrB, const int *csrColIndB, - const cuDoubleComplex *beta, const MatDescr descrD, int nnzD, - const int *csrRowPtrD, const int *csrColIndD, - const csrgemm2Info_t info, size_t* pBufferSize) - - Status cusparseXcsrgemm2Nnz( - Handle handle, int m, int n, int k, const MatDescr descrA, int nnzA, - const int *csrRowPtrA, const int *csrColIndA, const MatDescr descrB, - int nnzB, const int *csrRowPtrB, const int *csrColIndB, - const MatDescr descrD, int nnzD, const int *csrRowPtrD, - const int *csrColIndD, const MatDescr descrC, int *csrRowPtrC, - int *nnzTotalDevHostPtr, const csrgemm2Info_t info, void* pBuffer) - - Status cusparseScsrgemm2( - Handle handle, int m, int n, int k, const float *alpha, - const MatDescr descrA, int nnzA, const float *csrValA, - const int *csrRowPtrA, const int *csrColIndA, const MatDescr descrB, - int nnzB, const float *csrValB, const int *csrRowPtrB, - const int *csrColIndB, const float *beta, const MatDescr descrD, - int nnzD, const float *csrValD, const int *csrRowPtrD, - const int *csrColIndD, const MatDescr descrC, float *csrValC, - const int *csrRowPtrC, int *csrColIndC, const csrgemm2Info_t info, - void* pBuffer) - - Status cusparseDcsrgemm2( - Handle handle, int m, int n, int k, const double *alpha, - const MatDescr descrA, int nnzA, const double *csrValA, - const int *csrRowPtrA, const int *csrColIndA, const MatDescr descrB, - int nnzB, const double *csrValB, const int *csrRowPtrB, - const int *csrColIndB, const double *beta, const MatDescr descrD, - int nnzD, const double *csrValD, const int *csrRowPtrD, - const int *csrColIndD, const MatDescr descrC, double *csrValC, - const int *csrRowPtrC, int *csrColIndC, const csrgemm2Info_t info, - void* pBuffer) - - Status cusparseCcsrgemm2( - Handle handle, int m, int n, int k, const cuComplex *alpha, - const MatDescr descrA, int nnzA, const cuComplex *csrValA, - const int *csrRowPtrA, const int *csrColIndA, const MatDescr descrB, - int nnzB, const cuComplex *csrValB, const int *csrRowPtrB, - const int *csrColIndB, const cuComplex *beta, const MatDescr descrD, - int nnzD, const cuComplex *csrValD, const int *csrRowPtrD, - const int *csrColIndD, const MatDescr descrC, cuComplex *csrValC, - const int *csrRowPtrC, int *csrColIndC, const csrgemm2Info_t info, - void* pBuffer) - - Status cusparseZcsrgemm2( - Handle handle, int m, int n, int k, const cuDoubleComplex *alpha, - const MatDescr descrA, int nnzA, const cuDoubleComplex *csrValA, - const int *csrRowPtrA, const int *csrColIndA, const MatDescr descrB, - int nnzB, const cuDoubleComplex *csrValB, const int *csrRowPtrB, - const int *csrColIndB, const cuDoubleComplex *beta, - const MatDescr descrD, int nnzD, const cuDoubleComplex *csrValD, - const int *csrRowPtrD, const int *csrColIndD, const MatDescr descrC, - cuDoubleComplex *csrValC, const int *csrRowPtrC, int *csrColIndC, - const csrgemm2Info_t info, void* pBuffer) - - # cuSPARSE Format Convrsion - Status cusparseXcoo2csr( - Handle handle, const int *cooRowInd, int nnz, int m, int *csrRowPtr, - IndexBase idxBase) - - Status cusparseScsc2dense( - Handle handle, int m, int n, const MatDescr descrA, - const float *cscSortedValA, const int *cscSortedRowIndA, - const int *cscSortedColPtrA, float *A, int lda) - - Status cusparseDcsc2dense( - Handle handle, int m, int n, const MatDescr descrA, - const double *cscSortedValA, const int *cscSortedRowIndA, - const int *cscSortedColPtrA, double *A, int lda) - - Status cusparseCcsc2dense( - Handle handle, int m, int n, const MatDescr descrA, - const cuComplex *cscSortedValA, const int *cscSortedRowIndA, - const int *cscSortedColPtrA, cuComplex *A, int lda) - - Status cusparseZcsc2dense( - Handle handle, int m, int n, const MatDescr descrA, - const cuDoubleComplex *cscSortedValA, const int *cscSortedRowIndA, - const int *cscSortedColPtrA, cuDoubleComplex *A, int lda) - - Status cusparseXcsr2coo( - Handle handle, const int *csrRowPtr, int nnz, int m, int *cooRowInd, - IndexBase idxBase) - - Status cusparseScsr2csc( - Handle handle, int m, int n, int nnz, const float *csrVal, - const int *csrRowPtr, const int *csrColInd, float *cscVal, - int *cscRowInd, int *cscColPtr, Action copyValues, IndexBase idxBase) - - Status cusparseDcsr2csc( - Handle handle, int m, int n, int nnz, const double *csrVal, - const int *csrRowPtr, const int *csrColInd, double *cscVal, - int *cscRowInd, int *cscColPtr, Action copyValues, IndexBase idxBase) - - Status cusparseCcsr2csc( - Handle handle, int m, int n, int nnz, const cuComplex *csrVal, - const int *csrRowPtr, const int *csrColInd, cuComplex *cscVal, - int *cscRowInd, int *cscColPtr, Action copyValues, IndexBase idxBase) - - Status cusparseZcsr2csc( - Handle handle, int m, int n, int nnz, const cuDoubleComplex *csrVal, - const int *csrRowPtr, const int *csrColInd, cuDoubleComplex *cscVal, - int *cscRowInd, int *cscColPtr, Action copyValues, IndexBase idxBase) - - Status cusparseScsr2dense( - Handle handle, int m, int n, const MatDescr descrA, - const float *csrSortedValA, const int *csrSortedRowPtrA, - const int *csrSortedColIndA, float *A, int lda) - - Status cusparseDcsr2dense( - Handle handle, int m, int n, const MatDescr descrA, - const double *csrSortedValA, const int *csrSortedRowPtrA, - const int *csrSortedColIndA, double *A, int lda) - - Status cusparseCcsr2dense( - Handle handle, int m, int n, const MatDescr descrA, - const cuComplex *csrSortedValA, const int *csrSortedRowPtrA, - const int *csrSortedColIndA, cuComplex *A, int lda) - - Status cusparseZcsr2dense( - Handle handle, int m, int n, const MatDescr descrA, - const cuDoubleComplex *csrSortedValA, const int *csrSortedRowPtrA, - const int *csrSortedColIndA, cuDoubleComplex *A, int lda) - - Status cusparseSnnz_compress( - Handle handle, int m, const MatDescr descr, - const float *values, const int *rowPtr, int *nnzPerRow, - int *nnzTotal, float tol) - - Status cusparseDnnz_compress( - Handle handle, int m, const MatDescr descr, - const double *values, const int *rowPtr, int *nnzPerRow, - int *nnzTotal, double tol) - - Status cusparseCnnz_compress( - Handle handle, int m, const MatDescr descr, - const cuComplex *values, const int *rowPtr, int *nnzPerRow, - int *nnzTotal, cuComplex tol) - - Status cusparseZnnz_compress( - Handle handle, int m, const MatDescr descr, - const cuDoubleComplex *values, const int *rowPtr, int *nnzPerRow, - int *nnzTotal, cuDoubleComplex tol) - - Status cusparseScsr2csr_compress( - Handle handle, int m, int n, const MatDescr descrA, - const float *inVal, const int *inColInd, const int *inRowPtr, - int inNnz, int *nnzPerRow, float *outVal, int *outColInd, - int *outRowPtr, float tol) - - Status cusparseDcsr2csr_compress( - Handle handle, int m, int n, const MatDescr descrA, - const double *inVal, const int *inColInd, const int *inRowPtr, - int inNnz, int *nnzPerRow, double *outVal, int *outColInd, - int *outRowPtr, double tol) - - Status cusparseCcsr2csr_compress( - Handle handle, int m, int n, const MatDescr descrA, - const cuComplex *inVal, const int *inColInd, const int *inRowPtr, - int inNnz, int *nnzPerRow, cuComplex *outVal, int *outColInd, - int *outRowPtr, cuComplex tol) - - Status cusparseZcsr2csr_compress( - Handle handle, int m, int n, const MatDescr descrA, - const cuDoubleComplex *inVal, const int *inColInd, const int *inRowPtr, - int inNnz, int *nnzPerRow, cuDoubleComplex *outVal, int *outColInd, - int *outRowPtr, cuDoubleComplex tol) - - Status cusparseSdense2csc( - Handle handle, int m, int n, const MatDescr descrA, const float *A, - int lda, const int *nnzPerCol, float *cscValA, int *cscRowIndA, - int *cscColPtrA) - - Status cusparseDdense2csc( - Handle handle, int m, int n, const MatDescr descrA, const double *A, - int lda, const int *nnzPerCol, double *cscValA, int *cscRowIndA, - int *cscColPtrA) - - Status cusparseCdense2csc( - Handle handle, int m, int n, const MatDescr descrA, const cuComplex *A, - int lda, const int *nnzPerCol, cuComplex *cscValA, int *cscRowIndA, - int *cscColPtrA) - - Status cusparseZdense2csc( - Handle handle, int m, int n, const MatDescr descrA, - const cuDoubleComplex *A, - int lda, const int *nnzPerCol, cuDoubleComplex *cscValA, - int *cscRowIndA, int *cscColPtrA) - - Status cusparseSdense2csr( - Handle handle, int m, int n, const MatDescr descrA, - const float *A, int lda, const int *nnzPerRow, float *csrValA, - int *csrRowPtrA, int *csrColIndA) - - Status cusparseDdense2csr( - Handle handle, int m, int n, const MatDescr descrA, - const double *A, int lda, const int *nnzPerRow, double *csrValA, - int *csrRowPtrA, int *csrColIndA) - - Status cusparseCdense2csr( - Handle handle, int m, int n, const MatDescr descrA, - const cuComplex *A, int lda, const int *nnzPerRow, cuComplex *csrValA, - int *csrRowPtrA, int *csrColIndA) - - Status cusparseZdense2csr( - Handle handle, int m, int n, const MatDescr descrA, - const cuDoubleComplex *A, int lda, const int *nnzPerRow, - cuDoubleComplex *csrValA, - int *csrRowPtrA, int *csrColIndA) - - Status cusparseSnnz( - Handle handle, Direction dirA, int m, int n, const MatDescr descrA, - const float *A, int lda, int *nnzPerRowColumn, int *nnzTotalDevHostPtr) - - Status cusparseDnnz( - Handle handle, Direction dirA, int m, int n, const MatDescr descrA, - const double *A, int lda, int *nnzPerRowColumn, - int *nnzTotalDevHostPtr) - - Status cusparseCnnz( - Handle handle, Direction dirA, int m, int n, const MatDescr descrA, - const cuComplex *A, int lda, int *nnzPerRowColumn, - int *nnzTotalDevHostPtr) - - Status cusparseZnnz( - Handle handle, Direction dirA, int m, int n, const MatDescr descrA, - const cuDoubleComplex *A, int lda, int *nnzPerRowColumn, - int *nnzTotalDevHostPtr) - - Status cusparseCreateIdentityPermutation( - Handle handle, int n, int *p) - - Status cusparseXcoosort_bufferSizeExt( - Handle handle, int m, int n, int nnz, const int *cooRows, - const int *cooCols, size_t *pBufferSizeInBytes) - - Status cusparseXcoosortByRow( - Handle handle, int m, int n, int nnz, int *cooRows, int *cooCols, - int *P, void *pBuffer) - - Status cusparseXcoosortByColumn( - Handle handle, int m, int n, int nnz, int *cooRows, int *cooCols, - int *P, void *pBuffer) - - Status cusparseXcsrsort_bufferSizeExt( - Handle handle, int m, int n, int nnz, const int *csrRowPtr, - const int *csrColInd, size_t *pBufferSizeInBytes) - - Status cusparseXcsrsort( - Handle handle, int m, int n, int nnz, const MatDescr descrA, - const int *csrRowPtr, int *csrColInd, int *P, void *pBuffer) - - Status cusparseXcscsort_bufferSizeExt( - Handle handle, int m, int n, int nnz, const int *cscColPtr, - const int *cscRowInd, size_t *pBufferSizeInBytes) - - Status cusparseXcscsort( - Handle handle, int m, int n, int nnz, const MatDescr descrA, - const int *cscColPtr, int *cscRowInd, int *P, void *pBuffer) - - # cuSparse PRECONDITIONERS - cusparseStatus_t cusparseCreateCsrilu02Info(csrilu02Info_t *info) - cusparseStatus_t cusparseDestroyCsrilu02Info(csrilu02Info_t info) - cusparseStatus_t cusparseCreateBsrilu02Info(bsrilu02Info_t *info) - cusparseStatus_t cusparseDestroyBsrilu02Info(bsrilu02Info_t info) - cusparseStatus_t cusparseCreateCsric02Info(csric02Info_t *info) - cusparseStatus_t cusparseDestroyCsric02Info(csric02Info_t info) - cusparseStatus_t cusparseCreateBsric02Info(bsric02Info_t *info) - cusparseStatus_t cusparseDestroyBsric02Info(bsric02Info_t info) - cusparseStatus_t cusparseScsrilu02_numericBoost( - cusparseHandle_t handle, csrilu02Info_t info, int enable_boost, - double *tol, float *boost_val) - cusparseStatus_t cusparseDcsrilu02_numericBoost( - cusparseHandle_t handle, csrilu02Info_t info, int enable_boost, - double *tol, double *boost_val) - cusparseStatus_t cusparseCcsrilu02_numericBoost( - cusparseHandle_t handle, csrilu02Info_t info, int enable_boost, - double *tol, cuComplex *boost_val) - cusparseStatus_t cusparseZcsrilu02_numericBoost( - cusparseHandle_t handle, csrilu02Info_t info, int enable_boost, - double *tol, cuDoubleComplex *boost_val) - cusparseStatus_t cusparseXcsrilu02_zeroPivot( - cusparseHandle_t handle, csrilu02Info_t info, int *position) - cusparseStatus_t cusparseScsrilu02_bufferSize( - cusparseHandle_t handle, int m, int nnz, - const cusparseMatDescr_t descrA, float *csrSortedValA, - const int *csrSortedRowPtrA, const int *csrSortedColIndA, - csrilu02Info_t info, int *pBufferSizeInBytes) - cusparseStatus_t cusparseDcsrilu02_bufferSize( - cusparseHandle_t handle, int m, int nnz, - const cusparseMatDescr_t descrA, double *csrSortedValA, - const int *csrSortedRowPtrA, const int *csrSortedColIndA, - csrilu02Info_t info, int *pBufferSizeInBytes) - cusparseStatus_t cusparseCcsrilu02_bufferSize( - cusparseHandle_t handle, int m, int nnz, - const cusparseMatDescr_t descrA, cuComplex *csrSortedValA, - const int *csrSortedRowPtrA, const int *csrSortedColIndA, - csrilu02Info_t info, int *pBufferSizeInBytes) - cusparseStatus_t cusparseZcsrilu02_bufferSize( - cusparseHandle_t handle, int m, int nnz, - const cusparseMatDescr_t descrA, cuDoubleComplex *csrSortedValA, - const int *csrSortedRowPtrA, const int *csrSortedColIndA, - csrilu02Info_t info, int *pBufferSizeInBytes) - cusparseStatus_t cusparseScsrilu02_analysis( - cusparseHandle_t handle, int m, int nnz, - const cusparseMatDescr_t descrA, const float *csrSortedValA, - const int *csrSortedRowPtrA, const int *csrSortedColIndA, - csrilu02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) - cusparseStatus_t cusparseDcsrilu02_analysis( - cusparseHandle_t handle, int m, int nnz, - const cusparseMatDescr_t descrA, const double *csrSortedValA, - const int *csrSortedRowPtrA, const int *csrSortedColIndA, - csrilu02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) - cusparseStatus_t cusparseCcsrilu02_analysis( - cusparseHandle_t handle, int m, int nnz, - const cusparseMatDescr_t descrA, const cuComplex *csrSortedValA, - const int *csrSortedRowPtrA, const int *csrSortedColIndA, - csrilu02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) - cusparseStatus_t cusparseZcsrilu02_analysis( - cusparseHandle_t handle, int m, int nnz, - const cusparseMatDescr_t descrA, const cuDoubleComplex *csrSortedValA, - const int *csrSortedRowPtrA, const int *csrSortedColIndA, - csrilu02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) - cusparseStatus_t cusparseScsrilu02( - cusparseHandle_t handle, int m, int nnz, - const cusparseMatDescr_t descrA, float *csrSortedValA_valM, - const int *csrSortedRowPtrA, const int *csrSortedColIndA, - csrilu02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) - cusparseStatus_t cusparseDcsrilu02( - cusparseHandle_t handle, int m, int nnz, - const cusparseMatDescr_t descrA, double *csrSortedValA_valM, - const int *csrSortedRowPtrA, const int *csrSortedColIndA, - csrilu02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) - cusparseStatus_t cusparseCcsrilu02( - cusparseHandle_t handle, int m, int nnz, - const cusparseMatDescr_t descrA, cuComplex *csrSortedValA_valM, - const int *csrSortedRowPtrA, const int *csrSortedColIndA, - csrilu02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) - cusparseStatus_t cusparseZcsrilu02( - cusparseHandle_t handle, int m, int nnz, - const cusparseMatDescr_t descrA, cuDoubleComplex *csrSortedValA_valM, - const int *csrSortedRowPtrA, const int *csrSortedColIndA, - csrilu02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) - cusparseStatus_t cusparseSbsrilu02_numericBoost( - cusparseHandle_t handle, bsrilu02Info_t info, int enable_boost, - double *tol, float *boost_val) - cusparseStatus_t cusparseDbsrilu02_numericBoost( - cusparseHandle_t handle, bsrilu02Info_t info, int enable_boost, - double *tol, double *boost_val) - cusparseStatus_t cusparseCbsrilu02_numericBoost( - cusparseHandle_t handle, bsrilu02Info_t info, int enable_boost, - double *tol, cuComplex *boost_val) - cusparseStatus_t cusparseZbsrilu02_numericBoost( - cusparseHandle_t handle, bsrilu02Info_t info, int enable_boost, - double *tol, cuDoubleComplex *boost_val) - cusparseStatus_t cusparseXbsrilu02_zeroPivot( - cusparseHandle_t handle, bsrilu02Info_t info, int *position) - cusparseStatus_t cusparseSbsrilu02_bufferSize( - cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, - const cusparseMatDescr_t descrA, float *bsrSortedVal, - const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, - bsrilu02Info_t info, int *pBufferSizeInBytes) - cusparseStatus_t cusparseDbsrilu02_bufferSize( - cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, - const cusparseMatDescr_t descrA, double *bsrSortedVal, - const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, - bsrilu02Info_t info, int *pBufferSizeInBytes) - cusparseStatus_t cusparseCbsrilu02_bufferSize( - cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, - const cusparseMatDescr_t descrA, cuComplex *bsrSortedVal, - const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, - bsrilu02Info_t info, int *pBufferSizeInBytes) - cusparseStatus_t cusparseZbsrilu02_bufferSize( - cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, - const cusparseMatDescr_t descrA, cuDoubleComplex *bsrSortedVal, - const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, - bsrilu02Info_t info, int *pBufferSizeInBytes) - cusparseStatus_t cusparseSbsrilu02_analysis( - cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, - const cusparseMatDescr_t descrA, float *bsrSortedVal, - const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, - bsrilu02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) - cusparseStatus_t cusparseDbsrilu02_analysis( - cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, - const cusparseMatDescr_t descrA, double *bsrSortedVal, - const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, - bsrilu02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) - cusparseStatus_t cusparseCbsrilu02_analysis( - cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, - const cusparseMatDescr_t descrA, cuComplex *bsrSortedVal, - const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, - bsrilu02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) - cusparseStatus_t cusparseZbsrilu02_analysis( - cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, - const cusparseMatDescr_t descrA, cuDoubleComplex *bsrSortedVal, - const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, - bsrilu02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) - cusparseStatus_t cusparseSbsrilu02( - cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, - const cusparseMatDescr_t descrA, float *bsrSortedVal, - const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, - bsrilu02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) - cusparseStatus_t cusparseDbsrilu02( - cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, - const cusparseMatDescr_t descrA, double *bsrSortedVal, - const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, - bsrilu02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) - cusparseStatus_t cusparseCbsrilu02( - cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, - const cusparseMatDescr_t descrA, cuComplex *bsrSortedVal, - const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, - bsrilu02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) - cusparseStatus_t cusparseZbsrilu02( - cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, - const cusparseMatDescr_t descrA, cuDoubleComplex *bsrSortedVal, - const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, - bsrilu02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) - cusparseStatus_t cusparseXcsric02_zeroPivot( - cusparseHandle_t handle, csric02Info_t info, int *position) - cusparseStatus_t cusparseScsric02_bufferSize( - cusparseHandle_t handle, int m, int nnz, - const cusparseMatDescr_t descrA, float *csrSortedValA, - const int *csrSortedRowPtrA, const int *csrSortedColIndA, - csric02Info_t info, int *pBufferSizeInBytes) - cusparseStatus_t cusparseDcsric02_bufferSize( - cusparseHandle_t handle, int m, int nnz, - const cusparseMatDescr_t descrA, double *csrSortedValA, - const int *csrSortedRowPtrA, const int *csrSortedColIndA, - csric02Info_t info, int *pBufferSizeInBytes) - cusparseStatus_t cusparseCcsric02_bufferSize( - cusparseHandle_t handle, int m, int nnz, - const cusparseMatDescr_t descrA, cuComplex *csrSortedValA, - const int *csrSortedRowPtrA, const int *csrSortedColIndA, - csric02Info_t info, int *pBufferSizeInBytes) - cusparseStatus_t cusparseZcsric02_bufferSize( - cusparseHandle_t handle, int m, int nnz, - const cusparseMatDescr_t descrA, cuDoubleComplex *csrSortedValA, - const int *csrSortedRowPtrA, const int *csrSortedColIndA, - csric02Info_t info, int *pBufferSizeInBytes) - cusparseStatus_t cusparseScsric02_analysis( - cusparseHandle_t handle, int m, int nnz, - const cusparseMatDescr_t descrA, const float *csrSortedValA, - const int *csrSortedRowPtrA, const int *csrSortedColIndA, - csric02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) - cusparseStatus_t cusparseDcsric02_analysis( - cusparseHandle_t handle, int m, int nnz, - const cusparseMatDescr_t descrA, const double *csrSortedValA, - const int *csrSortedRowPtrA, const int *csrSortedColIndA, - csric02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) - cusparseStatus_t cusparseCcsric02_analysis( - cusparseHandle_t handle, int m, int nnz, - const cusparseMatDescr_t descrA, const cuComplex *csrSortedValA, - const int *csrSortedRowPtrA, const int *csrSortedColIndA, - csric02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) - cusparseStatus_t cusparseZcsric02_analysis( - cusparseHandle_t handle, int m, int nnz, - const cusparseMatDescr_t descrA, const cuDoubleComplex *csrSortedValA, - const int *csrSortedRowPtrA, const int *csrSortedColIndA, - csric02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) - cusparseStatus_t cusparseScsric02( - cusparseHandle_t handle, int m, int nnz, - const cusparseMatDescr_t descrA, float *csrSortedValA_valM, - const int *csrSortedRowPtrA, const int *csrSortedColIndA, - csric02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) - cusparseStatus_t cusparseDcsric02( - cusparseHandle_t handle, int m, int nnz, - const cusparseMatDescr_t descrA, double *csrSortedValA_valM, - const int *csrSortedRowPtrA, const int *csrSortedColIndA, - csric02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) - cusparseStatus_t cusparseCcsric02( - cusparseHandle_t handle, int m, int nnz, - const cusparseMatDescr_t descrA, cuComplex *csrSortedValA_valM, - const int *csrSortedRowPtrA, const int *csrSortedColIndA, - csric02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) - cusparseStatus_t cusparseZcsric02( - cusparseHandle_t handle, int m, int nnz, - const cusparseMatDescr_t descrA, cuDoubleComplex *csrSortedValA_valM, - const int *csrSortedRowPtrA, const int *csrSortedColIndA, - csric02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) - cusparseStatus_t cusparseXbsric02_zeroPivot( - cusparseHandle_t handle, bsric02Info_t info, int *position) - cusparseStatus_t cusparseSbsric02_bufferSize( - cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, - const cusparseMatDescr_t descrA, float *bsrSortedVal, - const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, - bsric02Info_t info, int *pBufferSizeInBytes) - cusparseStatus_t cusparseDbsric02_bufferSize( - cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, - const cusparseMatDescr_t descrA, double *bsrSortedVal, - const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, - bsric02Info_t info, int *pBufferSizeInBytes) - cusparseStatus_t cusparseCbsric02_bufferSize( - cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, - const cusparseMatDescr_t descrA, cuComplex *bsrSortedVal, - const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, - bsric02Info_t info, int *pBufferSizeInBytes) - cusparseStatus_t cusparseZbsric02_bufferSize( - cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, - const cusparseMatDescr_t descrA, cuDoubleComplex *bsrSortedVal, - const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, - bsric02Info_t info, int *pBufferSizeInBytes) - cusparseStatus_t cusparseSbsric02_analysis( - cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, - const cusparseMatDescr_t descrA, const float *bsrSortedVal, - const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, - bsric02Info_t info, cusparseSolvePolicy_t policy, void *pInputBuffer) - cusparseStatus_t cusparseDbsric02_analysis( - cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, - const cusparseMatDescr_t descrA, const double *bsrSortedVal, - const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, - bsric02Info_t info, cusparseSolvePolicy_t policy, void *pInputBuffer) - cusparseStatus_t cusparseCbsric02_analysis( - cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, - const cusparseMatDescr_t descrA, const cuComplex *bsrSortedVal, - const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, - bsric02Info_t info, cusparseSolvePolicy_t policy, void *pInputBuffer) - cusparseStatus_t cusparseZbsric02_analysis( - cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, - const cusparseMatDescr_t descrA, const cuDoubleComplex *bsrSortedVal, - const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, - bsric02Info_t info, cusparseSolvePolicy_t policy, void *pInputBuffer) - cusparseStatus_t cusparseSbsric02( - cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, - const cusparseMatDescr_t descrA, float *bsrSortedVal, - const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, - bsric02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) - cusparseStatus_t cusparseDbsric02( - cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, - const cusparseMatDescr_t descrA, double *bsrSortedVal, - const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, - bsric02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) - cusparseStatus_t cusparseCbsric02( - cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, - const cusparseMatDescr_t descrA, cuComplex *bsrSortedVal, - const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, - bsric02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) - cusparseStatus_t cusparseZbsric02( - cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, - const cusparseMatDescr_t descrA, cuDoubleComplex *bsrSortedVal, - const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, - bsric02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) - cusparseStatus_t cusparseSgtsv2_bufferSizeExt( - cusparseHandle_t handle, int m, int n, const float *dl, const float *d, - const float *du, const float *B, int ldb, size_t *bufferSizeInBytes) - cusparseStatus_t cusparseDgtsv2_bufferSizeExt( - cusparseHandle_t handle, int m, int n, const double *dl, - const double *d, const double *du, const double *B, int ldb, - size_t *bufferSizeInBytes) - cusparseStatus_t cusparseCgtsv2_bufferSizeExt( - cusparseHandle_t handle, int m, int n, const cuComplex *dl, - const cuComplex *d, const cuComplex *du, const cuComplex *B, int ldb, - size_t *bufferSizeInBytes) - cusparseStatus_t cusparseZgtsv2_bufferSizeExt( - cusparseHandle_t handle, int m, int n, const cuDoubleComplex *dl, - const cuDoubleComplex *d, const cuDoubleComplex *du, - const cuDoubleComplex *B, int ldb, size_t *bufferSizeInBytes) - cusparseStatus_t cusparseSgtsv2( - cusparseHandle_t handle, int m, int n, const float *dl, const float *d, - const float *du, float *B, int ldb, void *pBuffer) - cusparseStatus_t cusparseDgtsv2( - cusparseHandle_t handle, int m, int n, const double *dl, - const double *d, const double *du, double *B, int ldb, void *pBuffer) - cusparseStatus_t cusparseCgtsv2(cusparseHandle_t handle, int m, int n, - const cuComplex *dl, const cuComplex *d, - const cuComplex *du, cuComplex *B, int ldb, - void *pBuffer) - cusparseStatus_t cusparseZgtsv2( - cusparseHandle_t handle, int m, int n, const cuDoubleComplex *dl, - const cuDoubleComplex *d, const cuDoubleComplex *du, - cuDoubleComplex *B, int ldb, void *pBuffer) - cusparseStatus_t cusparseSgtsv2_nopivot_bufferSizeExt( - cusparseHandle_t handle, int m, int n, const float *dl, const float *d, - const float *du, const float *B, int ldb, size_t *bufferSizeInBytes) - cusparseStatus_t cusparseDgtsv2_nopivot_bufferSizeExt( - cusparseHandle_t handle, int m, int n, const double *dl, - const double *d, const double *du, const double *B, int ldb, - size_t *bufferSizeInBytes) - cusparseStatus_t cusparseCgtsv2_nopivot_bufferSizeExt( - cusparseHandle_t handle, int m, int n, const cuComplex *dl, - const cuComplex *d, const cuComplex *du, const cuComplex *B, int ldb, - size_t *bufferSizeInBytes) - cusparseStatus_t cusparseZgtsv2_nopivot_bufferSizeExt( - cusparseHandle_t handle, int m, int n, const cuDoubleComplex *dl, - const cuDoubleComplex *d, const cuDoubleComplex *du, - const cuDoubleComplex *B, int ldb, size_t *bufferSizeInBytes) - cusparseStatus_t cusparseSgtsv2_nopivot( - cusparseHandle_t handle, int m, int n, const float *dl, const float *d, - const float *du, float *B, int ldb, void *pBuffer) - cusparseStatus_t cusparseDgtsv2_nopivot( - cusparseHandle_t handle, int m, int n, const double *dl, - const double *d, const double *du, double *B, int ldb, void *pBuffer) - cusparseStatus_t cusparseCgtsv2_nopivot( - cusparseHandle_t handle, int m, int n, const cuComplex *dl, - const cuComplex *d, const cuComplex *du, cuComplex *B, int ldb, - void *pBuffer) - cusparseStatus_t cusparseZgtsv2_nopivot( - cusparseHandle_t handle, int m, int n, const cuDoubleComplex *dl, - const cuDoubleComplex *d, const cuDoubleComplex *du, - cuDoubleComplex *B, int ldb, void *pBuffer) - cusparseStatus_t cusparseSgtsv2StridedBatch_bufferSizeExt( - cusparseHandle_t handle, int m, const float *dl, const float *d, - const float *du, const float *x, int batchCount, int batchStride, - size_t *bufferSizeInBytes) - cusparseStatus_t cusparseDgtsv2StridedBatch_bufferSizeExt( - cusparseHandle_t handle, int m, const double *dl, const double *d, - const double *du, const double *x, int batchCount, int batchStride, - size_t *bufferSizeInBytes) - cusparseStatus_t cusparseCgtsv2StridedBatch_bufferSizeExt( - cusparseHandle_t handle, int m, const cuComplex *dl, - const cuComplex *d, const cuComplex *du, const cuComplex *x, - int batchCount, int batchStride, size_t *bufferSizeInBytes) - cusparseStatus_t cusparseZgtsv2StridedBatch_bufferSizeExt( - cusparseHandle_t handle, int m, const cuDoubleComplex *dl, - const cuDoubleComplex *d, const cuDoubleComplex *du, - const cuDoubleComplex *x, int batchCount, int batchStride, - size_t *bufferSizeInBytes) - cusparseStatus_t cusparseSgtsv2StridedBatch( - cusparseHandle_t handle, int m, const float *dl, const float *d, - const float *du, float *x, int batchCount, int batchStride, - void *pBuffer) - cusparseStatus_t cusparseDgtsv2StridedBatch( - cusparseHandle_t handle, int m, const double *dl, const double *d, - const double *du, double *x, int batchCount, int batchStride, - void *pBuffer) - cusparseStatus_t cusparseCgtsv2StridedBatch( - cusparseHandle_t handle, int m, const cuComplex *dl, - const cuComplex *d, const cuComplex *du, cuComplex *x, int batchCount, - int batchStride, void *pBuffer) - cusparseStatus_t cusparseZgtsv2StridedBatch( - cusparseHandle_t handle, int m, const cuDoubleComplex *dl, - const cuDoubleComplex *d, const cuDoubleComplex *du, - cuDoubleComplex *x, int batchCount, int batchStride, void *pBuffer) - cusparseStatus_t cusparseSgtsvInterleavedBatch_bufferSizeExt( - cusparseHandle_t handle, int algo, int m, const float *dl, - const float *d, const float *du, const float *x, int batchCount, - size_t *pBufferSizeInBytes) - cusparseStatus_t cusparseDgtsvInterleavedBatch_bufferSizeExt( - cusparseHandle_t handle, int algo, int m, const double *dl, - const double *d, const double *du, const double *x, int batchCount, - size_t *pBufferSizeInBytes) - cusparseStatus_t cusparseCgtsvInterleavedBatch_bufferSizeExt( - cusparseHandle_t handle, int algo, int m, const cuComplex *dl, - const cuComplex *d, const cuComplex *du, const cuComplex *x, - int batchCount, size_t *pBufferSizeInBytes) - cusparseStatus_t cusparseZgtsvInterleavedBatch_bufferSizeExt( - cusparseHandle_t handle, int algo, int m, const cuDoubleComplex *dl, - const cuDoubleComplex *d, const cuDoubleComplex *du, - const cuDoubleComplex *x, int batchCount, size_t *pBufferSizeInBytes) - cusparseStatus_t cusparseSgtsvInterleavedBatch( - cusparseHandle_t handle, int algo, int m, float *dl, float *d, - float *du, float *x, int batchCount, void *pBuffer) - cusparseStatus_t cusparseDgtsvInterleavedBatch( - cusparseHandle_t handle, int algo, int m, double *dl, double *d, - double *du, double *x, int batchCount, void *pBuffer) - cusparseStatus_t cusparseCgtsvInterleavedBatch( - cusparseHandle_t handle, int algo, int m, cuComplex *dl, cuComplex *d, - cuComplex *du, cuComplex *x, int batchCount, void *pBuffer) - cusparseStatus_t cusparseZgtsvInterleavedBatch( - cusparseHandle_t handle, int algo, int m, cuDoubleComplex *dl, - cuDoubleComplex *d, cuDoubleComplex *du, cuDoubleComplex *x, - int batchCount, void *pBuffer) - cusparseStatus_t cusparseSgpsvInterleavedBatch_bufferSizeExt( - cusparseHandle_t handle, int algo, int m, const float *ds, - const float *dl, const float *d, const float *du, const float *dw, - const float *x, int batchCount, size_t *pBufferSizeInBytes) - cusparseStatus_t cusparseDgpsvInterleavedBatch_bufferSizeExt( - cusparseHandle_t handle, int algo, int m, const double *ds, - const double *dl, const double *d, const double *du, const double *dw, - const double *x, int batchCount, size_t *pBufferSizeInBytes) - cusparseStatus_t cusparseCgpsvInterleavedBatch_bufferSizeExt( - cusparseHandle_t handle, int algo, int m, const cuComplex *ds, - const cuComplex *dl, const cuComplex *d, const cuComplex *du, - const cuComplex *dw, const cuComplex *x, int batchCount, - size_t *pBufferSizeInBytes) - cusparseStatus_t cusparseZgpsvInterleavedBatch_bufferSizeExt( - cusparseHandle_t handle, int algo, int m, const cuDoubleComplex *ds, - const cuDoubleComplex *dl, const cuDoubleComplex *d, - const cuDoubleComplex *du, const cuDoubleComplex *dw, - const cuDoubleComplex *x, int batchCount, size_t *pBufferSizeInBytes) - cusparseStatus_t cusparseSgpsvInterleavedBatch( - cusparseHandle_t handle, int algo, int m, float *ds, float *dl, - float *d, float *du, float *dw, float *x, int batchCount, - void *pBuffer) - cusparseStatus_t cusparseDgpsvInterleavedBatch( - cusparseHandle_t handle, int algo, int m, double *ds, double *dl, - double *d, double *du, double *dw, double *x, int batchCount, - void *pBuffer) - cusparseStatus_t cusparseCgpsvInterleavedBatch( - cusparseHandle_t handle, int algo, int m, cuComplex *ds, cuComplex *dl, - cuComplex *d, cuComplex *du, cuComplex *dw, cuComplex *x, - int batchCount, void *pBuffer) - cusparseStatus_t cusparseZgpsvInterleavedBatch( - cusparseHandle_t handle, int algo, int m, cuDoubleComplex *ds, - cuDoubleComplex *dl, cuDoubleComplex *d, cuDoubleComplex *du, - cuDoubleComplex *dw, cuDoubleComplex *x, int batchCount, void *pBuffer) - - # Sparse Vector APIs - Status cusparseCreateSpVec(SpVecDescr* spVecDescr, int64_t size, - int64_t nnz, void* indices, void* values, - IndexType idxType, IndexBase idxBase, - DataType valueType) - Status cusparseDestroySpVec(SpVecDescr spVecDescr) - Status cusparseSpVecGet(SpVecDescr spVecDescr, int64_t* size, int64_t* nnz, - void** indices, void** values, IndexType* idxType, - IndexBase* idxBase, DataType* valueType) - Status cusparseSpVecGetIndexBase(SpVecDescr spVecDescr, IndexBase* idxBae) - Status cusparseSpVecGetValues(SpVecDescr spVecDescr, void** values) - Status cusparseSpVecSetValues(SpVecDescr spVecDescr, void* values) - - # Sparse Matrix APIs - Status cusparseCreateCoo(SpMatDescr* spMatDescr, int64_t rows, - int64_t cols, int64_t nnz, void* cooRowInd, - void* cooColInd, void* cooValues, - IndexType cooIdxType, IndexBase idxBase, - DataType valueType) - Status cusparseCreateCooAoS(SpMatDescr* spMatDescr, int64_t rows, - int64_t cols, int64_t nnz, void* cooInd, - void* cooValues, IndexType cooIdxType, - IndexBase idxBase, DataType valueType) - Status cusparseCreateCsr(SpMatDescr* spMatDescr, int64_t rows, - int64_t cols, int64_t nnz, void* csrRowOffsets, - void* csrColind, void* csrValues, - IndexType csrRowOffsetsType, - IndexType csrColIndType, IndexBase idxBase, - DataType valueType) - Status cusparseDestroySpMat(SpMatDescr spMatDescr) - Status cusparseCooGet(SpMatDescr spMatDescr, int64_t* rows, int64_t* cols, - int64_t* nnz, void** cooRowInd, void** cooColInd, - void** cooValues, IndexType* idxType, - IndexBase* idxBase, DataType* valueType) - Status cusparseCooAoSGet(SpMatDescr spMatDescr, int64_t* rows, - int64_t* cols, int64_t* nnz, void** cooInd, - void** cooValues, IndexType* idxType, - IndexBase* idxBase, DataType* valueType) - Status cusparseCsrGet(SpMatDescr spMatDescr, int64_t* rows, int64_t* cols, - int64_t* nnz, void** csrRowOffsets, void** csrColInd, - void** csrValues, IndexType* csrRowOffsetsType, - IndexType* csrColIndType, IndexBase* idxBase, - DataType* valueType) - Status cusparseCsrSetPointers(SpMatDescr spMatDescr, void* csrRowOffsets, - void* csrColInd, void* csrValues) - Status cusparseSpMatGetFormat(SpMatDescr spMatDescr, Format* format) - Status cusparseSpMatGetIndexBase(SpMatDescr spMatDescr, IndexBase* idxBase) - Status cusparseSpMatGetValues(SpMatDescr spMatDescr, void** values) - Status cusparseSpMatSetValues(SpMatDescr spMatDescr, void* values) - Status cusparseSpMatGetSize(SpMatDescr spMatDescr, int64_t* rows, - int64_t* cols, int64_t* nnz) - Status cusparseSpMatGetStridedBatch(SpMatDescr spMatDescr, int* batchCount) - Status cusparseSpMatSetStridedBatch(SpMatDescr spMatDescr, int batchCount) - - # Dense Vector APIs - Status cusparseCreateDnVec(DnVecDescr *dnVecDescr, int64_t size, - void* values, DataType valueType) - Status cusparseDestroyDnVec(DnVecDescr dnVecDescr) - Status cusparseDnVecGet(DnVecDescr dnVecDescr, int64_t* size, - void** values, DataType* valueType) - Status cusparseDnVecGetValues(DnVecDescr dnVecDescr, void** values) - Status cusparseDnVecSetValues(DnVecDescr dnVecDescr, void* values) - - # Dense Matrix APIs - Status cusparseCreateDnMat(DnMatDescr* dnMatDescr, int64_t rows, - int64_t cols, int64_t ld, void* values, - DataType valueType, Order order) - Status cusparseDestroyDnMat(DnMatDescr dnVecDescr) - Status cusparseDnMatGet(DnMatDescr dnMatDescr, int64_t* rows, - int64_t* cols, int64_t* ld, void** values, - DataType* valueType, Order* order) - Status cusparseDnMatGetValues(DnMatDescr spMatDescr, void** values) - Status cusparseDnMatSetValues(DnMatDescr spMatDescr, void* values) - Status cusparseDnMatGetStridedBatch(DnMatDescr dnMatDescr, int* batchCount, - int64_t *batchStride) - Status cusparseDnMatSetStridedBatch(DnMatDescr dnMatDescr, int batchCount, - int64_t batchStride) - - # Generic API Functions - Status cusparseSpVV_bufferSize(Handle handle, Operation opX, - SpVecDescr vecX, DnVecDescr vecY, - void* result, DataType computeType, - size_t* bufferSize) - Status cusparseSpVV(Handle handle, Operation opX, SpVecDescr vecX, - DnVecDescr vecY, void* result, DataType computeType, - void* externalBuffer) - Status cusparseSpMV_bufferSize(Handle handle, Operation opA, void* alpha, - SpMatDescr matA, DnVecDescr vecX, - void* beta, DnVecDescr vecY, - DataType computeType, SpMVAlg alg, - size_t* bufferSize) - Status cusparseSpMV(Handle handle, Operation opA, void* alpha, - SpMatDescr matA, DnVecDescr vecX, void* beta, - DnVecDescr vecY, DataType computeType, SpMVAlg alg, - void* externalBuffer) - Status cusparseSpMM_bufferSize(Handle handle, Operation opA, Operation opB, - void* alpha, SpMatDescr matA, - DnMatDescr matB, void* beta, - DnMatDescr matC, DataType computeType, - SpMMAlg alg, size_t* bufferSize) - Status cusparseSpMM(Handle handle, Operation opA, Operation opB, - void* alpha, SpMatDescr matA, DnMatDescr matB, - void* beta, DnMatDescr matC, DataType computeType, - SpMMAlg alg, void* externalBuffer) - Status cusparseConstrainedGeMM_bufferSize( - Handle handle, Operation opA, Operation opB, void* alpha, - DnMatDescr matA, DnMatDescr matB, void* beta, SpMatDescr matC, - DataType computeType, size_t* bufferSize) - Status cusparseConstrainedGeMM( - Handle handle, Operation opA, Operation opB, void* alpha, - DnMatDescr matA, DnMatDescr matB, void* beta, SpMatDescr matC, - DataType computeType, void* externalBuffer) - - Status cusparseSpGEMM_createDescr(SpGEMMDescr* spgemmDescr) - Status cusparseSpGEMM_destroyDescr(SpGEMMDescr spgemmDescr) - Status cusparseSpGEMM_workEstimation( - Handle handle, Operation opA, Operation opB, const void* alpha, - SpMatDescr matA, SpMatDescr matB, const void* beta, SpMatDescr matC, - DataType computeType, SpGEMMAlg alg, SpGEMMDescr spgemmDescr, - size_t* bufferSize1, void* externalBuffer1) - Status cusparseSpGEMM_compute( - Handle handle, Operation opA, Operation opB, const void* alpha, - SpMatDescr matA, SpMatDescr matB, const void* beta, SpMatDescr matC, - DataType computeType, SpGEMMAlg alg, SpGEMMDescr spgemmDescr, - size_t* bufferSize2, void* externalBuffer2) - Status cusparseSpGEMM_copy( - Handle handle, Operation opA, Operation opB, const void* alpha, - SpMatDescr matA, SpMatDescr matB, const void* beta, SpMatDescr matC, - DataType computeType, SpGEMMAlg alg, SpGEMMDescr spgemmDescr) - Status cusparseGather(Handle handle, DnVecDescr vecY, SpVecDescr vecX) - - # CSR2CSC - Status cusparseCsr2cscEx2_bufferSize( - Handle handle, int m, int n, int nnz, const void* csrVal, - const int* csrRowPtr, const int* csrColInd, void* cscVal, - int* cscColPtr, int* cscRowInd, DataType valType, Action copyValues, - IndexBase idxBase, Csr2CscAlg alg, size_t* bufferSize) - - Status cusparseCsr2cscEx2( - Handle handle, int m, int n, int nnz, const void* csrVal, - const int* csrRowPtr, const int* csrColInd, void* cscVal, - int* cscColPtr, int* cscRowInd, DataType valType, Action copyValues, - IndexBase idxBase, Csr2CscAlg alg, void* buffer) - - # Build-time version - int CUSPARSE_VERSION - -ctypedef Status (*f_type)(...) nogil # NOQA -IF 11010 <= CUPY_CUDA_VERSION < 12000: - if _sys.platform == 'linux': - _libname = 'libcusparse.so.11' - else: - _libname = 'cusparse64_11.dll' -ELIF 12000 <= CUPY_CUDA_VERSION < 13000: - if _sys.platform == 'linux': - _libname = 'libcusparse.so.12' - else: - _libname = 'cusparse64_12.dll' -ELIF 0 < CUPY_HIP_VERSION: - _libname = __file__ -ELSE: - _libname = None - -cdef SoftLink _lib = SoftLink(_libname, 'cusparse') -# cuSPARSE 11.6+ (CUDA 11.3.1+) -cdef f_type cusparseSpSM_createDescr = _lib.get('SpSM_createDescr') -cdef f_type cusparseSpSM_destroyDescr = _lib.get('SpSM_destroyDescr') -cdef f_type cusparseSpSM_bufferSize = _lib.get('SpSM_bufferSize') -cdef f_type cusparseSpSM_analysis = _lib.get('SpSM_analysis') -cdef f_type cusparseSpSM_solve = _lib.get('SpSM_solve') -# cuSPARSE 11.5+ (CUDA 11.3.0+) -cdef f_type cusparseSpMatSetAttribute = _lib.get('SpMatSetAttribute') -# cuSPARSE 11.3.1+ (CUDA 11.2.0+) -cdef f_type cusparseCreateCsc = _lib.get('CreateCsc') -# cuSPARSE 11.3+ (CUDA 11.1.1+) -# Note: CUDA 11.1.0 contains cuSPARSE 11.2.0.275 -cdef f_type cusparseSparseToDense_bufferSize = _lib.get('SparseToDense_bufferSize') # NOQA -cdef f_type cusparseSparseToDense = _lib.get('SparseToDense') -cdef f_type cusparseDenseToSparse_bufferSize = _lib.get('DenseToSparse_bufferSize') # NOQA -cdef f_type cusparseDenseToSparse_analysis = _lib.get('DenseToSparse_analysis') # NOQA -cdef f_type cusparseDenseToSparse_convert = _lib.get('DenseToSparse_convert') # NOQA - -cdef dict HIP_STATUS = { - 0: b'HIPSPARSE_STATUS_SUCCESS', - 1: b'HIPSPARSE_STATUS_NOT_INITIALIZED', - 2: b'HIPSPARSE_STATUS_ALLOC_FAILED', - 3: b'HIPSPARSE_STATUS_INVALID_VALUE', - 4: b'HIPSPARSE_STATUS_ARCH_MISMATCH', - 5: b'HIPSPARSE_STATUS_MAPPING_ERROR', - 6: b'HIPSPARSE_STATUS_EXECUTION_FAILED', - 7: b'HIPSPARSE_STATUS_INTERNAL_ERROR', - 8: b'HIPSPARSE_STATUS_MATRIX_TYPE_NOT_SUPPORTED', - 9: b'HIPSPARSE_STATUS_ZERO_PIVOT', - 10: b'HIPSPARSE_STATUS_NOT_SUPPORTED', - 11: b'HIPSPARSE_STATUS_INSUFFICIENT_RESOURCES', -} - - -cdef class SpVecAttributes: - - def __init__(self, int64_t size, int64_t nnz, - intptr_t idx, intptr_t values, - IndexType idxType, IndexBase idxBase, DataType valueType): - self.size = size - self.nnz = nnz - self.idx = idx - self.values = values - self.idxType = idxType - self.idxBase = idxBase - self.valueType = valueType - - -cdef class CooAttributes: - - def __init__(self, int64_t rows, int64_t cols, int64_t nnz, - intptr_t rowIdx, intptr_t colIdx, intptr_t values, - IndexType idxType, IndexBase idxBase, DataType valueType): - self.rows = rows - self.cols = cols - self.nnz = nnz - self.rowIdx = rowIdx - self.colIdx = colIdx - self.values = values - self.idxType = idxType - self.idxBase = idxBase - self.valueType = valueType - - -cdef class CooAoSAttributes: - - def __init__(self, int64_t rows, int64_t cols, int64_t nnz, - intptr_t ind, intptr_t values, - IndexType idxType, IndexBase idxBase, DataType valueType): - self.rows = rows - self.cols = cols - self.nnz = nnz - self.ind = ind - self.values = values - self.idxType = idxType - self.idxBase = idxBase - self.valueType = valueType - - -cdef class CsrAttributes: - - def __init__(self, int64_t rows, int64_t cols, int64_t nnz, - intptr_t rowOffsets, intptr_t colIdx, intptr_t values, - IndexType rowOffsetType, IndexType colIdxType, - IndexBase idxBase, DataType valueType): - self.rows = rows - self.cols = cols - self.nnz = nnz - self.rowOffsets = rowOffsets - self.colIdx = colIdx - self.values = values - self.rowOffsetType = rowOffsetType - self.colIdxType = colIdxType - self.idxBase = idxBase - self.valueType = valueType - - -cdef class DnVecAttributes: - - def __init__(self, int64_t size, intptr_t values, DataType valueType): - self.size = size - self.values = values - self.valueType = valueType - - -cdef class DnMatAttributes: - - def __init__(self, int64_t rows, int64_t cols, int64_t ld, - intptr_t values, DataType valueType, Order order): - self.rows = rows - self.cols = cols - self.ld = ld - self.values = values - self.valueType = valueType - self.order = order - - -cdef class DnMatBatchAttributes: - - def __init__(self, int count, int64_t stride): - self.count = count - self.stride = stride - - -class CuSparseError(RuntimeError): - - def __init__(self, Status status): - self.status = status - cdef bytes name - cdef bytes msg - if _is_hip_environment: - name = HIP_STATUS[status] - msg = name - else: - name = cusparseGetErrorName(status) - msg = cusparseGetErrorString(status) - super().__init__(f'{name.decode()}: {msg.decode()}') - - def __reduce__(self): - return (type(self), (self.status,)) - - -@cython.profile(False) -cpdef inline check_status(int status): - if status != 0: - raise CuSparseError(status) - - -@cython.profile(False) -cdef inline cuComplex complex_to_cuda(complex value): - cdef cuComplex value_cuda - value_cuda.x = value.real - value_cuda.y = value.imag - return value_cuda - - -@cython.profile(False) -cdef inline cuDoubleComplex double_complex_to_cuda(double complex value): - cdef cuDoubleComplex value_cuda - value_cuda.x = value.real - value_cuda.y = value.imag - return value_cuda - - -cpdef int getVersion(intptr_t handle) except? -1: - cdef int version - status = cusparseGetVersion(handle, &version) - check_status(status) - return version - - -def get_build_version(): - return CUSPARSE_VERSION - - -######################################## -# cuSPARSE Helper Function - -cpdef intptr_t create() except? 0: - cdef Handle handle - status = cusparseCreate(& handle) - check_status(status) - return handle - - -cpdef size_t createMatDescr() except? -1: - cdef MatDescr desc - status = cusparseCreateMatDescr(& desc) - check_status(status) - return desc - - -cpdef void destroy(intptr_t handle) except *: - status = cusparseDestroy(handle) - check_status(status) - - -cpdef void destroyMatDescr(size_t descr) except *: - status = cusparseDestroyMatDescr(descr) - check_status(status) - - -cpdef void setMatIndexBase(size_t descr, base) except *: - status = cusparseSetMatIndexBase(descr, base) - check_status(status) - - -cpdef void setMatType(size_t descr, typ) except *: - status = cusparseSetMatType(descr, typ) - check_status(status) - -cpdef void setMatFillMode(size_t descrA, int fillMode) except *: - status = cusparseSetMatFillMode(descrA, fillMode) - check_status(status) - -cpdef void setMatDiagType(size_t descrA, int diagType) except *: - status = cusparseSetMatDiagType(descrA, diagType) - check_status(status) - -cpdef void setPointerMode(intptr_t handle, int mode) except *: - status = cusparseSetPointerMode(handle, mode) - check_status(status) - -cpdef void spMatSetAttribute( - size_t spMatDescr, int attribute, int data) except *: - # Assuming the value of attribute is an enum value, whose underlying type - # As for CUDA 11.7, the types of all the sparse matrix descriptor - # attributes are enums, whose underlying type is always int in C. - status = cusparseSpMatSetAttribute( - spMatDescr, attribute, &data, - sizeof(int)) - check_status(status) - - -######################################## -# Stream - -cpdef void setStream(intptr_t handle, size_t stream) except *: - # TODO(leofang): It seems most of cuSPARSE APIs support stream capture (as - # of CUDA 11.5) under certain conditions, see - # https://docs.nvidia.com/cuda/cusparse/index.html#optimization-notes - # Before we come up with a robust strategy to test the support conditions, - # we disable this functionality. - if not runtime._is_hip_environment and runtime.streamIsCapturing(stream): - raise NotImplementedError( - 'calling cuSPARSE API during stream capture is currently ' - 'unsupported') - - status = cusparseSetStream(handle, stream) - check_status(status) - - -cpdef size_t getStream(intptr_t handle) except? -1: - cdef Stream stream - status = cusparseGetStream(handle, &stream) - check_status(status) - return stream - - -cdef void _setStream(intptr_t handle) except *: - """Set current stream""" - setStream(handle, stream_module.get_current_stream_ptr()) - - -######################################## -# cuSPARSE Level1 Function - -cpdef void sgthr( - intptr_t handle, int nnz, size_t y, size_t xVal, size_t xInd, - int idxBase) except *: - _setStream(handle) - status = cusparseSgthr( - handle, nnz, y, xVal, - xInd, idxBase) - check_status(status) - -cpdef void dgthr( - intptr_t handle, int nnz, size_t y, size_t xVal, size_t xInd, - int idxBase) except *: - _setStream(handle) - status = cusparseDgthr( - handle, nnz, y, xVal, - xInd, idxBase) - check_status(status) - -cpdef void cgthr( - intptr_t handle, int nnz, size_t y, size_t xVal, size_t xInd, - int idxBase) except *: - _setStream(handle) - status = cusparseCgthr( - handle, nnz, y, xVal, - xInd, idxBase) - check_status(status) - -cpdef void zgthr( - intptr_t handle, int nnz, size_t y, size_t xVal, size_t xInd, - int idxBase) except *: - _setStream(handle) - status = cusparseZgthr( - handle, nnz, y, - xVal, xInd, idxBase) - check_status(status) - -######################################## -# cuSPARSE Level2 Function - -cpdef void scsrmv( - intptr_t handle, int transA, int m, int n, int nnz, - size_t alpha, size_t descrA, size_t csrSortedValA, - size_t csrSortedRowPtrA, size_t csrSortedColIndA, - size_t x, size_t beta, size_t y) except *: - _setStream(handle) - status = cusparseScsrmv( - handle, transA, m, n, nnz, - alpha, descrA, csrSortedValA, - csrSortedRowPtrA, csrSortedColIndA, - x, beta, y) - check_status(status) - -cpdef void dcsrmv( - intptr_t handle, int transA, int m, int n, int nnz, - size_t alpha, size_t descrA, size_t csrSortedValA, - size_t csrSortedRowPtrA, size_t csrSortedColIndA, - size_t x, size_t beta, size_t y) except *: - _setStream(handle) - status = cusparseDcsrmv( - handle, transA, m, n, nnz, - alpha, descrA, csrSortedValA, - csrSortedRowPtrA, csrSortedColIndA, - x, beta, y) - check_status(status) - -cpdef void ccsrmv( - intptr_t handle, int transA, int m, int n, int nnz, - size_t alpha, size_t descrA, size_t csrSortedValA, - size_t csrSortedRowPtrA, size_t csrSortedColIndA, - size_t x, size_t beta, size_t y) except *: - _setStream(handle) - status = cusparseCcsrmv( - handle, transA, m, n, nnz, - alpha, descrA, - csrSortedValA, - csrSortedRowPtrA, csrSortedColIndA, - x, beta, y) - check_status(status) - -cpdef void zcsrmv( - intptr_t handle, int transA, int m, int n, int nnz, - size_t alpha, size_t descrA, size_t csrSortedValA, - size_t csrSortedRowPtrA, size_t csrSortedColIndA, - size_t x, size_t beta, size_t y) except *: - _setStream(handle) - status = cusparseZcsrmv( - handle, transA, m, n, nnz, - alpha, descrA, - csrSortedValA, - csrSortedRowPtrA, csrSortedColIndA, - x, beta, - y) - check_status(status) - -cpdef size_t csrmvEx_bufferSize( - intptr_t handle, int alg, int transA, int m, int n, - int nnz, size_t alpha, int alphatype, size_t descrA, - size_t csrValA, int csrValAtype, size_t csrRowPtrA, - size_t csrColIndA, size_t x, int xtype, size_t beta, - int betatype, size_t y, int ytype, int executiontype) except? -1: - cdef size_t bufferSizeInBytes - _setStream(handle) - status = cusparseCsrmvEx_bufferSize( - handle, alg, transA, m, - n, nnz, alpha, alphatype, - descrA, csrValA, csrValAtype, - csrRowPtrA, csrColIndA, - x, xtype, beta, - betatype, y, ytype, - executiontype, &bufferSizeInBytes) - check_status(status) - return bufferSizeInBytes - -cpdef void csrmvEx( - intptr_t handle, int alg, int transA, int m, int n, - int nnz, size_t alpha, int alphatype, size_t descrA, - size_t csrValA, int csrValAtype, size_t csrRowPtrA, - size_t csrColIndA, size_t x, int xtype, size_t beta, - int betatype, size_t y, int ytype, int executiontype, - size_t buffer) except *: - _setStream(handle) - status = cusparseCsrmvEx( - handle, alg, transA, m, - n, nnz, alpha, alphatype, - descrA, csrValA, csrValAtype, - csrRowPtrA, csrColIndA, - x, xtype, beta, - betatype, y, ytype, - executiontype, buffer) - check_status(status) - -cpdef size_t createCsrsv2Info() except? -1: - cdef csrsv2Info_t info - status = cusparseCreateCsrsv2Info(&info) - check_status(status) - return info - -cpdef void destroyCsrsv2Info(size_t info) except *: - status = cusparseDestroyCsrsv2Info(info) - check_status(status) - -cpdef int scsrsv2_bufferSize( - intptr_t handle, int transA, int m, int nnz, size_t descrA, - size_t csrSortedValA, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t info) except? -1: - cdef int bufferSize - _setStream(handle) - status = cusparseScsrsv2_bufferSize( - handle, transA, m, nnz, descrA, - csrSortedValA, csrSortedRowPtrA, - csrSortedColIndA, info, &bufferSize) - check_status(status) - return bufferSize - -cpdef int dcsrsv2_bufferSize( - intptr_t handle, int transA, int m, int nnz, size_t descrA, - size_t csrSortedValA, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t info) except? -1: - cdef int bufferSize - _setStream(handle) - status = cusparseDcsrsv2_bufferSize( - handle, transA, m, nnz, descrA, - csrSortedValA, csrSortedRowPtrA, - csrSortedColIndA, info, &bufferSize) - check_status(status) - return bufferSize - -cpdef int ccsrsv2_bufferSize( - intptr_t handle, int transA, int m, int nnz, size_t descrA, - size_t csrSortedValA, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t info) except? -1: - cdef int bufferSize - _setStream(handle) - status = cusparseCcsrsv2_bufferSize( - handle, transA, m, nnz, descrA, - csrSortedValA, csrSortedRowPtrA, - csrSortedColIndA, info, &bufferSize) - check_status(status) - return bufferSize - -cpdef int zcsrsv2_bufferSize( - intptr_t handle, int transA, int m, int nnz, size_t descrA, - size_t csrSortedValA, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t info) except? -1: - cdef int bufferSize - _setStream(handle) - status = cusparseZcsrsv2_bufferSize( - handle, transA, m, nnz, descrA, - csrSortedValA, csrSortedRowPtrA, - csrSortedColIndA, info, &bufferSize) - check_status(status) - return bufferSize - -cpdef void scsrsv2_analysis( - intptr_t handle, int transA, int m, int nnz, size_t descrA, - size_t csrSortedValA, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t info, int policy, - size_t pBuffer) except *: - _setStream(handle) - status = cusparseScsrsv2_analysis( - handle, transA, m, nnz, descrA, - csrSortedValA, csrSortedRowPtrA, - csrSortedColIndA, info, - policy, pBuffer) - check_status(status) - -cpdef void dcsrsv2_analysis( - intptr_t handle, int transA, int m, int nnz, size_t descrA, - size_t csrSortedValA, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t info, int policy, - size_t pBuffer) except *: - _setStream(handle) - status = cusparseDcsrsv2_analysis( - handle, transA, m, nnz, descrA, - csrSortedValA, csrSortedRowPtrA, - csrSortedColIndA, info, - policy, pBuffer) - check_status(status) - -cpdef void ccsrsv2_analysis( - intptr_t handle, int transA, int m, int nnz, size_t descrA, - size_t csrSortedValA, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t info, int policy, - size_t pBuffer) except *: - _setStream(handle) - status = cusparseCcsrsv2_analysis( - handle, transA, m, nnz, descrA, - csrSortedValA, csrSortedRowPtrA, - csrSortedColIndA, info, - policy, pBuffer) - check_status(status) - -cpdef void zcsrsv2_analysis( - intptr_t handle, int transA, int m, int nnz, size_t descrA, - size_t csrSortedValA, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t info, int policy, - size_t pBuffer) except *: - _setStream(handle) - status = cusparseZcsrsv2_analysis( - handle, transA, m, nnz, descrA, - csrSortedValA, csrSortedRowPtrA, - csrSortedColIndA, info, - policy, pBuffer) - check_status(status) - -cpdef void scsrsv2_solve( - intptr_t handle, int transA, int m, int nnz, size_t alpha, - size_t descrA, size_t csrSortedValA, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t info, size_t x, size_t y, int policy, - size_t pBuffer) except *: - _setStream(handle) - status = cusparseScsrsv2_solve( - handle, transA, m, nnz, - alpha, descrA, - csrSortedValA, csrSortedRowPtrA, - csrSortedColIndA, info, - x, y, - policy, pBuffer) - check_status(status) - -cpdef void dcsrsv2_solve( - intptr_t handle, int transA, int m, int nnz, size_t alpha, - size_t descrA, size_t csrSortedValA, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t info, size_t x, size_t y, int policy, - size_t pBuffer) except *: - _setStream(handle) - status = cusparseDcsrsv2_solve( - handle, transA, m, nnz, - alpha, descrA, - csrSortedValA, csrSortedRowPtrA, - csrSortedColIndA, info, - x, y, - policy, pBuffer) - check_status(status) - -cpdef void ccsrsv2_solve( - intptr_t handle, int transA, int m, int nnz, size_t alpha, - size_t descrA, size_t csrSortedValA, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t info, size_t x, size_t y, int policy, - size_t pBuffer) except *: - _setStream(handle) - status = cusparseCcsrsv2_solve( - handle, transA, m, nnz, - alpha, descrA, - csrSortedValA, csrSortedRowPtrA, - csrSortedColIndA, info, - x, y, - policy, pBuffer) - check_status(status) - -cpdef void zcsrsv2_solve( - intptr_t handle, int transA, int m, int nnz, size_t alpha, - size_t descrA, size_t csrSortedValA, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t info, size_t x, size_t y, int policy, - size_t pBuffer) except *: - _setStream(handle) - status = cusparseZcsrsv2_solve( - handle, transA, m, nnz, - alpha, descrA, - csrSortedValA, csrSortedRowPtrA, - csrSortedColIndA, info, - x, y, - policy, pBuffer) - check_status(status) - -cpdef void xcsrsv2_zeroPivot( - intptr_t handle, size_t info, size_t position) except *: - _setStream(handle) - status = cusparseXcsrsv2_zeroPivot( - handle, info, position) - check_status(status) - -######################################## -# cuSPARSE Level3 Function - -cpdef void scsrmm( - intptr_t handle, int transA, int m, int n, int k, int nnz, - size_t alpha, size_t descrA, size_t csrSortedValA, - size_t csrSortedRowPtrA, size_t csrSortedColIndA, - size_t B, int ldb, size_t beta, size_t C, int ldc) except *: - _setStream(handle) - status = cusparseScsrmm( - handle, transA, m, n, k, nnz, - alpha, descrA, csrSortedValA, - csrSortedRowPtrA, csrSortedColIndA, - B, ldb, beta, C, ldc) - check_status(status) - -cpdef void dcsrmm( - intptr_t handle, int transA, int m, int n, int k, int nnz, - size_t alpha, size_t descrA, size_t csrSortedValA, - size_t csrSortedRowPtrA, size_t csrSortedColIndA, - size_t B, int ldb, size_t beta, size_t C, int ldc) except *: - _setStream(handle) - status = cusparseDcsrmm( - handle, transA, m, n, k, nnz, - alpha, descrA, csrSortedValA, - csrSortedRowPtrA, csrSortedColIndA, - B, ldb, beta, C, ldc) - check_status(status) - -cpdef void ccsrmm( - intptr_t handle, int transA, int m, int n, int k, int nnz, - size_t alpha, size_t descrA, size_t csrSortedValA, - size_t csrSortedRowPtrA, size_t csrSortedColIndA, - size_t B, int ldb, size_t beta, size_t C, int ldc) except *: - _setStream(handle) - status = cusparseCcsrmm( - handle, transA, m, n, k, nnz, - alpha, descrA, - csrSortedValA, - csrSortedRowPtrA, csrSortedColIndA, - B, ldb, beta, - C, ldc) - check_status(status) - -cpdef void zcsrmm( - intptr_t handle, int transA, int m, int n, int k, int nnz, - size_t alpha, size_t descrA, size_t csrSortedValA, - size_t csrSortedRowPtrA, size_t csrSortedColIndA, - size_t B, int ldb, size_t beta, size_t C, int ldc) except *: - _setStream(handle) - status = cusparseZcsrmm( - handle, transA, m, n, k, nnz, - alpha, descrA, - csrSortedValA, - csrSortedRowPtrA, csrSortedColIndA, - B, ldb, - beta, C, ldc) - check_status(status) - -cpdef void scsrmm2( - intptr_t handle, int transA, int transB, int m, int n, int k, int nnz, - size_t alpha, size_t descrA, size_t csrValA, - size_t csrRowPtrA, size_t csrColIndA, - size_t B, int ldb, size_t beta, size_t C, int ldc) except *: - _setStream(handle) - status = cusparseScsrmm2( - handle, transA, transB, m, n, k, nnz, - alpha, descrA, csrValA, - csrRowPtrA, csrColIndA, - B, ldb, beta, C, ldc) - check_status(status) - -cpdef void dcsrmm2( - intptr_t handle, int transA, int transB, int m, int n, int k, int nnz, - size_t alpha, size_t descrA, size_t csrValA, - size_t csrRowPtrA, size_t csrColIndA, - size_t B, int ldb, size_t beta, size_t C, int ldc) except *: - _setStream(handle) - status = cusparseDcsrmm2( - handle, transA, transB, m, n, k, nnz, - alpha, descrA, csrValA, - csrRowPtrA, csrColIndA, - B, ldb, beta, C, ldc) - check_status(status) - -cpdef void ccsrmm2( - intptr_t handle, int transA, int transB, int m, int n, int k, int nnz, - size_t alpha, size_t descrA, size_t csrValA, - size_t csrRowPtrA, size_t csrColIndA, - size_t B, int ldb, size_t beta, size_t C, int ldc) except *: - _setStream(handle) - status = cusparseCcsrmm2( - handle, transA, transB, m, n, k, nnz, - alpha, descrA, csrValA, - csrRowPtrA, csrColIndA, - B, ldb, beta, - C, ldc) - check_status(status) - -cpdef void zcsrmm2( - intptr_t handle, int transA, int transB, int m, int n, int k, int nnz, - size_t alpha, size_t descrA, size_t csrValA, - size_t csrRowPtrA, size_t csrColIndA, - size_t B, int ldb, size_t beta, size_t C, int ldc) except *: - _setStream(handle) - status = cusparseZcsrmm2( - handle, transA, transB, m, n, k, nnz, - alpha, descrA, - csrValA, - csrRowPtrA, csrColIndA, - B, ldb, - beta, C, ldc) - check_status(status) - -cpdef size_t createCsrsm2Info() except? -1: - cdef csrsm2Info_t info - status = cusparseCreateCsrsm2Info(&info) - check_status(status) - return info - -cpdef void destroyCsrsm2Info(size_t info) except *: - status = cusparseDestroyCsrsm2Info(info) - check_status(status) - -cpdef size_t scsrsm2_bufferSizeExt( - intptr_t handle, int algo, int transA, int transB, int m, int nrhs, - int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, - size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t B, int ldb, - size_t info, int policy) except? -1: - cdef size_t bufferSize - _setStream(handle) - status = cusparseScsrsm2_bufferSizeExt( - handle, algo, transA, transB, m, nrhs, - nnz, alpha, descrA, - csrSortedValA, csrSortedRowPtrA, - csrSortedColIndA, B, ldb, - info, policy, &bufferSize) - check_status(status) - return bufferSize - -cpdef size_t dcsrsm2_bufferSizeExt( - intptr_t handle, int algo, int transA, int transB, int m, int nrhs, - int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, - size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t B, int ldb, - size_t info, int policy) except? -1: - cdef size_t bufferSize - _setStream(handle) - status = cusparseDcsrsm2_bufferSizeExt( - handle, algo, transA, transB, m, nrhs, - nnz, alpha, descrA, - csrSortedValA, csrSortedRowPtrA, - csrSortedColIndA, B, ldb, - info, policy, &bufferSize) - check_status(status) - return bufferSize - -cpdef size_t ccsrsm2_bufferSizeExt( - intptr_t handle, int algo, int transA, int transB, int m, int nrhs, - int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, - size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t B, int ldb, - size_t info, int policy) except? -1: - cdef size_t bufferSize - _setStream(handle) - status = cusparseCcsrsm2_bufferSizeExt( - handle, algo, transA, transB, m, nrhs, - nnz, alpha, descrA, - csrSortedValA, csrSortedRowPtrA, - csrSortedColIndA, B, ldb, - info, policy, &bufferSize) - check_status(status) - return bufferSize - -cpdef size_t zcsrsm2_bufferSizeExt( - intptr_t handle, int algo, int transA, int transB, int m, int nrhs, - int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, - size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t B, int ldb, - size_t info, int policy) except? -1: - cdef size_t bufferSize - _setStream(handle) - status = cusparseZcsrsm2_bufferSizeExt( - handle, algo, transA, transB, m, nrhs, - nnz, alpha, descrA, - csrSortedValA, csrSortedRowPtrA, - csrSortedColIndA, B, ldb, - info, policy, &bufferSize) - check_status(status) - return bufferSize - -cpdef void scsrsm2_analysis( - intptr_t handle, int algo, int transA, int transB, int m, int nrhs, - int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, - size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t B, int ldb, - size_t info, int policy, size_t pBuffer) except *: - _setStream(handle) - status = cusparseScsrsm2_analysis( - handle, algo, transA, transB, m, nrhs, - nnz, alpha, descrA, - csrSortedValA, csrSortedRowPtrA, - csrSortedColIndA, B, ldb, - info, policy, pBuffer) - check_status(status) - -cpdef void dcsrsm2_analysis( - intptr_t handle, int algo, int transA, int transB, int m, int nrhs, - int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, - size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t B, int ldb, - size_t info, int policy, size_t pBuffer) except *: - _setStream(handle) - status = cusparseDcsrsm2_analysis( - handle, algo, transA, transB, m, nrhs, - nnz, alpha, descrA, - csrSortedValA, csrSortedRowPtrA, - csrSortedColIndA, B, ldb, - info, policy, pBuffer) - check_status(status) - -cpdef void ccsrsm2_analysis( - intptr_t handle, int algo, int transA, int transB, int m, int nrhs, - int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, - size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t B, int ldb, - size_t info, int policy, size_t pBuffer) except *: - _setStream(handle) - status = cusparseCcsrsm2_analysis( - handle, algo, transA, transB, m, nrhs, - nnz, alpha, descrA, - csrSortedValA, csrSortedRowPtrA, - csrSortedColIndA, B, ldb, - info, policy, pBuffer) - check_status(status) - -cpdef void zcsrsm2_analysis( - intptr_t handle, int algo, int transA, int transB, int m, int nrhs, - int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, - size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t B, int ldb, - size_t info, int policy, size_t pBuffer) except *: - _setStream(handle) - status = cusparseZcsrsm2_analysis( - handle, algo, transA, transB, m, nrhs, - nnz, alpha, descrA, - csrSortedValA, csrSortedRowPtrA, - csrSortedColIndA, B, ldb, - info, policy, pBuffer) - check_status(status) - -cpdef void scsrsm2_solve( - intptr_t handle, int algo, int transA, int transB, int m, int nrhs, - int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, - size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t B, int ldb, - size_t info, int policy, size_t pBuffer) except *: - _setStream(handle) - status = cusparseScsrsm2_solve( - handle, algo, transA, transB, m, nrhs, - nnz, alpha, descrA, - csrSortedValA, csrSortedRowPtrA, - csrSortedColIndA, B, ldb, - info, policy, pBuffer) - check_status(status) - -cpdef void dcsrsm2_solve( - intptr_t handle, int algo, int transA, int transB, int m, int nrhs, - int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, - size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t B, int ldb, - size_t info, int policy, size_t pBuffer) except *: - _setStream(handle) - status = cusparseDcsrsm2_solve( - handle, algo, transA, transB, m, nrhs, - nnz, alpha, descrA, - csrSortedValA, csrSortedRowPtrA, - csrSortedColIndA, B, ldb, - info, policy, pBuffer) - check_status(status) - -cpdef void ccsrsm2_solve( - intptr_t handle, int algo, int transA, int transB, int m, int nrhs, - int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, - size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t B, int ldb, - size_t info, int policy, size_t pBuffer) except *: - _setStream(handle) - status = cusparseCcsrsm2_solve( - handle, algo, transA, transB, m, nrhs, - nnz, alpha, descrA, - csrSortedValA, csrSortedRowPtrA, - csrSortedColIndA, B, ldb, - info, policy, pBuffer) - check_status(status) - -cpdef void zcsrsm2_solve( - intptr_t handle, int algo, int transA, int transB, int m, int nrhs, - int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, - size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t B, int ldb, - size_t info, int policy, size_t pBuffer) except *: - _setStream(handle) - status = cusparseZcsrsm2_solve( - handle, algo, transA, transB, m, nrhs, - nnz, alpha, descrA, - csrSortedValA, csrSortedRowPtrA, - csrSortedColIndA, B, ldb, - info, policy, pBuffer) - check_status(status) - -cpdef void xcsrsm2_zeroPivot( - intptr_t handle, size_t info, size_t position) except *: - _setStream(handle) - status = cusparseXcsrsm2_zeroPivot( - handle, info, position) - check_status(status) - -######################################## -# cuSPARSE Extra Function - -cpdef void xcsrgeamNnz( - intptr_t handle, int m, int n, size_t descrA, int nnzA, - size_t csrRowPtrA, size_t csrColIndA, size_t descrB, - int nnzB, size_t csrRowPtrB, size_t csrColIndB, - size_t descrC, size_t csrRowPtrC, size_t nnzTotalDevHostPtr) except *: - _setStream(handle) - status = cusparseXcsrgeamNnz( - handle, m, n, descrA, nnzA, - csrRowPtrA, csrColIndA, - descrB, nnzB, csrRowPtrB, - csrColIndB, descrC, csrRowPtrC, - nnzTotalDevHostPtr) - check_status(status) - -cpdef void scsrgeam( - intptr_t handle, int m, int n, size_t alpha, size_t descrA, - int nnzA, size_t csrValA, size_t csrRowPtrA, - size_t csrColIndA, size_t beta, size_t descrB, - int nnzB, size_t csrValB, size_t csrRowPtrB, - size_t csrColIndB, size_t descrC, size_t csrValC, - size_t csrRowPtrC, size_t csrColIndC) except *: - _setStream(handle) - status = cusparseScsrgeam( - handle, m, n, alpha, - descrA, nnzA, csrValA, - csrRowPtrA, csrColIndA, beta, - descrB, nnzB, csrValB, - csrRowPtrB, csrColIndB, - descrC, csrValC, csrRowPtrC, - csrColIndC) - check_status(status) - -cpdef void dcsrgeam( - intptr_t handle, int m, int n, size_t alpha, size_t descrA, - int nnzA, size_t csrValA, size_t csrRowPtrA, - size_t csrColIndA, size_t beta, size_t descrB, - int nnzB, size_t csrValB, size_t csrRowPtrB, - size_t csrColIndB, size_t descrC, size_t csrValC, - size_t csrRowPtrC, size_t csrColIndC) except *: - _setStream(handle) - status = cusparseDcsrgeam( - handle, m, n, alpha, - descrA, nnzA, csrValA, - csrRowPtrA, csrColIndA, beta, - descrB, nnzB, csrValB, - csrRowPtrB, csrColIndB, - descrC, csrValC, csrRowPtrC, - csrColIndC) - check_status(status) - -cpdef void ccsrgeam( - intptr_t handle, int m, int n, size_t alpha, size_t descrA, - int nnzA, size_t csrValA, size_t csrRowPtrA, - size_t csrColIndA, size_t beta, size_t descrB, - int nnzB, size_t csrValB, size_t csrRowPtrB, - size_t csrColIndB, size_t descrC, size_t csrValC, - size_t csrRowPtrC, size_t csrColIndC) except *: - _setStream(handle) - status = cusparseCcsrgeam( - handle, m, n, alpha, - descrA, nnzA, csrValA, - csrRowPtrA, csrColIndA, - beta, - descrB, nnzB, csrValB, - csrRowPtrB, csrColIndB, - descrC, csrValC, csrRowPtrC, - csrColIndC) - check_status(status) - -cpdef void zcsrgeam( - intptr_t handle, int m, int n, size_t alpha, size_t descrA, - int nnzA, size_t csrValA, size_t csrRowPtrA, - size_t csrColIndA, size_t beta, size_t descrB, - int nnzB, size_t csrValB, size_t csrRowPtrB, - size_t csrColIndB, size_t descrC, size_t csrValC, - size_t csrRowPtrC, size_t csrColIndC) except *: - _setStream(handle) - status = cusparseZcsrgeam( - handle, m, n, alpha, - descrA, nnzA, csrValA, - csrRowPtrA, csrColIndA, - beta, - descrB, nnzB, csrValB, - csrRowPtrB, csrColIndB, - descrC, csrValC, csrRowPtrC, - csrColIndC) - check_status(status) - -cpdef size_t scsrgeam2_bufferSizeExt( - intptr_t handle, int m, int n, size_t alpha, size_t descrA, - int nnzA, size_t csrValA, size_t csrRowPtrA, - size_t csrColIndA, size_t beta, size_t descrB, - int nnzB, size_t csrValB, size_t csrRowPtrB, - size_t csrColIndB, size_t descrC, size_t csrValC, - size_t csrRowPtrC, size_t csrColIndC) except? -1: - cdef size_t bufferSize - _setStream(handle) - status = cusparseScsrgeam2_bufferSizeExt( - handle, m, n, alpha, - descrA, nnzA, csrValA, - csrRowPtrA, csrColIndA, beta, - descrB, nnzB, csrValB, - csrRowPtrB, csrColIndB, - descrC, csrValC, csrRowPtrC, - csrColIndC, &bufferSize) - check_status(status) - return bufferSize - -cpdef size_t dcsrgeam2_bufferSizeExt( - intptr_t handle, int m, int n, size_t alpha, size_t descrA, - int nnzA, size_t csrValA, size_t csrRowPtrA, - size_t csrColIndA, size_t beta, size_t descrB, - int nnzB, size_t csrValB, size_t csrRowPtrB, - size_t csrColIndB, size_t descrC, size_t csrValC, - size_t csrRowPtrC, size_t csrColIndC) except? -1: - cdef size_t bufferSize - _setStream(handle) - status = cusparseDcsrgeam2_bufferSizeExt( - handle, m, n, alpha, - descrA, nnzA, csrValA, - csrRowPtrA, csrColIndA, beta, - descrB, nnzB, csrValB, - csrRowPtrB, csrColIndB, - descrC, csrValC, csrRowPtrC, - csrColIndC, &bufferSize) - check_status(status) - return bufferSize - -cpdef size_t ccsrgeam2_bufferSizeExt( - intptr_t handle, int m, int n, size_t alpha, size_t descrA, - int nnzA, size_t csrValA, size_t csrRowPtrA, - size_t csrColIndA, size_t beta, size_t descrB, - int nnzB, size_t csrValB, size_t csrRowPtrB, - size_t csrColIndB, size_t descrC, size_t csrValC, - size_t csrRowPtrC, size_t csrColIndC) except? -1: - cdef size_t bufferSize - _setStream(handle) - status = cusparseCcsrgeam2_bufferSizeExt( - handle, m, n, alpha, - descrA, nnzA, csrValA, - csrRowPtrA, csrColIndA, - beta, - descrB, nnzB, csrValB, - csrRowPtrB, csrColIndB, - descrC, csrValC, csrRowPtrC, - csrColIndC, &bufferSize) - check_status(status) - return bufferSize - -cpdef size_t zcsrgeam2_bufferSizeExt( - intptr_t handle, int m, int n, size_t alpha, size_t descrA, - int nnzA, size_t csrValA, size_t csrRowPtrA, - size_t csrColIndA, size_t beta, size_t descrB, - int nnzB, size_t csrValB, size_t csrRowPtrB, - size_t csrColIndB, size_t descrC, size_t csrValC, - size_t csrRowPtrC, size_t csrColIndC) except? -1: - cdef size_t bufferSize - _setStream(handle) - status = cusparseZcsrgeam2_bufferSizeExt( - handle, m, n, alpha, - descrA, nnzA, csrValA, - csrRowPtrA, csrColIndA, - beta, - descrB, nnzB, csrValB, - csrRowPtrB, csrColIndB, - descrC, csrValC, csrRowPtrC, - csrColIndC, &bufferSize) - check_status(status) - return bufferSize - -cpdef void xcsrgeam2Nnz( - intptr_t handle, int m, int n, size_t descrA, int nnzA, - size_t csrRowPtrA, size_t csrColIndA, size_t descrB, - int nnzB, size_t csrRowPtrB, size_t csrColIndB, - size_t descrC, size_t csrRowPtrC, size_t nnzTotalDevHostPtr, - size_t workspace) except *: - _setStream(handle) - status = cusparseXcsrgeam2Nnz( - handle, m, n, descrA, nnzA, - csrRowPtrA, csrColIndA, - descrB, nnzB, csrRowPtrB, - csrColIndB, descrC, csrRowPtrC, - nnzTotalDevHostPtr, workspace) - check_status(status) - -cpdef void scsrgeam2( - intptr_t handle, int m, int n, size_t alpha, size_t descrA, - int nnzA, size_t csrValA, size_t csrRowPtrA, - size_t csrColIndA, size_t beta, size_t descrB, - int nnzB, size_t csrValB, size_t csrRowPtrB, - size_t csrColIndB, size_t descrC, size_t csrValC, - size_t csrRowPtrC, size_t csrColIndC, size_t buffer) except *: - _setStream(handle) - status = cusparseScsrgeam2( - handle, m, n, alpha, - descrA, nnzA, csrValA, - csrRowPtrA, csrColIndA, beta, - descrB, nnzB, csrValB, - csrRowPtrB, csrColIndB, - descrC, csrValC, csrRowPtrC, - csrColIndC, buffer) - check_status(status) - -cpdef void dcsrgeam2( - intptr_t handle, int m, int n, size_t alpha, size_t descrA, - int nnzA, size_t csrValA, size_t csrRowPtrA, - size_t csrColIndA, size_t beta, size_t descrB, - int nnzB, size_t csrValB, size_t csrRowPtrB, - size_t csrColIndB, size_t descrC, size_t csrValC, - size_t csrRowPtrC, size_t csrColIndC, size_t buffer) except *: - _setStream(handle) - status = cusparseDcsrgeam2( - handle, m, n, alpha, - descrA, nnzA, csrValA, - csrRowPtrA, csrColIndA, beta, - descrB, nnzB, csrValB, - csrRowPtrB, csrColIndB, - descrC, csrValC, csrRowPtrC, - csrColIndC, buffer) - check_status(status) - -cpdef void ccsrgeam2( - intptr_t handle, int m, int n, size_t alpha, size_t descrA, - int nnzA, size_t csrValA, size_t csrRowPtrA, - size_t csrColIndA, size_t beta, size_t descrB, - int nnzB, size_t csrValB, size_t csrRowPtrB, - size_t csrColIndB, size_t descrC, size_t csrValC, - size_t csrRowPtrC, size_t csrColIndC, size_t buffer) except *: - _setStream(handle) - status = cusparseCcsrgeam2( - handle, m, n, alpha, - descrA, nnzA, csrValA, - csrRowPtrA, csrColIndA, - beta, - descrB, nnzB, csrValB, - csrRowPtrB, csrColIndB, - descrC, csrValC, csrRowPtrC, - csrColIndC, buffer) - check_status(status) - -cpdef void zcsrgeam2( - intptr_t handle, int m, int n, size_t alpha, size_t descrA, - int nnzA, size_t csrValA, size_t csrRowPtrA, - size_t csrColIndA, size_t beta, size_t descrB, - int nnzB, size_t csrValB, size_t csrRowPtrB, - size_t csrColIndB, size_t descrC, size_t csrValC, - size_t csrRowPtrC, size_t csrColIndC, size_t buffer) except *: - _setStream(handle) - status = cusparseZcsrgeam2( - handle, m, n, alpha, - descrA, nnzA, csrValA, - csrRowPtrA, csrColIndA, - beta, - descrB, nnzB, csrValB, - csrRowPtrB, csrColIndB, - descrC, csrValC, csrRowPtrC, - csrColIndC, buffer) - check_status(status) - -cpdef void xcsrgemmNnz( - intptr_t handle, int transA, int transB, int m, int n, int k, - size_t descrA, int nnzA, size_t csrRowPtrA, - size_t csrColIndA, size_t descrB, int nnzB, - size_t csrRowPtrB, size_t csrColIndB, - size_t descrC, size_t csrRowPtrC, size_t nnzTotalDevHostPtr) except *: - _setStream(handle) - status = cusparseXcsrgemmNnz( - handle, transA, transB, m, n, k, - descrA, nnzA, csrRowPtrA, - csrColIndA, descrB, nnzB, - csrRowPtrB, csrColIndB, - descrC, csrRowPtrC, nnzTotalDevHostPtr) - check_status(status) - -cpdef void scsrgemm( - intptr_t handle, int transA, int transB, int m, int n, int k, - size_t descrA, const int nnzA, size_t csrValA, - size_t csrRowPtrA, size_t csrColIndA, size_t descrB, - const int nnzB, size_t csrValB, size_t csrRowPtrB, - size_t csrColIndB, size_t descrC, size_t csrValC, - size_t csrRowPtrC, size_t csrColIndC) except *: - _setStream(handle) - status = cusparseScsrgemm( - handle, transA, transB, m, n, k, - descrA, nnzA, csrValA, - csrRowPtrA, csrColIndA, - descrB, nnzB, csrValB, - csrRowPtrB, csrColIndB, - descrC, csrValC, - csrRowPtrC, csrColIndC) - check_status(status) - -cpdef void dcsrgemm( - intptr_t handle, int transA, int transB, int m, int n, int k, - size_t descrA, const int nnzA, size_t csrValA, - size_t csrRowPtrA, size_t csrColIndA, size_t descrB, - const int nnzB, size_t csrValB, size_t csrRowPtrB, - size_t csrColIndB, size_t descrC, size_t csrValC, - size_t csrRowPtrC, size_t csrColIndC) except *: - _setStream(handle) - status = cusparseDcsrgemm( - handle, transA, transB, m, n, k, - descrA, nnzA, csrValA, - csrRowPtrA, csrColIndA, - descrB, nnzB, csrValB, - csrRowPtrB, csrColIndB, - descrC, csrValC, - csrRowPtrC, csrColIndC) - check_status(status) - -cpdef void ccsrgemm( - intptr_t handle, int transA, int transB, int m, int n, int k, - size_t descrA, const int nnzA, size_t csrValA, - size_t csrRowPtrA, size_t csrColIndA, size_t descrB, - const int nnzB, size_t csrValB, size_t csrRowPtrB, - size_t csrColIndB, size_t descrC, size_t csrValC, - size_t csrRowPtrC, size_t csrColIndC) except *: - _setStream(handle) - status = cusparseCcsrgemm( - handle, transA, transB, m, n, k, - descrA, nnzA, csrValA, - csrRowPtrA, csrColIndA, - descrB, nnzB, csrValB, - csrRowPtrB, csrColIndB, - descrC, csrValC, - csrRowPtrC, csrColIndC) - check_status(status) - -cpdef void zcsrgemm( - intptr_t handle, int transA, int transB, int m, int n, int k, - size_t descrA, const int nnzA, size_t csrValA, - size_t csrRowPtrA, size_t csrColIndA, size_t descrB, - const int nnzB, size_t csrValB, size_t csrRowPtrB, - size_t csrColIndB, size_t descrC, size_t csrValC, - size_t csrRowPtrC, size_t csrColIndC) except *: - _setStream(handle) - status = cusparseZcsrgemm( - handle, transA, transB, m, n, k, - descrA, nnzA, csrValA, - csrRowPtrA, csrColIndA, - descrB, nnzB, csrValB, - csrRowPtrB, csrColIndB, - descrC, csrValC, - csrRowPtrC, csrColIndC) - check_status(status) - -cpdef size_t createCsrgemm2Info() except? -1: - cdef csrgemm2Info_t info - with nogil: - status = cusparseCreateCsrgemm2Info(&info) - check_status(status) - return info - -cpdef void destroyCsrgemm2Info(size_t info) except *: - with nogil: - status = cusparseDestroyCsrgemm2Info(info) - check_status(status) - -cpdef size_t scsrgemm2_bufferSizeExt( - intptr_t handle, int m, int n, int k, - size_t alpha, - size_t descrA, int nnzA, size_t csrRowPtrA, size_t csrColIndA, - size_t descrB, int nnzB, size_t csrRowPtrB, size_t csrColIndB, - size_t beta, - size_t descrD, int nnzD, size_t csrRowPtrD, size_t csrColIndD, - size_t info) except? -1: - cdef size_t bufferSize - status = cusparseScsrgemm2_bufferSizeExt( - handle, m, n, k, - alpha, - descrA, nnzA, csrRowPtrA, csrColIndA, - descrB, nnzB, csrRowPtrB, csrColIndB, - beta, - descrD, nnzD, csrRowPtrD, csrColIndD, - info, &bufferSize) - check_status(status) - return bufferSize - -cpdef size_t dcsrgemm2_bufferSizeExt( - intptr_t handle, int m, int n, int k, - size_t alpha, - size_t descrA, int nnzA, size_t csrRowPtrA, size_t csrColIndA, - size_t descrB, int nnzB, size_t csrRowPtrB, size_t csrColIndB, - size_t beta, - size_t descrD, int nnzD, size_t csrRowPtrD, size_t csrColIndD, - size_t info) except? -1: - cdef size_t bufferSize - status = cusparseDcsrgemm2_bufferSizeExt( - handle, m, n, k, - alpha, - descrA, nnzA, csrRowPtrA, csrColIndA, - descrB, nnzB, csrRowPtrB, csrColIndB, - beta, - descrD, nnzD, csrRowPtrD, csrColIndD, - info, &bufferSize) - check_status(status) - return bufferSize - -cpdef size_t ccsrgemm2_bufferSizeExt( - intptr_t handle, int m, int n, int k, - size_t alpha, - size_t descrA, int nnzA, size_t csrRowPtrA, size_t csrColIndA, - size_t descrB, int nnzB, size_t csrRowPtrB, size_t csrColIndB, - size_t beta, - size_t descrD, int nnzD, size_t csrRowPtrD, size_t csrColIndD, - size_t info) except? -1: - cdef size_t bufferSize - status = cusparseCcsrgemm2_bufferSizeExt( - handle, m, n, k, - alpha, - descrA, nnzA, csrRowPtrA, csrColIndA, - descrB, nnzB, csrRowPtrB, csrColIndB, - beta, - descrD, nnzD, csrRowPtrD, csrColIndD, - info, &bufferSize) - check_status(status) - return bufferSize - -cpdef size_t zcsrgemm2_bufferSizeExt( - intptr_t handle, int m, int n, int k, - size_t alpha, - size_t descrA, int nnzA, size_t csrRowPtrA, size_t csrColIndA, - size_t descrB, int nnzB, size_t csrRowPtrB, size_t csrColIndB, - size_t beta, - size_t descrD, int nnzD, size_t csrRowPtrD, size_t csrColIndD, - size_t info) except? -1: - cdef size_t bufferSize - status = cusparseZcsrgemm2_bufferSizeExt( - handle, m, n, k, - alpha, - descrA, nnzA, csrRowPtrA, csrColIndA, - descrB, nnzB, csrRowPtrB, csrColIndB, - beta, - descrD, nnzD, csrRowPtrD, csrColIndD, - info, &bufferSize) - check_status(status) - return bufferSize - -cpdef void xcsrgemm2Nnz( - intptr_t handle, int m, int n, int k, - size_t descrA, int nnzA, size_t csrRowPtrA, size_t csrColIndA, - size_t descrB, int nnzB, size_t csrRowPtrB, size_t csrColIndB, - size_t descrD, int nnzD, size_t csrRowPtrD, size_t csrColIndD, - size_t descrC, size_t csrRowPtrC, - intptr_t nnzTotalDevHostPtr, size_t info, intptr_t pBuffer) except *: - _setStream(handle) - status = cusparseXcsrgemm2Nnz( - handle, m, n, k, - descrA, nnzA, csrRowPtrA, csrColIndA, - descrB, nnzB, csrRowPtrB, csrColIndB, - descrD, nnzD, csrRowPtrD, csrColIndD, - descrC, csrRowPtrC, - nnzTotalDevHostPtr, info, pBuffer) - check_status(status) - -cpdef void scsrgemm2( - intptr_t handle, int m, int n, int k, size_t alpha, size_t descrA, - int nnzA, size_t csrValA, size_t csrRowPtrA, size_t csrColIndA, - size_t descrB, int nnzB, size_t csrValB, size_t csrRowPtrB, - size_t csrColIndB, size_t beta, size_t descrD, int nnzD, - size_t csrValD, size_t csrRowPtrD, size_t csrColIndD, size_t descrC, - size_t csrValC, size_t csrRowPtrC, size_t csrColIndC, size_t info, - intptr_t pBuffer) except *: - _setStream(handle) - status = cusparseScsrgemm2( - handle, m, n, k, alpha, descrA, nnzA, - csrValA, csrRowPtrA, csrColIndA, descrB, - nnzB, csrValB, csrRowPtrB, csrColIndB, - beta, descrD, nnzD, csrValD, - csrRowPtrD, csrColIndD, descrC, csrValC, - csrRowPtrC, csrColIndC, info, - pBuffer) - check_status(status) - -cpdef void dcsrgemm2( - intptr_t handle, int m, int n, int k, size_t alpha, size_t descrA, - int nnzA, size_t csrValA, size_t csrRowPtrA, size_t csrColIndA, - size_t descrB, int nnzB, size_t csrValB, size_t csrRowPtrB, - size_t csrColIndB, size_t beta, size_t descrD, int nnzD, - size_t csrValD, size_t csrRowPtrD, size_t csrColIndD, size_t descrC, - size_t csrValC, size_t csrRowPtrC, size_t csrColIndC, size_t info, - intptr_t pBuffer) except *: - _setStream(handle) - status = cusparseDcsrgemm2( - handle, m, n, k, alpha, descrA, nnzA, - csrValA, csrRowPtrA, csrColIndA, descrB, - nnzB, csrValB, csrRowPtrB, csrColIndB, - beta, descrD, nnzD, csrValD, - csrRowPtrD, csrColIndD, descrC, csrValC, - csrRowPtrC, csrColIndC, info, - pBuffer) - check_status(status) - -cpdef void ccsrgemm2( - intptr_t handle, int m, int n, int k, size_t alpha, size_t descrA, - int nnzA, size_t csrValA, size_t csrRowPtrA, size_t csrColIndA, - size_t descrB, int nnzB, size_t csrValB, size_t csrRowPtrB, - size_t csrColIndB, size_t beta, size_t descrD, int nnzD, - size_t csrValD, size_t csrRowPtrD, size_t csrColIndD, size_t descrC, - size_t csrValC, size_t csrRowPtrC, size_t csrColIndC, size_t info, - intptr_t pBuffer) except *: - _setStream(handle) - status = cusparseCcsrgemm2( - handle, m, n, k, alpha, descrA, nnzA, - csrValA, csrRowPtrA, csrColIndA, - descrB, nnzB, csrValB, csrRowPtrB, - csrColIndB, beta, descrD, nnzD, - csrValD, csrRowPtrD, csrColIndD, - descrC, csrValC, csrRowPtrC, - csrColIndC, info, pBuffer) - check_status(status) - -cpdef void zcsrgemm2( - intptr_t handle, int m, int n, int k, size_t alpha, size_t descrA, - int nnzA, size_t csrValA, size_t csrRowPtrA, size_t csrColIndA, - size_t descrB, int nnzB, size_t csrValB, size_t csrRowPtrB, - size_t csrColIndB, size_t beta, size_t descrD, int nnzD, - size_t csrValD, size_t csrRowPtrD, size_t csrColIndD, size_t descrC, - size_t csrValC, size_t csrRowPtrC, size_t csrColIndC, size_t info, - intptr_t pBuffer) except *: - _setStream(handle) - status = cusparseZcsrgemm2( - handle, m, n, k, alpha, descrA, - nnzA, csrValA, csrRowPtrA, csrColIndA, - descrB, nnzB, csrValB, csrRowPtrB, - csrColIndB, beta, descrD, nnzD, - csrValD, csrRowPtrD, csrColIndD, - descrC, csrValC, csrRowPtrC, - csrColIndC, info, pBuffer) - check_status(status) - -######################################## -# cuSPARSE Format Convrsion - -cpdef void xcoo2csr( - intptr_t handle, size_t cooRowInd, int nnz, int m, size_t csrRowPtr, - int idxBase) except *: - _setStream(handle) - status = cusparseXcoo2csr( - handle, cooRowInd, nnz, m, csrRowPtr, - idxBase) - check_status(status) - - -cpdef void scsc2dense( - intptr_t handle, int m, int n, size_t descrA, - size_t cscSortedValA, size_t cscSortedRowIndA, - size_t cscSortedColPtrA, size_t A, int lda) except *: - _setStream(handle) - status = cusparseScsc2dense( - handle, m, n, descrA, - cscSortedValA, cscSortedRowIndA, - cscSortedColPtrA, A, lda) - check_status(status) - - -cpdef void dcsc2dense( - intptr_t handle, int m, int n, size_t descrA, - size_t cscSortedValA, size_t cscSortedRowIndA, - size_t cscSortedColPtrA, size_t A, int lda) except *: - _setStream(handle) - status = cusparseDcsc2dense( - handle, m, n, descrA, - cscSortedValA, cscSortedRowIndA, - cscSortedColPtrA, A, lda) - check_status(status) - -cpdef void ccsc2dense( - intptr_t handle, int m, int n, size_t descrA, - size_t cscSortedValA, size_t cscSortedRowIndA, - size_t cscSortedColPtrA, size_t A, int lda) except *: - _setStream(handle) - status = cusparseCcsc2dense( - handle, m, n, descrA, - cscSortedValA, cscSortedRowIndA, - cscSortedColPtrA, A, lda) - check_status(status) - -cpdef void zcsc2dense( - intptr_t handle, int m, int n, size_t descrA, - size_t cscSortedValA, size_t cscSortedRowIndA, - size_t cscSortedColPtrA, size_t A, int lda) except *: - _setStream(handle) - status = cusparseZcsc2dense( - handle, m, n, descrA, - cscSortedValA, cscSortedRowIndA, - cscSortedColPtrA, A, lda) - check_status(status) - -cpdef void xcsr2coo( - intptr_t handle, size_t csrRowPtr, int nnz, int m, size_t cooRowInd, - int idxBase) except *: - _setStream(handle) - status = cusparseXcsr2coo( - handle, csrRowPtr, nnz, m, cooRowInd, - idxBase) - check_status(status) - - -cpdef void scsr2csc( - intptr_t handle, int m, int n, int nnz, size_t csrVal, - size_t csrRowPtr, size_t csrColInd, size_t cscVal, - size_t cscRowInd, size_t cscColPtr, int copyValues, - int idxBase) except *: - _setStream(handle) - status = cusparseScsr2csc( - handle, m, n, nnz, csrVal, - csrRowPtr, csrColInd, cscVal, - cscRowInd, cscColPtr, copyValues, - idxBase) - check_status(status) - - -cpdef void dcsr2csc( - intptr_t handle, int m, int n, int nnz, size_t csrVal, - size_t csrRowPtr, size_t csrColInd, size_t cscVal, - size_t cscRowInd, size_t cscColPtr, int copyValues, - int idxBase) except *: - _setStream(handle) - status = cusparseDcsr2csc( - handle, m, n, nnz, csrVal, - csrRowPtr, csrColInd, cscVal, - cscRowInd, cscColPtr, copyValues, - idxBase) - check_status(status) - -cpdef void ccsr2csc( - intptr_t handle, int m, int n, int nnz, size_t csrVal, - size_t csrRowPtr, size_t csrColInd, size_t cscVal, - size_t cscRowInd, size_t cscColPtr, int copyValues, - int idxBase) except *: - _setStream(handle) - status = cusparseCcsr2csc( - handle, m, n, nnz, csrVal, - csrRowPtr, csrColInd, cscVal, - cscRowInd, cscColPtr, copyValues, - idxBase) - check_status(status) - -cpdef void zcsr2csc( - intptr_t handle, int m, int n, int nnz, size_t csrVal, - size_t csrRowPtr, size_t csrColInd, size_t cscVal, - size_t cscRowInd, size_t cscColPtr, int copyValues, - int idxBase) except *: - _setStream(handle) - status = cusparseZcsr2csc( - handle, m, n, nnz, csrVal, - csrRowPtr, csrColInd, - cscVal, - cscRowInd, cscColPtr, copyValues, - idxBase) - check_status(status) - -cpdef void scsr2dense( - intptr_t handle, int m, int n, size_t descrA, - size_t csrSortedValA, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t A, int lda) except *: - _setStream(handle) - status = cusparseScsr2dense( - handle, m, n, descrA, - csrSortedValA, csrSortedRowPtrA, - csrSortedColIndA, A, lda) - check_status(status) - -cpdef void dcsr2dense( - intptr_t handle, int m, int n, size_t descrA, - size_t csrSortedValA, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t A, int lda) except *: - _setStream(handle) - status = cusparseDcsr2dense( - handle, m, n, descrA, - csrSortedValA, csrSortedRowPtrA, - csrSortedColIndA, A, lda) - check_status(status) - -cpdef void ccsr2dense( - intptr_t handle, int m, int n, size_t descrA, - size_t csrSortedValA, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t A, int lda) except *: - _setStream(handle) - status = cusparseCcsr2dense( - handle, m, n, descrA, - csrSortedValA, csrSortedRowPtrA, - csrSortedColIndA, A, lda) - check_status(status) - -cpdef void zcsr2dense( - intptr_t handle, int m, int n, size_t descrA, - size_t csrSortedValA, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t A, int lda) except *: - _setStream(handle) - status = cusparseZcsr2dense( - handle, m, n, descrA, - csrSortedValA, csrSortedRowPtrA, - csrSortedColIndA, A, lda) - check_status(status) - -cpdef int snnz_compress( - intptr_t handle, int m, size_t descr, - size_t values, size_t rowPtr, size_t nnzPerRow, - float tol) except? -1: - cdef int nnz_total - _setStream(handle) - status = cusparseSnnz_compress( - handle, m, descr, - values, rowPtr, nnzPerRow, - &nnz_total, tol) - check_status(status) - return nnz_total - -cpdef int dnnz_compress( - intptr_t handle, int m, size_t descr, - size_t values, size_t rowPtr, size_t nnzPerRow, - double tol) except? -1: - cdef int nnz_total - _setStream(handle) - status = cusparseDnnz_compress( - handle, m, descr, - values, rowPtr, nnzPerRow, - &nnz_total, tol) - check_status(status) - return nnz_total - -cpdef int cnnz_compress( - intptr_t handle, int m, size_t descr, - size_t values, size_t rowPtr, size_t nnzPerRow, - complex tol) except? -1: - cdef int nnz_total - _setStream(handle) - status = cusparseCnnz_compress( - handle, m, descr, - values, rowPtr, nnzPerRow, - &nnz_total, complex_to_cuda(tol)) - check_status(status) - return nnz_total - -cpdef int znnz_compress( - intptr_t handle, int m, size_t descr, - size_t values, size_t rowPtr, size_t nnzPerRow, - double complex tol) except? -1: - cdef int nnz_total - _setStream(handle) - status = cusparseZnnz_compress( - handle, m, descr, - values, rowPtr, nnzPerRow, - &nnz_total, double_complex_to_cuda(tol)) - check_status(status) - return nnz_total - -cpdef void scsr2csr_compress( - intptr_t handle, int m, int n, size_t descrA, - size_t inVal, size_t inColInd, size_t inRowPtr, - int inNnz, size_t nnzPerRow, size_t outVal, size_t outColInd, - size_t outRowPtr, float tol) except *: - _setStream(handle) - status = cusparseScsr2csr_compress( - handle, m, n, descrA, - inVal, inColInd, inRowPtr, - inNnz, nnzPerRow, outVal, outColInd, - outRowPtr, tol) - check_status(status) - - -cpdef void dcsr2csr_compress( - intptr_t handle, int m, int n, size_t descrA, - size_t inVal, size_t inColInd, size_t inRowPtr, - int inNnz, size_t nnzPerRow, size_t outVal, size_t outColInd, - size_t outRowPtr, float tol) except *: - _setStream(handle) - status = cusparseDcsr2csr_compress( - handle, m, n, descrA, - inVal, inColInd, inRowPtr, - inNnz, nnzPerRow, outVal, outColInd, - outRowPtr, tol) - check_status(status) - -cpdef void ccsr2csr_compress( - intptr_t handle, int m, int n, size_t descrA, - size_t inVal, size_t inColInd, size_t inRowPtr, - int inNnz, size_t nnzPerRow, size_t outVal, size_t outColInd, - size_t outRowPtr, complex tol) except *: - _setStream(handle) - status = cusparseCcsr2csr_compress( - handle, m, n, descrA, - inVal, inColInd, inRowPtr, - inNnz, nnzPerRow, outVal, outColInd, - outRowPtr, complex_to_cuda(tol)) - check_status(status) - -cpdef void zcsr2csr_compress( - intptr_t handle, int m, int n, size_t descrA, - size_t inVal, size_t inColInd, size_t inRowPtr, - int inNnz, size_t nnzPerRow, size_t outVal, size_t outColInd, - size_t outRowPtr, double complex tol) except *: - _setStream(handle) - status = cusparseZcsr2csr_compress( - handle, m, n, descrA, - inVal, inColInd, - inRowPtr, - inNnz, nnzPerRow, outVal, outColInd, - outRowPtr, double_complex_to_cuda(tol)) - check_status(status) - -cpdef void sdense2csc( - intptr_t handle, int m, int n, size_t descrA, size_t A, - int lda, size_t nnzPerCol, size_t cscValA, size_t cscRowIndA, - size_t cscColPtrA) except *: - _setStream(handle) - status = cusparseSdense2csc( - handle, m, n, descrA, A, - lda, nnzPerCol, cscValA, cscRowIndA, - cscColPtrA) - check_status(status) - - -cpdef void ddense2csc( - intptr_t handle, int m, int n, size_t descrA, size_t A, - int lda, size_t nnzPerCol, size_t cscValA, size_t cscRowIndA, - size_t cscColPtrA) except *: - _setStream(handle) - status = cusparseDdense2csc( - handle, m, n, descrA, A, - lda, nnzPerCol, cscValA, cscRowIndA, - cscColPtrA) - check_status(status) - -cpdef void cdense2csc( - intptr_t handle, int m, int n, size_t descrA, size_t A, - int lda, size_t nnzPerCol, size_t cscValA, size_t cscRowIndA, - size_t cscColPtrA) except *: - _setStream(handle) - status = cusparseCdense2csc( - handle, m, n, descrA, A, - lda, nnzPerCol, cscValA, cscRowIndA, - cscColPtrA) - check_status(status) - -cpdef void zdense2csc( - intptr_t handle, int m, int n, size_t descrA, size_t A, - int lda, size_t nnzPerCol, size_t cscValA, size_t cscRowIndA, - size_t cscColPtrA) except *: - _setStream(handle) - status = cusparseZdense2csc( - handle, m, n, - descrA, A, - lda, nnzPerCol, - cscValA, cscRowIndA, - cscColPtrA) - check_status(status) - -cpdef void sdense2csr( - intptr_t handle, int m, int n, size_t descrA, - size_t A, int lda, size_t nnzPerRow, size_t csrValA, - size_t csrRowPtrA, size_t csrColIndA) except *: - _setStream(handle) - status = cusparseSdense2csr( - handle, m, n, descrA, - A, lda, nnzPerRow, csrValA, - csrRowPtrA, csrColIndA) - check_status(status) - - -cpdef void ddense2csr( - intptr_t handle, int m, int n, size_t descrA, - size_t A, int lda, size_t nnzPerRow, size_t csrValA, - size_t csrRowPtrA, size_t csrColIndA) except *: - _setStream(handle) - status = cusparseDdense2csr( - handle, m, n, descrA, - A, lda, nnzPerRow, csrValA, - csrRowPtrA, csrColIndA) - check_status(status) - -cpdef void cdense2csr( - intptr_t handle, int m, int n, size_t descrA, - size_t A, int lda, size_t nnzPerRow, size_t csrValA, - size_t csrRowPtrA, size_t csrColIndA) except *: - _setStream(handle) - status = cusparseCdense2csr( - handle, m, n, descrA, - A, lda, nnzPerRow, - csrValA, csrRowPtrA, csrColIndA) - check_status(status) - -cpdef void zdense2csr( - intptr_t handle, int m, int n, size_t descrA, - size_t A, int lda, size_t nnzPerRow, size_t csrValA, - size_t csrRowPtrA, size_t csrColIndA) except *: - _setStream(handle) - status = cusparseZdense2csr( - handle, m, n, descrA, - A, lda, nnzPerRow, - csrValA, csrRowPtrA, csrColIndA) - check_status(status) - -cpdef void snnz( - intptr_t handle, int dirA, int m, int n, size_t descrA, - size_t A, int lda, size_t nnzPerRowColumn, - size_t nnzTotalDevHostPtr) except *: - _setStream(handle) - status = cusparseSnnz( - handle, dirA, m, n, descrA, - A, lda, nnzPerRowColumn, - nnzTotalDevHostPtr) - check_status(status) - - -cpdef void dnnz( - intptr_t handle, int dirA, int m, int n, size_t descrA, - size_t A, int lda, size_t nnzPerRowColumn, - size_t nnzTotalDevHostPtr) except *: - _setStream(handle) - status = cusparseDnnz( - handle, dirA, m, n, descrA, - A, lda, nnzPerRowColumn, - nnzTotalDevHostPtr) - check_status(status) - -cpdef void cnnz( - intptr_t handle, int dirA, int m, int n, size_t descrA, - size_t A, int lda, size_t nnzPerRowColumn, - size_t nnzTotalDevHostPtr) except *: - _setStream(handle) - status = cusparseCnnz( - handle, dirA, m, n, descrA, - A, lda, nnzPerRowColumn, - nnzTotalDevHostPtr) - check_status(status) - -cpdef void znnz( - intptr_t handle, int dirA, int m, int n, size_t descrA, - size_t A, int lda, size_t nnzPerRowColumn, - size_t nnzTotalDevHostPtr) except *: - _setStream(handle) - status = cusparseZnnz( - handle, dirA, m, n, descrA, - A, lda, nnzPerRowColumn, - nnzTotalDevHostPtr) - check_status(status) - -cpdef void createIdentityPermutation( - intptr_t handle, int n, size_t p) except *: - _setStream(handle) - status = cusparseCreateIdentityPermutation( - handle, n, p) - check_status(status) - - -cpdef size_t xcoosort_bufferSizeExt( - intptr_t handle, int m, int n, int nnz, size_t cooRows, - size_t cooCols) except? -1: - cdef size_t bufferSizeInBytes - _setStream(handle) - status = cusparseXcoosort_bufferSizeExt( - handle, m, n, nnz, cooRows, - cooCols, &bufferSizeInBytes) - check_status(status) - return bufferSizeInBytes - - -cpdef void xcoosortByRow( - intptr_t handle, int m, int n, int nnz, size_t cooRows, size_t cooCols, - size_t P, size_t pBuffer) except *: - _setStream(handle) - status = cusparseXcoosortByRow( - handle, m, n, nnz, cooRows, cooCols, - P, pBuffer) - check_status(status) - - -cpdef void xcoosortByColumn( - intptr_t handle, int m, int n, int nnz, size_t cooRows, size_t cooCols, - size_t P, size_t pBuffer) except *: - _setStream(handle) - status = cusparseXcoosortByColumn( - handle, m, n, nnz, cooRows, cooCols, - P, pBuffer) - check_status(status) - - -cpdef size_t xcsrsort_bufferSizeExt( - intptr_t handle, int m, int n, int nnz, size_t csrRowPtr, - size_t csrColInd) except? -1: - cdef size_t bufferSizeInBytes - _setStream(handle) - status = cusparseXcsrsort_bufferSizeExt( - handle, m, n, nnz, csrRowPtr, - csrColInd, &bufferSizeInBytes) - check_status(status) - return bufferSizeInBytes - - -cpdef void xcsrsort( - intptr_t handle, int m, int n, int nnz, size_t descrA, - size_t csrRowPtr, size_t csrColInd, size_t P, size_t pBuffer) except *: - _setStream(handle) - status = cusparseXcsrsort( - handle, m, n, nnz, descrA, - csrRowPtr, csrColInd, P, pBuffer) - check_status(status) - - -cpdef size_t xcscsort_bufferSizeExt( - intptr_t handle, int m, int n, int nnz, size_t cscColPtr, - size_t cscRowInd) except? -1: - cdef size_t bufferSizeInBytes - _setStream(handle) - status = cusparseXcscsort_bufferSizeExt( - handle, m, n, nnz, cscColPtr, - cscRowInd, &bufferSizeInBytes) - check_status(status) - return bufferSizeInBytes - - -cpdef void xcscsort( - intptr_t handle, int m, int n, int nnz, size_t descrA, - size_t cscColPtr, size_t cscRowInd, size_t P, size_t pBuffer) except *: - _setStream(handle) - status = cusparseXcscsort( - handle, m, n, nnz, descrA, - cscColPtr, cscRowInd, P, pBuffer) - check_status(status) - -######################################## -# cuSPARSE PRECONDITIONERS - -cpdef size_t createCsrilu02Info() except? -1: - cdef csrilu02Info_t info - with nogil: - status = cusparseCreateCsrilu02Info(&info) - check_status(status) - return info - -cpdef void destroyCsrilu02Info(size_t info) except *: - with nogil: - status = cusparseDestroyCsrilu02Info(info) - check_status(status) - -cpdef size_t createBsrilu02Info() except? -1: - cdef bsrilu02Info_t info - with nogil: - status = cusparseCreateBsrilu02Info(&info) - check_status(status) - return info - -cpdef void destroyBsrilu02Info(size_t info) except *: - with nogil: - status = cusparseDestroyBsrilu02Info(info) - check_status(status) - -cpdef size_t createCsric02Info() except? -1: - cdef csric02Info_t info - with nogil: - status = cusparseCreateCsric02Info(&info) - check_status(status) - return info - -cpdef void destroyCsric02Info(size_t info) except *: - with nogil: - status = cusparseDestroyCsric02Info(info) - check_status(status) - -cpdef size_t createBsric02Info() except? -1: - cdef bsric02Info_t info - with nogil: - status = cusparseCreateBsric02Info(&info) - check_status(status) - return info - -cpdef void destroyBsric02Info(size_t info) except *: - with nogil: - status = cusparseDestroyBsric02Info(info) - check_status(status) - -cpdef void scsrilu02_numericBoost( - intptr_t handle, size_t info, int enable_boost, - size_t tol, size_t boost_val) except *: - _setStream(handle) - with nogil: - status = cusparseScsrilu02_numericBoost( - handle, info, enable_boost, - tol, boost_val) - check_status(status) - -cpdef void dcsrilu02_numericBoost( - intptr_t handle, size_t info, int enable_boost, - size_t tol, size_t boost_val) except *: - _setStream(handle) - with nogil: - status = cusparseDcsrilu02_numericBoost( - handle, info, enable_boost, - tol, boost_val) - check_status(status) - -cpdef void ccsrilu02_numericBoost( - intptr_t handle, size_t info, int enable_boost, - size_t tol, size_t boost_val) except *: - _setStream(handle) - with nogil: - status = cusparseCcsrilu02_numericBoost( - handle, info, enable_boost, - tol, boost_val) - check_status(status) - -cpdef void zcsrilu02_numericBoost( - intptr_t handle, size_t info, int enable_boost, - size_t tol, size_t boost_val) except *: - _setStream(handle) - with nogil: - status = cusparseZcsrilu02_numericBoost( - handle, info, enable_boost, - tol, boost_val) - check_status(status) - -cpdef void xcsrilu02_zeroPivot( - intptr_t handle, size_t info, size_t position) except *: - _setStream(handle) - with nogil: - status = cusparseXcsrilu02_zeroPivot( - handle, info, position) - check_status(status) - -cpdef int scsrilu02_bufferSize( - intptr_t handle, int m, int nnz, size_t descrA, - size_t csrSortedValA, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t info) except? -1: - cdef int pBufferSizeInBytes - _setStream(handle) - with nogil: - status = cusparseScsrilu02_bufferSize( - handle, m, nnz, descrA, +IF CUPY_USE_GEN_HIP_CODE: + from cupy_backends.cuda.libs.cusparse_hip import * +ELSE: + cdef extern from '../../cupy_complex.h': + ctypedef struct cuComplex 'cuComplex': + float x, y + + ctypedef struct cuDoubleComplex 'cuDoubleComplex': + double x, y + + cdef extern from '../../cupy_sparse.h' nogil: + ctypedef void* Stream 'cudaStream_t' + + # Version + cusparseStatus_t cusparseGetVersion(cusparseHandle_t handle, int* version) + + # Error handling + const char* cusparseGetErrorName(Status status) + const char* cusparseGetErrorString(Status status) + + # cuSPARSE Helper Function + Status cusparseCreate(Handle *handle) + Status cusparseCreateMatDescr(MatDescr descr) + Status cusparseDestroy(Handle handle) + Status cusparseDestroyMatDescr(MatDescr descr) + Status cusparseSetMatIndexBase(MatDescr descr, IndexBase base) + Status cusparseSetMatType(MatDescr descr, MatrixType type) + Status cusparseSetMatFillMode(MatDescr descrA, FillMode fillMode) + Status cusparseSetMatDiagType(MatDescr descrA, DiagType diagType) + Status cusparseSetPointerMode(Handle handle, PointerMode mode) + + # Stream + Status cusparseSetStream(Handle handle, Stream streamId) + Status cusparseGetStream(Handle handle, Stream* streamId) + + # cuSPARSE Level1 Function + Status cusparseSgthr( + Handle handle, int nnz, const float *y, float *xVal, const int *xInd, + IndexBase idxBase) + + Status cusparseDgthr( + Handle handle, int nnz, const double *y, double *xVal, const int *xInd, + IndexBase idxBase) + + Status cusparseCgthr( + Handle handle, int nnz, const cuComplex *y, cuComplex *xVal, + const int *xInd, + IndexBase idxBase) + + Status cusparseZgthr( + Handle handle, int nnz, const cuDoubleComplex *y, + cuDoubleComplex *xVal, const int *xInd, + IndexBase idxBase) + + # cuSPARSE Level2 Function + Status cusparseScsrmv( + Handle handle, Operation transA, int m, int n, int nnz, + const float *alpha, MatDescr descrA, const float *csrSortedValA, + const int *csrSortedRowPtrA, const int *csrSortedColIndA, + const float *x, const float *beta, float *y) + + Status cusparseDcsrmv( + Handle handle, Operation transA, int m, int n, int nnz, + const double *alpha, MatDescr descrA, const double *csrSortedValA, + const int *csrSortedRowPtrA, const int *csrSortedColIndA, + const double *x, const double *beta, double *y) + + Status cusparseCcsrmv( + Handle handle, Operation transA, int m, int n, int nnz, + const cuComplex *alpha, MatDescr descrA, + const cuComplex *csrSortedValA, + const int *csrSortedRowPtrA, const int *csrSortedColIndA, + const cuComplex *x, const cuComplex *beta, cuComplex *y) + + Status cusparseZcsrmv( + Handle handle, Operation transA, int m, int n, int nnz, + const cuDoubleComplex *alpha, MatDescr descrA, + const cuDoubleComplex *csrSortedValA, + const int *csrSortedRowPtrA, const int *csrSortedColIndA, + const cuDoubleComplex *x, const cuDoubleComplex *beta, + cuDoubleComplex *y) + + Status cusparseCsrmvEx_bufferSize( + Handle handle, AlgMode alg, Operation transA, int m, int n, + int nnz, const void *alpha, DataType alphatype, + MatDescr descrA, const void *csrValA, DataType csrValAtype, + const int *csrRowPtrA, const int *csrColIndA, + const void *x, DataType xtype, const void *beta, + DataType betatype, void *y, DataType ytype, + DataType executiontype, size_t *bufferSizeInBytes) + + Status cusparseCsrmvEx( + Handle handle, AlgMode alg, Operation transA, int m, int n, + int nnz, const void *alpha, DataType alphatype, + MatDescr descrA, const void *csrValA, DataType csrValAtype, + const int *csrRowPtrA, const int *csrColIndA, + const void *x, DataType xtype, const void *beta, + DataType betatype, void *y, DataType ytype, + DataType executiontype, void* buffer) + + Status cusparseCreateCsrsv2Info(csrsv2Info_t* info) + Status cusparseDestroyCsrsv2Info(csrsv2Info_t info) + + Status cusparseScsrsv2_bufferSize( + Handle handle, Operation transA, int m, int nnz, const MatDescr descrA, + float* csrSortedValA, const int* csrSortedRowPtrA, + const int* csrSortedColIndA, csrsv2Info_t info, + int* pBufferSizeInBytes) + Status cusparseDcsrsv2_bufferSize( + Handle handle, Operation transA, int m, int nnz, const MatDescr descrA, + double* csrSortedValA, const int* csrSortedRowPtrA, + const int* csrSortedColIndA, csrsv2Info_t info, + int* pBufferSizeInBytes) + Status cusparseCcsrsv2_bufferSize( + Handle handle, Operation transA, int m, int nnz, const MatDescr descrA, + cuComplex* csrSortedValA, const int* csrSortedRowPtrA, + const int* csrSortedColIndA, csrsv2Info_t info, + int* pBufferSizeInBytes) + Status cusparseZcsrsv2_bufferSize( + Handle handle, Operation transA, int m, int nnz, const MatDescr descrA, + cuDoubleComplex* csrSortedValA, const int* csrSortedRowPtrA, + const int* csrSortedColIndA, csrsv2Info_t info, + int* pBufferSizeInBytes) + + Status cusparseScsrsv2_analysis( + Handle handle, Operation transA, int m, int nnz, const MatDescr descrA, + const float* csrSortedValA, const int* csrSortedRowPtrA, + const int* csrSortedColIndA, csrsv2Info_t info, + cusparseSolvePolicy_t policy, void* pBuffer) + Status cusparseDcsrsv2_analysis( + Handle handle, Operation transA, int m, int nnz, const MatDescr descrA, + const double* csrSortedValA, const int* csrSortedRowPtrA, + const int* csrSortedColIndA, csrsv2Info_t info, + cusparseSolvePolicy_t policy, void* pBuffer) + Status cusparseCcsrsv2_analysis( + Handle handle, Operation transA, int m, int nnz, const MatDescr descrA, + const cuComplex* csrSortedValA, const int* csrSortedRowPtrA, + const int* csrSortedColIndA, csrsv2Info_t info, + cusparseSolvePolicy_t policy, void* pBuffer) + Status cusparseZcsrsv2_analysis( + Handle handle, Operation transA, int m, int nnz, const MatDescr descrA, + const cuDoubleComplex* csrSortedValA, const int* csrSortedRowPtrA, + const int* csrSortedColIndA, csrsv2Info_t info, + cusparseSolvePolicy_t policy, void* pBuffer) + + Status cusparseScsrsv2_solve( + Handle handle, Operation transA, int m, int nnz, + const float* alpha, const MatDescr descrA, + const float* csrSortedValA, const int* csrSortedRowPtrA, + const int* csrSortedColIndA, csrsv2Info_t info, + const float* x, float* y, + cusparseSolvePolicy_t policy, void* pBuffer) + Status cusparseDcsrsv2_solve( + Handle handle, Operation transA, int m, int nnz, + const double* alpha, const MatDescr descrA, + const double* csrSortedValA, const int* csrSortedRowPtrA, + const int* csrSortedColIndA, csrsv2Info_t info, + const double* x, double* y, + cusparseSolvePolicy_t policy, void* pBuffer) + Status cusparseCcsrsv2_solve( + Handle handle, Operation transA, int m, int nnz, + const cuComplex* alpha, const MatDescr descrA, + const cuComplex* csrSortedValA, const int* csrSortedRowPtrA, + const int* csrSortedColIndA, csrsv2Info_t info, + const cuComplex* x, cuComplex* y, + cusparseSolvePolicy_t policy, void* pBuffer) + Status cusparseZcsrsv2_solve( + Handle handle, Operation transA, int m, int nnz, + const cuDoubleComplex* alpha, const MatDescr descrA, + const cuDoubleComplex* csrSortedValA, const int* csrSortedRowPtrA, + const int* csrSortedColIndA, csrsv2Info_t info, + const cuDoubleComplex* x, cuDoubleComplex* y, + cusparseSolvePolicy_t policy, void* pBuffer) + + Status cusparseXcsrsv2_zeroPivot( + Handle handle, csrsv2Info_t info, int* position) + + # cuSPARSE Level3 Function + Status cusparseScsrmm( + Handle handle, Operation transA, int m, int n, int k, int nnz, + const float *alpha, const MatDescr descrA, const float *csrSortedValA, + const int *csrSortedRowPtrA, const int *csrSortedColIndA, + const float *B, int ldb, const float *beta, float *C, int ldc) + + Status cusparseDcsrmm( + Handle handle, Operation transA, int m, int n, int k, int nnz, + const double *alpha, const MatDescr descrA, + const double *csrSortedValA, + const int *csrSortedRowPtrA, const int *csrSortedColIndA, + const double *B, int ldb, const double *beta, double *C, int ldc) + + Status cusparseCcsrmm( + Handle handle, Operation transA, int m, int n, int k, int nnz, + const cuComplex *alpha, const MatDescr descrA, + const cuComplex *csrSortedValA, + const int *csrSortedRowPtrA, const int *csrSortedColIndA, + const cuComplex *B, int ldb, const cuComplex *beta, + cuComplex *C, int ldc) + + Status cusparseZcsrmm( + Handle handle, Operation transA, int m, int n, int k, int nnz, + const cuDoubleComplex *alpha, const MatDescr descrA, + const cuDoubleComplex *csrSortedValA, + const int *csrSortedRowPtrA, const int *csrSortedColIndA, + const cuDoubleComplex *B, int ldb, + const cuDoubleComplex *beta, cuDoubleComplex *C, int ldc) + + Status cusparseScsrmm2( + Handle handle, Operation transA, Operation transB, int m, int n, int k, + int nnz, const float *alpha, const MatDescr descrA, + const float *csrValA, const int *csrRowPtrA, const int *csrColIndA, + const float *B, int ldb, const float *beta, float *C, int ldc) + + Status cusparseDcsrmm2( + Handle handle, Operation transA, Operation transB, int m, int n, int k, + int nnz, const double *alpha, const MatDescr descrA, + const double *csrValA, const int *csrRowPtrA, const int *csrColIndA, + const double *B, int ldb, const double *beta, double *C, int ldc) + + Status cusparseCcsrmm2( + Handle handle, Operation transA, Operation transB, int m, int n, int k, + int nnz, const cuComplex *alpha, const MatDescr descrA, + const cuComplex *csrValA, const int *csrRowPtrA, const int *csrColIndA, + const cuComplex *B, int ldb, const cuComplex *beta, + cuComplex *C, int ldc) + + Status cusparseZcsrmm2( + Handle handle, Operation transA, Operation transB, int m, int n, int k, + int nnz, const cuDoubleComplex *alpha, const MatDescr descrA, + const cuDoubleComplex *csrValA, + const int *csrRowPtrA, const int *csrColIndA, + const cuDoubleComplex *B, int ldb, const cuDoubleComplex *beta, + cuDoubleComplex *C, int ldc) + + Status cusparseCreateCsrsm2Info(csrsm2Info_t* info) + Status cusparseDestroyCsrsm2Info(csrsm2Info_t info) + + Status cusparseScsrsm2_bufferSizeExt( + Handle handle, int algo, Operation transA, Operation transB, int m, + int nrhs, int nnz, const float* alpha, const MatDescr descrA, + const float* csrSortedValA, const int* csrSortedRowPtrA, + const int* csrSortedColIndA, const float* B, + int ldb, csrsm2Info_t info, cusparseSolvePolicy_t policy, + size_t* pBufferSize) + Status cusparseDcsrsm2_bufferSizeExt( + Handle handle, int algo, Operation transA, Operation transB, int m, + int nrhs, int nnz, const double* alpha, const MatDescr descrA, + const double* csrSortedValA, const int* csrSortedRowPtrA, + const int* csrSortedColIndA, const double* B, + int ldb, csrsm2Info_t info, cusparseSolvePolicy_t policy, + size_t* pBufferSize) + Status cusparseCcsrsm2_bufferSizeExt( + Handle handle, int algo, Operation transA, Operation transB, int m, + int nrhs, int nnz, const cuComplex* alpha, const MatDescr descrA, + const cuComplex* csrSortedValA, const int* csrSortedRowPtrA, + const int* csrSortedColIndA, const cuComplex* B, + int ldb, csrsm2Info_t info, cusparseSolvePolicy_t policy, + size_t* pBufferSize) + Status cusparseZcsrsm2_bufferSizeExt( + Handle handle, int algo, Operation transA, Operation transB, int m, + int nrhs, int nnz, const cuDoubleComplex* alpha, const MatDescr descrA, + const cuDoubleComplex* csrSortedValA, const int* csrSortedRowPtrA, + const int* csrSortedColIndA, const cuDoubleComplex* B, + int ldb, csrsm2Info_t info, cusparseSolvePolicy_t policy, + size_t* pBufferSize) + + Status cusparseScsrsm2_analysis( + Handle handle, int algo, Operation transA, Operation transB, int m, + int nrhs, int nnz, const float* alpha, const MatDescr descrA, + const float* csrSortedValA, const int* csrSortedRowPtrA, + const int* csrSortedColIndA, const float* B, + int ldb, csrsm2Info_t info, cusparseSolvePolicy_t policy, + void* pBuffer) + Status cusparseDcsrsm2_analysis( + Handle handle, int algo, Operation transA, Operation transB, int m, + int nrhs, int nnz, const double* alpha, const MatDescr descrA, + const double* csrSortedValA, const int* csrSortedRowPtrA, + const int* csrSortedColIndA, const double* B, + int ldb, csrsm2Info_t info, cusparseSolvePolicy_t policy, + void* pBuffer) + Status cusparseCcsrsm2_analysis( + Handle handle, int algo, Operation transA, Operation transB, int m, + int nrhs, int nnz, const cuComplex* alpha, const MatDescr descrA, + const cuComplex* csrSortedValA, const int* csrSortedRowPtrA, + const int* csrSortedColIndA, const cuComplex* B, + int ldb, csrsm2Info_t info, cusparseSolvePolicy_t policy, + void* pBuffer) + Status cusparseZcsrsm2_analysis( + Handle handle, int algo, Operation transA, Operation transB, int m, + int nrhs, int nnz, const cuDoubleComplex* alpha, const MatDescr descrA, + const cuDoubleComplex* csrSortedValA, const int* csrSortedRowPtrA, + const int* csrSortedColIndA, const cuDoubleComplex* B, + int ldb, csrsm2Info_t info, cusparseSolvePolicy_t policy, + void* pBuffer) + + Status cusparseScsrsm2_solve( + Handle handle, int algo, Operation transA, Operation transB, int m, + int nrhs, int nnz, const float* alpha, const MatDescr descrA, + const float* csrSortedValA, const int* csrSortedRowPtrA, + const int* csrSortedColIndA, float* B, + int ldb, csrsm2Info_t info, cusparseSolvePolicy_t policy, + void* pBuffer) + Status cusparseDcsrsm2_solve( + Handle handle, int algo, Operation transA, Operation transB, int m, + int nrhs, int nnz, const double* alpha, const MatDescr descrA, + const double* csrSortedValA, const int* csrSortedRowPtrA, + const int* csrSortedColIndA, double* B, + int ldb, csrsm2Info_t info, cusparseSolvePolicy_t policy, + void* pBuffer) + Status cusparseCcsrsm2_solve( + Handle handle, int algo, Operation transA, Operation transB, int m, + int nrhs, int nnz, const cuComplex* alpha, const MatDescr descrA, + const cuComplex* csrSortedValA, const int* csrSortedRowPtrA, + const int* csrSortedColIndA, cuComplex* B, + int ldb, csrsm2Info_t info, cusparseSolvePolicy_t policy, + void* pBuffer) + Status cusparseZcsrsm2_solve( + Handle handle, int algo, Operation transA, Operation transB, int m, + int nrhs, int nnz, const cuDoubleComplex* alpha, const MatDescr descrA, + const cuDoubleComplex* csrSortedValA, const int* csrSortedRowPtrA, + const int* csrSortedColIndA, cuDoubleComplex* B, + int ldb, csrsm2Info_t info, cusparseSolvePolicy_t policy, + void* pBuffer) + + Status cusparseXcsrsm2_zeroPivot( + Handle handle, csrsm2Info_t info, int* position) + + # cuSPARSE Extra Function + Status cusparseXcsrgeamNnz( + Handle handle, int m, int n, const MatDescr descrA, int nnzA, + const int *csrRowPtrA, const int *csrColIndA, const MatDescr descrB, + int nnzB, const int *csrRowPtrB, const int *csrColIndB, + const MatDescr descrC, int *csrRowPtrC, int *nnzTotalDevHostPtr) + + Status cusparseScsrgeam( + Handle handle, int m, int n, const float *alpha, const MatDescr descrA, + int nnzA, const float *csrValA, const int *csrRowPtrA, + const int *csrColIndA, const float *beta, const MatDescr descrB, + int nnzB, const float *csrValB, const int *csrRowPtrB, + const int *csrColIndB, const MatDescr descrC, float *csrValC, + int *csrRowPtrC, int *csrColIndC) + + Status cusparseDcsrgeam( + Handle handle, int m, int n, const double *alpha, + const MatDescr descrA, + int nnzA, const double *csrValA, const int *csrRowPtrA, + const int *csrColIndA, const double *beta, const MatDescr descrB, + int nnzB, const double *csrValB, const int *csrRowPtrB, + const int *csrColIndB, const MatDescr descrC, double *csrValC, + int *csrRowPtrC, int *csrColIndC) + + Status cusparseCcsrgeam( + Handle handle, int m, int n, const cuComplex *alpha, + const MatDescr descrA, + int nnzA, const cuComplex *csrValA, const int *csrRowPtrA, + const int *csrColIndA, const cuComplex *beta, const MatDescr descrB, + int nnzB, const cuComplex *csrValB, const int *csrRowPtrB, + const int *csrColIndB, const MatDescr descrC, cuComplex *csrValC, + int *csrRowPtrC, int *csrColIndC) + + Status cusparseZcsrgeam( + Handle handle, int m, int n, const cuDoubleComplex *alpha, + const MatDescr descrA, + int nnzA, const cuDoubleComplex *csrValA, const int *csrRowPtrA, + const int *csrColIndA, const cuDoubleComplex *beta, + const MatDescr descrB, + int nnzB, const cuDoubleComplex *csrValB, const int *csrRowPtrB, + const int *csrColIndB, const MatDescr descrC, + cuDoubleComplex *csrValC, int *csrRowPtrC, int *csrColIndC) + + Status cusparseScsrgeam2_bufferSizeExt( + Handle handle, int m, int n, const float *alpha, const MatDescr descrA, + int nnzA, const float *csrValA, const int *csrRowPtrA, + const int *csrColIndA, const float *beta, const MatDescr descrB, + int nnzB, const float *csrValB, const int *csrRowPtrB, + const int *csrColIndB, const MatDescr descrC, float *csrValC, + int *csrRowPtrC, int *csrColIndC, size_t *pBufferSize) + + Status cusparseDcsrgeam2_bufferSizeExt( + Handle handle, int m, int n, const double *alpha, + const MatDescr descrA, + int nnzA, const double *csrValA, const int *csrRowPtrA, + const int *csrColIndA, const double *beta, const MatDescr descrB, + int nnzB, const double *csrValB, const int *csrRowPtrB, + const int *csrColIndB, const MatDescr descrC, double *csrValC, + int *csrRowPtrC, int *csrColIndC, size_t *pBufferSize) + + Status cusparseCcsrgeam2_bufferSizeExt( + Handle handle, int m, int n, const cuComplex *alpha, + const MatDescr descrA, + int nnzA, const cuComplex *csrValA, const int *csrRowPtrA, + const int *csrColIndA, const cuComplex *beta, const MatDescr descrB, + int nnzB, const cuComplex *csrValB, const int *csrRowPtrB, + const int *csrColIndB, const MatDescr descrC, cuComplex *csrValC, + int *csrRowPtrC, int *csrColIndC, size_t *pBufferSize) + + Status cusparseZcsrgeam2_bufferSizeExt( + Handle handle, int m, int n, const cuDoubleComplex *alpha, + const MatDescr descrA, + int nnzA, const cuDoubleComplex *csrValA, const int *csrRowPtrA, + const int *csrColIndA, const cuDoubleComplex *beta, + const MatDescr descrB, + int nnzB, const cuDoubleComplex *csrValB, const int *csrRowPtrB, + const int *csrColIndB, const MatDescr descrC, + cuDoubleComplex *csrValC, int *csrRowPtrC, int *csrColIndC, + size_t *pBufferSize) + + Status cusparseXcsrgeam2Nnz( + Handle handle, int m, int n, const MatDescr descrA, int nnzA, + const int *csrRowPtrA, const int *csrColIndA, const MatDescr descrB, + int nnzB, const int *csrRowPtrB, const int *csrColIndB, + const MatDescr descrC, int *csrRowPtrC, int *nnzTotalDevHostPtr, + void *workspace) + + Status cusparseScsrgeam2( + Handle handle, int m, int n, const float *alpha, const MatDescr descrA, + int nnzA, const float *csrValA, const int *csrRowPtrA, + const int *csrColIndA, const float *beta, const MatDescr descrB, + int nnzB, const float *csrValB, const int *csrRowPtrB, + const int *csrColIndB, const MatDescr descrC, float *csrValC, + int *csrRowPtrC, int *csrColIndC, void *pBuffer) + + Status cusparseDcsrgeam2( + Handle handle, int m, int n, const double *alpha, + const MatDescr descrA, + int nnzA, const double *csrValA, const int *csrRowPtrA, + const int *csrColIndA, const double *beta, const MatDescr descrB, + int nnzB, const double *csrValB, const int *csrRowPtrB, + const int *csrColIndB, const MatDescr descrC, double *csrValC, + int *csrRowPtrC, int *csrColIndC, void *pBuffer) + + Status cusparseCcsrgeam2( + Handle handle, int m, int n, const cuComplex *alpha, + const MatDescr descrA, + int nnzA, const cuComplex *csrValA, const int *csrRowPtrA, + const int *csrColIndA, const cuComplex *beta, const MatDescr descrB, + int nnzB, const cuComplex *csrValB, const int *csrRowPtrB, + const int *csrColIndB, const MatDescr descrC, cuComplex *csrValC, + int *csrRowPtrC, int *csrColIndC, void *pBuffer) + + Status cusparseZcsrgeam2( + Handle handle, int m, int n, const cuDoubleComplex *alpha, + const MatDescr descrA, + int nnzA, const cuDoubleComplex *csrValA, const int *csrRowPtrA, + const int *csrColIndA, const cuDoubleComplex *beta, + const MatDescr descrB, + int nnzB, const cuDoubleComplex *csrValB, const int *csrRowPtrB, + const int *csrColIndB, const MatDescr descrC, + cuDoubleComplex *csrValC, int *csrRowPtrC, int *csrColIndC, + void *pBuffer) + + Status cusparseXcsrgemmNnz( + Handle handle, Operation transA, Operation transB, int m, int n, int k, + const MatDescr descrA, const int nnzA, const int *csrRowPtrA, + const int *csrColIndA, const MatDescr descrB, const int nnzB, + const int *csrRowPtrB, const int *csrColIndB, + const MatDescr descrC, int *csrRowPtrC, int *nnzTotalDevHostPtr) + + Status cusparseScsrgemm( + Handle handle, Operation transA, Operation transB, int m, int n, int k, + const MatDescr descrA, const int nnzA, const float *csrValA, + const int *csrRowPtrA, const int *csrColIndA, const MatDescr descrB, + const int nnzB, const float *csrValB, const int *csrRowPtrB, + const int *csrColIndB, const MatDescr descrC, float *csrValC, + const int *csrRowPtrC, int *csrColIndC) + + Status cusparseDcsrgemm( + Handle handle, Operation transA, Operation transB, int m, int n, int k, + const MatDescr descrA, const int nnzA, const double *csrValA, + const int *csrRowPtrA, const int *csrColIndA, const MatDescr descrB, + const int nnzB, const double *csrValB, const int *csrRowPtrB, + const int *csrColIndB, const MatDescr descrC, double *csrValC, + const int *csrRowPtrC, int *csrColIndC) + + Status cusparseCcsrgemm( + Handle handle, Operation transA, Operation transB, int m, int n, int k, + const MatDescr descrA, const int nnzA, const cuComplex *csrValA, + const int *csrRowPtrA, const int *csrColIndA, const MatDescr descrB, + const int nnzB, const cuComplex *csrValB, const int *csrRowPtrB, + const int *csrColIndB, const MatDescr descrC, cuComplex *csrValC, + const int *csrRowPtrC, int *csrColIndC) + + Status cusparseZcsrgemm( + Handle handle, Operation transA, Operation transB, int m, int n, int k, + const MatDescr descrA, const int nnzA, const cuDoubleComplex *csrValA, + const int *csrRowPtrA, const int *csrColIndA, const MatDescr descrB, + const int nnzB, const cuDoubleComplex *csrValB, const int *csrRowPtrB, + const int *csrColIndB, const MatDescr descrC, cuDoubleComplex *csrValC, + const int *csrRowPtrC, int *csrColIndC) + + cusparseStatus_t cusparseCreateCsrgemm2Info(csrgemm2Info_t *info) + cusparseStatus_t cusparseDestroyCsrgemm2Info(csrgemm2Info_t info) + + Status cusparseScsrgemm2_bufferSizeExt( + Handle handle, int m, int n, int k, const float *alpha, + const MatDescr descrA, int nnzA, const int *csrRowPtrA, + const int *csrColIndA, const MatDescr descrB, int nnzB, + const int *csrRowPtrB, const int *csrColIndB, const float *beta, + const MatDescr descrD, int nnzD, const int *csrRowPtrD, + const int *csrColIndD, const csrgemm2Info_t info, size_t* pBufferSize) + + Status cusparseDcsrgemm2_bufferSizeExt( + Handle handle, int m, int n, int k, const double *alpha, + const MatDescr descrA, int nnzA, const int *csrRowPtrA, + const int *csrColIndA, const MatDescr descrB, int nnzB, + const int *csrRowPtrB, const int *csrColIndB, const double *beta, + const MatDescr descrD, int nnzD, const int *csrRowPtrD, + const int *csrColIndD, const csrgemm2Info_t info, size_t* pBufferSize) + + Status cusparseCcsrgemm2_bufferSizeExt( + Handle handle, int m, int n, int k, const cuComplex *alpha, + const MatDescr descrA, int nnzA, const int *csrRowPtrA, + const int *csrColIndA, const MatDescr descrB, int nnzB, + const int *csrRowPtrB, const int *csrColIndB, const cuComplex *beta, + const MatDescr descrD, int nnzD, const int *csrRowPtrD, + const int *csrColIndD, const csrgemm2Info_t info, size_t* pBufferSize) + + Status cusparseZcsrgemm2_bufferSizeExt( + Handle handle, int m, int n, int k, const cuDoubleComplex *alpha, + const MatDescr descrA, int nnzA, const int *csrRowPtrA, + const int *csrColIndA, const MatDescr descrB, int nnzB, + const int *csrRowPtrB, const int *csrColIndB, + const cuDoubleComplex *beta, const MatDescr descrD, int nnzD, + const int *csrRowPtrD, const int *csrColIndD, + const csrgemm2Info_t info, size_t* pBufferSize) + + Status cusparseXcsrgemm2Nnz( + Handle handle, int m, int n, int k, const MatDescr descrA, int nnzA, + const int *csrRowPtrA, const int *csrColIndA, const MatDescr descrB, + int nnzB, const int *csrRowPtrB, const int *csrColIndB, + const MatDescr descrD, int nnzD, const int *csrRowPtrD, + const int *csrColIndD, const MatDescr descrC, int *csrRowPtrC, + int *nnzTotalDevHostPtr, const csrgemm2Info_t info, void* pBuffer) + + Status cusparseScsrgemm2( + Handle handle, int m, int n, int k, const float *alpha, + const MatDescr descrA, int nnzA, const float *csrValA, + const int *csrRowPtrA, const int *csrColIndA, const MatDescr descrB, + int nnzB, const float *csrValB, const int *csrRowPtrB, + const int *csrColIndB, const float *beta, const MatDescr descrD, + int nnzD, const float *csrValD, const int *csrRowPtrD, + const int *csrColIndD, const MatDescr descrC, float *csrValC, + const int *csrRowPtrC, int *csrColIndC, const csrgemm2Info_t info, + void* pBuffer) + + Status cusparseDcsrgemm2( + Handle handle, int m, int n, int k, const double *alpha, + const MatDescr descrA, int nnzA, const double *csrValA, + const int *csrRowPtrA, const int *csrColIndA, const MatDescr descrB, + int nnzB, const double *csrValB, const int *csrRowPtrB, + const int *csrColIndB, const double *beta, const MatDescr descrD, + int nnzD, const double *csrValD, const int *csrRowPtrD, + const int *csrColIndD, const MatDescr descrC, double *csrValC, + const int *csrRowPtrC, int *csrColIndC, const csrgemm2Info_t info, + void* pBuffer) + + Status cusparseCcsrgemm2( + Handle handle, int m, int n, int k, const cuComplex *alpha, + const MatDescr descrA, int nnzA, const cuComplex *csrValA, + const int *csrRowPtrA, const int *csrColIndA, const MatDescr descrB, + int nnzB, const cuComplex *csrValB, const int *csrRowPtrB, + const int *csrColIndB, const cuComplex *beta, const MatDescr descrD, + int nnzD, const cuComplex *csrValD, const int *csrRowPtrD, + const int *csrColIndD, const MatDescr descrC, cuComplex *csrValC, + const int *csrRowPtrC, int *csrColIndC, const csrgemm2Info_t info, + void* pBuffer) + + Status cusparseZcsrgemm2( + Handle handle, int m, int n, int k, const cuDoubleComplex *alpha, + const MatDescr descrA, int nnzA, const cuDoubleComplex *csrValA, + const int *csrRowPtrA, const int *csrColIndA, const MatDescr descrB, + int nnzB, const cuDoubleComplex *csrValB, const int *csrRowPtrB, + const int *csrColIndB, const cuDoubleComplex *beta, + const MatDescr descrD, int nnzD, const cuDoubleComplex *csrValD, + const int *csrRowPtrD, const int *csrColIndD, const MatDescr descrC, + cuDoubleComplex *csrValC, const int *csrRowPtrC, int *csrColIndC, + const csrgemm2Info_t info, void* pBuffer) + + # cuSPARSE Format Convrsion + Status cusparseXcoo2csr( + Handle handle, const int *cooRowInd, int nnz, int m, int *csrRowPtr, + IndexBase idxBase) + + Status cusparseScsc2dense( + Handle handle, int m, int n, const MatDescr descrA, + const float *cscSortedValA, const int *cscSortedRowIndA, + const int *cscSortedColPtrA, float *A, int lda) + + Status cusparseDcsc2dense( + Handle handle, int m, int n, const MatDescr descrA, + const double *cscSortedValA, const int *cscSortedRowIndA, + const int *cscSortedColPtrA, double *A, int lda) + + Status cusparseCcsc2dense( + Handle handle, int m, int n, const MatDescr descrA, + const cuComplex *cscSortedValA, const int *cscSortedRowIndA, + const int *cscSortedColPtrA, cuComplex *A, int lda) + + Status cusparseZcsc2dense( + Handle handle, int m, int n, const MatDescr descrA, + const cuDoubleComplex *cscSortedValA, const int *cscSortedRowIndA, + const int *cscSortedColPtrA, cuDoubleComplex *A, int lda) + + Status cusparseXcsr2coo( + Handle handle, const int *csrRowPtr, int nnz, int m, int *cooRowInd, + IndexBase idxBase) + + Status cusparseScsr2csc( + Handle handle, int m, int n, int nnz, const float *csrVal, + const int *csrRowPtr, const int *csrColInd, float *cscVal, + int *cscRowInd, int *cscColPtr, Action copyValues, IndexBase idxBase) + + Status cusparseDcsr2csc( + Handle handle, int m, int n, int nnz, const double *csrVal, + const int *csrRowPtr, const int *csrColInd, double *cscVal, + int *cscRowInd, int *cscColPtr, Action copyValues, IndexBase idxBase) + + Status cusparseCcsr2csc( + Handle handle, int m, int n, int nnz, const cuComplex *csrVal, + const int *csrRowPtr, const int *csrColInd, cuComplex *cscVal, + int *cscRowInd, int *cscColPtr, Action copyValues, IndexBase idxBase) + + Status cusparseZcsr2csc( + Handle handle, int m, int n, int nnz, const cuDoubleComplex *csrVal, + const int *csrRowPtr, const int *csrColInd, cuDoubleComplex *cscVal, + int *cscRowInd, int *cscColPtr, Action copyValues, IndexBase idxBase) + + Status cusparseScsr2dense( + Handle handle, int m, int n, const MatDescr descrA, + const float *csrSortedValA, const int *csrSortedRowPtrA, + const int *csrSortedColIndA, float *A, int lda) + + Status cusparseDcsr2dense( + Handle handle, int m, int n, const MatDescr descrA, + const double *csrSortedValA, const int *csrSortedRowPtrA, + const int *csrSortedColIndA, double *A, int lda) + + Status cusparseCcsr2dense( + Handle handle, int m, int n, const MatDescr descrA, + const cuComplex *csrSortedValA, const int *csrSortedRowPtrA, + const int *csrSortedColIndA, cuComplex *A, int lda) + + Status cusparseZcsr2dense( + Handle handle, int m, int n, const MatDescr descrA, + const cuDoubleComplex *csrSortedValA, const int *csrSortedRowPtrA, + const int *csrSortedColIndA, cuDoubleComplex *A, int lda) + + Status cusparseSnnz_compress( + Handle handle, int m, const MatDescr descr, + const float *values, const int *rowPtr, int *nnzPerRow, + int *nnzTotal, float tol) + + Status cusparseDnnz_compress( + Handle handle, int m, const MatDescr descr, + const double *values, const int *rowPtr, int *nnzPerRow, + int *nnzTotal, double tol) + + Status cusparseCnnz_compress( + Handle handle, int m, const MatDescr descr, + const cuComplex *values, const int *rowPtr, int *nnzPerRow, + int *nnzTotal, cuComplex tol) + + Status cusparseZnnz_compress( + Handle handle, int m, const MatDescr descr, + const cuDoubleComplex *values, const int *rowPtr, int *nnzPerRow, + int *nnzTotal, cuDoubleComplex tol) + + Status cusparseScsr2csr_compress( + Handle handle, int m, int n, const MatDescr descrA, + const float *inVal, const int *inColInd, const int *inRowPtr, + int inNnz, int *nnzPerRow, float *outVal, int *outColInd, + int *outRowPtr, float tol) + + Status cusparseDcsr2csr_compress( + Handle handle, int m, int n, const MatDescr descrA, + const double *inVal, const int *inColInd, const int *inRowPtr, + int inNnz, int *nnzPerRow, double *outVal, int *outColInd, + int *outRowPtr, double tol) + + Status cusparseCcsr2csr_compress( + Handle handle, int m, int n, const MatDescr descrA, + const cuComplex *inVal, const int *inColInd, const int *inRowPtr, + int inNnz, int *nnzPerRow, cuComplex *outVal, int *outColInd, + int *outRowPtr, cuComplex tol) + + Status cusparseZcsr2csr_compress( + Handle handle, int m, int n, const MatDescr descrA, + const cuDoubleComplex *inVal, const int *inColInd, const int *inRowPtr, + int inNnz, int *nnzPerRow, cuDoubleComplex *outVal, int *outColInd, + int *outRowPtr, cuDoubleComplex tol) + + Status cusparseSdense2csc( + Handle handle, int m, int n, const MatDescr descrA, const float *A, + int lda, const int *nnzPerCol, float *cscValA, int *cscRowIndA, + int *cscColPtrA) + + Status cusparseDdense2csc( + Handle handle, int m, int n, const MatDescr descrA, const double *A, + int lda, const int *nnzPerCol, double *cscValA, int *cscRowIndA, + int *cscColPtrA) + + Status cusparseCdense2csc( + Handle handle, int m, int n, const MatDescr descrA, const cuComplex *A, + int lda, const int *nnzPerCol, cuComplex *cscValA, int *cscRowIndA, + int *cscColPtrA) + + Status cusparseZdense2csc( + Handle handle, int m, int n, const MatDescr descrA, + const cuDoubleComplex *A, + int lda, const int *nnzPerCol, cuDoubleComplex *cscValA, + int *cscRowIndA, int *cscColPtrA) + + Status cusparseSdense2csr( + Handle handle, int m, int n, const MatDescr descrA, + const float *A, int lda, const int *nnzPerRow, float *csrValA, + int *csrRowPtrA, int *csrColIndA) + + Status cusparseDdense2csr( + Handle handle, int m, int n, const MatDescr descrA, + const double *A, int lda, const int *nnzPerRow, double *csrValA, + int *csrRowPtrA, int *csrColIndA) + + Status cusparseCdense2csr( + Handle handle, int m, int n, const MatDescr descrA, + const cuComplex *A, int lda, const int *nnzPerRow, cuComplex *csrValA, + int *csrRowPtrA, int *csrColIndA) + + Status cusparseZdense2csr( + Handle handle, int m, int n, const MatDescr descrA, + const cuDoubleComplex *A, int lda, const int *nnzPerRow, + cuDoubleComplex *csrValA, + int *csrRowPtrA, int *csrColIndA) + + Status cusparseSnnz( + Handle handle, Direction dirA, int m, int n, const MatDescr descrA, + const float *A, int lda, int *nnzPerRowColumn, int *nnzTotalDevHostPtr) + + Status cusparseDnnz( + Handle handle, Direction dirA, int m, int n, const MatDescr descrA, + const double *A, int lda, int *nnzPerRowColumn, + int *nnzTotalDevHostPtr) + + Status cusparseCnnz( + Handle handle, Direction dirA, int m, int n, const MatDescr descrA, + const cuComplex *A, int lda, int *nnzPerRowColumn, + int *nnzTotalDevHostPtr) + + Status cusparseZnnz( + Handle handle, Direction dirA, int m, int n, const MatDescr descrA, + const cuDoubleComplex *A, int lda, int *nnzPerRowColumn, + int *nnzTotalDevHostPtr) + + Status cusparseCreateIdentityPermutation( + Handle handle, int n, int *p) + + Status cusparseXcoosort_bufferSizeExt( + Handle handle, int m, int n, int nnz, const int *cooRows, + const int *cooCols, size_t *pBufferSizeInBytes) + + Status cusparseXcoosortByRow( + Handle handle, int m, int n, int nnz, int *cooRows, int *cooCols, + int *P, void *pBuffer) + + Status cusparseXcoosortByColumn( + Handle handle, int m, int n, int nnz, int *cooRows, int *cooCols, + int *P, void *pBuffer) + + Status cusparseXcsrsort_bufferSizeExt( + Handle handle, int m, int n, int nnz, const int *csrRowPtr, + const int *csrColInd, size_t *pBufferSizeInBytes) + + Status cusparseXcsrsort( + Handle handle, int m, int n, int nnz, const MatDescr descrA, + const int *csrRowPtr, int *csrColInd, int *P, void *pBuffer) + + Status cusparseXcscsort_bufferSizeExt( + Handle handle, int m, int n, int nnz, const int *cscColPtr, + const int *cscRowInd, size_t *pBufferSizeInBytes) + + Status cusparseXcscsort( + Handle handle, int m, int n, int nnz, const MatDescr descrA, + const int *cscColPtr, int *cscRowInd, int *P, void *pBuffer) + + # cuSparse PRECONDITIONERS + cusparseStatus_t cusparseCreateCsrilu02Info(csrilu02Info_t *info) + cusparseStatus_t cusparseDestroyCsrilu02Info(csrilu02Info_t info) + cusparseStatus_t cusparseCreateBsrilu02Info(bsrilu02Info_t *info) + cusparseStatus_t cusparseDestroyBsrilu02Info(bsrilu02Info_t info) + cusparseStatus_t cusparseCreateCsric02Info(csric02Info_t *info) + cusparseStatus_t cusparseDestroyCsric02Info(csric02Info_t info) + cusparseStatus_t cusparseCreateBsric02Info(bsric02Info_t *info) + cusparseStatus_t cusparseDestroyBsric02Info(bsric02Info_t info) + cusparseStatus_t cusparseScsrilu02_numericBoost( + cusparseHandle_t handle, csrilu02Info_t info, int enable_boost, + double *tol, float *boost_val) + cusparseStatus_t cusparseDcsrilu02_numericBoost( + cusparseHandle_t handle, csrilu02Info_t info, int enable_boost, + double *tol, double *boost_val) + cusparseStatus_t cusparseCcsrilu02_numericBoost( + cusparseHandle_t handle, csrilu02Info_t info, int enable_boost, + double *tol, cuComplex *boost_val) + cusparseStatus_t cusparseZcsrilu02_numericBoost( + cusparseHandle_t handle, csrilu02Info_t info, int enable_boost, + double *tol, cuDoubleComplex *boost_val) + cusparseStatus_t cusparseXcsrilu02_zeroPivot( + cusparseHandle_t handle, csrilu02Info_t info, int *position) + cusparseStatus_t cusparseScsrilu02_bufferSize( + cusparseHandle_t handle, int m, int nnz, + const cusparseMatDescr_t descrA, float *csrSortedValA, + const int *csrSortedRowPtrA, const int *csrSortedColIndA, + csrilu02Info_t info, int *pBufferSizeInBytes) + cusparseStatus_t cusparseDcsrilu02_bufferSize( + cusparseHandle_t handle, int m, int nnz, + const cusparseMatDescr_t descrA, double *csrSortedValA, + const int *csrSortedRowPtrA, const int *csrSortedColIndA, + csrilu02Info_t info, int *pBufferSizeInBytes) + cusparseStatus_t cusparseCcsrilu02_bufferSize( + cusparseHandle_t handle, int m, int nnz, + const cusparseMatDescr_t descrA, cuComplex *csrSortedValA, + const int *csrSortedRowPtrA, const int *csrSortedColIndA, + csrilu02Info_t info, int *pBufferSizeInBytes) + cusparseStatus_t cusparseZcsrilu02_bufferSize( + cusparseHandle_t handle, int m, int nnz, + const cusparseMatDescr_t descrA, cuDoubleComplex *csrSortedValA, + const int *csrSortedRowPtrA, const int *csrSortedColIndA, + csrilu02Info_t info, int *pBufferSizeInBytes) + cusparseStatus_t cusparseScsrilu02_analysis( + cusparseHandle_t handle, int m, int nnz, + const cusparseMatDescr_t descrA, const float *csrSortedValA, + const int *csrSortedRowPtrA, const int *csrSortedColIndA, + csrilu02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) + cusparseStatus_t cusparseDcsrilu02_analysis( + cusparseHandle_t handle, int m, int nnz, + const cusparseMatDescr_t descrA, const double *csrSortedValA, + const int *csrSortedRowPtrA, const int *csrSortedColIndA, + csrilu02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) + cusparseStatus_t cusparseCcsrilu02_analysis( + cusparseHandle_t handle, int m, int nnz, + const cusparseMatDescr_t descrA, const cuComplex *csrSortedValA, + const int *csrSortedRowPtrA, const int *csrSortedColIndA, + csrilu02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) + cusparseStatus_t cusparseZcsrilu02_analysis( + cusparseHandle_t handle, int m, int nnz, + const cusparseMatDescr_t descrA, const cuDoubleComplex *csrSortedValA, + const int *csrSortedRowPtrA, const int *csrSortedColIndA, + csrilu02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) + cusparseStatus_t cusparseScsrilu02( + cusparseHandle_t handle, int m, int nnz, + const cusparseMatDescr_t descrA, float *csrSortedValA_valM, + const int *csrSortedRowPtrA, const int *csrSortedColIndA, + csrilu02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) + cusparseStatus_t cusparseDcsrilu02( + cusparseHandle_t handle, int m, int nnz, + const cusparseMatDescr_t descrA, double *csrSortedValA_valM, + const int *csrSortedRowPtrA, const int *csrSortedColIndA, + csrilu02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) + cusparseStatus_t cusparseCcsrilu02( + cusparseHandle_t handle, int m, int nnz, + const cusparseMatDescr_t descrA, cuComplex *csrSortedValA_valM, + const int *csrSortedRowPtrA, const int *csrSortedColIndA, + csrilu02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) + cusparseStatus_t cusparseZcsrilu02( + cusparseHandle_t handle, int m, int nnz, + const cusparseMatDescr_t descrA, cuDoubleComplex *csrSortedValA_valM, + const int *csrSortedRowPtrA, const int *csrSortedColIndA, + csrilu02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) + cusparseStatus_t cusparseSbsrilu02_numericBoost( + cusparseHandle_t handle, bsrilu02Info_t info, int enable_boost, + double *tol, float *boost_val) + cusparseStatus_t cusparseDbsrilu02_numericBoost( + cusparseHandle_t handle, bsrilu02Info_t info, int enable_boost, + double *tol, double *boost_val) + cusparseStatus_t cusparseCbsrilu02_numericBoost( + cusparseHandle_t handle, bsrilu02Info_t info, int enable_boost, + double *tol, cuComplex *boost_val) + cusparseStatus_t cusparseZbsrilu02_numericBoost( + cusparseHandle_t handle, bsrilu02Info_t info, int enable_boost, + double *tol, cuDoubleComplex *boost_val) + cusparseStatus_t cusparseXbsrilu02_zeroPivot( + cusparseHandle_t handle, bsrilu02Info_t info, int *position) + cusparseStatus_t cusparseSbsrilu02_bufferSize( + cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, + const cusparseMatDescr_t descrA, float *bsrSortedVal, + const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, + bsrilu02Info_t info, int *pBufferSizeInBytes) + cusparseStatus_t cusparseDbsrilu02_bufferSize( + cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, + const cusparseMatDescr_t descrA, double *bsrSortedVal, + const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, + bsrilu02Info_t info, int *pBufferSizeInBytes) + cusparseStatus_t cusparseCbsrilu02_bufferSize( + cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, + const cusparseMatDescr_t descrA, cuComplex *bsrSortedVal, + const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, + bsrilu02Info_t info, int *pBufferSizeInBytes) + cusparseStatus_t cusparseZbsrilu02_bufferSize( + cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, + const cusparseMatDescr_t descrA, cuDoubleComplex *bsrSortedVal, + const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, + bsrilu02Info_t info, int *pBufferSizeInBytes) + cusparseStatus_t cusparseSbsrilu02_analysis( + cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, + const cusparseMatDescr_t descrA, float *bsrSortedVal, + const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, + bsrilu02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) + cusparseStatus_t cusparseDbsrilu02_analysis( + cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, + const cusparseMatDescr_t descrA, double *bsrSortedVal, + const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, + bsrilu02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) + cusparseStatus_t cusparseCbsrilu02_analysis( + cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, + const cusparseMatDescr_t descrA, cuComplex *bsrSortedVal, + const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, + bsrilu02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) + cusparseStatus_t cusparseZbsrilu02_analysis( + cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, + const cusparseMatDescr_t descrA, cuDoubleComplex *bsrSortedVal, + const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, + bsrilu02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) + cusparseStatus_t cusparseSbsrilu02( + cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, + const cusparseMatDescr_t descrA, float *bsrSortedVal, + const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, + bsrilu02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) + cusparseStatus_t cusparseDbsrilu02( + cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, + const cusparseMatDescr_t descrA, double *bsrSortedVal, + const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, + bsrilu02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) + cusparseStatus_t cusparseCbsrilu02( + cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, + const cusparseMatDescr_t descrA, cuComplex *bsrSortedVal, + const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, + bsrilu02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) + cusparseStatus_t cusparseZbsrilu02( + cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, + const cusparseMatDescr_t descrA, cuDoubleComplex *bsrSortedVal, + const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, + bsrilu02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) + cusparseStatus_t cusparseXcsric02_zeroPivot( + cusparseHandle_t handle, csric02Info_t info, int *position) + cusparseStatus_t cusparseScsric02_bufferSize( + cusparseHandle_t handle, int m, int nnz, + const cusparseMatDescr_t descrA, float *csrSortedValA, + const int *csrSortedRowPtrA, const int *csrSortedColIndA, + csric02Info_t info, int *pBufferSizeInBytes) + cusparseStatus_t cusparseDcsric02_bufferSize( + cusparseHandle_t handle, int m, int nnz, + const cusparseMatDescr_t descrA, double *csrSortedValA, + const int *csrSortedRowPtrA, const int *csrSortedColIndA, + csric02Info_t info, int *pBufferSizeInBytes) + cusparseStatus_t cusparseCcsric02_bufferSize( + cusparseHandle_t handle, int m, int nnz, + const cusparseMatDescr_t descrA, cuComplex *csrSortedValA, + const int *csrSortedRowPtrA, const int *csrSortedColIndA, + csric02Info_t info, int *pBufferSizeInBytes) + cusparseStatus_t cusparseZcsric02_bufferSize( + cusparseHandle_t handle, int m, int nnz, + const cusparseMatDescr_t descrA, cuDoubleComplex *csrSortedValA, + const int *csrSortedRowPtrA, const int *csrSortedColIndA, + csric02Info_t info, int *pBufferSizeInBytes) + cusparseStatus_t cusparseScsric02_analysis( + cusparseHandle_t handle, int m, int nnz, + const cusparseMatDescr_t descrA, const float *csrSortedValA, + const int *csrSortedRowPtrA, const int *csrSortedColIndA, + csric02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) + cusparseStatus_t cusparseDcsric02_analysis( + cusparseHandle_t handle, int m, int nnz, + const cusparseMatDescr_t descrA, const double *csrSortedValA, + const int *csrSortedRowPtrA, const int *csrSortedColIndA, + csric02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) + cusparseStatus_t cusparseCcsric02_analysis( + cusparseHandle_t handle, int m, int nnz, + const cusparseMatDescr_t descrA, const cuComplex *csrSortedValA, + const int *csrSortedRowPtrA, const int *csrSortedColIndA, + csric02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) + cusparseStatus_t cusparseZcsric02_analysis( + cusparseHandle_t handle, int m, int nnz, + const cusparseMatDescr_t descrA, const cuDoubleComplex *csrSortedValA, + const int *csrSortedRowPtrA, const int *csrSortedColIndA, + csric02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) + cusparseStatus_t cusparseScsric02( + cusparseHandle_t handle, int m, int nnz, + const cusparseMatDescr_t descrA, float *csrSortedValA_valM, + const int *csrSortedRowPtrA, const int *csrSortedColIndA, + csric02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) + cusparseStatus_t cusparseDcsric02( + cusparseHandle_t handle, int m, int nnz, + const cusparseMatDescr_t descrA, double *csrSortedValA_valM, + const int *csrSortedRowPtrA, const int *csrSortedColIndA, + csric02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) + cusparseStatus_t cusparseCcsric02( + cusparseHandle_t handle, int m, int nnz, + const cusparseMatDescr_t descrA, cuComplex *csrSortedValA_valM, + const int *csrSortedRowPtrA, const int *csrSortedColIndA, + csric02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) + cusparseStatus_t cusparseZcsric02( + cusparseHandle_t handle, int m, int nnz, + const cusparseMatDescr_t descrA, cuDoubleComplex *csrSortedValA_valM, + const int *csrSortedRowPtrA, const int *csrSortedColIndA, + csric02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) + cusparseStatus_t cusparseXbsric02_zeroPivot( + cusparseHandle_t handle, bsric02Info_t info, int *position) + cusparseStatus_t cusparseSbsric02_bufferSize( + cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, + const cusparseMatDescr_t descrA, float *bsrSortedVal, + const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, + bsric02Info_t info, int *pBufferSizeInBytes) + cusparseStatus_t cusparseDbsric02_bufferSize( + cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, + const cusparseMatDescr_t descrA, double *bsrSortedVal, + const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, + bsric02Info_t info, int *pBufferSizeInBytes) + cusparseStatus_t cusparseCbsric02_bufferSize( + cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, + const cusparseMatDescr_t descrA, cuComplex *bsrSortedVal, + const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, + bsric02Info_t info, int *pBufferSizeInBytes) + cusparseStatus_t cusparseZbsric02_bufferSize( + cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, + const cusparseMatDescr_t descrA, cuDoubleComplex *bsrSortedVal, + const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, + bsric02Info_t info, int *pBufferSizeInBytes) + cusparseStatus_t cusparseSbsric02_analysis( + cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, + const cusparseMatDescr_t descrA, const float *bsrSortedVal, + const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, + bsric02Info_t info, cusparseSolvePolicy_t policy, void *pInputBuffer) + cusparseStatus_t cusparseDbsric02_analysis( + cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, + const cusparseMatDescr_t descrA, const double *bsrSortedVal, + const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, + bsric02Info_t info, cusparseSolvePolicy_t policy, void *pInputBuffer) + cusparseStatus_t cusparseCbsric02_analysis( + cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, + const cusparseMatDescr_t descrA, const cuComplex *bsrSortedVal, + const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, + bsric02Info_t info, cusparseSolvePolicy_t policy, void *pInputBuffer) + cusparseStatus_t cusparseZbsric02_analysis( + cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, + const cusparseMatDescr_t descrA, const cuDoubleComplex *bsrSortedVal, + const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, + bsric02Info_t info, cusparseSolvePolicy_t policy, void *pInputBuffer) + cusparseStatus_t cusparseSbsric02( + cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, + const cusparseMatDescr_t descrA, float *bsrSortedVal, + const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, + bsric02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) + cusparseStatus_t cusparseDbsric02( + cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, + const cusparseMatDescr_t descrA, double *bsrSortedVal, + const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, + bsric02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) + cusparseStatus_t cusparseCbsric02( + cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, + const cusparseMatDescr_t descrA, cuComplex *bsrSortedVal, + const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, + bsric02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) + cusparseStatus_t cusparseZbsric02( + cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, + const cusparseMatDescr_t descrA, cuDoubleComplex *bsrSortedVal, + const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, + bsric02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) + cusparseStatus_t cusparseSgtsv2_bufferSizeExt( + cusparseHandle_t handle, int m, int n, const float *dl, const float *d, + const float *du, const float *B, int ldb, size_t *bufferSizeInBytes) + cusparseStatus_t cusparseDgtsv2_bufferSizeExt( + cusparseHandle_t handle, int m, int n, const double *dl, + const double *d, const double *du, const double *B, int ldb, + size_t *bufferSizeInBytes) + cusparseStatus_t cusparseCgtsv2_bufferSizeExt( + cusparseHandle_t handle, int m, int n, const cuComplex *dl, + const cuComplex *d, const cuComplex *du, const cuComplex *B, int ldb, + size_t *bufferSizeInBytes) + cusparseStatus_t cusparseZgtsv2_bufferSizeExt( + cusparseHandle_t handle, int m, int n, const cuDoubleComplex *dl, + const cuDoubleComplex *d, const cuDoubleComplex *du, + const cuDoubleComplex *B, int ldb, size_t *bufferSizeInBytes) + cusparseStatus_t cusparseSgtsv2( + cusparseHandle_t handle, int m, int n, const float *dl, const float *d, + const float *du, float *B, int ldb, void *pBuffer) + cusparseStatus_t cusparseDgtsv2( + cusparseHandle_t handle, int m, int n, const double *dl, + const double *d, const double *du, double *B, int ldb, void *pBuffer) + cusparseStatus_t cusparseCgtsv2(cusparseHandle_t handle, int m, int n, + const cuComplex *dl, const cuComplex *d, + const cuComplex *du, cuComplex *B, int ldb, + void *pBuffer) + cusparseStatus_t cusparseZgtsv2( + cusparseHandle_t handle, int m, int n, const cuDoubleComplex *dl, + const cuDoubleComplex *d, const cuDoubleComplex *du, + cuDoubleComplex *B, int ldb, void *pBuffer) + cusparseStatus_t cusparseSgtsv2_nopivot_bufferSizeExt( + cusparseHandle_t handle, int m, int n, const float *dl, const float *d, + const float *du, const float *B, int ldb, size_t *bufferSizeInBytes) + cusparseStatus_t cusparseDgtsv2_nopivot_bufferSizeExt( + cusparseHandle_t handle, int m, int n, const double *dl, + const double *d, const double *du, const double *B, int ldb, + size_t *bufferSizeInBytes) + cusparseStatus_t cusparseCgtsv2_nopivot_bufferSizeExt( + cusparseHandle_t handle, int m, int n, const cuComplex *dl, + const cuComplex *d, const cuComplex *du, const cuComplex *B, int ldb, + size_t *bufferSizeInBytes) + cusparseStatus_t cusparseZgtsv2_nopivot_bufferSizeExt( + cusparseHandle_t handle, int m, int n, const cuDoubleComplex *dl, + const cuDoubleComplex *d, const cuDoubleComplex *du, + const cuDoubleComplex *B, int ldb, size_t *bufferSizeInBytes) + cusparseStatus_t cusparseSgtsv2_nopivot( + cusparseHandle_t handle, int m, int n, const float *dl, const float *d, + const float *du, float *B, int ldb, void *pBuffer) + cusparseStatus_t cusparseDgtsv2_nopivot( + cusparseHandle_t handle, int m, int n, const double *dl, + const double *d, const double *du, double *B, int ldb, void *pBuffer) + cusparseStatus_t cusparseCgtsv2_nopivot( + cusparseHandle_t handle, int m, int n, const cuComplex *dl, + const cuComplex *d, const cuComplex *du, cuComplex *B, int ldb, + void *pBuffer) + cusparseStatus_t cusparseZgtsv2_nopivot( + cusparseHandle_t handle, int m, int n, const cuDoubleComplex *dl, + const cuDoubleComplex *d, const cuDoubleComplex *du, + cuDoubleComplex *B, int ldb, void *pBuffer) + cusparseStatus_t cusparseSgtsv2StridedBatch_bufferSizeExt( + cusparseHandle_t handle, int m, const float *dl, const float *d, + const float *du, const float *x, int batchCount, int batchStride, + size_t *bufferSizeInBytes) + cusparseStatus_t cusparseDgtsv2StridedBatch_bufferSizeExt( + cusparseHandle_t handle, int m, const double *dl, const double *d, + const double *du, const double *x, int batchCount, int batchStride, + size_t *bufferSizeInBytes) + cusparseStatus_t cusparseCgtsv2StridedBatch_bufferSizeExt( + cusparseHandle_t handle, int m, const cuComplex *dl, + const cuComplex *d, const cuComplex *du, const cuComplex *x, + int batchCount, int batchStride, size_t *bufferSizeInBytes) + cusparseStatus_t cusparseZgtsv2StridedBatch_bufferSizeExt( + cusparseHandle_t handle, int m, const cuDoubleComplex *dl, + const cuDoubleComplex *d, const cuDoubleComplex *du, + const cuDoubleComplex *x, int batchCount, int batchStride, + size_t *bufferSizeInBytes) + cusparseStatus_t cusparseSgtsv2StridedBatch( + cusparseHandle_t handle, int m, const float *dl, const float *d, + const float *du, float *x, int batchCount, int batchStride, + void *pBuffer) + cusparseStatus_t cusparseDgtsv2StridedBatch( + cusparseHandle_t handle, int m, const double *dl, const double *d, + const double *du, double *x, int batchCount, int batchStride, + void *pBuffer) + cusparseStatus_t cusparseCgtsv2StridedBatch( + cusparseHandle_t handle, int m, const cuComplex *dl, + const cuComplex *d, const cuComplex *du, cuComplex *x, int batchCount, + int batchStride, void *pBuffer) + cusparseStatus_t cusparseZgtsv2StridedBatch( + cusparseHandle_t handle, int m, const cuDoubleComplex *dl, + const cuDoubleComplex *d, const cuDoubleComplex *du, + cuDoubleComplex *x, int batchCount, int batchStride, void *pBuffer) + cusparseStatus_t cusparseSgtsvInterleavedBatch_bufferSizeExt( + cusparseHandle_t handle, int algo, int m, const float *dl, + const float *d, const float *du, const float *x, int batchCount, + size_t *pBufferSizeInBytes) + cusparseStatus_t cusparseDgtsvInterleavedBatch_bufferSizeExt( + cusparseHandle_t handle, int algo, int m, const double *dl, + const double *d, const double *du, const double *x, int batchCount, + size_t *pBufferSizeInBytes) + cusparseStatus_t cusparseCgtsvInterleavedBatch_bufferSizeExt( + cusparseHandle_t handle, int algo, int m, const cuComplex *dl, + const cuComplex *d, const cuComplex *du, const cuComplex *x, + int batchCount, size_t *pBufferSizeInBytes) + cusparseStatus_t cusparseZgtsvInterleavedBatch_bufferSizeExt( + cusparseHandle_t handle, int algo, int m, const cuDoubleComplex *dl, + const cuDoubleComplex *d, const cuDoubleComplex *du, + const cuDoubleComplex *x, int batchCount, size_t *pBufferSizeInBytes) + cusparseStatus_t cusparseSgtsvInterleavedBatch( + cusparseHandle_t handle, int algo, int m, float *dl, float *d, + float *du, float *x, int batchCount, void *pBuffer) + cusparseStatus_t cusparseDgtsvInterleavedBatch( + cusparseHandle_t handle, int algo, int m, double *dl, double *d, + double *du, double *x, int batchCount, void *pBuffer) + cusparseStatus_t cusparseCgtsvInterleavedBatch( + cusparseHandle_t handle, int algo, int m, cuComplex *dl, cuComplex *d, + cuComplex *du, cuComplex *x, int batchCount, void *pBuffer) + cusparseStatus_t cusparseZgtsvInterleavedBatch( + cusparseHandle_t handle, int algo, int m, cuDoubleComplex *dl, + cuDoubleComplex *d, cuDoubleComplex *du, cuDoubleComplex *x, + int batchCount, void *pBuffer) + cusparseStatus_t cusparseSgpsvInterleavedBatch_bufferSizeExt( + cusparseHandle_t handle, int algo, int m, const float *ds, + const float *dl, const float *d, const float *du, const float *dw, + const float *x, int batchCount, size_t *pBufferSizeInBytes) + cusparseStatus_t cusparseDgpsvInterleavedBatch_bufferSizeExt( + cusparseHandle_t handle, int algo, int m, const double *ds, + const double *dl, const double *d, const double *du, const double *dw, + const double *x, int batchCount, size_t *pBufferSizeInBytes) + cusparseStatus_t cusparseCgpsvInterleavedBatch_bufferSizeExt( + cusparseHandle_t handle, int algo, int m, const cuComplex *ds, + const cuComplex *dl, const cuComplex *d, const cuComplex *du, + const cuComplex *dw, const cuComplex *x, int batchCount, + size_t *pBufferSizeInBytes) + cusparseStatus_t cusparseZgpsvInterleavedBatch_bufferSizeExt( + cusparseHandle_t handle, int algo, int m, const cuDoubleComplex *ds, + const cuDoubleComplex *dl, const cuDoubleComplex *d, + const cuDoubleComplex *du, const cuDoubleComplex *dw, + const cuDoubleComplex *x, int batchCount, size_t *pBufferSizeInBytes) + cusparseStatus_t cusparseSgpsvInterleavedBatch( + cusparseHandle_t handle, int algo, int m, float *ds, float *dl, + float *d, float *du, float *dw, float *x, int batchCount, + void *pBuffer) + cusparseStatus_t cusparseDgpsvInterleavedBatch( + cusparseHandle_t handle, int algo, int m, double *ds, double *dl, + double *d, double *du, double *dw, double *x, int batchCount, + void *pBuffer) + cusparseStatus_t cusparseCgpsvInterleavedBatch( + cusparseHandle_t handle, int algo, int m, cuComplex *ds, cuComplex *dl, + cuComplex *d, cuComplex *du, cuComplex *dw, cuComplex *x, + int batchCount, void *pBuffer) + cusparseStatus_t cusparseZgpsvInterleavedBatch( + cusparseHandle_t handle, int algo, int m, cuDoubleComplex *ds, + cuDoubleComplex *dl, cuDoubleComplex *d, cuDoubleComplex *du, + cuDoubleComplex *dw, cuDoubleComplex *x, int batchCount, void *pBuffer) + + # Sparse Vector APIs + Status cusparseCreateSpVec(SpVecDescr* spVecDescr, int64_t size, + int64_t nnz, void* indices, void* values, + IndexType idxType, IndexBase idxBase, + DataType valueType) + Status cusparseDestroySpVec(SpVecDescr spVecDescr) + Status cusparseSpVecGet(SpVecDescr spVecDescr, int64_t* size, int64_t* nnz, + void** indices, void** values, IndexType* idxType, + IndexBase* idxBase, DataType* valueType) + Status cusparseSpVecGetIndexBase(SpVecDescr spVecDescr, IndexBase* idxBae) + Status cusparseSpVecGetValues(SpVecDescr spVecDescr, void** values) + Status cusparseSpVecSetValues(SpVecDescr spVecDescr, void* values) + + # Sparse Matrix APIs + Status cusparseCreateCoo(SpMatDescr* spMatDescr, int64_t rows, + int64_t cols, int64_t nnz, void* cooRowInd, + void* cooColInd, void* cooValues, + IndexType cooIdxType, IndexBase idxBase, + DataType valueType) + Status cusparseCreateCooAoS(SpMatDescr* spMatDescr, int64_t rows, + int64_t cols, int64_t nnz, void* cooInd, + void* cooValues, IndexType cooIdxType, + IndexBase idxBase, DataType valueType) + Status cusparseCreateCsr(SpMatDescr* spMatDescr, int64_t rows, + int64_t cols, int64_t nnz, void* csrRowOffsets, + void* csrColind, void* csrValues, + IndexType csrRowOffsetsType, + IndexType csrColIndType, IndexBase idxBase, + DataType valueType) + Status cusparseDestroySpMat(SpMatDescr spMatDescr) + Status cusparseCooGet(SpMatDescr spMatDescr, int64_t* rows, int64_t* cols, + int64_t* nnz, void** cooRowInd, void** cooColInd, + void** cooValues, IndexType* idxType, + IndexBase* idxBase, DataType* valueType) + Status cusparseCooAoSGet(SpMatDescr spMatDescr, int64_t* rows, + int64_t* cols, int64_t* nnz, void** cooInd, + void** cooValues, IndexType* idxType, + IndexBase* idxBase, DataType* valueType) + Status cusparseCsrGet(SpMatDescr spMatDescr, int64_t* rows, int64_t* cols, + int64_t* nnz, void** csrRowOffsets, void** csrColInd, + void** csrValues, IndexType* csrRowOffsetsType, + IndexType* csrColIndType, IndexBase* idxBase, + DataType* valueType) + Status cusparseCsrSetPointers(SpMatDescr spMatDescr, void* csrRowOffsets, + void* csrColInd, void* csrValues) + Status cusparseSpMatGetFormat(SpMatDescr spMatDescr, Format* format) + Status cusparseSpMatGetIndexBase(SpMatDescr spMatDescr, IndexBase* idxBase) + Status cusparseSpMatGetValues(SpMatDescr spMatDescr, void** values) + Status cusparseSpMatSetValues(SpMatDescr spMatDescr, void* values) + Status cusparseSpMatGetSize(SpMatDescr spMatDescr, int64_t* rows, + int64_t* cols, int64_t* nnz) + Status cusparseSpMatGetStridedBatch(SpMatDescr spMatDescr, int* batchCount) + Status cusparseSpMatSetStridedBatch(SpMatDescr spMatDescr, int batchCount) + + # Dense Vector APIs + Status cusparseCreateDnVec(DnVecDescr *dnVecDescr, int64_t size, + void* values, DataType valueType) + Status cusparseDestroyDnVec(DnVecDescr dnVecDescr) + Status cusparseDnVecGet(DnVecDescr dnVecDescr, int64_t* size, + void** values, DataType* valueType) + Status cusparseDnVecGetValues(DnVecDescr dnVecDescr, void** values) + Status cusparseDnVecSetValues(DnVecDescr dnVecDescr, void* values) + + # Dense Matrix APIs + Status cusparseCreateDnMat(DnMatDescr* dnMatDescr, int64_t rows, + int64_t cols, int64_t ld, void* values, + DataType valueType, Order order) + Status cusparseDestroyDnMat(DnMatDescr dnVecDescr) + Status cusparseDnMatGet(DnMatDescr dnMatDescr, int64_t* rows, + int64_t* cols, int64_t* ld, void** values, + DataType* valueType, Order* order) + Status cusparseDnMatGetValues(DnMatDescr spMatDescr, void** values) + Status cusparseDnMatSetValues(DnMatDescr spMatDescr, void* values) + Status cusparseDnMatGetStridedBatch(DnMatDescr dnMatDescr, int* batchCount, + int64_t *batchStride) + Status cusparseDnMatSetStridedBatch(DnMatDescr dnMatDescr, int batchCount, + int64_t batchStride) + + # Generic API Functions + Status cusparseSpVV_bufferSize(Handle handle, Operation opX, + SpVecDescr vecX, DnVecDescr vecY, + void* result, DataType computeType, + size_t* bufferSize) + Status cusparseSpVV(Handle handle, Operation opX, SpVecDescr vecX, + DnVecDescr vecY, void* result, DataType computeType, + void* externalBuffer) + Status cusparseSpMV_bufferSize(Handle handle, Operation opA, void* alpha, + SpMatDescr matA, DnVecDescr vecX, + void* beta, DnVecDescr vecY, + DataType computeType, SpMVAlg alg, + size_t* bufferSize) + Status cusparseSpMV(Handle handle, Operation opA, void* alpha, + SpMatDescr matA, DnVecDescr vecX, void* beta, + DnVecDescr vecY, DataType computeType, SpMVAlg alg, + void* externalBuffer) + Status cusparseSpMM_bufferSize(Handle handle, Operation opA, Operation opB, + void* alpha, SpMatDescr matA, + DnMatDescr matB, void* beta, + DnMatDescr matC, DataType computeType, + SpMMAlg alg, size_t* bufferSize) + Status cusparseSpMM(Handle handle, Operation opA, Operation opB, + void* alpha, SpMatDescr matA, DnMatDescr matB, + void* beta, DnMatDescr matC, DataType computeType, + SpMMAlg alg, void* externalBuffer) + Status cusparseConstrainedGeMM_bufferSize( + Handle handle, Operation opA, Operation opB, void* alpha, + DnMatDescr matA, DnMatDescr matB, void* beta, SpMatDescr matC, + DataType computeType, size_t* bufferSize) + Status cusparseConstrainedGeMM( + Handle handle, Operation opA, Operation opB, void* alpha, + DnMatDescr matA, DnMatDescr matB, void* beta, SpMatDescr matC, + DataType computeType, void* externalBuffer) + + Status cusparseSpGEMM_createDescr(SpGEMMDescr* spgemmDescr) + Status cusparseSpGEMM_destroyDescr(SpGEMMDescr spgemmDescr) + Status cusparseSpGEMM_workEstimation( + Handle handle, Operation opA, Operation opB, const void* alpha, + SpMatDescr matA, SpMatDescr matB, const void* beta, SpMatDescr matC, + DataType computeType, SpGEMMAlg alg, SpGEMMDescr spgemmDescr, + size_t* bufferSize1, void* externalBuffer1) + Status cusparseSpGEMM_compute( + Handle handle, Operation opA, Operation opB, const void* alpha, + SpMatDescr matA, SpMatDescr matB, const void* beta, SpMatDescr matC, + DataType computeType, SpGEMMAlg alg, SpGEMMDescr spgemmDescr, + size_t* bufferSize2, void* externalBuffer2) + Status cusparseSpGEMM_copy( + Handle handle, Operation opA, Operation opB, const void* alpha, + SpMatDescr matA, SpMatDescr matB, const void* beta, SpMatDescr matC, + DataType computeType, SpGEMMAlg alg, SpGEMMDescr spgemmDescr) + Status cusparseGather(Handle handle, DnVecDescr vecY, SpVecDescr vecX) + + # CSR2CSC + Status cusparseCsr2cscEx2_bufferSize( + Handle handle, int m, int n, int nnz, const void* csrVal, + const int* csrRowPtr, const int* csrColInd, void* cscVal, + int* cscColPtr, int* cscRowInd, DataType valType, Action copyValues, + IndexBase idxBase, Csr2CscAlg alg, size_t* bufferSize) + + Status cusparseCsr2cscEx2( + Handle handle, int m, int n, int nnz, const void* csrVal, + const int* csrRowPtr, const int* csrColInd, void* cscVal, + int* cscColPtr, int* cscRowInd, DataType valType, Action copyValues, + IndexBase idxBase, Csr2CscAlg alg, void* buffer) + + # Build-time version + int CUSPARSE_VERSION + + ctypedef Status (*f_type)(...) nogil # NOQA + IF 11010 <= CUPY_CUDA_VERSION < 12000: + if _sys.platform == 'linux': + _libname = 'libcusparse.so.11' + else: + _libname = 'cusparse64_11.dll' + ELIF 12000 <= CUPY_CUDA_VERSION < 13000: + if _sys.platform == 'linux': + _libname = 'libcusparse.so.12' + else: + _libname = 'cusparse64_12.dll' + ELIF 0 < CUPY_HIP_VERSION: + _libname = __file__ + ELSE: + _libname = None + + cdef SoftLink _lib = SoftLink(_libname, 'cusparse') + # cuSPARSE 11.6+ (CUDA 11.3.1+) + cdef f_type cusparseSpSM_createDescr = _lib.get('SpSM_createDescr') + cdef f_type cusparseSpSM_destroyDescr = _lib.get('SpSM_destroyDescr') + cdef f_type cusparseSpSM_bufferSize = _lib.get('SpSM_bufferSize') + cdef f_type cusparseSpSM_analysis = _lib.get('SpSM_analysis') + cdef f_type cusparseSpSM_solve = _lib.get('SpSM_solve') + # cuSPARSE 11.5+ (CUDA 11.3.0+) + cdef f_type cusparseSpMatSetAttribute = _lib.get('SpMatSetAttribute') + # cuSPARSE 11.3.1+ (CUDA 11.2.0+) + cdef f_type cusparseCreateCsc = _lib.get('CreateCsc') + # cuSPARSE 11.3+ (CUDA 11.1.1+) + # Note: CUDA 11.1.0 contains cuSPARSE 11.2.0.275 + cdef f_type cusparseSparseToDense_bufferSize = _lib.get('SparseToDense_bufferSize') # NOQA + cdef f_type cusparseSparseToDense = _lib.get('SparseToDense') + cdef f_type cusparseDenseToSparse_bufferSize = _lib.get('DenseToSparse_bufferSize') # NOQA + cdef f_type cusparseDenseToSparse_analysis = _lib.get('DenseToSparse_analysis') # NOQA + cdef f_type cusparseDenseToSparse_convert = _lib.get('DenseToSparse_convert') # NOQA + + cdef dict HIP_STATUS = { + 0: b'HIPSPARSE_STATUS_SUCCESS', + 1: b'HIPSPARSE_STATUS_NOT_INITIALIZED', + 2: b'HIPSPARSE_STATUS_ALLOC_FAILED', + 3: b'HIPSPARSE_STATUS_INVALID_VALUE', + 4: b'HIPSPARSE_STATUS_ARCH_MISMATCH', + 5: b'HIPSPARSE_STATUS_MAPPING_ERROR', + 6: b'HIPSPARSE_STATUS_EXECUTION_FAILED', + 7: b'HIPSPARSE_STATUS_INTERNAL_ERROR', + 8: b'HIPSPARSE_STATUS_MATRIX_TYPE_NOT_SUPPORTED', + 9: b'HIPSPARSE_STATUS_ZERO_PIVOT', + 10: b'HIPSPARSE_STATUS_NOT_SUPPORTED', + 11: b'HIPSPARSE_STATUS_INSUFFICIENT_RESOURCES', + } + + + cdef class SpVecAttributes: + + def __init__(self, int64_t size, int64_t nnz, + intptr_t idx, intptr_t values, + IndexType idxType, IndexBase idxBase, DataType valueType): + self.size = size + self.nnz = nnz + self.idx = idx + self.values = values + self.idxType = idxType + self.idxBase = idxBase + self.valueType = valueType + + + cdef class CooAttributes: + + def __init__(self, int64_t rows, int64_t cols, int64_t nnz, + intptr_t rowIdx, intptr_t colIdx, intptr_t values, + IndexType idxType, IndexBase idxBase, DataType valueType): + self.rows = rows + self.cols = cols + self.nnz = nnz + self.rowIdx = rowIdx + self.colIdx = colIdx + self.values = values + self.idxType = idxType + self.idxBase = idxBase + self.valueType = valueType + + + cdef class CooAoSAttributes: + + def __init__(self, int64_t rows, int64_t cols, int64_t nnz, + intptr_t ind, intptr_t values, + IndexType idxType, IndexBase idxBase, DataType valueType): + self.rows = rows + self.cols = cols + self.nnz = nnz + self.ind = ind + self.values = values + self.idxType = idxType + self.idxBase = idxBase + self.valueType = valueType + + + cdef class CsrAttributes: + + def __init__(self, int64_t rows, int64_t cols, int64_t nnz, + intptr_t rowOffsets, intptr_t colIdx, intptr_t values, + IndexType rowOffsetType, IndexType colIdxType, + IndexBase idxBase, DataType valueType): + self.rows = rows + self.cols = cols + self.nnz = nnz + self.rowOffsets = rowOffsets + self.colIdx = colIdx + self.values = values + self.rowOffsetType = rowOffsetType + self.colIdxType = colIdxType + self.idxBase = idxBase + self.valueType = valueType + + + cdef class DnVecAttributes: + + def __init__(self, int64_t size, intptr_t values, DataType valueType): + self.size = size + self.values = values + self.valueType = valueType + + + cdef class DnMatAttributes: + + def __init__(self, int64_t rows, int64_t cols, int64_t ld, + intptr_t values, DataType valueType, Order order): + self.rows = rows + self.cols = cols + self.ld = ld + self.values = values + self.valueType = valueType + self.order = order + + + cdef class DnMatBatchAttributes: + + def __init__(self, int count, int64_t stride): + self.count = count + self.stride = stride + + + class CuSparseError(RuntimeError): + + def __init__(self, Status status): + self.status = status + cdef bytes name + cdef bytes msg + if _is_hip_environment: + name = HIP_STATUS[status] + msg = name + else: + name = cusparseGetErrorName(status) + msg = cusparseGetErrorString(status) + super().__init__(f'{name.decode()}: {msg.decode()}') + + def __reduce__(self): + return (type(self), (self.status,)) + + + @cython.profile(False) + cpdef inline check_status(int status): + if status != 0: + raise CuSparseError(status) + + + @cython.profile(False) + cdef inline cuComplex complex_to_cuda(complex value): + cdef cuComplex value_cuda + value_cuda.x = value.real + value_cuda.y = value.imag + return value_cuda + + + @cython.profile(False) + cdef inline cuDoubleComplex double_complex_to_cuda(double complex value): + cdef cuDoubleComplex value_cuda + value_cuda.x = value.real + value_cuda.y = value.imag + return value_cuda + + + cpdef int getVersion(intptr_t handle) except? -1: + cdef int version + status = cusparseGetVersion(handle, &version) + check_status(status) + return version + + + def get_build_version(): + return CUSPARSE_VERSION + + + ######################################## + # cuSPARSE Helper Function + + cpdef intptr_t create() except? 0: + cdef Handle handle + status = cusparseCreate(& handle) + check_status(status) + return handle + + + cpdef size_t createMatDescr() except? -1: + cdef MatDescr desc + status = cusparseCreateMatDescr(& desc) + check_status(status) + return desc + + + cpdef void destroy(intptr_t handle) except *: + status = cusparseDestroy(handle) + check_status(status) + + + cpdef void destroyMatDescr(size_t descr) except *: + status = cusparseDestroyMatDescr(descr) + check_status(status) + + + cpdef void setMatIndexBase(size_t descr, base) except *: + status = cusparseSetMatIndexBase(descr, base) + check_status(status) + + + cpdef void setMatType(size_t descr, typ) except *: + status = cusparseSetMatType(descr, typ) + check_status(status) + + cpdef void setMatFillMode(size_t descrA, int fillMode) except *: + status = cusparseSetMatFillMode(descrA, fillMode) + check_status(status) + + cpdef void setMatDiagType(size_t descrA, int diagType) except *: + status = cusparseSetMatDiagType(descrA, diagType) + check_status(status) + + cpdef void setPointerMode(intptr_t handle, int mode) except *: + status = cusparseSetPointerMode(handle, mode) + check_status(status) + + cpdef void spMatSetAttribute( + size_t spMatDescr, int attribute, int data) except *: + # Assuming the value of attribute is an enum value, whose underlying type + # As for CUDA 11.7, the types of all the sparse matrix descriptor + # attributes are enums, whose underlying type is always int in C. + status = cusparseSpMatSetAttribute( + spMatDescr, attribute, &data, + sizeof(int)) + check_status(status) + + + ######################################## + # Stream + + cpdef void setStream(intptr_t handle, size_t stream) except *: + # TODO(leofang): It seems most of cuSPARSE APIs support stream capture (as + # of CUDA 11.5) under certain conditions, see + # https://docs.nvidia.com/cuda/cusparse/index.html#optimization-notes + # Before we come up with a robust strategy to test the support conditions, + # we disable this functionality. + if not runtime._is_hip_environment and runtime.streamIsCapturing(stream): + raise NotImplementedError( + 'calling cuSPARSE API during stream capture is currently ' + 'unsupported') + + status = cusparseSetStream(handle, stream) + check_status(status) + + + cpdef size_t getStream(intptr_t handle) except? -1: + cdef Stream stream + status = cusparseGetStream(handle, &stream) + check_status(status) + return stream + + + cdef void _setStream(intptr_t handle) except *: + """Set current stream""" + setStream(handle, stream_module.get_current_stream_ptr()) + + + ######################################## + # cuSPARSE Level1 Function + + cpdef void sgthr( + intptr_t handle, int nnz, size_t y, size_t xVal, size_t xInd, + int idxBase) except *: + _setStream(handle) + status = cusparseSgthr( + handle, nnz, y, xVal, + xInd, idxBase) + check_status(status) + + cpdef void dgthr( + intptr_t handle, int nnz, size_t y, size_t xVal, size_t xInd, + int idxBase) except *: + _setStream(handle) + status = cusparseDgthr( + handle, nnz, y, xVal, + xInd, idxBase) + check_status(status) + + cpdef void cgthr( + intptr_t handle, int nnz, size_t y, size_t xVal, size_t xInd, + int idxBase) except *: + _setStream(handle) + status = cusparseCgthr( + handle, nnz, y, xVal, + xInd, idxBase) + check_status(status) + + cpdef void zgthr( + intptr_t handle, int nnz, size_t y, size_t xVal, size_t xInd, + int idxBase) except *: + _setStream(handle) + status = cusparseZgthr( + handle, nnz, y, + xVal, xInd, idxBase) + check_status(status) + + ######################################## + # cuSPARSE Level2 Function + + cpdef void scsrmv( + intptr_t handle, int transA, int m, int n, int nnz, + size_t alpha, size_t descrA, size_t csrSortedValA, + size_t csrSortedRowPtrA, size_t csrSortedColIndA, + size_t x, size_t beta, size_t y) except *: + _setStream(handle) + status = cusparseScsrmv( + handle, transA, m, n, nnz, + alpha, descrA, csrSortedValA, + csrSortedRowPtrA, csrSortedColIndA, + x, beta, y) + check_status(status) + + cpdef void dcsrmv( + intptr_t handle, int transA, int m, int n, int nnz, + size_t alpha, size_t descrA, size_t csrSortedValA, + size_t csrSortedRowPtrA, size_t csrSortedColIndA, + size_t x, size_t beta, size_t y) except *: + _setStream(handle) + status = cusparseDcsrmv( + handle, transA, m, n, nnz, + alpha, descrA, csrSortedValA, + csrSortedRowPtrA, csrSortedColIndA, + x, beta, y) + check_status(status) + + cpdef void ccsrmv( + intptr_t handle, int transA, int m, int n, int nnz, + size_t alpha, size_t descrA, size_t csrSortedValA, + size_t csrSortedRowPtrA, size_t csrSortedColIndA, + size_t x, size_t beta, size_t y) except *: + _setStream(handle) + status = cusparseCcsrmv( + handle, transA, m, n, nnz, + alpha, descrA, + csrSortedValA, + csrSortedRowPtrA, csrSortedColIndA, + x, beta, y) + check_status(status) + + cpdef void zcsrmv( + intptr_t handle, int transA, int m, int n, int nnz, + size_t alpha, size_t descrA, size_t csrSortedValA, + size_t csrSortedRowPtrA, size_t csrSortedColIndA, + size_t x, size_t beta, size_t y) except *: + _setStream(handle) + status = cusparseZcsrmv( + handle, transA, m, n, nnz, + alpha, descrA, + csrSortedValA, + csrSortedRowPtrA, csrSortedColIndA, + x, beta, + y) + check_status(status) + + cpdef size_t csrmvEx_bufferSize( + intptr_t handle, int alg, int transA, int m, int n, + int nnz, size_t alpha, int alphatype, size_t descrA, + size_t csrValA, int csrValAtype, size_t csrRowPtrA, + size_t csrColIndA, size_t x, int xtype, size_t beta, + int betatype, size_t y, int ytype, int executiontype) except? -1: + cdef size_t bufferSizeInBytes + _setStream(handle) + status = cusparseCsrmvEx_bufferSize( + handle, alg, transA, m, + n, nnz, alpha, alphatype, + descrA, csrValA, csrValAtype, + csrRowPtrA, csrColIndA, + x, xtype, beta, + betatype, y, ytype, + executiontype, &bufferSizeInBytes) + check_status(status) + return bufferSizeInBytes + + cpdef void csrmvEx( + intptr_t handle, int alg, int transA, int m, int n, + int nnz, size_t alpha, int alphatype, size_t descrA, + size_t csrValA, int csrValAtype, size_t csrRowPtrA, + size_t csrColIndA, size_t x, int xtype, size_t beta, + int betatype, size_t y, int ytype, int executiontype, + size_t buffer) except *: + _setStream(handle) + status = cusparseCsrmvEx( + handle, alg, transA, m, + n, nnz, alpha, alphatype, + descrA, csrValA, csrValAtype, + csrRowPtrA, csrColIndA, + x, xtype, beta, + betatype, y, ytype, + executiontype, buffer) + check_status(status) + + cpdef size_t createCsrsv2Info() except? -1: + cdef csrsv2Info_t info + status = cusparseCreateCsrsv2Info(&info) + check_status(status) + return info + + cpdef void destroyCsrsv2Info(size_t info) except *: + status = cusparseDestroyCsrsv2Info(info) + check_status(status) + + cpdef int scsrsv2_bufferSize( + intptr_t handle, int transA, int m, int nnz, size_t descrA, + size_t csrSortedValA, size_t csrSortedRowPtrA, + size_t csrSortedColIndA, size_t info) except? -1: + cdef int bufferSize + _setStream(handle) + status = cusparseScsrsv2_bufferSize( + handle, transA, m, nnz, descrA, csrSortedValA, csrSortedRowPtrA, - csrSortedColIndA, info, - &pBufferSizeInBytes) - check_status(status) - return pBufferSizeInBytes - -cpdef int dcsrilu02_bufferSize( - intptr_t handle, int m, int nnz, size_t descrA, - size_t csrSortedValA, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t info) except? -1: - cdef int pBufferSizeInBytes - _setStream(handle) - with nogil: - status = cusparseDcsrilu02_bufferSize( - handle, m, nnz, descrA, + csrSortedColIndA, info, &bufferSize) + check_status(status) + return bufferSize + + cpdef int dcsrsv2_bufferSize( + intptr_t handle, int transA, int m, int nnz, size_t descrA, + size_t csrSortedValA, size_t csrSortedRowPtrA, + size_t csrSortedColIndA, size_t info) except? -1: + cdef int bufferSize + _setStream(handle) + status = cusparseDcsrsv2_bufferSize( + handle, transA, m, nnz, descrA, csrSortedValA, csrSortedRowPtrA, - csrSortedColIndA, info, - &pBufferSizeInBytes) - check_status(status) - return pBufferSizeInBytes - -cpdef int ccsrilu02_bufferSize( - intptr_t handle, int m, int nnz, size_t descrA, - size_t csrSortedValA, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t info) except? -1: - cdef int pBufferSizeInBytes - _setStream(handle) - with nogil: - status = cusparseCcsrilu02_bufferSize( - handle, m, nnz, descrA, + csrSortedColIndA, info, &bufferSize) + check_status(status) + return bufferSize + + cpdef int ccsrsv2_bufferSize( + intptr_t handle, int transA, int m, int nnz, size_t descrA, + size_t csrSortedValA, size_t csrSortedRowPtrA, + size_t csrSortedColIndA, size_t info) except? -1: + cdef int bufferSize + _setStream(handle) + status = cusparseCcsrsv2_bufferSize( + handle, transA, m, nnz, descrA, csrSortedValA, csrSortedRowPtrA, - csrSortedColIndA, info, - &pBufferSizeInBytes) - check_status(status) - return pBufferSizeInBytes - -cpdef int zcsrilu02_bufferSize( - intptr_t handle, int m, int nnz, size_t descrA, - size_t csrSortedValA, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t info) except? -1: - cdef int pBufferSizeInBytes - _setStream(handle) - with nogil: - status = cusparseZcsrilu02_bufferSize( - handle, m, nnz, descrA, + csrSortedColIndA, info, &bufferSize) + check_status(status) + return bufferSize + + cpdef int zcsrsv2_bufferSize( + intptr_t handle, int transA, int m, int nnz, size_t descrA, + size_t csrSortedValA, size_t csrSortedRowPtrA, + size_t csrSortedColIndA, size_t info) except? -1: + cdef int bufferSize + _setStream(handle) + status = cusparseZcsrsv2_bufferSize( + handle, transA, m, nnz, descrA, csrSortedValA, csrSortedRowPtrA, - csrSortedColIndA, info, - &pBufferSizeInBytes) - check_status(status) - return pBufferSizeInBytes - -cpdef void scsrilu02_analysis(intptr_t handle, int m, int nnz, size_t descrA, - size_t csrSortedValA, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t info, int policy, - size_t pBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseScsrilu02_analysis( - handle, m, nnz, descrA, + csrSortedColIndA, info, &bufferSize) + check_status(status) + return bufferSize + + cpdef void scsrsv2_analysis( + intptr_t handle, int transA, int m, int nnz, size_t descrA, + size_t csrSortedValA, size_t csrSortedRowPtrA, + size_t csrSortedColIndA, size_t info, int policy, + size_t pBuffer) except *: + _setStream(handle) + status = cusparseScsrsv2_analysis( + handle, transA, m, nnz, descrA, csrSortedValA, csrSortedRowPtrA, - csrSortedColIndA, info, + csrSortedColIndA, info, policy, pBuffer) - check_status(status) - -cpdef void dcsrilu02_analysis(intptr_t handle, int m, int nnz, size_t descrA, - size_t csrSortedValA, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t info, int policy, - size_t pBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseDcsrilu02_analysis( - handle, m, nnz, descrA, + check_status(status) + + cpdef void dcsrsv2_analysis( + intptr_t handle, int transA, int m, int nnz, size_t descrA, + size_t csrSortedValA, size_t csrSortedRowPtrA, + size_t csrSortedColIndA, size_t info, int policy, + size_t pBuffer) except *: + _setStream(handle) + status = cusparseDcsrsv2_analysis( + handle, transA, m, nnz, descrA, csrSortedValA, csrSortedRowPtrA, - csrSortedColIndA, info, + csrSortedColIndA, info, policy, pBuffer) - check_status(status) - -cpdef void ccsrilu02_analysis(intptr_t handle, int m, int nnz, size_t descrA, - size_t csrSortedValA, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t info, int policy, - size_t pBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseCcsrilu02_analysis( - handle, m, nnz, descrA, + check_status(status) + + cpdef void ccsrsv2_analysis( + intptr_t handle, int transA, int m, int nnz, size_t descrA, + size_t csrSortedValA, size_t csrSortedRowPtrA, + size_t csrSortedColIndA, size_t info, int policy, + size_t pBuffer) except *: + _setStream(handle) + status = cusparseCcsrsv2_analysis( + handle, transA, m, nnz, descrA, csrSortedValA, csrSortedRowPtrA, - csrSortedColIndA, info, - policy, pBuffer) - check_status(status) - -cpdef void zcsrilu02_analysis(intptr_t handle, int m, int nnz, size_t descrA, - size_t csrSortedValA, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t info, int policy, - size_t pBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseZcsrilu02_analysis( - handle, m, nnz, descrA, - csrSortedValA, - csrSortedRowPtrA, csrSortedColIndA, - info, policy, - pBuffer) - check_status(status) - -cpdef void scsrilu02(intptr_t handle, int m, int nnz, size_t descrA, - size_t csrSortedValA_valM, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t info, int policy, - size_t pBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseScsrilu02( - handle, m, nnz, descrA, - csrSortedValA_valM, csrSortedRowPtrA, - csrSortedColIndA, info, - policy, pBuffer) - check_status(status) - -cpdef void dcsrilu02(intptr_t handle, int m, int nnz, size_t descrA, - size_t csrSortedValA_valM, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t info, int policy, - size_t pBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseDcsrilu02( - handle, m, nnz, descrA, - csrSortedValA_valM, csrSortedRowPtrA, - csrSortedColIndA, info, - policy, pBuffer) - check_status(status) - -cpdef void ccsrilu02(intptr_t handle, int m, int nnz, size_t descrA, - size_t csrSortedValA_valM, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t info, int policy, - size_t pBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseCcsrilu02( - handle, m, nnz, descrA, - csrSortedValA_valM, csrSortedRowPtrA, - csrSortedColIndA, info, + csrSortedColIndA, info, policy, pBuffer) - check_status(status) - -cpdef void zcsrilu02(intptr_t handle, int m, int nnz, size_t descrA, - size_t csrSortedValA_valM, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t info, int policy, - size_t pBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseZcsrilu02( - handle, m, nnz, descrA, - csrSortedValA_valM, csrSortedRowPtrA, - csrSortedColIndA, info, + check_status(status) + + cpdef void zcsrsv2_analysis( + intptr_t handle, int transA, int m, int nnz, size_t descrA, + size_t csrSortedValA, size_t csrSortedRowPtrA, + size_t csrSortedColIndA, size_t info, int policy, + size_t pBuffer) except *: + _setStream(handle) + status = cusparseZcsrsv2_analysis( + handle, transA, m, nnz, descrA, + csrSortedValA, csrSortedRowPtrA, + csrSortedColIndA, info, policy, pBuffer) - check_status(status) - -cpdef void sbsrilu02_numericBoost( - intptr_t handle, size_t info, int enable_boost, - size_t tol, size_t boost_val) except *: - _setStream(handle) - with nogil: - status = cusparseSbsrilu02_numericBoost( - handle, info, enable_boost, - tol, boost_val) - check_status(status) - -cpdef void dbsrilu02_numericBoost( - intptr_t handle, size_t info, int enable_boost, - size_t tol, size_t boost_val) except *: - _setStream(handle) - with nogil: - status = cusparseDbsrilu02_numericBoost( - handle, info, enable_boost, - tol, boost_val) - check_status(status) - -cpdef void cbsrilu02_numericBoost( - intptr_t handle, size_t info, int enable_boost, - size_t tol, size_t boost_val) except *: - _setStream(handle) - with nogil: - status = cusparseCbsrilu02_numericBoost( - handle, info, enable_boost, - tol, boost_val) - check_status(status) - -cpdef void zbsrilu02_numericBoost( - intptr_t handle, size_t info, int enable_boost, - size_t tol, size_t boost_val) except *: - _setStream(handle) - with nogil: - status = cusparseZbsrilu02_numericBoost( - handle, info, enable_boost, - tol, boost_val) - check_status(status) - -cpdef void xbsrilu02_zeroPivot( - intptr_t handle, size_t info, size_t position) except *: - _setStream(handle) - with nogil: - status = cusparseXbsrilu02_zeroPivot( - handle, info, position) - check_status(status) - -cpdef int sbsrilu02_bufferSize(intptr_t handle, int dirA, int mb, int nnzb, - size_t descrA, size_t bsrSortedVal, - size_t bsrSortedRowPtr, size_t bsrSortedColInd, - int blockDim, size_t info) except? -1: - cdef int pBufferSizeInBytes - _setStream(handle) - with nogil: - status = cusparseSbsrilu02_bufferSize( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, &pBufferSizeInBytes) - check_status(status) - return pBufferSizeInBytes - -cpdef int dbsrilu02_bufferSize(intptr_t handle, int dirA, int mb, int nnzb, - size_t descrA, size_t bsrSortedVal, - size_t bsrSortedRowPtr, size_t bsrSortedColInd, - int blockDim, size_t info) except? -1: - cdef int pBufferSizeInBytes - _setStream(handle) - with nogil: - status = cusparseDbsrilu02_bufferSize( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, &pBufferSizeInBytes) - check_status(status) - return pBufferSizeInBytes - -cpdef int cbsrilu02_bufferSize(intptr_t handle, int dirA, int mb, int nnzb, - size_t descrA, size_t bsrSortedVal, - size_t bsrSortedRowPtr, size_t bsrSortedColInd, - int blockDim, size_t info) except? -1: - cdef int pBufferSizeInBytes - _setStream(handle) - with nogil: - status = cusparseCbsrilu02_bufferSize( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, &pBufferSizeInBytes) - check_status(status) - return pBufferSizeInBytes - -cpdef int zbsrilu02_bufferSize(intptr_t handle, int dirA, int mb, int nnzb, - size_t descrA, size_t bsrSortedVal, - size_t bsrSortedRowPtr, size_t bsrSortedColInd, - int blockDim, size_t info) except? -1: - cdef int pBufferSizeInBytes - _setStream(handle) - with nogil: - status = cusparseZbsrilu02_bufferSize( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, &pBufferSizeInBytes) - check_status(status) - return pBufferSizeInBytes - -cpdef void sbsrilu02_analysis( - intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, - size_t bsrSortedVal, size_t bsrSortedRowPtr, size_t bsrSortedColInd, - int blockDim, size_t info, int policy, size_t pBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseSbsrilu02_analysis( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, policy, - pBuffer) - check_status(status) - -cpdef void dbsrilu02_analysis( - intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, - size_t bsrSortedVal, size_t bsrSortedRowPtr, size_t bsrSortedColInd, - int blockDim, size_t info, int policy, size_t pBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseDbsrilu02_analysis( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, policy, - pBuffer) - check_status(status) - -cpdef void cbsrilu02_analysis( - intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, - size_t bsrSortedVal, size_t bsrSortedRowPtr, size_t bsrSortedColInd, - int blockDim, size_t info, int policy, size_t pBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseCbsrilu02_analysis( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, policy, - pBuffer) - check_status(status) - -cpdef void zbsrilu02_analysis( - intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, - size_t bsrSortedVal, size_t bsrSortedRowPtr, size_t bsrSortedColInd, - int blockDim, size_t info, int policy, size_t pBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseZbsrilu02_analysis( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, policy, - pBuffer) - check_status(status) - -cpdef void sbsrilu02( - intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, - size_t bsrSortedVal, size_t bsrSortedRowPtr, - size_t bsrSortedColInd, int blockDim, size_t info, int policy, - size_t pBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseSbsrilu02( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, policy, - pBuffer) - check_status(status) - -cpdef void dbsrilu02( - intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, - size_t bsrSortedVal, size_t bsrSortedRowPtr, - size_t bsrSortedColInd, int blockDim, size_t info, int policy, - size_t pBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseDbsrilu02( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, policy, - pBuffer) - check_status(status) - -cpdef void cbsrilu02( - intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, - size_t bsrSortedVal, size_t bsrSortedRowPtr, - size_t bsrSortedColInd, int blockDim, size_t info, int policy, - size_t pBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseCbsrilu02( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, policy, - pBuffer) - check_status(status) - -cpdef void zbsrilu02( - intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, - size_t bsrSortedVal, size_t bsrSortedRowPtr, - size_t bsrSortedColInd, int blockDim, size_t info, int policy, - size_t pBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseZbsrilu02( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, policy, - pBuffer) - check_status(status) - -cpdef void xcsric02_zeroPivot( - intptr_t handle, size_t info, size_t position) except *: - _setStream(handle) - with nogil: - status = cusparseXcsric02_zeroPivot( - handle, info, position) - check_status(status) - -cpdef int scsric02_bufferSize(intptr_t handle, int m, int nnz, size_t descrA, - size_t csrSortedValA, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t info) except? -1: - cdef int pBufferSizeInBytes - _setStream(handle) - with nogil: - status = cusparseScsric02_bufferSize( - handle, m, nnz, descrA, - csrSortedValA, csrSortedRowPtrA, - csrSortedColIndA, info, - &pBufferSizeInBytes) - check_status(status) - return pBufferSizeInBytes - -cpdef int dcsric02_bufferSize(intptr_t handle, int m, int nnz, size_t descrA, - size_t csrSortedValA, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t info) except? -1: - cdef int pBufferSizeInBytes - _setStream(handle) - with nogil: - status = cusparseDcsric02_bufferSize( - handle, m, nnz, descrA, - csrSortedValA, csrSortedRowPtrA, - csrSortedColIndA, info, - &pBufferSizeInBytes) - check_status(status) - return pBufferSizeInBytes - -cpdef int ccsric02_bufferSize(intptr_t handle, int m, int nnz, size_t descrA, - size_t csrSortedValA, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t info) except? -1: - cdef int pBufferSizeInBytes - _setStream(handle) - with nogil: - status = cusparseCcsric02_bufferSize( - handle, m, nnz, descrA, - csrSortedValA, csrSortedRowPtrA, - csrSortedColIndA, info, - &pBufferSizeInBytes) - check_status(status) - return pBufferSizeInBytes - -cpdef int zcsric02_bufferSize(intptr_t handle, int m, int nnz, size_t descrA, - size_t csrSortedValA, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t info) except? -1: - cdef int pBufferSizeInBytes - _setStream(handle) - with nogil: - status = cusparseZcsric02_bufferSize( - handle, m, nnz, descrA, - csrSortedValA, csrSortedRowPtrA, - csrSortedColIndA, info, - &pBufferSizeInBytes) - check_status(status) - return pBufferSizeInBytes - -cpdef void scsric02_analysis( - intptr_t handle, int m, int nnz, size_t descrA, - size_t csrSortedValA, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t info, int policy, - size_t pBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseScsric02_analysis( - handle, m, nnz, descrA, + check_status(status) + + cpdef void scsrsv2_solve( + intptr_t handle, int transA, int m, int nnz, size_t alpha, + size_t descrA, size_t csrSortedValA, size_t csrSortedRowPtrA, + size_t csrSortedColIndA, size_t info, size_t x, size_t y, int policy, + size_t pBuffer) except *: + _setStream(handle) + status = cusparseScsrsv2_solve( + handle, transA, m, nnz, + alpha, descrA, csrSortedValA, csrSortedRowPtrA, - csrSortedColIndA, info, + csrSortedColIndA, info, + x, y, policy, pBuffer) - check_status(status) - -cpdef void dcsric02_analysis( - intptr_t handle, int m, int nnz, size_t descrA, - size_t csrSortedValA, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t info, int policy, - size_t pBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseDcsric02_analysis( - handle, m, nnz, descrA, + check_status(status) + + cpdef void dcsrsv2_solve( + intptr_t handle, int transA, int m, int nnz, size_t alpha, + size_t descrA, size_t csrSortedValA, size_t csrSortedRowPtrA, + size_t csrSortedColIndA, size_t info, size_t x, size_t y, int policy, + size_t pBuffer) except *: + _setStream(handle) + status = cusparseDcsrsv2_solve( + handle, transA, m, nnz, + alpha, descrA, csrSortedValA, csrSortedRowPtrA, - csrSortedColIndA, info, + csrSortedColIndA, info, + x, y, policy, pBuffer) - check_status(status) - -cpdef void ccsric02_analysis( - intptr_t handle, int m, int nnz, size_t descrA, - size_t csrSortedValA, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t info, int policy, - size_t pBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseCcsric02_analysis( - handle, m, nnz, descrA, + check_status(status) + + cpdef void ccsrsv2_solve( + intptr_t handle, int transA, int m, int nnz, size_t alpha, + size_t descrA, size_t csrSortedValA, size_t csrSortedRowPtrA, + size_t csrSortedColIndA, size_t info, size_t x, size_t y, int policy, + size_t pBuffer) except *: + _setStream(handle) + status = cusparseCcsrsv2_solve( + handle, transA, m, nnz, + alpha, descrA, csrSortedValA, csrSortedRowPtrA, - csrSortedColIndA, info, - policy, pBuffer) - check_status(status) - -cpdef void zcsric02_analysis( - intptr_t handle, int m, int nnz, size_t descrA, - size_t csrSortedValA, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t info, int policy, - size_t pBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseZcsric02_analysis( - handle, m, nnz, descrA, - csrSortedValA, - csrSortedRowPtrA, csrSortedColIndA, - info, policy, pBuffer) - check_status(status) - -cpdef void scsric02( - intptr_t handle, int m, int nnz, size_t descrA, - size_t csrSortedValA_valM, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t info, int policy, - size_t pBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseScsric02( - handle, m, nnz, descrA, - csrSortedValA_valM, csrSortedRowPtrA, - csrSortedColIndA, info, - policy, pBuffer) - check_status(status) - -cpdef void dcsric02( - intptr_t handle, int m, int nnz, size_t descrA, - size_t csrSortedValA_valM, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t info, int policy, - size_t pBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseDcsric02( - handle, m, nnz, descrA, - csrSortedValA_valM, csrSortedRowPtrA, - csrSortedColIndA, info, + csrSortedColIndA, info, + x, y, policy, pBuffer) - check_status(status) - -cpdef void ccsric02( - intptr_t handle, int m, int nnz, size_t descrA, - size_t csrSortedValA_valM, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t info, int policy, - size_t pBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseCcsric02( - handle, m, nnz, descrA, - csrSortedValA_valM, csrSortedRowPtrA, - csrSortedColIndA, info, - policy, pBuffer) - check_status(status) - -cpdef void zcsric02( - intptr_t handle, int m, int nnz, size_t descrA, - size_t csrSortedValA_valM, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t info, int policy, - size_t pBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseZcsric02( - handle, m, nnz, descrA, - csrSortedValA_valM, csrSortedRowPtrA, - csrSortedColIndA, info, + check_status(status) + + cpdef void zcsrsv2_solve( + intptr_t handle, int transA, int m, int nnz, size_t alpha, + size_t descrA, size_t csrSortedValA, size_t csrSortedRowPtrA, + size_t csrSortedColIndA, size_t info, size_t x, size_t y, int policy, + size_t pBuffer) except *: + _setStream(handle) + status = cusparseZcsrsv2_solve( + handle, transA, m, nnz, + alpha, descrA, + csrSortedValA, csrSortedRowPtrA, + csrSortedColIndA, info, + x, y, policy, pBuffer) - check_status(status) - -cpdef void xbsric02_zeroPivot( - intptr_t handle, size_t info, size_t position) except *: - _setStream(handle) - with nogil: - status = cusparseXbsric02_zeroPivot( - handle, info, position) - check_status(status) - -cpdef int sbsric02_bufferSize(intptr_t handle, int dirA, int mb, int nnzb, - size_t descrA, size_t bsrSortedVal, - size_t bsrSortedRowPtr, size_t bsrSortedColInd, - int blockDim, size_t info) except? -1: - cdef int pBufferSizeInBytes - _setStream(handle) - with nogil: - status = cusparseSbsric02_bufferSize( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, &pBufferSizeInBytes) - check_status(status) - return pBufferSizeInBytes - -cpdef int dbsric02_bufferSize(intptr_t handle, int dirA, int mb, int nnzb, - size_t descrA, size_t bsrSortedVal, - size_t bsrSortedRowPtr, size_t bsrSortedColInd, - int blockDim, size_t info) except? -1: - cdef int pBufferSizeInBytes - _setStream(handle) - with nogil: - status = cusparseDbsric02_bufferSize( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, &pBufferSizeInBytes) - check_status(status) - return pBufferSizeInBytes - -cpdef int cbsric02_bufferSize(intptr_t handle, int dirA, int mb, int nnzb, - size_t descrA, size_t bsrSortedVal, - size_t bsrSortedRowPtr, size_t bsrSortedColInd, - int blockDim, size_t info) except? -1: - cdef int pBufferSizeInBytes - _setStream(handle) - with nogil: - status = cusparseCbsric02_bufferSize( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, &pBufferSizeInBytes) - check_status(status) - return pBufferSizeInBytes - -cpdef int zbsric02_bufferSize(intptr_t handle, int dirA, int mb, int nnzb, - size_t descrA, size_t bsrSortedVal, - size_t bsrSortedRowPtr, size_t bsrSortedColInd, - int blockDim, size_t info) except? -1: - cdef int pBufferSizeInBytes - _setStream(handle) - with nogil: - status = cusparseZbsric02_bufferSize( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, &pBufferSizeInBytes) - check_status(status) - return pBufferSizeInBytes - -cpdef void sbsric02_analysis( - intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, - size_t bsrSortedVal, size_t bsrSortedRowPtr, size_t bsrSortedColInd, - int blockDim, size_t info, int policy, size_t pInputBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseSbsric02_analysis( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, policy, - pInputBuffer) - check_status(status) - -cpdef void dbsric02_analysis( - intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, - size_t bsrSortedVal, size_t bsrSortedRowPtr, size_t bsrSortedColInd, - int blockDim, size_t info, int policy, size_t pInputBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseDbsric02_analysis( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, policy, - pInputBuffer) - check_status(status) - -cpdef void cbsric02_analysis( - intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, - size_t bsrSortedVal, size_t bsrSortedRowPtr, size_t bsrSortedColInd, - int blockDim, size_t info, int policy, size_t pInputBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseCbsric02_analysis( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, policy, - pInputBuffer) - check_status(status) - -cpdef void zbsric02_analysis( - intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, - size_t bsrSortedVal, size_t bsrSortedRowPtr, size_t bsrSortedColInd, - int blockDim, size_t info, int policy, size_t pInputBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseZbsric02_analysis( - handle, dirA, mb, nnzb, - descrA, - bsrSortedVal, bsrSortedRowPtr, - bsrSortedColInd, blockDim, info, - policy, pInputBuffer) - check_status(status) - -cpdef void sbsric02( - intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, - size_t bsrSortedVal, size_t bsrSortedRowPtr, - size_t bsrSortedColInd, int blockDim, size_t info, int policy, - size_t pBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseSbsric02( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, policy, pBuffer) - check_status(status) - -cpdef void dbsric02( - intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, - size_t bsrSortedVal, size_t bsrSortedRowPtr, - size_t bsrSortedColInd, int blockDim, size_t info, int policy, - size_t pBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseDbsric02( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, policy, pBuffer) - check_status(status) - -cpdef void cbsric02( - intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, - size_t bsrSortedVal, size_t bsrSortedRowPtr, - size_t bsrSortedColInd, int blockDim, size_t info, int policy, - size_t pBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseCbsric02( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, policy, pBuffer) - check_status(status) - -cpdef void zbsric02( - intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, - size_t bsrSortedVal, size_t bsrSortedRowPtr, - size_t bsrSortedColInd, int blockDim, size_t info, int policy, - size_t pBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseZbsric02( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, policy, pBuffer) - check_status(status) - -cpdef size_t sgtsv2_bufferSizeExt( - intptr_t handle, int m, int n, size_t dl, size_t d, - size_t du, size_t B, int ldb) except? -1: - cdef size_t bufferSizeInBytes - _setStream(handle) - with nogil: - status = cusparseSgtsv2_bufferSizeExt( - handle, m, n, dl, d, - du, B, ldb, &bufferSizeInBytes) - check_status(status) - return bufferSizeInBytes - -cpdef size_t dgtsv2_bufferSizeExt( - intptr_t handle, int m, int n, size_t dl, size_t d, - size_t du, size_t B, int ldb) except? -1: - cdef size_t bufferSizeInBytes - _setStream(handle) - with nogil: - status = cusparseDgtsv2_bufferSizeExt( - handle, m, n, dl, - d, du, B, ldb, - &bufferSizeInBytes) - check_status(status) - return bufferSizeInBytes - -cpdef size_t cgtsv2_bufferSizeExt( - intptr_t handle, int m, int n, size_t dl, size_t d, - size_t du, size_t B, int ldb) except? -1: - cdef size_t bufferSizeInBytes - _setStream(handle) - with nogil: - status = cusparseCgtsv2_bufferSizeExt( - handle, m, n, dl, - d, du, B, - ldb, &bufferSizeInBytes) - check_status(status) - return bufferSizeInBytes - -cpdef size_t zgtsv2_bufferSizeExt( - intptr_t handle, int m, int n, size_t dl, size_t d, - size_t du, size_t B, int ldb) except? -1: - cdef size_t bufferSizeInBytes - _setStream(handle) - with nogil: - status = cusparseZgtsv2_bufferSizeExt( - handle, m, n, dl, - d, du, - B, ldb, &bufferSizeInBytes) - check_status(status) - return bufferSizeInBytes - -cpdef void sgtsv2( - intptr_t handle, int m, int n, size_t dl, size_t d, size_t du, - size_t B, int ldb, size_t pBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseSgtsv2( - handle, m, n, dl, d, - du, B, ldb, pBuffer) - check_status(status) - -cpdef void dgtsv2( - intptr_t handle, int m, int n, size_t dl, size_t d, size_t du, - size_t B, int ldb, size_t pBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseDgtsv2(handle, m, n, - dl, d, - du, B, ldb, - pBuffer) - check_status(status) - -cpdef void cgtsv2( - intptr_t handle, int m, int n, size_t dl, size_t d, size_t du, - size_t B, int ldb, size_t pBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseCgtsv2(handle, m, n, - dl, d, - du, B, ldb, - pBuffer) - check_status(status) - -cpdef void zgtsv2( - intptr_t handle, int m, int n, size_t dl, size_t d, size_t du, - size_t B, int ldb, size_t pBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseZgtsv2( - handle, m, n, dl, - d, du, - B, ldb, pBuffer) - check_status(status) - -cpdef size_t sgtsv2_nopivot_bufferSizeExt( - intptr_t handle, int m, int n, size_t dl, - size_t d, size_t du, size_t B, int ldb) except? -1: - cdef size_t pBufferSizeInBytes - _setStream(handle) - with nogil: - status = cusparseSgtsv2_nopivot_bufferSizeExt( - handle, m, n, dl, d, - du, B, ldb, &pBufferSizeInBytes) - check_status(status) - return pBufferSizeInBytes - -cpdef size_t dgtsv2_nopivot_bufferSizeExt( - intptr_t handle, int m, int n, size_t dl, - size_t d, size_t du, size_t B, int ldb) except? -1: - cdef size_t pBufferSizeInBytes - _setStream(handle) - with nogil: - status = cusparseDgtsv2_nopivot_bufferSizeExt( - handle, m, n, dl, - d, du, B, ldb, - &pBufferSizeInBytes) - check_status(status) - return pBufferSizeInBytes - -cpdef size_t cgtsv2_nopivot_bufferSizeExt( - intptr_t handle, int m, int n, size_t dl, - size_t d, size_t du, size_t B, int ldb) except? -1: - cdef size_t pBufferSizeInBytes - _setStream(handle) - with nogil: - status = cusparseCgtsv2_nopivot_bufferSizeExt( - handle, m, n, dl, - d, du, B, - ldb, &pBufferSizeInBytes) - check_status(status) - return pBufferSizeInBytes - -cpdef size_t zgtsv2_nopivot_bufferSizeExt( - intptr_t handle, int m, int n, size_t dl, - size_t d, size_t du, size_t B, int ldb) except? -1: - cdef size_t pBufferSizeInBytes - _setStream(handle) - with nogil: - status = cusparseZgtsv2_nopivot_bufferSizeExt( - handle, m, n, dl, - d, du, - B, ldb, &pBufferSizeInBytes) - check_status(status) - return pBufferSizeInBytes - -cpdef void sgtsv2_nopivot( - intptr_t handle, int m, int n, size_t dl, size_t d, - size_t du, size_t B, int ldb, size_t pBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseSgtsv2_nopivot( - handle, m, n, dl, d, - du, B, ldb, pBuffer) - check_status(status) - -cpdef void dgtsv2_nopivot( - intptr_t handle, int m, int n, size_t dl, size_t d, - size_t du, size_t B, int ldb, size_t pBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseDgtsv2_nopivot(handle, m, n, - dl, d, - du, B, ldb, - pBuffer) - check_status(status) - -cpdef void cgtsv2_nopivot( - intptr_t handle, int m, int n, size_t dl, size_t d, - size_t du, size_t B, int ldb, size_t pBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseCgtsv2_nopivot( - handle, m, n, dl, - d, du, B, ldb, - pBuffer) - check_status(status) - -cpdef void zgtsv2_nopivot( - intptr_t handle, int m, int n, size_t dl, size_t d, - size_t du, size_t B, int ldb, size_t pBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseZgtsv2_nopivot( - handle, m, n, dl, - d, du, - B, ldb, pBuffer) - check_status(status) - -cpdef size_t sgtsv2StridedBatch_bufferSizeExt( - intptr_t handle, int m, size_t dl, size_t d, size_t du, size_t x, - int batchCount, int batchStride) except? -1: - cdef size_t bufferSizeInBytes - _setStream(handle) - with nogil: - status = cusparseSgtsv2StridedBatch_bufferSizeExt( - handle, m, dl, d, - du, x, batchCount, batchStride, - &bufferSizeInBytes) - check_status(status) - return bufferSizeInBytes - -cpdef size_t dgtsv2StridedBatch_bufferSizeExt( - intptr_t handle, int m, size_t dl, size_t d, size_t du, size_t x, - int batchCount, int batchStride): - cdef size_t bufferSizeInBytes - _setStream(handle) - with nogil: - status = cusparseDgtsv2StridedBatch_bufferSizeExt( - handle, m, dl, d, - du, x, batchCount, batchStride, - &bufferSizeInBytes) - check_status(status) - return bufferSizeInBytes - -cpdef size_t cgtsv2StridedBatch_bufferSizeExt( - intptr_t handle, int m, size_t dl, size_t d, size_t du, size_t x, - int batchCount, int batchStride) except? -1: - cdef size_t bufferSizeInBytes - _setStream(handle) - with nogil: - status = cusparseCgtsv2StridedBatch_bufferSizeExt( - handle, m, dl, - d, du, x, - batchCount, batchStride, &bufferSizeInBytes) - check_status(status) - return bufferSizeInBytes - -cpdef size_t zgtsv2StridedBatch_bufferSizeExt( - intptr_t handle, int m, size_t dl, size_t d, size_t du, size_t x, - int batchCount, int batchStride) except? -1: - cdef size_t bufferSizeInBytes - _setStream(handle) - with nogil: - status = cusparseZgtsv2StridedBatch_bufferSizeExt( - handle, m, dl, - d, du, - x, batchCount, batchStride, - &bufferSizeInBytes) - check_status(status) - return bufferSizeInBytes - -cpdef void sgtsv2StridedBatch( - intptr_t handle, int m, size_t dl, size_t d, - size_t du, size_t x, int batchCount, int batchStride, - size_t pBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseSgtsv2StridedBatch( - handle, m, dl, d, - du, x, batchCount, batchStride, - pBuffer) - check_status(status) - -cpdef void dgtsv2StridedBatch( - intptr_t handle, int m, size_t dl, size_t d, - size_t du, size_t x, int batchCount, int batchStride, - size_t pBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseDgtsv2StridedBatch( - handle, m, dl, d, - du, x, batchCount, batchStride, - pBuffer) - check_status(status) - -cpdef void cgtsv2StridedBatch( - intptr_t handle, int m, size_t dl, size_t d, - size_t du, size_t x, int batchCount, int batchStride, - size_t pBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseCgtsv2StridedBatch( - handle, m, dl, - d, du, x, - batchCount, batchStride, pBuffer) - check_status(status) - -cpdef void zgtsv2StridedBatch( - intptr_t handle, int m, size_t dl, size_t d, - size_t du, size_t x, int batchCount, int batchStride, - size_t pBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseZgtsv2StridedBatch( - handle, m, dl, - d, du, - x, batchCount, batchStride, pBuffer) - check_status(status) - -cpdef size_t sgtsvInterleavedBatch_bufferSizeExt( - intptr_t handle, int algo, int m, size_t dl, size_t d, size_t du, - size_t x, int batchCount) except? -1: - cdef size_t pBufferSizeInBytes - _setStream(handle) - with nogil: - status = cusparseSgtsvInterleavedBatch_bufferSizeExt( - handle, algo, m, dl, - d, du, x, batchCount, - &pBufferSizeInBytes) - check_status(status) - return pBufferSizeInBytes - -cpdef size_t dgtsvInterleavedBatch_bufferSizeExt( - intptr_t handle, int algo, int m, size_t dl, size_t d, size_t du, - size_t x, int batchCount) except? -1: - cdef size_t pBufferSizeInBytes - _setStream(handle) - with nogil: - status = cusparseDgtsvInterleavedBatch_bufferSizeExt( - handle, algo, m, dl, - d, du, x, batchCount, - &pBufferSizeInBytes) - check_status(status) - return pBufferSizeInBytes - -cpdef size_t cgtsvInterleavedBatch_bufferSizeExt( - intptr_t handle, int algo, int m, size_t dl, size_t d, size_t du, - size_t x, int batchCount) except? -1: - cdef size_t pBufferSizeInBytes - _setStream(handle) - with nogil: - status = cusparseCgtsvInterleavedBatch_bufferSizeExt( - handle, algo, m, dl, - d, du, x, - batchCount, &pBufferSizeInBytes) - check_status(status) - return pBufferSizeInBytes - -cpdef size_t zgtsvInterleavedBatch_bufferSizeExt( - intptr_t handle, int algo, int m, size_t dl, size_t d, size_t du, - size_t x, int batchCount) except? -1: - cdef size_t pBufferSizeInBytes - _setStream(handle) - with nogil: - status = cusparseZgtsvInterleavedBatch_bufferSizeExt( - handle, algo, m, dl, - d, du, - x, batchCount, &pBufferSizeInBytes) - check_status(status) - return pBufferSizeInBytes - -cpdef void sgtsvInterleavedBatch( - intptr_t handle, int algo, int m, size_t dl, - size_t d, size_t du, size_t x, int batchCount, - size_t pBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseSgtsvInterleavedBatch( - handle, algo, m, dl, d, - du, x, batchCount, pBuffer) - check_status(status) - -cpdef void dgtsvInterleavedBatch( - intptr_t handle, int algo, int m, size_t dl, - size_t d, size_t du, size_t x, int batchCount, - size_t pBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseDgtsvInterleavedBatch( - handle, algo, m, dl, d, - du, x, batchCount, pBuffer) - check_status(status) - -cpdef void cgtsvInterleavedBatch( - intptr_t handle, int algo, int m, size_t dl, - size_t d, size_t du, size_t x, int batchCount, - size_t pBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseCgtsvInterleavedBatch( - handle, algo, m, dl, d, - du, x, batchCount, pBuffer) - check_status(status) - -cpdef void zgtsvInterleavedBatch( - intptr_t handle, int algo, int m, size_t dl, - size_t d, size_t du, size_t x, int batchCount, - size_t pBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseZgtsvInterleavedBatch( - handle, algo, m, dl, - d, du, x, - batchCount, pBuffer) - check_status(status) - -cpdef size_t sgpsvInterleavedBatch_bufferSizeExt( - intptr_t handle, int algo, int m, size_t ds, size_t dl, size_t d, - size_t du, size_t dw, size_t x, int batchCount) except? -1: - cdef size_t pBufferSizeInBytes - _setStream(handle) - with nogil: - status = cusparseSgpsvInterleavedBatch_bufferSizeExt( - handle, algo, m, ds, - dl, d, du, - dw, x, batchCount, &pBufferSizeInBytes) - check_status(status) - return pBufferSizeInBytes - -cpdef size_t dgpsvInterleavedBatch_bufferSizeExt( - intptr_t handle, int algo, int m, size_t ds, size_t dl, size_t d, - size_t du, size_t dw, size_t x, int batchCount) except? -1: - cdef size_t pBufferSizeInBytes - _setStream(handle) - with nogil: - status = cusparseDgpsvInterleavedBatch_bufferSizeExt( - handle, algo, m, ds, - dl, d, du, - dw, x, batchCount, - &pBufferSizeInBytes) - check_status(status) - return pBufferSizeInBytes - -cpdef size_t cgpsvInterleavedBatch_bufferSizeExt( - intptr_t handle, int algo, int m, size_t ds, size_t dl, size_t d, - size_t du, size_t dw, size_t x, int batchCount) except? -1: - cdef size_t pBufferSizeInBytes - _setStream(handle) - with nogil: - status = cusparseCgpsvInterleavedBatch_bufferSizeExt( - handle, algo, m, ds, - dl, d, du, - dw, x, batchCount, - &pBufferSizeInBytes) - check_status(status) - return pBufferSizeInBytes - -cpdef size_t zgpsvInterleavedBatch_bufferSizeExt( - intptr_t handle, int algo, int m, size_t ds, size_t dl, size_t d, - size_t du, size_t dw, size_t x, int batchCount) except? -1: - cdef size_t pBufferSizeInBytes - _setStream(handle) - with nogil: - status = cusparseZgpsvInterleavedBatch_bufferSizeExt( - handle, algo, m, ds, - dl, d, - du, dw, - x, batchCount, &pBufferSizeInBytes) - check_status(status) - return pBufferSizeInBytes - -cpdef void sgpsvInterleavedBatch( - intptr_t handle, int algo, int m, size_t ds, - size_t dl, size_t d, size_t du, size_t dw, - size_t x, int batchCount, size_t pBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseSgpsvInterleavedBatch( - handle, algo, m, ds, dl, - d, du, dw, x, batchCount, - pBuffer) - check_status(status) - -cpdef void dgpsvInterleavedBatch( - intptr_t handle, int algo, int m, size_t ds, - size_t dl, size_t d, size_t du, size_t dw, - size_t x, int batchCount, size_t pBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseDgpsvInterleavedBatch( - handle, algo, m, ds, dl, - d, du, dw, x, batchCount, + check_status(status) + + cpdef void xcsrsv2_zeroPivot( + intptr_t handle, size_t info, size_t position) except *: + _setStream(handle) + status = cusparseXcsrsv2_zeroPivot( + handle, info, position) + check_status(status) + + ######################################## + # cuSPARSE Level3 Function + + cpdef void scsrmm( + intptr_t handle, int transA, int m, int n, int k, int nnz, + size_t alpha, size_t descrA, size_t csrSortedValA, + size_t csrSortedRowPtrA, size_t csrSortedColIndA, + size_t B, int ldb, size_t beta, size_t C, int ldc) except *: + _setStream(handle) + status = cusparseScsrmm( + handle, transA, m, n, k, nnz, + alpha, descrA, csrSortedValA, + csrSortedRowPtrA, csrSortedColIndA, + B, ldb, beta, C, ldc) + check_status(status) + + cpdef void dcsrmm( + intptr_t handle, int transA, int m, int n, int k, int nnz, + size_t alpha, size_t descrA, size_t csrSortedValA, + size_t csrSortedRowPtrA, size_t csrSortedColIndA, + size_t B, int ldb, size_t beta, size_t C, int ldc) except *: + _setStream(handle) + status = cusparseDcsrmm( + handle, transA, m, n, k, nnz, + alpha, descrA, csrSortedValA, + csrSortedRowPtrA, csrSortedColIndA, + B, ldb, beta, C, ldc) + check_status(status) + + cpdef void ccsrmm( + intptr_t handle, int transA, int m, int n, int k, int nnz, + size_t alpha, size_t descrA, size_t csrSortedValA, + size_t csrSortedRowPtrA, size_t csrSortedColIndA, + size_t B, int ldb, size_t beta, size_t C, int ldc) except *: + _setStream(handle) + status = cusparseCcsrmm( + handle, transA, m, n, k, nnz, + alpha, descrA, + csrSortedValA, + csrSortedRowPtrA, csrSortedColIndA, + B, ldb, beta, + C, ldc) + check_status(status) + + cpdef void zcsrmm( + intptr_t handle, int transA, int m, int n, int k, int nnz, + size_t alpha, size_t descrA, size_t csrSortedValA, + size_t csrSortedRowPtrA, size_t csrSortedColIndA, + size_t B, int ldb, size_t beta, size_t C, int ldc) except *: + _setStream(handle) + status = cusparseZcsrmm( + handle, transA, m, n, k, nnz, + alpha, descrA, + csrSortedValA, + csrSortedRowPtrA, csrSortedColIndA, + B, ldb, + beta, C, ldc) + check_status(status) + + cpdef void scsrmm2( + intptr_t handle, int transA, int transB, int m, int n, int k, int nnz, + size_t alpha, size_t descrA, size_t csrValA, + size_t csrRowPtrA, size_t csrColIndA, + size_t B, int ldb, size_t beta, size_t C, int ldc) except *: + _setStream(handle) + status = cusparseScsrmm2( + handle, transA, transB, m, n, k, nnz, + alpha, descrA, csrValA, + csrRowPtrA, csrColIndA, + B, ldb, beta, C, ldc) + check_status(status) + + cpdef void dcsrmm2( + intptr_t handle, int transA, int transB, int m, int n, int k, int nnz, + size_t alpha, size_t descrA, size_t csrValA, + size_t csrRowPtrA, size_t csrColIndA, + size_t B, int ldb, size_t beta, size_t C, int ldc) except *: + _setStream(handle) + status = cusparseDcsrmm2( + handle, transA, transB, m, n, k, nnz, + alpha, descrA, csrValA, + csrRowPtrA, csrColIndA, + B, ldb, beta, C, ldc) + check_status(status) + + cpdef void ccsrmm2( + intptr_t handle, int transA, int transB, int m, int n, int k, int nnz, + size_t alpha, size_t descrA, size_t csrValA, + size_t csrRowPtrA, size_t csrColIndA, + size_t B, int ldb, size_t beta, size_t C, int ldc) except *: + _setStream(handle) + status = cusparseCcsrmm2( + handle, transA, transB, m, n, k, nnz, + alpha, descrA, csrValA, + csrRowPtrA, csrColIndA, + B, ldb, beta, + C, ldc) + check_status(status) + + cpdef void zcsrmm2( + intptr_t handle, int transA, int transB, int m, int n, int k, int nnz, + size_t alpha, size_t descrA, size_t csrValA, + size_t csrRowPtrA, size_t csrColIndA, + size_t B, int ldb, size_t beta, size_t C, int ldc) except *: + _setStream(handle) + status = cusparseZcsrmm2( + handle, transA, transB, m, n, k, nnz, + alpha, descrA, + csrValA, + csrRowPtrA, csrColIndA, + B, ldb, + beta, C, ldc) + check_status(status) + + cpdef size_t createCsrsm2Info() except? -1: + cdef csrsm2Info_t info + status = cusparseCreateCsrsm2Info(&info) + check_status(status) + return info + + cpdef void destroyCsrsm2Info(size_t info) except *: + status = cusparseDestroyCsrsm2Info(info) + check_status(status) + + cpdef size_t scsrsm2_bufferSizeExt( + intptr_t handle, int algo, int transA, int transB, int m, int nrhs, + int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, + size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t B, int ldb, + size_t info, int policy) except? -1: + cdef size_t bufferSize + _setStream(handle) + status = cusparseScsrsm2_bufferSizeExt( + handle, algo, transA, transB, m, nrhs, + nnz, alpha, descrA, + csrSortedValA, csrSortedRowPtrA, + csrSortedColIndA, B, ldb, + info, policy, &bufferSize) + check_status(status) + return bufferSize + + cpdef size_t dcsrsm2_bufferSizeExt( + intptr_t handle, int algo, int transA, int transB, int m, int nrhs, + int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, + size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t B, int ldb, + size_t info, int policy) except? -1: + cdef size_t bufferSize + _setStream(handle) + status = cusparseDcsrsm2_bufferSizeExt( + handle, algo, transA, transB, m, nrhs, + nnz, alpha, descrA, + csrSortedValA, csrSortedRowPtrA, + csrSortedColIndA, B, ldb, + info, policy, &bufferSize) + check_status(status) + return bufferSize + + cpdef size_t ccsrsm2_bufferSizeExt( + intptr_t handle, int algo, int transA, int transB, int m, int nrhs, + int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, + size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t B, int ldb, + size_t info, int policy) except? -1: + cdef size_t bufferSize + _setStream(handle) + status = cusparseCcsrsm2_bufferSizeExt( + handle, algo, transA, transB, m, nrhs, + nnz, alpha, descrA, + csrSortedValA, csrSortedRowPtrA, + csrSortedColIndA, B, ldb, + info, policy, &bufferSize) + check_status(status) + return bufferSize + + cpdef size_t zcsrsm2_bufferSizeExt( + intptr_t handle, int algo, int transA, int transB, int m, int nrhs, + int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, + size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t B, int ldb, + size_t info, int policy) except? -1: + cdef size_t bufferSize + _setStream(handle) + status = cusparseZcsrsm2_bufferSizeExt( + handle, algo, transA, transB, m, nrhs, + nnz, alpha, descrA, + csrSortedValA, csrSortedRowPtrA, + csrSortedColIndA, B, ldb, + info, policy, &bufferSize) + check_status(status) + return bufferSize + + cpdef void scsrsm2_analysis( + intptr_t handle, int algo, int transA, int transB, int m, int nrhs, + int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, + size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t B, int ldb, + size_t info, int policy, size_t pBuffer) except *: + _setStream(handle) + status = cusparseScsrsm2_analysis( + handle, algo, transA, transB, m, nrhs, + nnz, alpha, descrA, + csrSortedValA, csrSortedRowPtrA, + csrSortedColIndA, B, ldb, + info, policy, pBuffer) + check_status(status) + + cpdef void dcsrsm2_analysis( + intptr_t handle, int algo, int transA, int transB, int m, int nrhs, + int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, + size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t B, int ldb, + size_t info, int policy, size_t pBuffer) except *: + _setStream(handle) + status = cusparseDcsrsm2_analysis( + handle, algo, transA, transB, m, nrhs, + nnz, alpha, descrA, + csrSortedValA, csrSortedRowPtrA, + csrSortedColIndA, B, ldb, + info, policy, pBuffer) + check_status(status) + + cpdef void ccsrsm2_analysis( + intptr_t handle, int algo, int transA, int transB, int m, int nrhs, + int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, + size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t B, int ldb, + size_t info, int policy, size_t pBuffer) except *: + _setStream(handle) + status = cusparseCcsrsm2_analysis( + handle, algo, transA, transB, m, nrhs, + nnz, alpha, descrA, + csrSortedValA, csrSortedRowPtrA, + csrSortedColIndA, B, ldb, + info, policy, pBuffer) + check_status(status) + + cpdef void zcsrsm2_analysis( + intptr_t handle, int algo, int transA, int transB, int m, int nrhs, + int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, + size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t B, int ldb, + size_t info, int policy, size_t pBuffer) except *: + _setStream(handle) + status = cusparseZcsrsm2_analysis( + handle, algo, transA, transB, m, nrhs, + nnz, alpha, descrA, + csrSortedValA, csrSortedRowPtrA, + csrSortedColIndA, B, ldb, + info, policy, pBuffer) + check_status(status) + + cpdef void scsrsm2_solve( + intptr_t handle, int algo, int transA, int transB, int m, int nrhs, + int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, + size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t B, int ldb, + size_t info, int policy, size_t pBuffer) except *: + _setStream(handle) + status = cusparseScsrsm2_solve( + handle, algo, transA, transB, m, nrhs, + nnz, alpha, descrA, + csrSortedValA, csrSortedRowPtrA, + csrSortedColIndA, B, ldb, + info, policy, pBuffer) + check_status(status) + + cpdef void dcsrsm2_solve( + intptr_t handle, int algo, int transA, int transB, int m, int nrhs, + int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, + size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t B, int ldb, + size_t info, int policy, size_t pBuffer) except *: + _setStream(handle) + status = cusparseDcsrsm2_solve( + handle, algo, transA, transB, m, nrhs, + nnz, alpha, descrA, + csrSortedValA, csrSortedRowPtrA, + csrSortedColIndA, B, ldb, + info, policy, pBuffer) + check_status(status) + + cpdef void ccsrsm2_solve( + intptr_t handle, int algo, int transA, int transB, int m, int nrhs, + int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, + size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t B, int ldb, + size_t info, int policy, size_t pBuffer) except *: + _setStream(handle) + status = cusparseCcsrsm2_solve( + handle, algo, transA, transB, m, nrhs, + nnz, alpha, descrA, + csrSortedValA, csrSortedRowPtrA, + csrSortedColIndA, B, ldb, + info, policy, pBuffer) + check_status(status) + + cpdef void zcsrsm2_solve( + intptr_t handle, int algo, int transA, int transB, int m, int nrhs, + int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, + size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t B, int ldb, + size_t info, int policy, size_t pBuffer) except *: + _setStream(handle) + status = cusparseZcsrsm2_solve( + handle, algo, transA, transB, m, nrhs, + nnz, alpha, descrA, + csrSortedValA, csrSortedRowPtrA, + csrSortedColIndA, B, ldb, + info, policy, pBuffer) + check_status(status) + + cpdef void xcsrsm2_zeroPivot( + intptr_t handle, size_t info, size_t position) except *: + _setStream(handle) + status = cusparseXcsrsm2_zeroPivot( + handle, info, position) + check_status(status) + + ######################################## + # cuSPARSE Extra Function + + cpdef void xcsrgeamNnz( + intptr_t handle, int m, int n, size_t descrA, int nnzA, + size_t csrRowPtrA, size_t csrColIndA, size_t descrB, + int nnzB, size_t csrRowPtrB, size_t csrColIndB, + size_t descrC, size_t csrRowPtrC, size_t nnzTotalDevHostPtr) except *: + _setStream(handle) + status = cusparseXcsrgeamNnz( + handle, m, n, descrA, nnzA, + csrRowPtrA, csrColIndA, + descrB, nnzB, csrRowPtrB, + csrColIndB, descrC, csrRowPtrC, + nnzTotalDevHostPtr) + check_status(status) + + cpdef void scsrgeam( + intptr_t handle, int m, int n, size_t alpha, size_t descrA, + int nnzA, size_t csrValA, size_t csrRowPtrA, + size_t csrColIndA, size_t beta, size_t descrB, + int nnzB, size_t csrValB, size_t csrRowPtrB, + size_t csrColIndB, size_t descrC, size_t csrValC, + size_t csrRowPtrC, size_t csrColIndC) except *: + _setStream(handle) + status = cusparseScsrgeam( + handle, m, n, alpha, + descrA, nnzA, csrValA, + csrRowPtrA, csrColIndA, beta, + descrB, nnzB, csrValB, + csrRowPtrB, csrColIndB, + descrC, csrValC, csrRowPtrC, + csrColIndC) + check_status(status) + + cpdef void dcsrgeam( + intptr_t handle, int m, int n, size_t alpha, size_t descrA, + int nnzA, size_t csrValA, size_t csrRowPtrA, + size_t csrColIndA, size_t beta, size_t descrB, + int nnzB, size_t csrValB, size_t csrRowPtrB, + size_t csrColIndB, size_t descrC, size_t csrValC, + size_t csrRowPtrC, size_t csrColIndC) except *: + _setStream(handle) + status = cusparseDcsrgeam( + handle, m, n, alpha, + descrA, nnzA, csrValA, + csrRowPtrA, csrColIndA, beta, + descrB, nnzB, csrValB, + csrRowPtrB, csrColIndB, + descrC, csrValC, csrRowPtrC, + csrColIndC) + check_status(status) + + cpdef void ccsrgeam( + intptr_t handle, int m, int n, size_t alpha, size_t descrA, + int nnzA, size_t csrValA, size_t csrRowPtrA, + size_t csrColIndA, size_t beta, size_t descrB, + int nnzB, size_t csrValB, size_t csrRowPtrB, + size_t csrColIndB, size_t descrC, size_t csrValC, + size_t csrRowPtrC, size_t csrColIndC) except *: + _setStream(handle) + status = cusparseCcsrgeam( + handle, m, n, alpha, + descrA, nnzA, csrValA, + csrRowPtrA, csrColIndA, + beta, + descrB, nnzB, csrValB, + csrRowPtrB, csrColIndB, + descrC, csrValC, csrRowPtrC, + csrColIndC) + check_status(status) + + cpdef void zcsrgeam( + intptr_t handle, int m, int n, size_t alpha, size_t descrA, + int nnzA, size_t csrValA, size_t csrRowPtrA, + size_t csrColIndA, size_t beta, size_t descrB, + int nnzB, size_t csrValB, size_t csrRowPtrB, + size_t csrColIndB, size_t descrC, size_t csrValC, + size_t csrRowPtrC, size_t csrColIndC) except *: + _setStream(handle) + status = cusparseZcsrgeam( + handle, m, n, alpha, + descrA, nnzA, csrValA, + csrRowPtrA, csrColIndA, + beta, + descrB, nnzB, csrValB, + csrRowPtrB, csrColIndB, + descrC, csrValC, csrRowPtrC, + csrColIndC) + check_status(status) + + cpdef size_t scsrgeam2_bufferSizeExt( + intptr_t handle, int m, int n, size_t alpha, size_t descrA, + int nnzA, size_t csrValA, size_t csrRowPtrA, + size_t csrColIndA, size_t beta, size_t descrB, + int nnzB, size_t csrValB, size_t csrRowPtrB, + size_t csrColIndB, size_t descrC, size_t csrValC, + size_t csrRowPtrC, size_t csrColIndC) except? -1: + cdef size_t bufferSize + _setStream(handle) + status = cusparseScsrgeam2_bufferSizeExt( + handle, m, n, alpha, + descrA, nnzA, csrValA, + csrRowPtrA, csrColIndA, beta, + descrB, nnzB, csrValB, + csrRowPtrB, csrColIndB, + descrC, csrValC, csrRowPtrC, + csrColIndC, &bufferSize) + check_status(status) + return bufferSize + + cpdef size_t dcsrgeam2_bufferSizeExt( + intptr_t handle, int m, int n, size_t alpha, size_t descrA, + int nnzA, size_t csrValA, size_t csrRowPtrA, + size_t csrColIndA, size_t beta, size_t descrB, + int nnzB, size_t csrValB, size_t csrRowPtrB, + size_t csrColIndB, size_t descrC, size_t csrValC, + size_t csrRowPtrC, size_t csrColIndC) except? -1: + cdef size_t bufferSize + _setStream(handle) + status = cusparseDcsrgeam2_bufferSizeExt( + handle, m, n, alpha, + descrA, nnzA, csrValA, + csrRowPtrA, csrColIndA, beta, + descrB, nnzB, csrValB, + csrRowPtrB, csrColIndB, + descrC, csrValC, csrRowPtrC, + csrColIndC, &bufferSize) + check_status(status) + return bufferSize + + cpdef size_t ccsrgeam2_bufferSizeExt( + intptr_t handle, int m, int n, size_t alpha, size_t descrA, + int nnzA, size_t csrValA, size_t csrRowPtrA, + size_t csrColIndA, size_t beta, size_t descrB, + int nnzB, size_t csrValB, size_t csrRowPtrB, + size_t csrColIndB, size_t descrC, size_t csrValC, + size_t csrRowPtrC, size_t csrColIndC) except? -1: + cdef size_t bufferSize + _setStream(handle) + status = cusparseCcsrgeam2_bufferSizeExt( + handle, m, n, alpha, + descrA, nnzA, csrValA, + csrRowPtrA, csrColIndA, + beta, + descrB, nnzB, csrValB, + csrRowPtrB, csrColIndB, + descrC, csrValC, csrRowPtrC, + csrColIndC, &bufferSize) + check_status(status) + return bufferSize + + cpdef size_t zcsrgeam2_bufferSizeExt( + intptr_t handle, int m, int n, size_t alpha, size_t descrA, + int nnzA, size_t csrValA, size_t csrRowPtrA, + size_t csrColIndA, size_t beta, size_t descrB, + int nnzB, size_t csrValB, size_t csrRowPtrB, + size_t csrColIndB, size_t descrC, size_t csrValC, + size_t csrRowPtrC, size_t csrColIndC) except? -1: + cdef size_t bufferSize + _setStream(handle) + status = cusparseZcsrgeam2_bufferSizeExt( + handle, m, n, alpha, + descrA, nnzA, csrValA, + csrRowPtrA, csrColIndA, + beta, + descrB, nnzB, csrValB, + csrRowPtrB, csrColIndB, + descrC, csrValC, csrRowPtrC, + csrColIndC, &bufferSize) + check_status(status) + return bufferSize + + cpdef void xcsrgeam2Nnz( + intptr_t handle, int m, int n, size_t descrA, int nnzA, + size_t csrRowPtrA, size_t csrColIndA, size_t descrB, + int nnzB, size_t csrRowPtrB, size_t csrColIndB, + size_t descrC, size_t csrRowPtrC, size_t nnzTotalDevHostPtr, + size_t workspace) except *: + _setStream(handle) + status = cusparseXcsrgeam2Nnz( + handle, m, n, descrA, nnzA, + csrRowPtrA, csrColIndA, + descrB, nnzB, csrRowPtrB, + csrColIndB, descrC, csrRowPtrC, + nnzTotalDevHostPtr, workspace) + check_status(status) + + cpdef void scsrgeam2( + intptr_t handle, int m, int n, size_t alpha, size_t descrA, + int nnzA, size_t csrValA, size_t csrRowPtrA, + size_t csrColIndA, size_t beta, size_t descrB, + int nnzB, size_t csrValB, size_t csrRowPtrB, + size_t csrColIndB, size_t descrC, size_t csrValC, + size_t csrRowPtrC, size_t csrColIndC, size_t buffer) except *: + _setStream(handle) + status = cusparseScsrgeam2( + handle, m, n, alpha, + descrA, nnzA, csrValA, + csrRowPtrA, csrColIndA, beta, + descrB, nnzB, csrValB, + csrRowPtrB, csrColIndB, + descrC, csrValC, csrRowPtrC, + csrColIndC, buffer) + check_status(status) + + cpdef void dcsrgeam2( + intptr_t handle, int m, int n, size_t alpha, size_t descrA, + int nnzA, size_t csrValA, size_t csrRowPtrA, + size_t csrColIndA, size_t beta, size_t descrB, + int nnzB, size_t csrValB, size_t csrRowPtrB, + size_t csrColIndB, size_t descrC, size_t csrValC, + size_t csrRowPtrC, size_t csrColIndC, size_t buffer) except *: + _setStream(handle) + status = cusparseDcsrgeam2( + handle, m, n, alpha, + descrA, nnzA, csrValA, + csrRowPtrA, csrColIndA, beta, + descrB, nnzB, csrValB, + csrRowPtrB, csrColIndB, + descrC, csrValC, csrRowPtrC, + csrColIndC, buffer) + check_status(status) + + cpdef void ccsrgeam2( + intptr_t handle, int m, int n, size_t alpha, size_t descrA, + int nnzA, size_t csrValA, size_t csrRowPtrA, + size_t csrColIndA, size_t beta, size_t descrB, + int nnzB, size_t csrValB, size_t csrRowPtrB, + size_t csrColIndB, size_t descrC, size_t csrValC, + size_t csrRowPtrC, size_t csrColIndC, size_t buffer) except *: + _setStream(handle) + status = cusparseCcsrgeam2( + handle, m, n, alpha, + descrA, nnzA, csrValA, + csrRowPtrA, csrColIndA, + beta, + descrB, nnzB, csrValB, + csrRowPtrB, csrColIndB, + descrC, csrValC, csrRowPtrC, + csrColIndC, buffer) + check_status(status) + + cpdef void zcsrgeam2( + intptr_t handle, int m, int n, size_t alpha, size_t descrA, + int nnzA, size_t csrValA, size_t csrRowPtrA, + size_t csrColIndA, size_t beta, size_t descrB, + int nnzB, size_t csrValB, size_t csrRowPtrB, + size_t csrColIndB, size_t descrC, size_t csrValC, + size_t csrRowPtrC, size_t csrColIndC, size_t buffer) except *: + _setStream(handle) + status = cusparseZcsrgeam2( + handle, m, n, alpha, + descrA, nnzA, csrValA, + csrRowPtrA, csrColIndA, + beta, + descrB, nnzB, csrValB, + csrRowPtrB, csrColIndB, + descrC, csrValC, csrRowPtrC, + csrColIndC, buffer) + check_status(status) + + cpdef void xcsrgemmNnz( + intptr_t handle, int transA, int transB, int m, int n, int k, + size_t descrA, int nnzA, size_t csrRowPtrA, + size_t csrColIndA, size_t descrB, int nnzB, + size_t csrRowPtrB, size_t csrColIndB, + size_t descrC, size_t csrRowPtrC, size_t nnzTotalDevHostPtr) except *: + _setStream(handle) + status = cusparseXcsrgemmNnz( + handle, transA, transB, m, n, k, + descrA, nnzA, csrRowPtrA, + csrColIndA, descrB, nnzB, + csrRowPtrB, csrColIndB, + descrC, csrRowPtrC, nnzTotalDevHostPtr) + check_status(status) + + cpdef void scsrgemm( + intptr_t handle, int transA, int transB, int m, int n, int k, + size_t descrA, const int nnzA, size_t csrValA, + size_t csrRowPtrA, size_t csrColIndA, size_t descrB, + const int nnzB, size_t csrValB, size_t csrRowPtrB, + size_t csrColIndB, size_t descrC, size_t csrValC, + size_t csrRowPtrC, size_t csrColIndC) except *: + _setStream(handle) + status = cusparseScsrgemm( + handle, transA, transB, m, n, k, + descrA, nnzA, csrValA, + csrRowPtrA, csrColIndA, + descrB, nnzB, csrValB, + csrRowPtrB, csrColIndB, + descrC, csrValC, + csrRowPtrC, csrColIndC) + check_status(status) + + cpdef void dcsrgemm( + intptr_t handle, int transA, int transB, int m, int n, int k, + size_t descrA, const int nnzA, size_t csrValA, + size_t csrRowPtrA, size_t csrColIndA, size_t descrB, + const int nnzB, size_t csrValB, size_t csrRowPtrB, + size_t csrColIndB, size_t descrC, size_t csrValC, + size_t csrRowPtrC, size_t csrColIndC) except *: + _setStream(handle) + status = cusparseDcsrgemm( + handle, transA, transB, m, n, k, + descrA, nnzA, csrValA, + csrRowPtrA, csrColIndA, + descrB, nnzB, csrValB, + csrRowPtrB, csrColIndB, + descrC, csrValC, + csrRowPtrC, csrColIndC) + check_status(status) + + cpdef void ccsrgemm( + intptr_t handle, int transA, int transB, int m, int n, int k, + size_t descrA, const int nnzA, size_t csrValA, + size_t csrRowPtrA, size_t csrColIndA, size_t descrB, + const int nnzB, size_t csrValB, size_t csrRowPtrB, + size_t csrColIndB, size_t descrC, size_t csrValC, + size_t csrRowPtrC, size_t csrColIndC) except *: + _setStream(handle) + status = cusparseCcsrgemm( + handle, transA, transB, m, n, k, + descrA, nnzA, csrValA, + csrRowPtrA, csrColIndA, + descrB, nnzB, csrValB, + csrRowPtrB, csrColIndB, + descrC, csrValC, + csrRowPtrC, csrColIndC) + check_status(status) + + cpdef void zcsrgemm( + intptr_t handle, int transA, int transB, int m, int n, int k, + size_t descrA, const int nnzA, size_t csrValA, + size_t csrRowPtrA, size_t csrColIndA, size_t descrB, + const int nnzB, size_t csrValB, size_t csrRowPtrB, + size_t csrColIndB, size_t descrC, size_t csrValC, + size_t csrRowPtrC, size_t csrColIndC) except *: + _setStream(handle) + status = cusparseZcsrgemm( + handle, transA, transB, m, n, k, + descrA, nnzA, csrValA, + csrRowPtrA, csrColIndA, + descrB, nnzB, csrValB, + csrRowPtrB, csrColIndB, + descrC, csrValC, + csrRowPtrC, csrColIndC) + check_status(status) + + cpdef size_t createCsrgemm2Info() except? -1: + cdef csrgemm2Info_t info + with nogil: + status = cusparseCreateCsrgemm2Info(&info) + check_status(status) + return info + + cpdef void destroyCsrgemm2Info(size_t info) except *: + with nogil: + status = cusparseDestroyCsrgemm2Info(info) + check_status(status) + + cpdef size_t scsrgemm2_bufferSizeExt( + intptr_t handle, int m, int n, int k, + size_t alpha, + size_t descrA, int nnzA, size_t csrRowPtrA, size_t csrColIndA, + size_t descrB, int nnzB, size_t csrRowPtrB, size_t csrColIndB, + size_t beta, + size_t descrD, int nnzD, size_t csrRowPtrD, size_t csrColIndD, + size_t info) except? -1: + cdef size_t bufferSize + status = cusparseScsrgemm2_bufferSizeExt( + handle, m, n, k, + alpha, + descrA, nnzA, csrRowPtrA, csrColIndA, + descrB, nnzB, csrRowPtrB, csrColIndB, + beta, + descrD, nnzD, csrRowPtrD, csrColIndD, + info, &bufferSize) + check_status(status) + return bufferSize + + cpdef size_t dcsrgemm2_bufferSizeExt( + intptr_t handle, int m, int n, int k, + size_t alpha, + size_t descrA, int nnzA, size_t csrRowPtrA, size_t csrColIndA, + size_t descrB, int nnzB, size_t csrRowPtrB, size_t csrColIndB, + size_t beta, + size_t descrD, int nnzD, size_t csrRowPtrD, size_t csrColIndD, + size_t info) except? -1: + cdef size_t bufferSize + status = cusparseDcsrgemm2_bufferSizeExt( + handle, m, n, k, + alpha, + descrA, nnzA, csrRowPtrA, csrColIndA, + descrB, nnzB, csrRowPtrB, csrColIndB, + beta, + descrD, nnzD, csrRowPtrD, csrColIndD, + info, &bufferSize) + check_status(status) + return bufferSize + + cpdef size_t ccsrgemm2_bufferSizeExt( + intptr_t handle, int m, int n, int k, + size_t alpha, + size_t descrA, int nnzA, size_t csrRowPtrA, size_t csrColIndA, + size_t descrB, int nnzB, size_t csrRowPtrB, size_t csrColIndB, + size_t beta, + size_t descrD, int nnzD, size_t csrRowPtrD, size_t csrColIndD, + size_t info) except? -1: + cdef size_t bufferSize + status = cusparseCcsrgemm2_bufferSizeExt( + handle, m, n, k, + alpha, + descrA, nnzA, csrRowPtrA, csrColIndA, + descrB, nnzB, csrRowPtrB, csrColIndB, + beta, + descrD, nnzD, csrRowPtrD, csrColIndD, + info, &bufferSize) + check_status(status) + return bufferSize + + cpdef size_t zcsrgemm2_bufferSizeExt( + intptr_t handle, int m, int n, int k, + size_t alpha, + size_t descrA, int nnzA, size_t csrRowPtrA, size_t csrColIndA, + size_t descrB, int nnzB, size_t csrRowPtrB, size_t csrColIndB, + size_t beta, + size_t descrD, int nnzD, size_t csrRowPtrD, size_t csrColIndD, + size_t info) except? -1: + cdef size_t bufferSize + status = cusparseZcsrgemm2_bufferSizeExt( + handle, m, n, k, + alpha, + descrA, nnzA, csrRowPtrA, csrColIndA, + descrB, nnzB, csrRowPtrB, csrColIndB, + beta, + descrD, nnzD, csrRowPtrD, csrColIndD, + info, &bufferSize) + check_status(status) + return bufferSize + + cpdef void xcsrgemm2Nnz( + intptr_t handle, int m, int n, int k, + size_t descrA, int nnzA, size_t csrRowPtrA, size_t csrColIndA, + size_t descrB, int nnzB, size_t csrRowPtrB, size_t csrColIndB, + size_t descrD, int nnzD, size_t csrRowPtrD, size_t csrColIndD, + size_t descrC, size_t csrRowPtrC, + intptr_t nnzTotalDevHostPtr, size_t info, intptr_t pBuffer) except *: + _setStream(handle) + status = cusparseXcsrgemm2Nnz( + handle, m, n, k, + descrA, nnzA, csrRowPtrA, csrColIndA, + descrB, nnzB, csrRowPtrB, csrColIndB, + descrD, nnzD, csrRowPtrD, csrColIndD, + descrC, csrRowPtrC, + nnzTotalDevHostPtr, info, pBuffer) + check_status(status) + + cpdef void scsrgemm2( + intptr_t handle, int m, int n, int k, size_t alpha, size_t descrA, + int nnzA, size_t csrValA, size_t csrRowPtrA, size_t csrColIndA, + size_t descrB, int nnzB, size_t csrValB, size_t csrRowPtrB, + size_t csrColIndB, size_t beta, size_t descrD, int nnzD, + size_t csrValD, size_t csrRowPtrD, size_t csrColIndD, size_t descrC, + size_t csrValC, size_t csrRowPtrC, size_t csrColIndC, size_t info, + intptr_t pBuffer) except *: + _setStream(handle) + status = cusparseScsrgemm2( + handle, m, n, k, alpha, descrA, nnzA, + csrValA, csrRowPtrA, csrColIndA, descrB, + nnzB, csrValB, csrRowPtrB, csrColIndB, + beta, descrD, nnzD, csrValD, + csrRowPtrD, csrColIndD, descrC, csrValC, + csrRowPtrC, csrColIndC, info, pBuffer) - check_status(status) - -cpdef void cgpsvInterleavedBatch( - intptr_t handle, int algo, int m, size_t ds, - size_t dl, size_t d, size_t du, size_t dw, - size_t x, int batchCount, size_t pBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseCgpsvInterleavedBatch( - handle, algo, m, ds, dl, - d, du, dw, x, - batchCount, pBuffer) - check_status(status) - -cpdef void zgpsvInterleavedBatch( - intptr_t handle, int algo, int m, size_t ds, - size_t dl, size_t d, size_t du, size_t dw, - size_t x, int batchCount, size_t pBuffer) except *: - _setStream(handle) - with nogil: - status = cusparseZgpsvInterleavedBatch( - handle, algo, m, ds, - dl, d, du, - dw, x, batchCount, + check_status(status) + + cpdef void dcsrgemm2( + intptr_t handle, int m, int n, int k, size_t alpha, size_t descrA, + int nnzA, size_t csrValA, size_t csrRowPtrA, size_t csrColIndA, + size_t descrB, int nnzB, size_t csrValB, size_t csrRowPtrB, + size_t csrColIndB, size_t beta, size_t descrD, int nnzD, + size_t csrValD, size_t csrRowPtrD, size_t csrColIndD, size_t descrC, + size_t csrValC, size_t csrRowPtrC, size_t csrColIndC, size_t info, + intptr_t pBuffer) except *: + _setStream(handle) + status = cusparseDcsrgemm2( + handle, m, n, k, alpha, descrA, nnzA, + csrValA, csrRowPtrA, csrColIndA, descrB, + nnzB, csrValB, csrRowPtrB, csrColIndB, + beta, descrD, nnzD, csrValD, + csrRowPtrD, csrColIndD, descrC, csrValC, + csrRowPtrC, csrColIndC, info, pBuffer) - check_status(status) - -############################################################ -# Sparse Vector APIs - -cpdef size_t createSpVec(int64_t size, int64_t nnz, intptr_t indices, - intptr_t values, IndexType idxType, IndexBase idxBase, - DataType valueType) except? -1: - cdef SpVecDescr desc - status = cusparseCreateSpVec(&desc, size, nnz, indices, - values, idxType, idxBase, valueType) - check_status(status) - return desc - -cpdef void destroySpVec(size_t desc) except *: - status = cusparseDestroySpVec(desc) - check_status(status) - -cpdef SpVecAttributes spVecGet(size_t desc): - cdef int64_t size, nnz - cdef intptr_t indices, values - cdef IndexType idxType - cdef IndexBase idxBase - cdef DataType valueType - status = cusparseSpVecGet(desc, &size, &nnz, - &indices, &values, - &idxType, &idxBase, &valueType) - check_status(status) - return SpVecAttributes(size, nnz, indices, values, idxType, idxBase, - valueType) - -cpdef int spVecGetIndexBase(size_t desc) except? -1: - cdef IndexBase idxBase - status = cusparseSpVecGetIndexBase(desc, &idxBase) - check_status(status) - return idxBase - -cpdef intptr_t spVecGetValues(size_t desc) except? -1: - cdef intptr_t values - status = cusparseSpVecGetValues(desc, &values) - check_status(status) - return values - -cpdef void spVecSetValues(size_t desc, intptr_t values) except *: - status = cusparseSpVecSetValues(desc, values) - check_status(status) - -############################################################ -# Sparse Matrix APIs - -cpdef size_t createCoo(int64_t rows, int64_t cols, int64_t nnz, - intptr_t cooRowInd, intptr_t cooColInd, - intptr_t cooValues, IndexType cooIdxType, - IndexBase idxBase, DataType valueType) except? -1: - cdef SpMatDescr desc - status = cusparseCreateCoo(&desc, rows, cols, nnz, cooRowInd, - cooColInd, cooValues, - cooIdxType, idxBase, valueType) - check_status(status) - return desc - -cpdef size_t createCooAoS(int64_t rows, int64_t cols, int64_t nnz, - intptr_t cooInd, intptr_t cooValues, - IndexType cooIdxType, IndexBase idxBase, - DataType valueType) except? -1: - cdef SpMatDescr desc - status = cusparseCreateCooAoS(&desc, rows, cols, nnz, cooInd, - cooValues, cooIdxType, idxBase, - valueType) - check_status(status) - return desc - -cpdef size_t createCsr(int64_t rows, int64_t cols, int64_t nnz, - intptr_t csrRowOffsets, intptr_t csrColind, - intptr_t csrValues, IndexType csrRowOffsetsType, - IndexType csrColIndType, IndexBase idxBase, - DataType valueType) except? -1: - cdef SpMatDescr desc - status = cusparseCreateCsr(&desc, rows, cols, nnz, - csrRowOffsets, csrColind, - csrValues, csrRowOffsetsType, - csrColIndType, idxBase, valueType) - check_status(status) - return desc - -cpdef size_t createCsc(int64_t rows, int64_t cols, int64_t nnz, - intptr_t cscColOffsets, intptr_t cscRowInd, - intptr_t cscValues, IndexType cscColOffsetsType, - IndexType cscRowIndType, IndexBase idxBase, - DataType valueType) except? -1: - cdef SpMatDescr desc - status = cusparseCreateCsc(&desc, rows, cols, nnz, - cscColOffsets, cscRowInd, - cscValues, cscColOffsetsType, - cscRowIndType, idxBase, valueType) - check_status(status) - return desc - -cpdef void destroySpMat(size_t desc) except *: - status = cusparseDestroySpMat(desc) - check_status(status) - -cpdef CooAttributes cooGet(size_t desc): - cdef int64_t rows, cols, nnz - cdef intptr_t rowInd, colInd, values, - cdef IndexType idxType, - cdef IndexBase idxBase, - cdef DataType valueType - status = cusparseCooGet(desc, &rows, &cols, &nnz, - &rowInd, &colInd, &values, - &idxType, &idxBase, &valueType) - check_status(status) - return CooAttributes(rows, cols, nnz, rowInd, colInd, values, - idxType, idxBase, valueType) - -cpdef CooAoSAttributes cooAoSGet(size_t desc): - cdef int64_t rows, cols, nnz - cdef intptr_t ind, values, - cdef IndexType idxType, - cdef IndexBase idxBase, - cdef DataType valueType - status = cusparseCooAoSGet(desc, &rows, &cols, &nnz, - &ind, &values, - &idxType, &idxBase, &valueType) - check_status(status) - return CooAoSAttributes(rows, cols, nnz, ind, values, - idxType, idxBase, valueType) - -cpdef CsrAttributes csrGet(size_t desc): - cdef int64_t rows, cols, nnz - cdef intptr_t rowOffsets, colInd, values, - cdef IndexType rowOffsetsType, colIndType - cdef IndexBase idxBase - cdef DataType valueType - status = cusparseCsrGet(desc, &rows, &cols, &nnz, - &rowOffsets, &colInd, - &values, &rowOffsetsType, &colIndType, - &idxBase, &valueType) - check_status(status) - return CsrAttributes(rows, cols, nnz, rowOffsets, colInd, values, - rowOffsetsType, colIndType, idxBase, valueType) - -cpdef void csrSetPointers( - size_t desc, size_t csrRowOffsets, size_t csrColInd, - size_t csrValues) except *: - status = cusparseCsrSetPointers(desc, csrRowOffsets, - csrColInd, csrValues) - check_status(status) - -cpdef int spMatGetFormat(size_t desc) except? -1: - cdef Format format - status = cusparseSpMatGetFormat(desc, &format) - check_status(status) - return format - -cpdef int spMatGetIndexBase(size_t desc) except? -1: - cdef IndexBase idxBase - status = cusparseSpMatGetIndexBase(desc, &idxBase) - check_status(status) - return idxBase - -cpdef intptr_t spMatGetValues(size_t desc) except? -1: - cdef intptr_t values - status = cusparseSpMatGetValues(desc, &values) - check_status(status) - return values - -cpdef void spMatSetValues(size_t desc, intptr_t values) except *: - status = cusparseSpMatSetValues(desc, values) - check_status(status) - -cpdef void spMatGetSize( - size_t desc, size_t rows, size_t cols, size_t nnz) except *: - status = cusparseSpMatGetSize(desc, rows, - cols, nnz) - check_status(status) - -cpdef int spMatGetStridedBatch(size_t desc) except? -1: - cdef int batchCount - status = cusparseSpMatGetStridedBatch(desc, &batchCount) - check_status(status) - return batchCount - -cpdef void spMatSetStridedBatch(size_t desc, int batchCount) except *: - status = cusparseSpMatSetStridedBatch(desc, batchCount) - check_status(status) - -############################################################ -# Dense Vector APIs - -cpdef size_t createDnVec(int64_t size, intptr_t values, - DataType valueType) except? -1: - cdef DnVecDescr desc - status = cusparseCreateDnVec(&desc, size, values, valueType) - check_status(status) - return desc - -cpdef void destroyDnVec(size_t desc) except *: - status = cusparseDestroyDnVec(desc) - check_status(status) - -cpdef DnVecAttributes dnVecGet(size_t desc): - cdef int64_t size - cdef intptr_t values - cdef DataType valueType - status = cusparseDnVecGet(desc, &size, &values, - &valueType) - check_status(status) - return DnVecAttributes(size, values, valueType) - -cpdef intptr_t dnVecGetValues(size_t desc) except? -1: - cdef intptr_t values - status = cusparseDnVecGetValues(desc, &values) - check_status(status) - return values - -cpdef void dnVecSetValues(size_t desc, intptr_t values) except *: - status = cusparseDnVecSetValues(desc, values) - check_status(status) - -############################################################ -# Dense Matrix APIs - -cpdef size_t createDnMat(int64_t rows, int64_t cols, int64_t ld, - intptr_t values, DataType valueType, - Order order) except? -1: - cdef DnMatDescr desc - status = cusparseCreateDnMat(&desc, rows, cols, ld, values, - valueType, order) - check_status(status) - return desc - -cpdef void destroyDnMat(size_t desc) except *: - status = cusparseDestroyDnMat(desc) - check_status(status) - -cpdef DnMatAttributes dnMatGet(size_t desc): - cdef int64_t rows, cols, ld - cdef intptr_t values, - cdef DataType valueType - cdef Order order - status = cusparseDnMatGet(desc, &rows, &cols, &ld, - &values, &valueType, &order) - check_status(status) - return DnMatAttributes(rows, cols, ld, values, valueType, order) - -cpdef intptr_t dnMatGetValues(size_t desc) except? -1: - cdef intptr_t values - status = cusparseDnMatGetValues(desc, &values) - check_status(status) - return values - -cpdef void dnMatSetValues(size_t desc, intptr_t values) except *: - status = cusparseDnMatSetValues(desc, values) - check_status(status) - -cpdef DnMatBatchAttributes dnMatGetStridedBatch(size_t desc): - cdef int batchCount - cdef int64_t batchStride - status = cusparseDnMatGetStridedBatch(desc, &batchCount, - &batchStride) - check_status(status) - return DnMatBatchAttributes(batchCount, batchStride) - -cpdef void dnMatSetStridedBatch( - size_t desc, int batchCount, int64_t batchStride) except *: - status = cusparseDnMatSetStridedBatch(desc, batchCount, - batchStride) - check_status(status) - -############################################################ -# Generic API Functions - -cpdef size_t spVV_bufferSize(intptr_t handle, Operation opX, - size_t vecX, size_t vecY, - intptr_t result, DataType computeType) except? -1: - cdef size_t bufferSize - status = cusparseSpVV_bufferSize(handle, opX, - vecX, vecY, - result, computeType, &bufferSize) - check_status(status) - return bufferSize - -cpdef void spVV( - intptr_t handle, Operation opX, size_t vecX, size_t vecY, - intptr_t result, DataType computeType, - intptr_t externalBuffer) except *: - _setStream(handle) - status = cusparseSpVV(handle, opX, vecX, - vecY, result, computeType, - externalBuffer) - check_status(status) - -cpdef size_t spMV_bufferSize(intptr_t handle, Operation opA, intptr_t alpha, - size_t matA, size_t vecX, intptr_t beta, - size_t vecY, DataType computeType, - SpMVAlg alg) except? -1: - cdef size_t bufferSize - status = cusparseSpMV_bufferSize(handle, opA, alpha, - matA, vecX, - beta, vecY, - computeType, alg, &bufferSize) - check_status(status) - return bufferSize - -cpdef void spMV( - intptr_t handle, Operation opA, intptr_t alpha, size_t matA, - size_t vecX, intptr_t beta, size_t vecY, DataType computeType, - SpMVAlg alg, intptr_t externalBuffer) except *: - _setStream(handle) - status = cusparseSpMV(handle, opA, alpha, matA, - vecX, beta, vecY, - computeType, alg, externalBuffer) - check_status(status) - -cpdef size_t spSM_createDescr() except? -1: - cdef SpSMDescr descr - status = cusparseSpSM_createDescr(&descr) - check_status(status) - return descr - -cpdef void spSM_destroyDescr(size_t descr) except *: - status = cusparseSpSM_destroyDescr(descr) - check_status(status) - -cpdef size_t spSM_bufferSize(intptr_t handle, Operation opA, Operation opB, - intptr_t alpha, size_t matA, size_t matB, - size_t matC, DataType computeType, SpSMAlg alg, - size_t spsmDescr) except? -1: - cdef size_t bufferSize - status = cusparseSpSM_bufferSize(handle, opA, opB, alpha, - matA, matB, - matC, computeType, alg, - spsmDescr, &bufferSize) - check_status(status) - return bufferSize - -cpdef void spSM_analysis( - intptr_t handle, Operation opA, Operation opB, - intptr_t alpha, size_t matA, size_t matB, size_t matC, - DataType computeType, SpSMAlg alg, size_t spsmDescr, - intptr_t externalBuffer) except *: - _setStream(handle) - status = cusparseSpSM_analysis( handle, opA, opB, alpha, - matA, matB, - matC, computeType, alg, - spsmDescr, externalBuffer) - check_status(status) - -cpdef void spSM_solve( - intptr_t handle, Operation opA, Operation opB, intptr_t alpha, - size_t matA, size_t matB, size_t matC, DataType computeType, - SpSMAlg alg, size_t spsmDescr, intptr_t externalBuffer=0) except *: - _setStream(handle) - IF CUPY_HIP_VERSION > 0: - # hipsparseSpSM_solve has the extra `externalBuffer` parameter that - # cusparseSpSM_solve does not require. - status = cusparseSpSM_solve( handle, opA, opB, alpha, - matA, matB, - matC, computeType, alg, - spsmDescr, - externalBuffer) - ELSE: - status = cusparseSpSM_solve( handle, opA, opB, alpha, - matA, matB, - matC, computeType, alg, - spsmDescr) - check_status(status) - -cpdef size_t spMM_bufferSize(intptr_t handle, Operation opA, Operation opB, - intptr_t alpha, size_t matA, size_t matB, - intptr_t beta, size_t matC, DataType computeType, - SpMMAlg alg) except? -1: - cdef size_t bufferSize - status = cusparseSpMM_bufferSize(handle, opA, opB, alpha, - matA, matB, - beta, matC, - computeType, alg, &bufferSize) - check_status(status) - return bufferSize - -cpdef void spMM( - intptr_t handle, Operation opA, Operation opB, intptr_t alpha, - size_t matA, size_t matB, intptr_t beta, size_t matC, - DataType computeType, SpMMAlg alg, intptr_t externalBuffer) except *: - _setStream(handle) - status = cusparseSpMM(handle, opA, opB, alpha, - matA, matB, beta, - matC, computeType, alg, - externalBuffer) - check_status(status) - -cpdef size_t constrainedGeMM_bufferSize(intptr_t handle, Operation opA, - Operation opB, intptr_t alpha, - size_t matA, size_t matB, - intptr_t beta, size_t matC, - DataType computeType) except? -1: - cdef size_t bufferSize - status = cusparseConstrainedGeMM_bufferSize( - handle, opA, opB, alpha, matA, - matB, beta, matC, computeType, - &bufferSize) - check_status(status) - return bufferSize - -cpdef void constrainedGeMM( - intptr_t handle, Operation opA, Operation opB, - intptr_t alpha, size_t matA, size_t matB, intptr_t beta, - size_t matC, DataType computeType, - intptr_t externalBuffer) except *: - _setStream(handle) - status = cusparseConstrainedGeMM( - handle, opA, opB, alpha, matA, - matB, beta, matC, computeType, - externalBuffer) - check_status(status) - -cpdef size_t spGEMM_createDescr() except? -1: - cdef SpGEMMDescr descr - status = cusparseSpGEMM_createDescr(&descr) - check_status(status) - return descr - -cpdef void spGEMM_destroyDescr(size_t descr) except *: - status = cusparseSpGEMM_destroyDescr(descr) - check_status(status) - -cpdef size_t spGEMM_workEstimation( - intptr_t handle, Operation opA, Operation opB, intptr_t alpha, - size_t matA, size_t matB, intptr_t beta, size_t matC, - DataType computeType, int alg, size_t spgemmDescr, - size_t bufferSize, intptr_t externalBuffer1) except? -1: - cdef size_t bufferSize1 = bufferSize - status = cusparseSpGEMM_workEstimation( - handle, opA, opB, alpha, matA, - matB, beta, matC, computeType, - alg, spgemmDescr, &bufferSize1, - externalBuffer1) - check_status(status) - return bufferSize1 - -cpdef size_t spGEMM_compute( - intptr_t handle, Operation opA, Operation opB, intptr_t alpha, - size_t matA, size_t matB, intptr_t beta, size_t matC, - DataType computeType, int alg, size_t spgemmDescr, - size_t bufferSize, intptr_t externalBuffer2) except? -1: - cdef size_t bufferSize2 = bufferSize - status = cusparseSpGEMM_compute( - handle, opA, opB, alpha, matA, - matB, beta, matC, computeType, - alg, spgemmDescr, &bufferSize2, - externalBuffer2) - check_status(status) - return bufferSize2 - -cpdef void spGEMM_copy( - intptr_t handle, Operation opA, Operation opB, intptr_t alpha, - size_t matA, size_t matB, intptr_t beta, size_t matC, - DataType computeType, int alg, size_t spgemmDescr) except *: - status = cusparseSpGEMM_copy( - handle, opA, opB, alpha, matA, - matB, beta, matC, computeType, - alg, spgemmDescr) - check_status(status) - -cpdef void gather(intptr_t handle, size_t vecY, size_t vecX) except *: - status = cusparseGather(handle, vecY, vecX) - check_status(status) - -cpdef size_t sparseToDense_bufferSize(intptr_t handle, size_t matA, - size_t matB, int alg) except? -1: - cdef size_t bufferSize - status = cusparseSparseToDense_bufferSize( - handle, matA, matB, - alg, &bufferSize) - check_status(status) - return bufferSize - -cpdef void sparseToDense( - intptr_t handle, size_t matA, size_t matB, int alg, - intptr_t buffer) except *: - _setStream(handle) - status = cusparseSparseToDense( - handle, matA, matB, - alg, buffer) - check_status(status) - -cpdef size_t denseToSparse_bufferSize(intptr_t handle, size_t matA, - size_t matB, int alg) except? -1: - cdef size_t bufferSize - status = cusparseDenseToSparse_bufferSize( - handle, matA, matB, - alg, &bufferSize) - check_status(status) - return bufferSize - -cpdef void denseToSparse_analysis( - intptr_t handle, size_t matA, size_t matB, - int alg, intptr_t buffer) except *: - _setStream(handle) - status = cusparseDenseToSparse_analysis( - handle, matA, matB, - alg, buffer) - check_status(status) - -cpdef void denseToSparse_convert( - intptr_t handle, size_t matA, size_t matB, - int alg, intptr_t buffer) except *: - _setStream(handle) - status = cusparseDenseToSparse_convert( - handle, matA, matB, - alg, buffer) - check_status(status) - -# CSR2CSC -cpdef size_t csr2cscEx2_bufferSize( - intptr_t handle, int m, int n, int nnz, intptr_t csrVal, - intptr_t csrRowPtr, intptr_t csrColInd, intptr_t cscVal, - intptr_t cscColPtr, intptr_t cscRowInd, DataType valType, - Action copyValues, IndexBase idxBase, Csr2CscAlg alg) except? -1: - cdef size_t bufferSize - status = cusparseCsr2cscEx2_bufferSize( - handle, m, n, nnz, csrVal, csrRowPtr, - csrColInd, cscVal, cscColPtr, cscRowInd, - valType, copyValues, idxBase, alg, &bufferSize) - check_status(status) - return bufferSize - -cpdef void csr2cscEx2( - intptr_t handle, int m, int n, int nnz, intptr_t csrVal, - intptr_t csrRowPtr, intptr_t csrColInd, intptr_t cscVal, - intptr_t cscColPtr, intptr_t cscRowInd, DataType valType, - Action copyValues, IndexBase idxBase, Csr2CscAlg alg, - intptr_t buffer) except *: - setStream(handle, stream_module.get_current_stream_ptr()) - status = cusparseCsr2cscEx2( - handle, m, n, nnz, csrVal, csrRowPtr, - csrColInd, cscVal, cscColPtr, cscRowInd, - valType, copyValues, idxBase, alg, buffer) - check_status(status) + check_status(status) + + cpdef void ccsrgemm2( + intptr_t handle, int m, int n, int k, size_t alpha, size_t descrA, + int nnzA, size_t csrValA, size_t csrRowPtrA, size_t csrColIndA, + size_t descrB, int nnzB, size_t csrValB, size_t csrRowPtrB, + size_t csrColIndB, size_t beta, size_t descrD, int nnzD, + size_t csrValD, size_t csrRowPtrD, size_t csrColIndD, size_t descrC, + size_t csrValC, size_t csrRowPtrC, size_t csrColIndC, size_t info, + intptr_t pBuffer) except *: + _setStream(handle) + status = cusparseCcsrgemm2( + handle, m, n, k, alpha, descrA, nnzA, + csrValA, csrRowPtrA, csrColIndA, + descrB, nnzB, csrValB, csrRowPtrB, + csrColIndB, beta, descrD, nnzD, + csrValD, csrRowPtrD, csrColIndD, + descrC, csrValC, csrRowPtrC, + csrColIndC, info, pBuffer) + check_status(status) + + cpdef void zcsrgemm2( + intptr_t handle, int m, int n, int k, size_t alpha, size_t descrA, + int nnzA, size_t csrValA, size_t csrRowPtrA, size_t csrColIndA, + size_t descrB, int nnzB, size_t csrValB, size_t csrRowPtrB, + size_t csrColIndB, size_t beta, size_t descrD, int nnzD, + size_t csrValD, size_t csrRowPtrD, size_t csrColIndD, size_t descrC, + size_t csrValC, size_t csrRowPtrC, size_t csrColIndC, size_t info, + intptr_t pBuffer) except *: + _setStream(handle) + status = cusparseZcsrgemm2( + handle, m, n, k, alpha, descrA, + nnzA, csrValA, csrRowPtrA, csrColIndA, + descrB, nnzB, csrValB, csrRowPtrB, + csrColIndB, beta, descrD, nnzD, + csrValD, csrRowPtrD, csrColIndD, + descrC, csrValC, csrRowPtrC, + csrColIndC, info, pBuffer) + check_status(status) + + ######################################## + # cuSPARSE Format Convrsion + + cpdef void xcoo2csr( + intptr_t handle, size_t cooRowInd, int nnz, int m, size_t csrRowPtr, + int idxBase) except *: + _setStream(handle) + status = cusparseXcoo2csr( + handle, cooRowInd, nnz, m, csrRowPtr, + idxBase) + check_status(status) + + + cpdef void scsc2dense( + intptr_t handle, int m, int n, size_t descrA, + size_t cscSortedValA, size_t cscSortedRowIndA, + size_t cscSortedColPtrA, size_t A, int lda) except *: + _setStream(handle) + status = cusparseScsc2dense( + handle, m, n, descrA, + cscSortedValA, cscSortedRowIndA, + cscSortedColPtrA, A, lda) + check_status(status) + + + cpdef void dcsc2dense( + intptr_t handle, int m, int n, size_t descrA, + size_t cscSortedValA, size_t cscSortedRowIndA, + size_t cscSortedColPtrA, size_t A, int lda) except *: + _setStream(handle) + status = cusparseDcsc2dense( + handle, m, n, descrA, + cscSortedValA, cscSortedRowIndA, + cscSortedColPtrA, A, lda) + check_status(status) + + cpdef void ccsc2dense( + intptr_t handle, int m, int n, size_t descrA, + size_t cscSortedValA, size_t cscSortedRowIndA, + size_t cscSortedColPtrA, size_t A, int lda) except *: + _setStream(handle) + status = cusparseCcsc2dense( + handle, m, n, descrA, + cscSortedValA, cscSortedRowIndA, + cscSortedColPtrA, A, lda) + check_status(status) + + cpdef void zcsc2dense( + intptr_t handle, int m, int n, size_t descrA, + size_t cscSortedValA, size_t cscSortedRowIndA, + size_t cscSortedColPtrA, size_t A, int lda) except *: + _setStream(handle) + status = cusparseZcsc2dense( + handle, m, n, descrA, + cscSortedValA, cscSortedRowIndA, + cscSortedColPtrA, A, lda) + check_status(status) + + cpdef void xcsr2coo( + intptr_t handle, size_t csrRowPtr, int nnz, int m, size_t cooRowInd, + int idxBase) except *: + _setStream(handle) + status = cusparseXcsr2coo( + handle, csrRowPtr, nnz, m, cooRowInd, + idxBase) + check_status(status) + + + cpdef void scsr2csc( + intptr_t handle, int m, int n, int nnz, size_t csrVal, + size_t csrRowPtr, size_t csrColInd, size_t cscVal, + size_t cscRowInd, size_t cscColPtr, int copyValues, + int idxBase) except *: + _setStream(handle) + status = cusparseScsr2csc( + handle, m, n, nnz, csrVal, + csrRowPtr, csrColInd, cscVal, + cscRowInd, cscColPtr, copyValues, + idxBase) + check_status(status) + + + cpdef void dcsr2csc( + intptr_t handle, int m, int n, int nnz, size_t csrVal, + size_t csrRowPtr, size_t csrColInd, size_t cscVal, + size_t cscRowInd, size_t cscColPtr, int copyValues, + int idxBase) except *: + _setStream(handle) + status = cusparseDcsr2csc( + handle, m, n, nnz, csrVal, + csrRowPtr, csrColInd, cscVal, + cscRowInd, cscColPtr, copyValues, + idxBase) + check_status(status) + + cpdef void ccsr2csc( + intptr_t handle, int m, int n, int nnz, size_t csrVal, + size_t csrRowPtr, size_t csrColInd, size_t cscVal, + size_t cscRowInd, size_t cscColPtr, int copyValues, + int idxBase) except *: + _setStream(handle) + status = cusparseCcsr2csc( + handle, m, n, nnz, csrVal, + csrRowPtr, csrColInd, cscVal, + cscRowInd, cscColPtr, copyValues, + idxBase) + check_status(status) + + cpdef void zcsr2csc( + intptr_t handle, int m, int n, int nnz, size_t csrVal, + size_t csrRowPtr, size_t csrColInd, size_t cscVal, + size_t cscRowInd, size_t cscColPtr, int copyValues, + int idxBase) except *: + _setStream(handle) + status = cusparseZcsr2csc( + handle, m, n, nnz, csrVal, + csrRowPtr, csrColInd, + cscVal, + cscRowInd, cscColPtr, copyValues, + idxBase) + check_status(status) + + cpdef void scsr2dense( + intptr_t handle, int m, int n, size_t descrA, + size_t csrSortedValA, size_t csrSortedRowPtrA, + size_t csrSortedColIndA, size_t A, int lda) except *: + _setStream(handle) + status = cusparseScsr2dense( + handle, m, n, descrA, + csrSortedValA, csrSortedRowPtrA, + csrSortedColIndA, A, lda) + check_status(status) + + cpdef void dcsr2dense( + intptr_t handle, int m, int n, size_t descrA, + size_t csrSortedValA, size_t csrSortedRowPtrA, + size_t csrSortedColIndA, size_t A, int lda) except *: + _setStream(handle) + status = cusparseDcsr2dense( + handle, m, n, descrA, + csrSortedValA, csrSortedRowPtrA, + csrSortedColIndA, A, lda) + check_status(status) + + cpdef void ccsr2dense( + intptr_t handle, int m, int n, size_t descrA, + size_t csrSortedValA, size_t csrSortedRowPtrA, + size_t csrSortedColIndA, size_t A, int lda) except *: + _setStream(handle) + status = cusparseCcsr2dense( + handle, m, n, descrA, + csrSortedValA, csrSortedRowPtrA, + csrSortedColIndA, A, lda) + check_status(status) + + cpdef void zcsr2dense( + intptr_t handle, int m, int n, size_t descrA, + size_t csrSortedValA, size_t csrSortedRowPtrA, + size_t csrSortedColIndA, size_t A, int lda) except *: + _setStream(handle) + status = cusparseZcsr2dense( + handle, m, n, descrA, + csrSortedValA, csrSortedRowPtrA, + csrSortedColIndA, A, lda) + check_status(status) + + cpdef int snnz_compress( + intptr_t handle, int m, size_t descr, + size_t values, size_t rowPtr, size_t nnzPerRow, + float tol) except? -1: + cdef int nnz_total + _setStream(handle) + status = cusparseSnnz_compress( + handle, m, descr, + values, rowPtr, nnzPerRow, + &nnz_total, tol) + check_status(status) + return nnz_total + + cpdef int dnnz_compress( + intptr_t handle, int m, size_t descr, + size_t values, size_t rowPtr, size_t nnzPerRow, + double tol) except? -1: + cdef int nnz_total + _setStream(handle) + status = cusparseDnnz_compress( + handle, m, descr, + values, rowPtr, nnzPerRow, + &nnz_total, tol) + check_status(status) + return nnz_total + + cpdef int cnnz_compress( + intptr_t handle, int m, size_t descr, + size_t values, size_t rowPtr, size_t nnzPerRow, + complex tol) except? -1: + cdef int nnz_total + _setStream(handle) + status = cusparseCnnz_compress( + handle, m, descr, + values, rowPtr, nnzPerRow, + &nnz_total, complex_to_cuda(tol)) + check_status(status) + return nnz_total + + cpdef int znnz_compress( + intptr_t handle, int m, size_t descr, + size_t values, size_t rowPtr, size_t nnzPerRow, + double complex tol) except? -1: + cdef int nnz_total + _setStream(handle) + status = cusparseZnnz_compress( + handle, m, descr, + values, rowPtr, nnzPerRow, + &nnz_total, double_complex_to_cuda(tol)) + check_status(status) + return nnz_total + + cpdef void scsr2csr_compress( + intptr_t handle, int m, int n, size_t descrA, + size_t inVal, size_t inColInd, size_t inRowPtr, + int inNnz, size_t nnzPerRow, size_t outVal, size_t outColInd, + size_t outRowPtr, float tol) except *: + _setStream(handle) + status = cusparseScsr2csr_compress( + handle, m, n, descrA, + inVal, inColInd, inRowPtr, + inNnz, nnzPerRow, outVal, outColInd, + outRowPtr, tol) + check_status(status) + + + cpdef void dcsr2csr_compress( + intptr_t handle, int m, int n, size_t descrA, + size_t inVal, size_t inColInd, size_t inRowPtr, + int inNnz, size_t nnzPerRow, size_t outVal, size_t outColInd, + size_t outRowPtr, float tol) except *: + _setStream(handle) + status = cusparseDcsr2csr_compress( + handle, m, n, descrA, + inVal, inColInd, inRowPtr, + inNnz, nnzPerRow, outVal, outColInd, + outRowPtr, tol) + check_status(status) + + cpdef void ccsr2csr_compress( + intptr_t handle, int m, int n, size_t descrA, + size_t inVal, size_t inColInd, size_t inRowPtr, + int inNnz, size_t nnzPerRow, size_t outVal, size_t outColInd, + size_t outRowPtr, complex tol) except *: + _setStream(handle) + status = cusparseCcsr2csr_compress( + handle, m, n, descrA, + inVal, inColInd, inRowPtr, + inNnz, nnzPerRow, outVal, outColInd, + outRowPtr, complex_to_cuda(tol)) + check_status(status) + + cpdef void zcsr2csr_compress( + intptr_t handle, int m, int n, size_t descrA, + size_t inVal, size_t inColInd, size_t inRowPtr, + int inNnz, size_t nnzPerRow, size_t outVal, size_t outColInd, + size_t outRowPtr, double complex tol) except *: + _setStream(handle) + status = cusparseZcsr2csr_compress( + handle, m, n, descrA, + inVal, inColInd, + inRowPtr, + inNnz, nnzPerRow, outVal, outColInd, + outRowPtr, double_complex_to_cuda(tol)) + check_status(status) + + cpdef void sdense2csc( + intptr_t handle, int m, int n, size_t descrA, size_t A, + int lda, size_t nnzPerCol, size_t cscValA, size_t cscRowIndA, + size_t cscColPtrA) except *: + _setStream(handle) + status = cusparseSdense2csc( + handle, m, n, descrA, A, + lda, nnzPerCol, cscValA, cscRowIndA, + cscColPtrA) + check_status(status) + + + cpdef void ddense2csc( + intptr_t handle, int m, int n, size_t descrA, size_t A, + int lda, size_t nnzPerCol, size_t cscValA, size_t cscRowIndA, + size_t cscColPtrA) except *: + _setStream(handle) + status = cusparseDdense2csc( + handle, m, n, descrA, A, + lda, nnzPerCol, cscValA, cscRowIndA, + cscColPtrA) + check_status(status) + + cpdef void cdense2csc( + intptr_t handle, int m, int n, size_t descrA, size_t A, + int lda, size_t nnzPerCol, size_t cscValA, size_t cscRowIndA, + size_t cscColPtrA) except *: + _setStream(handle) + status = cusparseCdense2csc( + handle, m, n, descrA, A, + lda, nnzPerCol, cscValA, cscRowIndA, + cscColPtrA) + check_status(status) + + cpdef void zdense2csc( + intptr_t handle, int m, int n, size_t descrA, size_t A, + int lda, size_t nnzPerCol, size_t cscValA, size_t cscRowIndA, + size_t cscColPtrA) except *: + _setStream(handle) + status = cusparseZdense2csc( + handle, m, n, + descrA, A, + lda, nnzPerCol, + cscValA, cscRowIndA, + cscColPtrA) + check_status(status) + + cpdef void sdense2csr( + intptr_t handle, int m, int n, size_t descrA, + size_t A, int lda, size_t nnzPerRow, size_t csrValA, + size_t csrRowPtrA, size_t csrColIndA) except *: + _setStream(handle) + status = cusparseSdense2csr( + handle, m, n, descrA, + A, lda, nnzPerRow, csrValA, + csrRowPtrA, csrColIndA) + check_status(status) + + + cpdef void ddense2csr( + intptr_t handle, int m, int n, size_t descrA, + size_t A, int lda, size_t nnzPerRow, size_t csrValA, + size_t csrRowPtrA, size_t csrColIndA) except *: + _setStream(handle) + status = cusparseDdense2csr( + handle, m, n, descrA, + A, lda, nnzPerRow, csrValA, + csrRowPtrA, csrColIndA) + check_status(status) + + cpdef void cdense2csr( + intptr_t handle, int m, int n, size_t descrA, + size_t A, int lda, size_t nnzPerRow, size_t csrValA, + size_t csrRowPtrA, size_t csrColIndA) except *: + _setStream(handle) + status = cusparseCdense2csr( + handle, m, n, descrA, + A, lda, nnzPerRow, + csrValA, csrRowPtrA, csrColIndA) + check_status(status) + + cpdef void zdense2csr( + intptr_t handle, int m, int n, size_t descrA, + size_t A, int lda, size_t nnzPerRow, size_t csrValA, + size_t csrRowPtrA, size_t csrColIndA) except *: + _setStream(handle) + status = cusparseZdense2csr( + handle, m, n, descrA, + A, lda, nnzPerRow, + csrValA, csrRowPtrA, csrColIndA) + check_status(status) + + cpdef void snnz( + intptr_t handle, int dirA, int m, int n, size_t descrA, + size_t A, int lda, size_t nnzPerRowColumn, + size_t nnzTotalDevHostPtr) except *: + _setStream(handle) + status = cusparseSnnz( + handle, dirA, m, n, descrA, + A, lda, nnzPerRowColumn, + nnzTotalDevHostPtr) + check_status(status) + + + cpdef void dnnz( + intptr_t handle, int dirA, int m, int n, size_t descrA, + size_t A, int lda, size_t nnzPerRowColumn, + size_t nnzTotalDevHostPtr) except *: + _setStream(handle) + status = cusparseDnnz( + handle, dirA, m, n, descrA, + A, lda, nnzPerRowColumn, + nnzTotalDevHostPtr) + check_status(status) + + cpdef void cnnz( + intptr_t handle, int dirA, int m, int n, size_t descrA, + size_t A, int lda, size_t nnzPerRowColumn, + size_t nnzTotalDevHostPtr) except *: + _setStream(handle) + status = cusparseCnnz( + handle, dirA, m, n, descrA, + A, lda, nnzPerRowColumn, + nnzTotalDevHostPtr) + check_status(status) + + cpdef void znnz( + intptr_t handle, int dirA, int m, int n, size_t descrA, + size_t A, int lda, size_t nnzPerRowColumn, + size_t nnzTotalDevHostPtr) except *: + _setStream(handle) + status = cusparseZnnz( + handle, dirA, m, n, descrA, + A, lda, nnzPerRowColumn, + nnzTotalDevHostPtr) + check_status(status) + + cpdef void createIdentityPermutation( + intptr_t handle, int n, size_t p) except *: + _setStream(handle) + status = cusparseCreateIdentityPermutation( + handle, n, p) + check_status(status) + + + cpdef size_t xcoosort_bufferSizeExt( + intptr_t handle, int m, int n, int nnz, size_t cooRows, + size_t cooCols) except? -1: + cdef size_t bufferSizeInBytes + _setStream(handle) + status = cusparseXcoosort_bufferSizeExt( + handle, m, n, nnz, cooRows, + cooCols, &bufferSizeInBytes) + check_status(status) + return bufferSizeInBytes + + + cpdef void xcoosortByRow( + intptr_t handle, int m, int n, int nnz, size_t cooRows, size_t cooCols, + size_t P, size_t pBuffer) except *: + _setStream(handle) + status = cusparseXcoosortByRow( + handle, m, n, nnz, cooRows, cooCols, + P, pBuffer) + check_status(status) + + + cpdef void xcoosortByColumn( + intptr_t handle, int m, int n, int nnz, size_t cooRows, size_t cooCols, + size_t P, size_t pBuffer) except *: + _setStream(handle) + status = cusparseXcoosortByColumn( + handle, m, n, nnz, cooRows, cooCols, + P, pBuffer) + check_status(status) + + + cpdef size_t xcsrsort_bufferSizeExt( + intptr_t handle, int m, int n, int nnz, size_t csrRowPtr, + size_t csrColInd) except? -1: + cdef size_t bufferSizeInBytes + _setStream(handle) + status = cusparseXcsrsort_bufferSizeExt( + handle, m, n, nnz, csrRowPtr, + csrColInd, &bufferSizeInBytes) + check_status(status) + return bufferSizeInBytes + + + cpdef void xcsrsort( + intptr_t handle, int m, int n, int nnz, size_t descrA, + size_t csrRowPtr, size_t csrColInd, size_t P, size_t pBuffer) except *: + _setStream(handle) + status = cusparseXcsrsort( + handle, m, n, nnz, descrA, + csrRowPtr, csrColInd, P, pBuffer) + check_status(status) + + + cpdef size_t xcscsort_bufferSizeExt( + intptr_t handle, int m, int n, int nnz, size_t cscColPtr, + size_t cscRowInd) except? -1: + cdef size_t bufferSizeInBytes + _setStream(handle) + status = cusparseXcscsort_bufferSizeExt( + handle, m, n, nnz, cscColPtr, + cscRowInd, &bufferSizeInBytes) + check_status(status) + return bufferSizeInBytes + + + cpdef void xcscsort( + intptr_t handle, int m, int n, int nnz, size_t descrA, + size_t cscColPtr, size_t cscRowInd, size_t P, size_t pBuffer) except *: + _setStream(handle) + status = cusparseXcscsort( + handle, m, n, nnz, descrA, + cscColPtr, cscRowInd, P, pBuffer) + check_status(status) + + ######################################## + # cuSPARSE PRECONDITIONERS + + cpdef size_t createCsrilu02Info() except? -1: + cdef csrilu02Info_t info + with nogil: + status = cusparseCreateCsrilu02Info(&info) + check_status(status) + return info + + cpdef void destroyCsrilu02Info(size_t info) except *: + with nogil: + status = cusparseDestroyCsrilu02Info(info) + check_status(status) + + cpdef size_t createBsrilu02Info() except? -1: + cdef bsrilu02Info_t info + with nogil: + status = cusparseCreateBsrilu02Info(&info) + check_status(status) + return info + + cpdef void destroyBsrilu02Info(size_t info) except *: + with nogil: + status = cusparseDestroyBsrilu02Info(info) + check_status(status) + + cpdef size_t createCsric02Info() except? -1: + cdef csric02Info_t info + with nogil: + status = cusparseCreateCsric02Info(&info) + check_status(status) + return info + + cpdef void destroyCsric02Info(size_t info) except *: + with nogil: + status = cusparseDestroyCsric02Info(info) + check_status(status) + + cpdef size_t createBsric02Info() except? -1: + cdef bsric02Info_t info + with nogil: + status = cusparseCreateBsric02Info(&info) + check_status(status) + return info + + cpdef void destroyBsric02Info(size_t info) except *: + with nogil: + status = cusparseDestroyBsric02Info(info) + check_status(status) + + cpdef void scsrilu02_numericBoost( + intptr_t handle, size_t info, int enable_boost, + size_t tol, size_t boost_val) except *: + _setStream(handle) + with nogil: + status = cusparseScsrilu02_numericBoost( + handle, info, enable_boost, + tol, boost_val) + check_status(status) + + cpdef void dcsrilu02_numericBoost( + intptr_t handle, size_t info, int enable_boost, + size_t tol, size_t boost_val) except *: + _setStream(handle) + with nogil: + status = cusparseDcsrilu02_numericBoost( + handle, info, enable_boost, + tol, boost_val) + check_status(status) + + cpdef void ccsrilu02_numericBoost( + intptr_t handle, size_t info, int enable_boost, + size_t tol, size_t boost_val) except *: + _setStream(handle) + with nogil: + status = cusparseCcsrilu02_numericBoost( + handle, info, enable_boost, + tol, boost_val) + check_status(status) + + cpdef void zcsrilu02_numericBoost( + intptr_t handle, size_t info, int enable_boost, + size_t tol, size_t boost_val) except *: + _setStream(handle) + with nogil: + status = cusparseZcsrilu02_numericBoost( + handle, info, enable_boost, + tol, boost_val) + check_status(status) + + cpdef void xcsrilu02_zeroPivot( + intptr_t handle, size_t info, size_t position) except *: + _setStream(handle) + with nogil: + status = cusparseXcsrilu02_zeroPivot( + handle, info, position) + check_status(status) + + cpdef int scsrilu02_bufferSize( + intptr_t handle, int m, int nnz, size_t descrA, + size_t csrSortedValA, size_t csrSortedRowPtrA, + size_t csrSortedColIndA, size_t info) except? -1: + cdef int pBufferSizeInBytes + _setStream(handle) + with nogil: + status = cusparseScsrilu02_bufferSize( + handle, m, nnz, descrA, + csrSortedValA, csrSortedRowPtrA, + csrSortedColIndA, info, + &pBufferSizeInBytes) + check_status(status) + return pBufferSizeInBytes + + cpdef int dcsrilu02_bufferSize( + intptr_t handle, int m, int nnz, size_t descrA, + size_t csrSortedValA, size_t csrSortedRowPtrA, + size_t csrSortedColIndA, size_t info) except? -1: + cdef int pBufferSizeInBytes + _setStream(handle) + with nogil: + status = cusparseDcsrilu02_bufferSize( + handle, m, nnz, descrA, + csrSortedValA, csrSortedRowPtrA, + csrSortedColIndA, info, + &pBufferSizeInBytes) + check_status(status) + return pBufferSizeInBytes + + cpdef int ccsrilu02_bufferSize( + intptr_t handle, int m, int nnz, size_t descrA, + size_t csrSortedValA, size_t csrSortedRowPtrA, + size_t csrSortedColIndA, size_t info) except? -1: + cdef int pBufferSizeInBytes + _setStream(handle) + with nogil: + status = cusparseCcsrilu02_bufferSize( + handle, m, nnz, descrA, + csrSortedValA, csrSortedRowPtrA, + csrSortedColIndA, info, + &pBufferSizeInBytes) + check_status(status) + return pBufferSizeInBytes + + cpdef int zcsrilu02_bufferSize( + intptr_t handle, int m, int nnz, size_t descrA, + size_t csrSortedValA, size_t csrSortedRowPtrA, + size_t csrSortedColIndA, size_t info) except? -1: + cdef int pBufferSizeInBytes + _setStream(handle) + with nogil: + status = cusparseZcsrilu02_bufferSize( + handle, m, nnz, descrA, + csrSortedValA, csrSortedRowPtrA, + csrSortedColIndA, info, + &pBufferSizeInBytes) + check_status(status) + return pBufferSizeInBytes + + cpdef void scsrilu02_analysis(intptr_t handle, int m, int nnz, size_t descrA, + size_t csrSortedValA, size_t csrSortedRowPtrA, + size_t csrSortedColIndA, size_t info, int policy, + size_t pBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseScsrilu02_analysis( + handle, m, nnz, descrA, + csrSortedValA, csrSortedRowPtrA, + csrSortedColIndA, info, + policy, pBuffer) + check_status(status) + + cpdef void dcsrilu02_analysis(intptr_t handle, int m, int nnz, size_t descrA, + size_t csrSortedValA, size_t csrSortedRowPtrA, + size_t csrSortedColIndA, size_t info, int policy, + size_t pBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseDcsrilu02_analysis( + handle, m, nnz, descrA, + csrSortedValA, csrSortedRowPtrA, + csrSortedColIndA, info, + policy, pBuffer) + check_status(status) + + cpdef void ccsrilu02_analysis(intptr_t handle, int m, int nnz, size_t descrA, + size_t csrSortedValA, size_t csrSortedRowPtrA, + size_t csrSortedColIndA, size_t info, int policy, + size_t pBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseCcsrilu02_analysis( + handle, m, nnz, descrA, + csrSortedValA, csrSortedRowPtrA, + csrSortedColIndA, info, + policy, pBuffer) + check_status(status) + + cpdef void zcsrilu02_analysis(intptr_t handle, int m, int nnz, size_t descrA, + size_t csrSortedValA, size_t csrSortedRowPtrA, + size_t csrSortedColIndA, size_t info, int policy, + size_t pBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseZcsrilu02_analysis( + handle, m, nnz, descrA, + csrSortedValA, + csrSortedRowPtrA, csrSortedColIndA, + info, policy, + pBuffer) + check_status(status) + + cpdef void scsrilu02(intptr_t handle, int m, int nnz, size_t descrA, + size_t csrSortedValA_valM, size_t csrSortedRowPtrA, + size_t csrSortedColIndA, size_t info, int policy, + size_t pBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseScsrilu02( + handle, m, nnz, descrA, + csrSortedValA_valM, csrSortedRowPtrA, + csrSortedColIndA, info, + policy, pBuffer) + check_status(status) + + cpdef void dcsrilu02(intptr_t handle, int m, int nnz, size_t descrA, + size_t csrSortedValA_valM, size_t csrSortedRowPtrA, + size_t csrSortedColIndA, size_t info, int policy, + size_t pBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseDcsrilu02( + handle, m, nnz, descrA, + csrSortedValA_valM, csrSortedRowPtrA, + csrSortedColIndA, info, + policy, pBuffer) + check_status(status) + + cpdef void ccsrilu02(intptr_t handle, int m, int nnz, size_t descrA, + size_t csrSortedValA_valM, size_t csrSortedRowPtrA, + size_t csrSortedColIndA, size_t info, int policy, + size_t pBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseCcsrilu02( + handle, m, nnz, descrA, + csrSortedValA_valM, csrSortedRowPtrA, + csrSortedColIndA, info, + policy, pBuffer) + check_status(status) + + cpdef void zcsrilu02(intptr_t handle, int m, int nnz, size_t descrA, + size_t csrSortedValA_valM, size_t csrSortedRowPtrA, + size_t csrSortedColIndA, size_t info, int policy, + size_t pBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseZcsrilu02( + handle, m, nnz, descrA, + csrSortedValA_valM, csrSortedRowPtrA, + csrSortedColIndA, info, + policy, pBuffer) + check_status(status) + + cpdef void sbsrilu02_numericBoost( + intptr_t handle, size_t info, int enable_boost, + size_t tol, size_t boost_val) except *: + _setStream(handle) + with nogil: + status = cusparseSbsrilu02_numericBoost( + handle, info, enable_boost, + tol, boost_val) + check_status(status) + + cpdef void dbsrilu02_numericBoost( + intptr_t handle, size_t info, int enable_boost, + size_t tol, size_t boost_val) except *: + _setStream(handle) + with nogil: + status = cusparseDbsrilu02_numericBoost( + handle, info, enable_boost, + tol, boost_val) + check_status(status) + + cpdef void cbsrilu02_numericBoost( + intptr_t handle, size_t info, int enable_boost, + size_t tol, size_t boost_val) except *: + _setStream(handle) + with nogil: + status = cusparseCbsrilu02_numericBoost( + handle, info, enable_boost, + tol, boost_val) + check_status(status) + + cpdef void zbsrilu02_numericBoost( + intptr_t handle, size_t info, int enable_boost, + size_t tol, size_t boost_val) except *: + _setStream(handle) + with nogil: + status = cusparseZbsrilu02_numericBoost( + handle, info, enable_boost, + tol, boost_val) + check_status(status) + + cpdef void xbsrilu02_zeroPivot( + intptr_t handle, size_t info, size_t position) except *: + _setStream(handle) + with nogil: + status = cusparseXbsrilu02_zeroPivot( + handle, info, position) + check_status(status) + + cpdef int sbsrilu02_bufferSize(intptr_t handle, int dirA, int mb, int nnzb, + size_t descrA, size_t bsrSortedVal, + size_t bsrSortedRowPtr, size_t bsrSortedColInd, + int blockDim, size_t info) except? -1: + cdef int pBufferSizeInBytes + _setStream(handle) + with nogil: + status = cusparseSbsrilu02_bufferSize( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, &pBufferSizeInBytes) + check_status(status) + return pBufferSizeInBytes + + cpdef int dbsrilu02_bufferSize(intptr_t handle, int dirA, int mb, int nnzb, + size_t descrA, size_t bsrSortedVal, + size_t bsrSortedRowPtr, size_t bsrSortedColInd, + int blockDim, size_t info) except? -1: + cdef int pBufferSizeInBytes + _setStream(handle) + with nogil: + status = cusparseDbsrilu02_bufferSize( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, &pBufferSizeInBytes) + check_status(status) + return pBufferSizeInBytes + + cpdef int cbsrilu02_bufferSize(intptr_t handle, int dirA, int mb, int nnzb, + size_t descrA, size_t bsrSortedVal, + size_t bsrSortedRowPtr, size_t bsrSortedColInd, + int blockDim, size_t info) except? -1: + cdef int pBufferSizeInBytes + _setStream(handle) + with nogil: + status = cusparseCbsrilu02_bufferSize( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, &pBufferSizeInBytes) + check_status(status) + return pBufferSizeInBytes + + cpdef int zbsrilu02_bufferSize(intptr_t handle, int dirA, int mb, int nnzb, + size_t descrA, size_t bsrSortedVal, + size_t bsrSortedRowPtr, size_t bsrSortedColInd, + int blockDim, size_t info) except? -1: + cdef int pBufferSizeInBytes + _setStream(handle) + with nogil: + status = cusparseZbsrilu02_bufferSize( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, &pBufferSizeInBytes) + check_status(status) + return pBufferSizeInBytes + + cpdef void sbsrilu02_analysis( + intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, + size_t bsrSortedVal, size_t bsrSortedRowPtr, size_t bsrSortedColInd, + int blockDim, size_t info, int policy, size_t pBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseSbsrilu02_analysis( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, policy, + pBuffer) + check_status(status) + + cpdef void dbsrilu02_analysis( + intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, + size_t bsrSortedVal, size_t bsrSortedRowPtr, size_t bsrSortedColInd, + int blockDim, size_t info, int policy, size_t pBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseDbsrilu02_analysis( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, policy, + pBuffer) + check_status(status) + + cpdef void cbsrilu02_analysis( + intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, + size_t bsrSortedVal, size_t bsrSortedRowPtr, size_t bsrSortedColInd, + int blockDim, size_t info, int policy, size_t pBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseCbsrilu02_analysis( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, policy, + pBuffer) + check_status(status) + + cpdef void zbsrilu02_analysis( + intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, + size_t bsrSortedVal, size_t bsrSortedRowPtr, size_t bsrSortedColInd, + int blockDim, size_t info, int policy, size_t pBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseZbsrilu02_analysis( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, policy, + pBuffer) + check_status(status) + + cpdef void sbsrilu02( + intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, + size_t bsrSortedVal, size_t bsrSortedRowPtr, + size_t bsrSortedColInd, int blockDim, size_t info, int policy, + size_t pBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseSbsrilu02( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, policy, + pBuffer) + check_status(status) + + cpdef void dbsrilu02( + intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, + size_t bsrSortedVal, size_t bsrSortedRowPtr, + size_t bsrSortedColInd, int blockDim, size_t info, int policy, + size_t pBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseDbsrilu02( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, policy, + pBuffer) + check_status(status) + + cpdef void cbsrilu02( + intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, + size_t bsrSortedVal, size_t bsrSortedRowPtr, + size_t bsrSortedColInd, int blockDim, size_t info, int policy, + size_t pBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseCbsrilu02( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, policy, + pBuffer) + check_status(status) + + cpdef void zbsrilu02( + intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, + size_t bsrSortedVal, size_t bsrSortedRowPtr, + size_t bsrSortedColInd, int blockDim, size_t info, int policy, + size_t pBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseZbsrilu02( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, policy, + pBuffer) + check_status(status) + + cpdef void xcsric02_zeroPivot( + intptr_t handle, size_t info, size_t position) except *: + _setStream(handle) + with nogil: + status = cusparseXcsric02_zeroPivot( + handle, info, position) + check_status(status) + + cpdef int scsric02_bufferSize(intptr_t handle, int m, int nnz, size_t descrA, + size_t csrSortedValA, size_t csrSortedRowPtrA, + size_t csrSortedColIndA, size_t info) except? -1: + cdef int pBufferSizeInBytes + _setStream(handle) + with nogil: + status = cusparseScsric02_bufferSize( + handle, m, nnz, descrA, + csrSortedValA, csrSortedRowPtrA, + csrSortedColIndA, info, + &pBufferSizeInBytes) + check_status(status) + return pBufferSizeInBytes + + cpdef int dcsric02_bufferSize(intptr_t handle, int m, int nnz, size_t descrA, + size_t csrSortedValA, size_t csrSortedRowPtrA, + size_t csrSortedColIndA, size_t info) except? -1: + cdef int pBufferSizeInBytes + _setStream(handle) + with nogil: + status = cusparseDcsric02_bufferSize( + handle, m, nnz, descrA, + csrSortedValA, csrSortedRowPtrA, + csrSortedColIndA, info, + &pBufferSizeInBytes) + check_status(status) + return pBufferSizeInBytes + + cpdef int ccsric02_bufferSize(intptr_t handle, int m, int nnz, size_t descrA, + size_t csrSortedValA, size_t csrSortedRowPtrA, + size_t csrSortedColIndA, size_t info) except? -1: + cdef int pBufferSizeInBytes + _setStream(handle) + with nogil: + status = cusparseCcsric02_bufferSize( + handle, m, nnz, descrA, + csrSortedValA, csrSortedRowPtrA, + csrSortedColIndA, info, + &pBufferSizeInBytes) + check_status(status) + return pBufferSizeInBytes + + cpdef int zcsric02_bufferSize(intptr_t handle, int m, int nnz, size_t descrA, + size_t csrSortedValA, size_t csrSortedRowPtrA, + size_t csrSortedColIndA, size_t info) except? -1: + cdef int pBufferSizeInBytes + _setStream(handle) + with nogil: + status = cusparseZcsric02_bufferSize( + handle, m, nnz, descrA, + csrSortedValA, csrSortedRowPtrA, + csrSortedColIndA, info, + &pBufferSizeInBytes) + check_status(status) + return pBufferSizeInBytes + + cpdef void scsric02_analysis( + intptr_t handle, int m, int nnz, size_t descrA, + size_t csrSortedValA, size_t csrSortedRowPtrA, + size_t csrSortedColIndA, size_t info, int policy, + size_t pBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseScsric02_analysis( + handle, m, nnz, descrA, + csrSortedValA, csrSortedRowPtrA, + csrSortedColIndA, info, + policy, pBuffer) + check_status(status) + + cpdef void dcsric02_analysis( + intptr_t handle, int m, int nnz, size_t descrA, + size_t csrSortedValA, size_t csrSortedRowPtrA, + size_t csrSortedColIndA, size_t info, int policy, + size_t pBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseDcsric02_analysis( + handle, m, nnz, descrA, + csrSortedValA, csrSortedRowPtrA, + csrSortedColIndA, info, + policy, pBuffer) + check_status(status) + + cpdef void ccsric02_analysis( + intptr_t handle, int m, int nnz, size_t descrA, + size_t csrSortedValA, size_t csrSortedRowPtrA, + size_t csrSortedColIndA, size_t info, int policy, + size_t pBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseCcsric02_analysis( + handle, m, nnz, descrA, + csrSortedValA, csrSortedRowPtrA, + csrSortedColIndA, info, + policy, pBuffer) + check_status(status) + + cpdef void zcsric02_analysis( + intptr_t handle, int m, int nnz, size_t descrA, + size_t csrSortedValA, size_t csrSortedRowPtrA, + size_t csrSortedColIndA, size_t info, int policy, + size_t pBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseZcsric02_analysis( + handle, m, nnz, descrA, + csrSortedValA, + csrSortedRowPtrA, csrSortedColIndA, + info, policy, pBuffer) + check_status(status) + + cpdef void scsric02( + intptr_t handle, int m, int nnz, size_t descrA, + size_t csrSortedValA_valM, size_t csrSortedRowPtrA, + size_t csrSortedColIndA, size_t info, int policy, + size_t pBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseScsric02( + handle, m, nnz, descrA, + csrSortedValA_valM, csrSortedRowPtrA, + csrSortedColIndA, info, + policy, pBuffer) + check_status(status) + + cpdef void dcsric02( + intptr_t handle, int m, int nnz, size_t descrA, + size_t csrSortedValA_valM, size_t csrSortedRowPtrA, + size_t csrSortedColIndA, size_t info, int policy, + size_t pBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseDcsric02( + handle, m, nnz, descrA, + csrSortedValA_valM, csrSortedRowPtrA, + csrSortedColIndA, info, + policy, pBuffer) + check_status(status) + + cpdef void ccsric02( + intptr_t handle, int m, int nnz, size_t descrA, + size_t csrSortedValA_valM, size_t csrSortedRowPtrA, + size_t csrSortedColIndA, size_t info, int policy, + size_t pBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseCcsric02( + handle, m, nnz, descrA, + csrSortedValA_valM, csrSortedRowPtrA, + csrSortedColIndA, info, + policy, pBuffer) + check_status(status) + + cpdef void zcsric02( + intptr_t handle, int m, int nnz, size_t descrA, + size_t csrSortedValA_valM, size_t csrSortedRowPtrA, + size_t csrSortedColIndA, size_t info, int policy, + size_t pBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseZcsric02( + handle, m, nnz, descrA, + csrSortedValA_valM, csrSortedRowPtrA, + csrSortedColIndA, info, + policy, pBuffer) + check_status(status) + + cpdef void xbsric02_zeroPivot( + intptr_t handle, size_t info, size_t position) except *: + _setStream(handle) + with nogil: + status = cusparseXbsric02_zeroPivot( + handle, info, position) + check_status(status) + + cpdef int sbsric02_bufferSize(intptr_t handle, int dirA, int mb, int nnzb, + size_t descrA, size_t bsrSortedVal, + size_t bsrSortedRowPtr, size_t bsrSortedColInd, + int blockDim, size_t info) except? -1: + cdef int pBufferSizeInBytes + _setStream(handle) + with nogil: + status = cusparseSbsric02_bufferSize( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, &pBufferSizeInBytes) + check_status(status) + return pBufferSizeInBytes + + cpdef int dbsric02_bufferSize(intptr_t handle, int dirA, int mb, int nnzb, + size_t descrA, size_t bsrSortedVal, + size_t bsrSortedRowPtr, size_t bsrSortedColInd, + int blockDim, size_t info) except? -1: + cdef int pBufferSizeInBytes + _setStream(handle) + with nogil: + status = cusparseDbsric02_bufferSize( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, &pBufferSizeInBytes) + check_status(status) + return pBufferSizeInBytes + + cpdef int cbsric02_bufferSize(intptr_t handle, int dirA, int mb, int nnzb, + size_t descrA, size_t bsrSortedVal, + size_t bsrSortedRowPtr, size_t bsrSortedColInd, + int blockDim, size_t info) except? -1: + cdef int pBufferSizeInBytes + _setStream(handle) + with nogil: + status = cusparseCbsric02_bufferSize( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, &pBufferSizeInBytes) + check_status(status) + return pBufferSizeInBytes + + cpdef int zbsric02_bufferSize(intptr_t handle, int dirA, int mb, int nnzb, + size_t descrA, size_t bsrSortedVal, + size_t bsrSortedRowPtr, size_t bsrSortedColInd, + int blockDim, size_t info) except? -1: + cdef int pBufferSizeInBytes + _setStream(handle) + with nogil: + status = cusparseZbsric02_bufferSize( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, &pBufferSizeInBytes) + check_status(status) + return pBufferSizeInBytes + + cpdef void sbsric02_analysis( + intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, + size_t bsrSortedVal, size_t bsrSortedRowPtr, size_t bsrSortedColInd, + int blockDim, size_t info, int policy, size_t pInputBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseSbsric02_analysis( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, policy, + pInputBuffer) + check_status(status) + + cpdef void dbsric02_analysis( + intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, + size_t bsrSortedVal, size_t bsrSortedRowPtr, size_t bsrSortedColInd, + int blockDim, size_t info, int policy, size_t pInputBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseDbsric02_analysis( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, policy, + pInputBuffer) + check_status(status) + + cpdef void cbsric02_analysis( + intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, + size_t bsrSortedVal, size_t bsrSortedRowPtr, size_t bsrSortedColInd, + int blockDim, size_t info, int policy, size_t pInputBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseCbsric02_analysis( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, policy, + pInputBuffer) + check_status(status) + + cpdef void zbsric02_analysis( + intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, + size_t bsrSortedVal, size_t bsrSortedRowPtr, size_t bsrSortedColInd, + int blockDim, size_t info, int policy, size_t pInputBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseZbsric02_analysis( + handle, dirA, mb, nnzb, + descrA, + bsrSortedVal, bsrSortedRowPtr, + bsrSortedColInd, blockDim, info, + policy, pInputBuffer) + check_status(status) + + cpdef void sbsric02( + intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, + size_t bsrSortedVal, size_t bsrSortedRowPtr, + size_t bsrSortedColInd, int blockDim, size_t info, int policy, + size_t pBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseSbsric02( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, policy, pBuffer) + check_status(status) + + cpdef void dbsric02( + intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, + size_t bsrSortedVal, size_t bsrSortedRowPtr, + size_t bsrSortedColInd, int blockDim, size_t info, int policy, + size_t pBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseDbsric02( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, policy, pBuffer) + check_status(status) + + cpdef void cbsric02( + intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, + size_t bsrSortedVal, size_t bsrSortedRowPtr, + size_t bsrSortedColInd, int blockDim, size_t info, int policy, + size_t pBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseCbsric02( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, policy, pBuffer) + check_status(status) + + cpdef void zbsric02( + intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, + size_t bsrSortedVal, size_t bsrSortedRowPtr, + size_t bsrSortedColInd, int blockDim, size_t info, int policy, + size_t pBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseZbsric02( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, policy, pBuffer) + check_status(status) + + cpdef size_t sgtsv2_bufferSizeExt( + intptr_t handle, int m, int n, size_t dl, size_t d, + size_t du, size_t B, int ldb) except? -1: + cdef size_t bufferSizeInBytes + _setStream(handle) + with nogil: + status = cusparseSgtsv2_bufferSizeExt( + handle, m, n, dl, d, + du, B, ldb, &bufferSizeInBytes) + check_status(status) + return bufferSizeInBytes + + cpdef size_t dgtsv2_bufferSizeExt( + intptr_t handle, int m, int n, size_t dl, size_t d, + size_t du, size_t B, int ldb) except? -1: + cdef size_t bufferSizeInBytes + _setStream(handle) + with nogil: + status = cusparseDgtsv2_bufferSizeExt( + handle, m, n, dl, + d, du, B, ldb, + &bufferSizeInBytes) + check_status(status) + return bufferSizeInBytes + + cpdef size_t cgtsv2_bufferSizeExt( + intptr_t handle, int m, int n, size_t dl, size_t d, + size_t du, size_t B, int ldb) except? -1: + cdef size_t bufferSizeInBytes + _setStream(handle) + with nogil: + status = cusparseCgtsv2_bufferSizeExt( + handle, m, n, dl, + d, du, B, + ldb, &bufferSizeInBytes) + check_status(status) + return bufferSizeInBytes + + cpdef size_t zgtsv2_bufferSizeExt( + intptr_t handle, int m, int n, size_t dl, size_t d, + size_t du, size_t B, int ldb) except? -1: + cdef size_t bufferSizeInBytes + _setStream(handle) + with nogil: + status = cusparseZgtsv2_bufferSizeExt( + handle, m, n, dl, + d, du, + B, ldb, &bufferSizeInBytes) + check_status(status) + return bufferSizeInBytes + + cpdef void sgtsv2( + intptr_t handle, int m, int n, size_t dl, size_t d, size_t du, + size_t B, int ldb, size_t pBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseSgtsv2( + handle, m, n, dl, d, + du, B, ldb, pBuffer) + check_status(status) + + cpdef void dgtsv2( + intptr_t handle, int m, int n, size_t dl, size_t d, size_t du, + size_t B, int ldb, size_t pBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseDgtsv2(handle, m, n, + dl, d, + du, B, ldb, + pBuffer) + check_status(status) + + cpdef void cgtsv2( + intptr_t handle, int m, int n, size_t dl, size_t d, size_t du, + size_t B, int ldb, size_t pBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseCgtsv2(handle, m, n, + dl, d, + du, B, ldb, + pBuffer) + check_status(status) + + cpdef void zgtsv2( + intptr_t handle, int m, int n, size_t dl, size_t d, size_t du, + size_t B, int ldb, size_t pBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseZgtsv2( + handle, m, n, dl, + d, du, + B, ldb, pBuffer) + check_status(status) + + cpdef size_t sgtsv2_nopivot_bufferSizeExt( + intptr_t handle, int m, int n, size_t dl, + size_t d, size_t du, size_t B, int ldb) except? -1: + cdef size_t pBufferSizeInBytes + _setStream(handle) + with nogil: + status = cusparseSgtsv2_nopivot_bufferSizeExt( + handle, m, n, dl, d, + du, B, ldb, &pBufferSizeInBytes) + check_status(status) + return pBufferSizeInBytes + + cpdef size_t dgtsv2_nopivot_bufferSizeExt( + intptr_t handle, int m, int n, size_t dl, + size_t d, size_t du, size_t B, int ldb) except? -1: + cdef size_t pBufferSizeInBytes + _setStream(handle) + with nogil: + status = cusparseDgtsv2_nopivot_bufferSizeExt( + handle, m, n, dl, + d, du, B, ldb, + &pBufferSizeInBytes) + check_status(status) + return pBufferSizeInBytes + + cpdef size_t cgtsv2_nopivot_bufferSizeExt( + intptr_t handle, int m, int n, size_t dl, + size_t d, size_t du, size_t B, int ldb) except? -1: + cdef size_t pBufferSizeInBytes + _setStream(handle) + with nogil: + status = cusparseCgtsv2_nopivot_bufferSizeExt( + handle, m, n, dl, + d, du, B, + ldb, &pBufferSizeInBytes) + check_status(status) + return pBufferSizeInBytes + + cpdef size_t zgtsv2_nopivot_bufferSizeExt( + intptr_t handle, int m, int n, size_t dl, + size_t d, size_t du, size_t B, int ldb) except? -1: + cdef size_t pBufferSizeInBytes + _setStream(handle) + with nogil: + status = cusparseZgtsv2_nopivot_bufferSizeExt( + handle, m, n, dl, + d, du, + B, ldb, &pBufferSizeInBytes) + check_status(status) + return pBufferSizeInBytes + + cpdef void sgtsv2_nopivot( + intptr_t handle, int m, int n, size_t dl, size_t d, + size_t du, size_t B, int ldb, size_t pBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseSgtsv2_nopivot( + handle, m, n, dl, d, + du, B, ldb, pBuffer) + check_status(status) + + cpdef void dgtsv2_nopivot( + intptr_t handle, int m, int n, size_t dl, size_t d, + size_t du, size_t B, int ldb, size_t pBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseDgtsv2_nopivot(handle, m, n, + dl, d, + du, B, ldb, + pBuffer) + check_status(status) + + cpdef void cgtsv2_nopivot( + intptr_t handle, int m, int n, size_t dl, size_t d, + size_t du, size_t B, int ldb, size_t pBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseCgtsv2_nopivot( + handle, m, n, dl, + d, du, B, ldb, + pBuffer) + check_status(status) + + cpdef void zgtsv2_nopivot( + intptr_t handle, int m, int n, size_t dl, size_t d, + size_t du, size_t B, int ldb, size_t pBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseZgtsv2_nopivot( + handle, m, n, dl, + d, du, + B, ldb, pBuffer) + check_status(status) + + cpdef size_t sgtsv2StridedBatch_bufferSizeExt( + intptr_t handle, int m, size_t dl, size_t d, size_t du, size_t x, + int batchCount, int batchStride) except? -1: + cdef size_t bufferSizeInBytes + _setStream(handle) + with nogil: + status = cusparseSgtsv2StridedBatch_bufferSizeExt( + handle, m, dl, d, + du, x, batchCount, batchStride, + &bufferSizeInBytes) + check_status(status) + return bufferSizeInBytes + + cpdef size_t dgtsv2StridedBatch_bufferSizeExt( + intptr_t handle, int m, size_t dl, size_t d, size_t du, size_t x, + int batchCount, int batchStride): + cdef size_t bufferSizeInBytes + _setStream(handle) + with nogil: + status = cusparseDgtsv2StridedBatch_bufferSizeExt( + handle, m, dl, d, + du, x, batchCount, batchStride, + &bufferSizeInBytes) + check_status(status) + return bufferSizeInBytes + + cpdef size_t cgtsv2StridedBatch_bufferSizeExt( + intptr_t handle, int m, size_t dl, size_t d, size_t du, size_t x, + int batchCount, int batchStride) except? -1: + cdef size_t bufferSizeInBytes + _setStream(handle) + with nogil: + status = cusparseCgtsv2StridedBatch_bufferSizeExt( + handle, m, dl, + d, du, x, + batchCount, batchStride, &bufferSizeInBytes) + check_status(status) + return bufferSizeInBytes + + cpdef size_t zgtsv2StridedBatch_bufferSizeExt( + intptr_t handle, int m, size_t dl, size_t d, size_t du, size_t x, + int batchCount, int batchStride) except? -1: + cdef size_t bufferSizeInBytes + _setStream(handle) + with nogil: + status = cusparseZgtsv2StridedBatch_bufferSizeExt( + handle, m, dl, + d, du, + x, batchCount, batchStride, + &bufferSizeInBytes) + check_status(status) + return bufferSizeInBytes + + cpdef void sgtsv2StridedBatch( + intptr_t handle, int m, size_t dl, size_t d, + size_t du, size_t x, int batchCount, int batchStride, + size_t pBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseSgtsv2StridedBatch( + handle, m, dl, d, + du, x, batchCount, batchStride, + pBuffer) + check_status(status) + + cpdef void dgtsv2StridedBatch( + intptr_t handle, int m, size_t dl, size_t d, + size_t du, size_t x, int batchCount, int batchStride, + size_t pBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseDgtsv2StridedBatch( + handle, m, dl, d, + du, x, batchCount, batchStride, + pBuffer) + check_status(status) + + cpdef void cgtsv2StridedBatch( + intptr_t handle, int m, size_t dl, size_t d, + size_t du, size_t x, int batchCount, int batchStride, + size_t pBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseCgtsv2StridedBatch( + handle, m, dl, + d, du, x, + batchCount, batchStride, pBuffer) + check_status(status) + + cpdef void zgtsv2StridedBatch( + intptr_t handle, int m, size_t dl, size_t d, + size_t du, size_t x, int batchCount, int batchStride, + size_t pBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseZgtsv2StridedBatch( + handle, m, dl, + d, du, + x, batchCount, batchStride, pBuffer) + check_status(status) + + cpdef size_t sgtsvInterleavedBatch_bufferSizeExt( + intptr_t handle, int algo, int m, size_t dl, size_t d, size_t du, + size_t x, int batchCount) except? -1: + cdef size_t pBufferSizeInBytes + _setStream(handle) + with nogil: + status = cusparseSgtsvInterleavedBatch_bufferSizeExt( + handle, algo, m, dl, + d, du, x, batchCount, + &pBufferSizeInBytes) + check_status(status) + return pBufferSizeInBytes + + cpdef size_t dgtsvInterleavedBatch_bufferSizeExt( + intptr_t handle, int algo, int m, size_t dl, size_t d, size_t du, + size_t x, int batchCount) except? -1: + cdef size_t pBufferSizeInBytes + _setStream(handle) + with nogil: + status = cusparseDgtsvInterleavedBatch_bufferSizeExt( + handle, algo, m, dl, + d, du, x, batchCount, + &pBufferSizeInBytes) + check_status(status) + return pBufferSizeInBytes + + cpdef size_t cgtsvInterleavedBatch_bufferSizeExt( + intptr_t handle, int algo, int m, size_t dl, size_t d, size_t du, + size_t x, int batchCount) except? -1: + cdef size_t pBufferSizeInBytes + _setStream(handle) + with nogil: + status = cusparseCgtsvInterleavedBatch_bufferSizeExt( + handle, algo, m, dl, + d, du, x, + batchCount, &pBufferSizeInBytes) + check_status(status) + return pBufferSizeInBytes + + cpdef size_t zgtsvInterleavedBatch_bufferSizeExt( + intptr_t handle, int algo, int m, size_t dl, size_t d, size_t du, + size_t x, int batchCount) except? -1: + cdef size_t pBufferSizeInBytes + _setStream(handle) + with nogil: + status = cusparseZgtsvInterleavedBatch_bufferSizeExt( + handle, algo, m, dl, + d, du, + x, batchCount, &pBufferSizeInBytes) + check_status(status) + return pBufferSizeInBytes + + cpdef void sgtsvInterleavedBatch( + intptr_t handle, int algo, int m, size_t dl, + size_t d, size_t du, size_t x, int batchCount, + size_t pBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseSgtsvInterleavedBatch( + handle, algo, m, dl, d, + du, x, batchCount, pBuffer) + check_status(status) + + cpdef void dgtsvInterleavedBatch( + intptr_t handle, int algo, int m, size_t dl, + size_t d, size_t du, size_t x, int batchCount, + size_t pBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseDgtsvInterleavedBatch( + handle, algo, m, dl, d, + du, x, batchCount, pBuffer) + check_status(status) + + cpdef void cgtsvInterleavedBatch( + intptr_t handle, int algo, int m, size_t dl, + size_t d, size_t du, size_t x, int batchCount, + size_t pBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseCgtsvInterleavedBatch( + handle, algo, m, dl, d, + du, x, batchCount, pBuffer) + check_status(status) + + cpdef void zgtsvInterleavedBatch( + intptr_t handle, int algo, int m, size_t dl, + size_t d, size_t du, size_t x, int batchCount, + size_t pBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseZgtsvInterleavedBatch( + handle, algo, m, dl, + d, du, x, + batchCount, pBuffer) + check_status(status) + + cpdef size_t sgpsvInterleavedBatch_bufferSizeExt( + intptr_t handle, int algo, int m, size_t ds, size_t dl, size_t d, + size_t du, size_t dw, size_t x, int batchCount) except? -1: + cdef size_t pBufferSizeInBytes + _setStream(handle) + with nogil: + status = cusparseSgpsvInterleavedBatch_bufferSizeExt( + handle, algo, m, ds, + dl, d, du, + dw, x, batchCount, &pBufferSizeInBytes) + check_status(status) + return pBufferSizeInBytes + + cpdef size_t dgpsvInterleavedBatch_bufferSizeExt( + intptr_t handle, int algo, int m, size_t ds, size_t dl, size_t d, + size_t du, size_t dw, size_t x, int batchCount) except? -1: + cdef size_t pBufferSizeInBytes + _setStream(handle) + with nogil: + status = cusparseDgpsvInterleavedBatch_bufferSizeExt( + handle, algo, m, ds, + dl, d, du, + dw, x, batchCount, + &pBufferSizeInBytes) + check_status(status) + return pBufferSizeInBytes + + cpdef size_t cgpsvInterleavedBatch_bufferSizeExt( + intptr_t handle, int algo, int m, size_t ds, size_t dl, size_t d, + size_t du, size_t dw, size_t x, int batchCount) except? -1: + cdef size_t pBufferSizeInBytes + _setStream(handle) + with nogil: + status = cusparseCgpsvInterleavedBatch_bufferSizeExt( + handle, algo, m, ds, + dl, d, du, + dw, x, batchCount, + &pBufferSizeInBytes) + check_status(status) + return pBufferSizeInBytes + + cpdef size_t zgpsvInterleavedBatch_bufferSizeExt( + intptr_t handle, int algo, int m, size_t ds, size_t dl, size_t d, + size_t du, size_t dw, size_t x, int batchCount) except? -1: + cdef size_t pBufferSizeInBytes + _setStream(handle) + with nogil: + status = cusparseZgpsvInterleavedBatch_bufferSizeExt( + handle, algo, m, ds, + dl, d, + du, dw, + x, batchCount, &pBufferSizeInBytes) + check_status(status) + return pBufferSizeInBytes + + cpdef void sgpsvInterleavedBatch( + intptr_t handle, int algo, int m, size_t ds, + size_t dl, size_t d, size_t du, size_t dw, + size_t x, int batchCount, size_t pBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseSgpsvInterleavedBatch( + handle, algo, m, ds, dl, + d, du, dw, x, batchCount, + pBuffer) + check_status(status) + + cpdef void dgpsvInterleavedBatch( + intptr_t handle, int algo, int m, size_t ds, + size_t dl, size_t d, size_t du, size_t dw, + size_t x, int batchCount, size_t pBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseDgpsvInterleavedBatch( + handle, algo, m, ds, dl, + d, du, dw, x, batchCount, + pBuffer) + check_status(status) + + cpdef void cgpsvInterleavedBatch( + intptr_t handle, int algo, int m, size_t ds, + size_t dl, size_t d, size_t du, size_t dw, + size_t x, int batchCount, size_t pBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseCgpsvInterleavedBatch( + handle, algo, m, ds, dl, + d, du, dw, x, + batchCount, pBuffer) + check_status(status) + + cpdef void zgpsvInterleavedBatch( + intptr_t handle, int algo, int m, size_t ds, + size_t dl, size_t d, size_t du, size_t dw, + size_t x, int batchCount, size_t pBuffer) except *: + _setStream(handle) + with nogil: + status = cusparseZgpsvInterleavedBatch( + handle, algo, m, ds, + dl, d, du, + dw, x, batchCount, + pBuffer) + check_status(status) + + ############################################################ + # Sparse Vector APIs + + cpdef size_t createSpVec(int64_t size, int64_t nnz, intptr_t indices, + intptr_t values, IndexType idxType, IndexBase idxBase, + DataType valueType) except? -1: + cdef SpVecDescr desc + status = cusparseCreateSpVec(&desc, size, nnz, indices, + values, idxType, idxBase, valueType) + check_status(status) + return desc + + cpdef void destroySpVec(size_t desc) except *: + status = cusparseDestroySpVec(desc) + check_status(status) + + cpdef SpVecAttributes spVecGet(size_t desc): + cdef int64_t size, nnz + cdef intptr_t indices, values + cdef IndexType idxType + cdef IndexBase idxBase + cdef DataType valueType + status = cusparseSpVecGet(desc, &size, &nnz, + &indices, &values, + &idxType, &idxBase, &valueType) + check_status(status) + return SpVecAttributes(size, nnz, indices, values, idxType, idxBase, + valueType) + + cpdef int spVecGetIndexBase(size_t desc) except? -1: + cdef IndexBase idxBase + status = cusparseSpVecGetIndexBase(desc, &idxBase) + check_status(status) + return idxBase + + cpdef intptr_t spVecGetValues(size_t desc) except? -1: + cdef intptr_t values + status = cusparseSpVecGetValues(desc, &values) + check_status(status) + return values + + cpdef void spVecSetValues(size_t desc, intptr_t values) except *: + status = cusparseSpVecSetValues(desc, values) + check_status(status) + + ############################################################ + # Sparse Matrix APIs + + cpdef size_t createCoo(int64_t rows, int64_t cols, int64_t nnz, + intptr_t cooRowInd, intptr_t cooColInd, + intptr_t cooValues, IndexType cooIdxType, + IndexBase idxBase, DataType valueType) except? -1: + cdef SpMatDescr desc + status = cusparseCreateCoo(&desc, rows, cols, nnz, cooRowInd, + cooColInd, cooValues, + cooIdxType, idxBase, valueType) + check_status(status) + return desc + + cpdef size_t createCooAoS(int64_t rows, int64_t cols, int64_t nnz, + intptr_t cooInd, intptr_t cooValues, + IndexType cooIdxType, IndexBase idxBase, + DataType valueType) except? -1: + cdef SpMatDescr desc + status = cusparseCreateCooAoS(&desc, rows, cols, nnz, cooInd, + cooValues, cooIdxType, idxBase, + valueType) + check_status(status) + return desc + + cpdef size_t createCsr(int64_t rows, int64_t cols, int64_t nnz, + intptr_t csrRowOffsets, intptr_t csrColind, + intptr_t csrValues, IndexType csrRowOffsetsType, + IndexType csrColIndType, IndexBase idxBase, + DataType valueType) except? -1: + cdef SpMatDescr desc + status = cusparseCreateCsr(&desc, rows, cols, nnz, + csrRowOffsets, csrColind, + csrValues, csrRowOffsetsType, + csrColIndType, idxBase, valueType) + check_status(status) + return desc + + cpdef size_t createCsc(int64_t rows, int64_t cols, int64_t nnz, + intptr_t cscColOffsets, intptr_t cscRowInd, + intptr_t cscValues, IndexType cscColOffsetsType, + IndexType cscRowIndType, IndexBase idxBase, + DataType valueType) except? -1: + cdef SpMatDescr desc + status = cusparseCreateCsc(&desc, rows, cols, nnz, + cscColOffsets, cscRowInd, + cscValues, cscColOffsetsType, + cscRowIndType, idxBase, valueType) + check_status(status) + return desc + + cpdef void destroySpMat(size_t desc) except *: + status = cusparseDestroySpMat(desc) + check_status(status) + + cpdef CooAttributes cooGet(size_t desc): + cdef int64_t rows, cols, nnz + cdef intptr_t rowInd, colInd, values, + cdef IndexType idxType, + cdef IndexBase idxBase, + cdef DataType valueType + status = cusparseCooGet(desc, &rows, &cols, &nnz, + &rowInd, &colInd, &values, + &idxType, &idxBase, &valueType) + check_status(status) + return CooAttributes(rows, cols, nnz, rowInd, colInd, values, + idxType, idxBase, valueType) + + cpdef CooAoSAttributes cooAoSGet(size_t desc): + cdef int64_t rows, cols, nnz + cdef intptr_t ind, values, + cdef IndexType idxType, + cdef IndexBase idxBase, + cdef DataType valueType + status = cusparseCooAoSGet(desc, &rows, &cols, &nnz, + &ind, &values, + &idxType, &idxBase, &valueType) + check_status(status) + return CooAoSAttributes(rows, cols, nnz, ind, values, + idxType, idxBase, valueType) + + cpdef CsrAttributes csrGet(size_t desc): + cdef int64_t rows, cols, nnz + cdef intptr_t rowOffsets, colInd, values, + cdef IndexType rowOffsetsType, colIndType + cdef IndexBase idxBase + cdef DataType valueType + status = cusparseCsrGet(desc, &rows, &cols, &nnz, + &rowOffsets, &colInd, + &values, &rowOffsetsType, &colIndType, + &idxBase, &valueType) + check_status(status) + return CsrAttributes(rows, cols, nnz, rowOffsets, colInd, values, + rowOffsetsType, colIndType, idxBase, valueType) + + cpdef void csrSetPointers( + size_t desc, size_t csrRowOffsets, size_t csrColInd, + size_t csrValues) except *: + status = cusparseCsrSetPointers(desc, csrRowOffsets, + csrColInd, csrValues) + check_status(status) + + cpdef int spMatGetFormat(size_t desc) except? -1: + cdef Format format + status = cusparseSpMatGetFormat(desc, &format) + check_status(status) + return format + + cpdef int spMatGetIndexBase(size_t desc) except? -1: + cdef IndexBase idxBase + status = cusparseSpMatGetIndexBase(desc, &idxBase) + check_status(status) + return idxBase + + cpdef intptr_t spMatGetValues(size_t desc) except? -1: + cdef intptr_t values + status = cusparseSpMatGetValues(desc, &values) + check_status(status) + return values + + cpdef void spMatSetValues(size_t desc, intptr_t values) except *: + status = cusparseSpMatSetValues(desc, values) + check_status(status) + + cpdef void spMatGetSize( + size_t desc, size_t rows, size_t cols, size_t nnz) except *: + status = cusparseSpMatGetSize(desc, rows, + cols, nnz) + check_status(status) + + cpdef int spMatGetStridedBatch(size_t desc) except? -1: + cdef int batchCount + status = cusparseSpMatGetStridedBatch(desc, &batchCount) + check_status(status) + return batchCount + + cpdef void spMatSetStridedBatch(size_t desc, int batchCount) except *: + status = cusparseSpMatSetStridedBatch(desc, batchCount) + check_status(status) + + ############################################################ + # Dense Vector APIs + + cpdef size_t createDnVec(int64_t size, intptr_t values, + DataType valueType) except? -1: + cdef DnVecDescr desc + status = cusparseCreateDnVec(&desc, size, values, valueType) + check_status(status) + return desc + + cpdef void destroyDnVec(size_t desc) except *: + status = cusparseDestroyDnVec(desc) + check_status(status) + + cpdef DnVecAttributes dnVecGet(size_t desc): + cdef int64_t size + cdef intptr_t values + cdef DataType valueType + status = cusparseDnVecGet(desc, &size, &values, + &valueType) + check_status(status) + return DnVecAttributes(size, values, valueType) + + cpdef intptr_t dnVecGetValues(size_t desc) except? -1: + cdef intptr_t values + status = cusparseDnVecGetValues(desc, &values) + check_status(status) + return values + + cpdef void dnVecSetValues(size_t desc, intptr_t values) except *: + status = cusparseDnVecSetValues(desc, values) + check_status(status) + + ############################################################ + # Dense Matrix APIs + + cpdef size_t createDnMat(int64_t rows, int64_t cols, int64_t ld, + intptr_t values, DataType valueType, + Order order) except? -1: + cdef DnMatDescr desc + status = cusparseCreateDnMat(&desc, rows, cols, ld, values, + valueType, order) + check_status(status) + return desc + + cpdef void destroyDnMat(size_t desc) except *: + status = cusparseDestroyDnMat(desc) + check_status(status) + + cpdef DnMatAttributes dnMatGet(size_t desc): + cdef int64_t rows, cols, ld + cdef intptr_t values, + cdef DataType valueType + cdef Order order + status = cusparseDnMatGet(desc, &rows, &cols, &ld, + &values, &valueType, &order) + check_status(status) + return DnMatAttributes(rows, cols, ld, values, valueType, order) + + cpdef intptr_t dnMatGetValues(size_t desc) except? -1: + cdef intptr_t values + status = cusparseDnMatGetValues(desc, &values) + check_status(status) + return values + + cpdef void dnMatSetValues(size_t desc, intptr_t values) except *: + status = cusparseDnMatSetValues(desc, values) + check_status(status) + + cpdef DnMatBatchAttributes dnMatGetStridedBatch(size_t desc): + cdef int batchCount + cdef int64_t batchStride + status = cusparseDnMatGetStridedBatch(desc, &batchCount, + &batchStride) + check_status(status) + return DnMatBatchAttributes(batchCount, batchStride) + + cpdef void dnMatSetStridedBatch( + size_t desc, int batchCount, int64_t batchStride) except *: + status = cusparseDnMatSetStridedBatch(desc, batchCount, + batchStride) + check_status(status) + + ############################################################ + # Generic API Functions + + cpdef size_t spVV_bufferSize(intptr_t handle, Operation opX, + size_t vecX, size_t vecY, + intptr_t result, DataType computeType) except? -1: + cdef size_t bufferSize + status = cusparseSpVV_bufferSize(handle, opX, + vecX, vecY, + result, computeType, &bufferSize) + check_status(status) + return bufferSize + + cpdef void spVV( + intptr_t handle, Operation opX, size_t vecX, size_t vecY, + intptr_t result, DataType computeType, + intptr_t externalBuffer) except *: + _setStream(handle) + status = cusparseSpVV(handle, opX, vecX, + vecY, result, computeType, + externalBuffer) + check_status(status) + + cpdef size_t spMV_bufferSize(intptr_t handle, Operation opA, intptr_t alpha, + size_t matA, size_t vecX, intptr_t beta, + size_t vecY, DataType computeType, + SpMVAlg alg) except? -1: + cdef size_t bufferSize + status = cusparseSpMV_bufferSize(handle, opA, alpha, + matA, vecX, + beta, vecY, + computeType, alg, &bufferSize) + check_status(status) + return bufferSize + + cpdef void spMV( + intptr_t handle, Operation opA, intptr_t alpha, size_t matA, + size_t vecX, intptr_t beta, size_t vecY, DataType computeType, + SpMVAlg alg, intptr_t externalBuffer) except *: + _setStream(handle) + status = cusparseSpMV(handle, opA, alpha, matA, + vecX, beta, vecY, + computeType, alg, externalBuffer) + check_status(status) + + cpdef size_t spSM_createDescr() except? -1: + cdef SpSMDescr descr + status = cusparseSpSM_createDescr(&descr) + check_status(status) + return descr + + cpdef void spSM_destroyDescr(size_t descr) except *: + status = cusparseSpSM_destroyDescr(descr) + check_status(status) + + cpdef size_t spSM_bufferSize(intptr_t handle, Operation opA, Operation opB, + intptr_t alpha, size_t matA, size_t matB, + size_t matC, DataType computeType, SpSMAlg alg, + size_t spsmDescr) except? -1: + cdef size_t bufferSize + status = cusparseSpSM_bufferSize(handle, opA, opB, alpha, + matA, matB, + matC, computeType, alg, + spsmDescr, &bufferSize) + check_status(status) + return bufferSize + + cpdef void spSM_analysis( + intptr_t handle, Operation opA, Operation opB, + intptr_t alpha, size_t matA, size_t matB, size_t matC, + DataType computeType, SpSMAlg alg, size_t spsmDescr, + intptr_t externalBuffer) except *: + _setStream(handle) + status = cusparseSpSM_analysis( handle, opA, opB, alpha, + matA, matB, + matC, computeType, alg, + spsmDescr, externalBuffer) + check_status(status) + + cpdef void spSM_solve( + intptr_t handle, Operation opA, Operation opB, intptr_t alpha, + size_t matA, size_t matB, size_t matC, DataType computeType, + SpSMAlg alg, size_t spsmDescr, intptr_t externalBuffer=0) except *: + _setStream(handle) + IF CUPY_HIP_VERSION > 0: + # hipsparseSpSM_solve has the extra `externalBuffer` parameter that + # cusparseSpSM_solve does not require. + status = cusparseSpSM_solve( handle, opA, opB, alpha, + matA, matB, + matC, computeType, alg, + spsmDescr, + externalBuffer) + ELSE: + status = cusparseSpSM_solve( handle, opA, opB, alpha, + matA, matB, + matC, computeType, alg, + spsmDescr) + check_status(status) + + cpdef size_t spMM_bufferSize(intptr_t handle, Operation opA, Operation opB, + intptr_t alpha, size_t matA, size_t matB, + intptr_t beta, size_t matC, DataType computeType, + SpMMAlg alg) except? -1: + cdef size_t bufferSize + status = cusparseSpMM_bufferSize(handle, opA, opB, alpha, + matA, matB, + beta, matC, + computeType, alg, &bufferSize) + check_status(status) + return bufferSize + + cpdef void spMM( + intptr_t handle, Operation opA, Operation opB, intptr_t alpha, + size_t matA, size_t matB, intptr_t beta, size_t matC, + DataType computeType, SpMMAlg alg, intptr_t externalBuffer) except *: + _setStream(handle) + status = cusparseSpMM(handle, opA, opB, alpha, + matA, matB, beta, + matC, computeType, alg, + externalBuffer) + check_status(status) + + cpdef size_t constrainedGeMM_bufferSize(intptr_t handle, Operation opA, + Operation opB, intptr_t alpha, + size_t matA, size_t matB, + intptr_t beta, size_t matC, + DataType computeType) except? -1: + cdef size_t bufferSize + status = cusparseConstrainedGeMM_bufferSize( + handle, opA, opB, alpha, matA, + matB, beta, matC, computeType, + &bufferSize) + check_status(status) + return bufferSize + + cpdef void constrainedGeMM( + intptr_t handle, Operation opA, Operation opB, + intptr_t alpha, size_t matA, size_t matB, intptr_t beta, + size_t matC, DataType computeType, + intptr_t externalBuffer) except *: + _setStream(handle) + status = cusparseConstrainedGeMM( + handle, opA, opB, alpha, matA, + matB, beta, matC, computeType, + externalBuffer) + check_status(status) + + cpdef size_t spGEMM_createDescr() except? -1: + cdef SpGEMMDescr descr + status = cusparseSpGEMM_createDescr(&descr) + check_status(status) + return descr + + cpdef void spGEMM_destroyDescr(size_t descr) except *: + status = cusparseSpGEMM_destroyDescr(descr) + check_status(status) + + cpdef size_t spGEMM_workEstimation( + intptr_t handle, Operation opA, Operation opB, intptr_t alpha, + size_t matA, size_t matB, intptr_t beta, size_t matC, + DataType computeType, int alg, size_t spgemmDescr, + size_t bufferSize, intptr_t externalBuffer1) except? -1: + cdef size_t bufferSize1 = bufferSize + status = cusparseSpGEMM_workEstimation( + handle, opA, opB, alpha, matA, + matB, beta, matC, computeType, + alg, spgemmDescr, &bufferSize1, + externalBuffer1) + check_status(status) + return bufferSize1 + + cpdef size_t spGEMM_compute( + intptr_t handle, Operation opA, Operation opB, intptr_t alpha, + size_t matA, size_t matB, intptr_t beta, size_t matC, + DataType computeType, int alg, size_t spgemmDescr, + size_t bufferSize, intptr_t externalBuffer2) except? -1: + cdef size_t bufferSize2 = bufferSize + status = cusparseSpGEMM_compute( + handle, opA, opB, alpha, matA, + matB, beta, matC, computeType, + alg, spgemmDescr, &bufferSize2, + externalBuffer2) + check_status(status) + return bufferSize2 + + cpdef void spGEMM_copy( + intptr_t handle, Operation opA, Operation opB, intptr_t alpha, + size_t matA, size_t matB, intptr_t beta, size_t matC, + DataType computeType, int alg, size_t spgemmDescr) except *: + status = cusparseSpGEMM_copy( + handle, opA, opB, alpha, matA, + matB, beta, matC, computeType, + alg, spgemmDescr) + check_status(status) + + cpdef void gather(intptr_t handle, size_t vecY, size_t vecX) except *: + status = cusparseGather(handle, vecY, vecX) + check_status(status) + + cpdef size_t sparseToDense_bufferSize(intptr_t handle, size_t matA, + size_t matB, int alg) except? -1: + cdef size_t bufferSize + status = cusparseSparseToDense_bufferSize( + handle, matA, matB, + alg, &bufferSize) + check_status(status) + return bufferSize + + cpdef void sparseToDense( + intptr_t handle, size_t matA, size_t matB, int alg, + intptr_t buffer) except *: + _setStream(handle) + status = cusparseSparseToDense( + handle, matA, matB, + alg, buffer) + check_status(status) + + cpdef size_t denseToSparse_bufferSize(intptr_t handle, size_t matA, + size_t matB, int alg) except? -1: + cdef size_t bufferSize + status = cusparseDenseToSparse_bufferSize( + handle, matA, matB, + alg, &bufferSize) + check_status(status) + return bufferSize + + cpdef void denseToSparse_analysis( + intptr_t handle, size_t matA, size_t matB, + int alg, intptr_t buffer) except *: + _setStream(handle) + status = cusparseDenseToSparse_analysis( + handle, matA, matB, + alg, buffer) + check_status(status) + + cpdef void denseToSparse_convert( + intptr_t handle, size_t matA, size_t matB, + int alg, intptr_t buffer) except *: + _setStream(handle) + status = cusparseDenseToSparse_convert( + handle, matA, matB, + alg, buffer) + check_status(status) + + # CSR2CSC + cpdef size_t csr2cscEx2_bufferSize( + intptr_t handle, int m, int n, int nnz, intptr_t csrVal, + intptr_t csrRowPtr, intptr_t csrColInd, intptr_t cscVal, + intptr_t cscColPtr, intptr_t cscRowInd, DataType valType, + Action copyValues, IndexBase idxBase, Csr2CscAlg alg) except? -1: + cdef size_t bufferSize + status = cusparseCsr2cscEx2_bufferSize( + handle, m, n, nnz, csrVal, csrRowPtr, + csrColInd, cscVal, cscColPtr, cscRowInd, + valType, copyValues, idxBase, alg, &bufferSize) + check_status(status) + return bufferSize + + cpdef void csr2cscEx2( + intptr_t handle, int m, int n, int nnz, intptr_t csrVal, + intptr_t csrRowPtr, intptr_t csrColInd, intptr_t cscVal, + intptr_t cscColPtr, intptr_t cscRowInd, DataType valType, + Action copyValues, IndexBase idxBase, Csr2CscAlg alg, + intptr_t buffer) except *: + setStream(handle, stream_module.get_current_stream_ptr()) + status = cusparseCsr2cscEx2( + handle, m, n, nnz, csrVal, csrRowPtr, + csrColInd, cscVal, cscColPtr, cscRowInd, + valType, copyValues, idxBase, alg, buffer) + check_status(status) From fb75777bab3b9cbbb1fa233fd119bfeedb72fb00 Mon Sep 17 00:00:00 2001 From: bmedishe Date: Wed, 24 Apr 2024 19:40:30 +0000 Subject: [PATCH 03/30] update cusparse.pxd --- cupy_backends/cuda/libs/cusparse.pxd | 437 +++++++++++++-------------- 1 file changed, 218 insertions(+), 219 deletions(-) diff --git a/cupy_backends/cuda/libs/cusparse.pxd b/cupy_backends/cuda/libs/cusparse.pxd index 2adf0c8d09e..3db5c013b6d 100644 --- a/cupy_backends/cuda/libs/cusparse.pxd +++ b/cupy_backends/cuda/libs/cusparse.pxd @@ -1,220 +1,219 @@ - from libc.stdint cimport intptr_t, int64_t - -cdef extern from *: - ctypedef int IndexBase 'cusparseIndexBase_t' - ctypedef int Status 'cusparseStatus_t' - - ctypedef void* Handle 'cusparseHandle_t' - - ctypedef void* MatDescr 'cusparseMatDescr_t' - - ctypedef int Direction 'cusparseDirection_t' - - ctypedef int MatrixType 'cusparseMatrixType_t' - ctypedef int FillMode 'cusparseFillMode_t' - ctypedef int DiagType 'cusparseDiagType_t' - - ctypedef int Operation 'cusparseOperation_t' - - ctypedef int PointerMode 'cusparsePointerMode_t' - - ctypedef int Action 'cusparseAction_t' - ctypedef int AlgMode 'cusparseAlgMode_t' - - ctypedef void* cusparseHandle_t - ctypedef void* cusparseMatDescr_t - ctypedef void* csrsv2Info_t - ctypedef void* csrsm2Info_t - ctypedef void* csric02Info_t - ctypedef void* bsric02Info_t - ctypedef void* csrilu02Info_t - ctypedef void* bsrilu02Info_t - ctypedef void* csrgemm2Info_t - - # Declarations for cuSparse generic API - ctypedef int cusparseStatus_t - ctypedef int cusparseDirection_t - ctypedef int cusparseSolvePolicy_t - - ctypedef int IndexType 'cusparseIndexType_t' - ctypedef int Format 'cusparseFormat_t' - ctypedef int Order 'cusparseOrder_t' - ctypedef int SpMVAlg 'cusparseSpMVAlg_t' - ctypedef int SpSMAlg 'cusparseSpSMAlg_t' - ctypedef int SpMMAlg 'cusparseSpMMAlg_t' - ctypedef int SpGEMMAlg 'cusparseSpGEMMAlg_t' - ctypedef int DataType 'cudaDataType' - ctypedef int SpMatAttribute 'cusparseSpMatAttribute_t' - - ctypedef void* SpVecDescr 'cusparseSpVecDescr_t' - ctypedef void* DnVecDescr 'cusparseDnVecDescr_t' - ctypedef void* SpMatDescr 'cusparseSpMatDescr_t' - ctypedef void* DnMatDescr 'cusparseDnMatDescr_t' - ctypedef void* SpSMDescr 'cusparseSpSMDescr_t' - ctypedef void* SpGEMMDescr 'cusparseSpGEMMDescr_t' - - ctypedef void* cusparseSpVecDescr_t - ctypedef void* cusparseDnVecDescr_t - ctypedef void* cusparseSpMatDescr_t - ctypedef void* cusparseDnMatDescr_t - ctypedef void* cusparseSpSMDescr_t - ctypedef void* cusparseSpGEMMDescr_t - - ctypedef int cusparseSparseToDenseAlg_t - ctypedef int cusparseDenseToSparseAlg_t - ctypedef int cusparseSpSMAlg_t - ctypedef int cusparseSpGEMMAlg_t - - # CSR2CSC - ctypedef int Csr2CscAlg 'cusparseCsr2CscAlg_t' - -cpdef enum: - CUSPARSE_POINTER_MODE_HOST = 0 - CUSPARSE_POINTER_MODE_DEVICE = 1 - - CUSPARSE_ACTION_SYMBOLIC = 0 - CUSPARSE_ACTION_NUMERIC = 1 - - # cusparseIndexBase_t - CUSPARSE_INDEX_BASE_ZERO = 0 - CUSPARSE_INDEX_BASE_ONE = 1 - - CUSPARSE_MATRIX_TYPE_GENERAL = 0 - CUSPARSE_MATRIX_TYPE_SYMMETRIC = 1 - CUSPARSE_MATRIX_TYPE_HERMITIAN = 2 - CUSPARSE_MATRIX_TYPE_TRIANGULAR = 3 - - # cusparseFillMode_t - CUSPARSE_FILL_MODE_LOWER = 0 - CUSPARSE_FILL_MODE_UPPER = 1 - - # cusparseDiagType_t; - CUSPARSE_DIAG_TYPE_NON_UNIT = 0 - CUSPARSE_DIAG_TYPE_UNIT = 1 - - CUSPARSE_OPERATION_NON_TRANSPOSE = 0 - CUSPARSE_OPERATION_TRANSPOSE = 1 - CUSPARSE_OPERATION_CONJUGATE_TRANSPOSE = 2 - - CUSPARSE_DIRECTION_ROW = 0 - CUSPARSE_DIRECTION_COLUMN = 1 - - CUSPARSE_SOLVE_POLICY_NO_LEVEL = 0 - CUSPARSE_SOLVE_POLICY_USE_LEVEL = 1 - - CUSPARSE_ALG_NAIVE = 0 - CUSPARSE_ALG_MERGE_PATH = 1 - - # Enums for cuSparse generic API - CUSPARSE_FORMAT_CSR = 1 # Compressed Sparse Row (CSR) - CUSPARSE_FORMAT_CSC = 2 # Compressed Sparse Column (CSC) - CUSPARSE_FORMAT_COO = 3 # Coordinate (COO) - Structure of Arrays - CUSPARSE_FORMAT_COO_AOS = 4 # Coordinate (COO) - Array of Structures - - CUSPARSE_ORDER_COL = 1 # Column-Major Order - Matrix memory layout - CUSPARSE_ORDER_ROW = 2 # Row-Major Order - Matrix memory layout - - CUSPARSE_MV_ALG_DEFAULT = 0 - CUSPARSE_COOMV_ALG = 1 - CUSPARSE_CSRMV_ALG1 = 2 - CUSPARSE_CSRMV_ALG2 = 3 - - CUSPARSE_MM_ALG_DEFAULT = 0 - CUSPARSE_COOMM_ALG1 = 1 # non-deterministc results - CUSPARSE_COOMM_ALG2 = 2 # deterministic results - CUSPARSE_COOMM_ALG3 = 3 # non-deterministc results, for large matrices - CUSPARSE_CSRMM_ALG1 = 4 - - CUSPARSE_INDEX_16U = 1 # 16-bit unsigned integer - CUSPARSE_INDEX_32I = 2 # 32-bit signed integer - CUSPARSE_INDEX_64I = 3 # 64-bit signed integer - - # cusparseSpMatAttribute_t - CUSPARSE_SPMAT_FILL_MODE = 0 - CUSPARSE_SPMAT_DIAG_TYPE = 1 - - # CSR2CSC - CUSPARSE_CSR2CSC_ALG1 = 1 # faster than ALG2 (in general), deterministc - CUSPARSE_CSR2CSC_ALG2 = 2 # low memory requirement, non-deterministc - - # cusparseSpSMAlg_t - CUSPARSE_SPSM_ALG_DEFAULT = 0 - - # ... - CUSPARSE_SPGEMM_DEFAULT = 0 - - # cusparseSparseToDenseAlg_t - CUSPARSE_SPARSETODENSE_ALG_DEFAULT = 0 - - # cusparseDenseToSparseAlg_t - CUSPARSE_DENSETOSPARSE_ALG_DEFAULT = 0 - -cdef class SpVecAttributes: - cdef: - public int64_t size - public int64_t nnz - public intptr_t idx - public intptr_t values - public IndexType idxType - public IndexBase idxBase - public DataType valueType - -cdef class CooAttributes: - cdef: - public int64_t rows - public int64_t cols - public int64_t nnz - public intptr_t rowIdx - public intptr_t colIdx - public intptr_t values - public IndexType idxType - public IndexBase idxBase - public DataType valueType - -cdef class CooAoSAttributes: - cdef: - public int64_t rows - public int64_t cols - public int64_t nnz - public intptr_t ind - public intptr_t values - public IndexType idxType - public IndexBase idxBase - public DataType valueType - -cdef class CsrAttributes: - cdef: - public int64_t rows - public int64_t cols - public int64_t nnz - public intptr_t rowOffsets - public intptr_t colIdx - public intptr_t values - public IndexType rowOffsetType - public IndexType colIdxType - public IndexBase idxBase - public DataType valueType - -cdef class DnVecAttributes: - cdef: - public int64_t size - public intptr_t values - public DataType valueType - -cdef class DnMatAttributes: - cdef: - public int64_t rows - public int64_t cols - public int64_t ld - public intptr_t values - public DataType valueType - public Order order - -cdef class DnMatBatchAttributes: - cdef: - public int count - public int64_t stride - -cpdef intptr_t create() except? 0 -cpdef void destroy(intptr_t handle) except * +IF CUPY_HIP_VERSION == 0: + cdef extern from *: + ctypedef int IndexBase 'cusparseIndexBase_t' + ctypedef int Status 'cusparseStatus_t' + + ctypedef void* Handle 'cusparseHandle_t' + + ctypedef void* MatDescr 'cusparseMatDescr_t' + + ctypedef int Direction 'cusparseDirection_t' + + ctypedef int MatrixType 'cusparseMatrixType_t' + ctypedef int FillMode 'cusparseFillMode_t' + ctypedef int DiagType 'cusparseDiagType_t' + + ctypedef int Operation 'cusparseOperation_t' + + ctypedef int PointerMode 'cusparsePointerMode_t' + + ctypedef int Action 'cusparseAction_t' + ctypedef int AlgMode 'cusparseAlgMode_t' + + ctypedef void* cusparseHandle_t + ctypedef void* cusparseMatDescr_t + ctypedef void* csrsv2Info_t + ctypedef void* csrsm2Info_t + ctypedef void* csric02Info_t + ctypedef void* bsric02Info_t + ctypedef void* csrilu02Info_t + ctypedef void* bsrilu02Info_t + ctypedef void* csrgemm2Info_t + + # Declarations for cuSparse generic API + ctypedef int cusparseStatus_t + ctypedef int cusparseDirection_t + ctypedef int cusparseSolvePolicy_t + + ctypedef int IndexType 'cusparseIndexType_t' + ctypedef int Format 'cusparseFormat_t' + ctypedef int Order 'cusparseOrder_t' + ctypedef int SpMVAlg 'cusparseSpMVAlg_t' + ctypedef int SpSMAlg 'cusparseSpSMAlg_t' + ctypedef int SpMMAlg 'cusparseSpMMAlg_t' + ctypedef int SpGEMMAlg 'cusparseSpGEMMAlg_t' + ctypedef int DataType 'cudaDataType' + ctypedef int SpMatAttribute 'cusparseSpMatAttribute_t' + + ctypedef void* SpVecDescr 'cusparseSpVecDescr_t' + ctypedef void* DnVecDescr 'cusparseDnVecDescr_t' + ctypedef void* SpMatDescr 'cusparseSpMatDescr_t' + ctypedef void* DnMatDescr 'cusparseDnMatDescr_t' + ctypedef void* SpSMDescr 'cusparseSpSMDescr_t' + ctypedef void* SpGEMMDescr 'cusparseSpGEMMDescr_t' + + ctypedef void* cusparseSpVecDescr_t + ctypedef void* cusparseDnVecDescr_t + ctypedef void* cusparseSpMatDescr_t + ctypedef void* cusparseDnMatDescr_t + ctypedef void* cusparseSpSMDescr_t + ctypedef void* cusparseSpGEMMDescr_t + + ctypedef int cusparseSparseToDenseAlg_t + ctypedef int cusparseDenseToSparseAlg_t + ctypedef int cusparseSpSMAlg_t + ctypedef int cusparseSpGEMMAlg_t + + # CSR2CSC + ctypedef int Csr2CscAlg 'cusparseCsr2CscAlg_t' + + cpdef enum: + CUSPARSE_POINTER_MODE_HOST = 0 + CUSPARSE_POINTER_MODE_DEVICE = 1 + + CUSPARSE_ACTION_SYMBOLIC = 0 + CUSPARSE_ACTION_NUMERIC = 1 + + # cusparseIndexBase_t + CUSPARSE_INDEX_BASE_ZERO = 0 + CUSPARSE_INDEX_BASE_ONE = 1 + + CUSPARSE_MATRIX_TYPE_GENERAL = 0 + CUSPARSE_MATRIX_TYPE_SYMMETRIC = 1 + CUSPARSE_MATRIX_TYPE_HERMITIAN = 2 + CUSPARSE_MATRIX_TYPE_TRIANGULAR = 3 + + # cusparseFillMode_t + CUSPARSE_FILL_MODE_LOWER = 0 + CUSPARSE_FILL_MODE_UPPER = 1 + + # cusparseDiagType_t; + CUSPARSE_DIAG_TYPE_NON_UNIT = 0 + CUSPARSE_DIAG_TYPE_UNIT = 1 + + CUSPARSE_OPERATION_NON_TRANSPOSE = 0 + CUSPARSE_OPERATION_TRANSPOSE = 1 + CUSPARSE_OPERATION_CONJUGATE_TRANSPOSE = 2 + + CUSPARSE_DIRECTION_ROW = 0 + CUSPARSE_DIRECTION_COLUMN = 1 + + CUSPARSE_SOLVE_POLICY_NO_LEVEL = 0 + CUSPARSE_SOLVE_POLICY_USE_LEVEL = 1 + + CUSPARSE_ALG_NAIVE = 0 + CUSPARSE_ALG_MERGE_PATH = 1 + + # Enums for cuSparse generic API + CUSPARSE_FORMAT_CSR = 1 # Compressed Sparse Row (CSR) + CUSPARSE_FORMAT_CSC = 2 # Compressed Sparse Column (CSC) + CUSPARSE_FORMAT_COO = 3 # Coordinate (COO) - Structure of Arrays + CUSPARSE_FORMAT_COO_AOS = 4 # Coordinate (COO) - Array of Structures + + CUSPARSE_ORDER_COL = 1 # Column-Major Order - Matrix memory layout + CUSPARSE_ORDER_ROW = 2 # Row-Major Order - Matrix memory layout + + CUSPARSE_MV_ALG_DEFAULT = 0 + CUSPARSE_COOMV_ALG = 1 + CUSPARSE_CSRMV_ALG1 = 2 + CUSPARSE_CSRMV_ALG2 = 3 + + CUSPARSE_MM_ALG_DEFAULT = 0 + CUSPARSE_COOMM_ALG1 = 1 # non-deterministc results + CUSPARSE_COOMM_ALG2 = 2 # deterministic results + CUSPARSE_COOMM_ALG3 = 3 # non-deterministc results, for large matrices + CUSPARSE_CSRMM_ALG1 = 4 + + CUSPARSE_INDEX_16U = 1 # 16-bit unsigned integer + CUSPARSE_INDEX_32I = 2 # 32-bit signed integer + CUSPARSE_INDEX_64I = 3 # 64-bit signed integer + + # cusparseSpMatAttribute_t + CUSPARSE_SPMAT_FILL_MODE = 0 + CUSPARSE_SPMAT_DIAG_TYPE = 1 + + # CSR2CSC + CUSPARSE_CSR2CSC_ALG1 = 1 # faster than ALG2 (in general), deterministc + CUSPARSE_CSR2CSC_ALG2 = 2 # low memory requirement, non-deterministc + + # cusparseSpSMAlg_t + CUSPARSE_SPSM_ALG_DEFAULT = 0 + + # ... + CUSPARSE_SPGEMM_DEFAULT = 0 + + # cusparseSparseToDenseAlg_t + CUSPARSE_SPARSETODENSE_ALG_DEFAULT = 0 + + # cusparseDenseToSparseAlg_t + CUSPARSE_DENSETOSPARSE_ALG_DEFAULT = 0 + + cdef class SpVecAttributes: + cdef: + public int64_t size + public int64_t nnz + public intptr_t idx + public intptr_t values + public IndexType idxType + public IndexBase idxBase + public DataType valueType + + cdef class CooAttributes: + cdef: + public int64_t rows + public int64_t cols + public int64_t nnz + public intptr_t rowIdx + public intptr_t colIdx + public intptr_t values + public IndexType idxType + public IndexBase idxBase + public DataType valueType + + cdef class CooAoSAttributes: + cdef: + public int64_t rows + public int64_t cols + public int64_t nnz + public intptr_t ind + public intptr_t values + public IndexType idxType + public IndexBase idxBase + public DataType valueType + + cdef class CsrAttributes: + cdef: + public int64_t rows + public int64_t cols + public int64_t nnz + public intptr_t rowOffsets + public intptr_t colIdx + public intptr_t values + public IndexType rowOffsetType + public IndexType colIdxType + public IndexBase idxBase + public DataType valueType + + cdef class DnVecAttributes: + cdef: + public int64_t size + public intptr_t values + public DataType valueType + + cdef class DnMatAttributes: + cdef: + public int64_t rows + public int64_t cols + public int64_t ld + public intptr_t values + public DataType valueType + public Order order + + cdef class DnMatBatchAttributes: + cdef: + public int count + public int64_t stride + + cpdef intptr_t create() except? 0 + cpdef void destroy(intptr_t handle) except * From b005cca84abdd6a6ab855c2c58f55a29fe763f59 Mon Sep 17 00:00:00 2001 From: bmedishe Date: Thu, 25 Apr 2024 21:01:38 +0000 Subject: [PATCH 04/30] remove tydep of hipsparsestatus to cusparsestatus --- cupy_backends/hip/cupy_hipsparse.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cupy_backends/hip/cupy_hipsparse.h b/cupy_backends/hip/cupy_hipsparse.h index db008ebcc0d..32ab260d075 100644 --- a/cupy_backends/hip/cupy_hipsparse.h +++ b/cupy_backends/hip/cupy_hipsparse.h @@ -34,7 +34,7 @@ static hipDataType convert_hipDatatype(cudaDataType type) { extern "C" { typedef hipsparseIndexBase_t cusparseIndexBase_t; -typedef hipsparseStatus_t cusparseStatus_t; +//typedef hipsparseStatus_t cusparseStatus_t; typedef hipsparseHandle_t cusparseHandle_t; typedef hipsparseMatDescr_t cusparseMatDescr_t; From 734e1bfd6e9656ca0824c264b600cfb404efcd6a Mon Sep 17 00:00:00 2001 From: bmedishe Date: Fri, 26 Apr 2024 19:07:56 +0000 Subject: [PATCH 05/30] update cusparse.pxd --- cupy_backends/cuda/libs/cusparse.pxd | 437 ++++++++++++++------------- 1 file changed, 219 insertions(+), 218 deletions(-) diff --git a/cupy_backends/cuda/libs/cusparse.pxd b/cupy_backends/cuda/libs/cusparse.pxd index 3db5c013b6d..2adf0c8d09e 100644 --- a/cupy_backends/cuda/libs/cusparse.pxd +++ b/cupy_backends/cuda/libs/cusparse.pxd @@ -1,219 +1,220 @@ + from libc.stdint cimport intptr_t, int64_t -IF CUPY_HIP_VERSION == 0: - cdef extern from *: - ctypedef int IndexBase 'cusparseIndexBase_t' - ctypedef int Status 'cusparseStatus_t' - - ctypedef void* Handle 'cusparseHandle_t' - - ctypedef void* MatDescr 'cusparseMatDescr_t' - - ctypedef int Direction 'cusparseDirection_t' - - ctypedef int MatrixType 'cusparseMatrixType_t' - ctypedef int FillMode 'cusparseFillMode_t' - ctypedef int DiagType 'cusparseDiagType_t' - - ctypedef int Operation 'cusparseOperation_t' - - ctypedef int PointerMode 'cusparsePointerMode_t' - - ctypedef int Action 'cusparseAction_t' - ctypedef int AlgMode 'cusparseAlgMode_t' - - ctypedef void* cusparseHandle_t - ctypedef void* cusparseMatDescr_t - ctypedef void* csrsv2Info_t - ctypedef void* csrsm2Info_t - ctypedef void* csric02Info_t - ctypedef void* bsric02Info_t - ctypedef void* csrilu02Info_t - ctypedef void* bsrilu02Info_t - ctypedef void* csrgemm2Info_t - - # Declarations for cuSparse generic API - ctypedef int cusparseStatus_t - ctypedef int cusparseDirection_t - ctypedef int cusparseSolvePolicy_t - - ctypedef int IndexType 'cusparseIndexType_t' - ctypedef int Format 'cusparseFormat_t' - ctypedef int Order 'cusparseOrder_t' - ctypedef int SpMVAlg 'cusparseSpMVAlg_t' - ctypedef int SpSMAlg 'cusparseSpSMAlg_t' - ctypedef int SpMMAlg 'cusparseSpMMAlg_t' - ctypedef int SpGEMMAlg 'cusparseSpGEMMAlg_t' - ctypedef int DataType 'cudaDataType' - ctypedef int SpMatAttribute 'cusparseSpMatAttribute_t' - - ctypedef void* SpVecDescr 'cusparseSpVecDescr_t' - ctypedef void* DnVecDescr 'cusparseDnVecDescr_t' - ctypedef void* SpMatDescr 'cusparseSpMatDescr_t' - ctypedef void* DnMatDescr 'cusparseDnMatDescr_t' - ctypedef void* SpSMDescr 'cusparseSpSMDescr_t' - ctypedef void* SpGEMMDescr 'cusparseSpGEMMDescr_t' - - ctypedef void* cusparseSpVecDescr_t - ctypedef void* cusparseDnVecDescr_t - ctypedef void* cusparseSpMatDescr_t - ctypedef void* cusparseDnMatDescr_t - ctypedef void* cusparseSpSMDescr_t - ctypedef void* cusparseSpGEMMDescr_t - - ctypedef int cusparseSparseToDenseAlg_t - ctypedef int cusparseDenseToSparseAlg_t - ctypedef int cusparseSpSMAlg_t - ctypedef int cusparseSpGEMMAlg_t - - # CSR2CSC - ctypedef int Csr2CscAlg 'cusparseCsr2CscAlg_t' - - cpdef enum: - CUSPARSE_POINTER_MODE_HOST = 0 - CUSPARSE_POINTER_MODE_DEVICE = 1 - - CUSPARSE_ACTION_SYMBOLIC = 0 - CUSPARSE_ACTION_NUMERIC = 1 - - # cusparseIndexBase_t - CUSPARSE_INDEX_BASE_ZERO = 0 - CUSPARSE_INDEX_BASE_ONE = 1 - - CUSPARSE_MATRIX_TYPE_GENERAL = 0 - CUSPARSE_MATRIX_TYPE_SYMMETRIC = 1 - CUSPARSE_MATRIX_TYPE_HERMITIAN = 2 - CUSPARSE_MATRIX_TYPE_TRIANGULAR = 3 - - # cusparseFillMode_t - CUSPARSE_FILL_MODE_LOWER = 0 - CUSPARSE_FILL_MODE_UPPER = 1 - - # cusparseDiagType_t; - CUSPARSE_DIAG_TYPE_NON_UNIT = 0 - CUSPARSE_DIAG_TYPE_UNIT = 1 - - CUSPARSE_OPERATION_NON_TRANSPOSE = 0 - CUSPARSE_OPERATION_TRANSPOSE = 1 - CUSPARSE_OPERATION_CONJUGATE_TRANSPOSE = 2 - - CUSPARSE_DIRECTION_ROW = 0 - CUSPARSE_DIRECTION_COLUMN = 1 - - CUSPARSE_SOLVE_POLICY_NO_LEVEL = 0 - CUSPARSE_SOLVE_POLICY_USE_LEVEL = 1 - - CUSPARSE_ALG_NAIVE = 0 - CUSPARSE_ALG_MERGE_PATH = 1 - - # Enums for cuSparse generic API - CUSPARSE_FORMAT_CSR = 1 # Compressed Sparse Row (CSR) - CUSPARSE_FORMAT_CSC = 2 # Compressed Sparse Column (CSC) - CUSPARSE_FORMAT_COO = 3 # Coordinate (COO) - Structure of Arrays - CUSPARSE_FORMAT_COO_AOS = 4 # Coordinate (COO) - Array of Structures - - CUSPARSE_ORDER_COL = 1 # Column-Major Order - Matrix memory layout - CUSPARSE_ORDER_ROW = 2 # Row-Major Order - Matrix memory layout - - CUSPARSE_MV_ALG_DEFAULT = 0 - CUSPARSE_COOMV_ALG = 1 - CUSPARSE_CSRMV_ALG1 = 2 - CUSPARSE_CSRMV_ALG2 = 3 - - CUSPARSE_MM_ALG_DEFAULT = 0 - CUSPARSE_COOMM_ALG1 = 1 # non-deterministc results - CUSPARSE_COOMM_ALG2 = 2 # deterministic results - CUSPARSE_COOMM_ALG3 = 3 # non-deterministc results, for large matrices - CUSPARSE_CSRMM_ALG1 = 4 - - CUSPARSE_INDEX_16U = 1 # 16-bit unsigned integer - CUSPARSE_INDEX_32I = 2 # 32-bit signed integer - CUSPARSE_INDEX_64I = 3 # 64-bit signed integer - - # cusparseSpMatAttribute_t - CUSPARSE_SPMAT_FILL_MODE = 0 - CUSPARSE_SPMAT_DIAG_TYPE = 1 - - # CSR2CSC - CUSPARSE_CSR2CSC_ALG1 = 1 # faster than ALG2 (in general), deterministc - CUSPARSE_CSR2CSC_ALG2 = 2 # low memory requirement, non-deterministc - - # cusparseSpSMAlg_t - CUSPARSE_SPSM_ALG_DEFAULT = 0 - - # ... - CUSPARSE_SPGEMM_DEFAULT = 0 - - # cusparseSparseToDenseAlg_t - CUSPARSE_SPARSETODENSE_ALG_DEFAULT = 0 - - # cusparseDenseToSparseAlg_t - CUSPARSE_DENSETOSPARSE_ALG_DEFAULT = 0 - - cdef class SpVecAttributes: - cdef: - public int64_t size - public int64_t nnz - public intptr_t idx - public intptr_t values - public IndexType idxType - public IndexBase idxBase - public DataType valueType - - cdef class CooAttributes: - cdef: - public int64_t rows - public int64_t cols - public int64_t nnz - public intptr_t rowIdx - public intptr_t colIdx - public intptr_t values - public IndexType idxType - public IndexBase idxBase - public DataType valueType - - cdef class CooAoSAttributes: - cdef: - public int64_t rows - public int64_t cols - public int64_t nnz - public intptr_t ind - public intptr_t values - public IndexType idxType - public IndexBase idxBase - public DataType valueType - - cdef class CsrAttributes: - cdef: - public int64_t rows - public int64_t cols - public int64_t nnz - public intptr_t rowOffsets - public intptr_t colIdx - public intptr_t values - public IndexType rowOffsetType - public IndexType colIdxType - public IndexBase idxBase - public DataType valueType - - cdef class DnVecAttributes: - cdef: - public int64_t size - public intptr_t values - public DataType valueType - - cdef class DnMatAttributes: - cdef: - public int64_t rows - public int64_t cols - public int64_t ld - public intptr_t values - public DataType valueType - public Order order - - cdef class DnMatBatchAttributes: - cdef: - public int count - public int64_t stride - - cpdef intptr_t create() except? 0 - cpdef void destroy(intptr_t handle) except * + +cdef extern from *: + ctypedef int IndexBase 'cusparseIndexBase_t' + ctypedef int Status 'cusparseStatus_t' + + ctypedef void* Handle 'cusparseHandle_t' + + ctypedef void* MatDescr 'cusparseMatDescr_t' + + ctypedef int Direction 'cusparseDirection_t' + + ctypedef int MatrixType 'cusparseMatrixType_t' + ctypedef int FillMode 'cusparseFillMode_t' + ctypedef int DiagType 'cusparseDiagType_t' + + ctypedef int Operation 'cusparseOperation_t' + + ctypedef int PointerMode 'cusparsePointerMode_t' + + ctypedef int Action 'cusparseAction_t' + ctypedef int AlgMode 'cusparseAlgMode_t' + + ctypedef void* cusparseHandle_t + ctypedef void* cusparseMatDescr_t + ctypedef void* csrsv2Info_t + ctypedef void* csrsm2Info_t + ctypedef void* csric02Info_t + ctypedef void* bsric02Info_t + ctypedef void* csrilu02Info_t + ctypedef void* bsrilu02Info_t + ctypedef void* csrgemm2Info_t + + # Declarations for cuSparse generic API + ctypedef int cusparseStatus_t + ctypedef int cusparseDirection_t + ctypedef int cusparseSolvePolicy_t + + ctypedef int IndexType 'cusparseIndexType_t' + ctypedef int Format 'cusparseFormat_t' + ctypedef int Order 'cusparseOrder_t' + ctypedef int SpMVAlg 'cusparseSpMVAlg_t' + ctypedef int SpSMAlg 'cusparseSpSMAlg_t' + ctypedef int SpMMAlg 'cusparseSpMMAlg_t' + ctypedef int SpGEMMAlg 'cusparseSpGEMMAlg_t' + ctypedef int DataType 'cudaDataType' + ctypedef int SpMatAttribute 'cusparseSpMatAttribute_t' + + ctypedef void* SpVecDescr 'cusparseSpVecDescr_t' + ctypedef void* DnVecDescr 'cusparseDnVecDescr_t' + ctypedef void* SpMatDescr 'cusparseSpMatDescr_t' + ctypedef void* DnMatDescr 'cusparseDnMatDescr_t' + ctypedef void* SpSMDescr 'cusparseSpSMDescr_t' + ctypedef void* SpGEMMDescr 'cusparseSpGEMMDescr_t' + + ctypedef void* cusparseSpVecDescr_t + ctypedef void* cusparseDnVecDescr_t + ctypedef void* cusparseSpMatDescr_t + ctypedef void* cusparseDnMatDescr_t + ctypedef void* cusparseSpSMDescr_t + ctypedef void* cusparseSpGEMMDescr_t + + ctypedef int cusparseSparseToDenseAlg_t + ctypedef int cusparseDenseToSparseAlg_t + ctypedef int cusparseSpSMAlg_t + ctypedef int cusparseSpGEMMAlg_t + + # CSR2CSC + ctypedef int Csr2CscAlg 'cusparseCsr2CscAlg_t' + +cpdef enum: + CUSPARSE_POINTER_MODE_HOST = 0 + CUSPARSE_POINTER_MODE_DEVICE = 1 + + CUSPARSE_ACTION_SYMBOLIC = 0 + CUSPARSE_ACTION_NUMERIC = 1 + + # cusparseIndexBase_t + CUSPARSE_INDEX_BASE_ZERO = 0 + CUSPARSE_INDEX_BASE_ONE = 1 + + CUSPARSE_MATRIX_TYPE_GENERAL = 0 + CUSPARSE_MATRIX_TYPE_SYMMETRIC = 1 + CUSPARSE_MATRIX_TYPE_HERMITIAN = 2 + CUSPARSE_MATRIX_TYPE_TRIANGULAR = 3 + + # cusparseFillMode_t + CUSPARSE_FILL_MODE_LOWER = 0 + CUSPARSE_FILL_MODE_UPPER = 1 + + # cusparseDiagType_t; + CUSPARSE_DIAG_TYPE_NON_UNIT = 0 + CUSPARSE_DIAG_TYPE_UNIT = 1 + + CUSPARSE_OPERATION_NON_TRANSPOSE = 0 + CUSPARSE_OPERATION_TRANSPOSE = 1 + CUSPARSE_OPERATION_CONJUGATE_TRANSPOSE = 2 + + CUSPARSE_DIRECTION_ROW = 0 + CUSPARSE_DIRECTION_COLUMN = 1 + + CUSPARSE_SOLVE_POLICY_NO_LEVEL = 0 + CUSPARSE_SOLVE_POLICY_USE_LEVEL = 1 + + CUSPARSE_ALG_NAIVE = 0 + CUSPARSE_ALG_MERGE_PATH = 1 + + # Enums for cuSparse generic API + CUSPARSE_FORMAT_CSR = 1 # Compressed Sparse Row (CSR) + CUSPARSE_FORMAT_CSC = 2 # Compressed Sparse Column (CSC) + CUSPARSE_FORMAT_COO = 3 # Coordinate (COO) - Structure of Arrays + CUSPARSE_FORMAT_COO_AOS = 4 # Coordinate (COO) - Array of Structures + + CUSPARSE_ORDER_COL = 1 # Column-Major Order - Matrix memory layout + CUSPARSE_ORDER_ROW = 2 # Row-Major Order - Matrix memory layout + + CUSPARSE_MV_ALG_DEFAULT = 0 + CUSPARSE_COOMV_ALG = 1 + CUSPARSE_CSRMV_ALG1 = 2 + CUSPARSE_CSRMV_ALG2 = 3 + + CUSPARSE_MM_ALG_DEFAULT = 0 + CUSPARSE_COOMM_ALG1 = 1 # non-deterministc results + CUSPARSE_COOMM_ALG2 = 2 # deterministic results + CUSPARSE_COOMM_ALG3 = 3 # non-deterministc results, for large matrices + CUSPARSE_CSRMM_ALG1 = 4 + + CUSPARSE_INDEX_16U = 1 # 16-bit unsigned integer + CUSPARSE_INDEX_32I = 2 # 32-bit signed integer + CUSPARSE_INDEX_64I = 3 # 64-bit signed integer + + # cusparseSpMatAttribute_t + CUSPARSE_SPMAT_FILL_MODE = 0 + CUSPARSE_SPMAT_DIAG_TYPE = 1 + + # CSR2CSC + CUSPARSE_CSR2CSC_ALG1 = 1 # faster than ALG2 (in general), deterministc + CUSPARSE_CSR2CSC_ALG2 = 2 # low memory requirement, non-deterministc + + # cusparseSpSMAlg_t + CUSPARSE_SPSM_ALG_DEFAULT = 0 + + # ... + CUSPARSE_SPGEMM_DEFAULT = 0 + + # cusparseSparseToDenseAlg_t + CUSPARSE_SPARSETODENSE_ALG_DEFAULT = 0 + + # cusparseDenseToSparseAlg_t + CUSPARSE_DENSETOSPARSE_ALG_DEFAULT = 0 + +cdef class SpVecAttributes: + cdef: + public int64_t size + public int64_t nnz + public intptr_t idx + public intptr_t values + public IndexType idxType + public IndexBase idxBase + public DataType valueType + +cdef class CooAttributes: + cdef: + public int64_t rows + public int64_t cols + public int64_t nnz + public intptr_t rowIdx + public intptr_t colIdx + public intptr_t values + public IndexType idxType + public IndexBase idxBase + public DataType valueType + +cdef class CooAoSAttributes: + cdef: + public int64_t rows + public int64_t cols + public int64_t nnz + public intptr_t ind + public intptr_t values + public IndexType idxType + public IndexBase idxBase + public DataType valueType + +cdef class CsrAttributes: + cdef: + public int64_t rows + public int64_t cols + public int64_t nnz + public intptr_t rowOffsets + public intptr_t colIdx + public intptr_t values + public IndexType rowOffsetType + public IndexType colIdxType + public IndexBase idxBase + public DataType valueType + +cdef class DnVecAttributes: + cdef: + public int64_t size + public intptr_t values + public DataType valueType + +cdef class DnMatAttributes: + cdef: + public int64_t rows + public int64_t cols + public int64_t ld + public intptr_t values + public DataType valueType + public Order order + +cdef class DnMatBatchAttributes: + cdef: + public int count + public int64_t stride + +cpdef intptr_t create() except? 0 +cpdef void destroy(intptr_t handle) except * From 8f69f8e13714c223258f622ac385a209e328d983 Mon Sep 17 00:00:00 2001 From: bmedishe Date: Fri, 26 Apr 2024 19:18:29 +0000 Subject: [PATCH 06/30] update cupy_backends/cuda/libs/cusparse.pxd --- cupy_backends/cuda/libs/cusparse.pxd | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cupy_backends/cuda/libs/cusparse.pxd b/cupy_backends/cuda/libs/cusparse.pxd index 2adf0c8d09e..9bdc3332e8e 100644 --- a/cupy_backends/cuda/libs/cusparse.pxd +++ b/cupy_backends/cuda/libs/cusparse.pxd @@ -215,6 +215,6 @@ cdef class DnMatBatchAttributes: cdef: public int count public int64_t stride - -cpdef intptr_t create() except? 0 -cpdef void destroy(intptr_t handle) except * +IF CUPY_HIP_VERSION == 0: + cpdef intptr_t create() except? 0 + cpdef void destroy(intptr_t handle) except * From 0fd31ec0bdb589867f6ba77f05622f72ac33c1ff Mon Sep 17 00:00:00 2001 From: bmedishe Date: Fri, 26 Apr 2024 19:42:58 +0000 Subject: [PATCH 07/30] remove definitions of cusparse apis with hip mappings --- cupy_backends/hip/cupy_hipsparse.h | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/cupy_backends/hip/cupy_hipsparse.h b/cupy_backends/hip/cupy_hipsparse.h index 32ab260d075..3b518e2e7c2 100644 --- a/cupy_backends/hip/cupy_hipsparse.h +++ b/cupy_backends/hip/cupy_hipsparse.h @@ -33,7 +33,7 @@ static hipDataType convert_hipDatatype(cudaDataType type) { extern "C" { -typedef hipsparseIndexBase_t cusparseIndexBase_t; +//typedef hipsparseIndexBase_t cusparseIndexBase_t; //typedef hipsparseStatus_t cusparseStatus_t; typedef hipsparseHandle_t cusparseHandle_t; @@ -3021,12 +3021,6 @@ typedef void* cusparseDnMatDescr_t; #endif -#if HIP_VERSION >= 402 -typedef hipsparseIndexType_t cusparseIndexType_t; -#else -typedef enum {} cusparseIndexType_t; -#endif - #if HIP_VERSION >= 402 typedef hipsparseFormat_t cusparseFormat_t; #else From 18fd7d9bdfd6e3653232694cd768a269c4bfd501 Mon Sep 17 00:00:00 2001 From: bmedishe Date: Mon, 29 Apr 2024 18:17:08 +0000 Subject: [PATCH 08/30] update softlink for hipsparse --- cupy_backends/cuda/libs/cusparse.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cupy_backends/cuda/libs/cusparse.pyx b/cupy_backends/cuda/libs/cusparse.pyx index aa4d3877f53..60c902e9a6f 100644 --- a/cupy_backends/cuda/libs/cusparse.pyx +++ b/cupy_backends/cuda/libs/cusparse.pyx @@ -1387,7 +1387,7 @@ ELSE: else: _libname = 'cusparse64_12.dll' ELIF 0 < CUPY_HIP_VERSION: - _libname = __file__ + _libname = 'libhipsparse.so' ELSE: _libname = None From 5f572d6336375466408b6a78831e985366fa5462 Mon Sep 17 00:00:00 2001 From: bmedishe Date: Mon, 29 Apr 2024 20:43:13 +0000 Subject: [PATCH 09/30] only missing cusparse mappings supported here --- cupy_backends/hip/cupy_hipsparse.h | 3859 +--------------------------- 1 file changed, 4 insertions(+), 3855 deletions(-) diff --git a/cupy_backends/hip/cupy_hipsparse.h b/cupy_backends/hip/cupy_hipsparse.h index 3b518e2e7c2..10ffb42a011 100644 --- a/cupy_backends/hip/cupy_hipsparse.h +++ b/cupy_backends/hip/cupy_hipsparse.h @@ -1,5 +1,3 @@ - - #ifndef INCLUDE_GUARD_HIP_CUPY_HIPSPARSE_H #define INCLUDE_GUARD_HIP_CUPY_HIPSPARSE_H #if HIP_VERSION >= 50530600 @@ -11,224 +9,6 @@ #include // for hipDataType #include // for gcc 10.0 -#if HIP_VERSION >= 402 -static hipDataType convert_hipDatatype(cudaDataType type) { - switch(static_cast(type)) { - case 2 /* CUDA_R_16F */: return HIP_R_16F; - case 0 /* CUDA_R_32F */: return HIP_R_32F; - case 1 /* CUDA_R_64F */: return HIP_R_64F; - case 6 /* CUDA_C_16F */: return HIP_C_16F; - case 4 /* CUDA_C_32F */: return HIP_C_32F; - case 5 /* CUDA_C_64F */: return HIP_C_64F; - default: throw std::runtime_error("unrecognized type"); - } -} -#endif - - -#if HIP_VERSION < 401 -#define HIPSPARSE_STATUS_NOT_SUPPORTED (hipsparseStatus_t)10 -#endif - - -extern "C" { - -//typedef hipsparseIndexBase_t cusparseIndexBase_t; -//typedef hipsparseStatus_t cusparseStatus_t; - -typedef hipsparseHandle_t cusparseHandle_t; -typedef hipsparseMatDescr_t cusparseMatDescr_t; -#if HIP_VERSION < 308 -typedef void* bsric02Info_t; -#endif - -#if HIP_VERSION < 309 -typedef void* bsrilu02Info_t; -#endif - - -typedef hipsparseMatrixType_t cusparseMatrixType_t; -typedef hipsparseFillMode_t cusparseFillMode_t; -typedef hipsparseDiagType_t cusparseDiagType_t; -typedef hipsparseOperation_t cusparseOperation_t; -typedef hipsparsePointerMode_t cusparsePointerMode_t; -typedef hipsparseAction_t cusparseAction_t; -typedef hipsparseDirection_t cusparseDirection_t; -typedef enum {} cusparseAlgMode_t; -typedef hipsparseSolvePolicy_t cusparseSolvePolicy_t; - -// Version -cusparseStatus_t cusparseGetVersion(cusparseHandle_t handle, - int* version) { - return hipsparseGetVersion(handle, version); -} - -// Error handling -const char* cusparseGetErrorName(...) { - // Unavailable in hipSparse; this should not be called - return "CUPY_HIPSPARSE_BINDING_UNEXPECTED_ERROR"; -} - -const char* cusparseGetErrorString(...) { - // Unavailable in hipSparse; this should not be called - return "unexpected error in CuPy hipSparse binding"; -} - -// cuSPARSE Helper Function -cusparseStatus_t cusparseCreate(cusparseHandle_t* handle) { - return hipsparseCreate(handle); -} - -cusparseStatus_t cusparseCreateMatDescr(cusparseMatDescr_t* descrA) { - return hipsparseCreateMatDescr(descrA); -} - -cusparseStatus_t cusparseDestroy(cusparseHandle_t handle) { - return hipsparseDestroy(handle); -} - -cusparseStatus_t cusparseDestroyMatDescr(cusparseMatDescr_t descrA) { - return hipsparseDestroyMatDescr(descrA); -} - -cusparseStatus_t cusparseSetMatIndexBase(cusparseMatDescr_t descrA, - cusparseIndexBase_t base) { - return hipsparseSetMatIndexBase(descrA, base); -} - -cusparseStatus_t cusparseSetMatType(cusparseMatDescr_t descrA, - cusparseMatrixType_t type) { - return hipsparseSetMatType(descrA, type); -} - -cusparseStatus_t cusparseSetMatFillMode(cusparseMatDescr_t descrA, - cusparseFillMode_t fillMode) { - return hipsparseSetMatFillMode(descrA, fillMode); -} - -cusparseStatus_t cusparseSetMatDiagType(cusparseMatDescr_t descrA, - cusparseDiagType_t diagType) { - return hipsparseSetMatDiagType(descrA, diagType); -} - -cusparseStatus_t cusparseSetPointerMode(cusparseHandle_t handle, - cusparsePointerMode_t mode) { - return hipsparseSetPointerMode(handle, mode); -} - -// Stream -cusparseStatus_t cusparseSetStream(cusparseHandle_t handle, - cudaStream_t streamId) { - return hipsparseSetStream(handle, streamId); -} - -cusparseStatus_t cusparseGetStream(cusparseHandle_t handle, - cudaStream_t* streamId) { - return hipsparseGetStream(handle, streamId); -} - -// cuSPARSE Level1 Function -cusparseStatus_t cusparseSgthr(cusparseHandle_t handle, - int nnz, - const float* y, - float* xVal, - const int* xInd, - cusparseIndexBase_t idxBase) { - return hipsparseSgthr(handle, nnz, y, xVal, xInd, idxBase); -} - -cusparseStatus_t cusparseDgthr(cusparseHandle_t handle, - int nnz, - const double* y, - double* xVal, - const int* xInd, - cusparseIndexBase_t idxBase) { - return hipsparseDgthr(handle, nnz, y, xVal, xInd, idxBase); -} - -cusparseStatus_t cusparseCgthr(cusparseHandle_t handle, - int nnz, - const cuComplex* y, - cuComplex* xVal, - const int* xInd, - cusparseIndexBase_t idxBase) { - return hipsparseCgthr(handle, nnz, reinterpret_cast(y), reinterpret_cast(xVal), xInd, idxBase); -} - -cusparseStatus_t cusparseZgthr(cusparseHandle_t handle, - int nnz, - const cuDoubleComplex* y, - cuDoubleComplex* xVal, - const int* xInd, - cusparseIndexBase_t idxBase) { - return hipsparseZgthr(handle, nnz, reinterpret_cast(y), reinterpret_cast(xVal), xInd, idxBase); -} - -// cuSPARSE Level2 Function -cusparseStatus_t cusparseScsrmv(cusparseHandle_t handle, - cusparseOperation_t transA, - int m, - int n, - int nnz, - const float* alpha, - const cusparseMatDescr_t descrA, - const float* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - const float* x, - const float* beta, - float* y) { - return hipsparseScsrmv(handle, transA, m, n, nnz, alpha, descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, x, beta, y); -} - -cusparseStatus_t cusparseDcsrmv(cusparseHandle_t handle, - cusparseOperation_t transA, - int m, - int n, - int nnz, - const double* alpha, - const cusparseMatDescr_t descrA, - const double* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - const double* x, - const double* beta, - double* y) { - return hipsparseDcsrmv(handle, transA, m, n, nnz, alpha, descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, x, beta, y); -} - -cusparseStatus_t cusparseCcsrmv(cusparseHandle_t handle, - cusparseOperation_t transA, - int m, - int n, - int nnz, - const cuComplex* alpha, - const cusparseMatDescr_t descrA, - const cuComplex* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - const cuComplex* x, - const cuComplex* beta, - cuComplex* y) { - return hipsparseCcsrmv(handle, transA, m, n, nnz, reinterpret_cast(alpha), descrA, reinterpret_cast(csrSortedValA), csrSortedRowPtrA, csrSortedColIndA, reinterpret_cast(x), reinterpret_cast(beta), reinterpret_cast(y)); -} - -cusparseStatus_t cusparseZcsrmv(cusparseHandle_t handle, - cusparseOperation_t transA, - int m, - int n, - int nnz, - const cuDoubleComplex* alpha, - const cusparseMatDescr_t descrA, - const cuDoubleComplex* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - const cuDoubleComplex* x, - const cuDoubleComplex* beta, - cuDoubleComplex* y) { - return hipsparseZcsrmv(handle, transA, m, n, nnz, reinterpret_cast(alpha), descrA, reinterpret_cast(csrSortedValA), csrSortedRowPtrA, csrSortedColIndA, reinterpret_cast(x), reinterpret_cast(beta), reinterpret_cast(y)); -} - cusparseStatus_t cusparseCsrmvEx_bufferSize(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } @@ -237,3643 +17,12 @@ cusparseStatus_t cusparseCsrmvEx(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -cusparseStatus_t cusparseCreateCsrsv2Info(csrsv2Info_t* info) { - return hipsparseCreateCsrsv2Info(info); -} - -cusparseStatus_t cusparseDestroyCsrsv2Info(csrsv2Info_t info) { - return hipsparseDestroyCsrsv2Info(info); -} - -cusparseStatus_t cusparseScsrsv2_bufferSize(cusparseHandle_t handle, - cusparseOperation_t transA, - int m, - int nnz, - const cusparseMatDescr_t descrA, - float* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - csrsv2Info_t info, - int* pBufferSizeInBytes) { - return hipsparseScsrsv2_bufferSize(handle, transA, m, nnz, descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, info, pBufferSizeInBytes); -} - -cusparseStatus_t cusparseDcsrsv2_bufferSize(cusparseHandle_t handle, - cusparseOperation_t transA, - int m, - int nnz, - const cusparseMatDescr_t descrA, - double* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - csrsv2Info_t info, - int* pBufferSizeInBytes) { - return hipsparseDcsrsv2_bufferSize(handle, transA, m, nnz, descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, info, pBufferSizeInBytes); -} - -cusparseStatus_t cusparseCcsrsv2_bufferSize(cusparseHandle_t handle, - cusparseOperation_t transA, - int m, - int nnz, - const cusparseMatDescr_t descrA, - cuComplex* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - csrsv2Info_t info, - int* pBufferSizeInBytes) { - return hipsparseCcsrsv2_bufferSize(handle, transA, m, nnz, descrA, reinterpret_cast(csrSortedValA), csrSortedRowPtrA, csrSortedColIndA, info, pBufferSizeInBytes); -} - -cusparseStatus_t cusparseZcsrsv2_bufferSize(cusparseHandle_t handle, - cusparseOperation_t transA, - int m, - int nnz, - const cusparseMatDescr_t descrA, - cuDoubleComplex* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - csrsv2Info_t info, - int* pBufferSizeInBytes) { - return hipsparseZcsrsv2_bufferSize(handle, transA, m, nnz, descrA, reinterpret_cast(csrSortedValA), csrSortedRowPtrA, csrSortedColIndA, info, pBufferSizeInBytes); -} - -cusparseStatus_t cusparseScsrsv2_analysis(cusparseHandle_t handle, - cusparseOperation_t transA, - int m, - int nnz, - const cusparseMatDescr_t descrA, - const float* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - csrsv2Info_t info, - cusparseSolvePolicy_t policy, - void* pBuffer) { - return hipsparseScsrsv2_analysis(handle, transA, m, nnz, descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, info, policy, pBuffer); -} - -cusparseStatus_t cusparseDcsrsv2_analysis(cusparseHandle_t handle, - cusparseOperation_t transA, - int m, - int nnz, - const cusparseMatDescr_t descrA, - const double* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - csrsv2Info_t info, - cusparseSolvePolicy_t policy, - void* pBuffer) { - return hipsparseDcsrsv2_analysis(handle, transA, m, nnz, descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, info, policy, pBuffer); -} - -cusparseStatus_t cusparseCcsrsv2_analysis(cusparseHandle_t handle, - cusparseOperation_t transA, - int m, - int nnz, - const cusparseMatDescr_t descrA, - const cuComplex* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - csrsv2Info_t info, - cusparseSolvePolicy_t policy, - void* pBuffer) { - return hipsparseCcsrsv2_analysis(handle, transA, m, nnz, descrA, reinterpret_cast(csrSortedValA), csrSortedRowPtrA, csrSortedColIndA, info, policy, pBuffer); -} - -cusparseStatus_t cusparseZcsrsv2_analysis(cusparseHandle_t handle, - cusparseOperation_t transA, - int m, - int nnz, - const cusparseMatDescr_t descrA, - const cuDoubleComplex* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - csrsv2Info_t info, - cusparseSolvePolicy_t policy, - void* pBuffer) { - return hipsparseZcsrsv2_analysis(handle, transA, m, nnz, descrA, reinterpret_cast(csrSortedValA), csrSortedRowPtrA, csrSortedColIndA, info, policy, pBuffer); -} - -cusparseStatus_t cusparseScsrsv2_solve(cusparseHandle_t handle, - cusparseOperation_t transA, - int m, - int nnz, - const float* alpha, - const cusparseMatDescr_t descrA, - const float* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - csrsv2Info_t info, - const float* f, - float* x, - cusparseSolvePolicy_t policy, - void* pBuffer) { - return hipsparseScsrsv2_solve(handle, transA, m, nnz, alpha, descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, info, f, x, policy, pBuffer); -} - -cusparseStatus_t cusparseDcsrsv2_solve(cusparseHandle_t handle, - cusparseOperation_t transA, - int m, - int nnz, - const double* alpha, - const cusparseMatDescr_t descrA, - const double* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - csrsv2Info_t info, - const double* f, - double* x, - cusparseSolvePolicy_t policy, - void* pBuffer) { - return hipsparseDcsrsv2_solve(handle, transA, m, nnz, alpha, descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, info, f, x, policy, pBuffer); -} - -cusparseStatus_t cusparseCcsrsv2_solve(cusparseHandle_t handle, - cusparseOperation_t transA, - int m, - int nnz, - const cuComplex* alpha, - const cusparseMatDescr_t descrA, - const cuComplex* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - csrsv2Info_t info, - const cuComplex* f, - cuComplex* x, - cusparseSolvePolicy_t policy, - void* pBuffer) { - return hipsparseCcsrsv2_solve(handle, transA, m, nnz, reinterpret_cast(alpha), descrA, reinterpret_cast(csrSortedValA), csrSortedRowPtrA, csrSortedColIndA, info, reinterpret_cast(f), reinterpret_cast(x), policy, pBuffer); -} - -cusparseStatus_t cusparseZcsrsv2_solve(cusparseHandle_t handle, - cusparseOperation_t transA, - int m, - int nnz, - const cuDoubleComplex* alpha, - const cusparseMatDescr_t descrA, - const cuDoubleComplex* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - csrsv2Info_t info, - const cuDoubleComplex* f, - cuDoubleComplex* x, - cusparseSolvePolicy_t policy, - void* pBuffer) { - return hipsparseZcsrsv2_solve(handle, transA, m, nnz, reinterpret_cast(alpha), descrA, reinterpret_cast(csrSortedValA), csrSortedRowPtrA, csrSortedColIndA, info, reinterpret_cast(f), reinterpret_cast(x), policy, pBuffer); -} - -cusparseStatus_t cusparseXcsrsv2_zeroPivot(cusparseHandle_t handle, - csrsv2Info_t info, - int* position) { - return hipsparseXcsrsv2_zeroPivot(handle, info, position); -} - -// cuSPARSE Level3 Function -cusparseStatus_t cusparseScsrmm(cusparseHandle_t handle, - cusparseOperation_t transA, - int m, - int n, - int k, - int nnz, - const float* alpha, - const cusparseMatDescr_t descrA, - const float* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - const float* B, - int ldb, - const float* beta, - float* C, - int ldc) { - return hipsparseScsrmm(handle, transA, m, n, k, nnz, alpha, descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, B, ldb, beta, C, ldc); -} - -cusparseStatus_t cusparseDcsrmm(cusparseHandle_t handle, - cusparseOperation_t transA, - int m, - int n, - int k, - int nnz, - const double* alpha, - const cusparseMatDescr_t descrA, - const double* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - const double* B, - int ldb, - const double* beta, - double* C, - int ldc) { - return hipsparseDcsrmm(handle, transA, m, n, k, nnz, alpha, descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, B, ldb, beta, C, ldc); -} - -cusparseStatus_t cusparseCcsrmm(cusparseHandle_t handle, - cusparseOperation_t transA, - int m, - int n, - int k, - int nnz, - const cuComplex* alpha, - const cusparseMatDescr_t descrA, - const cuComplex* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - const cuComplex* B, - int ldb, - const cuComplex* beta, - cuComplex* C, - int ldc) { - return hipsparseCcsrmm(handle, transA, m, n, k, nnz, reinterpret_cast(alpha), descrA, reinterpret_cast(csrSortedValA), csrSortedRowPtrA, csrSortedColIndA, reinterpret_cast(B), ldb, reinterpret_cast(beta), reinterpret_cast(C), ldc); -} - -cusparseStatus_t cusparseZcsrmm(cusparseHandle_t handle, - cusparseOperation_t transA, - int m, - int n, - int k, - int nnz, - const cuDoubleComplex* alpha, - const cusparseMatDescr_t descrA, - const cuDoubleComplex* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - const cuDoubleComplex* B, - int ldb, - const cuDoubleComplex* beta, - cuDoubleComplex* C, - int ldc) { - return hipsparseZcsrmm(handle, transA, m, n, k, nnz, reinterpret_cast(alpha), descrA, reinterpret_cast(csrSortedValA), csrSortedRowPtrA, csrSortedColIndA, reinterpret_cast(B), ldb, reinterpret_cast(beta), reinterpret_cast(C), ldc); -} - -cusparseStatus_t cusparseScsrmm2(cusparseHandle_t handle, - cusparseOperation_t transA, - cusparseOperation_t transB, - int m, - int n, - int k, - int nnz, - const float* alpha, - const cusparseMatDescr_t descrA, - const float* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - const float* B, - int ldb, - const float* beta, - float* C, - int ldc) { - return hipsparseScsrmm2(handle, transA, transB, m, n, k, nnz, alpha, descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, B, ldb, beta, C, ldc); -} - -cusparseStatus_t cusparseDcsrmm2(cusparseHandle_t handle, - cusparseOperation_t transA, - cusparseOperation_t transB, - int m, - int n, - int k, - int nnz, - const double* alpha, - const cusparseMatDescr_t descrA, - const double* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - const double* B, - int ldb, - const double* beta, - double* C, - int ldc) { - return hipsparseDcsrmm2(handle, transA, transB, m, n, k, nnz, alpha, descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, B, ldb, beta, C, ldc); -} - -cusparseStatus_t cusparseCcsrmm2(cusparseHandle_t handle, - cusparseOperation_t transA, - cusparseOperation_t transB, - int m, - int n, - int k, - int nnz, - const cuComplex* alpha, - const cusparseMatDescr_t descrA, - const cuComplex* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - const cuComplex* B, - int ldb, - const cuComplex* beta, - cuComplex* C, - int ldc) { - return hipsparseCcsrmm2(handle, transA, transB, m, n, k, nnz, reinterpret_cast(alpha), descrA, reinterpret_cast(csrSortedValA), csrSortedRowPtrA, csrSortedColIndA, reinterpret_cast(B), ldb, reinterpret_cast(beta), reinterpret_cast(C), ldc); -} - -cusparseStatus_t cusparseZcsrmm2(cusparseHandle_t handle, - cusparseOperation_t transA, - cusparseOperation_t transB, - int m, - int n, - int k, - int nnz, - const cuDoubleComplex* alpha, - const cusparseMatDescr_t descrA, - const cuDoubleComplex* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - const cuDoubleComplex* B, - int ldb, - const cuDoubleComplex* beta, - cuDoubleComplex* C, - int ldc) { - return hipsparseZcsrmm2(handle, transA, transB, m, n, k, nnz, reinterpret_cast(alpha), descrA, reinterpret_cast(csrSortedValA), csrSortedRowPtrA, csrSortedColIndA, reinterpret_cast(B), ldb, reinterpret_cast(beta), reinterpret_cast(C), ldc); -} - -cusparseStatus_t cusparseCreateCsrsm2Info(csrsm2Info_t* info) { - return hipsparseCreateCsrsm2Info(info); -} -cusparseStatus_t cusparseDestroyCsrsm2Info(csrsm2Info_t info) { - return hipsparseDestroyCsrsm2Info(info); -} - -cusparseStatus_t cusparseScsrsm2_bufferSizeExt(cusparseHandle_t handle, - int algo, - cusparseOperation_t transA, - cusparseOperation_t transB, - int m, - int nrhs, - int nnz, - const float* alpha, - const cusparseMatDescr_t descrA, - const float* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - const float* B, - int ldb, - csrsm2Info_t info, - cusparseSolvePolicy_t policy, - size_t* pBufferSize) { - return hipsparseScsrsm2_bufferSizeExt(handle, algo, transA, transB, m, nrhs, nnz, alpha, descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, B, ldb, info, policy, pBufferSize); -} -cusparseStatus_t cusparseDcsrsm2_bufferSizeExt(cusparseHandle_t handle, - int algo, - cusparseOperation_t transA, - cusparseOperation_t transB, - int m, - int nrhs, - int nnz, - const double* alpha, - const cusparseMatDescr_t descrA, - const double* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - const double* B, - int ldb, - csrsm2Info_t info, - cusparseSolvePolicy_t policy, - size_t* pBufferSize) { - return hipsparseDcsrsm2_bufferSizeExt(handle, algo, transA, transB, m, nrhs, nnz, alpha, descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, B, ldb, info, policy, pBufferSize); -} -cusparseStatus_t cusparseCcsrsm2_bufferSizeExt(cusparseHandle_t handle, - int algo, - cusparseOperation_t transA, - cusparseOperation_t transB, - int m, - int nrhs, - int nnz, - const cuComplex* alpha, - const cusparseMatDescr_t descrA, - const cuComplex* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - const cuComplex* B, - int ldb, - csrsm2Info_t info, - cusparseSolvePolicy_t policy, - size_t* pBufferSize) { - return hipsparseCcsrsm2_bufferSizeExt(handle, algo, transA, transB, m, nrhs, nnz, reinterpret_cast(alpha), descrA, reinterpret_cast(csrSortedValA), csrSortedRowPtrA, csrSortedColIndA, reinterpret_cast(B), ldb, info, policy, pBufferSize); -} -cusparseStatus_t cusparseZcsrsm2_bufferSizeExt(cusparseHandle_t handle, - int algo, - cusparseOperation_t transA, - cusparseOperation_t transB, - int m, - int nrhs, - int nnz, - const cuDoubleComplex* alpha, - const cusparseMatDescr_t descrA, - const cuDoubleComplex* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - const cuDoubleComplex* B, - int ldb, - csrsm2Info_t info, - cusparseSolvePolicy_t policy, - size_t* pBufferSize) { - return hipsparseZcsrsm2_bufferSizeExt(handle, algo, transA, transB, m, nrhs, nnz, reinterpret_cast(alpha), descrA, reinterpret_cast(csrSortedValA), csrSortedRowPtrA, csrSortedColIndA, reinterpret_cast(B), ldb, info, policy, pBufferSize); -} - -cusparseStatus_t cusparseScsrsm2_analysis(cusparseHandle_t handle, - int algo, - cusparseOperation_t transA, - cusparseOperation_t transB, - int m, - int nrhs, - int nnz, - const float* alpha, - const cusparseMatDescr_t descrA, - const float* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - const float* B, - int ldb, - csrsm2Info_t info, - cusparseSolvePolicy_t policy, - void* pBuffer) { - return hipsparseScsrsm2_analysis(handle, algo, transA, transB, m, nrhs, nnz, alpha, descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, B, ldb, info, policy, pBuffer); -} -cusparseStatus_t cusparseDcsrsm2_analysis(cusparseHandle_t handle, - int algo, - cusparseOperation_t transA, - cusparseOperation_t transB, - int m, - int nrhs, - int nnz, - const double* alpha, - const cusparseMatDescr_t descrA, - const double* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - const double* B, - int ldb, - csrsm2Info_t info, - cusparseSolvePolicy_t policy, - void* pBuffer) { - return hipsparseDcsrsm2_analysis(handle, algo, transA, transB, m, nrhs, nnz, alpha, descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, B, ldb, info, policy, pBuffer); -} -cusparseStatus_t cusparseCcsrsm2_analysis(cusparseHandle_t handle, - int algo, - cusparseOperation_t transA, - cusparseOperation_t transB, - int m, - int nrhs, - int nnz, - const cuComplex* alpha, - const cusparseMatDescr_t descrA, - const cuComplex* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - const cuComplex* B, - int ldb, - csrsm2Info_t info, - cusparseSolvePolicy_t policy, - void* pBuffer) { - return hipsparseCcsrsm2_analysis(handle, algo, transA, transB, m, nrhs, nnz, reinterpret_cast(alpha), descrA, reinterpret_cast(csrSortedValA), csrSortedRowPtrA, csrSortedColIndA, reinterpret_cast(B), ldb, info, policy, pBuffer); -} -cusparseStatus_t cusparseZcsrsm2_analysis(cusparseHandle_t handle, - int algo, - cusparseOperation_t transA, - cusparseOperation_t transB, - int m, - int nrhs, - int nnz, - const cuDoubleComplex* alpha, - const cusparseMatDescr_t descrA, - const cuDoubleComplex* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - const cuDoubleComplex* B, - int ldb, - csrsm2Info_t info, - cusparseSolvePolicy_t policy, - void* pBuffer) { - return hipsparseZcsrsm2_analysis(handle, algo, transA, transB, m, nrhs, nnz, reinterpret_cast(alpha), descrA, reinterpret_cast(csrSortedValA), csrSortedRowPtrA, csrSortedColIndA, reinterpret_cast(B), ldb, info, policy, pBuffer); -} - -cusparseStatus_t cusparseScsrsm2_solve(cusparseHandle_t handle, - int algo, - cusparseOperation_t transA, - cusparseOperation_t transB, - int m, - int nrhs, - int nnz, - const float* alpha, - const cusparseMatDescr_t descrA, - const float* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - float* B, - int ldb, - csrsm2Info_t info, - cusparseSolvePolicy_t policy, - void* pBuffer) { - return hipsparseScsrsm2_solve(handle, algo, transA, transB, m, nrhs, nnz, alpha, descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, B, ldb, info, policy, pBuffer); -} -cusparseStatus_t cusparseDcsrsm2_solve(cusparseHandle_t handle, - int algo, - cusparseOperation_t transA, - cusparseOperation_t transB, - int m, - int nrhs, - int nnz, - const double* alpha, - const cusparseMatDescr_t descrA, - const double* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - double* B, - int ldb, - csrsm2Info_t info, - cusparseSolvePolicy_t policy, - void* pBuffer) { - return hipsparseDcsrsm2_solve(handle, algo, transA, transB, m, nrhs, nnz, alpha, descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, B, ldb, info, policy, pBuffer); -} -cusparseStatus_t cusparseCcsrsm2_solve(cusparseHandle_t handle, - int algo, - cusparseOperation_t transA, - cusparseOperation_t transB, - int m, - int nrhs, - int nnz, - const cuComplex* alpha, - const cusparseMatDescr_t descrA, - const cuComplex* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - cuComplex* B, - int ldb, - csrsm2Info_t info, - cusparseSolvePolicy_t policy, - void* pBuffer) { - return hipsparseCcsrsm2_solve(handle, algo, transA, transB, m, nrhs, nnz, reinterpret_cast(alpha), descrA, reinterpret_cast(csrSortedValA), csrSortedRowPtrA, csrSortedColIndA, reinterpret_cast(B), ldb, info, policy, pBuffer); -} -cusparseStatus_t cusparseZcsrsm2_solve(cusparseHandle_t handle, - int algo, - cusparseOperation_t transA, - cusparseOperation_t transB, - int m, - int nrhs, - int nnz, - const cuDoubleComplex* alpha, - const cusparseMatDescr_t descrA, - const cuDoubleComplex* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - cuDoubleComplex* B, - int ldb, - csrsm2Info_t info, - cusparseSolvePolicy_t policy, - void* pBuffer) { - return hipsparseZcsrsm2_solve(handle, algo, transA, transB, m, nrhs, nnz, reinterpret_cast(alpha), descrA, reinterpret_cast(csrSortedValA), csrSortedRowPtrA, csrSortedColIndA, reinterpret_cast(B), ldb, info, policy, pBuffer); -} - -cusparseStatus_t cusparseXcsrsm2_zeroPivot(cusparseHandle_t handle, - csrsm2Info_t info, - int* position) { - return hipsparseXcsrsm2_zeroPivot(handle, info, position); -} - -// cuSPARSE Extra Function -cusparseStatus_t cusparseXcsrgeamNnz(cusparseHandle_t handle, - int m, - int n, - const cusparseMatDescr_t descrA, - int nnzA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - const cusparseMatDescr_t descrB, - int nnzB, - const int* csrSortedRowPtrB, - const int* csrSortedColIndB, - const cusparseMatDescr_t descrC, - int* csrSortedRowPtrC, - int* nnzTotalDevHostPtr) { - return hipsparseXcsrgeamNnz(handle, m, n, descrA, nnzA, csrSortedRowPtrA, csrSortedColIndA, descrB, nnzB, csrSortedRowPtrB, csrSortedColIndB, descrC, csrSortedRowPtrC, nnzTotalDevHostPtr); -} - -cusparseStatus_t cusparseScsrgeam(cusparseHandle_t handle, - int m, - int n, - const float* alpha, - const cusparseMatDescr_t descrA, - int nnzA, - const float* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - const float* beta, - const cusparseMatDescr_t descrB, - int nnzB, - const float* csrSortedValB, - const int* csrSortedRowPtrB, - const int* csrSortedColIndB, - const cusparseMatDescr_t descrC, - float* csrSortedValC, - int* csrSortedRowPtrC, - int* csrSortedColIndC) { - return hipsparseScsrgeam(handle, m, n, alpha, descrA, nnzA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, beta, descrB, nnzB, csrSortedValB, csrSortedRowPtrB, csrSortedColIndB, descrC, csrSortedValC, csrSortedRowPtrC, csrSortedColIndC); -} - -cusparseStatus_t cusparseDcsrgeam(cusparseHandle_t handle, - int m, - int n, - const double* alpha, - const cusparseMatDescr_t descrA, - int nnzA, - const double* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - const double* beta, - const cusparseMatDescr_t descrB, - int nnzB, - const double* csrSortedValB, - const int* csrSortedRowPtrB, - const int* csrSortedColIndB, - const cusparseMatDescr_t descrC, - double* csrSortedValC, - int* csrSortedRowPtrC, - int* csrSortedColIndC) { - return hipsparseDcsrgeam(handle, m, n, alpha, descrA, nnzA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, beta, descrB, nnzB, csrSortedValB, csrSortedRowPtrB, csrSortedColIndB, descrC, csrSortedValC, csrSortedRowPtrC, csrSortedColIndC); -} - -cusparseStatus_t cusparseCcsrgeam(cusparseHandle_t handle, - int m, - int n, - const cuComplex* alpha, - const cusparseMatDescr_t descrA, - int nnzA, - const cuComplex* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - const cuComplex* beta, - const cusparseMatDescr_t descrB, - int nnzB, - const cuComplex* csrSortedValB, - const int* csrSortedRowPtrB, - const int* csrSortedColIndB, - const cusparseMatDescr_t descrC, - cuComplex* csrSortedValC, - int* csrSortedRowPtrC, - int* csrSortedColIndC) { - return hipsparseCcsrgeam(handle, m, n, reinterpret_cast(alpha), descrA, nnzA, reinterpret_cast(csrSortedValA), csrSortedRowPtrA, csrSortedColIndA, reinterpret_cast(beta), descrB, nnzB, reinterpret_cast(csrSortedValB), csrSortedRowPtrB, csrSortedColIndB, descrC, reinterpret_cast(csrSortedValC), csrSortedRowPtrC, csrSortedColIndC); -} - -cusparseStatus_t cusparseZcsrgeam(cusparseHandle_t handle, - int m, - int n, - const cuDoubleComplex* alpha, - const cusparseMatDescr_t descrA, - int nnzA, - const cuDoubleComplex* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - const cuDoubleComplex* beta, - const cusparseMatDescr_t descrB, - int nnzB, - const cuDoubleComplex* csrSortedValB, - const int* csrSortedRowPtrB, - const int* csrSortedColIndB, - const cusparseMatDescr_t descrC, - cuDoubleComplex* csrSortedValC, - int* csrSortedRowPtrC, - int* csrSortedColIndC) { - return hipsparseZcsrgeam(handle, m, n, reinterpret_cast(alpha), descrA, nnzA, reinterpret_cast(csrSortedValA), csrSortedRowPtrA, csrSortedColIndA, reinterpret_cast(beta), descrB, nnzB, reinterpret_cast(csrSortedValB), csrSortedRowPtrB, csrSortedColIndB, descrC, reinterpret_cast(csrSortedValC), csrSortedRowPtrC, csrSortedColIndC); -} - -cusparseStatus_t cusparseScsrgeam2_bufferSizeExt(cusparseHandle_t handle, - int m, - int n, - const float* alpha, - const cusparseMatDescr_t descrA, - int nnzA, - const float* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - const float* beta, - const cusparseMatDescr_t descrB, - int nnzB, - const float* csrSortedValB, - const int* csrSortedRowPtrB, - const int* csrSortedColIndB, - const cusparseMatDescr_t descrC, - const float* csrSortedValC, - const int* csrSortedRowPtrC, - const int* csrSortedColIndC, - size_t* pBufferSizeInBytes) { - return hipsparseScsrgeam2_bufferSizeExt(handle, m, n, alpha, descrA, nnzA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, beta, descrB, nnzB, csrSortedValB, csrSortedRowPtrB, csrSortedColIndB, descrC, csrSortedValC, csrSortedRowPtrC, csrSortedColIndC, pBufferSizeInBytes); -} - -cusparseStatus_t cusparseDcsrgeam2_bufferSizeExt(cusparseHandle_t handle, - int m, - int n, - const double* alpha, - const cusparseMatDescr_t descrA, - int nnzA, - const double* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - const double* beta, - const cusparseMatDescr_t descrB, - int nnzB, - const double* csrSortedValB, - const int* csrSortedRowPtrB, - const int* csrSortedColIndB, - const cusparseMatDescr_t descrC, - const double* csrSortedValC, - const int* csrSortedRowPtrC, - const int* csrSortedColIndC, - size_t* pBufferSizeInBytes) { - return hipsparseDcsrgeam2_bufferSizeExt(handle, m, n, alpha, descrA, nnzA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, beta, descrB, nnzB, csrSortedValB, csrSortedRowPtrB, csrSortedColIndB, descrC, csrSortedValC, csrSortedRowPtrC, csrSortedColIndC, pBufferSizeInBytes); -} - -cusparseStatus_t cusparseCcsrgeam2_bufferSizeExt(cusparseHandle_t handle, - int m, - int n, - const cuComplex* alpha, - const cusparseMatDescr_t descrA, - int nnzA, - const cuComplex* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - const cuComplex* beta, - const cusparseMatDescr_t descrB, - int nnzB, - const cuComplex* csrSortedValB, - const int* csrSortedRowPtrB, - const int* csrSortedColIndB, - const cusparseMatDescr_t descrC, - const cuComplex* csrSortedValC, - const int* csrSortedRowPtrC, - const int* csrSortedColIndC, - size_t* pBufferSizeInBytes) { - return hipsparseCcsrgeam2_bufferSizeExt(handle, m, n, reinterpret_cast(alpha), descrA, nnzA, reinterpret_cast(csrSortedValA), csrSortedRowPtrA, csrSortedColIndA, reinterpret_cast(beta), descrB, nnzB, reinterpret_cast(csrSortedValB), csrSortedRowPtrB, csrSortedColIndB, descrC, reinterpret_cast(csrSortedValC), csrSortedRowPtrC, csrSortedColIndC, pBufferSizeInBytes); -} - -cusparseStatus_t cusparseZcsrgeam2_bufferSizeExt(cusparseHandle_t handle, - int m, - int n, - const cuDoubleComplex* alpha, - const cusparseMatDescr_t descrA, - int nnzA, - const cuDoubleComplex* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - const cuDoubleComplex* beta, - const cusparseMatDescr_t descrB, - int nnzB, - const cuDoubleComplex* csrSortedValB, - const int* csrSortedRowPtrB, - const int* csrSortedColIndB, - const cusparseMatDescr_t descrC, - const cuDoubleComplex* csrSortedValC, - const int* csrSortedRowPtrC, - const int* csrSortedColIndC, - size_t* pBufferSizeInBytes) { - return hipsparseZcsrgeam2_bufferSizeExt(handle, m, n, reinterpret_cast(alpha), descrA, nnzA, reinterpret_cast(csrSortedValA), csrSortedRowPtrA, csrSortedColIndA, reinterpret_cast(beta), descrB, nnzB, reinterpret_cast(csrSortedValB), csrSortedRowPtrB, csrSortedColIndB, descrC, reinterpret_cast(csrSortedValC), csrSortedRowPtrC, csrSortedColIndC, pBufferSizeInBytes); -} - -cusparseStatus_t cusparseXcsrgeam2Nnz(cusparseHandle_t handle, - int m, - int n, - const cusparseMatDescr_t descrA, - int nnzA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - const cusparseMatDescr_t descrB, - int nnzB, - const int* csrSortedRowPtrB, - const int* csrSortedColIndB, - const cusparseMatDescr_t descrC, - int* csrSortedRowPtrC, - int* nnzTotalDevHostPtr, - void* workspace) { - return hipsparseXcsrgeam2Nnz(handle, m, n, descrA, nnzA, csrSortedRowPtrA, csrSortedColIndA, descrB, nnzB, csrSortedRowPtrB, csrSortedColIndB, descrC, csrSortedRowPtrC, nnzTotalDevHostPtr, workspace); -} - -cusparseStatus_t cusparseScsrgeam2(cusparseHandle_t handle, - int m, - int n, - const float* alpha, - const cusparseMatDescr_t descrA, - int nnzA, - const float* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - const float* beta, - const cusparseMatDescr_t descrB, - int nnzB, - const float* csrSortedValB, - const int* csrSortedRowPtrB, - const int* csrSortedColIndB, - const cusparseMatDescr_t descrC, - float* csrSortedValC, - int* csrSortedRowPtrC, - int* csrSortedColIndC, - void* pBuffer) { - return hipsparseScsrgeam2(handle, m, n, alpha, descrA, nnzA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, beta, descrB, nnzB, csrSortedValB, csrSortedRowPtrB, csrSortedColIndB, descrC, csrSortedValC, csrSortedRowPtrC, csrSortedColIndC, pBuffer); -} - -cusparseStatus_t cusparseDcsrgeam2(cusparseHandle_t handle, - int m, - int n, - const double* alpha, - const cusparseMatDescr_t descrA, - int nnzA, - const double* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - const double* beta, - const cusparseMatDescr_t descrB, - int nnzB, - const double* csrSortedValB, - const int* csrSortedRowPtrB, - const int* csrSortedColIndB, - const cusparseMatDescr_t descrC, - double* csrSortedValC, - int* csrSortedRowPtrC, - int* csrSortedColIndC, - void* pBuffer) { - return hipsparseDcsrgeam2(handle, m, n, alpha, descrA, nnzA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, beta, descrB, nnzB, csrSortedValB, csrSortedRowPtrB, csrSortedColIndB, descrC, csrSortedValC, csrSortedRowPtrC, csrSortedColIndC, pBuffer); -} - -cusparseStatus_t cusparseCcsrgeam2(cusparseHandle_t handle, - int m, - int n, - const cuComplex* alpha, - const cusparseMatDescr_t descrA, - int nnzA, - const cuComplex* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - const cuComplex* beta, - const cusparseMatDescr_t descrB, - int nnzB, - const cuComplex* csrSortedValB, - const int* csrSortedRowPtrB, - const int* csrSortedColIndB, - const cusparseMatDescr_t descrC, - cuComplex* csrSortedValC, - int* csrSortedRowPtrC, - int* csrSortedColIndC, - void* pBuffer) { - return hipsparseCcsrgeam2(handle, m, n, reinterpret_cast(alpha), descrA, nnzA, reinterpret_cast(csrSortedValA), csrSortedRowPtrA, csrSortedColIndA, reinterpret_cast(beta), descrB, nnzB, reinterpret_cast(csrSortedValB), csrSortedRowPtrB, csrSortedColIndB, descrC, reinterpret_cast(csrSortedValC), csrSortedRowPtrC, csrSortedColIndC, pBuffer); -} - -cusparseStatus_t cusparseZcsrgeam2(cusparseHandle_t handle, - int m, - int n, - const cuDoubleComplex* alpha, - const cusparseMatDescr_t descrA, - int nnzA, - const cuDoubleComplex* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - const cuDoubleComplex* beta, - const cusparseMatDescr_t descrB, - int nnzB, - const cuDoubleComplex* csrSortedValB, - const int* csrSortedRowPtrB, - const int* csrSortedColIndB, - const cusparseMatDescr_t descrC, - cuDoubleComplex* csrSortedValC, - int* csrSortedRowPtrC, - int* csrSortedColIndC, - void* pBuffer) { - return hipsparseZcsrgeam2(handle, m, n, reinterpret_cast(alpha), descrA, nnzA, reinterpret_cast(csrSortedValA), csrSortedRowPtrA, csrSortedColIndA, reinterpret_cast(beta), descrB, nnzB, reinterpret_cast(csrSortedValB), csrSortedRowPtrB, csrSortedColIndB, descrC, reinterpret_cast(csrSortedValC), csrSortedRowPtrC, csrSortedColIndC, pBuffer); -} - -cusparseStatus_t cusparseXcsrgemmNnz(cusparseHandle_t handle, - cusparseOperation_t transA, - cusparseOperation_t transB, - int m, - int n, - int k, - const cusparseMatDescr_t descrA, - const int nnzA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - const cusparseMatDescr_t descrB, - const int nnzB, - const int* csrSortedRowPtrB, - const int* csrSortedColIndB, - const cusparseMatDescr_t descrC, - int* csrSortedRowPtrC, - int* nnzTotalDevHostPtr) { - return hipsparseXcsrgemmNnz(handle, transA, transB, m, n, k, descrA, nnzA, csrSortedRowPtrA, csrSortedColIndA, descrB, nnzB, csrSortedRowPtrB, csrSortedColIndB, descrC, csrSortedRowPtrC, nnzTotalDevHostPtr); -} - -cusparseStatus_t cusparseScsrgemm(cusparseHandle_t handle, - cusparseOperation_t transA, - cusparseOperation_t transB, - int m, - int n, - int k, - const cusparseMatDescr_t descrA, - const int nnzA, - const float* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - const cusparseMatDescr_t descrB, - const int nnzB, - const float* csrSortedValB, - const int* csrSortedRowPtrB, - const int* csrSortedColIndB, - const cusparseMatDescr_t descrC, - float* csrSortedValC, - const int* csrSortedRowPtrC, - int* csrSortedColIndC) { - return hipsparseScsrgemm(handle, transA, transB, m, n, k, descrA, nnzA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, descrB, nnzB, csrSortedValB, csrSortedRowPtrB, csrSortedColIndB, descrC, csrSortedValC, csrSortedRowPtrC, csrSortedColIndC); -} - -cusparseStatus_t cusparseDcsrgemm(cusparseHandle_t handle, - cusparseOperation_t transA, - cusparseOperation_t transB, - int m, - int n, - int k, - const cusparseMatDescr_t descrA, - int nnzA, - const double* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - const cusparseMatDescr_t descrB, - int nnzB, - const double* csrSortedValB, - const int* csrSortedRowPtrB, - const int* csrSortedColIndB, - const cusparseMatDescr_t descrC, - double* csrSortedValC, - const int* csrSortedRowPtrC, - int* csrSortedColIndC) { - return hipsparseDcsrgemm(handle, transA, transB, m, n, k, descrA, nnzA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, descrB, nnzB, csrSortedValB, csrSortedRowPtrB, csrSortedColIndB, descrC, csrSortedValC, csrSortedRowPtrC, csrSortedColIndC); -} - -cusparseStatus_t cusparseCcsrgemm(cusparseHandle_t handle, - cusparseOperation_t transA, - cusparseOperation_t transB, - int m, - int n, - int k, - const cusparseMatDescr_t descrA, - int nnzA, - const cuComplex* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - const cusparseMatDescr_t descrB, - int nnzB, - const cuComplex* csrSortedValB, - const int* csrSortedRowPtrB, - const int* csrSortedColIndB, - const cusparseMatDescr_t descrC, - cuComplex* csrSortedValC, - const int* csrSortedRowPtrC, - int* csrSortedColIndC) { - return hipsparseCcsrgemm(handle, transA, transB, m, n, k, descrA, nnzA, reinterpret_cast(csrSortedValA), csrSortedRowPtrA, csrSortedColIndA, descrB, nnzB, reinterpret_cast(csrSortedValB), csrSortedRowPtrB, csrSortedColIndB, descrC, reinterpret_cast(csrSortedValC), csrSortedRowPtrC, csrSortedColIndC); -} - -cusparseStatus_t cusparseZcsrgemm(cusparseHandle_t handle, - cusparseOperation_t transA, - cusparseOperation_t transB, - int m, - int n, - int k, - const cusparseMatDescr_t descrA, - int nnzA, - const cuDoubleComplex* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - const cusparseMatDescr_t descrB, - int nnzB, - const cuDoubleComplex* csrSortedValB, - const int* csrSortedRowPtrB, - const int* csrSortedColIndB, - const cusparseMatDescr_t descrC, - cuDoubleComplex* csrSortedValC, - const int* csrSortedRowPtrC, - int* csrSortedColIndC) { - return hipsparseZcsrgemm(handle, transA, transB, m, n, k, descrA, nnzA, reinterpret_cast(csrSortedValA), csrSortedRowPtrA, csrSortedColIndA, descrB, nnzB, reinterpret_cast(csrSortedValB), csrSortedRowPtrB, csrSortedColIndB, descrC, reinterpret_cast(csrSortedValC), csrSortedRowPtrC, csrSortedColIndC); -} - -cusparseStatus_t cusparseCreateCsrgemm2Info(csrgemm2Info_t* info) { - return hipsparseCreateCsrgemm2Info(info); -} - -cusparseStatus_t cusparseDestroyCsrgemm2Info(csrgemm2Info_t info) { - return hipsparseDestroyCsrgemm2Info(info); -} - -cusparseStatus_t cusparseScsrgemm2_bufferSizeExt(cusparseHandle_t handle, - int m, - int n, - int k, - const float* alpha, - const cusparseMatDescr_t descrA, - int nnzA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - const cusparseMatDescr_t descrB, - int nnzB, - const int* csrSortedRowPtrB, - const int* csrSortedColIndB, - const float* beta, - const cusparseMatDescr_t descrD, - int nnzD, - const int* csrSortedRowPtrD, - const int* csrSortedColIndD, - csrgemm2Info_t info, - size_t* pBufferSizeInBytes) { - return hipsparseScsrgemm2_bufferSizeExt(handle, m, n, k, alpha, descrA, nnzA, csrSortedRowPtrA, csrSortedColIndA, descrB, nnzB, csrSortedRowPtrB, csrSortedColIndB, beta, descrD, nnzD, csrSortedRowPtrD, csrSortedColIndD, info, pBufferSizeInBytes); -} - -cusparseStatus_t cusparseDcsrgemm2_bufferSizeExt(cusparseHandle_t handle, - int m, - int n, - int k, - const double* alpha, - const cusparseMatDescr_t descrA, - int nnzA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - const cusparseMatDescr_t descrB, - int nnzB, - const int* csrSortedRowPtrB, - const int* csrSortedColIndB, - const double* beta, - const cusparseMatDescr_t descrD, - int nnzD, - const int* csrSortedRowPtrD, - const int* csrSortedColIndD, - csrgemm2Info_t info, - size_t* pBufferSizeInBytes) { - return hipsparseDcsrgemm2_bufferSizeExt(handle, m, n, k, alpha, descrA, nnzA, csrSortedRowPtrA, csrSortedColIndA, descrB, nnzB, csrSortedRowPtrB, csrSortedColIndB, beta, descrD, nnzD, csrSortedRowPtrD, csrSortedColIndD, info, pBufferSizeInBytes); -} - -cusparseStatus_t cusparseCcsrgemm2_bufferSizeExt(cusparseHandle_t handle, - int m, - int n, - int k, - const cuComplex* alpha, - const cusparseMatDescr_t descrA, - int nnzA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - const cusparseMatDescr_t descrB, - int nnzB, - const int* csrSortedRowPtrB, - const int* csrSortedColIndB, - const cuComplex* beta, - const cusparseMatDescr_t descrD, - int nnzD, - const int* csrSortedRowPtrD, - const int* csrSortedColIndD, - csrgemm2Info_t info, - size_t* pBufferSizeInBytes) { - return hipsparseCcsrgemm2_bufferSizeExt(handle, m, n, k, reinterpret_cast(alpha), descrA, nnzA, csrSortedRowPtrA, csrSortedColIndA, descrB, nnzB, csrSortedRowPtrB, csrSortedColIndB, reinterpret_cast(beta), descrD, nnzD, csrSortedRowPtrD, csrSortedColIndD, info, pBufferSizeInBytes); -} - -cusparseStatus_t cusparseZcsrgemm2_bufferSizeExt(cusparseHandle_t handle, - int m, - int n, - int k, - const cuDoubleComplex* alpha, - const cusparseMatDescr_t descrA, - int nnzA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - const cusparseMatDescr_t descrB, - int nnzB, - const int* csrSortedRowPtrB, - const int* csrSortedColIndB, - const cuDoubleComplex* beta, - const cusparseMatDescr_t descrD, - int nnzD, - const int* csrSortedRowPtrD, - const int* csrSortedColIndD, - csrgemm2Info_t info, - size_t* pBufferSizeInBytes) { - return hipsparseZcsrgemm2_bufferSizeExt(handle, m, n, k, reinterpret_cast(alpha), descrA, nnzA, csrSortedRowPtrA, csrSortedColIndA, descrB, nnzB, csrSortedRowPtrB, csrSortedColIndB, reinterpret_cast(beta), descrD, nnzD, csrSortedRowPtrD, csrSortedColIndD, info, pBufferSizeInBytes); -} - -cusparseStatus_t cusparseXcsrgemm2Nnz(cusparseHandle_t handle, - int m, - int n, - int k, - const cusparseMatDescr_t descrA, - int nnzA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - const cusparseMatDescr_t descrB, - int nnzB, - const int* csrSortedRowPtrB, - const int* csrSortedColIndB, - const cusparseMatDescr_t descrD, - int nnzD, - const int* csrSortedRowPtrD, - const int* csrSortedColIndD, - const cusparseMatDescr_t descrC, - int* csrSortedRowPtrC, - int* nnzTotalDevHostPtr, - const csrgemm2Info_t info, - void* pBuffer) { - return hipsparseXcsrgemm2Nnz(handle, m, n, k, descrA, nnzA, csrSortedRowPtrA, csrSortedColIndA, descrB, nnzB, csrSortedRowPtrB, csrSortedColIndB, descrD, nnzD, csrSortedRowPtrD, csrSortedColIndD, descrC, csrSortedRowPtrC, nnzTotalDevHostPtr, info, pBuffer); -} - -cusparseStatus_t cusparseScsrgemm2(cusparseHandle_t handle, - int m, - int n, - int k, - const float* alpha, - const cusparseMatDescr_t descrA, - int nnzA, - const float* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - const cusparseMatDescr_t descrB, - int nnzB, - const float* csrSortedValB, - const int* csrSortedRowPtrB, - const int* csrSortedColIndB, - const float* beta, - const cusparseMatDescr_t descrD, - int nnzD, - const float* csrSortedValD, - const int* csrSortedRowPtrD, - const int* csrSortedColIndD, - const cusparseMatDescr_t descrC, - float* csrSortedValC, - const int* csrSortedRowPtrC, - int* csrSortedColIndC, - const csrgemm2Info_t info, - void* pBuffer) { - return hipsparseScsrgemm2(handle, m, n, k, alpha, descrA, nnzA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, descrB, nnzB, csrSortedValB, csrSortedRowPtrB, csrSortedColIndB, beta, descrD, nnzD, csrSortedValD, csrSortedRowPtrD, csrSortedColIndD, descrC, csrSortedValC, csrSortedRowPtrC, csrSortedColIndC, info, pBuffer); -} - -cusparseStatus_t cusparseDcsrgemm2(cusparseHandle_t handle, - int m, - int n, - int k, - const double* alpha, - const cusparseMatDescr_t descrA, - int nnzA, - const double* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - const cusparseMatDescr_t descrB, - int nnzB, - const double* csrSortedValB, - const int* csrSortedRowPtrB, - const int* csrSortedColIndB, - const double* beta, - const cusparseMatDescr_t descrD, - int nnzD, - const double* csrSortedValD, - const int* csrSortedRowPtrD, - const int* csrSortedColIndD, - const cusparseMatDescr_t descrC, - double* csrSortedValC, - const int* csrSortedRowPtrC, - int* csrSortedColIndC, - const csrgemm2Info_t info, - void* pBuffer) { - return hipsparseDcsrgemm2(handle, m, n, k, alpha, descrA, nnzA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, descrB, nnzB, csrSortedValB, csrSortedRowPtrB, csrSortedColIndB, beta, descrD, nnzD, csrSortedValD, csrSortedRowPtrD, csrSortedColIndD, descrC, csrSortedValC, csrSortedRowPtrC, csrSortedColIndC, info, pBuffer); -} - -cusparseStatus_t cusparseCcsrgemm2(cusparseHandle_t handle, - int m, - int n, - int k, - const cuComplex* alpha, - const cusparseMatDescr_t descrA, - int nnzA, - const cuComplex* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - const cusparseMatDescr_t descrB, - int nnzB, - const cuComplex* csrSortedValB, - const int* csrSortedRowPtrB, - const int* csrSortedColIndB, - const cuComplex* beta, - const cusparseMatDescr_t descrD, - int nnzD, - const cuComplex* csrSortedValD, - const int* csrSortedRowPtrD, - const int* csrSortedColIndD, - const cusparseMatDescr_t descrC, - cuComplex* csrSortedValC, - const int* csrSortedRowPtrC, - int* csrSortedColIndC, - const csrgemm2Info_t info, - void* pBuffer) { - return hipsparseCcsrgemm2(handle, m, n, k, reinterpret_cast(alpha), descrA, nnzA, reinterpret_cast(csrSortedValA), csrSortedRowPtrA, csrSortedColIndA, descrB, nnzB, reinterpret_cast(csrSortedValB), csrSortedRowPtrB, csrSortedColIndB, reinterpret_cast(beta), descrD, nnzD, reinterpret_cast(csrSortedValD), csrSortedRowPtrD, csrSortedColIndD, descrC, reinterpret_cast(csrSortedValC), csrSortedRowPtrC, csrSortedColIndC, info, pBuffer); -} - -cusparseStatus_t cusparseZcsrgemm2(cusparseHandle_t handle, - int m, - int n, - int k, - const cuDoubleComplex* alpha, - const cusparseMatDescr_t descrA, - int nnzA, - const cuDoubleComplex* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - const cusparseMatDescr_t descrB, - int nnzB, - const cuDoubleComplex* csrSortedValB, - const int* csrSortedRowPtrB, - const int* csrSortedColIndB, - const cuDoubleComplex* beta, - const cusparseMatDescr_t descrD, - int nnzD, - const cuDoubleComplex* csrSortedValD, - const int* csrSortedRowPtrD, - const int* csrSortedColIndD, - const cusparseMatDescr_t descrC, - cuDoubleComplex* csrSortedValC, - const int* csrSortedRowPtrC, - int* csrSortedColIndC, - const csrgemm2Info_t info, - void* pBuffer) { - return hipsparseZcsrgemm2(handle, m, n, k, reinterpret_cast(alpha), descrA, nnzA, reinterpret_cast(csrSortedValA), csrSortedRowPtrA, csrSortedColIndA, descrB, nnzB, reinterpret_cast(csrSortedValB), csrSortedRowPtrB, csrSortedColIndB, reinterpret_cast(beta), descrD, nnzD, reinterpret_cast(csrSortedValD), csrSortedRowPtrD, csrSortedColIndD, descrC, reinterpret_cast(csrSortedValC), csrSortedRowPtrC, csrSortedColIndC, info, pBuffer); -} - -// cuSPARSE Format Convrsion -cusparseStatus_t cusparseXcoo2csr(cusparseHandle_t handle, - const int* cooRowInd, - int nnz, - int m, - int* csrSortedRowPtr, - cusparseIndexBase_t idxBase) { - return hipsparseXcoo2csr(handle, cooRowInd, nnz, m, csrSortedRowPtr, idxBase); -} - -cusparseStatus_t cusparseScsc2dense(cusparseHandle_t handle, - int m, - int n, - const cusparseMatDescr_t descrA, - const float* cscSortedValA, - const int* cscSortedRowIndA, - const int* cscSortedColPtrA, - float* A, - int lda) { - return hipsparseScsc2dense(handle, m, n, descrA, cscSortedValA, cscSortedRowIndA, cscSortedColPtrA, A, lda); -} - -cusparseStatus_t cusparseDcsc2dense(cusparseHandle_t handle, - int m, - int n, - const cusparseMatDescr_t descrA, - const double* cscSortedValA, - const int* cscSortedRowIndA, - const int* cscSortedColPtrA, - double* A, - int lda) { - return hipsparseDcsc2dense(handle, m, n, descrA, cscSortedValA, cscSortedRowIndA, cscSortedColPtrA, A, lda); -} - -cusparseStatus_t cusparseCcsc2dense(cusparseHandle_t handle, - int m, - int n, - const cusparseMatDescr_t descrA, - const cuComplex* cscSortedValA, - const int* cscSortedRowIndA, - const int* cscSortedColPtrA, - cuComplex* A, - int lda) { - return hipsparseCcsc2dense(handle, m, n, descrA, reinterpret_cast(cscSortedValA), cscSortedRowIndA, cscSortedColPtrA, reinterpret_cast(A), lda); -} - -cusparseStatus_t cusparseZcsc2dense(cusparseHandle_t handle, - int m, - int n, - const cusparseMatDescr_t descrA, - const cuDoubleComplex* cscSortedValA, - const int* cscSortedRowIndA, - const int* cscSortedColPtrA, - cuDoubleComplex* A, - int lda) { - return hipsparseZcsc2dense(handle, m, n, descrA, reinterpret_cast(cscSortedValA), cscSortedRowIndA, cscSortedColPtrA, reinterpret_cast(A), lda); -} - -cusparseStatus_t cusparseXcsr2coo(cusparseHandle_t handle, - const int* csrSortedRowPtr, - int nnz, - int m, - int* cooRowInd, - cusparseIndexBase_t idxBase) { - return hipsparseXcsr2coo(handle, csrSortedRowPtr, nnz, m, cooRowInd, idxBase); -} - -cusparseStatus_t cusparseScsr2csc(cusparseHandle_t handle, - int m, - int n, - int nnz, - const float* csrSortedVal, - const int* csrSortedRowPtr, - const int* csrSortedColInd, - float* cscSortedVal, - int* cscSortedRowInd, - int* cscSortedColPtr, - cusparseAction_t copyValues, - cusparseIndexBase_t idxBase) { - return hipsparseScsr2csc(handle, m, n, nnz, csrSortedVal, csrSortedRowPtr, csrSortedColInd, cscSortedVal, cscSortedRowInd, cscSortedColPtr, copyValues, idxBase); -} - -cusparseStatus_t cusparseDcsr2csc(cusparseHandle_t handle, - int m, - int n, - int nnz, - const double* csrSortedVal, - const int* csrSortedRowPtr, - const int* csrSortedColInd, - double* cscSortedVal, - int* cscSortedRowInd, - int* cscSortedColPtr, - cusparseAction_t copyValues, - cusparseIndexBase_t idxBase) { - return hipsparseDcsr2csc(handle, m, n, nnz, csrSortedVal, csrSortedRowPtr, csrSortedColInd, cscSortedVal, cscSortedRowInd, cscSortedColPtr, copyValues, idxBase); -} - -cusparseStatus_t cusparseCcsr2csc(cusparseHandle_t handle, - int m, - int n, - int nnz, - const cuComplex* csrSortedVal, - const int* csrSortedRowPtr, - const int* csrSortedColInd, - cuComplex* cscSortedVal, - int* cscSortedRowInd, - int* cscSortedColPtr, - cusparseAction_t copyValues, - cusparseIndexBase_t idxBase) { - return hipsparseCcsr2csc(handle, m, n, nnz, reinterpret_cast(csrSortedVal), csrSortedRowPtr, csrSortedColInd, reinterpret_cast(cscSortedVal), cscSortedRowInd, cscSortedColPtr, copyValues, idxBase); -} - -cusparseStatus_t cusparseZcsr2csc(cusparseHandle_t handle, - int m, - int n, - int nnz, - const cuDoubleComplex* csrSortedVal, - const int* csrSortedRowPtr, - const int* csrSortedColInd, - cuDoubleComplex* cscSortedVal, - int* cscSortedRowInd, - int* cscSortedColPtr, - cusparseAction_t copyValues, - cusparseIndexBase_t idxBase) { - return hipsparseZcsr2csc(handle, m, n, nnz, reinterpret_cast(csrSortedVal), csrSortedRowPtr, csrSortedColInd, reinterpret_cast(cscSortedVal), cscSortedRowInd, cscSortedColPtr, copyValues, idxBase); -} - - -cusparseStatus_t cusparseScsr2dense(cusparseHandle_t handle, - int m, - int n, - const cusparseMatDescr_t descrA, - const float* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - float* A, - int lda) { - return hipsparseScsr2dense(handle, m, n, descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, A, lda); -} - -cusparseStatus_t cusparseDcsr2dense(cusparseHandle_t handle, - int m, - int n, - const cusparseMatDescr_t descrA, - const double* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - double* A, - int lda) { - return hipsparseDcsr2dense(handle, m, n, descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, A, lda); -} - -cusparseStatus_t cusparseCcsr2dense(cusparseHandle_t handle, - int m, - int n, - const cusparseMatDescr_t descrA, - const cuComplex* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - cuComplex* A, - int lda) { - return hipsparseCcsr2dense(handle, m, n, descrA, reinterpret_cast(csrSortedValA), csrSortedRowPtrA, csrSortedColIndA, reinterpret_cast(A), lda); -} - -cusparseStatus_t cusparseZcsr2dense(cusparseHandle_t handle, - int m, - int n, - const cusparseMatDescr_t descrA, - const cuDoubleComplex* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - cuDoubleComplex* A, - int lda) { - return hipsparseZcsr2dense(handle, m, n, descrA, reinterpret_cast(csrSortedValA), csrSortedRowPtrA, csrSortedColIndA, reinterpret_cast(A), lda); -} - -cusparseStatus_t cusparseSdense2csc(cusparseHandle_t handle, - int m, - int n, - const cusparseMatDescr_t descrA, - const float* A, - int lda, - const int* nnzPerCol, - float* cscSortedValA, - int* cscSortedRowIndA, - int* cscSortedColPtrA) { - return hipsparseSdense2csc(handle, m, n, descrA, A, lda, nnzPerCol, cscSortedValA, cscSortedRowIndA, cscSortedColPtrA); -} - -cusparseStatus_t cusparseDdense2csc(cusparseHandle_t handle, - int m, - int n, - const cusparseMatDescr_t descrA, - const double* A, - int lda, - const int* nnzPerCol, - double* cscSortedValA, - int* cscSortedRowIndA, - int* cscSortedColPtrA) { - return hipsparseDdense2csc(handle, m, n, descrA, A, lda, nnzPerCol, cscSortedValA, cscSortedRowIndA, cscSortedColPtrA); -} - -cusparseStatus_t cusparseCdense2csc(cusparseHandle_t handle, - int m, - int n, - const cusparseMatDescr_t descrA, - const cuComplex* A, - int lda, - const int* nnzPerCol, - cuComplex* cscSortedValA, - int* cscSortedRowIndA, - int* cscSortedColPtrA) { - return hipsparseCdense2csc(handle, m, n, descrA, reinterpret_cast(A), lda, nnzPerCol, reinterpret_cast(cscSortedValA), cscSortedRowIndA, cscSortedColPtrA); -} - -cusparseStatus_t cusparseZdense2csc(cusparseHandle_t handle, - int m, - int n, - const cusparseMatDescr_t descrA, - const cuDoubleComplex* A, - int lda, - const int* nnzPerCol, - cuDoubleComplex* cscSortedValA, - int* cscSortedRowIndA, - int* cscSortedColPtrA) { - return hipsparseZdense2csc(handle, m, n, descrA, reinterpret_cast(A), lda, nnzPerCol, reinterpret_cast(cscSortedValA), cscSortedRowIndA, cscSortedColPtrA); -} - -cusparseStatus_t cusparseSdense2csr(cusparseHandle_t handle, - int m, - int n, - const cusparseMatDescr_t descrA, - const float* A, - int lda, - const int* nnzPerRow, - float* csrSortedValA, - int* csrSortedRowPtrA, - int* csrSortedColIndA) { - return hipsparseSdense2csr(handle, m, n, descrA, A, lda, nnzPerRow, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA); -} - -cusparseStatus_t cusparseDdense2csr(cusparseHandle_t handle, - int m, - int n, - const cusparseMatDescr_t descrA, - const double* A, - int lda, - const int* nnzPerRow, - double* csrSortedValA, - int* csrSortedRowPtrA, - int* csrSortedColIndA) { - return hipsparseDdense2csr(handle, m, n, descrA, A, lda, nnzPerRow, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA); -} - -cusparseStatus_t cusparseCdense2csr(cusparseHandle_t handle, - int m, - int n, - const cusparseMatDescr_t descrA, - const cuComplex* A, - int lda, - const int* nnzPerRow, - cuComplex* csrSortedValA, - int* csrSortedRowPtrA, - int* csrSortedColIndA) { - return hipsparseCdense2csr(handle, m, n, descrA, reinterpret_cast(A), lda, nnzPerRow, reinterpret_cast(csrSortedValA), csrSortedRowPtrA, csrSortedColIndA); -} - -cusparseStatus_t cusparseZdense2csr(cusparseHandle_t handle, - int m, - int n, - const cusparseMatDescr_t descrA, - const cuDoubleComplex* A, - int lda, - const int* nnzPerRow, - cuDoubleComplex* csrSortedValA, - int* csrSortedRowPtrA, - int* csrSortedColIndA) { - return hipsparseZdense2csr(handle, m, n, descrA, reinterpret_cast(A), lda, nnzPerRow, reinterpret_cast(csrSortedValA), csrSortedRowPtrA, csrSortedColIndA); -} - -cusparseStatus_t cusparseSnnz(cusparseHandle_t handle, - cusparseDirection_t dirA, - int m, - int n, - const cusparseMatDescr_t descrA, - const float* A, - int lda, - int* nnzPerRowCol, - int* nnzTotalDevHostPtr) { - return hipsparseSnnz(handle, dirA, m, n, descrA, A, lda, nnzPerRowCol, nnzTotalDevHostPtr); -} - -cusparseStatus_t cusparseDnnz(cusparseHandle_t handle, - cusparseDirection_t dirA, - int m, - int n, - const cusparseMatDescr_t descrA, - const double* A, - int lda, - int* nnzPerRowCol, - int* nnzTotalDevHostPtr) { - return hipsparseDnnz(handle, dirA, m, n, descrA, A, lda, nnzPerRowCol, nnzTotalDevHostPtr); -} - -cusparseStatus_t cusparseCnnz(cusparseHandle_t handle, - cusparseDirection_t dirA, - int m, - int n, - const cusparseMatDescr_t descrA, - const cuComplex* A, - int lda, - int* nnzPerRowCol, - int* nnzTotalDevHostPtr) { - return hipsparseCnnz(handle, dirA, m, n, descrA, reinterpret_cast(A), lda, nnzPerRowCol, nnzTotalDevHostPtr); -} - -cusparseStatus_t cusparseZnnz(cusparseHandle_t handle, - cusparseDirection_t dirA, - int m, - int n, - const cusparseMatDescr_t descrA, - const cuDoubleComplex* A, - int lda, - int* nnzPerRowCol, - int* nnzTotalDevHostPtr) { - return hipsparseZnnz(handle, dirA, m, n, descrA, reinterpret_cast(A), lda, nnzPerRowCol, nnzTotalDevHostPtr); -} - -cusparseStatus_t cusparseCreateIdentityPermutation(cusparseHandle_t handle, - int n, - int* p) { - return hipsparseCreateIdentityPermutation(handle, n, p); -} - -cusparseStatus_t cusparseXcoosort_bufferSizeExt(cusparseHandle_t handle, - int m, - int n, - int nnz, - const int* cooRowsA, - const int* cooColsA, - size_t* pBufferSizeInBytes) { - return hipsparseXcoosort_bufferSizeExt(handle, m, n, nnz, cooRowsA, cooColsA, pBufferSizeInBytes); -} - -cusparseStatus_t cusparseXcoosortByRow(cusparseHandle_t handle, - int m, - int n, - int nnz, - int* cooRowsA, - int* cooColsA, - int* P, - void* pBuffer) { - return hipsparseXcoosortByRow(handle, m, n, nnz, cooRowsA, cooColsA, P, pBuffer); -} - -cusparseStatus_t cusparseXcoosortByColumn(cusparseHandle_t handle, - int m, - int n, - int nnz, - int* cooRowsA, - int* cooColsA, - int* P, - void* pBuffer) { - return hipsparseXcoosortByColumn(handle, m, n, nnz, cooRowsA, cooColsA, P, pBuffer); -} - -cusparseStatus_t cusparseXcsrsort_bufferSizeExt(cusparseHandle_t handle, - int m, - int n, - int nnz, - const int* csrRowPtrA, - const int* csrColIndA, - size_t* pBufferSizeInBytes) { - return hipsparseXcsrsort_bufferSizeExt(handle, m, n, nnz, csrRowPtrA, csrColIndA, pBufferSizeInBytes); -} - -cusparseStatus_t cusparseXcsrsort(cusparseHandle_t handle, - int m, - int n, - int nnz, - const cusparseMatDescr_t descrA, - const int* csrRowPtrA, - int* csrColIndA, - int* P, - void* pBuffer) { - return hipsparseXcsrsort(handle, m, n, nnz, descrA, csrRowPtrA, csrColIndA, P, pBuffer); -} - -cusparseStatus_t cusparseXcscsort_bufferSizeExt(cusparseHandle_t handle, - int m, - int n, - int nnz, - const int* cscColPtrA, - const int* cscRowIndA, - size_t* pBufferSizeInBytes) { - return hipsparseXcscsort_bufferSizeExt(handle, m, n, nnz, cscColPtrA, cscRowIndA, pBufferSizeInBytes); +cusparseStatus_t cusparseConstrainedGeMM_bufferSize(...) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; } -cusparseStatus_t cusparseXcscsort(cusparseHandle_t handle, - int m, - int n, - int nnz, - const cusparseMatDescr_t descrA, - const int* cscColPtrA, - int* cscRowIndA, - int* P, - void* pBuffer) { - return hipsparseXcscsort(handle, m, n, nnz, descrA, cscColPtrA, cscRowIndA, P, pBuffer); +cusparseStatus_t cusparseConstrainedGeMM(...) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; } -// cuSPARSE PRECONDITIONERS - -cusparseStatus_t cusparseCreateCsrilu02Info(csrilu02Info_t* info) { - return hipsparseCreateCsrilu02Info(info); -} - -cusparseStatus_t cusparseDestroyCsrilu02Info(csrilu02Info_t info) { - return hipsparseDestroyCsrilu02Info(info); -} - -cusparseStatus_t cusparseCreateBsrilu02Info(bsrilu02Info_t* info) { -#if HIP_VERSION >= 309 - return hipsparseCreateBsrilu02Info(info); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseDestroyBsrilu02Info(bsrilu02Info_t info) { -#if HIP_VERSION >= 309 - return hipsparseDestroyBsrilu02Info(info); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseCreateCsric02Info(csric02Info_t* info) { - return hipsparseCreateCsric02Info(info); -} - -cusparseStatus_t cusparseDestroyCsric02Info(csric02Info_t info) { - return hipsparseDestroyCsric02Info(info); -} - -cusparseStatus_t cusparseCreateBsric02Info(bsric02Info_t* info) { -#if HIP_VERSION >= 308 - return hipsparseCreateBsric02Info(info); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseDestroyBsric02Info(bsric02Info_t info) { -#if HIP_VERSION >= 308 - return hipsparseDestroyBsric02Info(info); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseScsrilu02_numericBoost(cusparseHandle_t handle, - csrilu02Info_t info, - int enable_boost, - double* tol, - float* boost_val) { -#if HIP_VERSION >= 400 - return hipsparseScsrilu02_numericBoost(handle, info, enable_boost, tol, boost_val); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseDcsrilu02_numericBoost(cusparseHandle_t handle, - csrilu02Info_t info, - int enable_boost, - double* tol, - double* boost_val) { -#if HIP_VERSION >= 400 - return hipsparseDcsrilu02_numericBoost(handle, info, enable_boost, tol, boost_val); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseCcsrilu02_numericBoost(cusparseHandle_t handle, - csrilu02Info_t info, - int enable_boost, - double* tol, - cuComplex* boost_val) { -#if HIP_VERSION >= 400 - return hipsparseCcsrilu02_numericBoost(handle, info, enable_boost, tol, reinterpret_cast(boost_val)); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseZcsrilu02_numericBoost(cusparseHandle_t handle, - csrilu02Info_t info, - int enable_boost, - double* tol, - cuDoubleComplex* boost_val) { -#if HIP_VERSION >= 400 - return hipsparseZcsrilu02_numericBoost(handle, info, enable_boost, tol, reinterpret_cast(boost_val)); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseXcsrilu02_zeroPivot(cusparseHandle_t handle, - csrilu02Info_t info, - int* position) { - return hipsparseXcsrilu02_zeroPivot(handle, info, position); -} - -cusparseStatus_t cusparseScsrilu02_bufferSize(cusparseHandle_t handle, - int m, - int nnz, - const cusparseMatDescr_t descrA, - float* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - csrilu02Info_t info, - int* pBufferSizeInBytes) { - return hipsparseScsrilu02_bufferSize(handle, m, nnz, descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, info, pBufferSizeInBytes); -} - -cusparseStatus_t cusparseDcsrilu02_bufferSize(cusparseHandle_t handle, - int m, - int nnz, - const cusparseMatDescr_t descrA, - double* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - csrilu02Info_t info, - int* pBufferSizeInBytes) { - return hipsparseDcsrilu02_bufferSize(handle, m, nnz, descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, info, pBufferSizeInBytes); -} - -cusparseStatus_t cusparseCcsrilu02_bufferSize(cusparseHandle_t handle, - int m, - int nnz, - const cusparseMatDescr_t descrA, - cuComplex* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - csrilu02Info_t info, - int* pBufferSizeInBytes) { - return hipsparseCcsrilu02_bufferSize(handle, m, nnz, descrA, reinterpret_cast(csrSortedValA), csrSortedRowPtrA, csrSortedColIndA, info, pBufferSizeInBytes); -} - -cusparseStatus_t cusparseZcsrilu02_bufferSize(cusparseHandle_t handle, - int m, - int nnz, - const cusparseMatDescr_t descrA, - cuDoubleComplex* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - csrilu02Info_t info, - int* pBufferSizeInBytes) { - return hipsparseZcsrilu02_bufferSize(handle, m, nnz, descrA, reinterpret_cast(csrSortedValA), csrSortedRowPtrA, csrSortedColIndA, info, pBufferSizeInBytes); -} - -cusparseStatus_t cusparseScsrilu02_analysis(cusparseHandle_t handle, - int m, - int nnz, - const cusparseMatDescr_t descrA, - const float* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - csrilu02Info_t info, - cusparseSolvePolicy_t policy, - void* pBuffer) { - return hipsparseScsrilu02_analysis(handle, m, nnz, descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, info, policy, pBuffer); -} - -cusparseStatus_t cusparseDcsrilu02_analysis(cusparseHandle_t handle, - int m, - int nnz, - const cusparseMatDescr_t descrA, - const double* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - csrilu02Info_t info, - cusparseSolvePolicy_t policy, - void* pBuffer) { - return hipsparseDcsrilu02_analysis(handle, m, nnz, descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, info, policy, pBuffer); -} - -cusparseStatus_t cusparseCcsrilu02_analysis(cusparseHandle_t handle, - int m, - int nnz, - const cusparseMatDescr_t descrA, - const cuComplex* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - csrilu02Info_t info, - cusparseSolvePolicy_t policy, - void* pBuffer) { - return hipsparseCcsrilu02_analysis(handle, m, nnz, descrA, reinterpret_cast(csrSortedValA), csrSortedRowPtrA, csrSortedColIndA, info, policy, pBuffer); -} - -cusparseStatus_t cusparseZcsrilu02_analysis(cusparseHandle_t handle, - int m, - int nnz, - const cusparseMatDescr_t descrA, - const cuDoubleComplex* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - csrilu02Info_t info, - cusparseSolvePolicy_t policy, - void* pBuffer) { - return hipsparseZcsrilu02_analysis(handle, m, nnz, descrA, reinterpret_cast(csrSortedValA), csrSortedRowPtrA, csrSortedColIndA, info, policy, pBuffer); -} - -cusparseStatus_t cusparseScsrilu02(cusparseHandle_t handle, - int m, - int nnz, - const cusparseMatDescr_t descrA, - float* csrSortedValA_valM, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - csrilu02Info_t info, - cusparseSolvePolicy_t policy, - void* pBuffer) { - return hipsparseScsrilu02(handle, m, nnz, descrA, csrSortedValA_valM, csrSortedRowPtrA, csrSortedColIndA, info, policy, pBuffer); -} - -cusparseStatus_t cusparseDcsrilu02(cusparseHandle_t handle, - int m, - int nnz, - const cusparseMatDescr_t descrA, - double* csrSortedValA_valM, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - csrilu02Info_t info, - cusparseSolvePolicy_t policy, - void* pBuffer) { - return hipsparseDcsrilu02(handle, m, nnz, descrA, csrSortedValA_valM, csrSortedRowPtrA, csrSortedColIndA, info, policy, pBuffer); -} - -cusparseStatus_t cusparseCcsrilu02(cusparseHandle_t handle, - int m, - int nnz, - const cusparseMatDescr_t descrA, - cuComplex* csrSortedValA_valM, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - csrilu02Info_t info, - cusparseSolvePolicy_t policy, - void* pBuffer) { - return hipsparseCcsrilu02(handle, m, nnz, descrA, reinterpret_cast(csrSortedValA_valM), csrSortedRowPtrA, csrSortedColIndA, info, policy, pBuffer); -} - -cusparseStatus_t cusparseZcsrilu02(cusparseHandle_t handle, - int m, - int nnz, - const cusparseMatDescr_t descrA, - cuDoubleComplex* csrSortedValA_valM, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - csrilu02Info_t info, - cusparseSolvePolicy_t policy, - void* pBuffer) { - return hipsparseZcsrilu02(handle, m, nnz, descrA, reinterpret_cast(csrSortedValA_valM), csrSortedRowPtrA, csrSortedColIndA, info, policy, pBuffer); -} - -cusparseStatus_t cusparseSbsrilu02_numericBoost(cusparseHandle_t handle, - bsrilu02Info_t info, - int enable_boost, - double* tol, - float* boost_val) { -#if HIP_VERSION >= 309 - return hipsparseSbsrilu02_numericBoost(handle, info, enable_boost, tol, boost_val); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseDbsrilu02_numericBoost(cusparseHandle_t handle, - bsrilu02Info_t info, - int enable_boost, - double* tol, - double* boost_val) { -#if HIP_VERSION >= 309 - return hipsparseDbsrilu02_numericBoost(handle, info, enable_boost, tol, boost_val); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseCbsrilu02_numericBoost(cusparseHandle_t handle, - bsrilu02Info_t info, - int enable_boost, - double* tol, - cuComplex* boost_val) { -#if HIP_VERSION >= 309 - return hipsparseCbsrilu02_numericBoost(handle, info, enable_boost, tol, reinterpret_cast(boost_val)); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseZbsrilu02_numericBoost(cusparseHandle_t handle, - bsrilu02Info_t info, - int enable_boost, - double* tol, - cuDoubleComplex* boost_val) { -#if HIP_VERSION >= 309 - return hipsparseZbsrilu02_numericBoost(handle, info, enable_boost, tol, reinterpret_cast(boost_val)); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseXbsrilu02_zeroPivot(cusparseHandle_t handle, - bsrilu02Info_t info, - int* position) { -#if HIP_VERSION >= 309 - return hipsparseXbsrilu02_zeroPivot(handle, info, position); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseSbsrilu02_bufferSize(cusparseHandle_t handle, - cusparseDirection_t dirA, - int mb, - int nnzb, - const cusparseMatDescr_t descrA, - float* bsrSortedVal, - const int* bsrSortedRowPtr, - const int* bsrSortedColInd, - int blockDim, - bsrilu02Info_t info, - int* pBufferSizeInBytes) { -#if HIP_VERSION >= 309 - return hipsparseSbsrilu02_bufferSize(handle, dirA, mb, nnzb, descrA, bsrSortedVal, bsrSortedRowPtr, bsrSortedColInd, blockDim, info, pBufferSizeInBytes); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseDbsrilu02_bufferSize(cusparseHandle_t handle, - cusparseDirection_t dirA, - int mb, - int nnzb, - const cusparseMatDescr_t descrA, - double* bsrSortedVal, - const int* bsrSortedRowPtr, - const int* bsrSortedColInd, - int blockDim, - bsrilu02Info_t info, - int* pBufferSizeInBytes) { -#if HIP_VERSION >= 309 - return hipsparseDbsrilu02_bufferSize(handle, dirA, mb, nnzb, descrA, bsrSortedVal, bsrSortedRowPtr, bsrSortedColInd, blockDim, info, pBufferSizeInBytes); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseCbsrilu02_bufferSize(cusparseHandle_t handle, - cusparseDirection_t dirA, - int mb, - int nnzb, - const cusparseMatDescr_t descrA, - cuComplex* bsrSortedVal, - const int* bsrSortedRowPtr, - const int* bsrSortedColInd, - int blockDim, - bsrilu02Info_t info, - int* pBufferSizeInBytes) { -#if HIP_VERSION >= 309 - return hipsparseCbsrilu02_bufferSize(handle, dirA, mb, nnzb, descrA, reinterpret_cast(bsrSortedVal), bsrSortedRowPtr, bsrSortedColInd, blockDim, info, pBufferSizeInBytes); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseZbsrilu02_bufferSize(cusparseHandle_t handle, - cusparseDirection_t dirA, - int mb, - int nnzb, - const cusparseMatDescr_t descrA, - cuDoubleComplex* bsrSortedVal, - const int* bsrSortedRowPtr, - const int* bsrSortedColInd, - int blockDim, - bsrilu02Info_t info, - int* pBufferSizeInBytes) { -#if HIP_VERSION >= 309 - return hipsparseZbsrilu02_bufferSize(handle, dirA, mb, nnzb, descrA, reinterpret_cast(bsrSortedVal), bsrSortedRowPtr, bsrSortedColInd, blockDim, info, pBufferSizeInBytes); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseSbsrilu02_analysis(cusparseHandle_t handle, - cusparseDirection_t dirA, - int mb, - int nnzb, - const cusparseMatDescr_t descrA, - float* bsrSortedVal, - const int* bsrSortedRowPtr, - const int* bsrSortedColInd, - int blockDim, - bsrilu02Info_t info, - cusparseSolvePolicy_t policy, - void* pBuffer) { -#if HIP_VERSION >= 309 - return hipsparseSbsrilu02_analysis(handle, dirA, mb, nnzb, descrA, bsrSortedVal, bsrSortedRowPtr, bsrSortedColInd, blockDim, info, policy, pBuffer); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseDbsrilu02_analysis(cusparseHandle_t handle, - cusparseDirection_t dirA, - int mb, - int nnzb, - const cusparseMatDescr_t descrA, - double* bsrSortedVal, - const int* bsrSortedRowPtr, - const int* bsrSortedColInd, - int blockDim, - bsrilu02Info_t info, - cusparseSolvePolicy_t policy, - void* pBuffer) { -#if HIP_VERSION >= 309 - return hipsparseDbsrilu02_analysis(handle, dirA, mb, nnzb, descrA, bsrSortedVal, bsrSortedRowPtr, bsrSortedColInd, blockDim, info, policy, pBuffer); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseCbsrilu02_analysis(cusparseHandle_t handle, - cusparseDirection_t dirA, - int mb, - int nnzb, - const cusparseMatDescr_t descrA, - cuComplex* bsrSortedVal, - const int* bsrSortedRowPtr, - const int* bsrSortedColInd, - int blockDim, - bsrilu02Info_t info, - cusparseSolvePolicy_t policy, - void* pBuffer) { -#if HIP_VERSION >= 309 - return hipsparseCbsrilu02_analysis(handle, dirA, mb, nnzb, descrA, reinterpret_cast(bsrSortedVal), bsrSortedRowPtr, bsrSortedColInd, blockDim, info, policy, pBuffer); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseZbsrilu02_analysis(cusparseHandle_t handle, - cusparseDirection_t dirA, - int mb, - int nnzb, - const cusparseMatDescr_t descrA, - cuDoubleComplex* bsrSortedVal, - const int* bsrSortedRowPtr, - const int* bsrSortedColInd, - int blockDim, - bsrilu02Info_t info, - cusparseSolvePolicy_t policy, - void* pBuffer) { -#if HIP_VERSION >= 309 - return hipsparseZbsrilu02_analysis(handle, dirA, mb, nnzb, descrA, reinterpret_cast(bsrSortedVal), bsrSortedRowPtr, bsrSortedColInd, blockDim, info, policy, pBuffer); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseSbsrilu02(cusparseHandle_t handle, - cusparseDirection_t dirA, - int mb, - int nnzb, - const cusparseMatDescr_t descrA, - float* bsrSortedVal, - const int* bsrSortedRowPtr, - const int* bsrSortedColInd, - int blockDim, - bsrilu02Info_t info, - cusparseSolvePolicy_t policy, - void* pBuffer) { -#if HIP_VERSION >= 309 - return hipsparseSbsrilu02(handle, dirA, mb, nnzb, descrA, bsrSortedVal, bsrSortedRowPtr, bsrSortedColInd, blockDim, info, policy, pBuffer); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseDbsrilu02(cusparseHandle_t handle, - cusparseDirection_t dirA, - int mb, - int nnzb, - const cusparseMatDescr_t descrA, - double* bsrSortedVal, - const int* bsrSortedRowPtr, - const int* bsrSortedColInd, - int blockDim, - bsrilu02Info_t info, - cusparseSolvePolicy_t policy, - void* pBuffer) { -#if HIP_VERSION >= 309 - return hipsparseDbsrilu02(handle, dirA, mb, nnzb, descrA, bsrSortedVal, bsrSortedRowPtr, bsrSortedColInd, blockDim, info, policy, pBuffer); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseCbsrilu02(cusparseHandle_t handle, - cusparseDirection_t dirA, - int mb, - int nnzb, - const cusparseMatDescr_t descrA, - cuComplex* bsrSortedVal, - const int* bsrSortedRowPtr, - const int* bsrSortedColInd, - int blockDim, - bsrilu02Info_t info, - cusparseSolvePolicy_t policy, - void* pBuffer) { -#if HIP_VERSION >= 309 - return hipsparseCbsrilu02(handle, dirA, mb, nnzb, descrA, reinterpret_cast(bsrSortedVal), bsrSortedRowPtr, bsrSortedColInd, blockDim, info, policy, pBuffer); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseZbsrilu02(cusparseHandle_t handle, - cusparseDirection_t dirA, - int mb, - int nnzb, - const cusparseMatDescr_t descrA, - cuDoubleComplex* bsrSortedVal, - const int* bsrSortedRowPtr, - const int* bsrSortedColInd, - int blockDim, - bsrilu02Info_t info, - cusparseSolvePolicy_t policy, - void* pBuffer) { -#if HIP_VERSION >= 309 - return hipsparseZbsrilu02(handle, dirA, mb, nnzb, descrA, reinterpret_cast(bsrSortedVal), bsrSortedRowPtr, bsrSortedColInd, blockDim, info, policy, pBuffer); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseXcsric02_zeroPivot(cusparseHandle_t handle, - csric02Info_t info, - int* position) { - return hipsparseXcsric02_zeroPivot(handle, info, position); -} - -cusparseStatus_t cusparseScsric02_bufferSize(cusparseHandle_t handle, - int m, - int nnz, - const cusparseMatDescr_t descrA, - float* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - csric02Info_t info, - int* pBufferSizeInBytes) { - return hipsparseScsric02_bufferSize(handle, m, nnz, descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, info, pBufferSizeInBytes); -} - -cusparseStatus_t cusparseDcsric02_bufferSize(cusparseHandle_t handle, - int m, - int nnz, - const cusparseMatDescr_t descrA, - double* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - csric02Info_t info, - int* pBufferSizeInBytes) { - return hipsparseDcsric02_bufferSize(handle, m, nnz, descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, info, pBufferSizeInBytes); -} - -cusparseStatus_t cusparseCcsric02_bufferSize(cusparseHandle_t handle, - int m, - int nnz, - const cusparseMatDescr_t descrA, - cuComplex* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - csric02Info_t info, - int* pBufferSizeInBytes) { - return hipsparseCcsric02_bufferSize(handle, m, nnz, descrA, reinterpret_cast(csrSortedValA), csrSortedRowPtrA, csrSortedColIndA, info, pBufferSizeInBytes); -} - -cusparseStatus_t cusparseZcsric02_bufferSize(cusparseHandle_t handle, - int m, - int nnz, - const cusparseMatDescr_t descrA, - cuDoubleComplex* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - csric02Info_t info, - int* pBufferSizeInBytes) { - return hipsparseZcsric02_bufferSize(handle, m, nnz, descrA, reinterpret_cast(csrSortedValA), csrSortedRowPtrA, csrSortedColIndA, info, pBufferSizeInBytes); -} - -cusparseStatus_t cusparseScsric02_analysis(cusparseHandle_t handle, - int m, - int nnz, - const cusparseMatDescr_t descrA, - const float* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - csric02Info_t info, - cusparseSolvePolicy_t policy, - void* pBuffer) { - return hipsparseScsric02_analysis(handle, m, nnz, descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, info, policy, pBuffer); -} - -cusparseStatus_t cusparseDcsric02_analysis(cusparseHandle_t handle, - int m, - int nnz, - const cusparseMatDescr_t descrA, - const double* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - csric02Info_t info, - cusparseSolvePolicy_t policy, - void* pBuffer) { - return hipsparseDcsric02_analysis(handle, m, nnz, descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, info, policy, pBuffer); -} - -cusparseStatus_t cusparseCcsric02_analysis(cusparseHandle_t handle, - int m, - int nnz, - const cusparseMatDescr_t descrA, - const cuComplex* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - csric02Info_t info, - cusparseSolvePolicy_t policy, - void* pBuffer) { - return hipsparseCcsric02_analysis(handle, m, nnz, descrA, reinterpret_cast(csrSortedValA), csrSortedRowPtrA, csrSortedColIndA, info, policy, pBuffer); -} - -cusparseStatus_t cusparseZcsric02_analysis(cusparseHandle_t handle, - int m, - int nnz, - const cusparseMatDescr_t descrA, - const cuDoubleComplex* csrSortedValA, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - csric02Info_t info, - cusparseSolvePolicy_t policy, - void* pBuffer) { - return hipsparseZcsric02_analysis(handle, m, nnz, descrA, reinterpret_cast(csrSortedValA), csrSortedRowPtrA, csrSortedColIndA, info, policy, pBuffer); -} - -cusparseStatus_t cusparseScsric02(cusparseHandle_t handle, - int m, - int nnz, - const cusparseMatDescr_t descrA, - float* csrSortedValA_valM, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - csric02Info_t info, - cusparseSolvePolicy_t policy, - void* pBuffer) { - return hipsparseScsric02(handle, m, nnz, descrA, csrSortedValA_valM, csrSortedRowPtrA, csrSortedColIndA, info, policy, pBuffer); -} - -cusparseStatus_t cusparseDcsric02(cusparseHandle_t handle, - int m, - int nnz, - const cusparseMatDescr_t descrA, - double* csrSortedValA_valM, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - csric02Info_t info, - cusparseSolvePolicy_t policy, - void* pBuffer) { - return hipsparseDcsric02(handle, m, nnz, descrA, csrSortedValA_valM, csrSortedRowPtrA, csrSortedColIndA, info, policy, pBuffer); -} - -cusparseStatus_t cusparseCcsric02(cusparseHandle_t handle, - int m, - int nnz, - const cusparseMatDescr_t descrA, - cuComplex* csrSortedValA_valM, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - csric02Info_t info, - cusparseSolvePolicy_t policy, - void* pBuffer) { - return hipsparseCcsric02(handle, m, nnz, descrA, reinterpret_cast(csrSortedValA_valM), csrSortedRowPtrA, csrSortedColIndA, info, policy, pBuffer); -} - -cusparseStatus_t cusparseZcsric02(cusparseHandle_t handle, - int m, - int nnz, - const cusparseMatDescr_t descrA, - cuDoubleComplex* csrSortedValA_valM, - const int* csrSortedRowPtrA, - const int* csrSortedColIndA, - csric02Info_t info, - cusparseSolvePolicy_t policy, - void* pBuffer) { - return hipsparseZcsric02(handle, m, nnz, descrA, reinterpret_cast(csrSortedValA_valM), csrSortedRowPtrA, csrSortedColIndA, info, policy, pBuffer); -} - -cusparseStatus_t cusparseXbsric02_zeroPivot(cusparseHandle_t handle, - bsric02Info_t info, - int* position) { -#if HIP_VERSION >= 308 - return hipsparseXbsric02_zeroPivot(handle, info, position); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseSbsric02_bufferSize(cusparseHandle_t handle, - cusparseDirection_t dirA, - int mb, - int nnzb, - const cusparseMatDescr_t descrA, - float* bsrSortedVal, - const int* bsrSortedRowPtr, - const int* bsrSortedColInd, - int blockDim, - bsric02Info_t info, - int* pBufferSizeInBytes) { -#if HIP_VERSION >= 308 - return hipsparseSbsric02_bufferSize(handle, dirA, mb, nnzb, descrA, bsrSortedVal, bsrSortedRowPtr, bsrSortedColInd, blockDim, info, pBufferSizeInBytes); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseDbsric02_bufferSize(cusparseHandle_t handle, - cusparseDirection_t dirA, - int mb, - int nnzb, - const cusparseMatDescr_t descrA, - double* bsrSortedVal, - const int* bsrSortedRowPtr, - const int* bsrSortedColInd, - int blockDim, - bsric02Info_t info, - int* pBufferSizeInBytes) { -#if HIP_VERSION >= 308 - return hipsparseDbsric02_bufferSize(handle, dirA, mb, nnzb, descrA, bsrSortedVal, bsrSortedRowPtr, bsrSortedColInd, blockDim, info, pBufferSizeInBytes); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseCbsric02_bufferSize(cusparseHandle_t handle, - cusparseDirection_t dirA, - int mb, - int nnzb, - const cusparseMatDescr_t descrA, - cuComplex* bsrSortedVal, - const int* bsrSortedRowPtr, - const int* bsrSortedColInd, - int blockDim, - bsric02Info_t info, - int* pBufferSizeInBytes) { -#if HIP_VERSION >= 308 - return hipsparseCbsric02_bufferSize(handle, dirA, mb, nnzb, descrA, reinterpret_cast(bsrSortedVal), bsrSortedRowPtr, bsrSortedColInd, blockDim, info, pBufferSizeInBytes); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseZbsric02_bufferSize(cusparseHandle_t handle, - cusparseDirection_t dirA, - int mb, - int nnzb, - const cusparseMatDescr_t descrA, - cuDoubleComplex* bsrSortedVal, - const int* bsrSortedRowPtr, - const int* bsrSortedColInd, - int blockDim, - bsric02Info_t info, - int* pBufferSizeInBytes) { -#if HIP_VERSION >= 308 - return hipsparseZbsric02_bufferSize(handle, dirA, mb, nnzb, descrA, reinterpret_cast(bsrSortedVal), bsrSortedRowPtr, bsrSortedColInd, blockDim, info, pBufferSizeInBytes); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseSbsric02_analysis(cusparseHandle_t handle, - cusparseDirection_t dirA, - int mb, - int nnzb, - const cusparseMatDescr_t descrA, - const float* bsrSortedVal, - const int* bsrSortedRowPtr, - const int* bsrSortedColInd, - int blockDim, - bsric02Info_t info, - cusparseSolvePolicy_t policy, - void* pInputBuffer) { -#if HIP_VERSION >= 308 - return hipsparseSbsric02_analysis(handle, dirA, mb, nnzb, descrA, bsrSortedVal, bsrSortedRowPtr, bsrSortedColInd, blockDim, info, policy, pInputBuffer); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseDbsric02_analysis(cusparseHandle_t handle, - cusparseDirection_t dirA, - int mb, - int nnzb, - const cusparseMatDescr_t descrA, - const double* bsrSortedVal, - const int* bsrSortedRowPtr, - const int* bsrSortedColInd, - int blockDim, - bsric02Info_t info, - cusparseSolvePolicy_t policy, - void* pInputBuffer) { -#if HIP_VERSION >= 308 - return hipsparseDbsric02_analysis(handle, dirA, mb, nnzb, descrA, bsrSortedVal, bsrSortedRowPtr, bsrSortedColInd, blockDim, info, policy, pInputBuffer); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseCbsric02_analysis(cusparseHandle_t handle, - cusparseDirection_t dirA, - int mb, - int nnzb, - const cusparseMatDescr_t descrA, - const cuComplex* bsrSortedVal, - const int* bsrSortedRowPtr, - const int* bsrSortedColInd, - int blockDim, - bsric02Info_t info, - cusparseSolvePolicy_t policy, - void* pInputBuffer) { -#if HIP_VERSION >= 308 - return hipsparseCbsric02_analysis(handle, dirA, mb, nnzb, descrA, reinterpret_cast(bsrSortedVal), bsrSortedRowPtr, bsrSortedColInd, blockDim, info, policy, pInputBuffer); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseZbsric02_analysis(cusparseHandle_t handle, - cusparseDirection_t dirA, - int mb, - int nnzb, - const cusparseMatDescr_t descrA, - const cuDoubleComplex* bsrSortedVal, - const int* bsrSortedRowPtr, - const int* bsrSortedColInd, - int blockDim, - bsric02Info_t info, - cusparseSolvePolicy_t policy, - void* pInputBuffer) { -#if HIP_VERSION >= 308 - return hipsparseZbsric02_analysis(handle, dirA, mb, nnzb, descrA, reinterpret_cast(bsrSortedVal), bsrSortedRowPtr, bsrSortedColInd, blockDim, info, policy, pInputBuffer); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseSbsric02(cusparseHandle_t handle, - cusparseDirection_t dirA, - int mb, - int nnzb, - const cusparseMatDescr_t descrA, - float* bsrSortedVal, - const int* bsrSortedRowPtr, - const int* bsrSortedColInd, - int blockDim, - bsric02Info_t info, - cusparseSolvePolicy_t policy, - void* pBuffer) { -#if HIP_VERSION >= 308 - return hipsparseSbsric02(handle, dirA, mb, nnzb, descrA, bsrSortedVal, bsrSortedRowPtr, bsrSortedColInd, blockDim, info, policy, pBuffer); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseDbsric02(cusparseHandle_t handle, - cusparseDirection_t dirA, - int mb, - int nnzb, - const cusparseMatDescr_t descrA, - double* bsrSortedVal, - const int* bsrSortedRowPtr, - const int* bsrSortedColInd, - int blockDim, - bsric02Info_t info, - cusparseSolvePolicy_t policy, - void* pBuffer) { -#if HIP_VERSION >= 308 - return hipsparseDbsric02(handle, dirA, mb, nnzb, descrA, bsrSortedVal, bsrSortedRowPtr, bsrSortedColInd, blockDim, info, policy, pBuffer); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseCbsric02(cusparseHandle_t handle, - cusparseDirection_t dirA, - int mb, - int nnzb, - const cusparseMatDescr_t descrA, - cuComplex* bsrSortedVal, - const int* bsrSortedRowPtr, - const int* - bsrSortedColInd, - int blockDim, - bsric02Info_t info, - cusparseSolvePolicy_t policy, - void* pBuffer) { -#if HIP_VERSION >= 308 - return hipsparseCbsric02(handle, dirA, mb, nnzb, descrA, reinterpret_cast(bsrSortedVal), bsrSortedRowPtr, bsrSortedColInd, blockDim, info, policy, pBuffer); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseZbsric02(cusparseHandle_t handle, - cusparseDirection_t dirA, - int mb, - int nnzb, - const cusparseMatDescr_t descrA, - cuDoubleComplex* bsrSortedVal, - const int* bsrSortedRowPtr, - const int* bsrSortedColInd, - int blockDim, - bsric02Info_t info, - cusparseSolvePolicy_t policy, - void* pBuffer) { -#if HIP_VERSION >= 308 - return hipsparseZbsric02(handle, dirA, mb, nnzb, descrA, reinterpret_cast(bsrSortedVal), bsrSortedRowPtr, bsrSortedColInd, blockDim, info, policy, pBuffer); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseSgtsv2_bufferSizeExt(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseDgtsv2_bufferSizeExt(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseCgtsv2_bufferSizeExt(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseZgtsv2_bufferSizeExt(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseSgtsv2(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseDgtsv2(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseCgtsv2(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseZgtsv2(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseSgtsv2_nopivot_bufferSizeExt(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseDgtsv2_nopivot_bufferSizeExt(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseCgtsv2_nopivot_bufferSizeExt(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseZgtsv2_nopivot_bufferSizeExt(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseSgtsv2_nopivot(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseDgtsv2_nopivot(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseCgtsv2_nopivot(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseZgtsv2_nopivot(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseSgtsv2StridedBatch_bufferSizeExt(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseDgtsv2StridedBatch_bufferSizeExt(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseCgtsv2StridedBatch_bufferSizeExt(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseZgtsv2StridedBatch_bufferSizeExt(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseSgtsv2StridedBatch(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseDgtsv2StridedBatch(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseCgtsv2StridedBatch(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseZgtsv2StridedBatch(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseSgtsvInterleavedBatch_bufferSizeExt(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseDgtsvInterleavedBatch_bufferSizeExt(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseCgtsvInterleavedBatch_bufferSizeExt(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseZgtsvInterleavedBatch_bufferSizeExt(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseSgtsvInterleavedBatch(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseDgtsvInterleavedBatch(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseCgtsvInterleavedBatch(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseZgtsvInterleavedBatch(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseSgpsvInterleavedBatch_bufferSizeExt(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseDgpsvInterleavedBatch_bufferSizeExt(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseCgpsvInterleavedBatch_bufferSizeExt(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseZgpsvInterleavedBatch_bufferSizeExt(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseSgpsvInterleavedBatch(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseDgpsvInterleavedBatch(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseCgpsvInterleavedBatch(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseZgpsvInterleavedBatch(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -#define CUSPARSE_VERSION (hipsparseVersionMajor*100000+hipsparseVersionMinor*100+hipsparseVersionPatch) - -// cuSPARSE generic API -#if HIP_VERSION >= 402 -typedef hipsparseSpVecDescr_t cusparseSpVecDescr_t; -#else -typedef void* cusparseSpVecDescr_t; -#endif - -#if HIP_VERSION >= 402 -typedef hipsparseDnVecDescr_t cusparseDnVecDescr_t; -#else -typedef void* cusparseDnVecDescr_t; -#endif - -#if HIP_VERSION >= 402 -typedef hipsparseSpMatDescr_t cusparseSpMatDescr_t; -#else -typedef void* cusparseSpMatDescr_t; -#endif - -#if HIP_VERSION >= 402 -typedef hipsparseDnMatDescr_t cusparseDnMatDescr_t; -#else -typedef void* cusparseDnMatDescr_t; -#endif - - -#if HIP_VERSION >= 402 -typedef hipsparseFormat_t cusparseFormat_t; -#else -typedef enum {} cusparseFormat_t; -#endif - - -#if HIP_VERSION >= 402 -typedef enum {} cusparseOrder_t; -static hipsparseOrder_t convert_hipsparseOrder_t(cusparseOrder_t type) { - switch(static_cast(type)) { - case 1 /* CUSPARSE_ORDER_COL */: return HIPSPARSE_ORDER_COLUMN; - case 2 /* CUSPARSE_ORDER_ROW */: return HIPSPARSE_ORDER_ROW; - default: throw std::runtime_error("unrecognized type"); - } -} - -#else -typedef enum {} cusparseOrder_t; -#endif - -#if HIP_VERSION >= 402 -typedef hipsparseSpMVAlg_t cusparseSpMVAlg_t; -#else -typedef enum {} cusparseSpMVAlg_t; -#endif - -#if HIP_VERSION >= 50000000 -typedef hipsparseSpMatAttribute_t cusparseSpMatAttribute_t; -typedef hipsparseSpSMAlg_t cusparseSpSMAlg_t; -typedef hipsparseSpSMDescr_t cusparseSpSMDescr_t; -#else -typedef enum {} cusparseSpMatAttribute_t; -typedef enum {} cusparseSpSMAlg_t; -typedef void * cusparseSpSMDescr_t; -#endif - -#if HIP_VERSION >= 402 -typedef hipsparseSpMMAlg_t cusparseSpMMAlg_t; -#else -typedef enum {} cusparseSpMMAlg_t; -#endif - -#if HIP_VERSION >= 402 -typedef hipsparseSparseToDenseAlg_t cusparseSparseToDenseAlg_t; -#else -typedef enum {} cusparseSparseToDenseAlg_t; -#endif - -#if HIP_VERSION >= 402 -typedef hipsparseDenseToSparseAlg_t cusparseDenseToSparseAlg_t; -#else -typedef enum {} cusparseDenseToSparseAlg_t; -#endif - - -cusparseStatus_t cusparseCreateSpVec(cusparseSpVecDescr_t* spVecDescr, - int64_t size, - int64_t nnz, - void* indices, - void* values, - cusparseIndexType_t idxType, - cusparseIndexBase_t idxBase, - cudaDataType valueType) { -#if HIP_VERSION >= 402 - hipDataType blah = convert_hipDatatype(valueType); - return hipsparseCreateSpVec(spVecDescr, size, nnz, indices, values, idxType, idxBase, blah); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseDestroySpVec(cusparseSpVecDescr_t spVecDescr) { -#if HIP_VERSION >= 402 - return hipsparseDestroySpVec(spVecDescr); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseSpVecGet(cusparseSpVecDescr_t spVecDescr, - int64_t* size, - int64_t* nnz, - void** indices, - void** values, - cusparseIndexType_t* idxType, - cusparseIndexBase_t* idxBase, - cudaDataType* valueType) { -#if HIP_VERSION >= 402 - return hipsparseSpVecGet(spVecDescr, size, nnz, indices, values, idxType, idxBase, reinterpret_cast(valueType)); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseSpVecGetIndexBase(cusparseSpVecDescr_t spVecDescr, - cusparseIndexBase_t* idxBase) { -#if HIP_VERSION >= 402 - return hipsparseSpVecGetIndexBase(spVecDescr, idxBase); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseSpVecGetValues(cusparseSpVecDescr_t spVecDescr, - void** values) { -#if HIP_VERSION >= 402 - return hipsparseSpVecGetValues(spVecDescr, values); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseSpVecSetValues(cusparseSpVecDescr_t spVecDescr, - void* values) { -#if HIP_VERSION >= 402 - return hipsparseSpVecSetValues(spVecDescr, values); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseCreateCoo(cusparseSpMatDescr_t* spMatDescr, - int64_t rows, - int64_t cols, - int64_t nnz, - void* cooRowInd, - void* cooColInd, - void* cooValues, - cusparseIndexType_t cooIdxType, - cusparseIndexBase_t idxBase, - cudaDataType valueType) { -#if HIP_VERSION >= 402 - hipDataType blah = convert_hipDatatype(valueType); - return hipsparseCreateCoo(spMatDescr, rows, cols, nnz, cooRowInd, cooColInd, cooValues, cooIdxType, idxBase, blah); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseCreateCooAoS(cusparseSpMatDescr_t* spMatDescr, - int64_t rows, - int64_t cols, - int64_t nnz, - void* cooInd, - void* cooValues, - cusparseIndexType_t cooIdxType, - cusparseIndexBase_t idxBase, - cudaDataType valueType) { -#if HIP_VERSION >= 402 - hipDataType blah = convert_hipDatatype(valueType); - return hipsparseCreateCooAoS(spMatDescr, rows, cols, nnz, cooInd, cooValues, cooIdxType, idxBase, blah); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseCreateCsr(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) { -#if HIP_VERSION >= 402 - hipDataType blah = convert_hipDatatype(valueType); - return hipsparseCreateCsr(spMatDescr, rows, cols, nnz, csrRowOffsets, csrColInd, csrValues, csrRowOffsetsType, csrColIndType, idxBase, blah); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseCreateCsc(cusparseSpMatDescr_t* spMatDescr, - int64_t rows, - int64_t cols, - int64_t nnz, - void* cscColOffsets, - void* cscRowInd, - void* cscValues, - cusparseIndexType_t cscColOffsetsType, - cusparseIndexType_t cscRowIndType, - cusparseIndexBase_t idxBase, - cudaDataType valueType) { -#if HIP_VERSION >= 402 - hipDataType blah = convert_hipDatatype(valueType); - return hipsparseCreateCsc(spMatDescr, rows, cols, nnz, cscColOffsets, cscRowInd, cscValues, cscColOffsetsType, cscRowIndType, idxBase, blah); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseDestroySpMat(cusparseSpMatDescr_t spMatDescr) { -#if HIP_VERSION >= 402 - return hipsparseDestroySpMat(spMatDescr); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseCooGet(cusparseSpMatDescr_t spMatDescr, - int64_t* rows, - int64_t* cols, - int64_t* nnz, - void** cooRowInd, // COO row indices - void** cooColInd, // COO column indices - void** cooValues, // COO values - cusparseIndexType_t* idxType, - cusparseIndexBase_t* idxBase, - cudaDataType* valueType) { -#if HIP_VERSION >= 402 - return hipsparseCooGet(spMatDescr, rows, cols, nnz, cooRowInd, cooColInd, cooValues, idxType, idxBase, reinterpret_cast(valueType)); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseCooAoSGet(cusparseSpMatDescr_t spMatDescr, - int64_t* rows, - int64_t* cols, - int64_t* nnz, - void** cooInd, // COO indices - void** cooValues, // COO values - cusparseIndexType_t* idxType, - cusparseIndexBase_t* idxBase, - cudaDataType* valueType) { -#if HIP_VERSION >= 402 - return hipsparseCooAoSGet(spMatDescr, rows, cols, nnz, cooInd, cooValues, idxType, idxBase, reinterpret_cast(valueType)); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseCsrGet(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) { -#if HIP_VERSION >= 402 - return hipsparseCsrGet(spMatDescr, rows, cols, nnz, csrRowOffsets, csrColInd, csrValues, csrRowOffsetsType, csrColIndType, idxBase, reinterpret_cast(valueType)); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseCsrSetPointers(cusparseSpMatDescr_t spMatDescr, - void* csrRowOffsets, - void* csrColInd, - void* csrValues) { -#if HIP_VERSION >= 402 - return hipsparseCsrSetPointers(spMatDescr, csrRowOffsets, csrColInd, csrValues); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseSpMatGetSize(cusparseSpMatDescr_t spMatDescr, - int64_t* rows, - int64_t* cols, - int64_t* nnz) { -#if HIP_VERSION >= 402 - return hipsparseSpMatGetSize(spMatDescr, rows, cols, nnz); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseSpMatGetFormat(cusparseSpMatDescr_t spMatDescr, - cusparseFormat_t* format) { -#if HIP_VERSION >= 402 - return hipsparseSpMatGetFormat(spMatDescr, format); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseSpMatGetIndexBase(cusparseSpMatDescr_t spMatDescr, - cusparseIndexBase_t* idxBase) { -#if HIP_VERSION >= 402 - return hipsparseSpMatGetIndexBase(spMatDescr, idxBase); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseSpMatGetValues(cusparseSpMatDescr_t spMatDescr, - void** values) { -#if HIP_VERSION >= 402 - return hipsparseSpMatGetValues(spMatDescr, values); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseSpMatSetValues(cusparseSpMatDescr_t spMatDescr, - void* values) { -#if HIP_VERSION >= 402 - return hipsparseSpMatSetValues(spMatDescr, values); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseSpMatGetStridedBatch(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseSpMatSetStridedBatch(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseSpMatSetAttribute(cusparseSpMatDescr_t spMatDescr, - cusparseSpMatAttribute_t attribute, - void* data, - size_t dataSize) { -#if HIP_VERSION >= 50000000 - return hipsparseSpMatSetAttribute(spMatDescr, attribute, data, dataSize); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseCreateDnVec(cusparseDnVecDescr_t* dnVecDescr, - int64_t size, - void* values, - cudaDataType valueType) { -#if HIP_VERSION >= 402 - hipDataType blah = convert_hipDatatype(valueType); - return hipsparseCreateDnVec(dnVecDescr, size, values, blah); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseDestroyDnVec(cusparseDnVecDescr_t dnVecDescr) { -#if HIP_VERSION >= 402 - return hipsparseDestroyDnVec(dnVecDescr); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseDnVecGet(cusparseDnVecDescr_t dnVecDescr, - int64_t* size, - void** values, - cudaDataType* valueType) { -#if HIP_VERSION >= 402 - return hipsparseDnVecGet(dnVecDescr, size, values, reinterpret_cast(valueType)); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseDnVecGetValues(cusparseDnVecDescr_t dnVecDescr, - void** values) { -#if HIP_VERSION >= 402 - return hipsparseDnVecGetValues(dnVecDescr, values); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseDnVecSetValues(cusparseDnVecDescr_t dnVecDescr, - void* values) { -#if HIP_VERSION >= 402 - return hipsparseDnVecSetValues(dnVecDescr, values); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseCreateDnMat(cusparseDnMatDescr_t* dnMatDescr, - int64_t rows, - int64_t cols, - int64_t ld, - void* values, - cudaDataType valueType, - cusparseOrder_t order) { -#if HIP_VERSION >= 402 - hipDataType blah = convert_hipDatatype(valueType); - hipsparseOrder_t blah2 = convert_hipsparseOrder_t(order); - return hipsparseCreateDnMat(dnMatDescr, rows, cols, ld, values, blah, blah2); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseDestroyDnMat(cusparseDnMatDescr_t dnMatDescr) { -#if HIP_VERSION >= 402 - return hipsparseDestroyDnMat(dnMatDescr); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseDnMatGet(cusparseDnMatDescr_t dnMatDescr, - int64_t* rows, - int64_t* cols, - int64_t* ld, - void** values, - cudaDataType* type, - cusparseOrder_t* order) { -#if HIP_VERSION >= 402 - hipsparseOrder_t blah2 = convert_hipsparseOrder_t(*order); - return hipsparseDnMatGet(dnMatDescr, rows, cols, ld, values, reinterpret_cast(type), &blah2); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseDnMatGetValues(cusparseDnMatDescr_t dnMatDescr, - void** values) { -#if HIP_VERSION >= 402 - return hipsparseDnMatGetValues(dnMatDescr, values); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseDnMatSetValues(cusparseDnMatDescr_t dnMatDescr, - void* values) { -#if HIP_VERSION >= 402 - return hipsparseDnMatSetValues(dnMatDescr, values); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseDnMatGetStridedBatch(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseDnMatSetStridedBatch(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseSpVV_bufferSize(cusparseHandle_t handle, - cusparseOperation_t opX, - cusparseSpVecDescr_t vecX, - cusparseDnVecDescr_t vecY, - const void* result, - cudaDataType computeType, - size_t* bufferSize) { -#if HIP_VERSION >= 402 - hipDataType blah = convert_hipDatatype(computeType); - return hipsparseSpVV_bufferSize(handle, opX, vecX, vecY, const_cast(result), blah, bufferSize); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseSpVV(cusparseHandle_t handle, - cusparseOperation_t opX, - cusparseSpVecDescr_t vecX, - cusparseDnVecDescr_t vecY, - void* result, - cudaDataType computeType, - void* externalBuffer) { -#if HIP_VERSION >= 402 - hipDataType blah = convert_hipDatatype(computeType); - return hipsparseSpVV(handle, opX, vecX, vecY, result, blah, externalBuffer); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseSpMV_bufferSize(cusparseHandle_t handle, - cusparseOperation_t opA, - const void* alpha, - cusparseSpMatDescr_t matA, - cusparseDnVecDescr_t vecX, - const void* beta, - cusparseDnVecDescr_t vecY, - cudaDataType computeType, - cusparseSpMVAlg_t alg, - size_t* bufferSize) { -#if HIP_VERSION >= 402 - hipDataType blah = convert_hipDatatype(computeType); - return hipsparseSpMV_bufferSize(handle, opA, alpha, matA, vecX, beta, vecY, blah, alg, bufferSize); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseSpMV(cusparseHandle_t handle, - cusparseOperation_t opA, - const void* alpha, - cusparseSpMatDescr_t matA, - cusparseDnVecDescr_t vecX, - const void* beta, - cusparseDnVecDescr_t vecY, - cudaDataType computeType, - cusparseSpMVAlg_t alg, - void* externalBuffer) { -#if HIP_VERSION >= 402 - hipDataType blah = convert_hipDatatype(computeType); - return hipsparseSpMV(handle, opA, alpha, matA, vecX, beta, vecY, blah, alg, externalBuffer); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseSpSM_createDescr(cusparseSpSMDescr_t* descr) { -#if HIP_VERSION >= 50000000 - return hipsparseSpSM_createDescr(descr); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseSpSM_destroyDescr(cusparseSpSMDescr_t descr) { -#if HIP_VERSION >= 50000000 - return hipsparseSpSM_destroyDescr(descr); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseSpSM_bufferSize(cusparseHandle_t handle, - cusparseOperation_t opA, - cusparseOperation_t opB, - const void* alpha, - cusparseSpMatDescr_t matA, - cusparseDnMatDescr_t matB, - cusparseDnMatDescr_t matC, - cudaDataType computeType, - cusparseSpSMAlg_t alg, - cusparseSpSMDescr_t spsmDescr, - size_t* bufferSize) { -#if HIP_VERSION >= 50000000 - hipDataType computeType1 = convert_hipDatatype(computeType); - return hipsparseSpSM_bufferSize(handle, opA, opB, alpha, matA, matB, matC, computeType1, alg, spsmDescr, bufferSize); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseSpSM_analysis(cusparseHandle_t handle, - cusparseOperation_t opA, - cusparseOperation_t opB, - const void* alpha, - cusparseSpMatDescr_t matA, - cusparseDnMatDescr_t matB, - cusparseDnMatDescr_t matC, - cudaDataType computeType, - cusparseSpSMAlg_t alg, - cusparseSpSMDescr_t spsmDescr, - void* externalBuffer) { -#if HIP_VERSION >= 50000000 - hipDataType computeType1 = convert_hipDatatype(computeType); - return hipsparseSpSM_analysis(handle, opA, opB, alpha, matA, matB, matC, computeType1, alg, spsmDescr, externalBuffer); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -// See cusparse.pyx for a comment -cusparseStatus_t cusparseSpSM_solve(cusparseHandle_t handle, - cusparseOperation_t opA, - cusparseOperation_t opB, - const void* alpha, - cusparseSpMatDescr_t matA, - cusparseDnMatDescr_t matB, - cusparseDnMatDescr_t matC, - cudaDataType computeType, - cusparseSpSMAlg_t alg, - cusparseSpSMDescr_t spsmDescr, - void* externalBuffer) { -#if HIP_VERSION >= 50000000 - hipDataType computeType1 = convert_hipDatatype(computeType); - return hipsparseSpSM_solve(handle, opA, opB, alpha, matA, matB, matC, computeType1, alg, spsmDescr, externalBuffer); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseSpMM_bufferSize(cusparseHandle_t handle, - cusparseOperation_t opA, - cusparseOperation_t opB, - const void* alpha, - cusparseSpMatDescr_t matA, - cusparseDnMatDescr_t matB, - const void* beta, - cusparseDnMatDescr_t matC, - cudaDataType computeType, - cusparseSpMMAlg_t alg, - size_t* bufferSize) { -#if HIP_VERSION >= 402 - hipDataType blah = convert_hipDatatype(computeType); - return hipsparseSpMM_bufferSize(handle, opA, opB, alpha, matA, matB, beta, matC, blah, alg, bufferSize); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseSpMM(cusparseHandle_t handle, - cusparseOperation_t opA, - cusparseOperation_t opB, - const void* alpha, - cusparseSpMatDescr_t matA, - cusparseDnMatDescr_t matB, - const void* beta, - cusparseDnMatDescr_t matC, - cudaDataType computeType, - cusparseSpMMAlg_t alg, - void* externalBuffer) { -#if HIP_VERSION >= 402 - hipDataType blah = convert_hipDatatype(computeType); - return hipsparseSpMM(handle, opA, opB, alpha, matA, matB, beta, matC, blah, alg, externalBuffer); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseConstrainedGeMM_bufferSize(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseConstrainedGeMM(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseSparseToDense_bufferSize(cusparseHandle_t handle, - cusparseSpMatDescr_t matA, - cusparseDnMatDescr_t matB, - cusparseSparseToDenseAlg_t alg, - size_t* bufferSize) { -#if HIP_VERSION >= 402 - return hipsparseSparseToDense_bufferSize(handle, matA, matB, alg, bufferSize); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseSparseToDense(cusparseHandle_t handle, - cusparseSpMatDescr_t matA, - cusparseDnMatDescr_t matB, - cusparseSparseToDenseAlg_t alg, - void* buffer) { -#if HIP_VERSION >= 402 - return hipsparseSparseToDense(handle, matA, matB, alg, buffer); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseDenseToSparse_bufferSize(cusparseHandle_t handle, - cusparseDnMatDescr_t matA, - cusparseSpMatDescr_t matB, - cusparseDenseToSparseAlg_t alg, - size_t* bufferSize) { -#if HIP_VERSION >= 402 - return hipsparseDenseToSparse_bufferSize(handle, matA, matB, alg, bufferSize); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseDenseToSparse_analysis(cusparseHandle_t handle, - cusparseDnMatDescr_t matA, - cusparseSpMatDescr_t matB, - cusparseDenseToSparseAlg_t alg, - void* buffer) { -#if HIP_VERSION >= 402 - return hipsparseDenseToSparse_analysis(handle, matA, matB, alg, buffer); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -cusparseStatus_t cusparseDenseToSparse_convert(cusparseHandle_t handle, - cusparseDnMatDescr_t matA, - cusparseSpMatDescr_t matB, - cusparseDenseToSparseAlg_t alg, - void* buffer) { -#if HIP_VERSION >= 402 - return hipsparseDenseToSparse_convert(handle, matA, matB, alg, buffer); -#else - return HIPSPARSE_STATUS_NOT_SUPPORTED; -#endif -} - -typedef enum {} cusparseCsr2CscAlg_t; - -cusparseStatus_t cusparseCsr2cscEx2_bufferSize(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseCsr2cscEx2(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -typedef void* cusparseSpGEMMDescr_t; -typedef enum {} cusparseSpGEMMAlg_t; - -cusparseStatus_t cusparseSpGEMM_createDescr(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseSpGEMM_destroyDescr(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseSpGEMM_workEstimation(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseSpGEMM_compute(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseSpGEMM_copy(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -cusparseStatus_t cusparseGather(...) { - return HIPSPARSE_STATUS_NOT_SUPPORTED; -} - -/////////////////////////////////////////////////////////////////////////////// -// Definitions are for compatibility -/////////////////////////////////////////////////////////////////////////////// - -cusparseStatus_t cusparseSnnz_compress(cusparseHandle_t handle, - int m, - const cusparseMatDescr_t descr, - const float* csrSortedValA, - const int* csrSortedRowPtrA, - int* nnzPerRow, - int* nnzC, - float tol) { - return hipsparseSnnz_compress(handle, m, descr, csrSortedValA, csrSortedRowPtrA, nnzPerRow, nnzC, tol); -} - -cusparseStatus_t cusparseDnnz_compress(cusparseHandle_t handle, - int m, - const cusparseMatDescr_t descr, - const double* csrSortedValA, - const int* csrSortedRowPtrA, - int* nnzPerRow, - int* nnzC, - double tol) { - return hipsparseDnnz_compress(handle, m, descr, csrSortedValA, csrSortedRowPtrA, nnzPerRow, nnzC, tol); -} - -cusparseStatus_t cusparseCnnz_compress(cusparseHandle_t handle, - int m, - const cusparseMatDescr_t descr, - const cuComplex* csrSortedValA, - const int* csrSortedRowPtrA, - int* nnzPerRow, - int* nnzC, - cuComplex tol) { - hipComplex blah; - blah.x=tol.x; - blah.y=tol.y; - return hipsparseCnnz_compress(handle, m, descr, reinterpret_cast(csrSortedValA), csrSortedRowPtrA, nnzPerRow, nnzC, blah); -} - -cusparseStatus_t cusparseZnnz_compress(cusparseHandle_t handle, - int m, - const cusparseMatDescr_t descr, - const cuDoubleComplex* csrSortedValA, - const int* csrSortedRowPtrA, - int* nnzPerRow, - int* nnzC, - cuDoubleComplex tol) { - hipDoubleComplex blah; - blah.x=tol.x; - blah.y=tol.y; - return hipsparseZnnz_compress(handle, m, descr, reinterpret_cast(csrSortedValA), csrSortedRowPtrA, nnzPerRow, nnzC, blah); -} - -cusparseStatus_t cusparseScsr2csr_compress(cusparseHandle_t handle, - int m, - int n, - const cusparseMatDescr_t descrA, - const float* csrSortedValA, - const int* csrSortedColIndA, - const int* csrSortedRowPtrA, - int nnzA, - const int* nnzPerRow, - float* csrSortedValC, - int* csrSortedColIndC, - int* csrSortedRowPtrC, - float tol) { - return hipsparseScsr2csr_compress(handle, m, n, descrA, csrSortedValA, csrSortedColIndA, csrSortedRowPtrA, nnzA, nnzPerRow, csrSortedValC, csrSortedColIndC, csrSortedRowPtrC, tol); -} - -cusparseStatus_t cusparseDcsr2csr_compress(cusparseHandle_t handle, - int m, - int n, - const cusparseMatDescr_t descrA, - const double* csrSortedValA, - const int* csrSortedColIndA, - const int* csrSortedRowPtrA, - int nnzA, - const int* nnzPerRow, - double* csrSortedValC, - int* csrSortedColIndC, - int* csrSortedRowPtrC, - double tol) { - return hipsparseDcsr2csr_compress(handle, m, n, descrA, csrSortedValA, csrSortedColIndA, csrSortedRowPtrA, nnzA, nnzPerRow, csrSortedValC, csrSortedColIndC, csrSortedRowPtrC, tol); -} - -cusparseStatus_t cusparseCcsr2csr_compress(cusparseHandle_t handle, - int m, - int n, - const cusparseMatDescr_t descrA, - const cuComplex* csrSortedValA, - const int* csrSortedColIndA, - const int* csrSortedRowPtrA, - int nnzA, - const int* nnzPerRow, - cuComplex* csrSortedValC, - int* csrSortedColIndC, - int* csrSortedRowPtrC, - cuComplex tol) { - hipComplex blah; - blah.x=tol.x; - blah.y=tol.y; - return hipsparseCcsr2csr_compress(handle, m, n, descrA, reinterpret_cast(csrSortedValA), csrSortedColIndA, csrSortedRowPtrA, nnzA, nnzPerRow, reinterpret_cast(csrSortedValC), csrSortedColIndC, csrSortedRowPtrC, blah); -} - -cusparseStatus_t cusparseZcsr2csr_compress(cusparseHandle_t handle, - int m, - int n, - const cusparseMatDescr_t descrA, - const cuDoubleComplex* csrSortedValA, - const int* csrSortedColIndA, - const int* csrSortedRowPtrA, - int nnzA, - const int* nnzPerRow, - cuDoubleComplex* csrSortedValC, - int* csrSortedColIndC, - int* csrSortedRowPtrC, - cuDoubleComplex tol) { - hipDoubleComplex blah; - blah.x=tol.x; - blah.y=tol.y; - return hipsparseZcsr2csr_compress(handle, m, n, descrA, reinterpret_cast(csrSortedValA), csrSortedColIndA, csrSortedRowPtrA, nnzA, nnzPerRow, reinterpret_cast(csrSortedValC), csrSortedColIndC, csrSortedRowPtrC, blah); -} - -} // extern "C" - - #endif // INCLUDE_GUARD_HIP_CUPY_HIPSPARSE_H From c9edf6ffa1c68ec26b0e4fa06cc51cbca9fb6eae Mon Sep 17 00:00:00 2001 From: bmedishe Date: Mon, 29 Apr 2024 20:45:27 +0000 Subject: [PATCH 10/30] replace cusparseStatus with hip --- cupy_backends/hip/cupy_hipsparse.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cupy_backends/hip/cupy_hipsparse.h b/cupy_backends/hip/cupy_hipsparse.h index 10ffb42a011..5d9a3362800 100644 --- a/cupy_backends/hip/cupy_hipsparse.h +++ b/cupy_backends/hip/cupy_hipsparse.h @@ -9,19 +9,19 @@ #include // for hipDataType #include // for gcc 10.0 -cusparseStatus_t cusparseCsrmvEx_bufferSize(...) { +hipsparseStatus_t cusparseCsrmvEx_bufferSize(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -cusparseStatus_t cusparseCsrmvEx(...) { +hipsparseStatus_t cusparseCsrmvEx(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -cusparseStatus_t cusparseConstrainedGeMM_bufferSize(...) { +hipsparseStatus_t cusparseConstrainedGeMM_bufferSize(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -cusparseStatus_t cusparseConstrainedGeMM(...) { +hipsparseStatus_t cusparseConstrainedGeMM(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } From 596268465bf062457f41b225a18cbd43c6bf3a48 Mon Sep 17 00:00:00 2001 From: bmedishe Date: Mon, 29 Apr 2024 21:31:12 +0000 Subject: [PATCH 11/30] update cupy_backends/cuda/libs/cusparse.pxd --- cupy_backends/cuda/libs/cusparse.pxd | 132 +++++++++++++-------------- 1 file changed, 66 insertions(+), 66 deletions(-) diff --git a/cupy_backends/cuda/libs/cusparse.pxd b/cupy_backends/cuda/libs/cusparse.pxd index 9bdc3332e8e..f3e56c87853 100644 --- a/cupy_backends/cuda/libs/cusparse.pxd +++ b/cupy_backends/cuda/libs/cusparse.pxd @@ -149,72 +149,72 @@ cpdef enum: # cusparseDenseToSparseAlg_t CUSPARSE_DENSETOSPARSE_ALG_DEFAULT = 0 - -cdef class SpVecAttributes: - cdef: - public int64_t size - public int64_t nnz - public intptr_t idx - public intptr_t values - public IndexType idxType - public IndexBase idxBase - public DataType valueType - -cdef class CooAttributes: - cdef: - public int64_t rows - public int64_t cols - public int64_t nnz - public intptr_t rowIdx - public intptr_t colIdx - public intptr_t values - public IndexType idxType - public IndexBase idxBase - public DataType valueType - -cdef class CooAoSAttributes: - cdef: - public int64_t rows - public int64_t cols - public int64_t nnz - public intptr_t ind - public intptr_t values - public IndexType idxType - public IndexBase idxBase - public DataType valueType - -cdef class CsrAttributes: - cdef: - public int64_t rows - public int64_t cols - public int64_t nnz - public intptr_t rowOffsets - public intptr_t colIdx - public intptr_t values - public IndexType rowOffsetType - public IndexType colIdxType - public IndexBase idxBase - public DataType valueType - -cdef class DnVecAttributes: - cdef: - public int64_t size - public intptr_t values - public DataType valueType - -cdef class DnMatAttributes: - cdef: - public int64_t rows - public int64_t cols - public int64_t ld - public intptr_t values - public DataType valueType - public Order order - -cdef class DnMatBatchAttributes: - cdef: - public int count - public int64_t stride IF CUPY_HIP_VERSION == 0: + cdef class SpVecAttributes: + cdef: + public int64_t size + public int64_t nnz + public intptr_t idx + public intptr_t values + public IndexType idxType + public IndexBase idxBase + public DataType valueType + + cdef class CooAttributes: + cdef: + public int64_t rows + public int64_t cols + public int64_t nnz + public intptr_t rowIdx + public intptr_t colIdx + public intptr_t values + public IndexType idxType + public IndexBase idxBase + public DataType valueType + + cdef class CooAoSAttributes: + cdef: + public int64_t rows + public int64_t cols + public int64_t nnz + public intptr_t ind + public intptr_t values + public IndexType idxType + public IndexBase idxBase + public DataType valueType + + cdef class CsrAttributes: + cdef: + public int64_t rows + public int64_t cols + public int64_t nnz + public intptr_t rowOffsets + public intptr_t colIdx + public intptr_t values + public IndexType rowOffsetType + public IndexType colIdxType + public IndexBase idxBase + public DataType valueType + + cdef class DnVecAttributes: + cdef: + public int64_t size + public intptr_t values + public DataType valueType + + cdef class DnMatAttributes: + cdef: + public int64_t rows + public int64_t cols + public int64_t ld + public intptr_t values + public DataType valueType + public Order order + + cdef class DnMatBatchAttributes: + cdef: + public int count + public int64_t stride + cpdef intptr_t create() except? 0 cpdef void destroy(intptr_t handle) except * From 0c04b24a80b2718b5b39355cef63cce4b5722f57 Mon Sep 17 00:00:00 2001 From: bmedishe Date: Mon, 29 Apr 2024 21:35:33 +0000 Subject: [PATCH 12/30] update cupy_backends/hip/cupy_hipsparse.h --- cupy_backends/hip/cupy_hipsparse.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cupy_backends/hip/cupy_hipsparse.h b/cupy_backends/hip/cupy_hipsparse.h index 5d9a3362800..11160492c45 100644 --- a/cupy_backends/hip/cupy_hipsparse.h +++ b/cupy_backends/hip/cupy_hipsparse.h @@ -25,4 +25,6 @@ hipsparseStatus_t cusparseConstrainedGeMM(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } +#define CUSPARSE_VERSION (hipsparseVersionMajor*100000+hipsparseVersionMinor*100+hipsparseVersionPatch) + #endif // INCLUDE_GUARD_HIP_CUPY_HIPSPARSE_H From 4e4f2ccfc2c406954e825e8e0331979c0cd1238f Mon Sep 17 00:00:00 2001 From: bmedishe Date: Tue, 30 Apr 2024 15:46:27 +0000 Subject: [PATCH 13/30] update cupy_backends/hip/cupy_hipsparse.h --- cupy_backends/hip/cupy_hipsparse.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cupy_backends/hip/cupy_hipsparse.h b/cupy_backends/hip/cupy_hipsparse.h index 11160492c45..73d6d8ac735 100644 --- a/cupy_backends/hip/cupy_hipsparse.h +++ b/cupy_backends/hip/cupy_hipsparse.h @@ -9,6 +9,8 @@ #include // for hipDataType #include // for gcc 10.0 +typedef enum {} cusparseAlgMode_t; + hipsparseStatus_t cusparseCsrmvEx_bufferSize(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } From 832f7b322080ff7042c5337514d687f5e59d7633 Mon Sep 17 00:00:00 2001 From: bmedishe Date: Tue, 7 May 2024 15:42:28 +0000 Subject: [PATCH 14/30] version code from cupy_backends/hip/cupy_hipsparse.h moved to cupy_backends/cuda/libs/cusparse.pyx --- cupy_backends/cuda/libs/cusparse.pyx | 442 +++++++++++++++++---------- cupy_backends/hip/cupy_hipsparse.h | 23 ++ 2 files changed, 301 insertions(+), 164 deletions(-) diff --git a/cupy_backends/cuda/libs/cusparse.pyx b/cupy_backends/cuda/libs/cusparse.pyx index 60c902e9a6f..df083494475 100644 --- a/cupy_backends/cuda/libs/cusparse.pyx +++ b/cupy_backends/cuda/libs/cusparse.pyx @@ -3322,13 +3322,19 @@ ELSE: cpdef size_t createBsrilu02Info() except? -1: cdef bsrilu02Info_t info with nogil: - status = cusparseCreateBsrilu02Info(&info) + IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30900000: + status = CUSPARSE_STATUS_NOT_SUPPORTED; + ELSE: + status = cusparseCreateBsrilu02Info(&info) check_status(status) return info cpdef void destroyBsrilu02Info(size_t info) except *: with nogil: - status = cusparseDestroyBsrilu02Info(info) + IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30900000: + status = CUSPARSE_STATUS_NOT_SUPPORTED; + ELSE: + status = cusparseDestroyBsrilu02Info(info) check_status(status) cpdef size_t createCsric02Info() except? -1: @@ -3346,13 +3352,19 @@ ELSE: cpdef size_t createBsric02Info() except? -1: cdef bsric02Info_t info with nogil: - status = cusparseCreateBsric02Info(&info) + IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30800000: + status = CUSPARSE_STATUS_NOT_SUPPORTED; + ELSE: + status = cusparseCreateBsric02Info(&info) check_status(status) return info cpdef void destroyBsric02Info(size_t info) except *: with nogil: - status = cusparseDestroyBsric02Info(info) + IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30800000: + status = CUSPARSE_STATUS_NOT_SUPPORTED; + ELSE: + status = cusparseDestroyBsric02Info(info) check_status(status) cpdef void scsrilu02_numericBoost( @@ -3360,9 +3372,12 @@ ELSE: size_t tol, size_t boost_val) except *: _setStream(handle) with nogil: - status = cusparseScsrilu02_numericBoost( - handle, info, enable_boost, - tol, boost_val) + IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 40000000: + status = CUSPARSE_STATUS_NOT_SUPPORTED; + ELSE: + status = cusparseScsrilu02_numericBoost( + handle, info, enable_boost, + tol, boost_val) check_status(status) cpdef void dcsrilu02_numericBoost( @@ -3370,9 +3385,12 @@ ELSE: size_t tol, size_t boost_val) except *: _setStream(handle) with nogil: - status = cusparseDcsrilu02_numericBoost( - handle, info, enable_boost, - tol, boost_val) + IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 40000000: + status = CUSPARSE_STATUS_NOT_SUPPORTED; + ELSE: + status = cusparseDcsrilu02_numericBoost( + handle, info, enable_boost, + tol, boost_val) check_status(status) cpdef void ccsrilu02_numericBoost( @@ -3380,9 +3398,12 @@ ELSE: size_t tol, size_t boost_val) except *: _setStream(handle) with nogil: - status = cusparseCcsrilu02_numericBoost( - handle, info, enable_boost, - tol, boost_val) + IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 40000000: + status = CUSPARSE_STATUS_NOT_SUPPORTED; + ELSE: + status = cusparseCcsrilu02_numericBoost( + handle, info, enable_boost, + tol, boost_val) check_status(status) cpdef void zcsrilu02_numericBoost( @@ -3390,9 +3411,12 @@ ELSE: size_t tol, size_t boost_val) except *: _setStream(handle) with nogil: - status = cusparseZcsrilu02_numericBoost( - handle, info, enable_boost, - tol, boost_val) + IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 40000000: + status = CUSPARSE_STATUS_NOT_SUPPORTED; + ELSE: + status = cusparseZcsrilu02_numericBoost( + handle, info, enable_boost, + tol, boost_val) check_status(status) cpdef void xcsrilu02_zeroPivot( @@ -3573,9 +3597,12 @@ ELSE: size_t tol, size_t boost_val) except *: _setStream(handle) with nogil: - status = cusparseSbsrilu02_numericBoost( - handle, info, enable_boost, - tol, boost_val) + IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30900000: + status = CUSPARSE_STATUS_NOT_SUPPORTED; + ELSE: + status = cusparseSbsrilu02_numericBoost( + handle, info, enable_boost, + tol, boost_val) check_status(status) cpdef void dbsrilu02_numericBoost( @@ -3583,9 +3610,12 @@ ELSE: size_t tol, size_t boost_val) except *: _setStream(handle) with nogil: - status = cusparseDbsrilu02_numericBoost( - handle, info, enable_boost, - tol, boost_val) + IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30900000: + status = CUSPARSE_STATUS_NOT_SUPPORTED; + ELSE: + status = cusparseDbsrilu02_numericBoost( + handle, info, enable_boost, + tol, boost_val) check_status(status) cpdef void cbsrilu02_numericBoost( @@ -3593,9 +3623,12 @@ ELSE: size_t tol, size_t boost_val) except *: _setStream(handle) with nogil: - status = cusparseCbsrilu02_numericBoost( - handle, info, enable_boost, - tol, boost_val) + IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30900000: + status = CUSPARSE_STATUS_NOT_SUPPORTED; + ELSE: + status = cusparseCbsrilu02_numericBoost( + handle, info, enable_boost, + tol, boost_val) check_status(status) cpdef void zbsrilu02_numericBoost( @@ -3603,17 +3636,23 @@ ELSE: size_t tol, size_t boost_val) except *: _setStream(handle) with nogil: - status = cusparseZbsrilu02_numericBoost( - handle, info, enable_boost, - tol, boost_val) + IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30900000: + status = CUSPARSE_STATUS_NOT_SUPPORTED; + ELSE: + status = cusparseZbsrilu02_numericBoost( + handle, info, enable_boost, + tol, boost_val) check_status(status) cpdef void xbsrilu02_zeroPivot( intptr_t handle, size_t info, size_t position) except *: _setStream(handle) with nogil: - status = cusparseXbsrilu02_zeroPivot( - handle, info, position) + IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30900000: + status = CUSPARSE_STATUS_NOT_SUPPORTED; + ELSE: + status = cusparseXbsrilu02_zeroPivot( + handle, info, position) check_status(status) cpdef int sbsrilu02_bufferSize(intptr_t handle, int dirA, int mb, int nnzb, @@ -3623,11 +3662,14 @@ ELSE: cdef int pBufferSizeInBytes _setStream(handle) with nogil: - status = cusparseSbsrilu02_bufferSize( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, &pBufferSizeInBytes) + IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30900000: + status = CUSPARSE_STATUS_NOT_SUPPORTED; + ELSE: + status = cusparseSbsrilu02_bufferSize( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes @@ -3638,11 +3680,14 @@ ELSE: cdef int pBufferSizeInBytes _setStream(handle) with nogil: - status = cusparseDbsrilu02_bufferSize( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, &pBufferSizeInBytes) + IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30900000: + status = CUSPARSE_STATUS_NOT_SUPPORTED; + ELSE: + status = cusparseDbsrilu02_bufferSize( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes @@ -3653,11 +3698,14 @@ ELSE: cdef int pBufferSizeInBytes _setStream(handle) with nogil: - status = cusparseCbsrilu02_bufferSize( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, &pBufferSizeInBytes) + IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30900000: + status = CUSPARSE_STATUS_NOT_SUPPORTED; + ELSE: + status = cusparseCbsrilu02_bufferSize( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes @@ -3668,11 +3716,14 @@ ELSE: cdef int pBufferSizeInBytes _setStream(handle) with nogil: - status = cusparseZbsrilu02_bufferSize( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, &pBufferSizeInBytes) + IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30900000: + status = CUSPARSE_STATUS_NOT_SUPPORTED; + ELSE: + status = cusparseZbsrilu02_bufferSize( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes @@ -3682,12 +3733,15 @@ ELSE: int blockDim, size_t info, int policy, size_t pBuffer) except *: _setStream(handle) with nogil: - status = cusparseSbsrilu02_analysis( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, policy, - pBuffer) + IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30900000: + status = CUSPARSE_STATUS_NOT_SUPPORTED; + ELSE: + status = cusparseSbsrilu02_analysis( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, policy, + pBuffer) check_status(status) cpdef void dbsrilu02_analysis( @@ -3696,12 +3750,15 @@ ELSE: int blockDim, size_t info, int policy, size_t pBuffer) except *: _setStream(handle) with nogil: - status = cusparseDbsrilu02_analysis( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, policy, - pBuffer) + IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30900000: + status = CUSPARSE_STATUS_NOT_SUPPORTED; + ELSE: + status = cusparseDbsrilu02_analysis( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, policy, + pBuffer) check_status(status) cpdef void cbsrilu02_analysis( @@ -3710,12 +3767,15 @@ ELSE: int blockDim, size_t info, int policy, size_t pBuffer) except *: _setStream(handle) with nogil: - status = cusparseCbsrilu02_analysis( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, policy, - pBuffer) + IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30900000: + status = CUSPARSE_STATUS_NOT_SUPPORTED; + ELSE: + status = cusparseCbsrilu02_analysis( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, policy, + pBuffer) check_status(status) cpdef void zbsrilu02_analysis( @@ -3724,12 +3784,15 @@ ELSE: int blockDim, size_t info, int policy, size_t pBuffer) except *: _setStream(handle) with nogil: - status = cusparseZbsrilu02_analysis( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, policy, - pBuffer) + IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30900000: + status = CUSPARSE_STATUS_NOT_SUPPORTED; + ELSE: + status = cusparseZbsrilu02_analysis( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, policy, + pBuffer) check_status(status) cpdef void sbsrilu02( @@ -3739,12 +3802,15 @@ ELSE: size_t pBuffer) except *: _setStream(handle) with nogil: - status = cusparseSbsrilu02( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, policy, - pBuffer) + IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30900000: + status = CUSPARSE_STATUS_NOT_SUPPORTED; + ELSE: + status = cusparseSbsrilu02( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, policy, + pBuffer) check_status(status) cpdef void dbsrilu02( @@ -3754,12 +3820,15 @@ ELSE: size_t pBuffer) except *: _setStream(handle) with nogil: - status = cusparseDbsrilu02( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, policy, - pBuffer) + IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30900000: + status = CUSPARSE_STATUS_NOT_SUPPORTED; + ELSE: + status = cusparseDbsrilu02( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, policy, + pBuffer) check_status(status) cpdef void cbsrilu02( @@ -3769,12 +3838,15 @@ ELSE: size_t pBuffer) except *: _setStream(handle) with nogil: - status = cusparseCbsrilu02( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, policy, - pBuffer) + IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30900000: + status = CUSPARSE_STATUS_NOT_SUPPORTED; + ELSE: + status = cusparseCbsrilu02( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, policy, + pBuffer) check_status(status) cpdef void zbsrilu02( @@ -3784,12 +3856,15 @@ ELSE: size_t pBuffer) except *: _setStream(handle) with nogil: - status = cusparseZbsrilu02( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, policy, - pBuffer) + IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30900000: + status = CUSPARSE_STATUS_NOT_SUPPORTED; + ELSE: + status = cusparseZbsrilu02( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, policy, + pBuffer) check_status(status) cpdef void xcsric02_zeroPivot( @@ -3972,8 +4047,11 @@ ELSE: intptr_t handle, size_t info, size_t position) except *: _setStream(handle) with nogil: - status = cusparseXbsric02_zeroPivot( - handle, info, position) + IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30800000: + status = CUSPARSE_STATUS_NOT_SUPPORTED; + ELSE: + status = cusparseXbsric02_zeroPivot( + handle, info, position) check_status(status) cpdef int sbsric02_bufferSize(intptr_t handle, int dirA, int mb, int nnzb, @@ -3983,11 +4061,14 @@ ELSE: cdef int pBufferSizeInBytes _setStream(handle) with nogil: - status = cusparseSbsric02_bufferSize( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, &pBufferSizeInBytes) + IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30800000: + status = CUSPARSE_STATUS_NOT_SUPPORTED; + ELSE: + status = cusparseSbsric02_bufferSize( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes @@ -3998,11 +4079,14 @@ ELSE: cdef int pBufferSizeInBytes _setStream(handle) with nogil: - status = cusparseDbsric02_bufferSize( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, &pBufferSizeInBytes) + IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30800000: + status = CUSPARSE_STATUS_NOT_SUPPORTED; + ELSE: + status = cusparseDbsric02_bufferSize( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes @@ -4013,11 +4097,14 @@ ELSE: cdef int pBufferSizeInBytes _setStream(handle) with nogil: - status = cusparseCbsric02_bufferSize( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, &pBufferSizeInBytes) + IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30800000: + status = CUSPARSE_STATUS_NOT_SUPPORTED; + ELSE: + status = cusparseCbsric02_bufferSize( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes @@ -4028,11 +4115,14 @@ ELSE: cdef int pBufferSizeInBytes _setStream(handle) with nogil: - status = cusparseZbsric02_bufferSize( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, &pBufferSizeInBytes) + IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30800000: + status = CUSPARSE_STATUS_NOT_SUPPORTED; + ELSE: + status = cusparseZbsric02_bufferSize( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes @@ -4042,12 +4132,15 @@ ELSE: int blockDim, size_t info, int policy, size_t pInputBuffer) except *: _setStream(handle) with nogil: - status = cusparseSbsric02_analysis( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, policy, - pInputBuffer) + IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30800000: + status = CUSPARSE_STATUS_NOT_SUPPORTED; + ELSE: + status = cusparseSbsric02_analysis( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, policy, + pInputBuffer) check_status(status) cpdef void dbsric02_analysis( @@ -4056,12 +4149,15 @@ ELSE: int blockDim, size_t info, int policy, size_t pInputBuffer) except *: _setStream(handle) with nogil: - status = cusparseDbsric02_analysis( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, policy, - pInputBuffer) + IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30800000: + status = CUSPARSE_STATUS_NOT_SUPPORTED; + ELSE: + status = cusparseDbsric02_analysis( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, policy, + pInputBuffer) check_status(status) cpdef void cbsric02_analysis( @@ -4070,12 +4166,15 @@ ELSE: int blockDim, size_t info, int policy, size_t pInputBuffer) except *: _setStream(handle) with nogil: - status = cusparseCbsric02_analysis( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, policy, - pInputBuffer) + IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30800000: + status = CUSPARSE_STATUS_NOT_SUPPORTED; + ELSE: + status = cusparseCbsric02_analysis( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, policy, + pInputBuffer) check_status(status) cpdef void zbsric02_analysis( @@ -4084,12 +4183,15 @@ ELSE: int blockDim, size_t info, int policy, size_t pInputBuffer) except *: _setStream(handle) with nogil: - status = cusparseZbsric02_analysis( - handle, dirA, mb, nnzb, - descrA, - bsrSortedVal, bsrSortedRowPtr, - bsrSortedColInd, blockDim, info, - policy, pInputBuffer) + IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30800000: + status = CUSPARSE_STATUS_NOT_SUPPORTED; + ELSE: + status = cusparseZbsric02_analysis( + handle, dirA, mb, nnzb, + descrA, + bsrSortedVal, bsrSortedRowPtr, + bsrSortedColInd, blockDim, info, + policy, pInputBuffer) check_status(status) cpdef void sbsric02( @@ -4099,11 +4201,14 @@ ELSE: size_t pBuffer) except *: _setStream(handle) with nogil: - status = cusparseSbsric02( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, policy, pBuffer) + IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30800000: + status = CUSPARSE_STATUS_NOT_SUPPORTED; + ELSE: + status = cusparseSbsric02( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, policy, pBuffer) check_status(status) cpdef void dbsric02( @@ -4113,11 +4218,14 @@ ELSE: size_t pBuffer) except *: _setStream(handle) with nogil: - status = cusparseDbsric02( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, policy, pBuffer) + IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30800000: + status = CUSPARSE_STATUS_NOT_SUPPORTED; + ELSE: + status = cusparseDbsric02( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, policy, pBuffer) check_status(status) cpdef void cbsric02( @@ -4127,11 +4235,14 @@ ELSE: size_t pBuffer) except *: _setStream(handle) with nogil: - status = cusparseCbsric02( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, policy, pBuffer) + IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30800000: + status = CUSPARSE_STATUS_NOT_SUPPORTED; + ELSE: + status = cusparseCbsric02( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, policy, pBuffer) check_status(status) cpdef void zbsric02( @@ -4141,11 +4252,14 @@ ELSE: size_t pBuffer) except *: _setStream(handle) with nogil: - status = cusparseZbsric02( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, policy, pBuffer) + IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30800000: + status = CUSPARSE_STATUS_NOT_SUPPORTED; + ELSE: + status = cusparseZbsric02( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, policy, pBuffer) check_status(status) cpdef size_t sgtsv2_bufferSizeExt( diff --git a/cupy_backends/hip/cupy_hipsparse.h b/cupy_backends/hip/cupy_hipsparse.h index 73d6d8ac735..4d730017ebc 100644 --- a/cupy_backends/hip/cupy_hipsparse.h +++ b/cupy_backends/hip/cupy_hipsparse.h @@ -29,4 +29,27 @@ hipsparseStatus_t cusparseConstrainedGeMM(...) { #define CUSPARSE_VERSION (hipsparseVersionMajor*100000+hipsparseVersionMinor*100+hipsparseVersionPatch) +// cuSPARSE generic API +#if HIP_VERSION < 402 +typedef void* cusparseSpVecDescr_t; +typedef void* cusparseDnVecDescr_t; +typedef void* cusparseSpMatDescr_t; +typedef void* cusparseDnMatDescr_t; +typedef enum {} cusparseIndexType_t; +typedef enum {} cusparseFormat_t; +typedef enum {} cusparseOrder_t; +typedef enum {} cusparseSpMVAlg_t; +typedef enum {} cusparseSpMMAlg_t; +typedef enum {} cusparseSparseToDenseAlg_t; +typedef enum {} cusparseDenseToSparseAlg_t; +#endif + +#if HIP_VERSION < 50000000 +typedef enum {} cusparseSpMatAttribute_t; +typedef enum {} cusparseSpSMAlg_t; +typedef void * cusparseSpSMDescr_t; +#endif + + + #endif // INCLUDE_GUARD_HIP_CUPY_HIPSPARSE_H From c40dde3177d14cc26faf3ad6bad7fc7e1043f046 Mon Sep 17 00:00:00 2001 From: bmedishe Date: Tue, 7 May 2024 15:48:56 +0000 Subject: [PATCH 15/30] update cupy_backends/cuda/libs/cusparse.pxd with unspported enums --- cupy_backends/cuda/libs/cusparse.pxd | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cupy_backends/cuda/libs/cusparse.pxd b/cupy_backends/cuda/libs/cusparse.pxd index f3e56c87853..7531ec6cfd3 100644 --- a/cupy_backends/cuda/libs/cusparse.pxd +++ b/cupy_backends/cuda/libs/cusparse.pxd @@ -103,9 +103,6 @@ cpdef enum: CUSPARSE_SOLVE_POLICY_NO_LEVEL = 0 CUSPARSE_SOLVE_POLICY_USE_LEVEL = 1 - CUSPARSE_ALG_NAIVE = 0 - CUSPARSE_ALG_MERGE_PATH = 1 - # Enums for cuSparse generic API CUSPARSE_FORMAT_CSR = 1 # Compressed Sparse Row (CSR) CUSPARSE_FORMAT_CSC = 2 # Compressed Sparse Column (CSC) @@ -150,6 +147,10 @@ cpdef enum: # cusparseDenseToSparseAlg_t CUSPARSE_DENSETOSPARSE_ALG_DEFAULT = 0 IF CUPY_HIP_VERSION == 0: + cpdef enum: + CUSPARSE_ALG_NAIVE = 0 + CUSPARSE_ALG_MERGE_PATH = 1 + cdef class SpVecAttributes: cdef: public int64_t size From 9f9e75c7bb9837adecf58d44a32d25b7727f48e5 Mon Sep 17 00:00:00 2001 From: bmedishe Date: Tue, 7 May 2024 19:20:46 +0000 Subject: [PATCH 16/30] is_hip_environment to runtime._is_hip_environment --- cupy_backends/cuda/libs/cusparse.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cupy_backends/cuda/libs/cusparse.pyx b/cupy_backends/cuda/libs/cusparse.pyx index df083494475..9e860e59a73 100644 --- a/cupy_backends/cuda/libs/cusparse.pyx +++ b/cupy_backends/cuda/libs/cusparse.pyx @@ -1522,7 +1522,7 @@ ELSE: self.status = status cdef bytes name cdef bytes msg - if _is_hip_environment: + if runtime._is_hip_environment: name = HIP_STATUS[status] msg = name else: From 15c457444453081b77243b98800b227279fda012 Mon Sep 17 00:00:00 2001 From: bmedishe Date: Tue, 7 May 2024 21:15:38 +0000 Subject: [PATCH 17/30] version_check grouped and in cupy_backends/hip/cupy_hipsparse.h --- cupy_backends/cuda/libs/cusparse.pyx | 446 +++++--------- cupy_backends/hip/cupy_hipsparse.h | 865 +++++++++++++++++++++++++++ 2 files changed, 1031 insertions(+), 280 deletions(-) diff --git a/cupy_backends/cuda/libs/cusparse.pyx b/cupy_backends/cuda/libs/cusparse.pyx index 9e860e59a73..9eeb6ade6e6 100644 --- a/cupy_backends/cuda/libs/cusparse.pyx +++ b/cupy_backends/cuda/libs/cusparse.pyx @@ -3,9 +3,9 @@ cimport cython # NOQA IF CUPY_HIP_VERSION > 0: from cupy_backends.cuda.api cimport runtime_hip as runtime + from cupy_backends.cuda.api.runtime_hip cimport _is_hip_environment ELSE: from cupy_backends.cuda.api cimport runtime -from cupy_backends.cuda.api.runtime cimport _is_hip_environment from cupy_backends.cuda cimport stream as stream_module from cupy_backends.cuda._softlink cimport SoftLink @@ -1522,7 +1522,7 @@ ELSE: self.status = status cdef bytes name cdef bytes msg - if runtime._is_hip_environment: + if _is_hip_environment: name = HIP_STATUS[status] msg = name else: @@ -3322,19 +3322,13 @@ ELSE: cpdef size_t createBsrilu02Info() except? -1: cdef bsrilu02Info_t info with nogil: - IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30900000: - status = CUSPARSE_STATUS_NOT_SUPPORTED; - ELSE: - status = cusparseCreateBsrilu02Info(&info) + status = cusparseCreateBsrilu02Info(&info) check_status(status) return info cpdef void destroyBsrilu02Info(size_t info) except *: with nogil: - IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30900000: - status = CUSPARSE_STATUS_NOT_SUPPORTED; - ELSE: - status = cusparseDestroyBsrilu02Info(info) + status = cusparseDestroyBsrilu02Info(info) check_status(status) cpdef size_t createCsric02Info() except? -1: @@ -3352,19 +3346,13 @@ ELSE: cpdef size_t createBsric02Info() except? -1: cdef bsric02Info_t info with nogil: - IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30800000: - status = CUSPARSE_STATUS_NOT_SUPPORTED; - ELSE: - status = cusparseCreateBsric02Info(&info) + status = cusparseCreateBsric02Info(&info) check_status(status) return info cpdef void destroyBsric02Info(size_t info) except *: with nogil: - IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30800000: - status = CUSPARSE_STATUS_NOT_SUPPORTED; - ELSE: - status = cusparseDestroyBsric02Info(info) + status = cusparseDestroyBsric02Info(info) check_status(status) cpdef void scsrilu02_numericBoost( @@ -3372,12 +3360,9 @@ ELSE: size_t tol, size_t boost_val) except *: _setStream(handle) with nogil: - IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 40000000: - status = CUSPARSE_STATUS_NOT_SUPPORTED; - ELSE: - status = cusparseScsrilu02_numericBoost( - handle, info, enable_boost, - tol, boost_val) + status = cusparseScsrilu02_numericBoost( + handle, info, enable_boost, + tol, boost_val) check_status(status) cpdef void dcsrilu02_numericBoost( @@ -3385,12 +3370,9 @@ ELSE: size_t tol, size_t boost_val) except *: _setStream(handle) with nogil: - IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 40000000: - status = CUSPARSE_STATUS_NOT_SUPPORTED; - ELSE: - status = cusparseDcsrilu02_numericBoost( - handle, info, enable_boost, - tol, boost_val) + status = cusparseDcsrilu02_numericBoost( + handle, info, enable_boost, + tol, boost_val) check_status(status) cpdef void ccsrilu02_numericBoost( @@ -3398,12 +3380,9 @@ ELSE: size_t tol, size_t boost_val) except *: _setStream(handle) with nogil: - IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 40000000: - status = CUSPARSE_STATUS_NOT_SUPPORTED; - ELSE: - status = cusparseCcsrilu02_numericBoost( - handle, info, enable_boost, - tol, boost_val) + status = cusparseCcsrilu02_numericBoost( + handle, info, enable_boost, + tol, boost_val) check_status(status) cpdef void zcsrilu02_numericBoost( @@ -3411,12 +3390,9 @@ ELSE: size_t tol, size_t boost_val) except *: _setStream(handle) with nogil: - IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 40000000: - status = CUSPARSE_STATUS_NOT_SUPPORTED; - ELSE: - status = cusparseZcsrilu02_numericBoost( - handle, info, enable_boost, - tol, boost_val) + status = cusparseZcsrilu02_numericBoost( + handle, info, enable_boost, + tol, boost_val) check_status(status) cpdef void xcsrilu02_zeroPivot( @@ -3597,12 +3573,9 @@ ELSE: size_t tol, size_t boost_val) except *: _setStream(handle) with nogil: - IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30900000: - status = CUSPARSE_STATUS_NOT_SUPPORTED; - ELSE: - status = cusparseSbsrilu02_numericBoost( - handle, info, enable_boost, - tol, boost_val) + status = cusparseSbsrilu02_numericBoost( + handle, info, enable_boost, + tol, boost_val) check_status(status) cpdef void dbsrilu02_numericBoost( @@ -3610,12 +3583,9 @@ ELSE: size_t tol, size_t boost_val) except *: _setStream(handle) with nogil: - IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30900000: - status = CUSPARSE_STATUS_NOT_SUPPORTED; - ELSE: - status = cusparseDbsrilu02_numericBoost( - handle, info, enable_boost, - tol, boost_val) + status = cusparseDbsrilu02_numericBoost( + handle, info, enable_boost, + tol, boost_val) check_status(status) cpdef void cbsrilu02_numericBoost( @@ -3623,12 +3593,9 @@ ELSE: size_t tol, size_t boost_val) except *: _setStream(handle) with nogil: - IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30900000: - status = CUSPARSE_STATUS_NOT_SUPPORTED; - ELSE: - status = cusparseCbsrilu02_numericBoost( - handle, info, enable_boost, - tol, boost_val) + status = cusparseCbsrilu02_numericBoost( + handle, info, enable_boost, + tol, boost_val) check_status(status) cpdef void zbsrilu02_numericBoost( @@ -3636,23 +3603,17 @@ ELSE: size_t tol, size_t boost_val) except *: _setStream(handle) with nogil: - IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30900000: - status = CUSPARSE_STATUS_NOT_SUPPORTED; - ELSE: - status = cusparseZbsrilu02_numericBoost( - handle, info, enable_boost, - tol, boost_val) + status = cusparseZbsrilu02_numericBoost( + handle, info, enable_boost, + tol, boost_val) check_status(status) cpdef void xbsrilu02_zeroPivot( intptr_t handle, size_t info, size_t position) except *: _setStream(handle) with nogil: - IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30900000: - status = CUSPARSE_STATUS_NOT_SUPPORTED; - ELSE: - status = cusparseXbsrilu02_zeroPivot( - handle, info, position) + status = cusparseXbsrilu02_zeroPivot( + handle, info, position) check_status(status) cpdef int sbsrilu02_bufferSize(intptr_t handle, int dirA, int mb, int nnzb, @@ -3662,14 +3623,11 @@ ELSE: cdef int pBufferSizeInBytes _setStream(handle) with nogil: - IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30900000: - status = CUSPARSE_STATUS_NOT_SUPPORTED; - ELSE: - status = cusparseSbsrilu02_bufferSize( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, &pBufferSizeInBytes) + status = cusparseSbsrilu02_bufferSize( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes @@ -3680,14 +3638,11 @@ ELSE: cdef int pBufferSizeInBytes _setStream(handle) with nogil: - IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30900000: - status = CUSPARSE_STATUS_NOT_SUPPORTED; - ELSE: - status = cusparseDbsrilu02_bufferSize( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, &pBufferSizeInBytes) + status = cusparseDbsrilu02_bufferSize( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes @@ -3698,14 +3653,11 @@ ELSE: cdef int pBufferSizeInBytes _setStream(handle) with nogil: - IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30900000: - status = CUSPARSE_STATUS_NOT_SUPPORTED; - ELSE: - status = cusparseCbsrilu02_bufferSize( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, &pBufferSizeInBytes) + status = cusparseCbsrilu02_bufferSize( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes @@ -3716,14 +3668,11 @@ ELSE: cdef int pBufferSizeInBytes _setStream(handle) with nogil: - IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30900000: - status = CUSPARSE_STATUS_NOT_SUPPORTED; - ELSE: - status = cusparseZbsrilu02_bufferSize( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, &pBufferSizeInBytes) + status = cusparseZbsrilu02_bufferSize( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes @@ -3733,15 +3682,12 @@ ELSE: int blockDim, size_t info, int policy, size_t pBuffer) except *: _setStream(handle) with nogil: - IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30900000: - status = CUSPARSE_STATUS_NOT_SUPPORTED; - ELSE: - status = cusparseSbsrilu02_analysis( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, policy, - pBuffer) + status = cusparseSbsrilu02_analysis( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, policy, + pBuffer) check_status(status) cpdef void dbsrilu02_analysis( @@ -3750,15 +3696,12 @@ ELSE: int blockDim, size_t info, int policy, size_t pBuffer) except *: _setStream(handle) with nogil: - IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30900000: - status = CUSPARSE_STATUS_NOT_SUPPORTED; - ELSE: - status = cusparseDbsrilu02_analysis( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, policy, - pBuffer) + status = cusparseDbsrilu02_analysis( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, policy, + pBuffer) check_status(status) cpdef void cbsrilu02_analysis( @@ -3767,15 +3710,12 @@ ELSE: int blockDim, size_t info, int policy, size_t pBuffer) except *: _setStream(handle) with nogil: - IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30900000: - status = CUSPARSE_STATUS_NOT_SUPPORTED; - ELSE: - status = cusparseCbsrilu02_analysis( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, policy, - pBuffer) + status = cusparseCbsrilu02_analysis( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, policy, + pBuffer) check_status(status) cpdef void zbsrilu02_analysis( @@ -3784,15 +3724,12 @@ ELSE: int blockDim, size_t info, int policy, size_t pBuffer) except *: _setStream(handle) with nogil: - IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30900000: - status = CUSPARSE_STATUS_NOT_SUPPORTED; - ELSE: - status = cusparseZbsrilu02_analysis( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, policy, - pBuffer) + status = cusparseZbsrilu02_analysis( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, policy, + pBuffer) check_status(status) cpdef void sbsrilu02( @@ -3802,15 +3739,12 @@ ELSE: size_t pBuffer) except *: _setStream(handle) with nogil: - IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30900000: - status = CUSPARSE_STATUS_NOT_SUPPORTED; - ELSE: - status = cusparseSbsrilu02( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, policy, - pBuffer) + status = cusparseSbsrilu02( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, policy, + pBuffer) check_status(status) cpdef void dbsrilu02( @@ -3820,15 +3754,12 @@ ELSE: size_t pBuffer) except *: _setStream(handle) with nogil: - IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30900000: - status = CUSPARSE_STATUS_NOT_SUPPORTED; - ELSE: - status = cusparseDbsrilu02( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, policy, - pBuffer) + status = cusparseDbsrilu02( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, policy, + pBuffer) check_status(status) cpdef void cbsrilu02( @@ -3838,15 +3769,12 @@ ELSE: size_t pBuffer) except *: _setStream(handle) with nogil: - IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30900000: - status = CUSPARSE_STATUS_NOT_SUPPORTED; - ELSE: - status = cusparseCbsrilu02( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, policy, - pBuffer) + status = cusparseCbsrilu02( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, policy, + pBuffer) check_status(status) cpdef void zbsrilu02( @@ -3856,15 +3784,12 @@ ELSE: size_t pBuffer) except *: _setStream(handle) with nogil: - IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30900000: - status = CUSPARSE_STATUS_NOT_SUPPORTED; - ELSE: - status = cusparseZbsrilu02( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, policy, - pBuffer) + status = cusparseZbsrilu02( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, policy, + pBuffer) check_status(status) cpdef void xcsric02_zeroPivot( @@ -4047,11 +3972,8 @@ ELSE: intptr_t handle, size_t info, size_t position) except *: _setStream(handle) with nogil: - IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30800000: - status = CUSPARSE_STATUS_NOT_SUPPORTED; - ELSE: - status = cusparseXbsric02_zeroPivot( - handle, info, position) + status = cusparseXbsric02_zeroPivot( + handle, info, position) check_status(status) cpdef int sbsric02_bufferSize(intptr_t handle, int dirA, int mb, int nnzb, @@ -4061,14 +3983,11 @@ ELSE: cdef int pBufferSizeInBytes _setStream(handle) with nogil: - IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30800000: - status = CUSPARSE_STATUS_NOT_SUPPORTED; - ELSE: - status = cusparseSbsric02_bufferSize( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, &pBufferSizeInBytes) + status = cusparseSbsric02_bufferSize( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes @@ -4079,14 +3998,11 @@ ELSE: cdef int pBufferSizeInBytes _setStream(handle) with nogil: - IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30800000: - status = CUSPARSE_STATUS_NOT_SUPPORTED; - ELSE: - status = cusparseDbsric02_bufferSize( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, &pBufferSizeInBytes) + status = cusparseDbsric02_bufferSize( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes @@ -4097,14 +4013,11 @@ ELSE: cdef int pBufferSizeInBytes _setStream(handle) with nogil: - IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30800000: - status = CUSPARSE_STATUS_NOT_SUPPORTED; - ELSE: - status = cusparseCbsric02_bufferSize( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, &pBufferSizeInBytes) + status = cusparseCbsric02_bufferSize( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes @@ -4115,14 +4028,11 @@ ELSE: cdef int pBufferSizeInBytes _setStream(handle) with nogil: - IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30800000: - status = CUSPARSE_STATUS_NOT_SUPPORTED; - ELSE: - status = cusparseZbsric02_bufferSize( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, &pBufferSizeInBytes) + status = cusparseZbsric02_bufferSize( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes @@ -4132,15 +4042,12 @@ ELSE: int blockDim, size_t info, int policy, size_t pInputBuffer) except *: _setStream(handle) with nogil: - IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30800000: - status = CUSPARSE_STATUS_NOT_SUPPORTED; - ELSE: - status = cusparseSbsric02_analysis( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, policy, - pInputBuffer) + status = cusparseSbsric02_analysis( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, policy, + pInputBuffer) check_status(status) cpdef void dbsric02_analysis( @@ -4149,15 +4056,12 @@ ELSE: int blockDim, size_t info, int policy, size_t pInputBuffer) except *: _setStream(handle) with nogil: - IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30800000: - status = CUSPARSE_STATUS_NOT_SUPPORTED; - ELSE: - status = cusparseDbsric02_analysis( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, policy, - pInputBuffer) + status = cusparseDbsric02_analysis( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, policy, + pInputBuffer) check_status(status) cpdef void cbsric02_analysis( @@ -4166,15 +4070,12 @@ ELSE: int blockDim, size_t info, int policy, size_t pInputBuffer) except *: _setStream(handle) with nogil: - IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30800000: - status = CUSPARSE_STATUS_NOT_SUPPORTED; - ELSE: - status = cusparseCbsric02_analysis( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, policy, - pInputBuffer) + status = cusparseCbsric02_analysis( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, policy, + pInputBuffer) check_status(status) cpdef void zbsric02_analysis( @@ -4183,15 +4084,12 @@ ELSE: int blockDim, size_t info, int policy, size_t pInputBuffer) except *: _setStream(handle) with nogil: - IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30800000: - status = CUSPARSE_STATUS_NOT_SUPPORTED; - ELSE: - status = cusparseZbsric02_analysis( - handle, dirA, mb, nnzb, - descrA, - bsrSortedVal, bsrSortedRowPtr, - bsrSortedColInd, blockDim, info, - policy, pInputBuffer) + status = cusparseZbsric02_analysis( + handle, dirA, mb, nnzb, + descrA, + bsrSortedVal, bsrSortedRowPtr, + bsrSortedColInd, blockDim, info, + policy, pInputBuffer) check_status(status) cpdef void sbsric02( @@ -4201,14 +4099,11 @@ ELSE: size_t pBuffer) except *: _setStream(handle) with nogil: - IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30800000: - status = CUSPARSE_STATUS_NOT_SUPPORTED; - ELSE: - status = cusparseSbsric02( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, policy, pBuffer) + status = cusparseSbsric02( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, policy, pBuffer) check_status(status) cpdef void dbsric02( @@ -4218,14 +4113,11 @@ ELSE: size_t pBuffer) except *: _setStream(handle) with nogil: - IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30800000: - status = CUSPARSE_STATUS_NOT_SUPPORTED; - ELSE: - status = cusparseDbsric02( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, policy, pBuffer) + status = cusparseDbsric02( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, policy, pBuffer) check_status(status) cpdef void cbsric02( @@ -4235,14 +4127,11 @@ ELSE: size_t pBuffer) except *: _setStream(handle) with nogil: - IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30800000: - status = CUSPARSE_STATUS_NOT_SUPPORTED; - ELSE: - status = cusparseCbsric02( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, policy, pBuffer) + status = cusparseCbsric02( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, policy, pBuffer) check_status(status) cpdef void zbsric02( @@ -4252,14 +4141,11 @@ ELSE: size_t pBuffer) except *: _setStream(handle) with nogil: - IF CUPY_HIP_VERSION > 0 and CUPY_HIP_VERSION < 30800000: - status = CUSPARSE_STATUS_NOT_SUPPORTED; - ELSE: - status = cusparseZbsric02( - handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, policy, pBuffer) + status = cusparseZbsric02( + handle, dirA, mb, nnzb, + descrA, bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, + info, policy, pBuffer) check_status(status) cpdef size_t sgtsv2_bufferSizeExt( diff --git a/cupy_backends/hip/cupy_hipsparse.h b/cupy_backends/hip/cupy_hipsparse.h index 4d730017ebc..90793d55a7a 100644 --- a/cupy_backends/hip/cupy_hipsparse.h +++ b/cupy_backends/hip/cupy_hipsparse.h @@ -9,6 +9,14 @@ #include // for hipDataType #include // for gcc 10.0 +extern "C" { +#if HIP_VERSION < 308 +typedef void* bsric02Info_t; +#endif + +#if HIP_VERSION < 309 +typedef void* bsrilu02Info_t; +#endif typedef enum {} cusparseAlgMode_t; hipsparseStatus_t cusparseCsrmvEx_bufferSize(...) { @@ -26,6 +34,455 @@ hipsparseStatus_t cusparseConstrainedGeMM_bufferSize(...) { hipsparseStatus_t cusparseConstrainedGeMM(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } +#if HIP_VERSION < 309 +hipsparseStatus_t cusparseCreateBsrilu02Info(bsrilu02Info_t* info) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} +hipsparseStatus_t cusparseDestroyBsrilu02Info(bsrilu02Info_t info) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} +hipsparseStatus_t cusparseSbsrilu02_numericBoost(cusparseHandle_t handle, + bsrilu02Info_t info, + int enable_boost, + double* tol, + float* boost_val) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseDbsrilu02_numericBoost(cusparseHandle_t handle, + bsrilu02Info_t info, + int enable_boost, + double* tol, + double* boost_val) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseCbsrilu02_numericBoost(cusparseHandle_t handle, + bsrilu02Info_t info, + int enable_boost, + double* tol, + cuComplex* boost_val) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseZbsrilu02_numericBoost(cusparseHandle_t handle, + bsrilu02Info_t info, + int enable_boost, + double* tol, + cuDoubleComplex* boost_val) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseXbsrilu02_zeroPivot(cusparseHandle_t handle, + bsrilu02Info_t info, + int* position) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseSbsrilu02_bufferSize(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + float* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockDim, + bsrilu02Info_t info, + int* pBufferSizeInBytes) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseDbsrilu02_bufferSize(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + double* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockDim, + bsrilu02Info_t info, + int* pBufferSizeInBytes) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseCbsrilu02_bufferSize(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + cuComplex* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockDim, + bsrilu02Info_t info, + int* pBufferSizeInBytes) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseZbsrilu02_bufferSize(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + cuDoubleComplex* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockDim, + bsrilu02Info_t info, + int* pBufferSizeInBytes) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseSbsrilu02_analysis(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + float* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockDim, + bsrilu02Info_t info, + cusparseSolvePolicy_t policy, + void* pBuffer) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseDbsrilu02_analysis(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + double* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockDim, + bsrilu02Info_t info, + cusparseSolvePolicy_t policy, + void* pBuffer) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseCbsrilu02_analysis(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + cuComplex* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockDim, + bsrilu02Info_t info, + cusparseSolvePolicy_t policy, + void* pBuffer) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseZbsrilu02_analysis(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + cuDoubleComplex* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockDim, + bsrilu02Info_t info, + cusparseSolvePolicy_t policy, + void* pBuffer) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseSbsrilu02(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + float* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockDim, + bsrilu02Info_t info, + cusparseSolvePolicy_t policy, + void* pBuffer) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseDbsrilu02(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + double* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockDim, + bsrilu02Info_t info, + cusparseSolvePolicy_t policy, + void* pBuffer) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseCbsrilu02(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + cuComplex* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockDim, + bsrilu02Info_t info, + cusparseSolvePolicy_t policy, + void* pBuffer) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseZbsrilu02(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + cuDoubleComplex* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockDim, + bsrilu02Info_t info, + cusparseSolvePolicy_t policy, + void* pBuffer) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} +#endif + +#if HIP_VERSION < 308 +hipsparseStatus_t cusparseCreateBsric02Info(bsric02Info_t* info) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseDestroyBsric02Info(bsric02Info_t info) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} +hipsparseStatus_t cusparseXbsric02_zeroPivot(cusparseHandle_t handle, + bsric02Info_t info, + int* position) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseSbsric02_bufferSize(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + float* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockDim, + bsric02Info_t info, + int* pBufferSizeInBytes) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseDbsric02_bufferSize(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + double* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockDim, + bsric02Info_t info, + int* pBufferSizeInBytes) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseCbsric02_bufferSize(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + cuComplex* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockDim, + bsric02Info_t info, + int* pBufferSizeInBytes) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseZbsric02_bufferSize(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + cuDoubleComplex* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockDim, + bsric02Info_t info, + int* pBufferSizeInBytes) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseSbsric02_analysis(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + const float* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockDim, + bsric02Info_t info, + cusparseSolvePolicy_t policy, + void* pInputBuffer) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseDbsric02_analysis(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + const double* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockDim, + bsric02Info_t info, + cusparseSolvePolicy_t policy, + void* pInputBuffer) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseCbsric02_analysis(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + const cuComplex* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockDim, + bsric02Info_t info, + cusparseSolvePolicy_t policy, + void* pInputBuffer) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseZbsric02_analysis(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + const cuDoubleComplex* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockDim, + bsric02Info_t info, + cusparseSolvePolicy_t policy, + void* pInputBuffer) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseSbsric02(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + float* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockDim, + bsric02Info_t info, + cusparseSolvePolicy_t policy, + void* pBuffer) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseDbsric02(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + double* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockDim, + bsric02Info_t info, + cusparseSolvePolicy_t policy, + void* pBuffer) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseCbsric02(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + cuComplex* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* + bsrSortedColInd, + int blockDim, + bsric02Info_t info, + cusparseSolvePolicy_t policy, + void* pBuffer) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseZbsric02(cusparseHandle_t handle, + cusparseDirection_t dirA, + int mb, + int nnzb, + const cusparseMatDescr_t descrA, + cuDoubleComplex* bsrSortedVal, + const int* bsrSortedRowPtr, + const int* bsrSortedColInd, + int blockDim, + bsric02Info_t info, + cusparseSolvePolicy_t policy, + void* pBuffer) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} +#endif + +#if HIP_VERSION < 400 +hipsparseStatus_t cusparseScsrilu02_numericBoost(cusparseHandle_t handle, + csrilu02Info_t info, + int enable_boost, + double* tol, + float* boost_val) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseDcsrilu02_numericBoost(cusparseHandle_t handle, + csrilu02Info_t info, + int enable_boost, + double* tol, + double* boost_val) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseCcsrilu02_numericBoost(cusparseHandle_t handle, + csrilu02Info_t info, + int enable_boost, + double* tol, + cuComplex* boost_val) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseZcsrilu02_numericBoost(cusparseHandle_t handle, + csrilu02Info_t info, + int enable_boost, + double* tol, + cuDoubleComplex* boost_val) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} +#endif + + #define CUSPARSE_VERSION (hipsparseVersionMajor*100000+hipsparseVersionMinor*100+hipsparseVersionPatch) @@ -50,6 +507,414 @@ typedef enum {} cusparseSpSMAlg_t; typedef void * cusparseSpSMDescr_t; #endif +#if HIP_VERSION < 402 +hipsparseStatus_t cusparseCreateSpVec(cusparseSpVecDescr_t* spVecDescr, + int64_t size, + int64_t nnz, + void* indices, + void* values, + cusparseIndexType_t idxType, + cusparseIndexBase_t idxBase, + cudaDataType valueType) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseDestroySpVec(cusparseSpVecDescr_t spVecDescr) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseSpVecGet(cusparseSpVecDescr_t spVecDescr, + int64_t* size, + int64_t* nnz, + void** indices, + void** values, + cusparseIndexType_t* idxType, + cusparseIndexBase_t* idxBase, + cudaDataType* valueType) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseSpVecGetIndexBase(cusparseSpVecDescr_t spVecDescr, + cusparseIndexBase_t* idxBase) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} +hipsparseStatus_t cusparseSpVecGetValues(cusparseSpVecDescr_t spVecDescr, + void** values) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseSpVecSetValues(cusparseSpVecDescr_t spVecDescr, + void* values) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseCreateCoo(cusparseSpMatDescr_t* spMatDescr, + int64_t rows, + int64_t cols, + int64_t nnz, + void* cooRowInd, + void* cooColInd, + void* cooValues, + cusparseIndexType_t cooIdxType, + cusparseIndexBase_t idxBase, + cudaDataType valueType) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseCreateCooAoS(cusparseSpMatDescr_t* spMatDescr, + int64_t rows, + int64_t cols, + int64_t nnz, + void* cooInd, + void* cooValues, + cusparseIndexType_t cooIdxType, + cusparseIndexBase_t idxBase, + cudaDataType valueType) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseCreateCsr(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) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseCreateCsc(cusparseSpMatDescr_t* spMatDescr, + int64_t rows, + int64_t cols, + int64_t nnz, + void* cscColOffsets, + void* cscRowInd, + void* cscValues, + cusparseIndexType_t cscColOffsetsType, + cusparseIndexType_t cscRowIndType, + cusparseIndexBase_t idxBase, + cudaDataType valueType) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseDestroySpMat(cusparseSpMatDescr_t spMatDescr) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseCooGet(cusparseSpMatDescr_t spMatDescr, + int64_t* rows, + int64_t* cols, + int64_t* nnz, + void** cooRowInd, // COO row indices + void** cooColInd, // COO column indices + void** cooValues, // COO values + cusparseIndexType_t* idxType, + cusparseIndexBase_t* idxBase, + cudaDataType* valueType) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseCooAoSGet(cusparseSpMatDescr_t spMatDescr, + int64_t* rows, + int64_t* cols, + int64_t* nnz, + void** cooInd, // COO indices + void** cooValues, // COO values + cusparseIndexType_t* idxType, + cusparseIndexBase_t* idxBase, + cudaDataType* valueType) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseCsrGet(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) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseCsrSetPointers(cusparseSpMatDescr_t spMatDescr, + void* csrRowOffsets, + void* csrColInd, + void* csrValues) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseSpMatGetSize(cusparseSpMatDescr_t spMatDescr, + int64_t* rows, + int64_t* cols, + int64_t* nnz) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseSpMatGetFormat(cusparseSpMatDescr_t spMatDescr, + cusparseFormat_t* format) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseSpMatGetIndexBase(cusparseSpMatDescr_t spMatDescr, + cusparseIndexBase_t* idxBase) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseSpMatGetValues(cusparseSpMatDescr_t spMatDescr, + void** values) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseSpMatSetValues(cusparseSpMatDescr_t spMatDescr, + void* values) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseCreateDnVec(cusparseDnVecDescr_t* dnVecDescr, + int64_t size, + void* values, + cudaDataType valueType) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseDestroyDnVec(cusparseDnVecDescr_t dnVecDescr) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseDnVecGet(cusparseDnVecDescr_t dnVecDescr, + int64_t* size, + void** values, + cudaDataType* valueType) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseDnVecGetValues(cusparseDnVecDescr_t dnVecDescr, + void** values) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseDnVecSetValues(cusparseDnVecDescr_t dnVecDescr, + void* values) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseCreateDnMat(cusparseDnMatDescr_t* dnMatDescr, + int64_t rows, + int64_t cols, + int64_t ld, + void* values, + cudaDataType valueType, + cusparseOrder_t order) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseDestroyDnMat(cusparseDnMatDescr_t dnMatDescr) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseDnMatGet(cusparseDnMatDescr_t dnMatDescr, + int64_t* rows, + int64_t* cols, + int64_t* ld, + void** values, + cudaDataType* type, + cusparseOrder_t* order) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseDnMatGetValues(cusparseDnMatDescr_t dnMatDescr, + void** values) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseDnMatSetValues(cusparseDnMatDescr_t dnMatDescr, + void* values) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseSpVV_bufferSize(cusparseHandle_t handle, + cusparseOperation_t opX, + cusparseSpVecDescr_t vecX, + cusparseDnVecDescr_t vecY, + const void* result, + cudaDataType computeType, + size_t* bufferSize) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseSpVV(cusparseHandle_t handle, + cusparseOperation_t opX, + cusparseSpVecDescr_t vecX, + cusparseDnVecDescr_t vecY, + void* result, + cudaDataType computeType, + void* externalBuffer) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseSpMV_bufferSize(cusparseHandle_t handle, + cusparseOperation_t opA, + const void* alpha, + cusparseSpMatDescr_t matA, + cusparseDnVecDescr_t vecX, + const void* beta, + cusparseDnVecDescr_t vecY, + cudaDataType computeType, + cusparseSpMVAlg_t alg, + size_t* bufferSize) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseSpMV(cusparseHandle_t handle, + cusparseOperation_t opA, + const void* alpha, + cusparseSpMatDescr_t matA, + cusparseDnVecDescr_t vecX, + const void* beta, + cusparseDnVecDescr_t vecY, + cudaDataType computeType, + cusparseSpMVAlg_t alg, + void* externalBuffer) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseSpMM_bufferSize(cusparseHandle_t handle, + cusparseOperation_t opA, + cusparseOperation_t opB, + const void* alpha, + cusparseSpMatDescr_t matA, + cusparseDnMatDescr_t matB, + const void* beta, + cusparseDnMatDescr_t matC, + cudaDataType computeType, + cusparseSpMMAlg_t alg, + size_t* bufferSize) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseSpMM(cusparseHandle_t handle, + cusparseOperation_t opA, + cusparseOperation_t opB, + const void* alpha, + cusparseSpMatDescr_t matA, + cusparseDnMatDescr_t matB, + const void* beta, + cusparseDnMatDescr_t matC, + cudaDataType computeType, + cusparseSpMMAlg_t alg, + void* externalBuffer) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseSparseToDense_bufferSize(cusparseHandle_t handle, + cusparseSpMatDescr_t matA, + cusparseDnMatDescr_t matB, + cusparseSparseToDenseAlg_t alg, + size_t* bufferSize) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseSparseToDense(cusparseHandle_t handle, + cusparseSpMatDescr_t matA, + cusparseDnMatDescr_t matB, + cusparseSparseToDenseAlg_t alg, + void* buffer) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseDenseToSparse_bufferSize(cusparseHandle_t handle, + cusparseDnMatDescr_t matA, + cusparseSpMatDescr_t matB, + cusparseDenseToSparseAlg_t alg, + size_t* bufferSize) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseDenseToSparse_analysis(cusparseHandle_t handle, + cusparseDnMatDescr_t matA, + cusparseSpMatDescr_t matB, + cusparseDenseToSparseAlg_t alg, + void* buffer) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseDenseToSparse_convert(cusparseHandle_t handle, + cusparseDnMatDescr_t matA, + cusparseSpMatDescr_t matB, + cusparseDenseToSparseAlg_t alg, + void* buffer) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} +#endif + +#if HIP_VERSION < 50000000 +hipsparseStatus_t cusparseSpMatSetAttribute(cusparseSpMatDescr_t spMatDescr, + cusparseSpMatAttribute_t attribute, + void* data, + size_t dataSize) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseSpSM_createDescr(cusparseSpSMDescr_t* descr) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseSpSM_destroyDescr(cusparseSpSMDescr_t descr) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseSpSM_bufferSize(cusparseHandle_t handle, + cusparseOperation_t opA, + cusparseOperation_t opB, + const void* alpha, + cusparseSpMatDescr_t matA, + cusparseDnMatDescr_t matB, + cusparseDnMatDescr_t matC, + cudaDataType computeType, + cusparseSpSMAlg_t alg, + cusparseSpSMDescr_t spsmDescr, + size_t* bufferSize) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseSpSM_analysis(cusparseHandle_t handle, + cusparseOperation_t opA, + cusparseOperation_t opB, + const void* alpha, + cusparseSpMatDescr_t matA, + cusparseDnMatDescr_t matB, + cusparseDnMatDescr_t matC, + cudaDataType computeType, + cusparseSpSMAlg_t alg, + cusparseSpSMDescr_t spsmDescr, + void* externalBuffer) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +// See cusparse.pyx for a comment +hipsparseStatus_t cusparseSpSM_solve(cusparseHandle_t handle, + cusparseOperation_t opA, + cusparseOperation_t opB, + const void* alpha, + cusparseSpMatDescr_t matA, + cusparseDnMatDescr_t matB, + cusparseDnMatDescr_t matC, + cudaDataType computeType, + cusparseSpSMAlg_t alg, + cusparseSpSMDescr_t spsmDescr, + void* externalBuffer) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} +#endif +} // extern "C" #endif // INCLUDE_GUARD_HIP_CUPY_HIPSPARSE_H From 81e820d05e2ffde692923d35afc64e7083d2eda9 Mon Sep 17 00:00:00 2001 From: bmedishe Date: Tue, 14 May 2024 14:56:40 +0000 Subject: [PATCH 18/30] prasanth comment for cuda build fail --- cupy_backends/cuda/libs/cusparse.pyx | 1 + 1 file changed, 1 insertion(+) diff --git a/cupy_backends/cuda/libs/cusparse.pyx b/cupy_backends/cuda/libs/cusparse.pyx index 9eeb6ade6e6..332a54fc0bd 100644 --- a/cupy_backends/cuda/libs/cusparse.pyx +++ b/cupy_backends/cuda/libs/cusparse.pyx @@ -6,6 +6,7 @@ IF CUPY_HIP_VERSION > 0: from cupy_backends.cuda.api.runtime_hip cimport _is_hip_environment ELSE: from cupy_backends.cuda.api cimport runtime + from cupy_backends.cuda.api.runtime cimport _is_hip_environment from cupy_backends.cuda cimport stream as stream_module from cupy_backends.cuda._softlink cimport SoftLink From 640989a6ff5bf9112a7ef883019e74c06ad972cb Mon Sep 17 00:00:00 2001 From: bmedishe Date: Tue, 14 May 2024 19:40:42 +0000 Subject: [PATCH 19/30] missing version checks --- cupy_backends/hip/cupy_hipsparse.h | 171 +++++++++++++++++++++++++++++ 1 file changed, 171 insertions(+) diff --git a/cupy_backends/hip/cupy_hipsparse.h b/cupy_backends/hip/cupy_hipsparse.h index 90793d55a7a..7c99c3caeaf 100644 --- a/cupy_backends/hip/cupy_hipsparse.h +++ b/cupy_backends/hip/cupy_hipsparse.h @@ -9,6 +9,10 @@ #include // for hipDataType #include // for gcc 10.0 +#if HIP_VERSION < 401 +#define HIPSPARSE_STATUS_NOT_SUPPORTED (hipsparseStatus_t)10 +#endif + extern "C" { #if HIP_VERSION < 308 typedef void* bsric02Info_t; @@ -856,6 +860,106 @@ hipsparseStatus_t cusparseDenseToSparse_convert(cusparseHandle_t handl } #endif +#if HIP_VERSION < 403 +hipsparseStatus_t cusparseSgtsv2_bufferSizeExt(...) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseDgtsv2_bufferSizeExt(...) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseCgtsv2_bufferSizeExt(...) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseZgtsv2_bufferSizeExt(...) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseSgtsv2(...) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseDgtsv2(...) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseCgtsv2(...) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseZgtsv2(...) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseSgtsv2_nopivot_bufferSizeExt(...) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseDgtsv2_nopivot_bufferSizeExt(...) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseCgtsv2_nopivot_bufferSizeExt(...) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseZgtsv2_nopivot_bufferSizeExt(...) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseSgtsv2_nopivot(...) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseDgtsv2_nopivot(...) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseCgtsv2_nopivot(...) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseZgtsv2_nopivot(...) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} +#endif + +#if HIP_VERSION < 405 +hipsparseStatus_t cusparseSgtsv2StridedBatch_bufferSizeExt(...) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseDgtsv2StridedBatch_bufferSizeExt(...) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseCgtsv2StridedBatch_bufferSizeExt(...) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseZgtsv2StridedBatch_bufferSizeExt(...) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseSgtsv2StridedBatch(...) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseDgtsv2StridedBatch(...) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseCgtsv2StridedBatch(...) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseZgtsv2StridedBatch(...) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} +#endif + #if HIP_VERSION < 50000000 hipsparseStatus_t cusparseSpMatSetAttribute(cusparseSpMatDescr_t spMatDescr, cusparseSpMatAttribute_t attribute, @@ -914,6 +1018,73 @@ hipsparseStatus_t cusparseSpSM_solve(cusparseHandle_t handle, void* externalBuffer) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } +#endif + +#if HIP_VERSION < 501 +hipsparseStatus_t cusparseSgtsvInterleavedBatch_bufferSizeExt(...) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseDgtsvInterleavedBatch_bufferSizeExt(...) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseCgtsvInterleavedBatch_bufferSizeExt(...) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseZgtsvInterleavedBatch_bufferSizeExt(...) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseSgtsvInterleavedBatch(...) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseDgtsvInterleavedBatch(...) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseCgtsvInterleavedBatch(...) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseZgtsvInterleavedBatch(...) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseSgpsvInterleavedBatch_bufferSizeExt(...) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseDgpsvInterleavedBatch_bufferSizeExt(...) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseCgpsvInterleavedBatch_bufferSizeExt(...) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseZgpsvInterleavedBatch_bufferSizeExt(...) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseSgpsvInterleavedBatch(...) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseDgpsvInterleavedBatch(...) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseCgpsvInterleavedBatch(...) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + +hipsparseStatus_t cusparseZgpsvInterleavedBatch(...) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} + #endif } // extern "C" From a640e20167278cbdb9028af63e8451bec0e25616 Mon Sep 17 00:00:00 2001 From: bmedishe Date: Fri, 17 May 2024 13:30:11 +0000 Subject: [PATCH 20/30] flake W293 E303 errors fixed in cusparse.pyx , pxd --- cupy_backends/cuda/libs/cusparse.pxd | 12 +- cupy_backends/cuda/libs/cusparse.pyx | 948 +++++++++++++-------------- 2 files changed, 461 insertions(+), 499 deletions(-) diff --git a/cupy_backends/cuda/libs/cusparse.pxd b/cupy_backends/cuda/libs/cusparse.pxd index 7531ec6cfd3..b84f4eacba8 100644 --- a/cupy_backends/cuda/libs/cusparse.pxd +++ b/cupy_backends/cuda/libs/cusparse.pxd @@ -160,7 +160,7 @@ IF CUPY_HIP_VERSION == 0: public IndexType idxType public IndexBase idxBase public DataType valueType - + cdef class CooAttributes: cdef: public int64_t rows @@ -172,7 +172,7 @@ IF CUPY_HIP_VERSION == 0: public IndexType idxType public IndexBase idxBase public DataType valueType - + cdef class CooAoSAttributes: cdef: public int64_t rows @@ -183,7 +183,7 @@ IF CUPY_HIP_VERSION == 0: public IndexType idxType public IndexBase idxBase public DataType valueType - + cdef class CsrAttributes: cdef: public int64_t rows @@ -196,13 +196,13 @@ IF CUPY_HIP_VERSION == 0: public IndexType colIdxType public IndexBase idxBase public DataType valueType - + cdef class DnVecAttributes: cdef: public int64_t size public intptr_t values public DataType valueType - + cdef class DnMatAttributes: cdef: public int64_t rows @@ -211,7 +211,7 @@ IF CUPY_HIP_VERSION == 0: public intptr_t values public DataType valueType public Order order - + cdef class DnMatBatchAttributes: cdef: public int count diff --git a/cupy_backends/cuda/libs/cusparse.pyx b/cupy_backends/cuda/libs/cusparse.pyx index 332a54fc0bd..7837a9acb96 100644 --- a/cupy_backends/cuda/libs/cusparse.pyx +++ b/cupy_backends/cuda/libs/cusparse.pyx @@ -16,20 +16,20 @@ ELSE: cdef extern from '../../cupy_complex.h': ctypedef struct cuComplex 'cuComplex': float x, y - + ctypedef struct cuDoubleComplex 'cuDoubleComplex': double x, y - + cdef extern from '../../cupy_sparse.h' nogil: ctypedef void* Stream 'cudaStream_t' - + # Version cusparseStatus_t cusparseGetVersion(cusparseHandle_t handle, int* version) - + # Error handling const char* cusparseGetErrorName(Status status) const char* cusparseGetErrorString(Status status) - + # cuSPARSE Helper Function Status cusparseCreate(Handle *handle) Status cusparseCreateMatDescr(MatDescr descr) @@ -40,50 +40,50 @@ ELSE: Status cusparseSetMatFillMode(MatDescr descrA, FillMode fillMode) Status cusparseSetMatDiagType(MatDescr descrA, DiagType diagType) Status cusparseSetPointerMode(Handle handle, PointerMode mode) - + # Stream Status cusparseSetStream(Handle handle, Stream streamId) Status cusparseGetStream(Handle handle, Stream* streamId) - + # cuSPARSE Level1 Function Status cusparseSgthr( Handle handle, int nnz, const float *y, float *xVal, const int *xInd, IndexBase idxBase) - + Status cusparseDgthr( Handle handle, int nnz, const double *y, double *xVal, const int *xInd, IndexBase idxBase) - + Status cusparseCgthr( Handle handle, int nnz, const cuComplex *y, cuComplex *xVal, const int *xInd, IndexBase idxBase) - + Status cusparseZgthr( Handle handle, int nnz, const cuDoubleComplex *y, cuDoubleComplex *xVal, const int *xInd, IndexBase idxBase) - + # cuSPARSE Level2 Function Status cusparseScsrmv( Handle handle, Operation transA, int m, int n, int nnz, const float *alpha, MatDescr descrA, const float *csrSortedValA, const int *csrSortedRowPtrA, const int *csrSortedColIndA, const float *x, const float *beta, float *y) - + Status cusparseDcsrmv( Handle handle, Operation transA, int m, int n, int nnz, const double *alpha, MatDescr descrA, const double *csrSortedValA, const int *csrSortedRowPtrA, const int *csrSortedColIndA, const double *x, const double *beta, double *y) - + Status cusparseCcsrmv( Handle handle, Operation transA, int m, int n, int nnz, const cuComplex *alpha, MatDescr descrA, const cuComplex *csrSortedValA, const int *csrSortedRowPtrA, const int *csrSortedColIndA, const cuComplex *x, const cuComplex *beta, cuComplex *y) - + Status cusparseZcsrmv( Handle handle, Operation transA, int m, int n, int nnz, const cuDoubleComplex *alpha, MatDescr descrA, @@ -91,7 +91,7 @@ ELSE: const int *csrSortedRowPtrA, const int *csrSortedColIndA, const cuDoubleComplex *x, const cuDoubleComplex *beta, cuDoubleComplex *y) - + Status cusparseCsrmvEx_bufferSize( Handle handle, AlgMode alg, Operation transA, int m, int n, int nnz, const void *alpha, DataType alphatype, @@ -100,7 +100,7 @@ ELSE: const void *x, DataType xtype, const void *beta, DataType betatype, void *y, DataType ytype, DataType executiontype, size_t *bufferSizeInBytes) - + Status cusparseCsrmvEx( Handle handle, AlgMode alg, Operation transA, int m, int n, int nnz, const void *alpha, DataType alphatype, @@ -109,10 +109,10 @@ ELSE: const void *x, DataType xtype, const void *beta, DataType betatype, void *y, DataType ytype, DataType executiontype, void* buffer) - + Status cusparseCreateCsrsv2Info(csrsv2Info_t* info) Status cusparseDestroyCsrsv2Info(csrsv2Info_t info) - + Status cusparseScsrsv2_bufferSize( Handle handle, Operation transA, int m, int nnz, const MatDescr descrA, float* csrSortedValA, const int* csrSortedRowPtrA, @@ -133,7 +133,7 @@ ELSE: cuDoubleComplex* csrSortedValA, const int* csrSortedRowPtrA, const int* csrSortedColIndA, csrsv2Info_t info, int* pBufferSizeInBytes) - + Status cusparseScsrsv2_analysis( Handle handle, Operation transA, int m, int nnz, const MatDescr descrA, const float* csrSortedValA, const int* csrSortedRowPtrA, @@ -154,7 +154,7 @@ ELSE: const cuDoubleComplex* csrSortedValA, const int* csrSortedRowPtrA, const int* csrSortedColIndA, csrsv2Info_t info, cusparseSolvePolicy_t policy, void* pBuffer) - + Status cusparseScsrsv2_solve( Handle handle, Operation transA, int m, int nnz, const float* alpha, const MatDescr descrA, @@ -183,24 +183,24 @@ ELSE: const int* csrSortedColIndA, csrsv2Info_t info, const cuDoubleComplex* x, cuDoubleComplex* y, cusparseSolvePolicy_t policy, void* pBuffer) - + Status cusparseXcsrsv2_zeroPivot( Handle handle, csrsv2Info_t info, int* position) - + # cuSPARSE Level3 Function Status cusparseScsrmm( Handle handle, Operation transA, int m, int n, int k, int nnz, const float *alpha, const MatDescr descrA, const float *csrSortedValA, const int *csrSortedRowPtrA, const int *csrSortedColIndA, const float *B, int ldb, const float *beta, float *C, int ldc) - + Status cusparseDcsrmm( Handle handle, Operation transA, int m, int n, int k, int nnz, const double *alpha, const MatDescr descrA, const double *csrSortedValA, const int *csrSortedRowPtrA, const int *csrSortedColIndA, const double *B, int ldb, const double *beta, double *C, int ldc) - + Status cusparseCcsrmm( Handle handle, Operation transA, int m, int n, int k, int nnz, const cuComplex *alpha, const MatDescr descrA, @@ -208,7 +208,7 @@ ELSE: const int *csrSortedRowPtrA, const int *csrSortedColIndA, const cuComplex *B, int ldb, const cuComplex *beta, cuComplex *C, int ldc) - + Status cusparseZcsrmm( Handle handle, Operation transA, int m, int n, int k, int nnz, const cuDoubleComplex *alpha, const MatDescr descrA, @@ -216,26 +216,26 @@ ELSE: const int *csrSortedRowPtrA, const int *csrSortedColIndA, const cuDoubleComplex *B, int ldb, const cuDoubleComplex *beta, cuDoubleComplex *C, int ldc) - + Status cusparseScsrmm2( Handle handle, Operation transA, Operation transB, int m, int n, int k, int nnz, const float *alpha, const MatDescr descrA, const float *csrValA, const int *csrRowPtrA, const int *csrColIndA, const float *B, int ldb, const float *beta, float *C, int ldc) - + Status cusparseDcsrmm2( Handle handle, Operation transA, Operation transB, int m, int n, int k, int nnz, const double *alpha, const MatDescr descrA, const double *csrValA, const int *csrRowPtrA, const int *csrColIndA, const double *B, int ldb, const double *beta, double *C, int ldc) - + Status cusparseCcsrmm2( Handle handle, Operation transA, Operation transB, int m, int n, int k, int nnz, const cuComplex *alpha, const MatDescr descrA, const cuComplex *csrValA, const int *csrRowPtrA, const int *csrColIndA, const cuComplex *B, int ldb, const cuComplex *beta, cuComplex *C, int ldc) - + Status cusparseZcsrmm2( Handle handle, Operation transA, Operation transB, int m, int n, int k, int nnz, const cuDoubleComplex *alpha, const MatDescr descrA, @@ -243,10 +243,10 @@ ELSE: const int *csrRowPtrA, const int *csrColIndA, const cuDoubleComplex *B, int ldb, const cuDoubleComplex *beta, cuDoubleComplex *C, int ldc) - + Status cusparseCreateCsrsm2Info(csrsm2Info_t* info) Status cusparseDestroyCsrsm2Info(csrsm2Info_t info) - + Status cusparseScsrsm2_bufferSizeExt( Handle handle, int algo, Operation transA, Operation transB, int m, int nrhs, int nnz, const float* alpha, const MatDescr descrA, @@ -275,7 +275,7 @@ ELSE: const int* csrSortedColIndA, const cuDoubleComplex* B, int ldb, csrsm2Info_t info, cusparseSolvePolicy_t policy, size_t* pBufferSize) - + Status cusparseScsrsm2_analysis( Handle handle, int algo, Operation transA, Operation transB, int m, int nrhs, int nnz, const float* alpha, const MatDescr descrA, @@ -304,7 +304,7 @@ ELSE: const int* csrSortedColIndA, const cuDoubleComplex* B, int ldb, csrsm2Info_t info, cusparseSolvePolicy_t policy, void* pBuffer) - + Status cusparseScsrsm2_solve( Handle handle, int algo, Operation transA, Operation transB, int m, int nrhs, int nnz, const float* alpha, const MatDescr descrA, @@ -333,17 +333,17 @@ ELSE: const int* csrSortedColIndA, cuDoubleComplex* B, int ldb, csrsm2Info_t info, cusparseSolvePolicy_t policy, void* pBuffer) - + Status cusparseXcsrsm2_zeroPivot( Handle handle, csrsm2Info_t info, int* position) - + # cuSPARSE Extra Function Status cusparseXcsrgeamNnz( Handle handle, int m, int n, const MatDescr descrA, int nnzA, const int *csrRowPtrA, const int *csrColIndA, const MatDescr descrB, int nnzB, const int *csrRowPtrB, const int *csrColIndB, const MatDescr descrC, int *csrRowPtrC, int *nnzTotalDevHostPtr) - + Status cusparseScsrgeam( Handle handle, int m, int n, const float *alpha, const MatDescr descrA, int nnzA, const float *csrValA, const int *csrRowPtrA, @@ -351,7 +351,7 @@ ELSE: int nnzB, const float *csrValB, const int *csrRowPtrB, const int *csrColIndB, const MatDescr descrC, float *csrValC, int *csrRowPtrC, int *csrColIndC) - + Status cusparseDcsrgeam( Handle handle, int m, int n, const double *alpha, const MatDescr descrA, @@ -360,7 +360,7 @@ ELSE: int nnzB, const double *csrValB, const int *csrRowPtrB, const int *csrColIndB, const MatDescr descrC, double *csrValC, int *csrRowPtrC, int *csrColIndC) - + Status cusparseCcsrgeam( Handle handle, int m, int n, const cuComplex *alpha, const MatDescr descrA, @@ -369,7 +369,7 @@ ELSE: int nnzB, const cuComplex *csrValB, const int *csrRowPtrB, const int *csrColIndB, const MatDescr descrC, cuComplex *csrValC, int *csrRowPtrC, int *csrColIndC) - + Status cusparseZcsrgeam( Handle handle, int m, int n, const cuDoubleComplex *alpha, const MatDescr descrA, @@ -379,7 +379,7 @@ ELSE: int nnzB, const cuDoubleComplex *csrValB, const int *csrRowPtrB, const int *csrColIndB, const MatDescr descrC, cuDoubleComplex *csrValC, int *csrRowPtrC, int *csrColIndC) - + Status cusparseScsrgeam2_bufferSizeExt( Handle handle, int m, int n, const float *alpha, const MatDescr descrA, int nnzA, const float *csrValA, const int *csrRowPtrA, @@ -387,7 +387,7 @@ ELSE: int nnzB, const float *csrValB, const int *csrRowPtrB, const int *csrColIndB, const MatDescr descrC, float *csrValC, int *csrRowPtrC, int *csrColIndC, size_t *pBufferSize) - + Status cusparseDcsrgeam2_bufferSizeExt( Handle handle, int m, int n, const double *alpha, const MatDescr descrA, @@ -396,7 +396,7 @@ ELSE: int nnzB, const double *csrValB, const int *csrRowPtrB, const int *csrColIndB, const MatDescr descrC, double *csrValC, int *csrRowPtrC, int *csrColIndC, size_t *pBufferSize) - + Status cusparseCcsrgeam2_bufferSizeExt( Handle handle, int m, int n, const cuComplex *alpha, const MatDescr descrA, @@ -405,7 +405,7 @@ ELSE: int nnzB, const cuComplex *csrValB, const int *csrRowPtrB, const int *csrColIndB, const MatDescr descrC, cuComplex *csrValC, int *csrRowPtrC, int *csrColIndC, size_t *pBufferSize) - + Status cusparseZcsrgeam2_bufferSizeExt( Handle handle, int m, int n, const cuDoubleComplex *alpha, const MatDescr descrA, @@ -416,14 +416,14 @@ ELSE: const int *csrColIndB, const MatDescr descrC, cuDoubleComplex *csrValC, int *csrRowPtrC, int *csrColIndC, size_t *pBufferSize) - + Status cusparseXcsrgeam2Nnz( Handle handle, int m, int n, const MatDescr descrA, int nnzA, const int *csrRowPtrA, const int *csrColIndA, const MatDescr descrB, int nnzB, const int *csrRowPtrB, const int *csrColIndB, const MatDescr descrC, int *csrRowPtrC, int *nnzTotalDevHostPtr, void *workspace) - + Status cusparseScsrgeam2( Handle handle, int m, int n, const float *alpha, const MatDescr descrA, int nnzA, const float *csrValA, const int *csrRowPtrA, @@ -431,7 +431,7 @@ ELSE: int nnzB, const float *csrValB, const int *csrRowPtrB, const int *csrColIndB, const MatDescr descrC, float *csrValC, int *csrRowPtrC, int *csrColIndC, void *pBuffer) - + Status cusparseDcsrgeam2( Handle handle, int m, int n, const double *alpha, const MatDescr descrA, @@ -440,7 +440,7 @@ ELSE: int nnzB, const double *csrValB, const int *csrRowPtrB, const int *csrColIndB, const MatDescr descrC, double *csrValC, int *csrRowPtrC, int *csrColIndC, void *pBuffer) - + Status cusparseCcsrgeam2( Handle handle, int m, int n, const cuComplex *alpha, const MatDescr descrA, @@ -449,7 +449,7 @@ ELSE: int nnzB, const cuComplex *csrValB, const int *csrRowPtrB, const int *csrColIndB, const MatDescr descrC, cuComplex *csrValC, int *csrRowPtrC, int *csrColIndC, void *pBuffer) - + Status cusparseZcsrgeam2( Handle handle, int m, int n, const cuDoubleComplex *alpha, const MatDescr descrA, @@ -460,14 +460,14 @@ ELSE: const int *csrColIndB, const MatDescr descrC, cuDoubleComplex *csrValC, int *csrRowPtrC, int *csrColIndC, void *pBuffer) - + Status cusparseXcsrgemmNnz( Handle handle, Operation transA, Operation transB, int m, int n, int k, const MatDescr descrA, const int nnzA, const int *csrRowPtrA, const int *csrColIndA, const MatDescr descrB, const int nnzB, const int *csrRowPtrB, const int *csrColIndB, const MatDescr descrC, int *csrRowPtrC, int *nnzTotalDevHostPtr) - + Status cusparseScsrgemm( Handle handle, Operation transA, Operation transB, int m, int n, int k, const MatDescr descrA, const int nnzA, const float *csrValA, @@ -475,7 +475,7 @@ ELSE: const int nnzB, const float *csrValB, const int *csrRowPtrB, const int *csrColIndB, const MatDescr descrC, float *csrValC, const int *csrRowPtrC, int *csrColIndC) - + Status cusparseDcsrgemm( Handle handle, Operation transA, Operation transB, int m, int n, int k, const MatDescr descrA, const int nnzA, const double *csrValA, @@ -483,7 +483,7 @@ ELSE: const int nnzB, const double *csrValB, const int *csrRowPtrB, const int *csrColIndB, const MatDescr descrC, double *csrValC, const int *csrRowPtrC, int *csrColIndC) - + Status cusparseCcsrgemm( Handle handle, Operation transA, Operation transB, int m, int n, int k, const MatDescr descrA, const int nnzA, const cuComplex *csrValA, @@ -491,7 +491,7 @@ ELSE: const int nnzB, const cuComplex *csrValB, const int *csrRowPtrB, const int *csrColIndB, const MatDescr descrC, cuComplex *csrValC, const int *csrRowPtrC, int *csrColIndC) - + Status cusparseZcsrgemm( Handle handle, Operation transA, Operation transB, int m, int n, int k, const MatDescr descrA, const int nnzA, const cuDoubleComplex *csrValA, @@ -499,10 +499,10 @@ ELSE: const int nnzB, const cuDoubleComplex *csrValB, const int *csrRowPtrB, const int *csrColIndB, const MatDescr descrC, cuDoubleComplex *csrValC, const int *csrRowPtrC, int *csrColIndC) - + cusparseStatus_t cusparseCreateCsrgemm2Info(csrgemm2Info_t *info) cusparseStatus_t cusparseDestroyCsrgemm2Info(csrgemm2Info_t info) - + Status cusparseScsrgemm2_bufferSizeExt( Handle handle, int m, int n, int k, const float *alpha, const MatDescr descrA, int nnzA, const int *csrRowPtrA, @@ -510,7 +510,7 @@ ELSE: const int *csrRowPtrB, const int *csrColIndB, const float *beta, const MatDescr descrD, int nnzD, const int *csrRowPtrD, const int *csrColIndD, const csrgemm2Info_t info, size_t* pBufferSize) - + Status cusparseDcsrgemm2_bufferSizeExt( Handle handle, int m, int n, int k, const double *alpha, const MatDescr descrA, int nnzA, const int *csrRowPtrA, @@ -518,7 +518,7 @@ ELSE: const int *csrRowPtrB, const int *csrColIndB, const double *beta, const MatDescr descrD, int nnzD, const int *csrRowPtrD, const int *csrColIndD, const csrgemm2Info_t info, size_t* pBufferSize) - + Status cusparseCcsrgemm2_bufferSizeExt( Handle handle, int m, int n, int k, const cuComplex *alpha, const MatDescr descrA, int nnzA, const int *csrRowPtrA, @@ -526,7 +526,7 @@ ELSE: const int *csrRowPtrB, const int *csrColIndB, const cuComplex *beta, const MatDescr descrD, int nnzD, const int *csrRowPtrD, const int *csrColIndD, const csrgemm2Info_t info, size_t* pBufferSize) - + Status cusparseZcsrgemm2_bufferSizeExt( Handle handle, int m, int n, int k, const cuDoubleComplex *alpha, const MatDescr descrA, int nnzA, const int *csrRowPtrA, @@ -535,7 +535,7 @@ ELSE: const cuDoubleComplex *beta, const MatDescr descrD, int nnzD, const int *csrRowPtrD, const int *csrColIndD, const csrgemm2Info_t info, size_t* pBufferSize) - + Status cusparseXcsrgemm2Nnz( Handle handle, int m, int n, int k, const MatDescr descrA, int nnzA, const int *csrRowPtrA, const int *csrColIndA, const MatDescr descrB, @@ -543,7 +543,7 @@ ELSE: const MatDescr descrD, int nnzD, const int *csrRowPtrD, const int *csrColIndD, const MatDescr descrC, int *csrRowPtrC, int *nnzTotalDevHostPtr, const csrgemm2Info_t info, void* pBuffer) - + Status cusparseScsrgemm2( Handle handle, int m, int n, int k, const float *alpha, const MatDescr descrA, int nnzA, const float *csrValA, @@ -554,7 +554,7 @@ ELSE: const int *csrColIndD, const MatDescr descrC, float *csrValC, const int *csrRowPtrC, int *csrColIndC, const csrgemm2Info_t info, void* pBuffer) - + Status cusparseDcsrgemm2( Handle handle, int m, int n, int k, const double *alpha, const MatDescr descrA, int nnzA, const double *csrValA, @@ -565,7 +565,7 @@ ELSE: const int *csrColIndD, const MatDescr descrC, double *csrValC, const int *csrRowPtrC, int *csrColIndC, const csrgemm2Info_t info, void* pBuffer) - + Status cusparseCcsrgemm2( Handle handle, int m, int n, int k, const cuComplex *alpha, const MatDescr descrA, int nnzA, const cuComplex *csrValA, @@ -576,7 +576,7 @@ ELSE: const int *csrColIndD, const MatDescr descrC, cuComplex *csrValC, const int *csrRowPtrC, int *csrColIndC, const csrgemm2Info_t info, void* pBuffer) - + Status cusparseZcsrgemm2( Handle handle, int m, int n, int k, const cuDoubleComplex *alpha, const MatDescr descrA, int nnzA, const cuDoubleComplex *csrValA, @@ -587,212 +587,212 @@ ELSE: const int *csrRowPtrD, const int *csrColIndD, const MatDescr descrC, cuDoubleComplex *csrValC, const int *csrRowPtrC, int *csrColIndC, const csrgemm2Info_t info, void* pBuffer) - + # cuSPARSE Format Convrsion Status cusparseXcoo2csr( Handle handle, const int *cooRowInd, int nnz, int m, int *csrRowPtr, IndexBase idxBase) - + Status cusparseScsc2dense( Handle handle, int m, int n, const MatDescr descrA, const float *cscSortedValA, const int *cscSortedRowIndA, const int *cscSortedColPtrA, float *A, int lda) - + Status cusparseDcsc2dense( Handle handle, int m, int n, const MatDescr descrA, const double *cscSortedValA, const int *cscSortedRowIndA, const int *cscSortedColPtrA, double *A, int lda) - + Status cusparseCcsc2dense( Handle handle, int m, int n, const MatDescr descrA, const cuComplex *cscSortedValA, const int *cscSortedRowIndA, const int *cscSortedColPtrA, cuComplex *A, int lda) - + Status cusparseZcsc2dense( Handle handle, int m, int n, const MatDescr descrA, const cuDoubleComplex *cscSortedValA, const int *cscSortedRowIndA, const int *cscSortedColPtrA, cuDoubleComplex *A, int lda) - + Status cusparseXcsr2coo( Handle handle, const int *csrRowPtr, int nnz, int m, int *cooRowInd, IndexBase idxBase) - + Status cusparseScsr2csc( Handle handle, int m, int n, int nnz, const float *csrVal, const int *csrRowPtr, const int *csrColInd, float *cscVal, int *cscRowInd, int *cscColPtr, Action copyValues, IndexBase idxBase) - + Status cusparseDcsr2csc( Handle handle, int m, int n, int nnz, const double *csrVal, const int *csrRowPtr, const int *csrColInd, double *cscVal, int *cscRowInd, int *cscColPtr, Action copyValues, IndexBase idxBase) - + Status cusparseCcsr2csc( Handle handle, int m, int n, int nnz, const cuComplex *csrVal, const int *csrRowPtr, const int *csrColInd, cuComplex *cscVal, int *cscRowInd, int *cscColPtr, Action copyValues, IndexBase idxBase) - + Status cusparseZcsr2csc( Handle handle, int m, int n, int nnz, const cuDoubleComplex *csrVal, const int *csrRowPtr, const int *csrColInd, cuDoubleComplex *cscVal, int *cscRowInd, int *cscColPtr, Action copyValues, IndexBase idxBase) - + Status cusparseScsr2dense( Handle handle, int m, int n, const MatDescr descrA, const float *csrSortedValA, const int *csrSortedRowPtrA, const int *csrSortedColIndA, float *A, int lda) - + Status cusparseDcsr2dense( Handle handle, int m, int n, const MatDescr descrA, const double *csrSortedValA, const int *csrSortedRowPtrA, const int *csrSortedColIndA, double *A, int lda) - + Status cusparseCcsr2dense( Handle handle, int m, int n, const MatDescr descrA, const cuComplex *csrSortedValA, const int *csrSortedRowPtrA, const int *csrSortedColIndA, cuComplex *A, int lda) - + Status cusparseZcsr2dense( Handle handle, int m, int n, const MatDescr descrA, const cuDoubleComplex *csrSortedValA, const int *csrSortedRowPtrA, const int *csrSortedColIndA, cuDoubleComplex *A, int lda) - + Status cusparseSnnz_compress( Handle handle, int m, const MatDescr descr, const float *values, const int *rowPtr, int *nnzPerRow, int *nnzTotal, float tol) - + Status cusparseDnnz_compress( Handle handle, int m, const MatDescr descr, const double *values, const int *rowPtr, int *nnzPerRow, int *nnzTotal, double tol) - + Status cusparseCnnz_compress( Handle handle, int m, const MatDescr descr, const cuComplex *values, const int *rowPtr, int *nnzPerRow, int *nnzTotal, cuComplex tol) - + Status cusparseZnnz_compress( Handle handle, int m, const MatDescr descr, const cuDoubleComplex *values, const int *rowPtr, int *nnzPerRow, int *nnzTotal, cuDoubleComplex tol) - + Status cusparseScsr2csr_compress( Handle handle, int m, int n, const MatDescr descrA, const float *inVal, const int *inColInd, const int *inRowPtr, int inNnz, int *nnzPerRow, float *outVal, int *outColInd, int *outRowPtr, float tol) - + Status cusparseDcsr2csr_compress( Handle handle, int m, int n, const MatDescr descrA, const double *inVal, const int *inColInd, const int *inRowPtr, int inNnz, int *nnzPerRow, double *outVal, int *outColInd, int *outRowPtr, double tol) - + Status cusparseCcsr2csr_compress( Handle handle, int m, int n, const MatDescr descrA, const cuComplex *inVal, const int *inColInd, const int *inRowPtr, int inNnz, int *nnzPerRow, cuComplex *outVal, int *outColInd, int *outRowPtr, cuComplex tol) - + Status cusparseZcsr2csr_compress( Handle handle, int m, int n, const MatDescr descrA, const cuDoubleComplex *inVal, const int *inColInd, const int *inRowPtr, int inNnz, int *nnzPerRow, cuDoubleComplex *outVal, int *outColInd, int *outRowPtr, cuDoubleComplex tol) - + Status cusparseSdense2csc( Handle handle, int m, int n, const MatDescr descrA, const float *A, int lda, const int *nnzPerCol, float *cscValA, int *cscRowIndA, int *cscColPtrA) - + Status cusparseDdense2csc( Handle handle, int m, int n, const MatDescr descrA, const double *A, int lda, const int *nnzPerCol, double *cscValA, int *cscRowIndA, int *cscColPtrA) - + Status cusparseCdense2csc( Handle handle, int m, int n, const MatDescr descrA, const cuComplex *A, int lda, const int *nnzPerCol, cuComplex *cscValA, int *cscRowIndA, int *cscColPtrA) - + Status cusparseZdense2csc( Handle handle, int m, int n, const MatDescr descrA, const cuDoubleComplex *A, int lda, const int *nnzPerCol, cuDoubleComplex *cscValA, int *cscRowIndA, int *cscColPtrA) - + Status cusparseSdense2csr( Handle handle, int m, int n, const MatDescr descrA, const float *A, int lda, const int *nnzPerRow, float *csrValA, int *csrRowPtrA, int *csrColIndA) - + Status cusparseDdense2csr( Handle handle, int m, int n, const MatDescr descrA, const double *A, int lda, const int *nnzPerRow, double *csrValA, int *csrRowPtrA, int *csrColIndA) - + Status cusparseCdense2csr( Handle handle, int m, int n, const MatDescr descrA, const cuComplex *A, int lda, const int *nnzPerRow, cuComplex *csrValA, int *csrRowPtrA, int *csrColIndA) - + Status cusparseZdense2csr( Handle handle, int m, int n, const MatDescr descrA, const cuDoubleComplex *A, int lda, const int *nnzPerRow, cuDoubleComplex *csrValA, int *csrRowPtrA, int *csrColIndA) - + Status cusparseSnnz( Handle handle, Direction dirA, int m, int n, const MatDescr descrA, const float *A, int lda, int *nnzPerRowColumn, int *nnzTotalDevHostPtr) - + Status cusparseDnnz( Handle handle, Direction dirA, int m, int n, const MatDescr descrA, const double *A, int lda, int *nnzPerRowColumn, int *nnzTotalDevHostPtr) - + Status cusparseCnnz( Handle handle, Direction dirA, int m, int n, const MatDescr descrA, const cuComplex *A, int lda, int *nnzPerRowColumn, int *nnzTotalDevHostPtr) - + Status cusparseZnnz( Handle handle, Direction dirA, int m, int n, const MatDescr descrA, const cuDoubleComplex *A, int lda, int *nnzPerRowColumn, int *nnzTotalDevHostPtr) - + Status cusparseCreateIdentityPermutation( Handle handle, int n, int *p) - + Status cusparseXcoosort_bufferSizeExt( Handle handle, int m, int n, int nnz, const int *cooRows, const int *cooCols, size_t *pBufferSizeInBytes) - + Status cusparseXcoosortByRow( Handle handle, int m, int n, int nnz, int *cooRows, int *cooCols, int *P, void *pBuffer) - + Status cusparseXcoosortByColumn( Handle handle, int m, int n, int nnz, int *cooRows, int *cooCols, int *P, void *pBuffer) - + Status cusparseXcsrsort_bufferSizeExt( Handle handle, int m, int n, int nnz, const int *csrRowPtr, const int *csrColInd, size_t *pBufferSizeInBytes) - + Status cusparseXcsrsort( Handle handle, int m, int n, int nnz, const MatDescr descrA, const int *csrRowPtr, int *csrColInd, int *P, void *pBuffer) - + Status cusparseXcscsort_bufferSizeExt( Handle handle, int m, int n, int nnz, const int *cscColPtr, const int *cscRowInd, size_t *pBufferSizeInBytes) - + Status cusparseXcscsort( Handle handle, int m, int n, int nnz, const MatDescr descrA, const int *cscColPtr, int *cscRowInd, int *P, void *pBuffer) - + # cuSparse PRECONDITIONERS cusparseStatus_t cusparseCreateCsrilu02Info(csrilu02Info_t *info) cusparseStatus_t cusparseDestroyCsrilu02Info(csrilu02Info_t info) @@ -1228,7 +1228,7 @@ ELSE: cusparseHandle_t handle, int algo, int m, cuDoubleComplex *ds, cuDoubleComplex *dl, cuDoubleComplex *d, cuDoubleComplex *du, cuDoubleComplex *dw, cuDoubleComplex *x, int batchCount, void *pBuffer) - + # Sparse Vector APIs Status cusparseCreateSpVec(SpVecDescr* spVecDescr, int64_t size, int64_t nnz, void* indices, void* values, @@ -1241,7 +1241,7 @@ ELSE: Status cusparseSpVecGetIndexBase(SpVecDescr spVecDescr, IndexBase* idxBae) Status cusparseSpVecGetValues(SpVecDescr spVecDescr, void** values) Status cusparseSpVecSetValues(SpVecDescr spVecDescr, void* values) - + # Sparse Matrix APIs Status cusparseCreateCoo(SpMatDescr* spMatDescr, int64_t rows, int64_t cols, int64_t nnz, void* cooRowInd, @@ -1282,7 +1282,7 @@ ELSE: int64_t* cols, int64_t* nnz) Status cusparseSpMatGetStridedBatch(SpMatDescr spMatDescr, int* batchCount) Status cusparseSpMatSetStridedBatch(SpMatDescr spMatDescr, int batchCount) - + # Dense Vector APIs Status cusparseCreateDnVec(DnVecDescr *dnVecDescr, int64_t size, void* values, DataType valueType) @@ -1291,7 +1291,7 @@ ELSE: void** values, DataType* valueType) Status cusparseDnVecGetValues(DnVecDescr dnVecDescr, void** values) Status cusparseDnVecSetValues(DnVecDescr dnVecDescr, void* values) - + # Dense Matrix APIs Status cusparseCreateDnMat(DnMatDescr* dnMatDescr, int64_t rows, int64_t cols, int64_t ld, void* values, @@ -1306,7 +1306,7 @@ ELSE: int64_t *batchStride) Status cusparseDnMatSetStridedBatch(DnMatDescr dnMatDescr, int batchCount, int64_t batchStride) - + # Generic API Functions Status cusparseSpVV_bufferSize(Handle handle, Operation opX, SpVecDescr vecX, DnVecDescr vecY, @@ -1341,7 +1341,7 @@ ELSE: Handle handle, Operation opA, Operation opB, void* alpha, DnMatDescr matA, DnMatDescr matB, void* beta, SpMatDescr matC, DataType computeType, void* externalBuffer) - + Status cusparseSpGEMM_createDescr(SpGEMMDescr* spgemmDescr) Status cusparseSpGEMM_destroyDescr(SpGEMMDescr spgemmDescr) Status cusparseSpGEMM_workEstimation( @@ -1359,23 +1359,23 @@ ELSE: SpMatDescr matA, SpMatDescr matB, const void* beta, SpMatDescr matC, DataType computeType, SpGEMMAlg alg, SpGEMMDescr spgemmDescr) Status cusparseGather(Handle handle, DnVecDescr vecY, SpVecDescr vecX) - + # CSR2CSC Status cusparseCsr2cscEx2_bufferSize( Handle handle, int m, int n, int nnz, const void* csrVal, const int* csrRowPtr, const int* csrColInd, void* cscVal, int* cscColPtr, int* cscRowInd, DataType valType, Action copyValues, IndexBase idxBase, Csr2CscAlg alg, size_t* bufferSize) - + Status cusparseCsr2cscEx2( Handle handle, int m, int n, int nnz, const void* csrVal, const int* csrRowPtr, const int* csrColInd, void* cscVal, int* cscColPtr, int* cscRowInd, DataType valType, Action copyValues, IndexBase idxBase, Csr2CscAlg alg, void* buffer) - + # Build-time version int CUSPARSE_VERSION - + ctypedef Status (*f_type)(...) nogil # NOQA IF 11010 <= CUPY_CUDA_VERSION < 12000: if _sys.platform == 'linux': @@ -1391,7 +1391,7 @@ ELSE: _libname = 'libhipsparse.so' ELSE: _libname = None - + cdef SoftLink _lib = SoftLink(_libname, 'cusparse') # cuSPARSE 11.6+ (CUDA 11.3.1+) cdef f_type cusparseSpSM_createDescr = _lib.get('SpSM_createDescr') @@ -1410,7 +1410,7 @@ ELSE: cdef f_type cusparseDenseToSparse_bufferSize = _lib.get('DenseToSparse_bufferSize') # NOQA cdef f_type cusparseDenseToSparse_analysis = _lib.get('DenseToSparse_analysis') # NOQA cdef f_type cusparseDenseToSparse_convert = _lib.get('DenseToSparse_convert') # NOQA - + cdef dict HIP_STATUS = { 0: b'HIPSPARSE_STATUS_SUCCESS', 1: b'HIPSPARSE_STATUS_NOT_INITIALIZED', @@ -1425,10 +1425,9 @@ ELSE: 10: b'HIPSPARSE_STATUS_NOT_SUPPORTED', 11: b'HIPSPARSE_STATUS_INSUFFICIENT_RESOURCES', } - - + cdef class SpVecAttributes: - + def __init__(self, int64_t size, int64_t nnz, intptr_t idx, intptr_t values, IndexType idxType, IndexBase idxBase, DataType valueType): @@ -1439,10 +1438,9 @@ ELSE: self.idxType = idxType self.idxBase = idxBase self.valueType = valueType - - + cdef class CooAttributes: - + def __init__(self, int64_t rows, int64_t cols, int64_t nnz, intptr_t rowIdx, intptr_t colIdx, intptr_t values, IndexType idxType, IndexBase idxBase, DataType valueType): @@ -1455,10 +1453,9 @@ ELSE: self.idxType = idxType self.idxBase = idxBase self.valueType = valueType - - + cdef class CooAoSAttributes: - + def __init__(self, int64_t rows, int64_t cols, int64_t nnz, intptr_t ind, intptr_t values, IndexType idxType, IndexBase idxBase, DataType valueType): @@ -1470,10 +1467,9 @@ ELSE: self.idxType = idxType self.idxBase = idxBase self.valueType = valueType - - + cdef class CsrAttributes: - + def __init__(self, int64_t rows, int64_t cols, int64_t nnz, intptr_t rowOffsets, intptr_t colIdx, intptr_t values, IndexType rowOffsetType, IndexType colIdxType, @@ -1488,18 +1484,16 @@ ELSE: self.colIdxType = colIdxType self.idxBase = idxBase self.valueType = valueType - - + cdef class DnVecAttributes: - + def __init__(self, int64_t size, intptr_t values, DataType valueType): self.size = size self.values = values self.valueType = valueType - - + cdef class DnMatAttributes: - + def __init__(self, int64_t rows, int64_t cols, int64_t ld, intptr_t values, DataType valueType, Order order): self.rows = rows @@ -1508,17 +1502,15 @@ ELSE: self.values = values self.valueType = valueType self.order = order - - + cdef class DnMatBatchAttributes: - + def __init__(self, int count, int64_t stride): self.count = count self.stride = stride - - + class CuSparseError(RuntimeError): - + def __init__(self, Status status): self.status = status cdef bytes name @@ -1530,92 +1522,81 @@ ELSE: name = cusparseGetErrorName(status) msg = cusparseGetErrorString(status) super().__init__(f'{name.decode()}: {msg.decode()}') - + def __reduce__(self): return (type(self), (self.status,)) - - + @cython.profile(False) cpdef inline check_status(int status): if status != 0: raise CuSparseError(status) - - + @cython.profile(False) cdef inline cuComplex complex_to_cuda(complex value): cdef cuComplex value_cuda value_cuda.x = value.real value_cuda.y = value.imag return value_cuda - - + @cython.profile(False) cdef inline cuDoubleComplex double_complex_to_cuda(double complex value): cdef cuDoubleComplex value_cuda value_cuda.x = value.real value_cuda.y = value.imag return value_cuda - - + cpdef int getVersion(intptr_t handle) except? -1: cdef int version status = cusparseGetVersion(handle, &version) check_status(status) return version - - + def get_build_version(): return CUSPARSE_VERSION - - + ######################################## # cuSPARSE Helper Function - + cpdef intptr_t create() except? 0: cdef Handle handle status = cusparseCreate(& handle) check_status(status) return handle - - + cpdef size_t createMatDescr() except? -1: cdef MatDescr desc status = cusparseCreateMatDescr(& desc) check_status(status) return desc - - + cpdef void destroy(intptr_t handle) except *: status = cusparseDestroy(handle) check_status(status) - - + cpdef void destroyMatDescr(size_t descr) except *: status = cusparseDestroyMatDescr(descr) check_status(status) - - + cpdef void setMatIndexBase(size_t descr, base) except *: status = cusparseSetMatIndexBase(descr, base) check_status(status) - - + cpdef void setMatType(size_t descr, typ) except *: status = cusparseSetMatType(descr, typ) check_status(status) - + cpdef void setMatFillMode(size_t descrA, int fillMode) except *: status = cusparseSetMatFillMode(descrA, fillMode) check_status(status) - + cpdef void setMatDiagType(size_t descrA, int diagType) except *: status = cusparseSetMatDiagType(descrA, diagType) check_status(status) - + cpdef void setPointerMode(intptr_t handle, int mode) except *: status = cusparseSetPointerMode(handle, mode) check_status(status) - + cpdef void spMatSetAttribute( size_t spMatDescr, int attribute, int data) except *: # Assuming the value of attribute is an enum value, whose underlying type @@ -1625,11 +1606,10 @@ ELSE: spMatDescr, attribute, &data, sizeof(int)) check_status(status) - - + ######################################## # Stream - + cpdef void setStream(intptr_t handle, size_t stream) except *: # TODO(leofang): It seems most of cuSPARSE APIs support stream capture (as # of CUDA 11.5) under certain conditions, see @@ -1640,26 +1620,23 @@ ELSE: raise NotImplementedError( 'calling cuSPARSE API during stream capture is currently ' 'unsupported') - + status = cusparseSetStream(handle, stream) check_status(status) - - + cpdef size_t getStream(intptr_t handle) except? -1: cdef Stream stream status = cusparseGetStream(handle, &stream) check_status(status) return stream - - + cdef void _setStream(intptr_t handle) except *: """Set current stream""" setStream(handle, stream_module.get_current_stream_ptr()) - - + ######################################## # cuSPARSE Level1 Function - + cpdef void sgthr( intptr_t handle, int nnz, size_t y, size_t xVal, size_t xInd, int idxBase) except *: @@ -1668,7 +1645,7 @@ ELSE: handle, nnz, y, xVal, xInd, idxBase) check_status(status) - + cpdef void dgthr( intptr_t handle, int nnz, size_t y, size_t xVal, size_t xInd, int idxBase) except *: @@ -1677,7 +1654,7 @@ ELSE: handle, nnz, y, xVal, xInd, idxBase) check_status(status) - + cpdef void cgthr( intptr_t handle, int nnz, size_t y, size_t xVal, size_t xInd, int idxBase) except *: @@ -1686,7 +1663,7 @@ ELSE: handle, nnz, y, xVal, xInd, idxBase) check_status(status) - + cpdef void zgthr( intptr_t handle, int nnz, size_t y, size_t xVal, size_t xInd, int idxBase) except *: @@ -1695,10 +1672,10 @@ ELSE: handle, nnz, y, xVal, xInd, idxBase) check_status(status) - + ######################################## # cuSPARSE Level2 Function - + cpdef void scsrmv( intptr_t handle, int transA, int m, int n, int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, @@ -1711,7 +1688,7 @@ ELSE: csrSortedRowPtrA, csrSortedColIndA, x, beta, y) check_status(status) - + cpdef void dcsrmv( intptr_t handle, int transA, int m, int n, int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, @@ -1724,7 +1701,7 @@ ELSE: csrSortedRowPtrA, csrSortedColIndA, x, beta, y) check_status(status) - + cpdef void ccsrmv( intptr_t handle, int transA, int m, int n, int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, @@ -1738,7 +1715,7 @@ ELSE: csrSortedRowPtrA, csrSortedColIndA, x, beta, y) check_status(status) - + cpdef void zcsrmv( intptr_t handle, int transA, int m, int n, int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, @@ -1753,7 +1730,7 @@ ELSE: x, beta, y) check_status(status) - + cpdef size_t csrmvEx_bufferSize( intptr_t handle, int alg, int transA, int m, int n, int nnz, size_t alpha, int alphatype, size_t descrA, @@ -1772,7 +1749,7 @@ ELSE: executiontype, &bufferSizeInBytes) check_status(status) return bufferSizeInBytes - + cpdef void csrmvEx( intptr_t handle, int alg, int transA, int m, int n, int nnz, size_t alpha, int alphatype, size_t descrA, @@ -1790,17 +1767,17 @@ ELSE: betatype, y, ytype, executiontype, buffer) check_status(status) - + cpdef size_t createCsrsv2Info() except? -1: cdef csrsv2Info_t info status = cusparseCreateCsrsv2Info(&info) check_status(status) return info - + cpdef void destroyCsrsv2Info(size_t info) except *: status = cusparseDestroyCsrsv2Info(info) check_status(status) - + cpdef int scsrsv2_bufferSize( intptr_t handle, int transA, int m, int nnz, size_t descrA, size_t csrSortedValA, size_t csrSortedRowPtrA, @@ -1813,7 +1790,7 @@ ELSE: csrSortedColIndA, info, &bufferSize) check_status(status) return bufferSize - + cpdef int dcsrsv2_bufferSize( intptr_t handle, int transA, int m, int nnz, size_t descrA, size_t csrSortedValA, size_t csrSortedRowPtrA, @@ -1826,7 +1803,7 @@ ELSE: csrSortedColIndA, info, &bufferSize) check_status(status) return bufferSize - + cpdef int ccsrsv2_bufferSize( intptr_t handle, int transA, int m, int nnz, size_t descrA, size_t csrSortedValA, size_t csrSortedRowPtrA, @@ -1839,7 +1816,7 @@ ELSE: csrSortedColIndA, info, &bufferSize) check_status(status) return bufferSize - + cpdef int zcsrsv2_bufferSize( intptr_t handle, int transA, int m, int nnz, size_t descrA, size_t csrSortedValA, size_t csrSortedRowPtrA, @@ -1852,7 +1829,7 @@ ELSE: csrSortedColIndA, info, &bufferSize) check_status(status) return bufferSize - + cpdef void scsrsv2_analysis( intptr_t handle, int transA, int m, int nnz, size_t descrA, size_t csrSortedValA, size_t csrSortedRowPtrA, @@ -1865,7 +1842,7 @@ ELSE: csrSortedColIndA, info, policy, pBuffer) check_status(status) - + cpdef void dcsrsv2_analysis( intptr_t handle, int transA, int m, int nnz, size_t descrA, size_t csrSortedValA, size_t csrSortedRowPtrA, @@ -1878,7 +1855,7 @@ ELSE: csrSortedColIndA, info, policy, pBuffer) check_status(status) - + cpdef void ccsrsv2_analysis( intptr_t handle, int transA, int m, int nnz, size_t descrA, size_t csrSortedValA, size_t csrSortedRowPtrA, @@ -1891,7 +1868,7 @@ ELSE: csrSortedColIndA, info, policy, pBuffer) check_status(status) - + cpdef void zcsrsv2_analysis( intptr_t handle, int transA, int m, int nnz, size_t descrA, size_t csrSortedValA, size_t csrSortedRowPtrA, @@ -1904,7 +1881,7 @@ ELSE: csrSortedColIndA, info, policy, pBuffer) check_status(status) - + cpdef void scsrsv2_solve( intptr_t handle, int transA, int m, int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, size_t csrSortedRowPtrA, @@ -1919,7 +1896,7 @@ ELSE: x, y, policy, pBuffer) check_status(status) - + cpdef void dcsrsv2_solve( intptr_t handle, int transA, int m, int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, size_t csrSortedRowPtrA, @@ -1934,7 +1911,7 @@ ELSE: x, y, policy, pBuffer) check_status(status) - + cpdef void ccsrsv2_solve( intptr_t handle, int transA, int m, int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, size_t csrSortedRowPtrA, @@ -1949,7 +1926,7 @@ ELSE: x, y, policy, pBuffer) check_status(status) - + cpdef void zcsrsv2_solve( intptr_t handle, int transA, int m, int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, size_t csrSortedRowPtrA, @@ -1964,17 +1941,17 @@ ELSE: x, y, policy, pBuffer) check_status(status) - + cpdef void xcsrsv2_zeroPivot( intptr_t handle, size_t info, size_t position) except *: _setStream(handle) status = cusparseXcsrsv2_zeroPivot( handle, info, position) check_status(status) - + ######################################## # cuSPARSE Level3 Function - + cpdef void scsrmm( intptr_t handle, int transA, int m, int n, int k, int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, @@ -1987,7 +1964,7 @@ ELSE: csrSortedRowPtrA, csrSortedColIndA, B, ldb, beta, C, ldc) check_status(status) - + cpdef void dcsrmm( intptr_t handle, int transA, int m, int n, int k, int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, @@ -2000,7 +1977,7 @@ ELSE: csrSortedRowPtrA, csrSortedColIndA, B, ldb, beta, C, ldc) check_status(status) - + cpdef void ccsrmm( intptr_t handle, int transA, int m, int n, int k, int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, @@ -2015,7 +1992,7 @@ ELSE: B, ldb, beta, C, ldc) check_status(status) - + cpdef void zcsrmm( intptr_t handle, int transA, int m, int n, int k, int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, @@ -2030,7 +2007,7 @@ ELSE: B, ldb, beta, C, ldc) check_status(status) - + cpdef void scsrmm2( intptr_t handle, int transA, int transB, int m, int n, int k, int nnz, size_t alpha, size_t descrA, size_t csrValA, @@ -2043,7 +2020,7 @@ ELSE: csrRowPtrA, csrColIndA, B, ldb, beta, C, ldc) check_status(status) - + cpdef void dcsrmm2( intptr_t handle, int transA, int transB, int m, int n, int k, int nnz, size_t alpha, size_t descrA, size_t csrValA, @@ -2056,7 +2033,7 @@ ELSE: csrRowPtrA, csrColIndA, B, ldb, beta, C, ldc) check_status(status) - + cpdef void ccsrmm2( intptr_t handle, int transA, int transB, int m, int n, int k, int nnz, size_t alpha, size_t descrA, size_t csrValA, @@ -2070,7 +2047,7 @@ ELSE: B, ldb, beta, C, ldc) check_status(status) - + cpdef void zcsrmm2( intptr_t handle, int transA, int transB, int m, int n, int k, int nnz, size_t alpha, size_t descrA, size_t csrValA, @@ -2085,17 +2062,17 @@ ELSE: B, ldb, beta, C, ldc) check_status(status) - + cpdef size_t createCsrsm2Info() except? -1: cdef csrsm2Info_t info status = cusparseCreateCsrsm2Info(&info) check_status(status) return info - + cpdef void destroyCsrsm2Info(size_t info) except *: status = cusparseDestroyCsrsm2Info(info) check_status(status) - + cpdef size_t scsrsm2_bufferSizeExt( intptr_t handle, int algo, int transA, int transB, int m, int nrhs, int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, @@ -2111,7 +2088,7 @@ ELSE: info, policy, &bufferSize) check_status(status) return bufferSize - + cpdef size_t dcsrsm2_bufferSizeExt( intptr_t handle, int algo, int transA, int transB, int m, int nrhs, int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, @@ -2127,7 +2104,7 @@ ELSE: info, policy, &bufferSize) check_status(status) return bufferSize - + cpdef size_t ccsrsm2_bufferSizeExt( intptr_t handle, int algo, int transA, int transB, int m, int nrhs, int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, @@ -2143,7 +2120,7 @@ ELSE: info, policy, &bufferSize) check_status(status) return bufferSize - + cpdef size_t zcsrsm2_bufferSizeExt( intptr_t handle, int algo, int transA, int transB, int m, int nrhs, int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, @@ -2159,7 +2136,7 @@ ELSE: info, policy, &bufferSize) check_status(status) return bufferSize - + cpdef void scsrsm2_analysis( intptr_t handle, int algo, int transA, int transB, int m, int nrhs, int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, @@ -2173,7 +2150,7 @@ ELSE: csrSortedColIndA, B, ldb, info, policy, pBuffer) check_status(status) - + cpdef void dcsrsm2_analysis( intptr_t handle, int algo, int transA, int transB, int m, int nrhs, int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, @@ -2187,7 +2164,7 @@ ELSE: csrSortedColIndA, B, ldb, info, policy, pBuffer) check_status(status) - + cpdef void ccsrsm2_analysis( intptr_t handle, int algo, int transA, int transB, int m, int nrhs, int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, @@ -2201,7 +2178,7 @@ ELSE: csrSortedColIndA, B, ldb, info, policy, pBuffer) check_status(status) - + cpdef void zcsrsm2_analysis( intptr_t handle, int algo, int transA, int transB, int m, int nrhs, int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, @@ -2215,7 +2192,7 @@ ELSE: csrSortedColIndA, B, ldb, info, policy, pBuffer) check_status(status) - + cpdef void scsrsm2_solve( intptr_t handle, int algo, int transA, int transB, int m, int nrhs, int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, @@ -2229,7 +2206,7 @@ ELSE: csrSortedColIndA, B, ldb, info, policy, pBuffer) check_status(status) - + cpdef void dcsrsm2_solve( intptr_t handle, int algo, int transA, int transB, int m, int nrhs, int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, @@ -2243,7 +2220,7 @@ ELSE: csrSortedColIndA, B, ldb, info, policy, pBuffer) check_status(status) - + cpdef void ccsrsm2_solve( intptr_t handle, int algo, int transA, int transB, int m, int nrhs, int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, @@ -2257,7 +2234,7 @@ ELSE: csrSortedColIndA, B, ldb, info, policy, pBuffer) check_status(status) - + cpdef void zcsrsm2_solve( intptr_t handle, int algo, int transA, int transB, int m, int nrhs, int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, @@ -2271,17 +2248,17 @@ ELSE: csrSortedColIndA, B, ldb, info, policy, pBuffer) check_status(status) - + cpdef void xcsrsm2_zeroPivot( intptr_t handle, size_t info, size_t position) except *: _setStream(handle) status = cusparseXcsrsm2_zeroPivot( handle, info, position) check_status(status) - + ######################################## # cuSPARSE Extra Function - + cpdef void xcsrgeamNnz( intptr_t handle, int m, int n, size_t descrA, int nnzA, size_t csrRowPtrA, size_t csrColIndA, size_t descrB, @@ -2295,7 +2272,7 @@ ELSE: csrColIndB, descrC, csrRowPtrC, nnzTotalDevHostPtr) check_status(status) - + cpdef void scsrgeam( intptr_t handle, int m, int n, size_t alpha, size_t descrA, int nnzA, size_t csrValA, size_t csrRowPtrA, @@ -2313,7 +2290,7 @@ ELSE: descrC, csrValC, csrRowPtrC, csrColIndC) check_status(status) - + cpdef void dcsrgeam( intptr_t handle, int m, int n, size_t alpha, size_t descrA, int nnzA, size_t csrValA, size_t csrRowPtrA, @@ -2331,7 +2308,7 @@ ELSE: descrC, csrValC, csrRowPtrC, csrColIndC) check_status(status) - + cpdef void ccsrgeam( intptr_t handle, int m, int n, size_t alpha, size_t descrA, int nnzA, size_t csrValA, size_t csrRowPtrA, @@ -2350,7 +2327,7 @@ ELSE: descrC, csrValC, csrRowPtrC, csrColIndC) check_status(status) - + cpdef void zcsrgeam( intptr_t handle, int m, int n, size_t alpha, size_t descrA, int nnzA, size_t csrValA, size_t csrRowPtrA, @@ -2369,7 +2346,7 @@ ELSE: descrC, csrValC, csrRowPtrC, csrColIndC) check_status(status) - + cpdef size_t scsrgeam2_bufferSizeExt( intptr_t handle, int m, int n, size_t alpha, size_t descrA, int nnzA, size_t csrValA, size_t csrRowPtrA, @@ -2389,7 +2366,7 @@ ELSE: csrColIndC, &bufferSize) check_status(status) return bufferSize - + cpdef size_t dcsrgeam2_bufferSizeExt( intptr_t handle, int m, int n, size_t alpha, size_t descrA, int nnzA, size_t csrValA, size_t csrRowPtrA, @@ -2409,7 +2386,7 @@ ELSE: csrColIndC, &bufferSize) check_status(status) return bufferSize - + cpdef size_t ccsrgeam2_bufferSizeExt( intptr_t handle, int m, int n, size_t alpha, size_t descrA, int nnzA, size_t csrValA, size_t csrRowPtrA, @@ -2430,7 +2407,7 @@ ELSE: csrColIndC, &bufferSize) check_status(status) return bufferSize - + cpdef size_t zcsrgeam2_bufferSizeExt( intptr_t handle, int m, int n, size_t alpha, size_t descrA, int nnzA, size_t csrValA, size_t csrRowPtrA, @@ -2451,7 +2428,7 @@ ELSE: csrColIndC, &bufferSize) check_status(status) return bufferSize - + cpdef void xcsrgeam2Nnz( intptr_t handle, int m, int n, size_t descrA, int nnzA, size_t csrRowPtrA, size_t csrColIndA, size_t descrB, @@ -2466,7 +2443,7 @@ ELSE: csrColIndB, descrC, csrRowPtrC, nnzTotalDevHostPtr, workspace) check_status(status) - + cpdef void scsrgeam2( intptr_t handle, int m, int n, size_t alpha, size_t descrA, int nnzA, size_t csrValA, size_t csrRowPtrA, @@ -2484,7 +2461,7 @@ ELSE: descrC, csrValC, csrRowPtrC, csrColIndC, buffer) check_status(status) - + cpdef void dcsrgeam2( intptr_t handle, int m, int n, size_t alpha, size_t descrA, int nnzA, size_t csrValA, size_t csrRowPtrA, @@ -2502,7 +2479,7 @@ ELSE: descrC, csrValC, csrRowPtrC, csrColIndC, buffer) check_status(status) - + cpdef void ccsrgeam2( intptr_t handle, int m, int n, size_t alpha, size_t descrA, int nnzA, size_t csrValA, size_t csrRowPtrA, @@ -2521,7 +2498,7 @@ ELSE: descrC, csrValC, csrRowPtrC, csrColIndC, buffer) check_status(status) - + cpdef void zcsrgeam2( intptr_t handle, int m, int n, size_t alpha, size_t descrA, int nnzA, size_t csrValA, size_t csrRowPtrA, @@ -2540,7 +2517,7 @@ ELSE: descrC, csrValC, csrRowPtrC, csrColIndC, buffer) check_status(status) - + cpdef void xcsrgemmNnz( intptr_t handle, int transA, int transB, int m, int n, int k, size_t descrA, int nnzA, size_t csrRowPtrA, @@ -2555,7 +2532,7 @@ ELSE: csrRowPtrB, csrColIndB, descrC, csrRowPtrC, nnzTotalDevHostPtr) check_status(status) - + cpdef void scsrgemm( intptr_t handle, int transA, int transB, int m, int n, int k, size_t descrA, const int nnzA, size_t csrValA, @@ -2573,7 +2550,7 @@ ELSE: descrC, csrValC, csrRowPtrC, csrColIndC) check_status(status) - + cpdef void dcsrgemm( intptr_t handle, int transA, int transB, int m, int n, int k, size_t descrA, const int nnzA, size_t csrValA, @@ -2591,7 +2568,7 @@ ELSE: descrC, csrValC, csrRowPtrC, csrColIndC) check_status(status) - + cpdef void ccsrgemm( intptr_t handle, int transA, int transB, int m, int n, int k, size_t descrA, const int nnzA, size_t csrValA, @@ -2609,7 +2586,7 @@ ELSE: descrC, csrValC, csrRowPtrC, csrColIndC) check_status(status) - + cpdef void zcsrgemm( intptr_t handle, int transA, int transB, int m, int n, int k, size_t descrA, const int nnzA, size_t csrValA, @@ -2627,19 +2604,19 @@ ELSE: descrC, csrValC, csrRowPtrC, csrColIndC) check_status(status) - + cpdef size_t createCsrgemm2Info() except? -1: cdef csrgemm2Info_t info with nogil: status = cusparseCreateCsrgemm2Info(&info) check_status(status) return info - + cpdef void destroyCsrgemm2Info(size_t info) except *: with nogil: status = cusparseDestroyCsrgemm2Info(info) check_status(status) - + cpdef size_t scsrgemm2_bufferSizeExt( intptr_t handle, int m, int n, int k, size_t alpha, @@ -2659,7 +2636,7 @@ ELSE: info, &bufferSize) check_status(status) return bufferSize - + cpdef size_t dcsrgemm2_bufferSizeExt( intptr_t handle, int m, int n, int k, size_t alpha, @@ -2679,7 +2656,7 @@ ELSE: info, &bufferSize) check_status(status) return bufferSize - + cpdef size_t ccsrgemm2_bufferSizeExt( intptr_t handle, int m, int n, int k, size_t alpha, @@ -2699,7 +2676,7 @@ ELSE: info, &bufferSize) check_status(status) return bufferSize - + cpdef size_t zcsrgemm2_bufferSizeExt( intptr_t handle, int m, int n, int k, size_t alpha, @@ -2719,7 +2696,7 @@ ELSE: info, &bufferSize) check_status(status) return bufferSize - + cpdef void xcsrgemm2Nnz( intptr_t handle, int m, int n, int k, size_t descrA, int nnzA, size_t csrRowPtrA, size_t csrColIndA, @@ -2736,7 +2713,7 @@ ELSE: descrC, csrRowPtrC, nnzTotalDevHostPtr, info, pBuffer) check_status(status) - + cpdef void scsrgemm2( intptr_t handle, int m, int n, int k, size_t alpha, size_t descrA, int nnzA, size_t csrValA, size_t csrRowPtrA, size_t csrColIndA, @@ -2755,7 +2732,7 @@ ELSE: csrRowPtrC, csrColIndC, info, pBuffer) check_status(status) - + cpdef void dcsrgemm2( intptr_t handle, int m, int n, int k, size_t alpha, size_t descrA, int nnzA, size_t csrValA, size_t csrRowPtrA, size_t csrColIndA, @@ -2774,7 +2751,7 @@ ELSE: csrRowPtrC, csrColIndC, info, pBuffer) check_status(status) - + cpdef void ccsrgemm2( intptr_t handle, int m, int n, int k, size_t alpha, size_t descrA, int nnzA, size_t csrValA, size_t csrRowPtrA, size_t csrColIndA, @@ -2793,7 +2770,7 @@ ELSE: descrC, csrValC, csrRowPtrC, csrColIndC, info, pBuffer) check_status(status) - + cpdef void zcsrgemm2( intptr_t handle, int m, int n, int k, size_t alpha, size_t descrA, int nnzA, size_t csrValA, size_t csrRowPtrA, size_t csrColIndA, @@ -2812,10 +2789,10 @@ ELSE: descrC, csrValC, csrRowPtrC, csrColIndC, info, pBuffer) check_status(status) - + ######################################## # cuSPARSE Format Convrsion - + cpdef void xcoo2csr( intptr_t handle, size_t cooRowInd, int nnz, int m, size_t csrRowPtr, int idxBase) except *: @@ -2824,8 +2801,7 @@ ELSE: handle, cooRowInd, nnz, m, csrRowPtr, idxBase) check_status(status) - - + cpdef void scsc2dense( intptr_t handle, int m, int n, size_t descrA, size_t cscSortedValA, size_t cscSortedRowIndA, @@ -2836,8 +2812,7 @@ ELSE: cscSortedValA, cscSortedRowIndA, cscSortedColPtrA, A, lda) check_status(status) - - + cpdef void dcsc2dense( intptr_t handle, int m, int n, size_t descrA, size_t cscSortedValA, size_t cscSortedRowIndA, @@ -2848,7 +2823,7 @@ ELSE: cscSortedValA, cscSortedRowIndA, cscSortedColPtrA, A, lda) check_status(status) - + cpdef void ccsc2dense( intptr_t handle, int m, int n, size_t descrA, size_t cscSortedValA, size_t cscSortedRowIndA, @@ -2859,7 +2834,7 @@ ELSE: cscSortedValA, cscSortedRowIndA, cscSortedColPtrA, A, lda) check_status(status) - + cpdef void zcsc2dense( intptr_t handle, int m, int n, size_t descrA, size_t cscSortedValA, size_t cscSortedRowIndA, @@ -2870,7 +2845,7 @@ ELSE: cscSortedValA, cscSortedRowIndA, cscSortedColPtrA, A, lda) check_status(status) - + cpdef void xcsr2coo( intptr_t handle, size_t csrRowPtr, int nnz, int m, size_t cooRowInd, int idxBase) except *: @@ -2879,8 +2854,7 @@ ELSE: handle, csrRowPtr, nnz, m, cooRowInd, idxBase) check_status(status) - - + cpdef void scsr2csc( intptr_t handle, int m, int n, int nnz, size_t csrVal, size_t csrRowPtr, size_t csrColInd, size_t cscVal, @@ -2893,8 +2867,7 @@ ELSE: cscRowInd, cscColPtr, copyValues, idxBase) check_status(status) - - + cpdef void dcsr2csc( intptr_t handle, int m, int n, int nnz, size_t csrVal, size_t csrRowPtr, size_t csrColInd, size_t cscVal, @@ -2907,7 +2880,7 @@ ELSE: cscRowInd, cscColPtr, copyValues, idxBase) check_status(status) - + cpdef void ccsr2csc( intptr_t handle, int m, int n, int nnz, size_t csrVal, size_t csrRowPtr, size_t csrColInd, size_t cscVal, @@ -2920,7 +2893,7 @@ ELSE: cscRowInd, cscColPtr, copyValues, idxBase) check_status(status) - + cpdef void zcsr2csc( intptr_t handle, int m, int n, int nnz, size_t csrVal, size_t csrRowPtr, size_t csrColInd, size_t cscVal, @@ -2934,7 +2907,7 @@ ELSE: cscRowInd, cscColPtr, copyValues, idxBase) check_status(status) - + cpdef void scsr2dense( intptr_t handle, int m, int n, size_t descrA, size_t csrSortedValA, size_t csrSortedRowPtrA, @@ -2945,7 +2918,7 @@ ELSE: csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, A, lda) check_status(status) - + cpdef void dcsr2dense( intptr_t handle, int m, int n, size_t descrA, size_t csrSortedValA, size_t csrSortedRowPtrA, @@ -2956,7 +2929,7 @@ ELSE: csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, A, lda) check_status(status) - + cpdef void ccsr2dense( intptr_t handle, int m, int n, size_t descrA, size_t csrSortedValA, size_t csrSortedRowPtrA, @@ -2967,7 +2940,7 @@ ELSE: csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, A, lda) check_status(status) - + cpdef void zcsr2dense( intptr_t handle, int m, int n, size_t descrA, size_t csrSortedValA, size_t csrSortedRowPtrA, @@ -2978,7 +2951,7 @@ ELSE: csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, A, lda) check_status(status) - + cpdef int snnz_compress( intptr_t handle, int m, size_t descr, size_t values, size_t rowPtr, size_t nnzPerRow, @@ -2991,7 +2964,7 @@ ELSE: &nnz_total, tol) check_status(status) return nnz_total - + cpdef int dnnz_compress( intptr_t handle, int m, size_t descr, size_t values, size_t rowPtr, size_t nnzPerRow, @@ -3004,7 +2977,7 @@ ELSE: &nnz_total, tol) check_status(status) return nnz_total - + cpdef int cnnz_compress( intptr_t handle, int m, size_t descr, size_t values, size_t rowPtr, size_t nnzPerRow, @@ -3017,7 +2990,7 @@ ELSE: &nnz_total, complex_to_cuda(tol)) check_status(status) return nnz_total - + cpdef int znnz_compress( intptr_t handle, int m, size_t descr, size_t values, size_t rowPtr, size_t nnzPerRow, @@ -3030,7 +3003,7 @@ ELSE: &nnz_total, double_complex_to_cuda(tol)) check_status(status) return nnz_total - + cpdef void scsr2csr_compress( intptr_t handle, int m, int n, size_t descrA, size_t inVal, size_t inColInd, size_t inRowPtr, @@ -3043,8 +3016,7 @@ ELSE: inNnz, nnzPerRow, outVal, outColInd, outRowPtr, tol) check_status(status) - - + cpdef void dcsr2csr_compress( intptr_t handle, int m, int n, size_t descrA, size_t inVal, size_t inColInd, size_t inRowPtr, @@ -3057,7 +3029,7 @@ ELSE: inNnz, nnzPerRow, outVal, outColInd, outRowPtr, tol) check_status(status) - + cpdef void ccsr2csr_compress( intptr_t handle, int m, int n, size_t descrA, size_t inVal, size_t inColInd, size_t inRowPtr, @@ -3070,7 +3042,7 @@ ELSE: inNnz, nnzPerRow, outVal, outColInd, outRowPtr, complex_to_cuda(tol)) check_status(status) - + cpdef void zcsr2csr_compress( intptr_t handle, int m, int n, size_t descrA, size_t inVal, size_t inColInd, size_t inRowPtr, @@ -3084,7 +3056,7 @@ ELSE: inNnz, nnzPerRow, outVal, outColInd, outRowPtr, double_complex_to_cuda(tol)) check_status(status) - + cpdef void sdense2csc( intptr_t handle, int m, int n, size_t descrA, size_t A, int lda, size_t nnzPerCol, size_t cscValA, size_t cscRowIndA, @@ -3095,8 +3067,7 @@ ELSE: lda, nnzPerCol, cscValA, cscRowIndA, cscColPtrA) check_status(status) - - + cpdef void ddense2csc( intptr_t handle, int m, int n, size_t descrA, size_t A, int lda, size_t nnzPerCol, size_t cscValA, size_t cscRowIndA, @@ -3107,7 +3078,7 @@ ELSE: lda, nnzPerCol, cscValA, cscRowIndA, cscColPtrA) check_status(status) - + cpdef void cdense2csc( intptr_t handle, int m, int n, size_t descrA, size_t A, int lda, size_t nnzPerCol, size_t cscValA, size_t cscRowIndA, @@ -3118,7 +3089,7 @@ ELSE: lda, nnzPerCol, cscValA, cscRowIndA, cscColPtrA) check_status(status) - + cpdef void zdense2csc( intptr_t handle, int m, int n, size_t descrA, size_t A, int lda, size_t nnzPerCol, size_t cscValA, size_t cscRowIndA, @@ -3131,7 +3102,7 @@ ELSE: cscValA, cscRowIndA, cscColPtrA) check_status(status) - + cpdef void sdense2csr( intptr_t handle, int m, int n, size_t descrA, size_t A, int lda, size_t nnzPerRow, size_t csrValA, @@ -3142,8 +3113,7 @@ ELSE: A, lda, nnzPerRow, csrValA, csrRowPtrA, csrColIndA) check_status(status) - - + cpdef void ddense2csr( intptr_t handle, int m, int n, size_t descrA, size_t A, int lda, size_t nnzPerRow, size_t csrValA, @@ -3154,7 +3124,7 @@ ELSE: A, lda, nnzPerRow, csrValA, csrRowPtrA, csrColIndA) check_status(status) - + cpdef void cdense2csr( intptr_t handle, int m, int n, size_t descrA, size_t A, int lda, size_t nnzPerRow, size_t csrValA, @@ -3165,7 +3135,7 @@ ELSE: A, lda, nnzPerRow, csrValA, csrRowPtrA, csrColIndA) check_status(status) - + cpdef void zdense2csr( intptr_t handle, int m, int n, size_t descrA, size_t A, int lda, size_t nnzPerRow, size_t csrValA, @@ -3176,7 +3146,7 @@ ELSE: A, lda, nnzPerRow, csrValA, csrRowPtrA, csrColIndA) check_status(status) - + cpdef void snnz( intptr_t handle, int dirA, int m, int n, size_t descrA, size_t A, int lda, size_t nnzPerRowColumn, @@ -3187,8 +3157,7 @@ ELSE: A, lda, nnzPerRowColumn, nnzTotalDevHostPtr) check_status(status) - - + cpdef void dnnz( intptr_t handle, int dirA, int m, int n, size_t descrA, size_t A, int lda, size_t nnzPerRowColumn, @@ -3199,7 +3168,7 @@ ELSE: A, lda, nnzPerRowColumn, nnzTotalDevHostPtr) check_status(status) - + cpdef void cnnz( intptr_t handle, int dirA, int m, int n, size_t descrA, size_t A, int lda, size_t nnzPerRowColumn, @@ -3210,7 +3179,7 @@ ELSE: A, lda, nnzPerRowColumn, nnzTotalDevHostPtr) check_status(status) - + cpdef void znnz( intptr_t handle, int dirA, int m, int n, size_t descrA, size_t A, int lda, size_t nnzPerRowColumn, @@ -3221,15 +3190,14 @@ ELSE: A, lda, nnzPerRowColumn, nnzTotalDevHostPtr) check_status(status) - + cpdef void createIdentityPermutation( intptr_t handle, int n, size_t p) except *: _setStream(handle) status = cusparseCreateIdentityPermutation( handle, n, p) check_status(status) - - + cpdef size_t xcoosort_bufferSizeExt( intptr_t handle, int m, int n, int nnz, size_t cooRows, size_t cooCols) except? -1: @@ -3240,8 +3208,7 @@ ELSE: cooCols, &bufferSizeInBytes) check_status(status) return bufferSizeInBytes - - + cpdef void xcoosortByRow( intptr_t handle, int m, int n, int nnz, size_t cooRows, size_t cooCols, size_t P, size_t pBuffer) except *: @@ -3250,8 +3217,7 @@ ELSE: handle, m, n, nnz, cooRows, cooCols, P, pBuffer) check_status(status) - - + cpdef void xcoosortByColumn( intptr_t handle, int m, int n, int nnz, size_t cooRows, size_t cooCols, size_t P, size_t pBuffer) except *: @@ -3260,8 +3226,7 @@ ELSE: handle, m, n, nnz, cooRows, cooCols, P, pBuffer) check_status(status) - - + cpdef size_t xcsrsort_bufferSizeExt( intptr_t handle, int m, int n, int nnz, size_t csrRowPtr, size_t csrColInd) except? -1: @@ -3272,8 +3237,7 @@ ELSE: csrColInd, &bufferSizeInBytes) check_status(status) return bufferSizeInBytes - - + cpdef void xcsrsort( intptr_t handle, int m, int n, int nnz, size_t descrA, size_t csrRowPtr, size_t csrColInd, size_t P, size_t pBuffer) except *: @@ -3282,8 +3246,7 @@ ELSE: handle, m, n, nnz, descrA, csrRowPtr, csrColInd, P, pBuffer) check_status(status) - - + cpdef size_t xcscsort_bufferSizeExt( intptr_t handle, int m, int n, int nnz, size_t cscColPtr, size_t cscRowInd) except? -1: @@ -3294,8 +3257,7 @@ ELSE: cscRowInd, &bufferSizeInBytes) check_status(status) return bufferSizeInBytes - - + cpdef void xcscsort( intptr_t handle, int m, int n, int nnz, size_t descrA, size_t cscColPtr, size_t cscRowInd, size_t P, size_t pBuffer) except *: @@ -3304,58 +3266,58 @@ ELSE: handle, m, n, nnz, descrA, cscColPtr, cscRowInd, P, pBuffer) check_status(status) - + ######################################## # cuSPARSE PRECONDITIONERS - + cpdef size_t createCsrilu02Info() except? -1: cdef csrilu02Info_t info with nogil: status = cusparseCreateCsrilu02Info(&info) check_status(status) return info - + cpdef void destroyCsrilu02Info(size_t info) except *: with nogil: status = cusparseDestroyCsrilu02Info(info) check_status(status) - + cpdef size_t createBsrilu02Info() except? -1: cdef bsrilu02Info_t info with nogil: status = cusparseCreateBsrilu02Info(&info) check_status(status) return info - + cpdef void destroyBsrilu02Info(size_t info) except *: with nogil: status = cusparseDestroyBsrilu02Info(info) check_status(status) - + cpdef size_t createCsric02Info() except? -1: cdef csric02Info_t info with nogil: status = cusparseCreateCsric02Info(&info) check_status(status) return info - + cpdef void destroyCsric02Info(size_t info) except *: with nogil: status = cusparseDestroyCsric02Info(info) check_status(status) - + cpdef size_t createBsric02Info() except? -1: cdef bsric02Info_t info with nogil: status = cusparseCreateBsric02Info(&info) check_status(status) return info - + cpdef void destroyBsric02Info(size_t info) except *: with nogil: status = cusparseDestroyBsric02Info(info) check_status(status) - + cpdef void scsrilu02_numericBoost( intptr_t handle, size_t info, int enable_boost, size_t tol, size_t boost_val) except *: @@ -3365,7 +3327,7 @@ ELSE: handle, info, enable_boost, tol, boost_val) check_status(status) - + cpdef void dcsrilu02_numericBoost( intptr_t handle, size_t info, int enable_boost, size_t tol, size_t boost_val) except *: @@ -3375,7 +3337,7 @@ ELSE: handle, info, enable_boost, tol, boost_val) check_status(status) - + cpdef void ccsrilu02_numericBoost( intptr_t handle, size_t info, int enable_boost, size_t tol, size_t boost_val) except *: @@ -3385,7 +3347,7 @@ ELSE: handle, info, enable_boost, tol, boost_val) check_status(status) - + cpdef void zcsrilu02_numericBoost( intptr_t handle, size_t info, int enable_boost, size_t tol, size_t boost_val) except *: @@ -3395,7 +3357,7 @@ ELSE: handle, info, enable_boost, tol, boost_val) check_status(status) - + cpdef void xcsrilu02_zeroPivot( intptr_t handle, size_t info, size_t position) except *: _setStream(handle) @@ -3403,7 +3365,7 @@ ELSE: status = cusparseXcsrilu02_zeroPivot( handle, info, position) check_status(status) - + cpdef int scsrilu02_bufferSize( intptr_t handle, int m, int nnz, size_t descrA, size_t csrSortedValA, size_t csrSortedRowPtrA, @@ -3418,7 +3380,7 @@ ELSE: &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes - + cpdef int dcsrilu02_bufferSize( intptr_t handle, int m, int nnz, size_t descrA, size_t csrSortedValA, size_t csrSortedRowPtrA, @@ -3433,7 +3395,7 @@ ELSE: &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes - + cpdef int ccsrilu02_bufferSize( intptr_t handle, int m, int nnz, size_t descrA, size_t csrSortedValA, size_t csrSortedRowPtrA, @@ -3448,7 +3410,7 @@ ELSE: &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes - + cpdef int zcsrilu02_bufferSize( intptr_t handle, int m, int nnz, size_t descrA, size_t csrSortedValA, size_t csrSortedRowPtrA, @@ -3463,7 +3425,7 @@ ELSE: &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes - + cpdef void scsrilu02_analysis(intptr_t handle, int m, int nnz, size_t descrA, size_t csrSortedValA, size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t info, int policy, @@ -3476,7 +3438,7 @@ ELSE: csrSortedColIndA, info, policy, pBuffer) check_status(status) - + cpdef void dcsrilu02_analysis(intptr_t handle, int m, int nnz, size_t descrA, size_t csrSortedValA, size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t info, int policy, @@ -3489,7 +3451,7 @@ ELSE: csrSortedColIndA, info, policy, pBuffer) check_status(status) - + cpdef void ccsrilu02_analysis(intptr_t handle, int m, int nnz, size_t descrA, size_t csrSortedValA, size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t info, int policy, @@ -3502,7 +3464,7 @@ ELSE: csrSortedColIndA, info, policy, pBuffer) check_status(status) - + cpdef void zcsrilu02_analysis(intptr_t handle, int m, int nnz, size_t descrA, size_t csrSortedValA, size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t info, int policy, @@ -3516,7 +3478,7 @@ ELSE: info, policy, pBuffer) check_status(status) - + cpdef void scsrilu02(intptr_t handle, int m, int nnz, size_t descrA, size_t csrSortedValA_valM, size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t info, int policy, @@ -3529,7 +3491,7 @@ ELSE: csrSortedColIndA, info, policy, pBuffer) check_status(status) - + cpdef void dcsrilu02(intptr_t handle, int m, int nnz, size_t descrA, size_t csrSortedValA_valM, size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t info, int policy, @@ -3542,7 +3504,7 @@ ELSE: csrSortedColIndA, info, policy, pBuffer) check_status(status) - + cpdef void ccsrilu02(intptr_t handle, int m, int nnz, size_t descrA, size_t csrSortedValA_valM, size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t info, int policy, @@ -3555,7 +3517,7 @@ ELSE: csrSortedColIndA, info, policy, pBuffer) check_status(status) - + cpdef void zcsrilu02(intptr_t handle, int m, int nnz, size_t descrA, size_t csrSortedValA_valM, size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t info, int policy, @@ -3568,7 +3530,7 @@ ELSE: csrSortedColIndA, info, policy, pBuffer) check_status(status) - + cpdef void sbsrilu02_numericBoost( intptr_t handle, size_t info, int enable_boost, size_t tol, size_t boost_val) except *: @@ -3578,7 +3540,7 @@ ELSE: handle, info, enable_boost, tol, boost_val) check_status(status) - + cpdef void dbsrilu02_numericBoost( intptr_t handle, size_t info, int enable_boost, size_t tol, size_t boost_val) except *: @@ -3588,7 +3550,7 @@ ELSE: handle, info, enable_boost, tol, boost_val) check_status(status) - + cpdef void cbsrilu02_numericBoost( intptr_t handle, size_t info, int enable_boost, size_t tol, size_t boost_val) except *: @@ -3598,7 +3560,7 @@ ELSE: handle, info, enable_boost, tol, boost_val) check_status(status) - + cpdef void zbsrilu02_numericBoost( intptr_t handle, size_t info, int enable_boost, size_t tol, size_t boost_val) except *: @@ -3608,7 +3570,7 @@ ELSE: handle, info, enable_boost, tol, boost_val) check_status(status) - + cpdef void xbsrilu02_zeroPivot( intptr_t handle, size_t info, size_t position) except *: _setStream(handle) @@ -3616,7 +3578,7 @@ ELSE: status = cusparseXbsrilu02_zeroPivot( handle, info, position) check_status(status) - + cpdef int sbsrilu02_bufferSize(intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, size_t bsrSortedVal, size_t bsrSortedRowPtr, size_t bsrSortedColInd, @@ -3631,7 +3593,7 @@ ELSE: info, &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes - + cpdef int dbsrilu02_bufferSize(intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, size_t bsrSortedVal, size_t bsrSortedRowPtr, size_t bsrSortedColInd, @@ -3646,7 +3608,7 @@ ELSE: info, &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes - + cpdef int cbsrilu02_bufferSize(intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, size_t bsrSortedVal, size_t bsrSortedRowPtr, size_t bsrSortedColInd, @@ -3661,7 +3623,7 @@ ELSE: info, &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes - + cpdef int zbsrilu02_bufferSize(intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, size_t bsrSortedVal, size_t bsrSortedRowPtr, size_t bsrSortedColInd, @@ -3676,7 +3638,7 @@ ELSE: info, &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes - + cpdef void sbsrilu02_analysis( intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, size_t bsrSortedVal, size_t bsrSortedRowPtr, size_t bsrSortedColInd, @@ -3690,7 +3652,7 @@ ELSE: info, policy, pBuffer) check_status(status) - + cpdef void dbsrilu02_analysis( intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, size_t bsrSortedVal, size_t bsrSortedRowPtr, size_t bsrSortedColInd, @@ -3704,7 +3666,7 @@ ELSE: info, policy, pBuffer) check_status(status) - + cpdef void cbsrilu02_analysis( intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, size_t bsrSortedVal, size_t bsrSortedRowPtr, size_t bsrSortedColInd, @@ -3718,7 +3680,7 @@ ELSE: info, policy, pBuffer) check_status(status) - + cpdef void zbsrilu02_analysis( intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, size_t bsrSortedVal, size_t bsrSortedRowPtr, size_t bsrSortedColInd, @@ -3732,7 +3694,7 @@ ELSE: info, policy, pBuffer) check_status(status) - + cpdef void sbsrilu02( intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, size_t bsrSortedVal, size_t bsrSortedRowPtr, @@ -3747,7 +3709,7 @@ ELSE: info, policy, pBuffer) check_status(status) - + cpdef void dbsrilu02( intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, size_t bsrSortedVal, size_t bsrSortedRowPtr, @@ -3762,7 +3724,7 @@ ELSE: info, policy, pBuffer) check_status(status) - + cpdef void cbsrilu02( intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, size_t bsrSortedVal, size_t bsrSortedRowPtr, @@ -3777,7 +3739,7 @@ ELSE: info, policy, pBuffer) check_status(status) - + cpdef void zbsrilu02( intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, size_t bsrSortedVal, size_t bsrSortedRowPtr, @@ -3792,7 +3754,7 @@ ELSE: info, policy, pBuffer) check_status(status) - + cpdef void xcsric02_zeroPivot( intptr_t handle, size_t info, size_t position) except *: _setStream(handle) @@ -3800,7 +3762,7 @@ ELSE: status = cusparseXcsric02_zeroPivot( handle, info, position) check_status(status) - + cpdef int scsric02_bufferSize(intptr_t handle, int m, int nnz, size_t descrA, size_t csrSortedValA, size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t info) except? -1: @@ -3814,7 +3776,7 @@ ELSE: &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes - + cpdef int dcsric02_bufferSize(intptr_t handle, int m, int nnz, size_t descrA, size_t csrSortedValA, size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t info) except? -1: @@ -3828,7 +3790,7 @@ ELSE: &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes - + cpdef int ccsric02_bufferSize(intptr_t handle, int m, int nnz, size_t descrA, size_t csrSortedValA, size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t info) except? -1: @@ -3842,7 +3804,7 @@ ELSE: &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes - + cpdef int zcsric02_bufferSize(intptr_t handle, int m, int nnz, size_t descrA, size_t csrSortedValA, size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t info) except? -1: @@ -3856,7 +3818,7 @@ ELSE: &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes - + cpdef void scsric02_analysis( intptr_t handle, int m, int nnz, size_t descrA, size_t csrSortedValA, size_t csrSortedRowPtrA, @@ -3870,7 +3832,7 @@ ELSE: csrSortedColIndA, info, policy, pBuffer) check_status(status) - + cpdef void dcsric02_analysis( intptr_t handle, int m, int nnz, size_t descrA, size_t csrSortedValA, size_t csrSortedRowPtrA, @@ -3884,7 +3846,7 @@ ELSE: csrSortedColIndA, info, policy, pBuffer) check_status(status) - + cpdef void ccsric02_analysis( intptr_t handle, int m, int nnz, size_t descrA, size_t csrSortedValA, size_t csrSortedRowPtrA, @@ -3898,7 +3860,7 @@ ELSE: csrSortedColIndA, info, policy, pBuffer) check_status(status) - + cpdef void zcsric02_analysis( intptr_t handle, int m, int nnz, size_t descrA, size_t csrSortedValA, size_t csrSortedRowPtrA, @@ -3912,7 +3874,7 @@ ELSE: csrSortedRowPtrA, csrSortedColIndA, info, policy, pBuffer) check_status(status) - + cpdef void scsric02( intptr_t handle, int m, int nnz, size_t descrA, size_t csrSortedValA_valM, size_t csrSortedRowPtrA, @@ -3926,7 +3888,7 @@ ELSE: csrSortedColIndA, info, policy, pBuffer) check_status(status) - + cpdef void dcsric02( intptr_t handle, int m, int nnz, size_t descrA, size_t csrSortedValA_valM, size_t csrSortedRowPtrA, @@ -3940,7 +3902,7 @@ ELSE: csrSortedColIndA, info, policy, pBuffer) check_status(status) - + cpdef void ccsric02( intptr_t handle, int m, int nnz, size_t descrA, size_t csrSortedValA_valM, size_t csrSortedRowPtrA, @@ -3954,7 +3916,7 @@ ELSE: csrSortedColIndA, info, policy, pBuffer) check_status(status) - + cpdef void zcsric02( intptr_t handle, int m, int nnz, size_t descrA, size_t csrSortedValA_valM, size_t csrSortedRowPtrA, @@ -3968,7 +3930,7 @@ ELSE: csrSortedColIndA, info, policy, pBuffer) check_status(status) - + cpdef void xbsric02_zeroPivot( intptr_t handle, size_t info, size_t position) except *: _setStream(handle) @@ -3976,7 +3938,7 @@ ELSE: status = cusparseXbsric02_zeroPivot( handle, info, position) check_status(status) - + cpdef int sbsric02_bufferSize(intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, size_t bsrSortedVal, size_t bsrSortedRowPtr, size_t bsrSortedColInd, @@ -3991,7 +3953,7 @@ ELSE: info, &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes - + cpdef int dbsric02_bufferSize(intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, size_t bsrSortedVal, size_t bsrSortedRowPtr, size_t bsrSortedColInd, @@ -4006,7 +3968,7 @@ ELSE: info, &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes - + cpdef int cbsric02_bufferSize(intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, size_t bsrSortedVal, size_t bsrSortedRowPtr, size_t bsrSortedColInd, @@ -4021,7 +3983,7 @@ ELSE: info, &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes - + cpdef int zbsric02_bufferSize(intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, size_t bsrSortedVal, size_t bsrSortedRowPtr, size_t bsrSortedColInd, @@ -4036,7 +3998,7 @@ ELSE: info, &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes - + cpdef void sbsric02_analysis( intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, size_t bsrSortedVal, size_t bsrSortedRowPtr, size_t bsrSortedColInd, @@ -4050,7 +4012,7 @@ ELSE: info, policy, pInputBuffer) check_status(status) - + cpdef void dbsric02_analysis( intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, size_t bsrSortedVal, size_t bsrSortedRowPtr, size_t bsrSortedColInd, @@ -4064,7 +4026,7 @@ ELSE: info, policy, pInputBuffer) check_status(status) - + cpdef void cbsric02_analysis( intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, size_t bsrSortedVal, size_t bsrSortedRowPtr, size_t bsrSortedColInd, @@ -4078,7 +4040,7 @@ ELSE: info, policy, pInputBuffer) check_status(status) - + cpdef void zbsric02_analysis( intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, size_t bsrSortedVal, size_t bsrSortedRowPtr, size_t bsrSortedColInd, @@ -4092,7 +4054,7 @@ ELSE: bsrSortedColInd, blockDim, info, policy, pInputBuffer) check_status(status) - + cpdef void sbsric02( intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, size_t bsrSortedVal, size_t bsrSortedRowPtr, @@ -4106,7 +4068,7 @@ ELSE: bsrSortedRowPtr, bsrSortedColInd, blockDim, info, policy, pBuffer) check_status(status) - + cpdef void dbsric02( intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, size_t bsrSortedVal, size_t bsrSortedRowPtr, @@ -4120,7 +4082,7 @@ ELSE: bsrSortedRowPtr, bsrSortedColInd, blockDim, info, policy, pBuffer) check_status(status) - + cpdef void cbsric02( intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, size_t bsrSortedVal, size_t bsrSortedRowPtr, @@ -4134,7 +4096,7 @@ ELSE: bsrSortedRowPtr, bsrSortedColInd, blockDim, info, policy, pBuffer) check_status(status) - + cpdef void zbsric02( intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, size_t bsrSortedVal, size_t bsrSortedRowPtr, @@ -4148,7 +4110,7 @@ ELSE: bsrSortedRowPtr, bsrSortedColInd, blockDim, info, policy, pBuffer) check_status(status) - + cpdef size_t sgtsv2_bufferSizeExt( intptr_t handle, int m, int n, size_t dl, size_t d, size_t du, size_t B, int ldb) except? -1: @@ -4160,7 +4122,7 @@ ELSE: du, B, ldb, &bufferSizeInBytes) check_status(status) return bufferSizeInBytes - + cpdef size_t dgtsv2_bufferSizeExt( intptr_t handle, int m, int n, size_t dl, size_t d, size_t du, size_t B, int ldb) except? -1: @@ -4173,7 +4135,7 @@ ELSE: &bufferSizeInBytes) check_status(status) return bufferSizeInBytes - + cpdef size_t cgtsv2_bufferSizeExt( intptr_t handle, int m, int n, size_t dl, size_t d, size_t du, size_t B, int ldb) except? -1: @@ -4186,7 +4148,7 @@ ELSE: ldb, &bufferSizeInBytes) check_status(status) return bufferSizeInBytes - + cpdef size_t zgtsv2_bufferSizeExt( intptr_t handle, int m, int n, size_t dl, size_t d, size_t du, size_t B, int ldb) except? -1: @@ -4199,7 +4161,7 @@ ELSE: B, ldb, &bufferSizeInBytes) check_status(status) return bufferSizeInBytes - + cpdef void sgtsv2( intptr_t handle, int m, int n, size_t dl, size_t d, size_t du, size_t B, int ldb, size_t pBuffer) except *: @@ -4209,7 +4171,7 @@ ELSE: handle, m, n, dl, d, du, B, ldb, pBuffer) check_status(status) - + cpdef void dgtsv2( intptr_t handle, int m, int n, size_t dl, size_t d, size_t du, size_t B, int ldb, size_t pBuffer) except *: @@ -4220,7 +4182,7 @@ ELSE: du, B, ldb, pBuffer) check_status(status) - + cpdef void cgtsv2( intptr_t handle, int m, int n, size_t dl, size_t d, size_t du, size_t B, int ldb, size_t pBuffer) except *: @@ -4231,7 +4193,7 @@ ELSE: du, B, ldb, pBuffer) check_status(status) - + cpdef void zgtsv2( intptr_t handle, int m, int n, size_t dl, size_t d, size_t du, size_t B, int ldb, size_t pBuffer) except *: @@ -4242,7 +4204,7 @@ ELSE: d, du, B, ldb, pBuffer) check_status(status) - + cpdef size_t sgtsv2_nopivot_bufferSizeExt( intptr_t handle, int m, int n, size_t dl, size_t d, size_t du, size_t B, int ldb) except? -1: @@ -4254,7 +4216,7 @@ ELSE: du, B, ldb, &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes - + cpdef size_t dgtsv2_nopivot_bufferSizeExt( intptr_t handle, int m, int n, size_t dl, size_t d, size_t du, size_t B, int ldb) except? -1: @@ -4267,7 +4229,7 @@ ELSE: &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes - + cpdef size_t cgtsv2_nopivot_bufferSizeExt( intptr_t handle, int m, int n, size_t dl, size_t d, size_t du, size_t B, int ldb) except? -1: @@ -4280,7 +4242,7 @@ ELSE: ldb, &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes - + cpdef size_t zgtsv2_nopivot_bufferSizeExt( intptr_t handle, int m, int n, size_t dl, size_t d, size_t du, size_t B, int ldb) except? -1: @@ -4293,7 +4255,7 @@ ELSE: B, ldb, &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes - + cpdef void sgtsv2_nopivot( intptr_t handle, int m, int n, size_t dl, size_t d, size_t du, size_t B, int ldb, size_t pBuffer) except *: @@ -4303,7 +4265,7 @@ ELSE: handle, m, n, dl, d, du, B, ldb, pBuffer) check_status(status) - + cpdef void dgtsv2_nopivot( intptr_t handle, int m, int n, size_t dl, size_t d, size_t du, size_t B, int ldb, size_t pBuffer) except *: @@ -4314,7 +4276,7 @@ ELSE: du, B, ldb, pBuffer) check_status(status) - + cpdef void cgtsv2_nopivot( intptr_t handle, int m, int n, size_t dl, size_t d, size_t du, size_t B, int ldb, size_t pBuffer) except *: @@ -4325,7 +4287,7 @@ ELSE: d, du, B, ldb, pBuffer) check_status(status) - + cpdef void zgtsv2_nopivot( intptr_t handle, int m, int n, size_t dl, size_t d, size_t du, size_t B, int ldb, size_t pBuffer) except *: @@ -4336,7 +4298,7 @@ ELSE: d, du, B, ldb, pBuffer) check_status(status) - + cpdef size_t sgtsv2StridedBatch_bufferSizeExt( intptr_t handle, int m, size_t dl, size_t d, size_t du, size_t x, int batchCount, int batchStride) except? -1: @@ -4349,7 +4311,7 @@ ELSE: &bufferSizeInBytes) check_status(status) return bufferSizeInBytes - + cpdef size_t dgtsv2StridedBatch_bufferSizeExt( intptr_t handle, int m, size_t dl, size_t d, size_t du, size_t x, int batchCount, int batchStride): @@ -4362,7 +4324,7 @@ ELSE: &bufferSizeInBytes) check_status(status) return bufferSizeInBytes - + cpdef size_t cgtsv2StridedBatch_bufferSizeExt( intptr_t handle, int m, size_t dl, size_t d, size_t du, size_t x, int batchCount, int batchStride) except? -1: @@ -4375,7 +4337,7 @@ ELSE: batchCount, batchStride, &bufferSizeInBytes) check_status(status) return bufferSizeInBytes - + cpdef size_t zgtsv2StridedBatch_bufferSizeExt( intptr_t handle, int m, size_t dl, size_t d, size_t du, size_t x, int batchCount, int batchStride) except? -1: @@ -4389,7 +4351,7 @@ ELSE: &bufferSizeInBytes) check_status(status) return bufferSizeInBytes - + cpdef void sgtsv2StridedBatch( intptr_t handle, int m, size_t dl, size_t d, size_t du, size_t x, int batchCount, int batchStride, @@ -4401,7 +4363,7 @@ ELSE: du, x, batchCount, batchStride, pBuffer) check_status(status) - + cpdef void dgtsv2StridedBatch( intptr_t handle, int m, size_t dl, size_t d, size_t du, size_t x, int batchCount, int batchStride, @@ -4413,7 +4375,7 @@ ELSE: du, x, batchCount, batchStride, pBuffer) check_status(status) - + cpdef void cgtsv2StridedBatch( intptr_t handle, int m, size_t dl, size_t d, size_t du, size_t x, int batchCount, int batchStride, @@ -4425,7 +4387,7 @@ ELSE: d, du, x, batchCount, batchStride, pBuffer) check_status(status) - + cpdef void zgtsv2StridedBatch( intptr_t handle, int m, size_t dl, size_t d, size_t du, size_t x, int batchCount, int batchStride, @@ -4437,7 +4399,7 @@ ELSE: d, du, x, batchCount, batchStride, pBuffer) check_status(status) - + cpdef size_t sgtsvInterleavedBatch_bufferSizeExt( intptr_t handle, int algo, int m, size_t dl, size_t d, size_t du, size_t x, int batchCount) except? -1: @@ -4450,7 +4412,7 @@ ELSE: &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes - + cpdef size_t dgtsvInterleavedBatch_bufferSizeExt( intptr_t handle, int algo, int m, size_t dl, size_t d, size_t du, size_t x, int batchCount) except? -1: @@ -4463,7 +4425,7 @@ ELSE: &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes - + cpdef size_t cgtsvInterleavedBatch_bufferSizeExt( intptr_t handle, int algo, int m, size_t dl, size_t d, size_t du, size_t x, int batchCount) except? -1: @@ -4476,7 +4438,7 @@ ELSE: batchCount, &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes - + cpdef size_t zgtsvInterleavedBatch_bufferSizeExt( intptr_t handle, int algo, int m, size_t dl, size_t d, size_t du, size_t x, int batchCount) except? -1: @@ -4489,7 +4451,7 @@ ELSE: x, batchCount, &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes - + cpdef void sgtsvInterleavedBatch( intptr_t handle, int algo, int m, size_t dl, size_t d, size_t du, size_t x, int batchCount, @@ -4500,7 +4462,7 @@ ELSE: handle, algo, m, dl, d, du, x, batchCount, pBuffer) check_status(status) - + cpdef void dgtsvInterleavedBatch( intptr_t handle, int algo, int m, size_t dl, size_t d, size_t du, size_t x, int batchCount, @@ -4511,7 +4473,7 @@ ELSE: handle, algo, m, dl, d, du, x, batchCount, pBuffer) check_status(status) - + cpdef void cgtsvInterleavedBatch( intptr_t handle, int algo, int m, size_t dl, size_t d, size_t du, size_t x, int batchCount, @@ -4522,7 +4484,7 @@ ELSE: handle, algo, m, dl, d, du, x, batchCount, pBuffer) check_status(status) - + cpdef void zgtsvInterleavedBatch( intptr_t handle, int algo, int m, size_t dl, size_t d, size_t du, size_t x, int batchCount, @@ -4534,7 +4496,7 @@ ELSE: d, du, x, batchCount, pBuffer) check_status(status) - + cpdef size_t sgpsvInterleavedBatch_bufferSizeExt( intptr_t handle, int algo, int m, size_t ds, size_t dl, size_t d, size_t du, size_t dw, size_t x, int batchCount) except? -1: @@ -4547,7 +4509,7 @@ ELSE: dw, x, batchCount, &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes - + cpdef size_t dgpsvInterleavedBatch_bufferSizeExt( intptr_t handle, int algo, int m, size_t ds, size_t dl, size_t d, size_t du, size_t dw, size_t x, int batchCount) except? -1: @@ -4561,7 +4523,7 @@ ELSE: &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes - + cpdef size_t cgpsvInterleavedBatch_bufferSizeExt( intptr_t handle, int algo, int m, size_t ds, size_t dl, size_t d, size_t du, size_t dw, size_t x, int batchCount) except? -1: @@ -4575,7 +4537,7 @@ ELSE: &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes - + cpdef size_t zgpsvInterleavedBatch_bufferSizeExt( intptr_t handle, int algo, int m, size_t ds, size_t dl, size_t d, size_t du, size_t dw, size_t x, int batchCount) except? -1: @@ -4589,7 +4551,7 @@ ELSE: x, batchCount, &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes - + cpdef void sgpsvInterleavedBatch( intptr_t handle, int algo, int m, size_t ds, size_t dl, size_t d, size_t du, size_t dw, @@ -4601,7 +4563,7 @@ ELSE: d, du, dw, x, batchCount, pBuffer) check_status(status) - + cpdef void dgpsvInterleavedBatch( intptr_t handle, int algo, int m, size_t ds, size_t dl, size_t d, size_t du, size_t dw, @@ -4613,7 +4575,7 @@ ELSE: d, du, dw, x, batchCount, pBuffer) check_status(status) - + cpdef void cgpsvInterleavedBatch( intptr_t handle, int algo, int m, size_t ds, size_t dl, size_t d, size_t du, size_t dw, @@ -4625,7 +4587,7 @@ ELSE: d, du, dw, x, batchCount, pBuffer) check_status(status) - + cpdef void zgpsvInterleavedBatch( intptr_t handle, int algo, int m, size_t ds, size_t dl, size_t d, size_t du, size_t dw, @@ -4638,10 +4600,10 @@ ELSE: dw, x, batchCount, pBuffer) check_status(status) - + ############################################################ # Sparse Vector APIs - + cpdef size_t createSpVec(int64_t size, int64_t nnz, intptr_t indices, intptr_t values, IndexType idxType, IndexBase idxBase, DataType valueType) except? -1: @@ -4650,11 +4612,11 @@ ELSE: values, idxType, idxBase, valueType) check_status(status) return desc - + cpdef void destroySpVec(size_t desc) except *: status = cusparseDestroySpVec(desc) check_status(status) - + cpdef SpVecAttributes spVecGet(size_t desc): cdef int64_t size, nnz cdef intptr_t indices, values @@ -4667,26 +4629,26 @@ ELSE: check_status(status) return SpVecAttributes(size, nnz, indices, values, idxType, idxBase, valueType) - + cpdef int spVecGetIndexBase(size_t desc) except? -1: cdef IndexBase idxBase status = cusparseSpVecGetIndexBase(desc, &idxBase) check_status(status) return idxBase - + cpdef intptr_t spVecGetValues(size_t desc) except? -1: cdef intptr_t values status = cusparseSpVecGetValues(desc, &values) check_status(status) return values - + cpdef void spVecSetValues(size_t desc, intptr_t values) except *: status = cusparseSpVecSetValues(desc, values) check_status(status) - + ############################################################ # Sparse Matrix APIs - + cpdef size_t createCoo(int64_t rows, int64_t cols, int64_t nnz, intptr_t cooRowInd, intptr_t cooColInd, intptr_t cooValues, IndexType cooIdxType, @@ -4697,7 +4659,7 @@ ELSE: cooIdxType, idxBase, valueType) check_status(status) return desc - + cpdef size_t createCooAoS(int64_t rows, int64_t cols, int64_t nnz, intptr_t cooInd, intptr_t cooValues, IndexType cooIdxType, IndexBase idxBase, @@ -4708,7 +4670,7 @@ ELSE: valueType) check_status(status) return desc - + cpdef size_t createCsr(int64_t rows, int64_t cols, int64_t nnz, intptr_t csrRowOffsets, intptr_t csrColind, intptr_t csrValues, IndexType csrRowOffsetsType, @@ -4721,7 +4683,7 @@ ELSE: csrColIndType, idxBase, valueType) check_status(status) return desc - + cpdef size_t createCsc(int64_t rows, int64_t cols, int64_t nnz, intptr_t cscColOffsets, intptr_t cscRowInd, intptr_t cscValues, IndexType cscColOffsetsType, @@ -4734,11 +4696,11 @@ ELSE: cscRowIndType, idxBase, valueType) check_status(status) return desc - + cpdef void destroySpMat(size_t desc) except *: status = cusparseDestroySpMat(desc) check_status(status) - + cpdef CooAttributes cooGet(size_t desc): cdef int64_t rows, cols, nnz cdef intptr_t rowInd, colInd, values, @@ -4751,7 +4713,7 @@ ELSE: check_status(status) return CooAttributes(rows, cols, nnz, rowInd, colInd, values, idxType, idxBase, valueType) - + cpdef CooAoSAttributes cooAoSGet(size_t desc): cdef int64_t rows, cols, nnz cdef intptr_t ind, values, @@ -4764,7 +4726,7 @@ ELSE: check_status(status) return CooAoSAttributes(rows, cols, nnz, ind, values, idxType, idxBase, valueType) - + cpdef CsrAttributes csrGet(size_t desc): cdef int64_t rows, cols, nnz cdef intptr_t rowOffsets, colInd, values, @@ -4778,66 +4740,66 @@ ELSE: check_status(status) return CsrAttributes(rows, cols, nnz, rowOffsets, colInd, values, rowOffsetsType, colIndType, idxBase, valueType) - + cpdef void csrSetPointers( size_t desc, size_t csrRowOffsets, size_t csrColInd, size_t csrValues) except *: status = cusparseCsrSetPointers(desc, csrRowOffsets, csrColInd, csrValues) check_status(status) - + cpdef int spMatGetFormat(size_t desc) except? -1: cdef Format format status = cusparseSpMatGetFormat(desc, &format) check_status(status) return format - + cpdef int spMatGetIndexBase(size_t desc) except? -1: cdef IndexBase idxBase status = cusparseSpMatGetIndexBase(desc, &idxBase) check_status(status) return idxBase - + cpdef intptr_t spMatGetValues(size_t desc) except? -1: cdef intptr_t values status = cusparseSpMatGetValues(desc, &values) check_status(status) return values - + cpdef void spMatSetValues(size_t desc, intptr_t values) except *: status = cusparseSpMatSetValues(desc, values) check_status(status) - + cpdef void spMatGetSize( size_t desc, size_t rows, size_t cols, size_t nnz) except *: status = cusparseSpMatGetSize(desc, rows, cols, nnz) check_status(status) - + cpdef int spMatGetStridedBatch(size_t desc) except? -1: cdef int batchCount status = cusparseSpMatGetStridedBatch(desc, &batchCount) check_status(status) return batchCount - + cpdef void spMatSetStridedBatch(size_t desc, int batchCount) except *: status = cusparseSpMatSetStridedBatch(desc, batchCount) check_status(status) - + ############################################################ # Dense Vector APIs - + cpdef size_t createDnVec(int64_t size, intptr_t values, DataType valueType) except? -1: cdef DnVecDescr desc status = cusparseCreateDnVec(&desc, size, values, valueType) check_status(status) return desc - + cpdef void destroyDnVec(size_t desc) except *: status = cusparseDestroyDnVec(desc) check_status(status) - + cpdef DnVecAttributes dnVecGet(size_t desc): cdef int64_t size cdef intptr_t values @@ -4846,20 +4808,20 @@ ELSE: &valueType) check_status(status) return DnVecAttributes(size, values, valueType) - + cpdef intptr_t dnVecGetValues(size_t desc) except? -1: cdef intptr_t values status = cusparseDnVecGetValues(desc, &values) check_status(status) return values - + cpdef void dnVecSetValues(size_t desc, intptr_t values) except *: status = cusparseDnVecSetValues(desc, values) check_status(status) - + ############################################################ # Dense Matrix APIs - + cpdef size_t createDnMat(int64_t rows, int64_t cols, int64_t ld, intptr_t values, DataType valueType, Order order) except? -1: @@ -4868,11 +4830,11 @@ ELSE: valueType, order) check_status(status) return desc - + cpdef void destroyDnMat(size_t desc) except *: status = cusparseDestroyDnMat(desc) check_status(status) - + cpdef DnMatAttributes dnMatGet(size_t desc): cdef int64_t rows, cols, ld cdef intptr_t values, @@ -4882,17 +4844,17 @@ ELSE: &values, &valueType, &order) check_status(status) return DnMatAttributes(rows, cols, ld, values, valueType, order) - + cpdef intptr_t dnMatGetValues(size_t desc) except? -1: cdef intptr_t values status = cusparseDnMatGetValues(desc, &values) check_status(status) return values - + cpdef void dnMatSetValues(size_t desc, intptr_t values) except *: status = cusparseDnMatSetValues(desc, values) check_status(status) - + cpdef DnMatBatchAttributes dnMatGetStridedBatch(size_t desc): cdef int batchCount cdef int64_t batchStride @@ -4900,16 +4862,16 @@ ELSE: &batchStride) check_status(status) return DnMatBatchAttributes(batchCount, batchStride) - + cpdef void dnMatSetStridedBatch( size_t desc, int batchCount, int64_t batchStride) except *: status = cusparseDnMatSetStridedBatch(desc, batchCount, batchStride) check_status(status) - + ############################################################ # Generic API Functions - + cpdef size_t spVV_bufferSize(intptr_t handle, Operation opX, size_t vecX, size_t vecY, intptr_t result, DataType computeType) except? -1: @@ -4919,7 +4881,7 @@ ELSE: result, computeType, &bufferSize) check_status(status) return bufferSize - + cpdef void spVV( intptr_t handle, Operation opX, size_t vecX, size_t vecY, intptr_t result, DataType computeType, @@ -4929,7 +4891,7 @@ ELSE: vecY, result, computeType, externalBuffer) check_status(status) - + cpdef size_t spMV_bufferSize(intptr_t handle, Operation opA, intptr_t alpha, size_t matA, size_t vecX, intptr_t beta, size_t vecY, DataType computeType, @@ -4941,7 +4903,7 @@ ELSE: computeType, alg, &bufferSize) check_status(status) return bufferSize - + cpdef void spMV( intptr_t handle, Operation opA, intptr_t alpha, size_t matA, size_t vecX, intptr_t beta, size_t vecY, DataType computeType, @@ -4951,17 +4913,17 @@ ELSE: vecX, beta, vecY, computeType, alg, externalBuffer) check_status(status) - + cpdef size_t spSM_createDescr() except? -1: cdef SpSMDescr descr status = cusparseSpSM_createDescr(&descr) check_status(status) return descr - + cpdef void spSM_destroyDescr(size_t descr) except *: status = cusparseSpSM_destroyDescr(descr) check_status(status) - + cpdef size_t spSM_bufferSize(intptr_t handle, Operation opA, Operation opB, intptr_t alpha, size_t matA, size_t matB, size_t matC, DataType computeType, SpSMAlg alg, @@ -4973,7 +4935,7 @@ ELSE: spsmDescr, &bufferSize) check_status(status) return bufferSize - + cpdef void spSM_analysis( intptr_t handle, Operation opA, Operation opB, intptr_t alpha, size_t matA, size_t matB, size_t matC, @@ -4985,7 +4947,7 @@ ELSE: matC, computeType, alg, spsmDescr, externalBuffer) check_status(status) - + cpdef void spSM_solve( intptr_t handle, Operation opA, Operation opB, intptr_t alpha, size_t matA, size_t matB, size_t matC, DataType computeType, @@ -5005,7 +4967,7 @@ ELSE: matC, computeType, alg, spsmDescr) check_status(status) - + cpdef size_t spMM_bufferSize(intptr_t handle, Operation opA, Operation opB, intptr_t alpha, size_t matA, size_t matB, intptr_t beta, size_t matC, DataType computeType, @@ -5017,7 +4979,7 @@ ELSE: computeType, alg, &bufferSize) check_status(status) return bufferSize - + cpdef void spMM( intptr_t handle, Operation opA, Operation opB, intptr_t alpha, size_t matA, size_t matB, intptr_t beta, size_t matC, @@ -5028,7 +4990,7 @@ ELSE: matC, computeType, alg, externalBuffer) check_status(status) - + cpdef size_t constrainedGeMM_bufferSize(intptr_t handle, Operation opA, Operation opB, intptr_t alpha, size_t matA, size_t matB, @@ -5041,7 +5003,7 @@ ELSE: &bufferSize) check_status(status) return bufferSize - + cpdef void constrainedGeMM( intptr_t handle, Operation opA, Operation opB, intptr_t alpha, size_t matA, size_t matB, intptr_t beta, @@ -5053,17 +5015,17 @@ ELSE: matB, beta, matC, computeType, externalBuffer) check_status(status) - + cpdef size_t spGEMM_createDescr() except? -1: cdef SpGEMMDescr descr status = cusparseSpGEMM_createDescr(&descr) check_status(status) return descr - + cpdef void spGEMM_destroyDescr(size_t descr) except *: status = cusparseSpGEMM_destroyDescr(descr) check_status(status) - + cpdef size_t spGEMM_workEstimation( intptr_t handle, Operation opA, Operation opB, intptr_t alpha, size_t matA, size_t matB, intptr_t beta, size_t matC, @@ -5077,7 +5039,7 @@ ELSE: externalBuffer1) check_status(status) return bufferSize1 - + cpdef size_t spGEMM_compute( intptr_t handle, Operation opA, Operation opB, intptr_t alpha, size_t matA, size_t matB, intptr_t beta, size_t matC, @@ -5091,7 +5053,7 @@ ELSE: externalBuffer2) check_status(status) return bufferSize2 - + cpdef void spGEMM_copy( intptr_t handle, Operation opA, Operation opB, intptr_t alpha, size_t matA, size_t matB, intptr_t beta, size_t matC, @@ -5101,11 +5063,11 @@ ELSE: matB, beta, matC, computeType, alg, spgemmDescr) check_status(status) - + cpdef void gather(intptr_t handle, size_t vecY, size_t vecX) except *: status = cusparseGather(handle, vecY, vecX) check_status(status) - + cpdef size_t sparseToDense_bufferSize(intptr_t handle, size_t matA, size_t matB, int alg) except? -1: cdef size_t bufferSize @@ -5114,7 +5076,7 @@ ELSE: alg, &bufferSize) check_status(status) return bufferSize - + cpdef void sparseToDense( intptr_t handle, size_t matA, size_t matB, int alg, intptr_t buffer) except *: @@ -5123,7 +5085,7 @@ ELSE: handle, matA, matB, alg, buffer) check_status(status) - + cpdef size_t denseToSparse_bufferSize(intptr_t handle, size_t matA, size_t matB, int alg) except? -1: cdef size_t bufferSize @@ -5132,7 +5094,7 @@ ELSE: alg, &bufferSize) check_status(status) return bufferSize - + cpdef void denseToSparse_analysis( intptr_t handle, size_t matA, size_t matB, int alg, intptr_t buffer) except *: @@ -5141,7 +5103,7 @@ ELSE: handle, matA, matB, alg, buffer) check_status(status) - + cpdef void denseToSparse_convert( intptr_t handle, size_t matA, size_t matB, int alg, intptr_t buffer) except *: @@ -5150,7 +5112,7 @@ ELSE: handle, matA, matB, alg, buffer) check_status(status) - + # CSR2CSC cpdef size_t csr2cscEx2_bufferSize( intptr_t handle, int m, int n, int nnz, intptr_t csrVal, @@ -5164,7 +5126,7 @@ ELSE: valType, copyValues, idxBase, alg, &bufferSize) check_status(status) return bufferSize - + cpdef void csr2cscEx2( intptr_t handle, int m, int n, int nnz, intptr_t csrVal, intptr_t csrRowPtr, intptr_t csrColInd, intptr_t cscVal, From 48e3497cf5a5c4597368ca9d0adfa65977e8a5e1 Mon Sep 17 00:00:00 2001 From: bmedishe Date: Tue, 21 May 2024 16:18:04 +0000 Subject: [PATCH 21/30] add more version checks --- cupy_backends/hip/cupy_hipsparse.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cupy_backends/hip/cupy_hipsparse.h b/cupy_backends/hip/cupy_hipsparse.h index 7c99c3caeaf..574bf8eba16 100644 --- a/cupy_backends/hip/cupy_hipsparse.h +++ b/cupy_backends/hip/cupy_hipsparse.h @@ -23,6 +23,18 @@ typedef void* bsrilu02Info_t; #endif typedef enum {} cusparseAlgMode_t; +#if HIP_VERSION < 600 +// Error handling +const char* cusparseGetErrorName(...) { + // Unavailable in hipSparse; this should not be called + return "CUPY_HIPSPARSE_BINDING_UNEXPECTED_ERROR"; +} +const char* cusparseGetErrorString(...) { + // Unavailable in hipSparse; this should not be called + return "unexpected error in CuPy hipSparse binding"; +} +#endif + hipsparseStatus_t cusparseCsrmvEx_bufferSize(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } From cec6c0c4b8dc0c18cb51ffe51ee21cfb99c0f342 Mon Sep 17 00:00:00 2001 From: bmedishe Date: Tue, 21 May 2024 17:50:19 +0000 Subject: [PATCH 22/30] hipsparseCsr2CscAlg_t --- cupy_backends/hip/cupy_hipsparse.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cupy_backends/hip/cupy_hipsparse.h b/cupy_backends/hip/cupy_hipsparse.h index 574bf8eba16..29627ef070e 100644 --- a/cupy_backends/hip/cupy_hipsparse.h +++ b/cupy_backends/hip/cupy_hipsparse.h @@ -35,6 +35,11 @@ const char* cusparseGetErrorString(...) { } #endif +#if HIP_VERSION < 540 +typedef enum {} cusparseCsr2CscAlg_t; +#endif + + hipsparseStatus_t cusparseCsrmvEx_bufferSize(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } From f6e6e8a7ce0ea45a12af2487c7bd021247fa9d0e Mon Sep 17 00:00:00 2001 From: bmedishe Date: Tue, 21 May 2024 19:44:53 +0000 Subject: [PATCH 23/30] update cupy_backends/hip/cupy_hipsparse.h --- cupy_backends/hip/cupy_hipsparse.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cupy_backends/hip/cupy_hipsparse.h b/cupy_backends/hip/cupy_hipsparse.h index 29627ef070e..a859016519c 100644 --- a/cupy_backends/hip/cupy_hipsparse.h +++ b/cupy_backends/hip/cupy_hipsparse.h @@ -37,6 +37,12 @@ const char* cusparseGetErrorString(...) { #if HIP_VERSION < 540 typedef enum {} cusparseCsr2CscAlg_t; +hipsparseStatus_t cusparseCsr2cscEx2_bufferSize(...) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} +hipsparseStatus_t cusparseCsr2cscEx2(...) { + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} #endif From 1be845c5c65349705c07c63879de21eacde1fb3e Mon Sep 17 00:00:00 2001 From: bmedishe Date: Tue, 21 May 2024 21:20:50 +0000 Subject: [PATCH 24/30] flake8 E501 errors --- cupy_backends/cuda/libs/cusparse.pyx | 1186 +++++++++++++++++--------- 1 file changed, 788 insertions(+), 398 deletions(-) diff --git a/cupy_backends/cuda/libs/cusparse.pyx b/cupy_backends/cuda/libs/cusparse.pyx index 7837a9acb96..b1231600dfb 100644 --- a/cupy_backends/cuda/libs/cusparse.pyx +++ b/cupy_backends/cuda/libs/cusparse.pyx @@ -24,7 +24,8 @@ ELSE: ctypedef void* Stream 'cudaStream_t' # Version - cusparseStatus_t cusparseGetVersion(cusparseHandle_t handle, int* version) + cusparseStatus_t cusparseGetVersion(cusparseHandle_t handle, + int* version) # Error handling const char* cusparseGetErrorName(Status status) @@ -47,11 +48,13 @@ ELSE: # cuSPARSE Level1 Function Status cusparseSgthr( - Handle handle, int nnz, const float *y, float *xVal, const int *xInd, + Handle handle, int nnz, const float *y, float *xVal, + const int *xInd, IndexBase idxBase) Status cusparseDgthr( - Handle handle, int nnz, const double *y, double *xVal, const int *xInd, + Handle handle, int nnz, const double *y, double *xVal, + const int *xInd, IndexBase idxBase) Status cusparseCgthr( @@ -114,43 +117,51 @@ ELSE: Status cusparseDestroyCsrsv2Info(csrsv2Info_t info) Status cusparseScsrsv2_bufferSize( - Handle handle, Operation transA, int m, int nnz, const MatDescr descrA, + Handle handle, Operation transA, int m, int nnz, + const MatDescr descrA, float* csrSortedValA, const int* csrSortedRowPtrA, const int* csrSortedColIndA, csrsv2Info_t info, int* pBufferSizeInBytes) Status cusparseDcsrsv2_bufferSize( - Handle handle, Operation transA, int m, int nnz, const MatDescr descrA, + Handle handle, Operation transA, int m, int nnz, + const MatDescr descrA, double* csrSortedValA, const int* csrSortedRowPtrA, const int* csrSortedColIndA, csrsv2Info_t info, int* pBufferSizeInBytes) Status cusparseCcsrsv2_bufferSize( - Handle handle, Operation transA, int m, int nnz, const MatDescr descrA, + Handle handle, Operation transA, int m, int nnz, + const MatDescr descrA, cuComplex* csrSortedValA, const int* csrSortedRowPtrA, const int* csrSortedColIndA, csrsv2Info_t info, int* pBufferSizeInBytes) Status cusparseZcsrsv2_bufferSize( - Handle handle, Operation transA, int m, int nnz, const MatDescr descrA, + Handle handle, Operation transA, int m, int nnz, + const MatDescr descrA, cuDoubleComplex* csrSortedValA, const int* csrSortedRowPtrA, const int* csrSortedColIndA, csrsv2Info_t info, int* pBufferSizeInBytes) Status cusparseScsrsv2_analysis( - Handle handle, Operation transA, int m, int nnz, const MatDescr descrA, + Handle handle, Operation transA, int m, int nnz, + const MatDescr descrA, const float* csrSortedValA, const int* csrSortedRowPtrA, const int* csrSortedColIndA, csrsv2Info_t info, cusparseSolvePolicy_t policy, void* pBuffer) Status cusparseDcsrsv2_analysis( - Handle handle, Operation transA, int m, int nnz, const MatDescr descrA, + Handle handle, Operation transA, int m, int nnz, + const MatDescr descrA, const double* csrSortedValA, const int* csrSortedRowPtrA, const int* csrSortedColIndA, csrsv2Info_t info, cusparseSolvePolicy_t policy, void* pBuffer) Status cusparseCcsrsv2_analysis( - Handle handle, Operation transA, int m, int nnz, const MatDescr descrA, + Handle handle, Operation transA, int m, int nnz, + const MatDescr descrA, const cuComplex* csrSortedValA, const int* csrSortedRowPtrA, const int* csrSortedColIndA, csrsv2Info_t info, cusparseSolvePolicy_t policy, void* pBuffer) Status cusparseZcsrsv2_analysis( - Handle handle, Operation transA, int m, int nnz, const MatDescr descrA, + Handle handle, Operation transA, int m, int nnz, + const MatDescr descrA, const cuDoubleComplex* csrSortedValA, const int* csrSortedRowPtrA, const int* csrSortedColIndA, csrsv2Info_t info, cusparseSolvePolicy_t policy, void* pBuffer) @@ -190,7 +201,8 @@ ELSE: # cuSPARSE Level3 Function Status cusparseScsrmm( Handle handle, Operation transA, int m, int n, int k, int nnz, - const float *alpha, const MatDescr descrA, const float *csrSortedValA, + const float *alpha, const MatDescr descrA, + const float *csrSortedValA, const int *csrSortedRowPtrA, const int *csrSortedColIndA, const float *B, int ldb, const float *beta, float *C, int ldc) @@ -218,26 +230,32 @@ ELSE: const cuDoubleComplex *beta, cuDoubleComplex *C, int ldc) Status cusparseScsrmm2( - Handle handle, Operation transA, Operation transB, int m, int n, int k, + Handle handle, Operation transA, Operation transB, + int m, int n, int k, int nnz, const float *alpha, const MatDescr descrA, const float *csrValA, const int *csrRowPtrA, const int *csrColIndA, const float *B, int ldb, const float *beta, float *C, int ldc) Status cusparseDcsrmm2( - Handle handle, Operation transA, Operation transB, int m, int n, int k, + Handle handle, Operation transA, Operation transB, + int m, int n, int k, int nnz, const double *alpha, const MatDescr descrA, - const double *csrValA, const int *csrRowPtrA, const int *csrColIndA, + const double *csrValA, const int *csrRowPtrA, + const int *csrColIndA, const double *B, int ldb, const double *beta, double *C, int ldc) Status cusparseCcsrmm2( - Handle handle, Operation transA, Operation transB, int m, int n, int k, + Handle handle, Operation transA, Operation transB, + int m, int n, int k, int nnz, const cuComplex *alpha, const MatDescr descrA, - const cuComplex *csrValA, const int *csrRowPtrA, const int *csrColIndA, + const cuComplex *csrValA, const int *csrRowPtrA, + const int *csrColIndA, const cuComplex *B, int ldb, const cuComplex *beta, cuComplex *C, int ldc) Status cusparseZcsrmm2( - Handle handle, Operation transA, Operation transB, int m, int n, int k, + Handle handle, Operation transA, Operation transB, + int m, int n, int k, int nnz, const cuDoubleComplex *alpha, const MatDescr descrA, const cuDoubleComplex *csrValA, const int *csrRowPtrA, const int *csrColIndA, @@ -270,7 +288,8 @@ ELSE: size_t* pBufferSize) Status cusparseZcsrsm2_bufferSizeExt( Handle handle, int algo, Operation transA, Operation transB, int m, - int nrhs, int nnz, const cuDoubleComplex* alpha, const MatDescr descrA, + int nrhs, int nnz, const cuDoubleComplex* alpha, + const MatDescr descrA, const cuDoubleComplex* csrSortedValA, const int* csrSortedRowPtrA, const int* csrSortedColIndA, const cuDoubleComplex* B, int ldb, csrsm2Info_t info, cusparseSolvePolicy_t policy, @@ -299,7 +318,8 @@ ELSE: void* pBuffer) Status cusparseZcsrsm2_analysis( Handle handle, int algo, Operation transA, Operation transB, int m, - int nrhs, int nnz, const cuDoubleComplex* alpha, const MatDescr descrA, + int nrhs, int nnz, const cuDoubleComplex* alpha, + const MatDescr descrA, const cuDoubleComplex* csrSortedValA, const int* csrSortedRowPtrA, const int* csrSortedColIndA, const cuDoubleComplex* B, int ldb, csrsm2Info_t info, cusparseSolvePolicy_t policy, @@ -328,7 +348,8 @@ ELSE: void* pBuffer) Status cusparseZcsrsm2_solve( Handle handle, int algo, Operation transA, Operation transB, int m, - int nrhs, int nnz, const cuDoubleComplex* alpha, const MatDescr descrA, + int nrhs, int nnz, const cuDoubleComplex* alpha, + const MatDescr descrA, const cuDoubleComplex* csrSortedValA, const int* csrSortedRowPtrA, const int* csrSortedColIndA, cuDoubleComplex* B, int ldb, csrsm2Info_t info, cusparseSolvePolicy_t policy, @@ -340,12 +361,14 @@ ELSE: # cuSPARSE Extra Function Status cusparseXcsrgeamNnz( Handle handle, int m, int n, const MatDescr descrA, int nnzA, - const int *csrRowPtrA, const int *csrColIndA, const MatDescr descrB, + const int *csrRowPtrA, const int *csrColIndA, + const MatDescr descrB, int nnzB, const int *csrRowPtrB, const int *csrColIndB, const MatDescr descrC, int *csrRowPtrC, int *nnzTotalDevHostPtr) Status cusparseScsrgeam( - Handle handle, int m, int n, const float *alpha, const MatDescr descrA, + Handle handle, int m, int n, const float *alpha, + const MatDescr descrA, int nnzA, const float *csrValA, const int *csrRowPtrA, const int *csrColIndA, const float *beta, const MatDescr descrB, int nnzB, const float *csrValB, const int *csrRowPtrB, @@ -365,7 +388,8 @@ ELSE: Handle handle, int m, int n, const cuComplex *alpha, const MatDescr descrA, int nnzA, const cuComplex *csrValA, const int *csrRowPtrA, - const int *csrColIndA, const cuComplex *beta, const MatDescr descrB, + const int *csrColIndA, const cuComplex *beta, + const MatDescr descrB, int nnzB, const cuComplex *csrValB, const int *csrRowPtrB, const int *csrColIndB, const MatDescr descrC, cuComplex *csrValC, int *csrRowPtrC, int *csrColIndC) @@ -381,7 +405,8 @@ ELSE: cuDoubleComplex *csrValC, int *csrRowPtrC, int *csrColIndC) Status cusparseScsrgeam2_bufferSizeExt( - Handle handle, int m, int n, const float *alpha, const MatDescr descrA, + Handle handle, int m, int n, const float *alpha, + const MatDescr descrA, int nnzA, const float *csrValA, const int *csrRowPtrA, const int *csrColIndA, const float *beta, const MatDescr descrB, int nnzB, const float *csrValB, const int *csrRowPtrB, @@ -401,7 +426,8 @@ ELSE: Handle handle, int m, int n, const cuComplex *alpha, const MatDescr descrA, int nnzA, const cuComplex *csrValA, const int *csrRowPtrA, - const int *csrColIndA, const cuComplex *beta, const MatDescr descrB, + const int *csrColIndA, const cuComplex *beta, + const MatDescr descrB, int nnzB, const cuComplex *csrValB, const int *csrRowPtrB, const int *csrColIndB, const MatDescr descrC, cuComplex *csrValC, int *csrRowPtrC, int *csrColIndC, size_t *pBufferSize) @@ -419,13 +445,15 @@ ELSE: Status cusparseXcsrgeam2Nnz( Handle handle, int m, int n, const MatDescr descrA, int nnzA, - const int *csrRowPtrA, const int *csrColIndA, const MatDescr descrB, + const int *csrRowPtrA, const int *csrColIndA, + const MatDescr descrB, int nnzB, const int *csrRowPtrB, const int *csrColIndB, const MatDescr descrC, int *csrRowPtrC, int *nnzTotalDevHostPtr, void *workspace) Status cusparseScsrgeam2( - Handle handle, int m, int n, const float *alpha, const MatDescr descrA, + Handle handle, int m, int n, const float *alpha, + const MatDescr descrA, int nnzA, const float *csrValA, const int *csrRowPtrA, const int *csrColIndA, const float *beta, const MatDescr descrB, int nnzB, const float *csrValB, const int *csrRowPtrB, @@ -445,7 +473,8 @@ ELSE: Handle handle, int m, int n, const cuComplex *alpha, const MatDescr descrA, int nnzA, const cuComplex *csrValA, const int *csrRowPtrA, - const int *csrColIndA, const cuComplex *beta, const MatDescr descrB, + const int *csrColIndA, const cuComplex *beta, + const MatDescr descrB, int nnzB, const cuComplex *csrValB, const int *csrRowPtrB, const int *csrColIndB, const MatDescr descrC, cuComplex *csrValC, int *csrRowPtrC, int *csrColIndC, void *pBuffer) @@ -462,42 +491,54 @@ ELSE: void *pBuffer) Status cusparseXcsrgemmNnz( - Handle handle, Operation transA, Operation transB, int m, int n, int k, + Handle handle, Operation transA, Operation transB, + int m, int n, int k, const MatDescr descrA, const int nnzA, const int *csrRowPtrA, const int *csrColIndA, const MatDescr descrB, const int nnzB, const int *csrRowPtrB, const int *csrColIndB, const MatDescr descrC, int *csrRowPtrC, int *nnzTotalDevHostPtr) Status cusparseScsrgemm( - Handle handle, Operation transA, Operation transB, int m, int n, int k, + Handle handle, Operation transA, Operation transB, + int m, int n, int k, const MatDescr descrA, const int nnzA, const float *csrValA, - const int *csrRowPtrA, const int *csrColIndA, const MatDescr descrB, + const int *csrRowPtrA, const int *csrColIndA, + const MatDescr descrB, const int nnzB, const float *csrValB, const int *csrRowPtrB, const int *csrColIndB, const MatDescr descrC, float *csrValC, const int *csrRowPtrC, int *csrColIndC) Status cusparseDcsrgemm( - Handle handle, Operation transA, Operation transB, int m, int n, int k, + Handle handle, Operation transA, Operation transB, + int m, int n, int k, const MatDescr descrA, const int nnzA, const double *csrValA, - const int *csrRowPtrA, const int *csrColIndA, const MatDescr descrB, + const int *csrRowPtrA, const int *csrColIndA, + const MatDescr descrB, const int nnzB, const double *csrValB, const int *csrRowPtrB, const int *csrColIndB, const MatDescr descrC, double *csrValC, const int *csrRowPtrC, int *csrColIndC) Status cusparseCcsrgemm( - Handle handle, Operation transA, Operation transB, int m, int n, int k, + Handle handle, Operation transA, Operation transB, + int m, int n, int k, const MatDescr descrA, const int nnzA, const cuComplex *csrValA, - const int *csrRowPtrA, const int *csrColIndA, const MatDescr descrB, + const int *csrRowPtrA, const int *csrColIndA, + const MatDescr descrB, const int nnzB, const cuComplex *csrValB, const int *csrRowPtrB, const int *csrColIndB, const MatDescr descrC, cuComplex *csrValC, const int *csrRowPtrC, int *csrColIndC) Status cusparseZcsrgemm( - Handle handle, Operation transA, Operation transB, int m, int n, int k, - const MatDescr descrA, const int nnzA, const cuDoubleComplex *csrValA, - const int *csrRowPtrA, const int *csrColIndA, const MatDescr descrB, - const int nnzB, const cuDoubleComplex *csrValB, const int *csrRowPtrB, - const int *csrColIndB, const MatDescr descrC, cuDoubleComplex *csrValC, + Handle handle, Operation transA, Operation transB, + int m, int n, int k, + const MatDescr descrA, const int nnzA, + const cuDoubleComplex *csrValA, + const int *csrRowPtrA, const int *csrColIndA, + const MatDescr descrB, + const int nnzB, const cuDoubleComplex *csrValB, + const int *csrRowPtrB, + const int *csrColIndB, const MatDescr descrC, + cuDoubleComplex *csrValC, const int *csrRowPtrC, int *csrColIndC) cusparseStatus_t cusparseCreateCsrgemm2Info(csrgemm2Info_t *info) @@ -509,7 +550,8 @@ ELSE: const int *csrColIndA, const MatDescr descrB, int nnzB, const int *csrRowPtrB, const int *csrColIndB, const float *beta, const MatDescr descrD, int nnzD, const int *csrRowPtrD, - const int *csrColIndD, const csrgemm2Info_t info, size_t* pBufferSize) + const int *csrColIndD, const csrgemm2Info_t info, + size_t* pBufferSize) Status cusparseDcsrgemm2_bufferSizeExt( Handle handle, int m, int n, int k, const double *alpha, @@ -517,15 +559,18 @@ ELSE: const int *csrColIndA, const MatDescr descrB, int nnzB, const int *csrRowPtrB, const int *csrColIndB, const double *beta, const MatDescr descrD, int nnzD, const int *csrRowPtrD, - const int *csrColIndD, const csrgemm2Info_t info, size_t* pBufferSize) + const int *csrColIndD, const csrgemm2Info_t info, + size_t* pBufferSize) Status cusparseCcsrgemm2_bufferSizeExt( Handle handle, int m, int n, int k, const cuComplex *alpha, const MatDescr descrA, int nnzA, const int *csrRowPtrA, const int *csrColIndA, const MatDescr descrB, int nnzB, - const int *csrRowPtrB, const int *csrColIndB, const cuComplex *beta, + const int *csrRowPtrB, const int *csrColIndB, + const cuComplex *beta, const MatDescr descrD, int nnzD, const int *csrRowPtrD, - const int *csrColIndD, const csrgemm2Info_t info, size_t* pBufferSize) + const int *csrColIndD, const csrgemm2Info_t info, + size_t* pBufferSize) Status cusparseZcsrgemm2_bufferSizeExt( Handle handle, int m, int n, int k, const cuDoubleComplex *alpha, @@ -537,8 +582,10 @@ ELSE: const csrgemm2Info_t info, size_t* pBufferSize) Status cusparseXcsrgemm2Nnz( - Handle handle, int m, int n, int k, const MatDescr descrA, int nnzA, - const int *csrRowPtrA, const int *csrColIndA, const MatDescr descrB, + Handle handle, int m, int n, int k, + const MatDescr descrA, int nnzA, + const int *csrRowPtrA, const int *csrColIndA, + const MatDescr descrB, int nnzB, const int *csrRowPtrB, const int *csrColIndB, const MatDescr descrD, int nnzD, const int *csrRowPtrD, const int *csrColIndD, const MatDescr descrC, int *csrRowPtrC, @@ -547,7 +594,8 @@ ELSE: Status cusparseScsrgemm2( Handle handle, int m, int n, int k, const float *alpha, const MatDescr descrA, int nnzA, const float *csrValA, - const int *csrRowPtrA, const int *csrColIndA, const MatDescr descrB, + const int *csrRowPtrA, const int *csrColIndA, + const MatDescr descrB, int nnzB, const float *csrValB, const int *csrRowPtrB, const int *csrColIndB, const float *beta, const MatDescr descrD, int nnzD, const float *csrValD, const int *csrRowPtrD, @@ -558,7 +606,8 @@ ELSE: Status cusparseDcsrgemm2( Handle handle, int m, int n, int k, const double *alpha, const MatDescr descrA, int nnzA, const double *csrValA, - const int *csrRowPtrA, const int *csrColIndA, const MatDescr descrB, + const int *csrRowPtrA, const int *csrColIndA, + const MatDescr descrB, int nnzB, const double *csrValB, const int *csrRowPtrB, const int *csrColIndB, const double *beta, const MatDescr descrD, int nnzD, const double *csrValD, const int *csrRowPtrD, @@ -569,9 +618,11 @@ ELSE: Status cusparseCcsrgemm2( Handle handle, int m, int n, int k, const cuComplex *alpha, const MatDescr descrA, int nnzA, const cuComplex *csrValA, - const int *csrRowPtrA, const int *csrColIndA, const MatDescr descrB, + const int *csrRowPtrA, const int *csrColIndA, + const MatDescr descrB, int nnzB, const cuComplex *csrValB, const int *csrRowPtrB, - const int *csrColIndB, const cuComplex *beta, const MatDescr descrD, + const int *csrColIndB, const cuComplex *beta, + const MatDescr descrD, int nnzD, const cuComplex *csrValD, const int *csrRowPtrD, const int *csrColIndD, const MatDescr descrC, cuComplex *csrValC, const int *csrRowPtrC, int *csrColIndC, const csrgemm2Info_t info, @@ -580,17 +631,20 @@ ELSE: Status cusparseZcsrgemm2( Handle handle, int m, int n, int k, const cuDoubleComplex *alpha, const MatDescr descrA, int nnzA, const cuDoubleComplex *csrValA, - const int *csrRowPtrA, const int *csrColIndA, const MatDescr descrB, + const int *csrRowPtrA, const int *csrColIndA, + const MatDescr descrB, int nnzB, const cuDoubleComplex *csrValB, const int *csrRowPtrB, const int *csrColIndB, const cuDoubleComplex *beta, const MatDescr descrD, int nnzD, const cuDoubleComplex *csrValD, - const int *csrRowPtrD, const int *csrColIndD, const MatDescr descrC, + const int *csrRowPtrD, const int *csrColIndD, + const MatDescr descrC, cuDoubleComplex *csrValC, const int *csrRowPtrC, int *csrColIndC, const csrgemm2Info_t info, void* pBuffer) # cuSPARSE Format Convrsion Status cusparseXcoo2csr( - Handle handle, const int *cooRowInd, int nnz, int m, int *csrRowPtr, + Handle handle, const int *cooRowInd, int nnz, int m, + int *csrRowPtr, IndexBase idxBase) Status cusparseScsc2dense( @@ -614,28 +668,35 @@ ELSE: const int *cscSortedColPtrA, cuDoubleComplex *A, int lda) Status cusparseXcsr2coo( - Handle handle, const int *csrRowPtr, int nnz, int m, int *cooRowInd, + Handle handle, const int *csrRowPtr, int nnz, int m, + int *cooRowInd, IndexBase idxBase) Status cusparseScsr2csc( Handle handle, int m, int n, int nnz, const float *csrVal, const int *csrRowPtr, const int *csrColInd, float *cscVal, - int *cscRowInd, int *cscColPtr, Action copyValues, IndexBase idxBase) + int *cscRowInd, int *cscColPtr, Action copyValues, + IndexBase idxBase) Status cusparseDcsr2csc( Handle handle, int m, int n, int nnz, const double *csrVal, const int *csrRowPtr, const int *csrColInd, double *cscVal, - int *cscRowInd, int *cscColPtr, Action copyValues, IndexBase idxBase) + int *cscRowInd, int *cscColPtr, Action copyValues, + IndexBase idxBase) Status cusparseCcsr2csc( Handle handle, int m, int n, int nnz, const cuComplex *csrVal, const int *csrRowPtr, const int *csrColInd, cuComplex *cscVal, - int *cscRowInd, int *cscColPtr, Action copyValues, IndexBase idxBase) + int *cscRowInd, int *cscColPtr, Action copyValues, + IndexBase idxBase) Status cusparseZcsr2csc( - Handle handle, int m, int n, int nnz, const cuDoubleComplex *csrVal, - const int *csrRowPtr, const int *csrColInd, cuDoubleComplex *cscVal, - int *cscRowInd, int *cscColPtr, Action copyValues, IndexBase idxBase) + Handle handle, int m, int n, int nnz, + const cuDoubleComplex *csrVal, + const int *csrRowPtr, const int *csrColInd, + cuDoubleComplex *cscVal, + int *cscRowInd, int *cscColPtr, Action copyValues, + IndexBase idxBase) Status cusparseScsr2dense( Handle handle, int m, int n, const MatDescr descrA, @@ -697,8 +758,10 @@ ELSE: Status cusparseZcsr2csr_compress( Handle handle, int m, int n, const MatDescr descrA, - const cuDoubleComplex *inVal, const int *inColInd, const int *inRowPtr, - int inNnz, int *nnzPerRow, cuDoubleComplex *outVal, int *outColInd, + const cuDoubleComplex *inVal, const int *inColInd, + const int *inRowPtr, + int inNnz, int *nnzPerRow, cuDoubleComplex *outVal, + int *outColInd, int *outRowPtr, cuDoubleComplex tol) Status cusparseSdense2csc( @@ -707,12 +770,14 @@ ELSE: int *cscColPtrA) Status cusparseDdense2csc( - Handle handle, int m, int n, const MatDescr descrA, const double *A, + Handle handle, int m, int n, const MatDescr descrA, + const double *A, int lda, const int *nnzPerCol, double *cscValA, int *cscRowIndA, int *cscColPtrA) Status cusparseCdense2csc( - Handle handle, int m, int n, const MatDescr descrA, const cuComplex *A, + Handle handle, int m, int n, const MatDescr descrA, + const cuComplex *A, int lda, const int *nnzPerCol, cuComplex *cscValA, int *cscRowIndA, int *cscColPtrA) @@ -734,7 +799,8 @@ ELSE: Status cusparseCdense2csr( Handle handle, int m, int n, const MatDescr descrA, - const cuComplex *A, int lda, const int *nnzPerRow, cuComplex *csrValA, + const cuComplex *A, int lda, const int *nnzPerRow, + cuComplex *csrValA, int *csrRowPtrA, int *csrColIndA) Status cusparseZdense2csr( @@ -745,7 +811,8 @@ ELSE: Status cusparseSnnz( Handle handle, Direction dirA, int m, int n, const MatDescr descrA, - const float *A, int lda, int *nnzPerRowColumn, int *nnzTotalDevHostPtr) + const float *A, int lda, int *nnzPerRowColumn, + int *nnzTotalDevHostPtr) Status cusparseDnnz( Handle handle, Direction dirA, int m, int n, const MatDescr descrA, @@ -853,7 +920,8 @@ ELSE: csrilu02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) cusparseStatus_t cusparseZcsrilu02_analysis( cusparseHandle_t handle, int m, int nnz, - const cusparseMatDescr_t descrA, const cuDoubleComplex *csrSortedValA, + const cusparseMatDescr_t descrA, + const cuDoubleComplex *csrSortedValA, const int *csrSortedRowPtrA, const int *csrSortedColIndA, csrilu02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) cusparseStatus_t cusparseScsrilu02( @@ -873,7 +941,8 @@ ELSE: csrilu02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) cusparseStatus_t cusparseZcsrilu02( cusparseHandle_t handle, int m, int nnz, - const cusparseMatDescr_t descrA, cuDoubleComplex *csrSortedValA_valM, + const cusparseMatDescr_t descrA, + cuDoubleComplex *csrSortedValA_valM, const int *csrSortedRowPtrA, const int *csrSortedColIndA, csrilu02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) cusparseStatus_t cusparseSbsrilu02_numericBoost( @@ -891,64 +960,88 @@ ELSE: cusparseStatus_t cusparseXbsrilu02_zeroPivot( cusparseHandle_t handle, bsrilu02Info_t info, int *position) cusparseStatus_t cusparseSbsrilu02_bufferSize( - cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, + cusparseHandle_t handle, cusparseDirection_t dirA, + int mb, int nnzb, const cusparseMatDescr_t descrA, float *bsrSortedVal, - const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, + const int *bsrSortedRowPtr, const int *bsrSortedColInd, + int blockDim, bsrilu02Info_t info, int *pBufferSizeInBytes) cusparseStatus_t cusparseDbsrilu02_bufferSize( - cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, + cusparseHandle_t handle, cusparseDirection_t dirA, int mb, + int nnzb, const cusparseMatDescr_t descrA, double *bsrSortedVal, - const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, + const int *bsrSortedRowPtr, const int *bsrSortedColInd, + int blockDim, bsrilu02Info_t info, int *pBufferSizeInBytes) cusparseStatus_t cusparseCbsrilu02_bufferSize( - cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, + cusparseHandle_t handle, cusparseDirection_t dirA, int mb, + int nnzb, const cusparseMatDescr_t descrA, cuComplex *bsrSortedVal, - const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, + const int *bsrSortedRowPtr, const int *bsrSortedColInd, + int blockDim, bsrilu02Info_t info, int *pBufferSizeInBytes) cusparseStatus_t cusparseZbsrilu02_bufferSize( - cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, + cusparseHandle_t handle, cusparseDirection_t dirA, int mb, + int nnzb, const cusparseMatDescr_t descrA, cuDoubleComplex *bsrSortedVal, - const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, + const int *bsrSortedRowPtr, const int *bsrSortedColInd, + int blockDim, bsrilu02Info_t info, int *pBufferSizeInBytes) cusparseStatus_t cusparseSbsrilu02_analysis( - cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, + cusparseHandle_t handle, cusparseDirection_t dirA, int mb, + int nnzb, const cusparseMatDescr_t descrA, float *bsrSortedVal, - const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, + const int *bsrSortedRowPtr, const int *bsrSortedColInd, + int blockDim, bsrilu02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) cusparseStatus_t cusparseDbsrilu02_analysis( - cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, + cusparseHandle_t handle, cusparseDirection_t dirA, int mb, + int nnzb, const cusparseMatDescr_t descrA, double *bsrSortedVal, - const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, + const int *bsrSortedRowPtr, const int *bsrSortedColInd, + int blockDim, bsrilu02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) cusparseStatus_t cusparseCbsrilu02_analysis( - cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, + cusparseHandle_t handle, cusparseDirection_t dirA, int mb, + int nnzb, const cusparseMatDescr_t descrA, cuComplex *bsrSortedVal, - const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, + const int *bsrSortedRowPtr, const int *bsrSortedColInd, + int blockDim, bsrilu02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) cusparseStatus_t cusparseZbsrilu02_analysis( - cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, + cusparseHandle_t handle, cusparseDirection_t dirA, int mb, + int nnzb, const cusparseMatDescr_t descrA, cuDoubleComplex *bsrSortedVal, - const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, + const int *bsrSortedRowPtr, const int *bsrSortedColInd, + int blockDim, bsrilu02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) cusparseStatus_t cusparseSbsrilu02( - cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, + cusparseHandle_t handle, cusparseDirection_t dirA, int mb, + int nnzb, const cusparseMatDescr_t descrA, float *bsrSortedVal, - const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, + const int *bsrSortedRowPtr, const int *bsrSortedColInd, + int blockDim, bsrilu02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) cusparseStatus_t cusparseDbsrilu02( - cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, + cusparseHandle_t handle, cusparseDirection_t dirA, int mb, + int nnzb, const cusparseMatDescr_t descrA, double *bsrSortedVal, - const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, + const int *bsrSortedRowPtr, const int *bsrSortedColInd, + int blockDim, bsrilu02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) cusparseStatus_t cusparseCbsrilu02( - cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, + cusparseHandle_t handle, cusparseDirection_t dirA, int mb, + int nnzb, const cusparseMatDescr_t descrA, cuComplex *bsrSortedVal, - const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, + const int *bsrSortedRowPtr, const int *bsrSortedColInd, + int blockDim, bsrilu02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) cusparseStatus_t cusparseZbsrilu02( - cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, + cusparseHandle_t handle, cusparseDirection_t dirA, int mb, + int nnzb, const cusparseMatDescr_t descrA, cuDoubleComplex *bsrSortedVal, - const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, + const int *bsrSortedRowPtr, const int *bsrSortedColInd, + int blockDim, bsrilu02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) cusparseStatus_t cusparseXcsric02_zeroPivot( cusparseHandle_t handle, csric02Info_t info, int *position) @@ -989,7 +1082,8 @@ ELSE: csric02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) cusparseStatus_t cusparseZcsric02_analysis( cusparseHandle_t handle, int m, int nnz, - const cusparseMatDescr_t descrA, const cuDoubleComplex *csrSortedValA, + const cusparseMatDescr_t descrA, + const cuDoubleComplex *csrSortedValA, const int *csrSortedRowPtrA, const int *csrSortedColIndA, csric02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) cusparseStatus_t cusparseScsric02( @@ -1009,121 +1103,163 @@ ELSE: csric02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) cusparseStatus_t cusparseZcsric02( cusparseHandle_t handle, int m, int nnz, - const cusparseMatDescr_t descrA, cuDoubleComplex *csrSortedValA_valM, + const cusparseMatDescr_t descrA, + cuDoubleComplex *csrSortedValA_valM, const int *csrSortedRowPtrA, const int *csrSortedColIndA, csric02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) cusparseStatus_t cusparseXbsric02_zeroPivot( cusparseHandle_t handle, bsric02Info_t info, int *position) cusparseStatus_t cusparseSbsric02_bufferSize( - cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, + cusparseHandle_t handle, cusparseDirection_t dirA, int mb, + int nnzb, const cusparseMatDescr_t descrA, float *bsrSortedVal, - const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, + const int *bsrSortedRowPtr, const int *bsrSortedColInd, + int blockDim, bsric02Info_t info, int *pBufferSizeInBytes) cusparseStatus_t cusparseDbsric02_bufferSize( - cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, + cusparseHandle_t handle, cusparseDirection_t dirA, int mb, + int nnzb, const cusparseMatDescr_t descrA, double *bsrSortedVal, - const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, + const int *bsrSortedRowPtr, const int *bsrSortedColInd, + int blockDim, bsric02Info_t info, int *pBufferSizeInBytes) cusparseStatus_t cusparseCbsric02_bufferSize( - cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, + cusparseHandle_t handle, cusparseDirection_t dirA, int mb, + int nnzb, const cusparseMatDescr_t descrA, cuComplex *bsrSortedVal, - const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, + const int *bsrSortedRowPtr, const int *bsrSortedColInd, + int blockDim, bsric02Info_t info, int *pBufferSizeInBytes) cusparseStatus_t cusparseZbsric02_bufferSize( - cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, + cusparseHandle_t handle, cusparseDirection_t dirA, int mb, + int nnzb, const cusparseMatDescr_t descrA, cuDoubleComplex *bsrSortedVal, - const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, + const int *bsrSortedRowPtr, const int *bsrSortedColInd, + int blockDim, bsric02Info_t info, int *pBufferSizeInBytes) cusparseStatus_t cusparseSbsric02_analysis( - cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, + cusparseHandle_t handle, cusparseDirection_t dirA, int mb, + int nnzb, const cusparseMatDescr_t descrA, const float *bsrSortedVal, - const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, - bsric02Info_t info, cusparseSolvePolicy_t policy, void *pInputBuffer) + const int *bsrSortedRowPtr, const int *bsrSortedColInd, + int blockDim, + bsric02Info_t info, cusparseSolvePolicy_t policy, + void *pInputBuffer) cusparseStatus_t cusparseDbsric02_analysis( - cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, + cusparseHandle_t handle, cusparseDirection_t dirA, int mb, + int nnzb, const cusparseMatDescr_t descrA, const double *bsrSortedVal, - const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, - bsric02Info_t info, cusparseSolvePolicy_t policy, void *pInputBuffer) + const int *bsrSortedRowPtr, const int *bsrSortedColInd, + int blockDim, + bsric02Info_t info, cusparseSolvePolicy_t policy, + void *pInputBuffer) cusparseStatus_t cusparseCbsric02_analysis( - cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, + cusparseHandle_t handle, cusparseDirection_t dirA, int mb, + int nnzb, const cusparseMatDescr_t descrA, const cuComplex *bsrSortedVal, - const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, - bsric02Info_t info, cusparseSolvePolicy_t policy, void *pInputBuffer) + const int *bsrSortedRowPtr, const int *bsrSortedColInd, + int blockDim, + bsric02Info_t info, cusparseSolvePolicy_t policy, + void *pInputBuffer) cusparseStatus_t cusparseZbsric02_analysis( - cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, - const cusparseMatDescr_t descrA, const cuDoubleComplex *bsrSortedVal, - const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, - bsric02Info_t info, cusparseSolvePolicy_t policy, void *pInputBuffer) + cusparseHandle_t handle, cusparseDirection_t dirA, int mb, + int nnzb, + const cusparseMatDescr_t descrA, + const cuDoubleComplex *bsrSortedVal, + const int *bsrSortedRowPtr, const int *bsrSortedColInd, + int blockDim, + bsric02Info_t info, cusparseSolvePolicy_t policy, + void *pInputBuffer) cusparseStatus_t cusparseSbsric02( - cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, + cusparseHandle_t handle, cusparseDirection_t dirA, int mb, + int nnzb, const cusparseMatDescr_t descrA, float *bsrSortedVal, - const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, + const int *bsrSortedRowPtr, const int *bsrSortedColInd, + int blockDim, bsric02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) cusparseStatus_t cusparseDbsric02( - cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, + cusparseHandle_t handle, cusparseDirection_t dirA, int mb, + int nnzb, const cusparseMatDescr_t descrA, double *bsrSortedVal, - const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, + const int *bsrSortedRowPtr, const int *bsrSortedColInd, + int blockDim, bsric02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) cusparseStatus_t cusparseCbsric02( - cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, + cusparseHandle_t handle, cusparseDirection_t dirA, int mb, + int nnzb, const cusparseMatDescr_t descrA, cuComplex *bsrSortedVal, - const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, + const int *bsrSortedRowPtr, const int *bsrSortedColInd, + int blockDim, bsric02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) cusparseStatus_t cusparseZbsric02( - cusparseHandle_t handle, cusparseDirection_t dirA, int mb, int nnzb, + cusparseHandle_t handle, cusparseDirection_t dirA, int mb, + int nnzb, const cusparseMatDescr_t descrA, cuDoubleComplex *bsrSortedVal, - const int *bsrSortedRowPtr, const int *bsrSortedColInd, int blockDim, + const int *bsrSortedRowPtr, const int *bsrSortedColInd, + int blockDim, bsric02Info_t info, cusparseSolvePolicy_t policy, void *pBuffer) cusparseStatus_t cusparseSgtsv2_bufferSizeExt( - cusparseHandle_t handle, int m, int n, const float *dl, const float *d, - const float *du, const float *B, int ldb, size_t *bufferSizeInBytes) + cusparseHandle_t handle, int m, int n, const float *dl, + const float *d, + const float *du, const float *B, int ldb, + size_t *bufferSizeInBytes) cusparseStatus_t cusparseDgtsv2_bufferSizeExt( cusparseHandle_t handle, int m, int n, const double *dl, const double *d, const double *du, const double *B, int ldb, size_t *bufferSizeInBytes) cusparseStatus_t cusparseCgtsv2_bufferSizeExt( cusparseHandle_t handle, int m, int n, const cuComplex *dl, - const cuComplex *d, const cuComplex *du, const cuComplex *B, int ldb, + const cuComplex *d, const cuComplex *du, const cuComplex *B, + int ldb, size_t *bufferSizeInBytes) cusparseStatus_t cusparseZgtsv2_bufferSizeExt( cusparseHandle_t handle, int m, int n, const cuDoubleComplex *dl, const cuDoubleComplex *d, const cuDoubleComplex *du, const cuDoubleComplex *B, int ldb, size_t *bufferSizeInBytes) cusparseStatus_t cusparseSgtsv2( - cusparseHandle_t handle, int m, int n, const float *dl, const float *d, + cusparseHandle_t handle, int m, int n, const float *dl, + const float *d, const float *du, float *B, int ldb, void *pBuffer) cusparseStatus_t cusparseDgtsv2( cusparseHandle_t handle, int m, int n, const double *dl, - const double *d, const double *du, double *B, int ldb, void *pBuffer) + const double *d, const double *du, double *B, int ldb, + void *pBuffer) cusparseStatus_t cusparseCgtsv2(cusparseHandle_t handle, int m, int n, - const cuComplex *dl, const cuComplex *d, - const cuComplex *du, cuComplex *B, int ldb, + const cuComplex *dl, + const cuComplex *d, + const cuComplex *du, cuComplex *B, + int ldb, void *pBuffer) cusparseStatus_t cusparseZgtsv2( cusparseHandle_t handle, int m, int n, const cuDoubleComplex *dl, const cuDoubleComplex *d, const cuDoubleComplex *du, cuDoubleComplex *B, int ldb, void *pBuffer) cusparseStatus_t cusparseSgtsv2_nopivot_bufferSizeExt( - cusparseHandle_t handle, int m, int n, const float *dl, const float *d, - const float *du, const float *B, int ldb, size_t *bufferSizeInBytes) + cusparseHandle_t handle, int m, int n, const float *dl, + const float *d, + const float *du, const float *B, int ldb, + size_t *bufferSizeInBytes) cusparseStatus_t cusparseDgtsv2_nopivot_bufferSizeExt( cusparseHandle_t handle, int m, int n, const double *dl, const double *d, const double *du, const double *B, int ldb, size_t *bufferSizeInBytes) cusparseStatus_t cusparseCgtsv2_nopivot_bufferSizeExt( cusparseHandle_t handle, int m, int n, const cuComplex *dl, - const cuComplex *d, const cuComplex *du, const cuComplex *B, int ldb, + const cuComplex *d, const cuComplex *du, const cuComplex *B, + int ldb, size_t *bufferSizeInBytes) cusparseStatus_t cusparseZgtsv2_nopivot_bufferSizeExt( cusparseHandle_t handle, int m, int n, const cuDoubleComplex *dl, const cuDoubleComplex *d, const cuDoubleComplex *du, const cuDoubleComplex *B, int ldb, size_t *bufferSizeInBytes) cusparseStatus_t cusparseSgtsv2_nopivot( - cusparseHandle_t handle, int m, int n, const float *dl, const float *d, + cusparseHandle_t handle, int m, int n, const float *dl, + const float *d, const float *du, float *B, int ldb, void *pBuffer) cusparseStatus_t cusparseDgtsv2_nopivot( cusparseHandle_t handle, int m, int n, const double *dl, - const double *d, const double *du, double *B, int ldb, void *pBuffer) + const double *d, const double *du, double *B, int ldb, + void *pBuffer) cusparseStatus_t cusparseCgtsv2_nopivot( cusparseHandle_t handle, int m, int n, const cuComplex *dl, const cuComplex *d, const cuComplex *du, cuComplex *B, int ldb, @@ -1159,7 +1295,8 @@ ELSE: void *pBuffer) cusparseStatus_t cusparseCgtsv2StridedBatch( cusparseHandle_t handle, int m, const cuComplex *dl, - const cuComplex *d, const cuComplex *du, cuComplex *x, int batchCount, + const cuComplex *d, const cuComplex *du, cuComplex *x, + int batchCount, int batchStride, void *pBuffer) cusparseStatus_t cusparseZgtsv2StridedBatch( cusparseHandle_t handle, int m, const cuDoubleComplex *dl, @@ -1178,9 +1315,11 @@ ELSE: const cuComplex *d, const cuComplex *du, const cuComplex *x, int batchCount, size_t *pBufferSizeInBytes) cusparseStatus_t cusparseZgtsvInterleavedBatch_bufferSizeExt( - cusparseHandle_t handle, int algo, int m, const cuDoubleComplex *dl, + cusparseHandle_t handle, int algo, int m, + const cuDoubleComplex *dl, const cuDoubleComplex *d, const cuDoubleComplex *du, - const cuDoubleComplex *x, int batchCount, size_t *pBufferSizeInBytes) + const cuDoubleComplex *x, int batchCount, + size_t *pBufferSizeInBytes) cusparseStatus_t cusparseSgtsvInterleavedBatch( cusparseHandle_t handle, int algo, int m, float *dl, float *d, float *du, float *x, int batchCount, void *pBuffer) @@ -1188,7 +1327,8 @@ ELSE: cusparseHandle_t handle, int algo, int m, double *dl, double *d, double *du, double *x, int batchCount, void *pBuffer) cusparseStatus_t cusparseCgtsvInterleavedBatch( - cusparseHandle_t handle, int algo, int m, cuComplex *dl, cuComplex *d, + cusparseHandle_t handle, int algo, int m, cuComplex *dl, + cuComplex *d, cuComplex *du, cuComplex *x, int batchCount, void *pBuffer) cusparseStatus_t cusparseZgtsvInterleavedBatch( cusparseHandle_t handle, int algo, int m, cuDoubleComplex *dl, @@ -1200,7 +1340,8 @@ ELSE: const float *x, int batchCount, size_t *pBufferSizeInBytes) cusparseStatus_t cusparseDgpsvInterleavedBatch_bufferSizeExt( cusparseHandle_t handle, int algo, int m, const double *ds, - const double *dl, const double *d, const double *du, const double *dw, + const double *dl, const double *d, const double *du, + const double *dw, const double *x, int batchCount, size_t *pBufferSizeInBytes) cusparseStatus_t cusparseCgpsvInterleavedBatch_bufferSizeExt( cusparseHandle_t handle, int algo, int m, const cuComplex *ds, @@ -1208,10 +1349,12 @@ ELSE: const cuComplex *dw, const cuComplex *x, int batchCount, size_t *pBufferSizeInBytes) cusparseStatus_t cusparseZgpsvInterleavedBatch_bufferSizeExt( - cusparseHandle_t handle, int algo, int m, const cuDoubleComplex *ds, + cusparseHandle_t handle, int algo, int m, + const cuDoubleComplex *ds, const cuDoubleComplex *dl, const cuDoubleComplex *d, const cuDoubleComplex *du, const cuDoubleComplex *dw, - const cuDoubleComplex *x, int batchCount, size_t *pBufferSizeInBytes) + const cuDoubleComplex *x, int batchCount, + size_t *pBufferSizeInBytes) cusparseStatus_t cusparseSgpsvInterleavedBatch( cusparseHandle_t handle, int algo, int m, float *ds, float *dl, float *d, float *du, float *dw, float *x, int batchCount, @@ -1221,13 +1364,15 @@ ELSE: double *d, double *du, double *dw, double *x, int batchCount, void *pBuffer) cusparseStatus_t cusparseCgpsvInterleavedBatch( - cusparseHandle_t handle, int algo, int m, cuComplex *ds, cuComplex *dl, + cusparseHandle_t handle, int algo, int m, cuComplex *ds, + cuComplex *dl, cuComplex *d, cuComplex *du, cuComplex *dw, cuComplex *x, int batchCount, void *pBuffer) cusparseStatus_t cusparseZgpsvInterleavedBatch( cusparseHandle_t handle, int algo, int m, cuDoubleComplex *ds, cuDoubleComplex *dl, cuDoubleComplex *d, cuDoubleComplex *du, - cuDoubleComplex *dw, cuDoubleComplex *x, int batchCount, void *pBuffer) + cuDoubleComplex *dw, cuDoubleComplex *x, int batchCount, + void *pBuffer) # Sparse Vector APIs Status cusparseCreateSpVec(SpVecDescr* spVecDescr, int64_t size, @@ -1235,10 +1380,13 @@ ELSE: IndexType idxType, IndexBase idxBase, DataType valueType) Status cusparseDestroySpVec(SpVecDescr spVecDescr) - Status cusparseSpVecGet(SpVecDescr spVecDescr, int64_t* size, int64_t* nnz, - void** indices, void** values, IndexType* idxType, + Status cusparseSpVecGet(SpVecDescr spVecDescr, int64_t* size, + int64_t* nnz, + void** indices, void** values, + IndexType* idxType, IndexBase* idxBase, DataType* valueType) - Status cusparseSpVecGetIndexBase(SpVecDescr spVecDescr, IndexBase* idxBae) + Status cusparseSpVecGetIndexBase(SpVecDescr spVecDescr, + IndexBase* idxBae) Status cusparseSpVecGetValues(SpVecDescr spVecDescr, void** values) Status cusparseSpVecSetValues(SpVecDescr spVecDescr, void* values) @@ -1253,13 +1401,15 @@ ELSE: void* cooValues, IndexType cooIdxType, IndexBase idxBase, DataType valueType) Status cusparseCreateCsr(SpMatDescr* spMatDescr, int64_t rows, - int64_t cols, int64_t nnz, void* csrRowOffsets, + int64_t cols, int64_t nnz, + void* csrRowOffsets, void* csrColind, void* csrValues, IndexType csrRowOffsetsType, IndexType csrColIndType, IndexBase idxBase, DataType valueType) Status cusparseDestroySpMat(SpMatDescr spMatDescr) - Status cusparseCooGet(SpMatDescr spMatDescr, int64_t* rows, int64_t* cols, + Status cusparseCooGet(SpMatDescr spMatDescr, int64_t* rows, + int64_t* cols, int64_t* nnz, void** cooRowInd, void** cooColInd, void** cooValues, IndexType* idxType, IndexBase* idxBase, DataType* valueType) @@ -1267,21 +1417,27 @@ ELSE: int64_t* cols, int64_t* nnz, void** cooInd, void** cooValues, IndexType* idxType, IndexBase* idxBase, DataType* valueType) - Status cusparseCsrGet(SpMatDescr spMatDescr, int64_t* rows, int64_t* cols, - int64_t* nnz, void** csrRowOffsets, void** csrColInd, + Status cusparseCsrGet(SpMatDescr spMatDescr, int64_t* rows, + int64_t* cols, + int64_t* nnz, void** csrRowOffsets, + void** csrColInd, void** csrValues, IndexType* csrRowOffsetsType, IndexType* csrColIndType, IndexBase* idxBase, DataType* valueType) - Status cusparseCsrSetPointers(SpMatDescr spMatDescr, void* csrRowOffsets, + Status cusparseCsrSetPointers(SpMatDescr spMatDescr, + void* csrRowOffsets, void* csrColInd, void* csrValues) Status cusparseSpMatGetFormat(SpMatDescr spMatDescr, Format* format) - Status cusparseSpMatGetIndexBase(SpMatDescr spMatDescr, IndexBase* idxBase) + Status cusparseSpMatGetIndexBase(SpMatDescr spMatDescr, + IndexBase* idxBase) Status cusparseSpMatGetValues(SpMatDescr spMatDescr, void** values) Status cusparseSpMatSetValues(SpMatDescr spMatDescr, void* values) Status cusparseSpMatGetSize(SpMatDescr spMatDescr, int64_t* rows, int64_t* cols, int64_t* nnz) - Status cusparseSpMatGetStridedBatch(SpMatDescr spMatDescr, int* batchCount) - Status cusparseSpMatSetStridedBatch(SpMatDescr spMatDescr, int batchCount) + Status cusparseSpMatGetStridedBatch(SpMatDescr spMatDescr, + int* batchCount) + Status cusparseSpMatSetStridedBatch(SpMatDescr spMatDescr, + int batchCount) # Dense Vector APIs Status cusparseCreateDnVec(DnVecDescr *dnVecDescr, int64_t size, @@ -1302,9 +1458,11 @@ ELSE: DataType* valueType, Order* order) Status cusparseDnMatGetValues(DnMatDescr spMatDescr, void** values) Status cusparseDnMatSetValues(DnMatDescr spMatDescr, void* values) - Status cusparseDnMatGetStridedBatch(DnMatDescr dnMatDescr, int* batchCount, + Status cusparseDnMatGetStridedBatch(DnMatDescr dnMatDescr, + int* batchCount, int64_t *batchStride) - Status cusparseDnMatSetStridedBatch(DnMatDescr dnMatDescr, int batchCount, + Status cusparseDnMatSetStridedBatch(DnMatDescr dnMatDescr, + int batchCount, int64_t batchStride) # Generic API Functions @@ -1313,9 +1471,11 @@ ELSE: void* result, DataType computeType, size_t* bufferSize) Status cusparseSpVV(Handle handle, Operation opX, SpVecDescr vecX, - DnVecDescr vecY, void* result, DataType computeType, + DnVecDescr vecY, void* result, + DataType computeType, void* externalBuffer) - Status cusparseSpMV_bufferSize(Handle handle, Operation opA, void* alpha, + Status cusparseSpMV_bufferSize(Handle handle, Operation opA, + void* alpha, SpMatDescr matA, DnVecDescr vecX, void* beta, DnVecDescr vecY, DataType computeType, SpMVAlg alg, @@ -1324,7 +1484,8 @@ ELSE: SpMatDescr matA, DnVecDescr vecX, void* beta, DnVecDescr vecY, DataType computeType, SpMVAlg alg, void* externalBuffer) - Status cusparseSpMM_bufferSize(Handle handle, Operation opA, Operation opB, + Status cusparseSpMM_bufferSize(Handle handle, Operation opA, + Operation opB, void* alpha, SpMatDescr matA, DnMatDescr matB, void* beta, DnMatDescr matC, DataType computeType, @@ -1346,17 +1507,20 @@ ELSE: Status cusparseSpGEMM_destroyDescr(SpGEMMDescr spgemmDescr) Status cusparseSpGEMM_workEstimation( Handle handle, Operation opA, Operation opB, const void* alpha, - SpMatDescr matA, SpMatDescr matB, const void* beta, SpMatDescr matC, + SpMatDescr matA, SpMatDescr matB, const void* beta, + SpMatDescr matC, DataType computeType, SpGEMMAlg alg, SpGEMMDescr spgemmDescr, size_t* bufferSize1, void* externalBuffer1) Status cusparseSpGEMM_compute( Handle handle, Operation opA, Operation opB, const void* alpha, - SpMatDescr matA, SpMatDescr matB, const void* beta, SpMatDescr matC, + SpMatDescr matA, SpMatDescr matB, const void* beta, + SpMatDescr matC, DataType computeType, SpGEMMAlg alg, SpGEMMDescr spgemmDescr, size_t* bufferSize2, void* externalBuffer2) Status cusparseSpGEMM_copy( Handle handle, Operation opA, Operation opB, const void* alpha, - SpMatDescr matA, SpMatDescr matB, const void* beta, SpMatDescr matC, + SpMatDescr matA, SpMatDescr matB, const void* beta, + SpMatDescr matC, DataType computeType, SpGEMMAlg alg, SpGEMMDescr spgemmDescr) Status cusparseGather(Handle handle, DnVecDescr vecY, SpVecDescr vecX) @@ -1364,13 +1528,15 @@ ELSE: Status cusparseCsr2cscEx2_bufferSize( Handle handle, int m, int n, int nnz, const void* csrVal, const int* csrRowPtr, const int* csrColInd, void* cscVal, - int* cscColPtr, int* cscRowInd, DataType valType, Action copyValues, + int* cscColPtr, int* cscRowInd, DataType valType, + Action copyValues, IndexBase idxBase, Csr2CscAlg alg, size_t* bufferSize) Status cusparseCsr2cscEx2( Handle handle, int m, int n, int nnz, const void* csrVal, const int* csrRowPtr, const int* csrColInd, void* cscVal, - int* cscColPtr, int* cscRowInd, DataType valType, Action copyValues, + int* cscColPtr, int* cscRowInd, DataType valType, + Action copyValues, IndexBase idxBase, Csr2CscAlg alg, void* buffer) # Build-time version @@ -1395,12 +1561,12 @@ ELSE: cdef SoftLink _lib = SoftLink(_libname, 'cusparse') # cuSPARSE 11.6+ (CUDA 11.3.1+) cdef f_type cusparseSpSM_createDescr = _lib.get('SpSM_createDescr') - cdef f_type cusparseSpSM_destroyDescr = _lib.get('SpSM_destroyDescr') + cdef f_type cusparseSpSM_destroyDescr = _lib.get('SpSM_destroyDescr') # NOQA cdef f_type cusparseSpSM_bufferSize = _lib.get('SpSM_bufferSize') cdef f_type cusparseSpSM_analysis = _lib.get('SpSM_analysis') cdef f_type cusparseSpSM_solve = _lib.get('SpSM_solve') # cuSPARSE 11.5+ (CUDA 11.3.0+) - cdef f_type cusparseSpMatSetAttribute = _lib.get('SpMatSetAttribute') + cdef f_type cusparseSpMatSetAttribute = _lib.get('SpMatSetAttribute') # NOQA # cuSPARSE 11.3.1+ (CUDA 11.2.0+) cdef f_type cusparseCreateCsc = _lib.get('CreateCsc') # cuSPARSE 11.3+ (CUDA 11.1.1+) @@ -1599,7 +1765,7 @@ ELSE: cpdef void spMatSetAttribute( size_t spMatDescr, int attribute, int data) except *: - # Assuming the value of attribute is an enum value, whose underlying type + # Assuming the value of attribute is an enum value, whose underlying type # NOQA # As for CUDA 11.7, the types of all the sparse matrix descriptor # attributes are enums, whose underlying type is always int in C. status = cusparseSpMatSetAttribute( @@ -1611,11 +1777,11 @@ ELSE: # Stream cpdef void setStream(intptr_t handle, size_t stream) except *: - # TODO(leofang): It seems most of cuSPARSE APIs support stream capture (as - # of CUDA 11.5) under certain conditions, see + # TODO(leofang): It seems most of cuSPARSE APIs support stream capture + # (as of CUDA 11.5) under certain conditions, see # https://docs.nvidia.com/cuda/cusparse/index.html#optimization-notes - # Before we come up with a robust strategy to test the support conditions, - # we disable this functionality. + # Before we come up with a robust strategy to test the support + # conditions, we disable this functionality. if not runtime._is_hip_environment and runtime.streamIsCapturing(stream): raise NotImplementedError( 'calling cuSPARSE API during stream capture is currently ' @@ -1684,7 +1850,8 @@ ELSE: _setStream(handle) status = cusparseScsrmv( handle, transA, m, n, nnz, - alpha, descrA, csrSortedValA, + alpha, descrA, + csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, x, beta, y) check_status(status) @@ -1697,7 +1864,8 @@ ELSE: _setStream(handle) status = cusparseDcsrmv( handle, transA, m, n, nnz, - alpha, descrA, csrSortedValA, + alpha, descrA, + csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, x, beta, y) check_status(status) @@ -1877,7 +2045,8 @@ ELSE: _setStream(handle) status = cusparseZcsrsv2_analysis( handle, transA, m, nnz, descrA, - csrSortedValA, csrSortedRowPtrA, + csrSortedValA, + csrSortedRowPtrA, csrSortedColIndA, info, policy, pBuffer) check_status(status) @@ -1885,7 +2054,8 @@ ELSE: cpdef void scsrsv2_solve( intptr_t handle, int transA, int m, int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t info, size_t x, size_t y, int policy, + size_t csrSortedColIndA, size_t info, size_t x, size_t y, + int policy, size_t pBuffer) except *: _setStream(handle) status = cusparseScsrsv2_solve( @@ -1900,7 +2070,8 @@ ELSE: cpdef void dcsrsv2_solve( intptr_t handle, int transA, int m, int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t info, size_t x, size_t y, int policy, + size_t csrSortedColIndA, size_t info, size_t x, size_t y, + int policy, size_t pBuffer) except *: _setStream(handle) status = cusparseDcsrsv2_solve( @@ -1915,7 +2086,8 @@ ELSE: cpdef void ccsrsv2_solve( intptr_t handle, int transA, int m, int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t info, size_t x, size_t y, int policy, + size_t csrSortedColIndA, size_t info, size_t x, size_t y, + int policy, size_t pBuffer) except *: _setStream(handle) status = cusparseCcsrsv2_solve( @@ -1930,13 +2102,15 @@ ELSE: cpdef void zcsrsv2_solve( intptr_t handle, int transA, int m, int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t info, size_t x, size_t y, int policy, + size_t csrSortedColIndA, size_t info, size_t x, size_t y, + int policy, size_t pBuffer) except *: _setStream(handle) status = cusparseZcsrsv2_solve( handle, transA, m, nnz, alpha, descrA, - csrSortedValA, csrSortedRowPtrA, + csrSortedValA, + csrSortedRowPtrA, csrSortedColIndA, info, x, y, policy, pBuffer) @@ -1960,7 +2134,8 @@ ELSE: _setStream(handle) status = cusparseScsrmm( handle, transA, m, n, k, nnz, - alpha, descrA, csrSortedValA, + alpha, descrA, + csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, B, ldb, beta, C, ldc) check_status(status) @@ -1973,7 +2148,8 @@ ELSE: _setStream(handle) status = cusparseDcsrmm( handle, transA, m, n, k, nnz, - alpha, descrA, csrSortedValA, + alpha, descrA, + csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, B, ldb, beta, C, ldc) check_status(status) @@ -2009,7 +2185,8 @@ ELSE: check_status(status) cpdef void scsrmm2( - intptr_t handle, int transA, int transB, int m, int n, int k, int nnz, + intptr_t handle, int transA, int transB, int m, int n, int k, + int nnz, size_t alpha, size_t descrA, size_t csrValA, size_t csrRowPtrA, size_t csrColIndA, size_t B, int ldb, size_t beta, size_t C, int ldc) except *: @@ -2022,7 +2199,8 @@ ELSE: check_status(status) cpdef void dcsrmm2( - intptr_t handle, int transA, int transB, int m, int n, int k, int nnz, + intptr_t handle, int transA, int transB, int m, int n, int k, + int nnz, size_t alpha, size_t descrA, size_t csrValA, size_t csrRowPtrA, size_t csrColIndA, size_t B, int ldb, size_t beta, size_t C, int ldc) except *: @@ -2035,21 +2213,24 @@ ELSE: check_status(status) cpdef void ccsrmm2( - intptr_t handle, int transA, int transB, int m, int n, int k, int nnz, + intptr_t handle, int transA, int transB, int m, int n, int k, + int nnz, size_t alpha, size_t descrA, size_t csrValA, size_t csrRowPtrA, size_t csrColIndA, size_t B, int ldb, size_t beta, size_t C, int ldc) except *: _setStream(handle) status = cusparseCcsrmm2( handle, transA, transB, m, n, k, nnz, - alpha, descrA, csrValA, + alpha, descrA, + csrValA, csrRowPtrA, csrColIndA, B, ldb, beta, C, ldc) check_status(status) cpdef void zcsrmm2( - intptr_t handle, int transA, int transB, int m, int n, int k, int nnz, + intptr_t handle, int transA, int transB, int m, int n, int k, + int nnz, size_t alpha, size_t descrA, size_t csrValA, size_t csrRowPtrA, size_t csrColIndA, size_t B, int ldb, size_t beta, size_t C, int ldc) except *: @@ -2076,12 +2257,14 @@ ELSE: cpdef size_t scsrsm2_bufferSizeExt( intptr_t handle, int algo, int transA, int transB, int m, int nrhs, int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, - size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t B, int ldb, + size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t B, + int ldb, size_t info, int policy) except? -1: cdef size_t bufferSize _setStream(handle) status = cusparseScsrsm2_bufferSizeExt( - handle, algo, transA, transB, m, nrhs, + handle, algo, transA, transB, m, + nrhs, nnz, alpha, descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, B, ldb, @@ -2092,12 +2275,14 @@ ELSE: cpdef size_t dcsrsm2_bufferSizeExt( intptr_t handle, int algo, int transA, int transB, int m, int nrhs, int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, - size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t B, int ldb, + size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t B, + int ldb, size_t info, int policy) except? -1: cdef size_t bufferSize _setStream(handle) status = cusparseDcsrsm2_bufferSizeExt( - handle, algo, transA, transB, m, nrhs, + handle, algo, transA, transB, m, + nrhs, nnz, alpha, descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, B, ldb, @@ -2108,12 +2293,14 @@ ELSE: cpdef size_t ccsrsm2_bufferSizeExt( intptr_t handle, int algo, int transA, int transB, int m, int nrhs, int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, - size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t B, int ldb, + size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t B, + int ldb, size_t info, int policy) except? -1: cdef size_t bufferSize _setStream(handle) status = cusparseCcsrsm2_bufferSizeExt( - handle, algo, transA, transB, m, nrhs, + handle, algo, transA, transB, m, + nrhs, nnz, alpha, descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, B, ldb, @@ -2124,27 +2311,33 @@ ELSE: cpdef size_t zcsrsm2_bufferSizeExt( intptr_t handle, int algo, int transA, int transB, int m, int nrhs, int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, - size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t B, int ldb, + size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t B, + int ldb, size_t info, int policy) except? -1: cdef size_t bufferSize _setStream(handle) status = cusparseZcsrsm2_bufferSizeExt( - handle, algo, transA, transB, m, nrhs, + handle, algo, transA, transB, m, + nrhs, nnz, alpha, descrA, - csrSortedValA, csrSortedRowPtrA, + csrSortedValA, + csrSortedRowPtrA, csrSortedColIndA, B, ldb, info, policy, &bufferSize) check_status(status) return bufferSize cpdef void scsrsm2_analysis( - intptr_t handle, int algo, int transA, int transB, int m, int nrhs, + intptr_t handle, int algo, int transA, int transB, int m, + int nrhs, int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, - size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t B, int ldb, + size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t B, + int ldb, size_t info, int policy, size_t pBuffer) except *: _setStream(handle) status = cusparseScsrsm2_analysis( - handle, algo, transA, transB, m, nrhs, + handle, algo, transA, transB, m, + nrhs, nnz, alpha, descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, B, ldb, @@ -2154,11 +2347,13 @@ ELSE: cpdef void dcsrsm2_analysis( intptr_t handle, int algo, int transA, int transB, int m, int nrhs, int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, - size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t B, int ldb, + size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t B, + int ldb, size_t info, int policy, size_t pBuffer) except *: _setStream(handle) status = cusparseDcsrsm2_analysis( - handle, algo, transA, transB, m, nrhs, + handle, algo, transA, transB, m, + nrhs, nnz, alpha, descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, B, ldb, @@ -2166,13 +2361,16 @@ ELSE: check_status(status) cpdef void ccsrsm2_analysis( - intptr_t handle, int algo, int transA, int transB, int m, int nrhs, + intptr_t handle, int algo, int transA, int transB, int m, + int nrhs, int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, - size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t B, int ldb, + size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t B, + int ldb, size_t info, int policy, size_t pBuffer) except *: _setStream(handle) status = cusparseCcsrsm2_analysis( - handle, algo, transA, transB, m, nrhs, + handle, algo, transA, transB, m, + nrhs, nnz, alpha, descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, B, ldb, @@ -2182,13 +2380,16 @@ ELSE: cpdef void zcsrsm2_analysis( intptr_t handle, int algo, int transA, int transB, int m, int nrhs, int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, - size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t B, int ldb, + size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t B, + int ldb, size_t info, int policy, size_t pBuffer) except *: _setStream(handle) status = cusparseZcsrsm2_analysis( - handle, algo, transA, transB, m, nrhs, + handle, algo, transA, transB, m, + nrhs, nnz, alpha, descrA, - csrSortedValA, csrSortedRowPtrA, + csrSortedValA, + csrSortedRowPtrA, csrSortedColIndA, B, ldb, info, policy, pBuffer) check_status(status) @@ -2196,11 +2397,13 @@ ELSE: cpdef void scsrsm2_solve( intptr_t handle, int algo, int transA, int transB, int m, int nrhs, int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, - size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t B, int ldb, + size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t B, + int ldb, size_t info, int policy, size_t pBuffer) except *: _setStream(handle) status = cusparseScsrsm2_solve( - handle, algo, transA, transB, m, nrhs, + handle, algo, transA, transB, m, + nrhs, nnz, alpha, descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, B, ldb, @@ -2210,11 +2413,13 @@ ELSE: cpdef void dcsrsm2_solve( intptr_t handle, int algo, int transA, int transB, int m, int nrhs, int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, - size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t B, int ldb, + size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t B, + int ldb, size_t info, int policy, size_t pBuffer) except *: _setStream(handle) status = cusparseDcsrsm2_solve( - handle, algo, transA, transB, m, nrhs, + handle, algo, transA, transB, m, + nrhs, nnz, alpha, descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, B, ldb, @@ -2224,11 +2429,13 @@ ELSE: cpdef void ccsrsm2_solve( intptr_t handle, int algo, int transA, int transB, int m, int nrhs, int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, - size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t B, int ldb, + size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t B, + int ldb, size_t info, int policy, size_t pBuffer) except *: _setStream(handle) status = cusparseCcsrsm2_solve( - handle, algo, transA, transB, m, nrhs, + handle, algo, transA, transB, m, + nrhs, nnz, alpha, descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, B, ldb, @@ -2238,13 +2445,16 @@ ELSE: cpdef void zcsrsm2_solve( intptr_t handle, int algo, int transA, int transB, int m, int nrhs, int nnz, size_t alpha, size_t descrA, size_t csrSortedValA, - size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t B, int ldb, + size_t csrSortedRowPtrA, size_t csrSortedColIndA, size_t B, + int ldb, size_t info, int policy, size_t pBuffer) except *: _setStream(handle) status = cusparseZcsrsm2_solve( - handle, algo, transA, transB, m, nrhs, + handle, algo, transA, transB, m, + nrhs, nnz, alpha, descrA, - csrSortedValA, csrSortedRowPtrA, + csrSortedValA, + csrSortedRowPtrA, csrSortedColIndA, B, ldb, info, policy, pBuffer) check_status(status) @@ -2263,7 +2473,8 @@ ELSE: intptr_t handle, int m, int n, size_t descrA, int nnzA, size_t csrRowPtrA, size_t csrColIndA, size_t descrB, int nnzB, size_t csrRowPtrB, size_t csrColIndB, - size_t descrC, size_t csrRowPtrC, size_t nnzTotalDevHostPtr) except *: + size_t descrC, size_t csrRowPtrC, + size_t nnzTotalDevHostPtr) except *: _setStream(handle) status = cusparseXcsrgeamNnz( handle, m, n, descrA, nnzA, @@ -2284,7 +2495,8 @@ ELSE: status = cusparseScsrgeam( handle, m, n, alpha, descrA, nnzA, csrValA, - csrRowPtrA, csrColIndA, beta, + csrRowPtrA, csrColIndA, + beta, descrB, nnzB, csrValB, csrRowPtrB, csrColIndB, descrC, csrValC, csrRowPtrC, @@ -2302,7 +2514,8 @@ ELSE: status = cusparseDcsrgeam( handle, m, n, alpha, descrA, nnzA, csrValA, - csrRowPtrA, csrColIndA, beta, + csrRowPtrA, csrColIndA, + beta, descrB, nnzB, csrValB, csrRowPtrB, csrColIndB, descrC, csrValC, csrRowPtrC, @@ -2343,7 +2556,8 @@ ELSE: beta, descrB, nnzB, csrValB, csrRowPtrB, csrColIndB, - descrC, csrValC, csrRowPtrC, + descrC, csrValC, + csrRowPtrC, csrColIndC) check_status(status) @@ -2359,7 +2573,8 @@ ELSE: status = cusparseScsrgeam2_bufferSizeExt( handle, m, n, alpha, descrA, nnzA, csrValA, - csrRowPtrA, csrColIndA, beta, + csrRowPtrA, csrColIndA, + beta, descrB, nnzB, csrValB, csrRowPtrB, csrColIndB, descrC, csrValC, csrRowPtrC, @@ -2379,7 +2594,8 @@ ELSE: status = cusparseDcsrgeam2_bufferSizeExt( handle, m, n, alpha, descrA, nnzA, csrValA, - csrRowPtrA, csrColIndA, beta, + csrRowPtrA, csrColIndA, + beta, descrB, nnzB, csrValB, csrRowPtrB, csrColIndB, descrC, csrValC, csrRowPtrC, @@ -2424,7 +2640,8 @@ ELSE: beta, descrB, nnzB, csrValB, csrRowPtrB, csrColIndB, - descrC, csrValC, csrRowPtrC, + descrC, csrValC, + csrRowPtrC, csrColIndC, &bufferSize) check_status(status) return bufferSize @@ -2455,7 +2672,8 @@ ELSE: status = cusparseScsrgeam2( handle, m, n, alpha, descrA, nnzA, csrValA, - csrRowPtrA, csrColIndA, beta, + csrRowPtrA, csrColIndA, + beta, descrB, nnzB, csrValB, csrRowPtrB, csrColIndB, descrC, csrValC, csrRowPtrC, @@ -2473,7 +2691,8 @@ ELSE: status = cusparseDcsrgeam2( handle, m, n, alpha, descrA, nnzA, csrValA, - csrRowPtrA, csrColIndA, beta, + csrRowPtrA, csrColIndA, + beta, descrB, nnzB, csrValB, csrRowPtrB, csrColIndB, descrC, csrValC, csrRowPtrC, @@ -2514,7 +2733,8 @@ ELSE: beta, descrB, nnzB, csrValB, csrRowPtrB, csrColIndB, - descrC, csrValC, csrRowPtrC, + descrC, csrValC, + csrRowPtrC, csrColIndC, buffer) check_status(status) @@ -2523,14 +2743,16 @@ ELSE: size_t descrA, int nnzA, size_t csrRowPtrA, size_t csrColIndA, size_t descrB, int nnzB, size_t csrRowPtrB, size_t csrColIndB, - size_t descrC, size_t csrRowPtrC, size_t nnzTotalDevHostPtr) except *: + size_t descrC, size_t csrRowPtrC, + size_t nnzTotalDevHostPtr) except *: _setStream(handle) status = cusparseXcsrgemmNnz( handle, transA, transB, m, n, k, descrA, nnzA, csrRowPtrA, csrColIndA, descrB, nnzB, csrRowPtrB, csrColIndB, - descrC, csrRowPtrC, nnzTotalDevHostPtr) + descrC, csrRowPtrC, + nnzTotalDevHostPtr) check_status(status) cpdef void scsrgemm( @@ -2703,7 +2925,8 @@ ELSE: size_t descrB, int nnzB, size_t csrRowPtrB, size_t csrColIndB, size_t descrD, int nnzD, size_t csrRowPtrD, size_t csrColIndD, size_t descrC, size_t csrRowPtrC, - intptr_t nnzTotalDevHostPtr, size_t info, intptr_t pBuffer) except *: + intptr_t nnzTotalDevHostPtr, size_t info, + intptr_t pBuffer) except *: _setStream(handle) status = cusparseXcsrgemm2Nnz( handle, m, n, k, @@ -2719,16 +2942,19 @@ ELSE: int nnzA, size_t csrValA, size_t csrRowPtrA, size_t csrColIndA, size_t descrB, int nnzB, size_t csrValB, size_t csrRowPtrB, size_t csrColIndB, size_t beta, size_t descrD, int nnzD, - size_t csrValD, size_t csrRowPtrD, size_t csrColIndD, size_t descrC, + size_t csrValD, size_t csrRowPtrD, size_t csrColIndD, + size_t descrC, size_t csrValC, size_t csrRowPtrC, size_t csrColIndC, size_t info, intptr_t pBuffer) except *: _setStream(handle) status = cusparseScsrgemm2( handle, m, n, k, alpha, descrA, nnzA, - csrValA, csrRowPtrA, csrColIndA, descrB, + csrValA, csrRowPtrA, csrColIndA, + descrB, nnzB, csrValB, csrRowPtrB, csrColIndB, beta, descrD, nnzD, csrValD, - csrRowPtrD, csrColIndD, descrC, csrValC, + csrRowPtrD, csrColIndD, descrC, + csrValC, csrRowPtrC, csrColIndC, info, pBuffer) check_status(status) @@ -2738,16 +2964,19 @@ ELSE: int nnzA, size_t csrValA, size_t csrRowPtrA, size_t csrColIndA, size_t descrB, int nnzB, size_t csrValB, size_t csrRowPtrB, size_t csrColIndB, size_t beta, size_t descrD, int nnzD, - size_t csrValD, size_t csrRowPtrD, size_t csrColIndD, size_t descrC, + size_t csrValD, size_t csrRowPtrD, size_t csrColIndD, + size_t descrC, size_t csrValC, size_t csrRowPtrC, size_t csrColIndC, size_t info, intptr_t pBuffer) except *: _setStream(handle) status = cusparseDcsrgemm2( handle, m, n, k, alpha, descrA, nnzA, - csrValA, csrRowPtrA, csrColIndA, descrB, + csrValA, csrRowPtrA, csrColIndA, + descrB, nnzB, csrValB, csrRowPtrB, csrColIndB, beta, descrD, nnzD, csrValD, - csrRowPtrD, csrColIndD, descrC, csrValC, + csrRowPtrD, csrColIndD, descrC, + csrValC, csrRowPtrC, csrColIndC, info, pBuffer) check_status(status) @@ -2757,12 +2986,14 @@ ELSE: int nnzA, size_t csrValA, size_t csrRowPtrA, size_t csrColIndA, size_t descrB, int nnzB, size_t csrValB, size_t csrRowPtrB, size_t csrColIndB, size_t beta, size_t descrD, int nnzD, - size_t csrValD, size_t csrRowPtrD, size_t csrColIndD, size_t descrC, + size_t csrValD, size_t csrRowPtrD, size_t csrColIndD, + size_t descrC, size_t csrValC, size_t csrRowPtrC, size_t csrColIndC, size_t info, intptr_t pBuffer) except *: _setStream(handle) status = cusparseCcsrgemm2( - handle, m, n, k, alpha, descrA, nnzA, + handle, m, n, k, alpha, + descrA, nnzA, csrValA, csrRowPtrA, csrColIndA, descrB, nnzB, csrValB, csrRowPtrB, csrColIndB, beta, descrD, nnzD, @@ -2776,14 +3007,17 @@ ELSE: int nnzA, size_t csrValA, size_t csrRowPtrA, size_t csrColIndA, size_t descrB, int nnzB, size_t csrValB, size_t csrRowPtrB, size_t csrColIndB, size_t beta, size_t descrD, int nnzD, - size_t csrValD, size_t csrRowPtrD, size_t csrColIndD, size_t descrC, + size_t csrValD, size_t csrRowPtrD, size_t csrColIndD, + size_t descrC, size_t csrValC, size_t csrRowPtrC, size_t csrColIndC, size_t info, intptr_t pBuffer) except *: _setStream(handle) status = cusparseZcsrgemm2( handle, m, n, k, alpha, descrA, - nnzA, csrValA, csrRowPtrA, csrColIndA, - descrB, nnzB, csrValB, csrRowPtrB, + nnzA, csrValA, csrRowPtrA, + csrColIndA, + descrB, nnzB, csrValB, + csrRowPtrB, csrColIndB, beta, descrD, nnzD, csrValD, csrRowPtrD, csrColIndD, descrC, csrValC, csrRowPtrC, @@ -2794,7 +3028,8 @@ ELSE: # cuSPARSE Format Convrsion cpdef void xcoo2csr( - intptr_t handle, size_t cooRowInd, int nnz, int m, size_t csrRowPtr, + intptr_t handle, size_t cooRowInd, int nnz, int m, + size_t csrRowPtr, int idxBase) except *: _setStream(handle) status = cusparseXcoo2csr( @@ -2842,12 +3077,14 @@ ELSE: _setStream(handle) status = cusparseZcsc2dense( handle, m, n, descrA, - cscSortedValA, cscSortedRowIndA, + cscSortedValA, + cscSortedRowIndA, cscSortedColPtrA, A, lda) check_status(status) cpdef void xcsr2coo( - intptr_t handle, size_t csrRowPtr, int nnz, int m, size_t cooRowInd, + intptr_t handle, size_t csrRowPtr, int nnz, int m, + size_t cooRowInd, int idxBase) except *: _setStream(handle) status = cusparseXcsr2coo( @@ -2889,7 +3126,8 @@ ELSE: _setStream(handle) status = cusparseCcsr2csc( handle, m, n, nnz, csrVal, - csrRowPtr, csrColInd, cscVal, + csrRowPtr, csrColInd, + cscVal, cscRowInd, cscColPtr, copyValues, idxBase) check_status(status) @@ -2948,7 +3186,8 @@ ELSE: _setStream(handle) status = cusparseZcsr2dense( handle, m, n, descrA, - csrSortedValA, csrSortedRowPtrA, + csrSortedValA, + csrSortedRowPtrA, csrSortedColIndA, A, lda) check_status(status) @@ -2999,7 +3238,8 @@ ELSE: _setStream(handle) status = cusparseZnnz_compress( handle, m, descr, - values, rowPtr, nnzPerRow, + values, rowPtr, + nnzPerRow, &nnz_total, double_complex_to_cuda(tol)) check_status(status) return nnz_total @@ -3025,7 +3265,8 @@ ELSE: _setStream(handle) status = cusparseDcsr2csr_compress( handle, m, n, descrA, - inVal, inColInd, inRowPtr, + inVal, inColInd, + inRowPtr, inNnz, nnzPerRow, outVal, outColInd, outRowPtr, tol) check_status(status) @@ -3038,7 +3279,8 @@ ELSE: _setStream(handle) status = cusparseCcsr2csr_compress( handle, m, n, descrA, - inVal, inColInd, inRowPtr, + inVal, inColInd, + inRowPtr, inNnz, nnzPerRow, outVal, outColInd, outRowPtr, complex_to_cuda(tol)) check_status(status) @@ -3053,7 +3295,8 @@ ELSE: handle, m, n, descrA, inVal, inColInd, inRowPtr, - inNnz, nnzPerRow, outVal, outColInd, + inNnz, nnzPerRow, outVal, + outColInd, outRowPtr, double_complex_to_cuda(tol)) check_status(status) @@ -3086,7 +3329,8 @@ ELSE: _setStream(handle) status = cusparseCdense2csc( handle, m, n, descrA, A, - lda, nnzPerCol, cscValA, cscRowIndA, + lda, nnzPerCol, cscValA, + cscRowIndA, cscColPtrA) check_status(status) @@ -3210,7 +3454,8 @@ ELSE: return bufferSizeInBytes cpdef void xcoosortByRow( - intptr_t handle, int m, int n, int nnz, size_t cooRows, size_t cooCols, + intptr_t handle, int m, int n, int nnz, size_t cooRows, + size_t cooCols, size_t P, size_t pBuffer) except *: _setStream(handle) status = cusparseXcoosortByRow( @@ -3219,7 +3464,8 @@ ELSE: check_status(status) cpdef void xcoosortByColumn( - intptr_t handle, int m, int n, int nnz, size_t cooRows, size_t cooCols, + intptr_t handle, int m, int n, int nnz, size_t cooRows, + size_t cooCols, size_t P, size_t pBuffer) except *: _setStream(handle) status = cusparseXcoosortByColumn( @@ -3240,11 +3486,14 @@ ELSE: cpdef void xcsrsort( intptr_t handle, int m, int n, int nnz, size_t descrA, - size_t csrRowPtr, size_t csrColInd, size_t P, size_t pBuffer) except *: + size_t csrRowPtr, size_t csrColInd, size_t P, + size_t pBuffer) except *: _setStream(handle) status = cusparseXcsrsort( handle, m, n, nnz, descrA, - csrRowPtr, csrColInd, P, pBuffer) + csrRowPtr, csrColInd, P, + + pBuffer) check_status(status) cpdef size_t xcscsort_bufferSizeExt( @@ -3260,11 +3509,13 @@ ELSE: cpdef void xcscsort( intptr_t handle, int m, int n, int nnz, size_t descrA, - size_t cscColPtr, size_t cscRowInd, size_t P, size_t pBuffer) except *: + size_t cscColPtr, size_t cscRowInd, size_t P, + size_t pBuffer) except *: _setStream(handle) status = cusparseXcscsort( handle, m, n, nnz, descrA, - cscColPtr, cscRowInd, P, pBuffer) + cscColPtr, cscRowInd, P, + pBuffer) check_status(status) ######################################## @@ -3374,7 +3625,8 @@ ELSE: _setStream(handle) with nogil: status = cusparseScsrilu02_bufferSize( - handle, m, nnz, descrA, + handle, m, nnz, + descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, info, &pBufferSizeInBytes) @@ -3389,7 +3641,8 @@ ELSE: _setStream(handle) with nogil: status = cusparseDcsrilu02_bufferSize( - handle, m, nnz, descrA, + handle, m, nnz, + descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, info, &pBufferSizeInBytes) @@ -3404,7 +3657,8 @@ ELSE: _setStream(handle) with nogil: status = cusparseCcsrilu02_bufferSize( - handle, m, nnz, descrA, + handle, m, nnz, + descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, info, &pBufferSizeInBytes) @@ -3419,60 +3673,77 @@ ELSE: _setStream(handle) with nogil: status = cusparseZcsrilu02_bufferSize( - handle, m, nnz, descrA, + handle, m, nnz, + descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, info, &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes - cpdef void scsrilu02_analysis(intptr_t handle, int m, int nnz, size_t descrA, - size_t csrSortedValA, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t info, int policy, + cpdef void scsrilu02_analysis(intptr_t handle, int m, + int nnz, size_t descrA, + size_t csrSortedValA, + size_t csrSortedRowPtrA, + size_t csrSortedColIndA, + size_t info, int policy, size_t pBuffer) except *: _setStream(handle) with nogil: status = cusparseScsrilu02_analysis( - handle, m, nnz, descrA, + handle, m, nnz, + descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, info, policy, pBuffer) check_status(status) - cpdef void dcsrilu02_analysis(intptr_t handle, int m, int nnz, size_t descrA, - size_t csrSortedValA, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t info, int policy, + cpdef void dcsrilu02_analysis(intptr_t handle, int m, int nnz, + size_t descrA, + size_t csrSortedValA, + size_t csrSortedRowPtrA, + size_t csrSortedColIndA, + size_t info, int policy, size_t pBuffer) except *: _setStream(handle) with nogil: status = cusparseDcsrilu02_analysis( - handle, m, nnz, descrA, + handle, m, nnz, + descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, info, policy, pBuffer) check_status(status) - cpdef void ccsrilu02_analysis(intptr_t handle, int m, int nnz, size_t descrA, - size_t csrSortedValA, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t info, int policy, + cpdef void ccsrilu02_analysis(intptr_t handle, int m, int nnz, + size_t descrA, + size_t csrSortedValA, + size_t csrSortedRowPtrA, + size_t csrSortedColIndA, + size_t info, int policy, size_t pBuffer) except *: _setStream(handle) with nogil: status = cusparseCcsrilu02_analysis( - handle, m, nnz, descrA, + handle, m, nnz, + descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, info, policy, pBuffer) check_status(status) - cpdef void zcsrilu02_analysis(intptr_t handle, int m, int nnz, size_t descrA, - size_t csrSortedValA, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t info, int policy, + cpdef void zcsrilu02_analysis(intptr_t handle, int m, int nnz, + size_t descrA, + size_t csrSortedValA, + size_t csrSortedRowPtrA, + size_t csrSortedColIndA, size_t info, + int policy, size_t pBuffer) except *: _setStream(handle) with nogil: status = cusparseZcsrilu02_analysis( - handle, m, nnz, descrA, + handle, m, nnz, + descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, info, policy, @@ -3486,7 +3757,8 @@ ELSE: _setStream(handle) with nogil: status = cusparseScsrilu02( - handle, m, nnz, descrA, + handle, m, nnz, + descrA, csrSortedValA_valM, csrSortedRowPtrA, csrSortedColIndA, info, policy, pBuffer) @@ -3499,7 +3771,8 @@ ELSE: _setStream(handle) with nogil: status = cusparseDcsrilu02( - handle, m, nnz, descrA, + handle, m, nnz, + descrA, csrSortedValA_valM, csrSortedRowPtrA, csrSortedColIndA, info, policy, pBuffer) @@ -3512,7 +3785,8 @@ ELSE: _setStream(handle) with nogil: status = cusparseCcsrilu02( - handle, m, nnz, descrA, + handle, m, nnz, + descrA, csrSortedValA_valM, csrSortedRowPtrA, csrSortedColIndA, info, policy, pBuffer) @@ -3525,8 +3799,10 @@ ELSE: _setStream(handle) with nogil: status = cusparseZcsrilu02( - handle, m, nnz, descrA, - csrSortedValA_valM, csrSortedRowPtrA, + handle, m, nnz, + descrA, + csrSortedValA_valM, + csrSortedRowPtrA, csrSortedColIndA, info, policy, pBuffer) check_status(status) @@ -3581,7 +3857,8 @@ ELSE: cpdef int sbsrilu02_bufferSize(intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, size_t bsrSortedVal, - size_t bsrSortedRowPtr, size_t bsrSortedColInd, + size_t bsrSortedRowPtr, + size_t bsrSortedColInd, int blockDim, size_t info) except? -1: cdef int pBufferSizeInBytes _setStream(handle) @@ -3589,14 +3866,16 @@ ELSE: status = cusparseSbsrilu02_bufferSize( handle, dirA, mb, nnzb, descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, + bsrSortedRowPtr, bsrSortedColInd, + blockDim, info, &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes cpdef int dbsrilu02_bufferSize(intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, size_t bsrSortedVal, - size_t bsrSortedRowPtr, size_t bsrSortedColInd, + size_t bsrSortedRowPtr, + size_t bsrSortedColInd, int blockDim, size_t info) except? -1: cdef int pBufferSizeInBytes _setStream(handle) @@ -3604,14 +3883,16 @@ ELSE: status = cusparseDbsrilu02_bufferSize( handle, dirA, mb, nnzb, descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, + bsrSortedRowPtr, bsrSortedColInd, + blockDim, info, &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes cpdef int cbsrilu02_bufferSize(intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, size_t bsrSortedVal, - size_t bsrSortedRowPtr, size_t bsrSortedColInd, + size_t bsrSortedRowPtr, + size_t bsrSortedColInd, int blockDim, size_t info) except? -1: cdef int pBufferSizeInBytes _setStream(handle) @@ -3619,78 +3900,91 @@ ELSE: status = cusparseCbsrilu02_bufferSize( handle, dirA, mb, nnzb, descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, + bsrSortedRowPtr, bsrSortedColInd, + blockDim, info, &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes cpdef int zbsrilu02_bufferSize(intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, size_t bsrSortedVal, - size_t bsrSortedRowPtr, size_t bsrSortedColInd, + size_t bsrSortedRowPtr, + size_t bsrSortedColInd, int blockDim, size_t info) except? -1: cdef int pBufferSizeInBytes _setStream(handle) with nogil: status = cusparseZbsrilu02_bufferSize( handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, + descrA, + bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, + blockDim, info, &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes cpdef void sbsrilu02_analysis( intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, - size_t bsrSortedVal, size_t bsrSortedRowPtr, size_t bsrSortedColInd, + size_t bsrSortedVal, size_t bsrSortedRowPtr, + size_t bsrSortedColInd, int blockDim, size_t info, int policy, size_t pBuffer) except *: _setStream(handle) with nogil: status = cusparseSbsrilu02_analysis( handle, dirA, mb, nnzb, descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, + bsrSortedRowPtr, bsrSortedColInd, + blockDim, info, policy, pBuffer) check_status(status) cpdef void dbsrilu02_analysis( intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, - size_t bsrSortedVal, size_t bsrSortedRowPtr, size_t bsrSortedColInd, + size_t bsrSortedVal, size_t bsrSortedRowPtr, + size_t bsrSortedColInd, int blockDim, size_t info, int policy, size_t pBuffer) except *: _setStream(handle) with nogil: status = cusparseDbsrilu02_analysis( handle, dirA, mb, nnzb, descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, + bsrSortedRowPtr, bsrSortedColInd, + blockDim, info, policy, pBuffer) check_status(status) cpdef void cbsrilu02_analysis( intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, - size_t bsrSortedVal, size_t bsrSortedRowPtr, size_t bsrSortedColInd, + size_t bsrSortedVal, size_t bsrSortedRowPtr, + size_t bsrSortedColInd, int blockDim, size_t info, int policy, size_t pBuffer) except *: _setStream(handle) with nogil: status = cusparseCbsrilu02_analysis( handle, dirA, mb, nnzb, descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, + bsrSortedRowPtr, + bsrSortedColInd, blockDim, info, policy, pBuffer) check_status(status) cpdef void zbsrilu02_analysis( intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, - size_t bsrSortedVal, size_t bsrSortedRowPtr, size_t bsrSortedColInd, + size_t bsrSortedVal, size_t bsrSortedRowPtr, + size_t bsrSortedColInd, int blockDim, size_t info, int policy, size_t pBuffer) except *: _setStream(handle) with nogil: status = cusparseZbsrilu02_analysis( handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, + descrA, + bsrSortedVal, + bsrSortedRowPtr, + bsrSortedColInd, blockDim, info, policy, pBuffer) check_status(status) @@ -3705,7 +3999,8 @@ ELSE: status = cusparseSbsrilu02( handle, dirA, mb, nnzb, descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, + bsrSortedRowPtr, + bsrSortedColInd, blockDim, info, policy, pBuffer) check_status(status) @@ -3720,7 +4015,8 @@ ELSE: status = cusparseDbsrilu02( handle, dirA, mb, nnzb, descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, + bsrSortedRowPtr, bsrSortedColInd, + blockDim, info, policy, pBuffer) check_status(status) @@ -3735,7 +4031,8 @@ ELSE: status = cusparseCbsrilu02( handle, dirA, mb, nnzb, descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, + bsrSortedRowPtr, bsrSortedColInd, + blockDim, info, policy, pBuffer) check_status(status) @@ -3749,8 +4046,10 @@ ELSE: with nogil: status = cusparseZbsrilu02( handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, + descrA, + bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, + blockDim, info, policy, pBuffer) check_status(status) @@ -3763,57 +4062,74 @@ ELSE: handle, info, position) check_status(status) - cpdef int scsric02_bufferSize(intptr_t handle, int m, int nnz, size_t descrA, - size_t csrSortedValA, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t info) except? -1: + cpdef int scsric02_bufferSize(intptr_t handle, int m, int nnz, + size_t descrA, + size_t csrSortedValA, + size_t csrSortedRowPtrA, + size_t csrSortedColIndA, + size_t info) except? -1: cdef int pBufferSizeInBytes _setStream(handle) with nogil: status = cusparseScsric02_bufferSize( - handle, m, nnz, descrA, + handle, m, nnz, + descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, info, &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes - cpdef int dcsric02_bufferSize(intptr_t handle, int m, int nnz, size_t descrA, - size_t csrSortedValA, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t info) except? -1: + cpdef int dcsric02_bufferSize(intptr_t handle, int m, int nnz, + size_t descrA, + size_t csrSortedValA, + size_t csrSortedRowPtrA, + size_t csrSortedColIndA, + size_t info) except? -1: cdef int pBufferSizeInBytes _setStream(handle) with nogil: status = cusparseDcsric02_bufferSize( - handle, m, nnz, descrA, + handle, m, nnz, + descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, info, &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes - cpdef int ccsric02_bufferSize(intptr_t handle, int m, int nnz, size_t descrA, - size_t csrSortedValA, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t info) except? -1: + cpdef int ccsric02_bufferSize(intptr_t handle, int m, int nnz, + size_t descrA, + size_t csrSortedValA, + size_t csrSortedRowPtrA, + size_t csrSortedColIndA, + size_t info) except? -1: cdef int pBufferSizeInBytes _setStream(handle) with nogil: status = cusparseCcsric02_bufferSize( - handle, m, nnz, descrA, + handle, m, nnz, + descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, info, &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes - cpdef int zcsric02_bufferSize(intptr_t handle, int m, int nnz, size_t descrA, - size_t csrSortedValA, size_t csrSortedRowPtrA, - size_t csrSortedColIndA, size_t info) except? -1: + cpdef int zcsric02_bufferSize(intptr_t handle, int m, int nnz, + size_t descrA, + size_t csrSortedValA, + size_t csrSortedRowPtrA, + size_t csrSortedColIndA, + size_t info) except? -1: cdef int pBufferSizeInBytes _setStream(handle) with nogil: status = cusparseZcsric02_bufferSize( - handle, m, nnz, descrA, - csrSortedValA, csrSortedRowPtrA, + handle, m, nnz, + descrA, + csrSortedValA, + csrSortedRowPtrA, csrSortedColIndA, info, &pBufferSizeInBytes) check_status(status) @@ -3827,7 +4143,8 @@ ELSE: _setStream(handle) with nogil: status = cusparseScsric02_analysis( - handle, m, nnz, descrA, + handle, m, nnz, + descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, info, policy, pBuffer) @@ -3841,7 +4158,8 @@ ELSE: _setStream(handle) with nogil: status = cusparseDcsric02_analysis( - handle, m, nnz, descrA, + handle, m, nnz, + descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, info, policy, pBuffer) @@ -3855,7 +4173,8 @@ ELSE: _setStream(handle) with nogil: status = cusparseCcsric02_analysis( - handle, m, nnz, descrA, + handle, m, nnz, + descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, info, policy, pBuffer) @@ -3869,10 +4188,12 @@ ELSE: _setStream(handle) with nogil: status = cusparseZcsric02_analysis( - handle, m, nnz, descrA, + handle, m, nnz, + descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, - info, policy, pBuffer) + info, policy, + pBuffer) check_status(status) cpdef void scsric02( @@ -3883,7 +4204,8 @@ ELSE: _setStream(handle) with nogil: status = cusparseScsric02( - handle, m, nnz, descrA, + handle, m, nnz, + descrA, csrSortedValA_valM, csrSortedRowPtrA, csrSortedColIndA, info, policy, pBuffer) @@ -3897,7 +4219,8 @@ ELSE: _setStream(handle) with nogil: status = cusparseDcsric02( - handle, m, nnz, descrA, + handle, m, nnz, + descrA, csrSortedValA_valM, csrSortedRowPtrA, csrSortedColIndA, info, policy, pBuffer) @@ -3911,7 +4234,8 @@ ELSE: _setStream(handle) with nogil: status = cusparseCcsric02( - handle, m, nnz, descrA, + handle, m, nnz, + descrA, csrSortedValA_valM, csrSortedRowPtrA, csrSortedColIndA, info, policy, pBuffer) @@ -3925,8 +4249,10 @@ ELSE: _setStream(handle) with nogil: status = cusparseZcsric02( - handle, m, nnz, descrA, - csrSortedValA_valM, csrSortedRowPtrA, + handle, m, nnz, + descrA, + csrSortedValA_valM, + csrSortedRowPtrA, csrSortedColIndA, info, policy, pBuffer) check_status(status) @@ -3941,7 +4267,8 @@ ELSE: cpdef int sbsric02_bufferSize(intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, size_t bsrSortedVal, - size_t bsrSortedRowPtr, size_t bsrSortedColInd, + size_t bsrSortedRowPtr, + size_t bsrSortedColInd, int blockDim, size_t info) except? -1: cdef int pBufferSizeInBytes _setStream(handle) @@ -3949,14 +4276,16 @@ ELSE: status = cusparseSbsric02_bufferSize( handle, dirA, mb, nnzb, descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, + bsrSortedRowPtr, bsrSortedColInd, + blockDim, info, &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes cpdef int dbsric02_bufferSize(intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, size_t bsrSortedVal, - size_t bsrSortedRowPtr, size_t bsrSortedColInd, + size_t bsrSortedRowPtr, + size_t bsrSortedColInd, int blockDim, size_t info) except? -1: cdef int pBufferSizeInBytes _setStream(handle) @@ -3964,14 +4293,16 @@ ELSE: status = cusparseDbsric02_bufferSize( handle, dirA, mb, nnzb, descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, + bsrSortedRowPtr, bsrSortedColInd, + blockDim, info, &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes cpdef int cbsric02_bufferSize(intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, size_t bsrSortedVal, - size_t bsrSortedRowPtr, size_t bsrSortedColInd, + size_t bsrSortedRowPtr, + size_t bsrSortedColInd, int blockDim, size_t info) except? -1: cdef int pBufferSizeInBytes _setStream(handle) @@ -3979,78 +4310,94 @@ ELSE: status = cusparseCbsric02_bufferSize( handle, dirA, mb, nnzb, descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, &pBufferSizeInBytes) + bsrSortedRowPtr, bsrSortedColInd, + blockDim, info, &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes cpdef int zbsric02_bufferSize(intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, size_t bsrSortedVal, - size_t bsrSortedRowPtr, size_t bsrSortedColInd, + size_t bsrSortedRowPtr, + size_t bsrSortedColInd, int blockDim, size_t info) except? -1: cdef int pBufferSizeInBytes _setStream(handle) with nogil: status = cusparseZbsric02_bufferSize( handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, + descrA, + bsrSortedVal, + bsrSortedRowPtr, + bsrSortedColInd, blockDim, info, &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes cpdef void sbsric02_analysis( intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, - size_t bsrSortedVal, size_t bsrSortedRowPtr, size_t bsrSortedColInd, - int blockDim, size_t info, int policy, size_t pInputBuffer) except *: + size_t bsrSortedVal, size_t bsrSortedRowPtr, + size_t bsrSortedColInd, + int blockDim, size_t info, int policy, + size_t pInputBuffer) except *: _setStream(handle) with nogil: status = cusparseSbsric02_analysis( handle, dirA, mb, nnzb, descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, + bsrSortedRowPtr, bsrSortedColInd, + blockDim, info, policy, pInputBuffer) check_status(status) cpdef void dbsric02_analysis( intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, - size_t bsrSortedVal, size_t bsrSortedRowPtr, size_t bsrSortedColInd, - int blockDim, size_t info, int policy, size_t pInputBuffer) except *: + size_t bsrSortedVal, size_t bsrSortedRowPtr, + size_t bsrSortedColInd, + int blockDim, size_t info, int policy, + size_t pInputBuffer) except *: _setStream(handle) with nogil: status = cusparseDbsric02_analysis( handle, dirA, mb, nnzb, descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, + bsrSortedRowPtr, bsrSortedColInd, + blockDim, info, policy, pInputBuffer) check_status(status) cpdef void cbsric02_analysis( intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, - size_t bsrSortedVal, size_t bsrSortedRowPtr, size_t bsrSortedColInd, - int blockDim, size_t info, int policy, size_t pInputBuffer) except *: + size_t bsrSortedVal, size_t bsrSortedRowPtr, + size_t bsrSortedColInd, + int blockDim, size_t info, int policy, + size_t pInputBuffer) except *: _setStream(handle) with nogil: status = cusparseCbsric02_analysis( handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, + descrA, + bsrSortedVal, + bsrSortedRowPtr, + bsrSortedColInd, blockDim, info, policy, pInputBuffer) check_status(status) cpdef void zbsric02_analysis( intptr_t handle, int dirA, int mb, int nnzb, size_t descrA, - size_t bsrSortedVal, size_t bsrSortedRowPtr, size_t bsrSortedColInd, - int blockDim, size_t info, int policy, size_t pInputBuffer) except *: + size_t bsrSortedVal, size_t bsrSortedRowPtr, + size_t bsrSortedColInd, + int blockDim, size_t info, int policy, + size_t pInputBuffer) except *: _setStream(handle) with nogil: status = cusparseZbsric02_analysis( handle, dirA, mb, nnzb, descrA, - bsrSortedVal, bsrSortedRowPtr, + bsrSortedVal, + bsrSortedRowPtr, bsrSortedColInd, blockDim, info, policy, pInputBuffer) check_status(status) @@ -4065,8 +4412,10 @@ ELSE: status = cusparseSbsric02( handle, dirA, mb, nnzb, descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, policy, pBuffer) + bsrSortedRowPtr, + bsrSortedColInd, blockDim, + info, policy, + pBuffer) check_status(status) cpdef void dbsric02( @@ -4079,8 +4428,10 @@ ELSE: status = cusparseDbsric02( handle, dirA, mb, nnzb, descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, policy, pBuffer) + bsrSortedRowPtr, + bsrSortedColInd, blockDim, + info, + policy, pBuffer) check_status(status) cpdef void cbsric02( @@ -4093,8 +4444,10 @@ ELSE: status = cusparseCbsric02( handle, dirA, mb, nnzb, descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, policy, pBuffer) + bsrSortedRowPtr, + bsrSortedColInd, blockDim, + info, + policy, pBuffer) check_status(status) cpdef void zbsric02( @@ -4106,9 +4459,12 @@ ELSE: with nogil: status = cusparseZbsric02( handle, dirA, mb, nnzb, - descrA, bsrSortedVal, - bsrSortedRowPtr, bsrSortedColInd, blockDim, - info, policy, pBuffer) + descrA, + bsrSortedVal, + bsrSortedRowPtr, + bsrSortedColInd, blockDim, + info, + policy, pBuffer) check_status(status) cpdef size_t sgtsv2_bufferSizeExt( @@ -4118,7 +4474,8 @@ ELSE: _setStream(handle) with nogil: status = cusparseSgtsv2_bufferSizeExt( - handle, m, n, dl, d, + handle, m, n, dl, + d, du, B, ldb, &bufferSizeInBytes) check_status(status) return bufferSizeInBytes @@ -4168,7 +4525,8 @@ ELSE: _setStream(handle) with nogil: status = cusparseSgtsv2( - handle, m, n, dl, d, + handle, m, n, dl, + d, du, B, ldb, pBuffer) check_status(status) @@ -4212,7 +4570,8 @@ ELSE: _setStream(handle) with nogil: status = cusparseSgtsv2_nopivot_bufferSizeExt( - handle, m, n, dl, d, + handle, m, n, dl, + d, du, B, ldb, &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes @@ -4262,7 +4621,8 @@ ELSE: _setStream(handle) with nogil: status = cusparseSgtsv2_nopivot( - handle, m, n, dl, d, + handle, m, n, dl, + d, du, B, ldb, pBuffer) check_status(status) @@ -4272,7 +4632,8 @@ ELSE: _setStream(handle) with nogil: status = cusparseDgtsv2_nopivot(handle, m, n, - dl, d, + dl, + d, du, B, ldb, pBuffer) check_status(status) @@ -4319,7 +4680,8 @@ ELSE: _setStream(handle) with nogil: status = cusparseDgtsv2StridedBatch_bufferSizeExt( - handle, m, dl, d, + handle, m, dl, + d, du, x, batchCount, batchStride, &bufferSizeInBytes) check_status(status) @@ -4371,7 +4733,8 @@ ELSE: _setStream(handle) with nogil: status = cusparseDgtsv2StridedBatch( - handle, m, dl, d, + handle, m, dl, + d, du, x, batchCount, batchStride, pBuffer) check_status(status) @@ -4421,7 +4784,8 @@ ELSE: with nogil: status = cusparseDgtsvInterleavedBatch_bufferSizeExt( handle, algo, m, dl, - d, du, x, batchCount, + d, du, x, + batchCount, &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes @@ -4481,7 +4845,8 @@ ELSE: _setStream(handle) with nogil: status = cusparseCgtsvInterleavedBatch( - handle, algo, m, dl, d, + handle, algo, m, dl, + d, du, x, batchCount, pBuffer) check_status(status) @@ -4493,7 +4858,8 @@ ELSE: with nogil: status = cusparseZgtsvInterleavedBatch( handle, algo, m, dl, - d, du, x, + d, du, + x, batchCount, pBuffer) check_status(status) @@ -4506,7 +4872,8 @@ ELSE: status = cusparseSgpsvInterleavedBatch_bufferSizeExt( handle, algo, m, ds, dl, d, du, - dw, x, batchCount, &pBufferSizeInBytes) + dw, x, batchCount, + &pBufferSizeInBytes) check_status(status) return pBufferSizeInBytes @@ -4532,7 +4899,8 @@ ELSE: with nogil: status = cusparseCgpsvInterleavedBatch_bufferSizeExt( handle, algo, m, ds, - dl, d, du, + dl, d, + du, dw, x, batchCount, &pBufferSizeInBytes) check_status(status) @@ -4583,7 +4951,8 @@ ELSE: _setStream(handle) with nogil: status = cusparseCgpsvInterleavedBatch( - handle, algo, m, ds, dl, + handle, algo, m, ds, + dl, d, du, dw, x, batchCount, pBuffer) check_status(status) @@ -4596,7 +4965,8 @@ ELSE: with nogil: status = cusparseZgpsvInterleavedBatch( handle, algo, m, ds, - dl, d, du, + dl, d, + du, dw, x, batchCount, pBuffer) check_status(status) @@ -4605,11 +4975,13 @@ ELSE: # Sparse Vector APIs cpdef size_t createSpVec(int64_t size, int64_t nnz, intptr_t indices, - intptr_t values, IndexType idxType, IndexBase idxBase, + intptr_t values, IndexType idxType, + IndexBase idxBase, DataType valueType) except? -1: cdef SpVecDescr desc status = cusparseCreateSpVec(&desc, size, nnz, indices, - values, idxType, idxBase, valueType) + values, idxType, idxBase, + valueType) check_status(status) return desc @@ -4708,7 +5080,8 @@ ELSE: cdef IndexBase idxBase, cdef DataType valueType status = cusparseCooGet(desc, &rows, &cols, &nnz, - &rowInd, &colInd, &values, + &rowInd, &colInd, + &values, &idxType, &idxBase, &valueType) check_status(status) return CooAttributes(rows, cols, nnz, rowInd, colInd, values, @@ -4874,11 +5247,13 @@ ELSE: cpdef size_t spVV_bufferSize(intptr_t handle, Operation opX, size_t vecX, size_t vecY, - intptr_t result, DataType computeType) except? -1: + intptr_t result, + DataType computeType) except? -1: cdef size_t bufferSize status = cusparseSpVV_bufferSize(handle, opX, vecX, vecY, - result, computeType, &bufferSize) + result, computeType, + &bufferSize) check_status(status) return bufferSize @@ -4892,7 +5267,8 @@ ELSE: externalBuffer) check_status(status) - cpdef size_t spMV_bufferSize(intptr_t handle, Operation opA, intptr_t alpha, + cpdef size_t spMV_bufferSize(intptr_t handle, Operation opA, + intptr_t alpha, size_t matA, size_t vecX, intptr_t beta, size_t vecY, DataType computeType, SpMVAlg alg) except? -1: @@ -4909,7 +5285,8 @@ ELSE: size_t vecX, intptr_t beta, size_t vecY, DataType computeType, SpMVAlg alg, intptr_t externalBuffer) except *: _setStream(handle) - status = cusparseSpMV(handle, opA, alpha, matA, + status = cusparseSpMV(handle, opA, alpha, + matA, vecX, beta, vecY, computeType, alg, externalBuffer) check_status(status) @@ -4926,10 +5303,12 @@ ELSE: cpdef size_t spSM_bufferSize(intptr_t handle, Operation opA, Operation opB, intptr_t alpha, size_t matA, size_t matB, - size_t matC, DataType computeType, SpSMAlg alg, + size_t matC, DataType computeType, + SpSMAlg alg, size_t spsmDescr) except? -1: cdef size_t bufferSize - status = cusparseSpSM_bufferSize(handle, opA, opB, alpha, + status = cusparseSpSM_bufferSize(handle, opA, opB, + alpha, matA, matB, matC, computeType, alg, spsmDescr, &bufferSize) @@ -4945,7 +5324,8 @@ ELSE: status = cusparseSpSM_analysis( handle, opA, opB, alpha, matA, matB, matC, computeType, alg, - spsmDescr, externalBuffer) + spsmDescr, + externalBuffer) check_status(status) cpdef void spSM_solve( @@ -4956,13 +5336,15 @@ ELSE: IF CUPY_HIP_VERSION > 0: # hipsparseSpSM_solve has the extra `externalBuffer` parameter that # cusparseSpSM_solve does not require. - status = cusparseSpSM_solve( handle, opA, opB, alpha, + status = cusparseSpSM_solve( handle, opA, opB, + alpha, matA, matB, matC, computeType, alg, spsmDescr, externalBuffer) ELSE: - status = cusparseSpSM_solve( handle, opA, opB, alpha, + status = cusparseSpSM_solve( handle, opA, opB, + alpha, matA, matB, matC, computeType, alg, spsmDescr) @@ -4970,10 +5352,12 @@ ELSE: cpdef size_t spMM_bufferSize(intptr_t handle, Operation opA, Operation opB, intptr_t alpha, size_t matA, size_t matB, - intptr_t beta, size_t matC, DataType computeType, + intptr_t beta, size_t matC, + DataType computeType, SpMMAlg alg) except? -1: cdef size_t bufferSize - status = cusparseSpMM_bufferSize(handle, opA, opB, alpha, + status = cusparseSpMM_bufferSize(handle, opA, opB, + alpha, matA, matB, beta, matC, computeType, alg, &bufferSize) @@ -4983,7 +5367,8 @@ ELSE: cpdef void spMM( intptr_t handle, Operation opA, Operation opB, intptr_t alpha, size_t matA, size_t matB, intptr_t beta, size_t matC, - DataType computeType, SpMMAlg alg, intptr_t externalBuffer) except *: + DataType computeType, SpMMAlg alg, + intptr_t externalBuffer) except *: _setStream(handle) status = cusparseSpMM(handle, opA, opB, alpha, matA, matB, beta, @@ -5065,7 +5450,8 @@ ELSE: check_status(status) cpdef void gather(intptr_t handle, size_t vecY, size_t vecX) except *: - status = cusparseGather(handle, vecY, vecX) + status = cusparseGather(handle, vecY, + vecX) check_status(status) cpdef size_t sparseToDense_bufferSize(intptr_t handle, size_t matA, @@ -5121,8 +5507,10 @@ ELSE: Action copyValues, IndexBase idxBase, Csr2CscAlg alg) except? -1: cdef size_t bufferSize status = cusparseCsr2cscEx2_bufferSize( - handle, m, n, nnz, csrVal, csrRowPtr, - csrColInd, cscVal, cscColPtr, cscRowInd, + handle, m, n, nnz, csrVal, + csrRowPtr, + csrColInd, cscVal, cscColPtr, + cscRowInd, valType, copyValues, idxBase, alg, &bufferSize) check_status(status) return bufferSize @@ -5135,7 +5523,9 @@ ELSE: intptr_t buffer) except *: setStream(handle, stream_module.get_current_stream_ptr()) status = cusparseCsr2cscEx2( - handle, m, n, nnz, csrVal, csrRowPtr, - csrColInd, cscVal, cscColPtr, cscRowInd, + handle, m, n, nnz, csrVal, + csrRowPtr, + csrColInd, cscVal, cscColPtr, + cscRowInd, valType, copyValues, idxBase, alg, buffer) check_status(status) From 54da486dffcf0f6e42bda3470ecb237a1fb2c0af Mon Sep 17 00:00:00 2001 From: bmedishe Date: Mon, 3 Jun 2024 17:46:39 +0000 Subject: [PATCH 25/30] flake8 errors --- cupy_backends/cuda/libs/cusparse.pyx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cupy_backends/cuda/libs/cusparse.pyx b/cupy_backends/cuda/libs/cusparse.pyx index b1231600dfb..b5ab81bd7a5 100644 --- a/cupy_backends/cuda/libs/cusparse.pyx +++ b/cupy_backends/cuda/libs/cusparse.pyx @@ -1561,12 +1561,12 @@ ELSE: cdef SoftLink _lib = SoftLink(_libname, 'cusparse') # cuSPARSE 11.6+ (CUDA 11.3.1+) cdef f_type cusparseSpSM_createDescr = _lib.get('SpSM_createDescr') - cdef f_type cusparseSpSM_destroyDescr = _lib.get('SpSM_destroyDescr') # NOQA + cdef f_type cusparseSpSM_destroyDescr = _lib.get('SpSM_destroyDescr') # NOQA cdef f_type cusparseSpSM_bufferSize = _lib.get('SpSM_bufferSize') cdef f_type cusparseSpSM_analysis = _lib.get('SpSM_analysis') cdef f_type cusparseSpSM_solve = _lib.get('SpSM_solve') # cuSPARSE 11.5+ (CUDA 11.3.0+) - cdef f_type cusparseSpMatSetAttribute = _lib.get('SpMatSetAttribute') # NOQA + cdef f_type cusparseSpMatSetAttribute = _lib.get('SpMatSetAttribute') # NOQA # cuSPARSE 11.3.1+ (CUDA 11.2.0+) cdef f_type cusparseCreateCsc = _lib.get('CreateCsc') # cuSPARSE 11.3+ (CUDA 11.1.1+) @@ -1782,7 +1782,10 @@ ELSE: # https://docs.nvidia.com/cuda/cusparse/index.html#optimization-notes # Before we come up with a robust strategy to test the support # conditions, we disable this functionality. - if not runtime._is_hip_environment and runtime.streamIsCapturing(stream): + if ( + not runtime._is_hip_environment and + runtime.streamIsCapturing(stream) + ): raise NotImplementedError( 'calling cuSPARSE API during stream capture is currently ' 'unsupported') From 65e89d0610cc977b7812786114bdf19ebc288b74 Mon Sep 17 00:00:00 2001 From: bmedishe Date: Tue, 4 Jun 2024 19:28:26 +0000 Subject: [PATCH 26/30] rocm backward compatibility --- cupy_backends/hip/cupy_hipsparse.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/cupy_backends/hip/cupy_hipsparse.h b/cupy_backends/hip/cupy_hipsparse.h index a859016519c..5372f1eb048 100644 --- a/cupy_backends/hip/cupy_hipsparse.h +++ b/cupy_backends/hip/cupy_hipsparse.h @@ -36,7 +36,7 @@ const char* cusparseGetErrorString(...) { #endif #if HIP_VERSION < 540 -typedef enum {} cusparseCsr2CscAlg_t; +typedef enum {} hipsparseCsr2CscAlg_t; hipsparseStatus_t cusparseCsr2cscEx2_bufferSize(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } @@ -519,18 +519,18 @@ typedef void* cusparseSpVecDescr_t; typedef void* cusparseDnVecDescr_t; typedef void* cusparseSpMatDescr_t; typedef void* cusparseDnMatDescr_t; -typedef enum {} cusparseIndexType_t; -typedef enum {} cusparseFormat_t; -typedef enum {} cusparseOrder_t; -typedef enum {} cusparseSpMVAlg_t; -typedef enum {} cusparseSpMMAlg_t; -typedef enum {} cusparseSparseToDenseAlg_t; -typedef enum {} cusparseDenseToSparseAlg_t; +typedef enum {} hipsparseIndexType_t; +typedef enum {} hipsparseFormat_t; +typedef enum {} hipsparseOrder_t; +typedef enum {} hipsparseSpMVAlg_t; +typedef enum {} hipsparseSpMMAlg_t; +typedef enum {} hipsparseSparseToDenseAlg_t; +typedef enum {} hipsparseDenseToSparseAlg_t; #endif #if HIP_VERSION < 50000000 -typedef enum {} cusparseSpMatAttribute_t; -typedef enum {} cusparseSpSMAlg_t; +typedef enum {} hipsparseSpMatAttribute_t; +typedef enum {} hipsparseSpSMAlg_t; typedef void * cusparseSpSMDescr_t; #endif From a7e05c3a594710929b8efa676dd572f8b58eedd0 Mon Sep 17 00:00:00 2001 From: bmedishe Date: Wed, 5 Jun 2024 16:55:00 +0000 Subject: [PATCH 27/30] HIP_VERSION updated --- cupy_backends/hip/cupy_hipsparse.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cupy_backends/hip/cupy_hipsparse.h b/cupy_backends/hip/cupy_hipsparse.h index 5372f1eb048..cb7cc45b9ae 100644 --- a/cupy_backends/hip/cupy_hipsparse.h +++ b/cupy_backends/hip/cupy_hipsparse.h @@ -35,7 +35,7 @@ const char* cusparseGetErrorString(...) { } #endif -#if HIP_VERSION < 540 +#if HIP_VERSION < 54000000 typedef enum {} hipsparseCsr2CscAlg_t; hipsparseStatus_t cusparseCsr2cscEx2_bufferSize(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; From b6074938c484fe61aa2e5d739c7cd2d7c8622249 Mon Sep 17 00:00:00 2001 From: bmedishe Date: Wed, 5 Jun 2024 18:14:53 +0000 Subject: [PATCH 28/30] change hip_version from 3 digits to 8 digits for backwrd compat --- cupy_backends/hip/cupy_hipsparse.h | 682 ++++++++++++++--------------- 1 file changed, 341 insertions(+), 341 deletions(-) diff --git a/cupy_backends/hip/cupy_hipsparse.h b/cupy_backends/hip/cupy_hipsparse.h index cb7cc45b9ae..7bfdccbd991 100644 --- a/cupy_backends/hip/cupy_hipsparse.h +++ b/cupy_backends/hip/cupy_hipsparse.h @@ -9,27 +9,27 @@ #include // for hipDataType #include // for gcc 10.0 -#if HIP_VERSION < 401 +#if HIP_VERSION < 40100000 #define HIPSPARSE_STATUS_NOT_SUPPORTED (hipsparseStatus_t)10 #endif extern "C" { -#if HIP_VERSION < 308 +#if HIP_VERSION < 30800000 typedef void* bsric02Info_t; #endif -#if HIP_VERSION < 309 +#if HIP_VERSION < 30900000 typedef void* bsrilu02Info_t; #endif typedef enum {} cusparseAlgMode_t; -#if HIP_VERSION < 600 +#if HIP_VERSION < 60000000 // Error handling -const char* cusparseGetErrorName(...) { +const char* hipsparseGetErrorName(...) { // Unavailable in hipSparse; this should not be called return "CUPY_HIPSPARSE_BINDING_UNEXPECTED_ERROR"; } -const char* cusparseGetErrorString(...) { +const char* hipsparseGetErrorString(...) { // Unavailable in hipSparse; this should not be called return "unexpected error in CuPy hipSparse binding"; } @@ -37,10 +37,10 @@ const char* cusparseGetErrorString(...) { #if HIP_VERSION < 54000000 typedef enum {} hipsparseCsr2CscAlg_t; -hipsparseStatus_t cusparseCsr2cscEx2_bufferSize(...) { +hipsparseStatus_t hipsparseCsr2cscEx2_bufferSize(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseCsr2cscEx2(...) { +hipsparseStatus_t hipsparseCsr2cscEx2(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } #endif @@ -61,14 +61,14 @@ hipsparseStatus_t cusparseConstrainedGeMM_bufferSize(...) { hipsparseStatus_t cusparseConstrainedGeMM(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -#if HIP_VERSION < 309 -hipsparseStatus_t cusparseCreateBsrilu02Info(bsrilu02Info_t* info) { +#if HIP_VERSION < 30900000 +hipsparseStatus_t hipsparseCreateBsrilu02Info(bsrilu02Info_t* info) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseDestroyBsrilu02Info(bsrilu02Info_t info) { +hipsparseStatus_t hipsparseDestroyBsrilu02Info(bsrilu02Info_t info) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseSbsrilu02_numericBoost(cusparseHandle_t handle, +hipsparseStatus_t hipsparseSbsrilu02_numericBoost(hipsparseHandle_t handle, bsrilu02Info_t info, int enable_boost, double* tol, @@ -76,7 +76,7 @@ hipsparseStatus_t cusparseSbsrilu02_numericBoost(cusparseHandle_t handle, return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseDbsrilu02_numericBoost(cusparseHandle_t handle, +hipsparseStatus_t hipsparseDbsrilu02_numericBoost(hipsparseHandle_t handle, bsrilu02Info_t info, int enable_boost, double* tol, @@ -84,33 +84,33 @@ hipsparseStatus_t cusparseDbsrilu02_numericBoost(cusparseHandle_t handle, return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseCbsrilu02_numericBoost(cusparseHandle_t handle, +hipsparseStatus_t hipsparseCbsrilu02_numericBoost(hipsparseHandle_t handle, bsrilu02Info_t info, int enable_boost, double* tol, - cuComplex* boost_val) { + hipComplex* boost_val) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseZbsrilu02_numericBoost(cusparseHandle_t handle, +hipsparseStatus_t hipsparseZbsrilu02_numericBoost(hipsparseHandle_t handle, bsrilu02Info_t info, int enable_boost, double* tol, - cuDoubleComplex* boost_val) { + hipDoubleComplex* boost_val) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseXbsrilu02_zeroPivot(cusparseHandle_t handle, +hipsparseStatus_t hipsparseXbsrilu02_zeroPivot(hipsparseHandle_t handle, bsrilu02Info_t info, int* position) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseSbsrilu02_bufferSize(cusparseHandle_t handle, - cusparseDirection_t dirA, +hipsparseStatus_t hipsparseSbsrilu02_bufferSize(hipsparseHandle_t handle, + hipsparseDirection_t dirA, int mb, int nnzb, - const cusparseMatDescr_t descrA, + const hipsparseMatDescr_t descrA, float* bsrSortedVal, const int* bsrSortedRowPtr, const int* bsrSortedColInd, @@ -120,11 +120,11 @@ hipsparseStatus_t cusparseSbsrilu02_bufferSize(cusparseHandle_t handle, return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseDbsrilu02_bufferSize(cusparseHandle_t handle, - cusparseDirection_t dirA, +hipsparseStatus_t hipsparseDbsrilu02_bufferSize(hipsparseHandle_t handle, + hipsparseDirection_t dirA, int mb, int nnzb, - const cusparseMatDescr_t descrA, + const hipsparseMatDescr_t descrA, double* bsrSortedVal, const int* bsrSortedRowPtr, const int* bsrSortedColInd, @@ -134,12 +134,12 @@ hipsparseStatus_t cusparseDbsrilu02_bufferSize(cusparseHandle_t handle, return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseCbsrilu02_bufferSize(cusparseHandle_t handle, - cusparseDirection_t dirA, +hipsparseStatus_t hipsparseCbsrilu02_bufferSize(hipsparseHandle_t handle, + hipsparseDirection_t dirA, int mb, int nnzb, - const cusparseMatDescr_t descrA, - cuComplex* bsrSortedVal, + const hipsparseMatDescr_t descrA, + hipComplex* bsrSortedVal, const int* bsrSortedRowPtr, const int* bsrSortedColInd, int blockDim, @@ -148,12 +148,12 @@ hipsparseStatus_t cusparseCbsrilu02_bufferSize(cusparseHandle_t handle, return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseZbsrilu02_bufferSize(cusparseHandle_t handle, - cusparseDirection_t dirA, +hipsparseStatus_t hipsparseZbsrilu02_bufferSize(hipsparseHandle_t handle, + hipsparseDirection_t dirA, int mb, int nnzb, - const cusparseMatDescr_t descrA, - cuDoubleComplex* bsrSortedVal, + const hipsparseMatDescr_t descrA, + hipDoubleComplex* bsrSortedVal, const int* bsrSortedRowPtr, const int* bsrSortedColInd, int blockDim, @@ -162,146 +162,146 @@ hipsparseStatus_t cusparseZbsrilu02_bufferSize(cusparseHandle_t handle, return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseSbsrilu02_analysis(cusparseHandle_t handle, - cusparseDirection_t dirA, +hipsparseStatus_t hipsparseSbsrilu02_analysis(hipsparseHandle_t handle, + hipsparseDirection_t dirA, int mb, int nnzb, - const cusparseMatDescr_t descrA, + const hipsparseMatDescr_t descrA, float* bsrSortedVal, const int* bsrSortedRowPtr, const int* bsrSortedColInd, int blockDim, bsrilu02Info_t info, - cusparseSolvePolicy_t policy, + hipsparseSolvePolicy_t policy, void* pBuffer) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseDbsrilu02_analysis(cusparseHandle_t handle, - cusparseDirection_t dirA, +hipsparseStatus_t hipsparseDbsrilu02_analysis(hipsparseHandle_t handle, + hipsparseDirection_t dirA, int mb, int nnzb, - const cusparseMatDescr_t descrA, + const hipsparseMatDescr_t descrA, double* bsrSortedVal, const int* bsrSortedRowPtr, const int* bsrSortedColInd, int blockDim, bsrilu02Info_t info, - cusparseSolvePolicy_t policy, + hipsparseSolvePolicy_t policy, void* pBuffer) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseCbsrilu02_analysis(cusparseHandle_t handle, - cusparseDirection_t dirA, +hipsparseStatus_t hipsparseCbsrilu02_analysis(hipsparseHandle_t handle, + hipsparseDirection_t dirA, int mb, int nnzb, - const cusparseMatDescr_t descrA, - cuComplex* bsrSortedVal, + const hipsparseMatDescr_t descrA, + hipComplex* bsrSortedVal, const int* bsrSortedRowPtr, const int* bsrSortedColInd, int blockDim, bsrilu02Info_t info, - cusparseSolvePolicy_t policy, + hipsparseSolvePolicy_t policy, void* pBuffer) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseZbsrilu02_analysis(cusparseHandle_t handle, - cusparseDirection_t dirA, +hipsparseStatus_t hipsparseZbsrilu02_analysis(hipsparseHandle_t handle, + hipsparseDirection_t dirA, int mb, int nnzb, - const cusparseMatDescr_t descrA, - cuDoubleComplex* bsrSortedVal, + const hipsparseMatDescr_t descrA, + hipDoubleComplex* bsrSortedVal, const int* bsrSortedRowPtr, const int* bsrSortedColInd, int blockDim, bsrilu02Info_t info, - cusparseSolvePolicy_t policy, + hipsparseSolvePolicy_t policy, void* pBuffer) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseSbsrilu02(cusparseHandle_t handle, - cusparseDirection_t dirA, +hipsparseStatus_t hipsparseSbsrilu02(hipsparseHandle_t handle, + hipsparseDirection_t dirA, int mb, int nnzb, - const cusparseMatDescr_t descrA, + const hipsparseMatDescr_t descrA, float* bsrSortedVal, const int* bsrSortedRowPtr, const int* bsrSortedColInd, int blockDim, bsrilu02Info_t info, - cusparseSolvePolicy_t policy, + hipsparseSolvePolicy_t policy, void* pBuffer) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseDbsrilu02(cusparseHandle_t handle, - cusparseDirection_t dirA, +hipsparseStatus_t hipsparseDbsrilu02(hipsparseHandle_t handle, + hipsparseDirection_t dirA, int mb, int nnzb, - const cusparseMatDescr_t descrA, + const hipsparseMatDescr_t descrA, double* bsrSortedVal, const int* bsrSortedRowPtr, const int* bsrSortedColInd, int blockDim, bsrilu02Info_t info, - cusparseSolvePolicy_t policy, + hipsparseSolvePolicy_t policy, void* pBuffer) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseCbsrilu02(cusparseHandle_t handle, - cusparseDirection_t dirA, +hipsparseStatus_t hipsparseCbsrilu02(hipsparseHandle_t handle, + hipsparseDirection_t dirA, int mb, int nnzb, - const cusparseMatDescr_t descrA, - cuComplex* bsrSortedVal, + const hipsparseMatDescr_t descrA, + hipComplex* bsrSortedVal, const int* bsrSortedRowPtr, const int* bsrSortedColInd, int blockDim, bsrilu02Info_t info, - cusparseSolvePolicy_t policy, + hipsparseSolvePolicy_t policy, void* pBuffer) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseZbsrilu02(cusparseHandle_t handle, - cusparseDirection_t dirA, +hipsparseStatus_t hipsparseZbsrilu02(hipsparseHandle_t handle, + hipsparseDirection_t dirA, int mb, int nnzb, - const cusparseMatDescr_t descrA, - cuDoubleComplex* bsrSortedVal, + const hipsparseMatDescr_t descrA, + hipDoubleComplex* bsrSortedVal, const int* bsrSortedRowPtr, const int* bsrSortedColInd, int blockDim, bsrilu02Info_t info, - cusparseSolvePolicy_t policy, + hipsparseSolvePolicy_t policy, void* pBuffer) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } #endif -#if HIP_VERSION < 308 -hipsparseStatus_t cusparseCreateBsric02Info(bsric02Info_t* info) { +#if HIP_VERSION < 30800000 +hipsparseStatus_t hipsparseCreateBsric02Info(bsric02Info_t* info) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseDestroyBsric02Info(bsric02Info_t info) { +hipsparseStatus_t hipsparseDestroyBsric02Info(bsric02Info_t info) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseXbsric02_zeroPivot(cusparseHandle_t handle, +hipsparseStatus_t hipsparseXbsric02_zeroPivot(hipsparseHandle_t handle, bsric02Info_t info, int* position) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseSbsric02_bufferSize(cusparseHandle_t handle, - cusparseDirection_t dirA, +hipsparseStatus_t hipsparseSbsric02_bufferSize(hipsparseHandle_t handle, + hipsparseDirection_t dirA, int mb, int nnzb, - const cusparseMatDescr_t descrA, + const hipsparseMatDescr_t descrA, float* bsrSortedVal, const int* bsrSortedRowPtr, const int* bsrSortedColInd, @@ -311,11 +311,11 @@ hipsparseStatus_t cusparseSbsric02_bufferSize(cusparseHandle_t handle, return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseDbsric02_bufferSize(cusparseHandle_t handle, - cusparseDirection_t dirA, +hipsparseStatus_t hipsparseDbsric02_bufferSize(hipsparseHandle_t handle, + hipsparseDirection_t dirA, int mb, int nnzb, - const cusparseMatDescr_t descrA, + const hipsparseMatDescr_t descrA, double* bsrSortedVal, const int* bsrSortedRowPtr, const int* bsrSortedColInd, @@ -325,12 +325,12 @@ hipsparseStatus_t cusparseDbsric02_bufferSize(cusparseHandle_t handle, return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseCbsric02_bufferSize(cusparseHandle_t handle, - cusparseDirection_t dirA, +hipsparseStatus_t hipsparseCbsric02_bufferSize(hipsparseHandle_t handle, + hipsparseDirection_t dirA, int mb, int nnzb, - const cusparseMatDescr_t descrA, - cuComplex* bsrSortedVal, + const hipsparseMatDescr_t descrA, + hipComplex* bsrSortedVal, const int* bsrSortedRowPtr, const int* bsrSortedColInd, int blockDim, @@ -339,12 +339,12 @@ hipsparseStatus_t cusparseCbsric02_bufferSize(cusparseHandle_t handle, return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseZbsric02_bufferSize(cusparseHandle_t handle, - cusparseDirection_t dirA, +hipsparseStatus_t hipsparseZbsric02_bufferSize(hipsparseHandle_t handle, + hipsparseDirection_t dirA, int mb, int nnzb, - const cusparseMatDescr_t descrA, - cuDoubleComplex* bsrSortedVal, + const hipsparseMatDescr_t descrA, + hipDoubleComplex* bsrSortedVal, const int* bsrSortedRowPtr, const int* bsrSortedColInd, int blockDim, @@ -353,130 +353,130 @@ hipsparseStatus_t cusparseZbsric02_bufferSize(cusparseHandle_t handle, return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseSbsric02_analysis(cusparseHandle_t handle, - cusparseDirection_t dirA, +hipsparseStatus_t hipsparseSbsric02_analysis(hipsparseHandle_t handle, + hipsparseDirection_t dirA, int mb, int nnzb, - const cusparseMatDescr_t descrA, + const hipsparseMatDescr_t descrA, const float* bsrSortedVal, const int* bsrSortedRowPtr, const int* bsrSortedColInd, int blockDim, bsric02Info_t info, - cusparseSolvePolicy_t policy, + hipsparseSolvePolicy_t policy, void* pInputBuffer) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseDbsric02_analysis(cusparseHandle_t handle, - cusparseDirection_t dirA, +hipsparseStatus_t hipsparseDbsric02_analysis(hipsparseHandle_t handle, + hipsparseDirection_t dirA, int mb, int nnzb, - const cusparseMatDescr_t descrA, + const hipsparseMatDescr_t descrA, const double* bsrSortedVal, const int* bsrSortedRowPtr, const int* bsrSortedColInd, int blockDim, bsric02Info_t info, - cusparseSolvePolicy_t policy, + hipsparseSolvePolicy_t policy, void* pInputBuffer) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseCbsric02_analysis(cusparseHandle_t handle, - cusparseDirection_t dirA, +hipsparseStatus_t hipsparseCbsric02_analysis(hipsparseHandle_t handle, + hipsparseDirection_t dirA, int mb, int nnzb, - const cusparseMatDescr_t descrA, - const cuComplex* bsrSortedVal, + const hipsparseMatDescr_t descrA, + const hipComplex* bsrSortedVal, const int* bsrSortedRowPtr, const int* bsrSortedColInd, int blockDim, bsric02Info_t info, - cusparseSolvePolicy_t policy, + hipsparseSolvePolicy_t policy, void* pInputBuffer) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseZbsric02_analysis(cusparseHandle_t handle, - cusparseDirection_t dirA, +hipsparseStatus_t hipsparseZbsric02_analysis(hipsparseHandle_t handle, + hipsparseDirection_t dirA, int mb, int nnzb, - const cusparseMatDescr_t descrA, - const cuDoubleComplex* bsrSortedVal, + const hipsparseMatDescr_t descrA, + const hipDoubleComplex* bsrSortedVal, const int* bsrSortedRowPtr, const int* bsrSortedColInd, int blockDim, bsric02Info_t info, - cusparseSolvePolicy_t policy, + hipsparseSolvePolicy_t policy, void* pInputBuffer) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseSbsric02(cusparseHandle_t handle, - cusparseDirection_t dirA, +hipsparseStatus_t hipsparseSbsric02(hipsparseHandle_t handle, + hipsparseDirection_t dirA, int mb, int nnzb, - const cusparseMatDescr_t descrA, + const hipsparseMatDescr_t descrA, float* bsrSortedVal, const int* bsrSortedRowPtr, const int* bsrSortedColInd, int blockDim, bsric02Info_t info, - cusparseSolvePolicy_t policy, + hipsparseSolvePolicy_t policy, void* pBuffer) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseDbsric02(cusparseHandle_t handle, - cusparseDirection_t dirA, +hipsparseStatus_t hipsparseDbsric02(hipsparseHandle_t handle, + hipsparseDirection_t dirA, int mb, int nnzb, - const cusparseMatDescr_t descrA, + const hipsparseMatDescr_t descrA, double* bsrSortedVal, const int* bsrSortedRowPtr, const int* bsrSortedColInd, int blockDim, bsric02Info_t info, - cusparseSolvePolicy_t policy, + hipsparseSolvePolicy_t policy, void* pBuffer) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseCbsric02(cusparseHandle_t handle, - cusparseDirection_t dirA, +hipsparseStatus_t hipsparseCbsric02(hipsparseHandle_t handle, + hipsparseDirection_t dirA, int mb, int nnzb, - const cusparseMatDescr_t descrA, - cuComplex* bsrSortedVal, + const hipsparseMatDescr_t descrA, + hipComplex* bsrSortedVal, const int* bsrSortedRowPtr, const int* bsrSortedColInd, int blockDim, bsric02Info_t info, - cusparseSolvePolicy_t policy, + hipsparseSolvePolicy_t policy, void* pBuffer) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseZbsric02(cusparseHandle_t handle, - cusparseDirection_t dirA, +hipsparseStatus_t hipsparseZbsric02(hipsparseHandle_t handle, + hipsparseDirection_t dirA, int mb, int nnzb, - const cusparseMatDescr_t descrA, - cuDoubleComplex* bsrSortedVal, + const hipsparseMatDescr_t descrA, + hipDoubleComplex* bsrSortedVal, const int* bsrSortedRowPtr, const int* bsrSortedColInd, int blockDim, bsric02Info_t info, - cusparseSolvePolicy_t policy, + hipsparseSolvePolicy_t policy, void* pBuffer) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } #endif -#if HIP_VERSION < 400 -hipsparseStatus_t cusparseScsrilu02_numericBoost(cusparseHandle_t handle, +#if HIP_VERSION < 40000000 +hipsparseStatus_t hipsparseScsrilu02_numericBoost(hipsparseHandle_t handle, csrilu02Info_t info, int enable_boost, double* tol, @@ -484,7 +484,7 @@ hipsparseStatus_t cusparseScsrilu02_numericBoost(cusparseHandle_t handle, return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseDcsrilu02_numericBoost(cusparseHandle_t handle, +hipsparseStatus_t hipsparseDcsrilu02_numericBoost(hipsparseHandle_t handle, csrilu02Info_t info, int enable_boost, double* tol, @@ -492,19 +492,19 @@ hipsparseStatus_t cusparseDcsrilu02_numericBoost(cusparseHandle_t handle, return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseCcsrilu02_numericBoost(cusparseHandle_t handle, +hipsparseStatus_t hipsparseCcsrilu02_numericBoost(hipsparseHandle_t handle, csrilu02Info_t info, int enable_boost, double* tol, - cuComplex* boost_val) { + hipComplex* boost_val) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseZcsrilu02_numericBoost(cusparseHandle_t handle, +hipsparseStatus_t hipsparseZcsrilu02_numericBoost(hipsparseHandle_t handle, csrilu02Info_t info, int enable_boost, double* tol, - cuDoubleComplex* boost_val) { + hipDoubleComplex* boost_val) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } #endif @@ -513,12 +513,12 @@ hipsparseStatus_t cusparseZcsrilu02_numericBoost(cusparseHandle_t handle, #define CUSPARSE_VERSION (hipsparseVersionMajor*100000+hipsparseVersionMinor*100+hipsparseVersionPatch) -// cuSPARSE generic API -#if HIP_VERSION < 402 -typedef void* cusparseSpVecDescr_t; -typedef void* cusparseDnVecDescr_t; -typedef void* cusparseSpMatDescr_t; -typedef void* cusparseDnMatDescr_t; +// hipSPARSE generic API +#if HIP_VERSION < 40200000 +typedef void* hipsparseSpVecDescr_t; +typedef void* hipsparseDnVecDescr_t; +typedef void* hipsparseSpMatDescr_t; +typedef void* hipsparseDnMatDescr_t; typedef enum {} hipsparseIndexType_t; typedef enum {} hipsparseFormat_t; typedef enum {} hipsparseOrder_t; @@ -531,580 +531,580 @@ typedef enum {} hipsparseDenseToSparseAlg_t; #if HIP_VERSION < 50000000 typedef enum {} hipsparseSpMatAttribute_t; typedef enum {} hipsparseSpSMAlg_t; -typedef void * cusparseSpSMDescr_t; +typedef void * hipsparseSpSMDescr_t; #endif -#if HIP_VERSION < 402 -hipsparseStatus_t cusparseCreateSpVec(cusparseSpVecDescr_t* spVecDescr, +#if HIP_VERSION < 40200000 +hipsparseStatus_t hipsparseCreateSpVec(hipsparseSpVecDescr_t* spVecDescr, int64_t size, int64_t nnz, void* indices, void* values, - cusparseIndexType_t idxType, - cusparseIndexBase_t idxBase, - cudaDataType valueType) { + hipsparseIndexType_t idxType, + hipsparseIndexBase_t idxBase, + hipdaDataType valueType) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseDestroySpVec(cusparseSpVecDescr_t spVecDescr) { +hipsparseStatus_t hipsparseDestroySpVec(hipsparseSpVecDescr_t spVecDescr) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseSpVecGet(cusparseSpVecDescr_t spVecDescr, +hipsparseStatus_t hipsparseSpVecGet(hipsparseSpVecDescr_t spVecDescr, int64_t* size, int64_t* nnz, void** indices, void** values, - cusparseIndexType_t* idxType, - cusparseIndexBase_t* idxBase, - cudaDataType* valueType) { + hipsparseIndexType_t* idxType, + hipsparseIndexBase_t* idxBase, + hipdaDataType* valueType) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseSpVecGetIndexBase(cusparseSpVecDescr_t spVecDescr, - cusparseIndexBase_t* idxBase) { +hipsparseStatus_t hipsparseSpVecGetIndexBase(hipsparseSpVecDescr_t spVecDescr, + hipsparseIndexBase_t* idxBase) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseSpVecGetValues(cusparseSpVecDescr_t spVecDescr, +hipsparseStatus_t hipsparseSpVecGetValues(hipsparseSpVecDescr_t spVecDescr, void** values) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseSpVecSetValues(cusparseSpVecDescr_t spVecDescr, +hipsparseStatus_t hipsparseSpVecSetValues(hipsparseSpVecDescr_t spVecDescr, void* values) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseCreateCoo(cusparseSpMatDescr_t* spMatDescr, +hipsparseStatus_t hipsparseCreateCoo(hipsparseSpMatDescr_t* spMatDescr, int64_t rows, int64_t cols, int64_t nnz, void* cooRowInd, void* cooColInd, void* cooValues, - cusparseIndexType_t cooIdxType, - cusparseIndexBase_t idxBase, - cudaDataType valueType) { + hipsparseIndexType_t cooIdxType, + hipsparseIndexBase_t idxBase, + hipdaDataType valueType) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseCreateCooAoS(cusparseSpMatDescr_t* spMatDescr, +hipsparseStatus_t hipsparseCreateCooAoS(hipsparseSpMatDescr_t* spMatDescr, int64_t rows, int64_t cols, int64_t nnz, void* cooInd, void* cooValues, - cusparseIndexType_t cooIdxType, - cusparseIndexBase_t idxBase, - cudaDataType valueType) { + hipsparseIndexType_t cooIdxType, + hipsparseIndexBase_t idxBase, + hipdaDataType valueType) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseCreateCsr(cusparseSpMatDescr_t* spMatDescr, +hipsparseStatus_t hipsparseCreateCsr(hipsparseSpMatDescr_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) { + hipsparseIndexType_t csrRowOffsetsType, + hipsparseIndexType_t csrColIndType, + hipsparseIndexBase_t idxBase, + hipdaDataType valueType) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseCreateCsc(cusparseSpMatDescr_t* spMatDescr, +hipsparseStatus_t hipsparseCreateCsc(hipsparseSpMatDescr_t* spMatDescr, int64_t rows, int64_t cols, int64_t nnz, void* cscColOffsets, void* cscRowInd, void* cscValues, - cusparseIndexType_t cscColOffsetsType, - cusparseIndexType_t cscRowIndType, - cusparseIndexBase_t idxBase, - cudaDataType valueType) { + hipsparseIndexType_t cscColOffsetsType, + hipsparseIndexType_t cscRowIndType, + hipsparseIndexBase_t idxBase, + hipdaDataType valueType) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseDestroySpMat(cusparseSpMatDescr_t spMatDescr) { +hipsparseStatus_t hipsparseDestroySpMat(hipsparseSpMatDescr_t spMatDescr) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseCooGet(cusparseSpMatDescr_t spMatDescr, +hipsparseStatus_t hipsparseCooGet(hipsparseSpMatDescr_t spMatDescr, int64_t* rows, int64_t* cols, int64_t* nnz, void** cooRowInd, // COO row indices void** cooColInd, // COO column indices void** cooValues, // COO values - cusparseIndexType_t* idxType, - cusparseIndexBase_t* idxBase, - cudaDataType* valueType) { + hipsparseIndexType_t* idxType, + hipsparseIndexBase_t* idxBase, + hipdaDataType* valueType) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseCooAoSGet(cusparseSpMatDescr_t spMatDescr, +hipsparseStatus_t hipsparseCooAoSGet(hipsparseSpMatDescr_t spMatDescr, int64_t* rows, int64_t* cols, int64_t* nnz, void** cooInd, // COO indices void** cooValues, // COO values - cusparseIndexType_t* idxType, - cusparseIndexBase_t* idxBase, - cudaDataType* valueType) { + hipsparseIndexType_t* idxType, + hipsparseIndexBase_t* idxBase, + hipdaDataType* valueType) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseCsrGet(cusparseSpMatDescr_t spMatDescr, +hipsparseStatus_t hipsparseCsrGet(hipsparseSpMatDescr_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) { + hipsparseIndexType_t* csrRowOffsetsType, + hipsparseIndexType_t* csrColIndType, + hipsparseIndexBase_t* idxBase, + hipdaDataType* valueType) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseCsrSetPointers(cusparseSpMatDescr_t spMatDescr, +hipsparseStatus_t hipsparseCsrSetPointers(hipsparseSpMatDescr_t spMatDescr, void* csrRowOffsets, void* csrColInd, void* csrValues) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseSpMatGetSize(cusparseSpMatDescr_t spMatDescr, +hipsparseStatus_t hipsparseSpMatGetSize(hipsparseSpMatDescr_t spMatDescr, int64_t* rows, int64_t* cols, int64_t* nnz) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseSpMatGetFormat(cusparseSpMatDescr_t spMatDescr, - cusparseFormat_t* format) { +hipsparseStatus_t hipsparseSpMatGetFormat(hipsparseSpMatDescr_t spMatDescr, + hipsparseFormat_t* format) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseSpMatGetIndexBase(cusparseSpMatDescr_t spMatDescr, - cusparseIndexBase_t* idxBase) { +hipsparseStatus_t hipsparseSpMatGetIndexBase(hipsparseSpMatDescr_t spMatDescr, + hipsparseIndexBase_t* idxBase) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseSpMatGetValues(cusparseSpMatDescr_t spMatDescr, +hipsparseStatus_t hipsparseSpMatGetValues(hipsparseSpMatDescr_t spMatDescr, void** values) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseSpMatSetValues(cusparseSpMatDescr_t spMatDescr, +hipsparseStatus_t hipsparseSpMatSetValues(hipsparseSpMatDescr_t spMatDescr, void* values) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseCreateDnVec(cusparseDnVecDescr_t* dnVecDescr, +hipsparseStatus_t hipsparseCreateDnVec(hipsparseDnVecDescr_t* dnVecDescr, int64_t size, void* values, - cudaDataType valueType) { + hipdaDataType valueType) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseDestroyDnVec(cusparseDnVecDescr_t dnVecDescr) { +hipsparseStatus_t hipsparseDestroyDnVec(hipsparseDnVecDescr_t dnVecDescr) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseDnVecGet(cusparseDnVecDescr_t dnVecDescr, +hipsparseStatus_t hipsparseDnVecGet(hipsparseDnVecDescr_t dnVecDescr, int64_t* size, void** values, - cudaDataType* valueType) { + hipdaDataType* valueType) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseDnVecGetValues(cusparseDnVecDescr_t dnVecDescr, +hipsparseStatus_t hipsparseDnVecGetValues(hipsparseDnVecDescr_t dnVecDescr, void** values) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseDnVecSetValues(cusparseDnVecDescr_t dnVecDescr, +hipsparseStatus_t hipsparseDnVecSetValues(hipsparseDnVecDescr_t dnVecDescr, void* values) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseCreateDnMat(cusparseDnMatDescr_t* dnMatDescr, +hipsparseStatus_t hipsparseCreateDnMat(hipsparseDnMatDescr_t* dnMatDescr, int64_t rows, int64_t cols, int64_t ld, void* values, - cudaDataType valueType, - cusparseOrder_t order) { + hipdaDataType valueType, + hipsparseOrder_t order) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseDestroyDnMat(cusparseDnMatDescr_t dnMatDescr) { +hipsparseStatus_t hipsparseDestroyDnMat(hipsparseDnMatDescr_t dnMatDescr) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseDnMatGet(cusparseDnMatDescr_t dnMatDescr, +hipsparseStatus_t hipsparseDnMatGet(hipsparseDnMatDescr_t dnMatDescr, int64_t* rows, int64_t* cols, int64_t* ld, void** values, - cudaDataType* type, - cusparseOrder_t* order) { + hipdaDataType* type, + hipsparseOrder_t* order) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseDnMatGetValues(cusparseDnMatDescr_t dnMatDescr, +hipsparseStatus_t hipsparseDnMatGetValues(hipsparseDnMatDescr_t dnMatDescr, void** values) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseDnMatSetValues(cusparseDnMatDescr_t dnMatDescr, +hipsparseStatus_t hipsparseDnMatSetValues(hipsparseDnMatDescr_t dnMatDescr, void* values) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseSpVV_bufferSize(cusparseHandle_t handle, - cusparseOperation_t opX, - cusparseSpVecDescr_t vecX, - cusparseDnVecDescr_t vecY, +hipsparseStatus_t hipsparseSpVV_bufferSize(hipsparseHandle_t handle, + hipsparseOperation_t opX, + hipsparseSpVecDescr_t vecX, + hipsparseDnVecDescr_t vecY, const void* result, - cudaDataType computeType, + hipdaDataType computeType, size_t* bufferSize) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseSpVV(cusparseHandle_t handle, - cusparseOperation_t opX, - cusparseSpVecDescr_t vecX, - cusparseDnVecDescr_t vecY, +hipsparseStatus_t hipsparseSpVV(hipsparseHandle_t handle, + hipsparseOperation_t opX, + hipsparseSpVecDescr_t vecX, + hipsparseDnVecDescr_t vecY, void* result, - cudaDataType computeType, + hipdaDataType computeType, void* externalBuffer) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseSpMV_bufferSize(cusparseHandle_t handle, - cusparseOperation_t opA, +hipsparseStatus_t hipsparseSpMV_bufferSize(hipsparseHandle_t handle, + hipsparseOperation_t opA, const void* alpha, - cusparseSpMatDescr_t matA, - cusparseDnVecDescr_t vecX, + hipsparseSpMatDescr_t matA, + hipsparseDnVecDescr_t vecX, const void* beta, - cusparseDnVecDescr_t vecY, - cudaDataType computeType, - cusparseSpMVAlg_t alg, + hipsparseDnVecDescr_t vecY, + hipdaDataType computeType, + hipsparseSpMVAlg_t alg, size_t* bufferSize) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseSpMV(cusparseHandle_t handle, - cusparseOperation_t opA, +hipsparseStatus_t hipsparseSpMV(hipsparseHandle_t handle, + hipsparseOperation_t opA, const void* alpha, - cusparseSpMatDescr_t matA, - cusparseDnVecDescr_t vecX, + hipsparseSpMatDescr_t matA, + hipsparseDnVecDescr_t vecX, const void* beta, - cusparseDnVecDescr_t vecY, - cudaDataType computeType, - cusparseSpMVAlg_t alg, + hipsparseDnVecDescr_t vecY, + hipdaDataType computeType, + hipsparseSpMVAlg_t alg, void* externalBuffer) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseSpMM_bufferSize(cusparseHandle_t handle, - cusparseOperation_t opA, - cusparseOperation_t opB, +hipsparseStatus_t hipsparseSpMM_bufferSize(hipsparseHandle_t handle, + hipsparseOperation_t opA, + hipsparseOperation_t opB, const void* alpha, - cusparseSpMatDescr_t matA, - cusparseDnMatDescr_t matB, + hipsparseSpMatDescr_t matA, + hipsparseDnMatDescr_t matB, const void* beta, - cusparseDnMatDescr_t matC, - cudaDataType computeType, - cusparseSpMMAlg_t alg, + hipsparseDnMatDescr_t matC, + hipdaDataType computeType, + hipsparseSpMMAlg_t alg, size_t* bufferSize) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseSpMM(cusparseHandle_t handle, - cusparseOperation_t opA, - cusparseOperation_t opB, +hipsparseStatus_t hipsparseSpMM(hipsparseHandle_t handle, + hipsparseOperation_t opA, + hipsparseOperation_t opB, const void* alpha, - cusparseSpMatDescr_t matA, - cusparseDnMatDescr_t matB, + hipsparseSpMatDescr_t matA, + hipsparseDnMatDescr_t matB, const void* beta, - cusparseDnMatDescr_t matC, - cudaDataType computeType, - cusparseSpMMAlg_t alg, + hipsparseDnMatDescr_t matC, + hipdaDataType computeType, + hipsparseSpMMAlg_t alg, void* externalBuffer) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseSparseToDense_bufferSize(cusparseHandle_t handle, - cusparseSpMatDescr_t matA, - cusparseDnMatDescr_t matB, - cusparseSparseToDenseAlg_t alg, +hipsparseStatus_t hipsparseSparseToDense_bufferSize(hipsparseHandle_t handle, + hipsparseSpMatDescr_t matA, + hipsparseDnMatDescr_t matB, + hipsparseSparseToDenseAlg_t alg, size_t* bufferSize) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseSparseToDense(cusparseHandle_t handle, - cusparseSpMatDescr_t matA, - cusparseDnMatDescr_t matB, - cusparseSparseToDenseAlg_t alg, +hipsparseStatus_t hipsparseSparseToDense(hipsparseHandle_t handle, + hipsparseSpMatDescr_t matA, + hipsparseDnMatDescr_t matB, + hipsparseSparseToDenseAlg_t alg, void* buffer) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseDenseToSparse_bufferSize(cusparseHandle_t handle, - cusparseDnMatDescr_t matA, - cusparseSpMatDescr_t matB, - cusparseDenseToSparseAlg_t alg, +hipsparseStatus_t hipsparseDenseToSparse_bufferSize(hipsparseHandle_t handle, + hipsparseDnMatDescr_t matA, + hipsparseSpMatDescr_t matB, + hipsparseDenseToSparseAlg_t alg, size_t* bufferSize) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseDenseToSparse_analysis(cusparseHandle_t handle, - cusparseDnMatDescr_t matA, - cusparseSpMatDescr_t matB, - cusparseDenseToSparseAlg_t alg, +hipsparseStatus_t hipsparseDenseToSparse_analysis(hipsparseHandle_t handle, + hipsparseDnMatDescr_t matA, + hipsparseSpMatDescr_t matB, + hipsparseDenseToSparseAlg_t alg, void* buffer) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseDenseToSparse_convert(cusparseHandle_t handle, - cusparseDnMatDescr_t matA, - cusparseSpMatDescr_t matB, - cusparseDenseToSparseAlg_t alg, +hipsparseStatus_t hipsparseDenseToSparse_convert(hipsparseHandle_t handle, + hipsparseDnMatDescr_t matA, + hipsparseSpMatDescr_t matB, + hipsparseDenseToSparseAlg_t alg, void* buffer) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } #endif -#if HIP_VERSION < 403 -hipsparseStatus_t cusparseSgtsv2_bufferSizeExt(...) { +#if HIP_VERSION < 40300000 +hipsparseStatus_t hipsparseSgtsv2_bufferSizeExt(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseDgtsv2_bufferSizeExt(...) { +hipsparseStatus_t hipsparseDgtsv2_bufferSizeExt(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseCgtsv2_bufferSizeExt(...) { +hipsparseStatus_t hipsparseCgtsv2_bufferSizeExt(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseZgtsv2_bufferSizeExt(...) { +hipsparseStatus_t hipsparseZgtsv2_bufferSizeExt(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseSgtsv2(...) { +hipsparseStatus_t hipsparseSgtsv2(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseDgtsv2(...) { +hipsparseStatus_t hipsparseDgtsv2(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseCgtsv2(...) { +hipsparseStatus_t hipsparseCgtsv2(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseZgtsv2(...) { +hipsparseStatus_t hipsparseZgtsv2(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseSgtsv2_nopivot_bufferSizeExt(...) { +hipsparseStatus_t hipsparseSgtsv2_nopivot_bufferSizeExt(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseDgtsv2_nopivot_bufferSizeExt(...) { +hipsparseStatus_t hipsparseDgtsv2_nopivot_bufferSizeExt(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseCgtsv2_nopivot_bufferSizeExt(...) { +hipsparseStatus_t hipsparseCgtsv2_nopivot_bufferSizeExt(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseZgtsv2_nopivot_bufferSizeExt(...) { +hipsparseStatus_t hipsparseZgtsv2_nopivot_bufferSizeExt(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseSgtsv2_nopivot(...) { +hipsparseStatus_t hipsparseSgtsv2_nopivot(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseDgtsv2_nopivot(...) { +hipsparseStatus_t hipsparseDgtsv2_nopivot(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseCgtsv2_nopivot(...) { +hipsparseStatus_t hipsparseCgtsv2_nopivot(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseZgtsv2_nopivot(...) { +hipsparseStatus_t hipsparseZgtsv2_nopivot(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } #endif -#if HIP_VERSION < 405 -hipsparseStatus_t cusparseSgtsv2StridedBatch_bufferSizeExt(...) { +#if HIP_VERSION < 40500000 +hipsparseStatus_t hipsparseSgtsv2StridedBatch_bufferSizeExt(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseDgtsv2StridedBatch_bufferSizeExt(...) { +hipsparseStatus_t hipsparseDgtsv2StridedBatch_bufferSizeExt(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseCgtsv2StridedBatch_bufferSizeExt(...) { +hipsparseStatus_t hipsparseCgtsv2StridedBatch_bufferSizeExt(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseZgtsv2StridedBatch_bufferSizeExt(...) { +hipsparseStatus_t hipsparseZgtsv2StridedBatch_bufferSizeExt(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseSgtsv2StridedBatch(...) { +hipsparseStatus_t hipsparseSgtsv2StridedBatch(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseDgtsv2StridedBatch(...) { +hipsparseStatus_t hipsparseDgtsv2StridedBatch(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseCgtsv2StridedBatch(...) { +hipsparseStatus_t hipsparseCgtsv2StridedBatch(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseZgtsv2StridedBatch(...) { +hipsparseStatus_t hipsparseZgtsv2StridedBatch(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } #endif #if HIP_VERSION < 50000000 -hipsparseStatus_t cusparseSpMatSetAttribute(cusparseSpMatDescr_t spMatDescr, - cusparseSpMatAttribute_t attribute, +hipsparseStatus_t hipsparseSpMatSetAttribute(hipsparseSpMatDescr_t spMatDescr, + hipsparseSpMatAttribute_t attribute, void* data, size_t dataSize) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseSpSM_createDescr(cusparseSpSMDescr_t* descr) { +hipsparseStatus_t hipsparseSpSM_createDescr(hipsparseSpSMDescr_t* descr) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseSpSM_destroyDescr(cusparseSpSMDescr_t descr) { +hipsparseStatus_t hipsparseSpSM_destroyDescr(hipsparseSpSMDescr_t descr) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseSpSM_bufferSize(cusparseHandle_t handle, - cusparseOperation_t opA, - cusparseOperation_t opB, +hipsparseStatus_t hipsparseSpSM_bufferSize(hipsparseHandle_t handle, + hipsparseOperation_t opA, + hipsparseOperation_t opB, const void* alpha, - cusparseSpMatDescr_t matA, - cusparseDnMatDescr_t matB, - cusparseDnMatDescr_t matC, - cudaDataType computeType, - cusparseSpSMAlg_t alg, - cusparseSpSMDescr_t spsmDescr, + hipsparseSpMatDescr_t matA, + hipsparseDnMatDescr_t matB, + hipsparseDnMatDescr_t matC, + hipdaDataType computeType, + hipsparseSpSMAlg_t alg, + hipsparseSpSMDescr_t spsmDescr, size_t* bufferSize) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseSpSM_analysis(cusparseHandle_t handle, - cusparseOperation_t opA, - cusparseOperation_t opB, +hipsparseStatus_t hipsparseSpSM_analysis(hipsparseHandle_t handle, + hipsparseOperation_t opA, + hipsparseOperation_t opB, const void* alpha, - cusparseSpMatDescr_t matA, - cusparseDnMatDescr_t matB, - cusparseDnMatDescr_t matC, - cudaDataType computeType, - cusparseSpSMAlg_t alg, - cusparseSpSMDescr_t spsmDescr, + hipsparseSpMatDescr_t matA, + hipsparseDnMatDescr_t matB, + hipsparseDnMatDescr_t matC, + hipdaDataType computeType, + hipsparseSpSMAlg_t alg, + hipsparseSpSMDescr_t spsmDescr, void* externalBuffer) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -// See cusparse.pyx for a comment -hipsparseStatus_t cusparseSpSM_solve(cusparseHandle_t handle, - cusparseOperation_t opA, - cusparseOperation_t opB, +// See hipsparse.pyx for a comment +hipsparseStatus_t hipsparseSpSM_solve(hipsparseHandle_t handle, + hipsparseOperation_t opA, + hipsparseOperation_t opB, const void* alpha, - cusparseSpMatDescr_t matA, - cusparseDnMatDescr_t matB, - cusparseDnMatDescr_t matC, - cudaDataType computeType, - cusparseSpSMAlg_t alg, - cusparseSpSMDescr_t spsmDescr, + hipsparseSpMatDescr_t matA, + hipsparseDnMatDescr_t matB, + hipsparseDnMatDescr_t matC, + hipdaDataType computeType, + hipsparseSpSMAlg_t alg, + hipsparseSpSMDescr_t spsmDescr, void* externalBuffer) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } #endif -#if HIP_VERSION < 501 -hipsparseStatus_t cusparseSgtsvInterleavedBatch_bufferSizeExt(...) { +#if HIP_VERSION < 50100000 +hipsparseStatus_t hipsparseSgtsvInterleavedBatch_bufferSizeExt(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseDgtsvInterleavedBatch_bufferSizeExt(...) { +hipsparseStatus_t hipsparseDgtsvInterleavedBatch_bufferSizeExt(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseCgtsvInterleavedBatch_bufferSizeExt(...) { +hipsparseStatus_t hipsparseCgtsvInterleavedBatch_bufferSizeExt(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseZgtsvInterleavedBatch_bufferSizeExt(...) { +hipsparseStatus_t hipsparseZgtsvInterleavedBatch_bufferSizeExt(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseSgtsvInterleavedBatch(...) { +hipsparseStatus_t hipsparseSgtsvInterleavedBatch(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseDgtsvInterleavedBatch(...) { +hipsparseStatus_t hipsparseDgtsvInterleavedBatch(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseCgtsvInterleavedBatch(...) { +hipsparseStatus_t hipsparseCgtsvInterleavedBatch(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseZgtsvInterleavedBatch(...) { +hipsparseStatus_t hipsparseZgtsvInterleavedBatch(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseSgpsvInterleavedBatch_bufferSizeExt(...) { +hipsparseStatus_t hipsparseSgpsvInterleavedBatch_bufferSizeExt(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseDgpsvInterleavedBatch_bufferSizeExt(...) { +hipsparseStatus_t hipsparseDgpsvInterleavedBatch_bufferSizeExt(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseCgpsvInterleavedBatch_bufferSizeExt(...) { +hipsparseStatus_t hipsparseCgpsvInterleavedBatch_bufferSizeExt(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseZgpsvInterleavedBatch_bufferSizeExt(...) { +hipsparseStatus_t hipsparseZgpsvInterleavedBatch_bufferSizeExt(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseSgpsvInterleavedBatch(...) { +hipsparseStatus_t hipsparseSgpsvInterleavedBatch(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseDgpsvInterleavedBatch(...) { +hipsparseStatus_t hipsparseDgpsvInterleavedBatch(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseCgpsvInterleavedBatch(...) { +hipsparseStatus_t hipsparseCgpsvInterleavedBatch(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } -hipsparseStatus_t cusparseZgpsvInterleavedBatch(...) { +hipsparseStatus_t hipsparseZgpsvInterleavedBatch(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } From b151336ecc7116fa0c3228a396b90fa0ba97c430 Mon Sep 17 00:00:00 2001 From: bmedishe Date: Wed, 5 Jun 2024 18:59:30 +0000 Subject: [PATCH 29/30] more backward compatibility updates --- cupy_backends/hip/cupy_hipsparse.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/cupy_backends/hip/cupy_hipsparse.h b/cupy_backends/hip/cupy_hipsparse.h index 7bfdccbd991..0f24d3a6d38 100644 --- a/cupy_backends/hip/cupy_hipsparse.h +++ b/cupy_backends/hip/cupy_hipsparse.h @@ -1108,6 +1108,27 @@ hipsparseStatus_t hipsparseZgpsvInterleavedBatch(...) { return HIPSPARSE_STATUS_NOT_SUPPORTED; } +#endif + +#if HIP_VERSION < 52000000 +hipsparseStatus_t hipsparseSpMatGetStridedBatch(hipsparseConstSpMatDescr_t spMatDescr, + int* batchCount){ + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} +hipsparseStatus_t hipsparseSpMatSetStridedBatch(hipsparseConstSpMatDescr_t spMatDescr, + int batchCount){ + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} +hipsparseStatus_t hipsparseDnMatGetStridedBatch(hipsparseConstDnMatDescr_t dnMatDescr, + int* batchCount, + int64_t* batchStride){ + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} +hipsparseStatus_t hipsparseDnMatSetStridedBatch(hipsparseDnMatDescr_t dnMatDescr, + int batchCount, + int64_t batchStride){ + return HIPSPARSE_STATUS_NOT_SUPPORTED; +} #endif } // extern "C" From 073075f635c14c38944d0528ac91dcef5a626542 Mon Sep 17 00:00:00 2001 From: bmedishe Date: Wed, 5 Jun 2024 19:18:50 +0000 Subject: [PATCH 30/30] backward compatibility fix --- cupy_backends/hip/cupy_hipsparse.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cupy_backends/hip/cupy_hipsparse.h b/cupy_backends/hip/cupy_hipsparse.h index 0f24d3a6d38..9ad29fe933c 100644 --- a/cupy_backends/hip/cupy_hipsparse.h +++ b/cupy_backends/hip/cupy_hipsparse.h @@ -33,6 +33,8 @@ const char* hipsparseGetErrorString(...) { // Unavailable in hipSparse; this should not be called return "unexpected error in CuPy hipSparse binding"; } +typedef void const* hipsparseConstSpMatDescr_t; +typedef void const* hipsparseConstDnMatDescr_t; #endif #if HIP_VERSION < 54000000