0

I want to call the sparse matrix multiplication function in cuSPARSE library inside the kernel instead of directly calling it at the host side. I write a __device__ function to implement it.My CUDA is 11.3 and My hardware is V100.My code all follows NVIDIA CUDALibrarySamples: spmm_csr

But it fails with:

error: calling a __host__ function("cusparseSpMM") from a __device__ function("spmm_csr") is not allowed

How can I call it in __device__ function?

Or there are others ways to implement sparse matrix multiplication inside kernel?

talonmies
  • 70,661
  • 34
  • 192
  • 269
ben286
  • 1
  • 1

1 Answers1

1

I want to call the sparse matrix multiplication function in cuSPARSE library inside the kernel instead of directly calling it at the host side

That is not possible. cuSPARSE is a host only library.

talonmies
  • 70,661
  • 34
  • 192
  • 269
  • Thanks!Do you know whether the cuBLAS library is a host only library? – ben286 Dec 05 '22 at 07:57
  • Yes, cuBLAS is now also host only. There was a period where there was also a device side version of cuBLAS, but that was discontinued and removed from the CUDA toolkit several major release cycles ago – talonmies Dec 05 '22 at 09:05
  • @ben286 Some linear algebra features (mostly GEMM) for device code are available through [CUTLASS](https://github.com/NVIDIA/cutlass). – paleonix Dec 05 '22 at 13:32