I am trying to use Cusparse as below but the buffer is requiring 22 TB memory regardless of matrix size. I would appreciate it if you can comment. I didn’t find any specific remedy on documents.
…
! Creating the descriptor for the sparse matrix Bbar
istat = cusparseCreate(h_Bbar)
istat = cusparseCreateMatDescr(descr_Bbar)
istat = cusparseSetMatType(descr_Bbar,CUSPARSE_MATRIX_TYPE_GENERAL)
istat = cusparseSetMatIndexBase(descr_Bbar,CUSPARSE_INDEX_BASE_ONE)
#if CUDA_VERSION >= 11000
istat = cusparseCreateCsr(spMatDescr_Bbar,ntsx3,ntbx3,nnz_Bbar,B_RowPtr_d,B_ColInd_d,B_Val_d,CUSPARSE_INDEX_32I,&
CUSPARSE_INDEX_32I,CUSPARSE_INDEX_BASE_ONE,CUDA_R_64F)
if (istat /= CUSPARSE_STATUS_SUCCESS) print’(" cusparseCreateCsr Error : ",i)',istat
#endif
! Specifying the buffer size for csr2csc for Bbar and also performing the conversion
#if CUDA_VERSION >= 11000
! Specifying the buffer size
istat = cusparseCsr2cscEx2_buffersize(h_Bbar,ntsx3,ntbx3,nnz_Bbar,Bbar_Val_d,Bbar_RowPtr_d,Bbar_ColInd_d,&
Bbar_Val_tr_d,Bbar_ColPtr_d,Bbar_RowInd_d,CUDA_R_64F,CUSPARSE_ACTION_NUMERIC,CUSPARSE_INDEX_BASE_ONE,&
CUSPARSE_CSRMV_ALG2,bsize)
print’(" cusparseCsr2cscEx2 buffersize required in init_conv: ",i)',bsize
if (bsize > 0) allocate(buffer(bsize))
! Performing the csr2csc conversion
istat = cusparseCsr2cscEx2(h_Bbar,ntsx3,ntbx3,nnz_Bbar,Bbar_Val_d,Bbar_RowPtr_d,Bbar_ColInd_d,&
Bbar_Val_tr_d,Bbar_ColPtr_d,Bbar_RowInd_d,CUDA_R_64F,CUSPARSE_ACTION_NUMERIC,CUSPARSE_INDEX_BASE_ONE,&
CUSPARSE_CSRMV_ALG2,buffer)
if (istat /= CUSPARSE_STATUS_SUCCESS) print'(" cusparseCsr2cscEx2 Error : ",i)',istat