This sample demonstrates the usage of cusparseSpMMOp
for performing sparse matrix - dense matrix multiplication with custom operators, where the sparse matrix is represented in CSR (Compressed Sparse Row) storage format.
op_add(X, Y) := X + Y
op_mul(X, Y) := X * Y
epilogue(X, Y) := 2 * X + Y
C_ij = epilogue( op_add(op_add(op_mul(A_i0, B_0j), op_mul(A_i1, B_1j)), op_mul(A_i2, B_2j)) ..., C_ij )
-
Command line
nvcc -I<cuda_toolkit_path>/include spmm_csr_op_example.c -o spmm_csr_op_example -lcusparse
-
Linux
make
-
Windows/Linux
mkdir build cd build cmake .. make
On Windows, instead of running the last build step, open the Visual Studio Solution that was created and build.
- Supported SM Architectures: SM 3.5, SM 3.7, SM 5.0, SM 5.2, SM 5.3, SM 6.0, SM 6.1, SM 6.2, SM 7.0, SM 7.2, SM 7.5, SM 8.0, SM 8.6, SM 8.9, SM 9.0
- Supported OSes: Linux, Windows, QNX
- Supported CPU Architectures: x86_64, ppc64le, arm64
- Supported Compilers: gcc, clang, Intel icc, IBM xlc, Microsoft msvc, Nvidia HPC SDK nvc
- Language:
C99
- CUDA 11.6 toolkit (or above) and compatible driver (see CUDA Driver Release Notes).
- CMake 3.9 or above on Windows