Skip to content

ivhak/spmv-hip

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

spmv-hip
--------

Example program for computing a sparse matrix-vector multiplication with a
matrix in the compressed sparse row (CSR) and ELLPACK formats.

The program takes a Matrix Market file, and performs sparse matrix-vector
multiplication with it and a vector of ones of the appropriate size. See Usage.


Compiling on eX³
----------------

AMD

    The ROCm toolchain is installed on n004 (mi100q). Run the following command
    to compile for AMD and produce the binary `spmv-hip-amd`:

        $ make clean amd

NVIDIA

    To compile for NVIDIA, the ROCm toolchain is still required, i.e., it is
    still required to be on n004. To produce the binary `spmv-hip-nvidia`, run
    the following commands:

        $ module load cuda11.0/toolkit/11.0.3
        $ make clean nvidia

Usage
-----

    ./spmv-hip-[amd|nvidia] [-f FORMAT] [-c] [-v] [-i NUM] [-m NUM] [-h] INPUT_FILE

    Options:
       -h         Show usage.

       -c         Run the benchmarks on the CPU as well as the GPU.

       -i  NUM    Run the benchmarks for NUM iterations.

       -v         Be verbose, show the output of the SpMV calculation(s).

       -f  FORMAT Run the benchmarks using the format FORMAT, where FORMAT
                  is either CSR or ELLPACK. More than one format can be specified
                  by repeating the option. Defaults to running all formats if no
                  format is specified.

       -m  NUM    Sets the maximum number of nonzero values per row for the
                  matrix in INPUT_FILE. Must be less than or equal to the
                  number of columns in the matrix. Required when using the
                  ELLPACK format.

    Example:

       Run ELLPACK on both the GPU and CPU, on the matrix in mat.mtx,
       which has 16 nonzeros per row:

           ./spmv-hip-[amd|nvidia] -f ELLPACK -m 16 -c mat.mtx

ANSI C library for Matrix Market I/O
------------------------------------

The files `src/mmio.h` and `src/mmio.c` are from the "NIST ANSI C library for Matrix Market I/O"
(https://math.nist.gov/MatrixMarket/mmio-c.html).

About

Example program for computing a sparse matrix-vector multiplication with a matrix in the compressed sparse row (CSR) and ELLPACK formats in HIP.

Resources

License

Stars

Watchers

Forks

Contributors

Languages

  • C 57.6%
  • C++ 40.6%
  • Makefile 1.8%