Skip to main content

Module spgemm

Module spgemm 

Source
Expand description

Sparse matrix-sparse matrix multiplication (SpGEMM).

Computes C = A * B where A and B are sparse CSR matrices and C is the resulting sparse CSR matrix.

The algorithm uses a two-phase approach:

  1. Symbolic phase (spgemm_symbolic): Determines the sparsity pattern of C by counting non-zeros per row.
  2. Numeric phase (spgemm_numeric): Computes the actual values and column indices of C.

Each phase generates and launches a PTX kernel where each thread handles one row of A, iterates over its non-zeros, and accumulates column entries from corresponding rows of B using a hash-table approach with linear probing for collision resolution.

Functionsยง

spgemm_numeric
Numeric phase of SpGEMM: fills in values and column indices of C = A * B.
spgemm_symbolic
Symbolic phase of SpGEMM: computes the row pointer array for C = A * B.