Converting the dense formatting to the CSR formatting using cusparseSdense2csr

Hi all,
I would like to compile a CUDA source code containing the routine cusparseCreateMatDescr, but I am getting a compilation error as follows:

mkdir -p obj/
nvcc -O3 -arch=sm_86 -c cusparse.cu -o obj/cusparse.o
cusparse.cu(156): error: identifier “cusparseSdense2csr” is undefined
CHECK_CUSPARSE(cusparseSdense2csr(handle, M, N, descr, dA, M, dNnzPerRow,
^

cusparse.cu(160): error: identifier “cusparseScsrmv” is undefined
CHECK_CUSPARSE(cusparseScsrmv(handle, CUSPARSE_OPERATION_NON_TRANSPOSE,
^

2 errors detected in the compilation of “cusparse.cu”.
make: *** [Makefile:22: obj/cusparse.o] Error 2

I am using Ubuntu 20.04.1 OS; Checking the include directory

pwd
/usr/local/cuda-12.4/targets/x86_64-linux/include
grep “cusparseSdense2csr” cusparse.h
:/usr/local/cuda-12.4/targets/x86_64-linux/include$ grep -r “cusparseSdense2csr”
:/usr/local/cuda-12.4/targets/x86_64-linux/include$

The cusparseSdense2csr is not in the *.h files. The version of nvcc and driver is as follows:

nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2024 NVIDIA Corporation
Built on Thu_Mar_28_02:18:24_PDT_2024
Cuda compilation tools, release 12.4, V12.4.131
Build cuda_12.4.r12.4/compiler.34097967_0

nvidia-smi
Wed Apr 10 20:23:19 2024
±----------------------------------------------------------------------------------------+
| NVIDIA-SMI 550.54.15 Driver Version: 550.54.15 CUDA Version: 12.4 |
|-----------------------------------------±-----------------------±---------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+========================+======================|
| 0 NVIDIA GeForce RTX 3050 … Off | 00000000:01:00.0 Off | N/A |
| N/A 43C P3 N/A / 35W | 12MiB / 4096MiB | 0% Default |
| | | N/A |
±----------------------------------------±-----------------------±---------------------+

±----------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=========================================================================================|
| 0 N/A N/A 1621 G /usr/lib/xorg/Xorg 4MiB |
| 0 N/A N/A 2596 G /usr/lib/xorg/Xorg 4MiB |
±----------------------------------------------------------------------------------------+

The compiler is failing to find the cusparseSdense2csr in the header file. Is this routine deprecated?

I saw some sample codes in the cuSPARSE 12.4 documentation using this routine. I would appreciate any guidance and help in this regard.

The compiler errors indicate that at lines 156, 160 of cusparse.cu the code is calling cusparseScsrmv and cusparseSdense2csr. These routines have been removed in CUDA 11, and there are no mention of them in the documentation. Now they have been replaced by cusparseSpMV() and cusparseDenseToSparse()

Hi fbusato,

I sincerely appreciate your thorough and helpful explanation and guidance.

Kind regards,
Kazem