/spmv-samples

A collection of sample implementations for SpMV using the CSR sparse matrix format on GPU.

Primary LanguageCudaMIT LicenseMIT

SpMV-Samples

A collection of sample implementations for Sparse Matrix-Vector Multiplication (SpMV) using the Compressed Sparse Row (CSR) sparse matrix format on GPU.

Current Supported SpMV Implementations:

Requirements

GCC (version 9.4.0 and above)
CUDA (version 11.8 and above)
CMake (version 3.12 and above)

Setup

Execute the following instructions in the root directory of the project.

mkdir build && cd build
cmake .. 
make

Dataset

Support for Matrix Market format graph datasets.
You can download graph datasets from the website https://sparse.tamu.edu/.

Add Your SpMV

You can add your own CSR sparse matrix format SpMV implementation.
Just encapsulate it with the following interface:

// interface
template <typename index_t, typename offset_t, typename mat_value_t,
          typename vec_x_value_t, typename vec_y_value_t>
void SpMV(const std::string& kind_str,
    index_t n_rows,  index_t n_cols, offset_t nnz,
    const offset_t *Ap, const index_t *Aj, const mat_value_t *Ax, 
    const vec_x_value_t *x, vec_y_value_t *y); 

And define the corresponding label strings and function definitions in the spmv.h header file.

/// SPMV kind strings and its function
#define SPMV_KINDS                       \
    X("cusparse", SpMV_cusparse)         \
    X("YOUR_SPMV_LABEL", YOUR_SPMV_FUNC)