Implementing a parallel sparse matrix-vector multiplication using dataflow

Brunno F. Goldstein, Tiago A. O. Alves, Michael Souza, Luiz Mariano Carvalho, Leandro A. J. Marzulo, Felipe M. G. FrançaProceeding 2015

Abstract

Sparse matrix-vector multiplication (SpMV) is an important operation in sparse linear algebra problems, representing the dominant cost in many iterative methods for solving large-scale linear systems. In this paper, we propose a dataflow parallel version of the SpMV kernel using the Compressed Sparse Row (CSR) storage format. This implementation is executed in a Dataflow Runtime Environment called Trebuchet. The dataflow model exposes parallelism by essence, triggering task execution as soon as input data is available. Our results show that even a naive dataflow implementation can achieve higher speedups than the Intel Math Kernel Library (MKL) for larger matrices, despite the overheads inherent in the runtime environment for smaller workloads.

Introduction

Sparse Matrix-Vector Multiplication (SpMV) is the "heavy lifter" of scientific computing, serving as the primary bottleneck in iterative methods used to solve massive linear systems in engineering, physics, and data science. The challenge lies in the "sparse" nature of the data—most elements in these matrices are zero. Standard parallelization techniques often rely on the Von Neumann model, where instructions follow a specific, sequential control flow, which can create artificial bottlenecks.

This research investigates whether a Dataflow model—where tasks are treated as nodes in a graph and executed the moment their input data arrives—can handle the irregular memory access patterns of SpMV more efficiently than traditional methods like OpenMP.

Methodology

The researchers implemented a parallel version of the SpMV kernel using the Compressed Sparse Row (CSR) storage format. Their approach utilizes:

  • The Dataflow Model: A dataflow program is a directed graph where nodes represent tasks and edges represent data dependencies. If two tasks do not depend on each other and their data is ready, they run concurrently by default.
  • Trebuchet Runtime: This specific Dataflow Runtime Environment manages task triggering and resource allocation.
  • Baseline Comparison: Results are compared against the Intel Math Kernel Library (MKL), which is highly optimized for Intel processors and uses OpenMP for parallelization.

The experimental environment consisted of a machine with four Quad-Core Intel Core i7-3820 processors running at 3.6GHz and 64 GB RAM.

Experimental Setup

The study evaluated performance using four distinct matrices from the University of Florida Sparse Matrix Collection. These matrices vary in size and structure, ranging from approximately 60,000 to over 3.5 million rows, as detailed in the table below.

Table 1: Characteristics of the matrices used in the evaluation.

Results and Discussion

The performance was measured in terms of speedup, comparing the parallel versions to a sequential implementation.

Figure 1: Speedup comparison between Intel MKL and Trebuchet across different matrices.

The results indicate a clear trade-off between runtime overhead and problem scale:

  • Scale and Efficiency: For the FEM_3D_thermal2 matrix, the Trebuchet dataflow implementation achieved a noticeably higher speedup (approx. 7x) compared to Intel MKL (approx. 5.5x).
  • Runtime Overhead: On the smallest matrix (water_tank), Intel MKL dominated with a speedup of nearly 20x, while Trebuchet lagged at around 13x. This confirms that the dataflow runtime overhead is more visible on smaller workloads.
  • Competitive Performance: For the largest matrix by row count (circuit5M_dc), the dataflow implementation remained competitive with MKL, proving its viability for massive datasets.

Conclusion

This study demonstrates that a "naive" dataflow implementation can outperform industry-standard libraries on large datasets by naturally exposing maximum concurrency. While runtime overhead remains a challenge for smaller matrices, the flexibility of the dataflow model offers significant potential. Future work will focus on improving cache locality, implementing different storage formats, and exploring advanced parallelization patterns to further reduce overhead and enhance performance.

Summary updated

BibTeX
@inproceedings{goldstein2015implementing,
  author = {Brunno F. Goldstein and Tiago A. O. Alves and Michael Souza and Luiz Mariano Carvalho and Leandro A. J. Marzulo and Felipe M. G. França},
  title = {{Implementing a parallel sparse matrix-vector multiplication using dataflow}},
  booktitle = {Proceeding},
  year = {2015},
  doi = {10.5540/03.2015.003.01.0108},
}
Figure