A Work-Efficient Parallel Sparse Matrix-Sparse Vector Multiplication Algorithm

Ariful Azad, Aydin Buluç

TL;DR

Researchers at Lawrence Berkeley National Laboratory have developed SpMSpV-bucket, a new parallel algorithm for sparse matrix-sparse vector multiplication (SpMSpV). By using a clever three-step "bucketing" strategy, the algorithm achieves high scalability and work-efficiency, outperforming existing frameworks like GraphMat and CombBLAS by up to several orders of magnitude on very sparse data.

What Problem Does This Paper Address?

Sparse matrix-sparse vector multiplication (SpMSpV) is the "engine room" of modern graph analytics (like Breadth-First Search or PageRank) and machine learning (like Support Vector Machines). In these applications, both the matrix and the vectors are mostly zeros.

The challenge is that as we increase the number of CPU cores (parallelism), traditional algorithms struggle. They often spend more time "looking" for data in the sparse matrix structure than actually performing math. Existing parallel approaches usually fall into two traps:

  1. Row-splitting: Each thread handles a set of rows. This is easy to parallelize but "work-inefficient" because every thread has to scan the entire input vector, leading to redundant work.
  2. Column-splitting: This is work-efficient but requires expensive synchronization (locks) because multiple threads might try to update the same entry in the output vector simultaneously.

The authors sought a "work-efficient" algorithm—one where the total work performed by all processors is proportional to the work a single processor would do—that also avoids the overhead of synchronization.

Methods

The authors introduce the SpMSpV-bucket algorithm. It operates on the standard Compressed Sparse Column (CSC) matrix format and uses a three-step process:

  1. Bucketing (Step 1): The algorithm identifies which columns of the matrix need to be accessed based on the non-zero entries in the input vector. Instead of writing directly to an output vector, it places these "scaled" column entries into different buckets based on their row indices.
  2. The Secret Sauce: To avoid locks during this step, they use a quick preprocessing pass to calculate exactly how much space each thread needs in each bucket. This allows for lock-free insertion.
  3. Merging (Step 2): Each bucket represents a horizontal slice of the output vector. Because these slices are independent, threads can process buckets in parallel. Each thread uses a Sparse Accumulator (SPA)—a dense array combined with a list of active indices—to merge the entries within its assigned bucket.
  4. Concatenation (Step 3): The results from all buckets are linked together to form the final sparse output vector.

Datasets

The algorithm was evaluated using a diverse set of real-world matrices from the University of Florida Sparse Matrix Collection. These included:

  • Low-diameter graphs: Social networks (LiveJournal) and web crawls (Google, .edu domains).
  • High-diameter graphs: Road networks, circuit simulations, and structural engineering problems.
  • Synthetic graphs: Erdős-Rényi random graphs used for theoretical complexity analysis.

Key Insights and Ideas

  • Avoiding the "Scan" Problem: The key insight is that threads should not individually scan the matrix columns. By bucketing the work first, the algorithm ensures that the matrix is accessed only where necessary.
  • Work-Efficiency is King: For very sparse vectors, matrix-driven algorithms (which iterate over the whole matrix) are incredibly slow. SpMSpV-bucket is "vector-driven," meaning its complexity depends on the number of non-zeros in the input ($f$) and the average non-zeros per column ($d$), resulting in $O(df)$ complexity.
  • Cache Locality via Sorting: While the algorithm works on unsorted data, the authors found that sorting the input vector by index before processing can significantly improve cache performance when the vector is relatively dense, as it makes matrix column access more predictable.

Key Results

The algorithm was tested on two high-performance platforms: an Intel Ivy Bridge (24 cores) and an Intel Knight’s Landing (KNL, 64 cores).

  • Speedup: It achieved up to 15x speedup on the 24-core system and 49x speedup on the 64-core KNL.
  • Superiority on Sparse Data: When the input vector was extremely sparse (e.g., only 50 non-zeros), SpMSpV-bucket was 200x to 744x faster than competitors like CombBLAS and GraphMat.
  • Robustness: Unlike previous algorithms that performed well on social networks but failed on "high-diameter" graphs (like road maps), SpMSpV-bucket maintained high performance across all graph types.

Limitations and Future Work

  • Extreme Sparsity Scaling: While highly efficient, the algorithm's parallel efficiency still drops when the input vector is extremely sparse (e.g., fewer non-zeros than the number of available threads), simply because there isn't enough work to keep all cores busy.
  • Masked Operations: The authors note that the emerging GraphBLAS standard often uses "masked" operations (where we only care about certain parts of the output). Integrating these masks directly into the bucketing logic is a suggested area for future research.
  • Dynamic Environments: In some machine learning applications, the "working set" of the matrix changes. The authors suggest investigating how their data structures handle frequent row/column deletions.

Summary updated

BibTeX
@inproceedings{azad2017work,
  author = {Ariful Azad and Aydin Buluç},
  title = {{A Work-Efficient Parallel Sparse Matrix-Sparse Vector Multiplication Algorithm}},
  booktitle = {IPDPS},
  year = {2017},
  doi = {10.1109/ipdps.2017.76},
}
Figure