error: identifier "cusparseCreateCsr" is undefined

Hi,

I am developing a tool using CUDA (version 10.1.105) that uses cuBLAS, cuSOLVE and cuSPARSE. I did not have any problem until I needed to use the function:

cusparseCreateCsr()

described in the documentation: https://docs.nvidia.com/cuda/cusparse/index.html#cusparse-generic-spmat-create-csr

When I try to compile my program using the command:

nvcc -o test -L$mkl/mkl/lib/intel64 -I$mkl/mkl/include --gpu-architecture sm_37 main.cu -lcublas -lcurand -lcusolver -lcusparse -lmkl_intel_lp64 -lmkl_gnu_thread -lmkl_core -lgomp -lpthread -lm -ldl

The compiler returns me this error:

error: identifier "cusparseCreateCsr" is undefined

In the header, I am including the folloeing files:

#include <iostream>
#include <cmath>
#include <cassert>
#include <iomanip> 

#include <cusolverDn.h>
#include <cublas_v2.h>
#include <cuda.h>
#include <cuda_runtime_api.h>
#include <cusparse.h>

I did not have any other problem with other cuSPARSE functions, that compile without problems. It is when I try to call this function that I get this error.

I made a search in Google and in this forums, but I was unable to fins any other person describing the same problem.

Could anybody help me?

Many thanks and best regards,

This function is not available in CUDA 10.1.105
That version of CUDA 10.1 is simply called “CUDA 10.1”

The function is new in CUDA 10.1.168, which is referred to as “CUDA 10.1 Update 1”

This is covered in the release notes:

[url]Release Notes :: CUDA Toolkit Documentation

The online docs you linked are applicable to 10.1.168, not 10.1.105

If you have 10.1.105 installed, you will find a doc directory in the install. You can find a pdf copy of the cusparse manual there. That pdf copy will show that there is no such function in CUDA 10.1.105

Either stop using this function, or update to 10.1.168 (CUDA 10.1 Update 1)

Dear Robert,

Many thanks for your answer and your help.

Am I right in thinking that I should use cusparseCreateMatDescr() function in my version?

Again, many thanks.

Best regards,

the two functions are not identical

cusparseCreateCsr is effectively a shorthand for multiple cusparse calls. Yes, the starting point would probably be cusparseCreateMatDescr(), but other calls would be needed to create equivalent functionality to cusparseCreateCsr, such as cusparseSetMatType() and probably others

To see how to use a CSR matrix in your version of CUSPARSE, refer to the CUDA sample codes that use CSR matrices with cusparse. One such code is conjugateGradient

You can also refer to the example given in the cusparse documentation itself, for proper setup, handling, and usage of a CSR matrix:

[url]https://docs.nvidia.com/cuda/cusparse/index.html#appendix-b-cusparse-library-c---example[/url]

Dear Robert,

Many thanks again for your help.

Your messages had been very useful.

All the best,