a systematic survey of general sparse matrix-matrix ... · school of computer science and...

19
A Systematic Survey of General Sparse Matrix-Matrix Multiplication Jianhua Gao School of Computer Science and Technology Beijing Institute of Technology Beijing, China [email protected] Weixing Ji School of Computer Science and Technology Beijing Institute of Technology Beijing, China [email protected] Zhaonian Tan School of Computer Science and Technology Beijing Institute of Technology Beijing, China tan [email protected] Yueyan Zhao School of Information and Electronics Beijing Institute of Technology Beijing, China [email protected] Abstract—SpGEMM (General Sparse Matrix-Matrix Multipli- cation) has attracted much attention from researchers in fields of multigrid methods and graph analysis. Many optimization techniques have been developed for certain application fields and computing architecture over the decades. The objective of this paper is to provide a structured and comprehensive overview of the research on SpGEMM. Existing optimization techniques have been grouped into different categories based on their target problems and architectures. Covered topics include SpGEMM applications, size prediction of result matrix, matrix partitioning and load balancing, result accumulating, and target architecture- oriented optimization. The rationales of different algorithms in each category are analyzed, and a wide range of SpGEMM algo- rithms are summarized. This survey sufficiently reveals the latest progress and research status of SpGEMM optimization from 1977 to 2019. More specifically, an experimentally comparative study of existing implementations on CPU and GPU is presented. Based on our findings, we highlight future research directions and how future studies can leverage our findings to encourage better design and implementation. Index Terms—SpGEMM, Parallel Optimization, Sparse Matrix Partitioning, Parallel Architecture. I. I NTRODUCTION General sparse matrix-matrix multiplication, abbreviated as SpGEMM, is a fundamental and expensive computational ker- nel in numerous scientific computing applications and graph algorithms, such as algebraic multigrid solvers [1] [2] [3] [4], triangle counting [5] [6] [7] [8], multi-source breadth- first searching [9] [10] [11], the shortest path finding [12], colored intersecting [13] [14], and subgraphs [15] [16]. Hence the optimization of SpGEMM has the potential to impact a wide variety of applications. Given two input sparse matrices A and B, SpGEMM computes a sparse matrix C such that C = A × B, where A R p×q ,B R q×r ,C R p×r , and the operator × represents the general matrix multiplication. Let a ij denote the element in the ith row and the j th column of matrix A, and we write a i* to denote the vector comprising of the entries in the ith row of A, also a *j to denote the vector comprising of the entries in the j th column of A. In the general matrix- matrix multiplication (GEMM), the ith row of the result matrix C can be generated by c i* =(a i* · b *1 ,a i* · b *2 , ..., a i* · b *r ), (1) where the operation · represents the dot product of two vectors [17]. Compared with GEMM, SpGEMM requires to exploit the sparsity of the two input matrices and the result matrix because of huge memory and computational cost for the zero entries with dense formats. Most of the research on SpGEMM is proposed based on the row-wise SpGEMM algorithm given by Gustavson [18]. The i-th row of the result matrix C is given by c i* = j a ij * b j* , where the operator * represents the scalar multiplication, and the computation only occurs in non-zero entries of sparse matrices A and B. The pseudocode for Gustavson’s SpGEMM algorithm is presented in Algorithm 1. The goal of this survey paper is to provide a structured and broad overview of extensive research on SpGEMM design and implementations spanning multiple application domains and research areas. We not only strive to provide an overview of existing algorithms, data structures, and libraries available but also try to uncover the design decisions behind the various implementation by the designers. It gives an in-depth presentation of the many algorithms and libraries available for computing SpGEMM. Sparse matrix has been a hot topic of many surveys and reviews. Duff et al. [19] provide an extensive survey of sparse matrix research developed before the year of 1976. A broad review of the sparse matrix and vector multiplication is presented by Grossman et al. [20]. Over the past decades, SpGEMM attracts intensive attention in a wide range of application fields, and many new designs and optimizations are proposed targeting different architectures. The development of arXiv:2002.11273v1 [cs.DC] 26 Feb 2020

Upload: others

Post on 25-Jul-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: A Systematic Survey of General Sparse Matrix-Matrix ... · School of Computer Science and Technology Beijing Institute of Technology Beijing, China tan zn@163.com Yueyan Zhao School

A Systematic Survey of General SparseMatrix-Matrix Multiplication

Jianhua GaoSchool of Computer Science and Technology

Beijing Institute of TechnologyBeijing, [email protected]

Weixing JiSchool of Computer Science and Technology

Beijing Institute of TechnologyBeijing, [email protected]

Zhaonian TanSchool of Computer Science and Technology

Beijing Institute of TechnologyBeijing, China

tan [email protected]

Yueyan ZhaoSchool of Information and Electronics

Beijing Institute of TechnologyBeijing, China

[email protected]

Abstract—SpGEMM (General Sparse Matrix-Matrix Multipli-cation) has attracted much attention from researchers in fieldsof multigrid methods and graph analysis. Many optimizationtechniques have been developed for certain application fields andcomputing architecture over the decades. The objective of thispaper is to provide a structured and comprehensive overviewof the research on SpGEMM. Existing optimization techniqueshave been grouped into different categories based on their targetproblems and architectures. Covered topics include SpGEMMapplications, size prediction of result matrix, matrix partitioningand load balancing, result accumulating, and target architecture-oriented optimization. The rationales of different algorithms ineach category are analyzed, and a wide range of SpGEMM algo-rithms are summarized. This survey sufficiently reveals the latestprogress and research status of SpGEMM optimization from1977 to 2019. More specifically, an experimentally comparativestudy of existing implementations on CPU and GPU is presented.Based on our findings, we highlight future research directions andhow future studies can leverage our findings to encourage betterdesign and implementation.

Index Terms—SpGEMM, Parallel Optimization, Sparse MatrixPartitioning, Parallel Architecture.

I. INTRODUCTION

General sparse matrix-matrix multiplication, abbreviated asSpGEMM, is a fundamental and expensive computational ker-nel in numerous scientific computing applications and graphalgorithms, such as algebraic multigrid solvers [1] [2] [3][4], triangle counting [5] [6] [7] [8], multi-source breadth-first searching [9] [10] [11], the shortest path finding [12],colored intersecting [13] [14], and subgraphs [15] [16]. Hencethe optimization of SpGEMM has the potential to impact awide variety of applications.

Given two input sparse matrices A and B, SpGEMMcomputes a sparse matrix C such that C = A × B, whereA ∈ Rp×q, B ∈ Rq×r, C ∈ Rp×r, and the operator ×represents the general matrix multiplication. Let aij denotethe element in the ith row and the jth column of matrix A,and we write ai∗ to denote the vector comprising of the entries

in the ith row of A, also a∗j to denote the vector comprisingof the entries in the jth column of A. In the general matrix-matrix multiplication (GEMM), the ith row of the result matrixC can be generated by

ci∗ = (ai∗ · b∗1, ai∗ · b∗2, ..., ai∗ · b∗r), (1)

where the operation · represents the dot product of two vectors[17].

Compared with GEMM, SpGEMM requires to exploit thesparsity of the two input matrices and the result matrix becauseof huge memory and computational cost for the zero entrieswith dense formats. Most of the research on SpGEMM isproposed based on the row-wise SpGEMM algorithm givenby Gustavson [18]. The i-th row of the result matrix C isgiven by ci∗ =

∑j aij ∗ bj∗, where the operator ∗ represents

the scalar multiplication, and the computation only occurs innon-zero entries of sparse matrices A and B. The pseudocodefor Gustavson’s SpGEMM algorithm is presented in Algorithm1.

The goal of this survey paper is to provide a structuredand broad overview of extensive research on SpGEMM designand implementations spanning multiple application domainsand research areas. We not only strive to provide an overviewof existing algorithms, data structures, and libraries availablebut also try to uncover the design decisions behind thevarious implementation by the designers. It gives an in-depthpresentation of the many algorithms and libraries available forcomputing SpGEMM.

Sparse matrix has been a hot topic of many surveys andreviews. Duff et al. [19] provide an extensive survey ofsparse matrix research developed before the year of 1976. Abroad review of the sparse matrix and vector multiplication ispresented by Grossman et al. [20]. Over the past decades,SpGEMM attracts intensive attention in a wide range ofapplication fields, and many new designs and optimizations areproposed targeting different architectures. The development of

arX

iv:2

002.

1127

3v1

[cs

.DC

] 2

6 Fe

b 20

20

Page 2: A Systematic Survey of General Sparse Matrix-Matrix ... · School of Computer Science and Technology Beijing Institute of Technology Beijing, China tan zn@163.com Yueyan Zhao School

Algorithm 1: Pseudocode for the Gustavson’s SpGEMMalgorithm.

Input: A ∈ Rp×q, B ∈ Rq×r

Output: C ∈ Rp×r

1 for ai∗ ∈ A do2 for aij ∈ ai∗ and aij is non-zero do3 for bjk ∈ bj∗ and bjk is non-zero do4 value← aij ∗ bjk;5 if cik /∈ ci∗ then6 cik ← 0;7 end8 cik ← cik + value;9 end

10 end11 end

multi/many-core architectures and parallel programming havebrought new opportunities for the acceleration of SpGEMM,and also challenging problems emerged need to be consideredintensively. To the best of our knowledge, this is the firstsurvey paper that overviews the developments of SpGEMMover the decades. The goal of this survey is to present aworking knowledge of the underlying theory and practice ofSpGEMM for solving large-scale scientific problems, and toprovide an overview of the algorithms, data structures, andlibraries available to solve these problems, so that the readerscan both understand the methods and know how to use thembest. This survey covers the application domains, challeng-ing problems, architecture-oriented optimization techniques,and performance evaluation of available implementations forSpGEMM. We adopt the categories of challenging problemsgiven in [21] and summarize existing techniques about sizepredicting of the result matrix, load balancing, and intermedi-ate results merging.

The main factors that differentiate our survey from theexisting related work are:

• the systematic process for collecting the data;• a classified list of studies on both applications and opti-

mization techniques;• analysis of the collected studies in the view of both

algorithm design and architecture optimization;• an detailed evaluation of 6 library implementations.

The rest of the paper is organized as follows. Section2 gives a brief overview of this survey. Section 3 intro-duces several classical applications of SpGEMM in detail.In section 4, the related work on three pivotal problems ofSpGEMM computation is presented. In section 5, the relatedwork of SpGEMM optimization based on different platformsis introduced in detail. Besides, we perform a performanceevaluation employing different SpGEMM implementations insection 6. A discussion about the challenges and future workof SpGEMM is presented in section 7, and followed by ourconclusion in section 8.

II. LITERATURE OVERVIEW

A. Research Questions

This study follows the guidelines of the systematic literaturereview proposed by Kitchenham [22], which is initially used inmedical science but later gained interest in other fields as well.According to the three main phases: planning, conducting,and reporting, we have formulated the following researchquestions:

RQ1: What are the applications of SpGEMM, and how arethey formulated?

RQ2: What is the current state of SpGEMM research?RQ3: How do the SpGEMM implementations on the off-

the-shelf processors perform?RQ4: What challenges could be inferred from the current

research effort that will inform future research?Regarding RQ1, the study will address how SpGEMM is

used in these applications, including the sub-questions likewhat are the typical applications of SpGEMM? Is it used inan iterative algorithm? Do the matrices keep constant in thecomputation? This will give an insight into the requirements ofSpGEMM in solving real problems. In RQ2, the study looksat existing techniques that were proposed in recent decades.Regarding RQ3, we will perform some evaluations for bothCPU and GPU to have a general idea about the performanceof these implementations. Finally, in RQ4, we will summarizethe challenges and future research directions according to ourinvestigative results.

B. Search Procedure

There have been some other reviews presented in the relatedwork section [21]. However, they cover a more limited numberof studies. We evaluate and interpret all high-quality studiesrelated to SpGEMM in this study.

To have a broad coverage, we perform a systematic literaturesurvey by indexing papers from several popular digital libraries(IEEE Explore Digital Library, ACM Digital Library, ElsevierScienceDirect, Springer Digital Library, Google Scholar, Webof Science, DBLP) using the keywords “SpGEMM”, “Sparsematrix”, “sparse matrix multiplication”, “sparse matrix-matrixmultiplication”. It is an iterative process, and the keywordsare fine-tuned according to the returned results step by step.Just like other literature survey work, we try to broaden thesearch as much possible while maintaining a manageable resultset. In order to do that, only refereed journal and conferencepublications were included. Then, we read the titles andabstracts of these papers and finally include 87 papers of morethan 142 papers we found in this survey.

C. Search Result

It is difficult to give a sufficient and systematic taxonomyfor classifying SpGEMM research because the same topic mayhave different meanings in different contexts. For example,load balance of SpGEMM in distributed computing, sharedmemory multi-core computing, single GPU computing, multi-GPU computing, CPU+GPU computing. We select several

Page 3: A Systematic Survey of General Sparse Matrix-Matrix ... · School of Computer Science and Technology Beijing Institute of Technology Beijing, China tan zn@163.com Yueyan Zhao School

TABLE I: Categories of selected papers.

Category Papers

Application

Multigrid solvers [1] [2] [3] [4] [23] [24] [25]Triangle counting [5] [6] [7] [8] [26] [27] [28]MBFS [9] [10] [11] [29]Other [12] [13] [14] [15] [16] [30] [31]

[32] [33] [34] [35] [36] [37] [38][39] [40] [41] [42]

Optimization

Algorithm [18] [21] [43] [44] [45] [46] [47][14] [7] [48] [49] [50] [2] [51] [52][53] [42] [54] [3] [55] [56] [57][58] [59] [60] [61] [62] [63] [64][16] [65] [66] [67] [68] [69] [25][70] [71] [72] [73] [74] [75] [26][41] [76] [?] [77]

Many-core CPU [69] [51] [25] [59] [58] [68]GPU [21] [57] [47] [58] [68]Distributed [78] [42] [79] [67] [46]Heterogeneous [17] [53] [80] [81]FPGA [82] [83]

Programming models [84] [85] [78] [54]Surveys [19] [20] [22]Benchmark [86]

topics that are frequently covered by existing papers, andpresent the correlation between papers and topics in Table I.

III. TYPICAL APPLICATION

SpGEMM is mainly used in linear algebra and graphanalytics, and among which algebraic multigrid solver, trianglecounting, and multi-source breadth-first search are three mostclassical applications of SpGEMM. In the following subsec-tions, we will introduce the procedures of these three applica-tions and how the SpGEMM is applied in these applicationsin detail.

A. Algebraic Multigrid Solvers

Algebraic Multigrid (AMG) is a multi-grid method de-veloped by utilizing some important principles and conceptsof Geometric multigrid (GMG), and it requires no explicitgeometric knowledge of the problem. AMG method itera-tively solves large and sparse linear systems Ax = b byautomatically constructing a hierarchy of grids and inter-gridtransfer operators. It achieves optimality by employing twocomplementary processes: smoothing and coarse-grid correc-tion. The smoother is generally fixed to be a simple point-wise method such as Gauss-Seidel or weighted Jacobi foreliminating the high-frequency error. Coarse-grid correctioninvolves three phases, including projecting error to a coarsergrid through restriction operator, solving a coarse-grid systemof equations, and then projecting the solution back to the finegrid through interpolation (also called prolongation) operator[23] [24].

Algorithm 2 describes the construction of several importantoperators in AMG. First, the strength operation identifies thestrongly connected edges in the matrix Al at level l to constructstrength-of-connection matrix Sl (line 3 of Algorithm 2). Next,the interpolation operator Pl is constructed to transfer informa-tion from level l+1 to level l (line 4 of Algorithm 2). Finally,

Algorithm 2: Construction of several important operatorsin AMG [2].Input: A,BOutput: A1, ..., AL, P0, ..., PL−1

1 A0 ← A,B0 ← B;2 for l = 0, ..., L− 1 do

// Strength-of-connection of edges3 Sl =strength(Al);

// Construct interpolation andrestriction

4 Pl =interpolation(Al, Sl);// Galerkin product (triple sparse

matrices multiplication)5 Al+1 = P T

l AlPl;6 end

the coarse-grid operator is constructed by a Galerkin triple-matrix product (line 5 of Algorithm 2), which is implementedwith two sparse matrix-matrix multiplications [1] [2] [3] [4][25].

These matrix-matrix multiplications, taking more than 80%of the total construction time, are the most expensive com-ponents. Moreover, the construction of operators (and thusSpGEMM) is a considerable part of the overall execution sinceit may occur at every time step (for transient problems) or evenmultiple times per time step (for non-linear problems), makingit important to optimize SpGEMM [25].

B. Triangle Counting

Triangle counting is one of the major kernels for graphanalysis and constitutes the core of several critical graphalgorithms, such as triangle enumeration [8] [7] [26], subgraphisomorphism [30] [31], and k-truss computation [31] [32].

The problem of triangle counting in an undirected graph isto find the number of triangles in the graph. Given a graphG = (V,E), it can be represented by a square sparse matrixA of dimension n × n, where n is the number of vertexesin graph G: n = |V |, and either the matrix entry aij oraji represents the edge (i, j) [5]. Azad et al. [8] describean adjacency matrix-based triangle counting method basedon Cohen’s MapReduce algorithm [6]. First, they constructan adjacency matrix A from graph G, with its rows orderedwith the increasing number of non-zeros they contain (equalto the degree of the corresponding vertex). Assuming thatsparse matrix L is the lower triangular part of A holding edges(i, j) where i > j, and U is the upper triangular part of Aholding edges (i, j) where i < j, then A = L + U . Next,all the wedges of (i, j, k) where j is the smallest numberedvertex are counted via the SpGEMM operation: B = L× U ,and B(i, k) represents the count for (i, j, k) wedges. Finally,finding the close wedges by doing element-wise multiplicationwith the original matrix: C = A. ∗ B. Algorithm 3 presentsthe pseudocode for the serial adjacency matrix-based trianglecounting algorithm, and an example of triangle counting ispresented in Fig. 1.

Page 4: A Systematic Survey of General Sparse Matrix-Matrix ... · School of Computer Science and Technology Beijing Institute of Technology Beijing, China tan zn@163.com Yueyan Zhao School

Algorithm 3: Pseudocode for the serial adjacency matrix-based triangle counting algorithm [6] [8].

Input: Ordered adjacency matrix A of graph GOutput: Number Nt of triangles in graph G

1 (L,U)←Split(A);2 B← SpGEMM(L,U);3 C ←ElementWiseSpGEMM(A,B);// Sum all entries of matrix C

4 Nt ← Sumi,j(cij)/2;

Besides, Wolf et al. [27] develop a GraphBLAS likeapproach for triangle enumeration using an overloadedSpGEMM of the graph adjacency matrix (A) and incidencematrix (H): C = A×H , which can also be used for trianglecounting. Although this method is useful for more complexgraph calculations, it is less efficient than the adjacent matrix-based method. Furthermore, a variant of the adjacency matrix-based triangle counting algorithm is given by Wolf et al. in[7], which uses the lower triangle portion of the adjacencymatrix to count triangles.

a

b d

c

G Two triangles

a

b

c

a

d

c

Fig. 1: An example of triangle counting. Graph G includestwo triangles: (a, b, c) and (a, d, c).

Collected from social media, sensor feeds, the World WideWeb, biological and genetic fields, co-author networks, andcitations, increasing large amounts of data are being analyzedwith graph analytics to reveal the complicated underlyingrelationship between different data entities [28] [31]. One ofthe fundamental techniques for graph analytics is subgraphfinding, and the triangle is one of the most important sub-graphs. Moreover, the number of triangles is an importantmetric in many network analysis applications, including linkrecommendation [33], spam detection [34], social networkanalysis [34], and dense neighborhood graph discovery [35].In the adjacency matrix-based triangle counting algorithm, theSpGEMM operation B = L×U costs d2n operations, whered is the average degree and n is the number of vertices [8].Considering that the computational complexity increases withthe scale of the problem, the optimization of triangle counting(thus SpGEMM) becomes extremely considerable.

C. Multi-Source Breadth-first Search

Breadth-first search (BFS) is a key and fundamental sub-routine in many graph analysis algorithms, such as finding

connectivity, finding the shortest path, and finding k-hopneighbors [36] [37].

The goal of the BFS is to traverse a graph from a givensource vertex, which can be performed by a sparse matrix-vector multiplication (SpMV) between the adjacency matrixof a graph and a sparse vector [29].

Let us take an example in a sparse unweighted graph G =(V,E) represented by sparse matrix A. Assume n = |V |, thenthe size of A is n×n. Let x be a sparse vector with x(i) = 1and all other elements being zero, then the 1-hop vertexesfrom source vertex i, denoted as Vi1, can be derived by theSpMV operation: y = Ax. Repeat the operation from Vi1, wecan receive 1-hop vertexes from Vi1 or 2-hop vertexes from i.Finally, a complete BFS for graph G from vertex i is yielded[9].

In contrast, Multi-Source BFS (MS-BFS) executes multipleindependent BFSs concurrently on the same graph from mul-tiple source vertexes. It can be performed by SpGEMM. Asimple example for MS-BFS is presented in Fig. 2 [10]. Let{1, 2} be two source vertexes, A is the adjacency matrix ofthe graph, and X = (x1, x2) is a rectangular matrix repre-senting the source vertexes, where x1 and x2 are two sparsecolumn vectors with x1(1) = 1 and x2(2) = 1 respectivelyand all other elements being zero. Let Bi = (bi1, b

i2), then

B1 = A × X . Obviously, B1 is a sparse rectangular matrixrepresenting the 1-hop vertexes (denoted as V1) from sourcevertexes {1, 2}. Repeat the SpGEMM operation of adjacencymatrix and V1, we can derive the 1-hop vertexes from V1, also2-hop vertexes from {1, 2} by B2 = A×B1. Finally, we getthe breadth-first traversal results from vertices 1 and 2, whichare {1, 3, 4, 2, 5, 6} and {2, 3, 4, 1, 5, 6}, respectively.

Fig. 2: An example of BFS. Vertexes filling in horizontal linesand vertical lines are being visited by the BFS starting fromvertex {1} and {2} respectively, and vertexes filling in leftoblique lines have been visited by the BFS starting from vertex{1} or {2} [10].

Many applications require hundreds or even billion of BFSsover the same graph. Examples of such applications includecalculating graph centrality, enumerating the neighborhoodsfor all vertexes, and solving the all-pairs shortest distance

Page 5: A Systematic Survey of General Sparse Matrix-Matrix ... · School of Computer Science and Technology Beijing Institute of Technology Beijing, China tan zn@163.com Yueyan Zhao School

problem. Comparing with running parallel and distributedBFSs sequentially, executing multiple BFSs concurrently ina single core allows us to share the computation betweendifferent BFSs without paying the synchronization cost [9].As the most expensive part of MS-BFS, SpGEMM is worthyof more attention to be paid.

In addition, SpGEMM is also one of the most importantcomponents for graph contraction [38], graph matching [39],graph coloring [13] [14], all pairs shortest path [12], sub-graph[15] [16], cycle detection or counting [40], and moleculardynamics [41] [42]. Because of limited space, we will notintroduce these applications and corresponding SpGEMMformulation in detail.

IV. METHODOLOGY

The development of multi/many-core architecture and par-allel programming has brought new opportunities for theacceleration of SpGEMM, and three challenging problemsemerged need to be considered intensively [21], including sizepredicting of result matrix, matrix partitioning and load bal-ancing, and intermediate result accumulating. In the followingsubsections, we will introduce related studies in these threechallenges in detail.

A. Size Prediction

The first problem is the unknown number of non-zeros in theresult matrix before real execution. The number of non-zerosof a sparse matrix usually dominates its memory overhead,while in SpGEMM, the sparsity of the result matrix is alwaysunknown in advance. Therefore, precise memory allocationfor the result matrix is impossible before real execution. Theresearch focusing on the size prediction of the result matrixcan be mainly classified as the following four approaches.

1) Precise Method: The SpGEMM algorithms, which useprecise method to solve size prediction problem, usuallyconsist of two phases: symbolic and numeric phase. In thesymbolic phase, the precise number of non-zeros in resultmatrix C is computed, while the real values are calculatedin the numeric phase.

The implementations of SpGEMM in KokkosKernels [87],cuSPARSE [88], MKL [89] and RMerge [43] are typical rep-resentatives of this method. Besides, Demouth [44], Nagasakaet al. [45] and Demirci et al. [46] also adopt this approach.In [47], Deveci et al. design a graph compression technique,similar to the color compression idea [14], to compress matrixB by packing its columns as bits in order to speedup thesymbolic phase.

Accurate pre-computation of the number of non-zeros notonly saves the memory usage but also enables the sparsestructure of C to be reused for different multiplies with thesame structure of input matrices [47]. Moreover, it presentssignificant benefits in graph analytics, because most of themwork only on the symbolic structure, no numeric phase [7].However, the calculation of two phases also means that itneeds to iterate through the input matrices twice, indicatingthe higher computation overhead than the following methods.

2) Probabilistic Method: The second method estimates thesparse structure of the result matrix based on random samplingand probability analysis on the input matrices, which is knownas the probabilistic method.

Cohen [48] thinks that the problem of estimating the numberof non-zeros in result matrix can be converted to estimatethe size of reachability sets in a directed graph. Then hepresents a Monte Carlo-based algorithm that estimates the sizeof reachability sets with high confidence and small relativeerror. The non-zero structure not only can guide efficientmemory allocation for the output matrix but also can beused to determine the optimal order of multiplications whencomputing a chain product of three or more matrices, wherethe optimal order means the minimization of a total numberof operations. Therefore, Cohen [48] proposes a method thatestimates the non-zero structure of the result matrix in timelinear based on the previous reachability-set size estimationalgorithm. For any constant error probability δ > 0 and anythe tolerated relative error ε > 0, it can compute a 1 ± εapproximation of z of result matrix in time O(n/ε2), wherez denotes the number of non-zeros in the result matrix. Then,Amossen et al. [49] improve this method to expected timeO(n) for ε > 4/ 4

√z. Pagh et al. also present a method

to estimate column/row sizes of the result matrix based onthe non-zeros of input matrices, and a detailed description isreferred to the Lemma 1 in [50].

This type of method does not require SpGEMM-like com-putation and then yields a low time cost for estimation.However, considering that this type of method usually givesan approximate estimation, hence an extra memory allocationmust be performed when the estimation fails.

3) Upper Bound Method: The third method computes anupper bound of the number of non-zeros in the result matrixand allocates corresponding memory space, which is known asthe upper bound method. The most commonly used method ofcalculating upper bound for C is to count the number of non-zeros of the corresponding row in matrix B for each non-zeroentry in matrix A. Assume that input matrices A and B arecompressed with CSR format, and I and J are the row pointerarray and column index array, respectively. Then Algorithm 4gives the pseudocode for computing the upper bound of thenumber of non-zeros in each row of the result matrix, whichis stored in array U = {u0, u1, . . . , up−1}.

Bell et al. [2] propose a classical ESC (Expansion, Sorting,Compression) method to accelerate AMG method, and itallocates the memory space of the upper-bounded size forresult matrix, which is applied in CUSP [90]. Nagasaka et al.[51] also count a maximum of scalar non-zero multiplicationsper row of the result matrix. Then each thread allocates thehash table based on the maximum and reuses the hash tablethroughout the computation by re-initializing for each row.

This type of method is efficient and straightforward toimplement, while it does not consider the merging of thevalues with the same index items in the calculation process,and usually leads to over-allocation. Especially for someparticular matrices, the estimated size with the upper bound

Page 6: A Systematic Survey of General Sparse Matrix-Matrix ... · School of Computer Science and Technology Beijing Institute of Technology Beijing, China tan zn@163.com Yueyan Zhao School

Algorithm 4: Pseudocode for computing the upper boundof the number of non-zeros in each row of the result matrix,and all sparse matrices are compressed with CSR format.

Input: IA, JA, IB .Output: U = {u0, u1, . . . , up−1}.

1 for i = 0, p− 1 do2 ui = 0;3 for k = IA(i), IA(i+ 1)− 1 do4 j = JA(k);5 ui+ = IB(j + 1)− IB(j);6 end7 end

method and precise size have large difference.4) Progressive Method: The fourth method, known as the

progressive method, dynamically allocates memory as needed.It first allocates memory of proper size and then starts matrix-matrix multiplication. The reallocation of larger memory isrequired if the current memory is insufficient.

The implementation of SpGEMM in Matlab [52] is therepresentative of this type of method. It first guesses the sizeof the result matrix and allocates a new memory space thatis larger by a constant factor (typically 1.5) than the currentspace if more space is required at some point. Meanwhile, thecolumns which are already computed are required to be copiedinto the new memory.

If this type of method estimates successfully in first, thenit has no additional time overhead in SpGEMM. However,if the first estimation fails, this type of method is extremelyinefficient, especially in GPU. Moreover, if the SpGEMMalgorithm is implemented in thread-level parallel, and threadsare using their local storage, then it must take time to aggregateall the independent storage into the result matrix.

Besides, the hybrid methods are also proposed to cope withthe problem. Weifeng Liu and Brian Vinter propose a hybridmethod for result matrix pre-allocation [21]. They calculatethe upper bound of the number of non-zeros in each rowof the result matrix and divide all rows into multiple groupsaccording to the number of non-zeros. Then they allocate spaceof the upper-bound size for the short rows and progressivelyallocate space for the long rows.

B. Matrix Partition and Load Balancing

The second problem is matrix partitioning and load balanc-ing. With the development of multi/many-core architecture,reasonable partitioning of matrices and balanced assigning oftasks among multiple cores or nodes are critical for makingfull use of hardware resources.

1) Formulations of SpGEMM: It is closely related betweenmatrix partitioning and SpGEMM formulations. There are fourformulations of SpGEMM can be devised.1) Outer-product formulation [53] [42] [54] [3] [55] [56].

This formulation is based on the column-wise and row-wise partitioning of input matrices A and B, respectively.

Result matrix C is obtained by summing the outer productof each column a∗i of A and corresponding row bi∗ of B,i.e.

C =

q∑i=1

a∗i ⊗ bi∗, (2)

where the operator ⊗ represents the outer product ofvectors.

2) Inner-product formulation [53] [55] [45] [56]. Thisformulation is based on the row-wise and column-wisepartitioning of input matrices A and B, respectively. Resultmatrix C consists of the inner product of each row ofmatrix A and each column of matrix B, i.e.

cij =∑

k∈I(i,j)

aik ∗ bkj , (3)

where i = 1, 2, ..., p, j = 1, 2, ..., r, and I(i, j) denotes theset of indexes k such that both the entries aik and bkj arenon-zero.

3) Row-by-row-product formulation [53] [3] [56] [46]. Thisformulation is based on the row-wise partitioning of inputmatrices. Each row ci∗ of result matrix C is obtained bysumming the intermediate multiplication results of eachnon-zero entry aik of ai∗ and corresponding row bk∗of B.i.e.

ci∗ =∑

k∈Ii(A)

aik ∗ bk∗, (4)

where Ii(A) denotes the set of column indexes k of thenon-zero entries in the i-th row of A.

4) Column-by-column-product formulation [3] [56]. Thisformulation is based on the column-wise partitioning ofinput matrices, which is similar to the row-by-row-productformulation. Each column c∗j of result matrix C is ob-tained by summing the intermediate multiplication resultsof each non-zero entry bkj of b∗j and correspondingcolumn a∗k, i.e.

c∗j =∑

k∈Ij(B)

a∗k ∗ bkj , (5)

where Ij(B) denotes the set of row indexes k of the non-zero entries in the j-th column of B.

2) Block Partitioning: Four formulations of SpGEMM rep-resent four different 1D matrix partitioning schemes: column-by-row, row-by-column, row-by-row, and column-by-column.However, considering the irregular distribution of non-zeroentries in sparse matrices, plain slice-based matrix parti-tioning usually results in load unbalancing. Therefore, someresearchers pay attention to load balancing for specific archi-tectures.

Weifeng Liu and Brian Vinter propose a method thatguarantees a balanced load through assigning rows with adifferent number of non-zeros to the different number of bins[21] for GPU platform. In order to balance the load andefficiently exploit GPU resources, Nagasaka et al. [45] dividethe rows into groups in the symbolic phase by the number ofintermediate products, which is the upper bound of the number

Page 7: A Systematic Survey of General Sparse Matrix-Matrix ... · School of Computer Science and Technology Beijing Institute of Technology Beijing, China tan zn@163.com Yueyan Zhao School

of non-zeros in output matrix. In the numeric phase, theydivide the rows into groups by the number of non-zeros in eachrow. Winter et al. [57] also design a balanced work assigningscheme for GPU. Each thread block is assigned an equalnumber of non-zeros of A while ignoring the row boundariesof a matrix. Deveci et al. [58] propose two chunking methodsfor KNL and GPU. The difference lies in partitioning A in thecolumn-wise method for KNL, but for GPU partitioning A inthe 2D method because of its multi-level memory property.Deveci et al. [68] also utilize row-by-row matrix partitioningbut with different tasks assigning scheme (thread-sequential,team-sequential, thread-parallel, and thread-flat-parallel) forhigh performance computing architectures. Chen et al. [59]design a three-level partitioning scheme to improve the loadbalance of SpGEMM on Sunway TaihuLight supercomputer.The first level represents that A is partitioned into NP sub-matrices, where NP is the number of core groups appliedin the computation. In the second level, B is partitioned intoNC sub-matrices, where NC is the number of computingprocessing element (CPE) cores applied in each core group.Sub-A and sub-B are further partitioned into several sets inthe third level.

Kurt et al. [60] propose an adaptive task partition schemeacross virtual warps of a thread block in GPU. For example,for a thread block of size 128 and a virtual warp of size 4, eachthread block will preside over four rows of A simultaneously.Then 32(=128/4) threads are assigned cyclically to deal withthe corresponding entries of B for each row of A. Theyalso give a systematic exploration and analysis of upperdata movement requirements for SpGEMM for the first time.The work distribution scheme is similar to the row mergingmethod by GPU sub-warps in [43] [61]. Ballard et al. [3]present a detailed theoretical prediction for communicationcost for SpMM (sparse-dense matrix multiplication) operationwithin the Galerkin triple product of smoothed aggregationAMG methods. They also conclude that the row-by-row-product algorithm is the best 1D method for the first twomultiplications and that the outer-product algorithm is the best1D method for the third multiplication.

Van de Geijn et al. [62] propose a 2D block data de-composition and mapping methods for dense matrix-matrixmultiplication based on the platform with distributed memory.It is applied in SpGEMM by Buluc et al. [63] [64] [16].Noted increasing hypersparse matrices after 2D block datadecomposition, they propose a new format DCSC (doublycompressed sparse column) to exploit the hypersparsity of theindividual sub-matrices. Then, they developed two sequentialSpGEMM algorithms based on the outer-product and column-by-column-product multiplications, respectively, which mainlyimprove the hypersparse sub-matrices multiplication after the2D partitioning. Finally, they present a parallel efficient sparseSUMMA [62]. Furthermore, Azad et al. [65] first implement a3D parallel SpGEMM algorithm, based on the work of Bulucet al. that exploits both the inter-node parallelism within a thirdprocessor grid dimension and the multi-threading parallelismwithin the node.

3) Hypergraph Partitioning: Traditional block-based ma-trix partitioning schemes seldom consider the communicationproblem from the sparse patterns of input or output matri-ces. Akbudak et al. [42] propose an elementary hypergraphpartitioning (HP) model to partition input matrices for outer-product parallel SpGEMM. It aims at minimizing communi-cation cost while maintaining a balanced computational loadby a predetermined maximum allowable imbalance ratio. TheHP model is composed of three components. The first is thevertex for representing the outer product of each column of Awith the corresponding row of B. The second is the vertexfor each non-zero entry of C to enable 2D nonzero-basedpartitioning of the output matrix. The third is the hyperedge(or net) for each non-zero entry of C to encode the totalvolume of communication that occurred in intermediate resultaccumulating. Assuming that the partitioning of the inputmatrices A and B in the HP model is presented as

A = AQ = [Ac1 A

c2 · · · Ac

K ] and B = QB =

Br

1

Br2

...Br

K

, (6)

where Q is the permutation matrix induced by the partitioning,the HP model for outer-product parallel SpGEMM includestwo phases. In the first phase (also called as multiplicationphase), each processor Pk owns column stripe Ac

k and rowstripe Br

k of the permuted matrices, and then finishes thecommunication-free local SpGEMM computations Ac

k × Brk.

The second phase (also called as summation phase) reducespartial results yielded in the first phase to calculate the finalvalue of each non-zero entry of C. In order to maintain abalanced load over two phases, the two-constraint formulationis proposed. Each vertex is assigned two weights, which rep-resent the computational overhead associated with the vertexfor two phases, respectively. Moreover, an imbalance ratio isintroduced to direct partitioning for load balancing.

Ballard et al. [66], based on the HP model, present a fine-grained framework to prove sparsity-dependent communica-tion lower bounds for both parallel and sequential SpGEMM.Further, they reduce identifying a communication-optimal al-gorithm for given input matrices to solve the HP problem.Akbudak et al. [55] also apply the HP model to improve theouter-product parallel and inner-product parallel sparse matrix-matrix multiplication (SpMM) algorithms for the Xeon Phiarchitecture. The HP model allocates A-matrix columns andB-matrix rows that contribute to the same C-matrix entriesinto the same parts as much as possible in the inner-product-parallel SpMM. In the outer-product-parallel SpMM, the HPmodel allocates A-matrix rows that require the same rows ofB into the same parts as much as possible. The reason is thatit enables the exploiting of temporal locality.

Besides, Akbudak et al. [56] also apply the graph modeland HP model on the outer-product, inner-product, and row-by-row-product parallel SpGEMM algorithms. Demirci et al.[46] adopt a similar bipartite graph model for matrices parti-

Page 8: A Systematic Survey of General Sparse Matrix-Matrix ... · School of Computer Science and Technology Beijing Institute of Technology Beijing, China tan zn@163.com Yueyan Zhao School

tioning on the distributed-memory platform but complementa 3-constraint edge weight assignment scheme to maintaina balanced load among tablet servers. Selvitopi et al. [67]apply the graph model and hypergraph model for simultane-ous assigning of the map and reduce tasks to improve datalocality and maintain a balanced load among processors inboth map and reduce phases. Then, Considering the similaritybetween the map and reduce tasks in the MapReduce and theaccumulation of intermediate results in SpGEMM, they applythe obtained MapReduce partitioning scheme based on graphand hypergraph models to improve the data locality and loadbalancing in SpGEMM.

C. Result Accumulating

The third problem is the expensive intermediate resultaccumulating. In outer-product SpGEMM, result matrix C isobtained by summing the outer-product result of each row ofA and the corresponding column of B, where the intermediateouter-product result is usually a sparse matrix. In row-by-row-product SpGEMM, the result matrix is obtained by summingthe multiplication result of each non-zero entry of A and thecorresponding row of B, where the intermediate multiplicationresults are also sparse. The other two formulations are similar.So no matter which SpGEMM formulation is chosed, themerging of sparse structures will be involved, and it is achallenging problem.

1) Accumulator: Here, we call the data structure that holdsintermediate results as the accumulator, and let us take row-by-row-product SpGEMM as an example to introduce theaccumulator (because most of SpGEMM research is based onthe row-by-row-product formulation). There are two types ofaccumulators at present: dense and sparse accumulators.

In dense accumulator, intermediate results for a row arestored in an array of size r in dense format, where r isthe column dimension of result matrix. It does not requireextra time cost for hashing, sorting or merging operations,while it may not be suitable to parallelization with largethreads and large r values. Deveci et al. [68] [7] utilize denseaccumulator for CPU or KNL instead of GPU because of itshigh memory requirements. Patwary et al. [69] utilize denseaccumulator with a column-wise partitioning of B to reducememory overhead. Elliott et al. [25] note that prolongationmatrices (P ) in the AMG method are usually tall and skinny,so they use a local dense lookup array for each thread andallocate memory space fast for result matrix by page-alignedand size-tracked technologies.

In row-by-row-product SpGEMM, each row of result matrixC can be expressed as ci∗ =

∑k∈Ii(A) aik ∗ bk∗, which is

also known as sparse accumulator [70]. In sparse accumulator,intermediate results for a row are stored in the sparse formatslike COO and CSR. Therefore, the insertion operations atrandom positions hold expensive time overhead in SpGEMMwith a sparse accumulator. There are two types of methodsfor intermediate result merging: sort-based and hash-basedmethods.

2) Sort-based: A sort-based merging is performed by sort-ing the intermediate results according to the column indexesand then summing the values with the same column indexes.The difference between sort-based works often lies in thedifferent sort algorithms utilized, including radix sort, mergesort, and heap sort.

1) Radix sort based. Bell et al. [2] adopt the radix-sortmethod (implemented in [84]) to sort the intermediateresults, and Dalton et al. [71] employ the B40C radix sortalgorithm [72] which allows specifications in the numberand location of the sorting bits to accelerate the sortoperation.

2) Merge sort based. In the GPU-accelerated SpGEMMgiven by Gremse et al. [43], the sparse rows of B selectedand weighted by corresponding non-zeros of A, are mergedin a hierarchical way similar to merge sort. At each level,the number of rows is reduced by half, but the length ofrows becomes larger due to merging. Winter et al. [57]utilize the ESC method to sort intermediate results yieldedin a chunk while ignoring row boundaries of a matrix.Simple sorting of the chunks is performed based on theirglobal chunk order in the merge stage. Final, a prefixscanning is utilized to merge rows shared between chunksto generate the final result.

3) Heap sort based. Azad et al. [65] represent the interme-diate result as a list of triples, and each list of triplesis sorted by the (j, i) pair, where the triple (i, j, val)stores the row index, column index, and value of anon-zero entry. A k-way merge on k lists of triplesT1, T2, ..., Tk is performed by maintaining a heap of sizek, which stores the current lexicographically minimumentry in each list of triples. Then a multi-way mergeroutine finds the minimum triple from the heap andmerges it into the current result. Nagasaka et al. [51]implement a heap sort-based sparse accumulator adoptingthe one-phase SpGEMM in KNL and multi-core archi-tecture. In merge-based sparse accumulator (similar toheap sort-based accumulator) proposed by Junhong et al.[70], each thread stores multiple column indexes, andthen performs an intra-thread-min operation to ob-tain the local minimum column index inta-min. Mean-while, the intermediate result value for each intra-minis fetched by each thread. Next, each thread performsinter-thread-min(intra-min) operation to obtain theminimum column index min among the threads at thesame warp. Final, the inter-sum(value(min)) is utilizedto obtain the reduction sum of multiple threads.

Besides, Junhong et al. [70] propose a register-aware sort-based sparse accumulator and a vectorized method for parallelsegmented sum [73], where the sparse accumulator exploits theN -to-M pattern [74] to sort the data in the register. It is forthe first time that the two methods are implemented for GPUregisters.

3) Hash-based: The hash-based sparse accumulator firstallocates a memory space based on the upper bound estimation

Page 9: A Systematic Survey of General Sparse Matrix-Matrix ... · School of Computer Science and Technology Beijing Institute of Technology Beijing, China tan zn@163.com Yueyan Zhao School

as the hash table and uses the column indexes of the inter-mediate results as the key. Then the hash table is requiredto be shrunk to a dense state after hash functions. At last,sorting the values of each row of the result matrix accordingto their column indexes to obtain the final result matrixcompressed with sparse format [70]. Result accumulation incuSPARSE [44] [88] is based on the hash-based sparse accu-mulator. Deveci et al. [75] [47] [58] design a sparse, two-level,hashmap-based accumulator which supports parallel insertionsor accumulations from multiple vector lanes. It is stored in alinked list structure and consists of 4 parallel arrays, columnindexes, and their numerical values in the numeric phase, aswell as beginning indexes of the linked list corresponding tothe hash values and the indexes of the next elements withinthe liked list. In [68], they implement linked list-based andlinear probing hashmap accumulators utilizing different datastructures. Junhong et al. [70] optimize the data allocationsof each thread in a hash-based accumulator utilizing GPUregisters. Besides, Yaar et al. [26] utilize hashmap-based ac-cumulators in triangle counting. Weber et al. [41] use the hashtable to store each row of matrix C based on the distributedblocked compress sparse row (BCSR) format. Nagasaka et al.[45] utilize the hash table for counting the number of non-zeros of each row in the symbolic phase and for calculation ofvalues of result matrix in the numeric phase. In the hash-basedsparse accumulator given by [45], Nagasaka et al. utilize thevector registers in KNL and multicore architectures for hashprobing to accelerate the hash-based SpGEMM.

Besides, Weifeng Liu et al. [21] propose a hybrid parallelresult merging method. Heapsort-like, bitonic ESC and mergemethods are employed respectively according to the upperbound of the number of non-zeros in each row.

4) Discussion: Sort-based join and hash-based join havebeen two popular join algorithms, and the debate over whichis the best joint algorithm has been going on for decades.Kim et al. [76] claim that sort-based join will be faster thanhash-based join when SIMD wide enough through a series ofexperiments. Albutiu et al. [?] devise a new massively parallelsort-merge (MPSM) join algorithm, and the experimentalresult shows that the MPSM algorithm outperforms competinghash join. However, the experiments performed by Balkesenet al. [77] show that the hash-based join is still superior, andsort-based joint algorithms outperform hash-based join onlywhen vast amounts of data are involved. Therefore, there isno consensus on which join method is the best.

V. ARCHITECTURE ORIENTED OPTIMIZATION

Different computer architectures usually have different com-puting and storage properties, so the optimization of SpGEMMis closely related to the architecture used. In following sub-sections, we will introduce the related research of optimizingSpGEMM based on the multi/many-core platforms, FPGA(Field-Programmable Gate Array), heterogeneous computingplatform, and distributed platform respectively.

A. Multi-core and Many-core Platforms

The research on multi-core and many-core platforms mainlyfocuses on two problems: memory management and loadbalance.

1) CPU-based Optimization: Memory management. Toexploit data locality, Patwary et al. optimize the traditionalsequential SpGEMM algorithm by using dense arrays in [69].In order to reduce deallocation cost in SpGEMM, Nagasakaet al. compute the amount of memory required by each threadand allocate this amount of thread-private memory in eachthread independently on the Intel KNL processor [51]. Theyalso develop a hash table-based SpGEMM algorithm targetingshared-memory multi-core and many-core processors. For ar-chitectures with reasonably large memory and modest threadcounts, Elliott et al. present a single-pass OpenMP variantof Gustavsons SpGEMM algorithm in [25]. They partitionthe rows of the right-hand side matrix and then performGustavson algorithm locally using thread-local storage fordata and column arrays while constructing the row array inplace. To reduce the overhead of memory allocation, theyuse page-aligned allocations and track used size and capacityseparately. To implement efficient SpGEMM for many large-scale applications, Chen et al. propose optimized SpGEMMkernels based on COO, CSR, ELL, and CSC formats on theSunway TaihuLight supercomputer in [59]. In this paper, theyuse the DMA transmission to access data for CPE core inthe main memory. Beyond doubt, continuous data transferusing DMA performs better than discrete memory accesses.To study the relationship between different multi-level memoryarchitectures and the performance of SpGEMM kernel, Deveciet al. design different chunking-based SpGEMM algorithmsfor Intel KNL where the memory subsystems have similarlatency [58]. They find that the performance difference ofsubsystems decreases with the better temporal and spatiallocality of SpGEMM. Considering that the accesses to B canbe irregular depending on the structure of A, a data placementmethod of storing matrix B as much as possible for KNL isproposed. In [68], Deveci et al. provide heuristics to choose thebest kernel parameters according to problem characteristics,and present their results for the selection of partitioningschemes and data structures with trade-offs between memoryaccess and computational cost. Before the kernel call andservice requests from thousands of threads, a memory poolis allocated and initialized beforehand. A chunk of memory isreturned to the request thread and it will not be released untilthe thread puts the chunk back to the pool. The parameters ofthe memory pool are architecture-specific and the number ofchunks is chosen based on the available concurrency of thetarget device.

Load balance. In [69], matrices are divided into small par-titions and dynamic load balancing is used over the partitions.Experiments show that reducing the size of each partition leadsto better load balance on a system with two Intel Xeon E5-2697 V3 processors. They find that better results are achievedwhen the total number of partitions is 6-10 times the number

Page 10: A Systematic Survey of General Sparse Matrix-Matrix ... · School of Computer Science and Technology Beijing Institute of Technology Beijing, China tan zn@163.com Yueyan Zhao School

of threads. To reduce the overhead of dynamic scheduling,the static scheduling is used in the SpGEMM algorithm on theIntel KNL processor [51]. A three-level partitioning scheme ispresented to achieve load balancing based on the architectureof the Sunway [59]. For the form of C = A × B, on thefirst level, the left sparse matrix A is partitioned into multiplesub-A. Each core group in the SW26010 processor performsthe multiplication of a sub-A and B. On the second level, Bis partitioned into multiple sub-B. Each CPE core in a coregroup multiplies the sub-A by a sub-B. On the third level, tofit the 64-KB local data memory in each CPE core, sub-A andsub-B are further partitioned into several sets.

2) GPU-based Optimization: Memory management. Liuet al. summarize the extra irregularity that an efficient parallelSpGEMM algorithm has to handle in [21]. One of them isthat the number of non-zeros in the result sparse matrix isunknown in advance. In their paper, memory pre-allocationfor the result matrix is organized using a hybrid approachthat saves a large amount of global memory space. Besides,the very limited on-chip scratchpad memory is efficientlyutilized. To make full use of the high-speed registers and onGPU, Liu et al. design different register-aware SpGEMM algo-rithms for different sparse accumulators respectively in [70].These sparse accumulators include sort-based, merge-based,and hash-based, where merge-based is similar to the mergesort-based accumulator mentioned in Section IV. They fullyutilize the GPU registers to fetch data, finish computations,and store results out. In [57], Winter et al. propose an adaptivechunk-based GPU SpGEMM approach (AC-SpGEMM) to cutdown the computational overhead throughout all stages. Theyperform chunk-based ESC (explicitly expand all temporaryproducts, sort them and combine them to yield the finalmatrix) to produce deterministic bit-stable results. With thehelp of the local task distribution, this stage performs multipleiterations of ESC, fully utilizing local memory resourceswhile keeping temporary results in scratchpad memory. Toachieve the performance portability on massively threadedarchitectures, Deveci et al. design a hierarchical and memory-efficient SpGEMM algorithm in [47] by introducing two threadscalable data structures, a multilevel hashmap and a memorypool. Since the memory subsystems of NVIDIA GPU differsignificantly in both bandwidth and latency, two different dataplacements methods are proposed in [58]. One is to keep thepartitions of A and C in fast memory and stream the partitionsof B to fast memory. Another is to keep the partitions ofB in fast memory and stream the partitions of A and C tofast memory. Which method to be chosen often depends onthe input matrix properties. To select proper parameters ofthe memory pool on GPU, Deveci et al. over-estimate theconcurrency to access memory efficiently. They check theavailable memory and reduce the number of chunks if thememory allocation becomes too expensive on GPUs [68].

Load balancing. To balance the workload of SpGEMM onGPU, a heuristic method is presented to assign the rows ofthe result matrix to multiple bins with different subsequentcomputational methods [21]. In this paper, Liu et al. first

allocate 38 bins and put them into five bin groups. Then,all rows are assigned to corresponding bins according to thenumber of the non-zeros. Finally, they allocate a temporarymatrix for the non-zero entries in the result matrix C based onthe size of each bin. Because the rows in the first two bins onlyrequire trivial operations, these two bins are excluded fromsubsequent more complex computation on the GPUs. Thus abetter load balancing can be expected. In [57], Winter et al.split the non-zeros of matrix A uniformly, assigning the samenumber of non-zeros to each thread block. Though memoryrequirements from A are static, the actual workload for eachblock varies based on the generated intermediate products. Astatic splitting of A′s non-zeros does not require processing,but the second stage still needs to associate each entry fromA with a row. Therefore, the global load balancing in parallelchecks A′s row pointers and writes the required informationinto an auxiliary array. The cost of this step is negligiblecompared to enumerating temporary products.

B. Field-Programmable Gate Array (FPGA)

Related research of SpGEMM on FPGA is quite rare. Linet al. are the first to address SpGEMM on FPGAs. In [82],the authors design and implement the SpGEMM algorithmon FPGAs. They study the performance of their design interms of computational latency, as well as the associatedpower-delay and energy-delay trade off. Taking advantage ofthe sparsity of the input matrices, their design allows user-tunable power-delay and energy-delay trade off by employingthe different numbers of processing elements in architecturedesign and different block size in blocking decomposition.Such ability allows designers to employ different on-chipresources for different system power-delay and energy-delayrequirements. Jamro et al. think that indices comparisonsdominate floating-point operations. Therefore they propose ahighly parallel architecture, which can carry out at least 8×8indices comparison in a single clock cycle in [83].

C. Heterogeneous Computing Platform

Researchers mainly focus on load balancing problems onheterogeneous platforms. For heterogeneous systems com-posing CPUs and GPUs, Siegel et al. develop a task-basedprogramming model and a runtime-supported execution modelto achieve dynamic load balancing in [80]. They partitionthe SpGEMM problem in blocks in the form of tasks toaddress the unbalancing introduced by the sparse matrix andthe heterogeneous platform. For a CPU-GPU heterogeneouscomputing system, Matam et al. propose several heuristicmethods to identify the proper work division of a subclassof matrices between CPU and GPU in [53]. Liu et al. proposea load-balancing method based on output space decompositionin [17]. They assign rows to a fixed number of bins througha much faster linear-time traverse on the CPU. Moreover,they decompose the output space in a more detailed way thatguarantees much more efficient load balancing. Their methodis always load balanced in all stages for maximizing resourceutilization of GPUs. Besides, in [81], Rubensson et al. present

Page 11: A Systematic Survey of General Sparse Matrix-Matrix ... · School of Computer Science and Technology Beijing Institute of Technology Beijing, China tan zn@163.com Yueyan Zhao School

a method for parallel block SpGEMM on distributed memoryclusters based on their previously proposed Chunks and Tasksmodel [54]. They use a quad-tree matrix representation toexploit data locality without prior information about the matrixsparsity pattern. The quad-tree representation, combined withthe Chunks and Tasks model, leads to favorable weak andstrong scaling of the communication cost with the numberof processes. Matrices are represented as sparse quad-treesof chunk objects, and the leaves in the hierarchy are block-sparse sub-matrices. Sparsity is dynamically detected and mayoccur at any level in the hierarchy and/or within the sub-matrixleaves. In case GPU is available, this design uses both CPUsand GPUs for leaf-level multiplication, thus making full useof the computing capacity of each node.

D. Distributed Platform

The research of SpGEMM on the cluster system mainlyfocuses on the minimizing of inter-node communication. In[78], Jin et al. conduct a series of experiments to study the datacommunication issue of SpGEMM on the PC cluster. Theyfind that due to communication overheads, it is difficult forclusters to exploit low-level parallelism. Thus, to successfullyachieve computation parallel, it is critical to exploit high-levelparallelism sufficiently. Increasing the degree of high-levelparallelism makes easier the task of balancing the workload.Dynamic scheduling algorithms always have less unbalancedoverhead than static scheduling algorithms, no matter uni-casting or multicasting is used for data communication. In[42], for outer-product-parallel SpGEMM, Akbudak et al.propose three hypergraph models that achieve simultaneouspartitioning of input and output matrices without any repli-cation of input data. All three hypergraph models performconformable 1D column-wise and row-wise partitioning of theinput matrices A and B, respectively. The first hypergraphmodel performs two-dimensional nonzero-based partitioningof the output matrix, whereas the second and third modelsperform 1D row-wise and column-wise partitioning of theoutput matrix, respectively. This partitioning scheme leads to atwo-phase parallel SpGEMM algorithm: communication-freelocal SpGEMM computations and the multiple single-node-accumulation operations on the local SpGEMM results.

In [79], Bethune et al. study the performance of SpGEMMusing the open-source sparse linear algebra library DBCSR(Distributed Block Compressed Sparse Row) on differentdistributed systems. DBCSR matrices are stored in a blockedcompressed sparse row (CSR) format distributed over a two-dimensional grid of P MPI processes. Inter-process com-munication is based on the communication-reducing 2.5Dalgorithm.

The local multiplication will start as soon as all thedata has arrived at the destination process. The amount ofcommunicated data by each process scales as O(1/

√P ).

In [67], Selvitopi et al. achieve static scheduling of “map”and “reduce” tasks in a MapReduce job based on graphand hypergraph partitioning. The locality in task assignmentreduces the amount of data transfer in the shuffle phase, and

the balancing of computations leads to faster task execution.They show the validity of their scheduling on the MapReduceparallelization of SpGEMM. Their model leads to tremendoussavings in data transfer and consequently achieves up to 4.2xspeedup for SpGEMM compared with random scheduling.

In [46], Demirci et al. design a distributed SpGEMMalgorithm on Accumolo, which is a highly scalable, distributedkey-value store built on the design of Googles Bigtable. Thebasic idea of this work is that reducing the values for a keylocally before they are sent to a remote node. They use a tabletserver to iterate through multiple rows in sub-A and createbatches of rows to be processed together before performingany computation or a batch-scan operation. Batch processingof rows significantly reduces the latency and communicationvolume among servers, because both the number of lookupoperations and the redundant retrieval of rows of B arereduced.

VI. PERFORMANCE EVALUATION

A. Overview

The performance of the SpGEMM kernel is dominated byseveral factors, including sparse format, matrix sparsity, andcomputational device. It is extremely challenging to figure outthe exact relationship between the SpGEMM kernel and thesefactors.

In this section, we conduct a series of experiments tocompare the SpGEMM performance of several state-of-artapproaches, and the non-zeros of sparse matrices are cachedand involved in calculation in double precision. Our testedlibraries include Intel Math Kernel Library (MKL) [89],NVIDIA CUDA Sparse Library (cuSPARSE) [88], CSPARSE[91], CUSP [90], bhSPARSE [17] [21] and KokkosKernels[87].

Intel MKL is a highly-parallel closed-source library forIntel processors. One of its sub-library, named spblas, includesstandard C and Fortran API for sparse linear algebra. Ituses a highly encapsulated internal data structure to performoperations upon sparse matrices. We call mkl sparse sp2mto perform SpGEMM, and both input matrices are encodedwith either CSR or BSR. This interface supports two-stageexecution. The row pointer array of the output matrix iscalculated in the first stage. In the second stage, the remainingcolumn indexes and value arrays of the output matrix arecalculated. At the same time, We record the execution timeof these two stages.

cuSPARSE is a closed-source library provided by NVIDIA.It contains a set of basic linear algebra subroutines used forhandling sparse matrices. In our test program, input matri-ces encoded with COO format are first converted into CSRformat by calling cusparseXcoo2csr, then we call cusparseXc-srgemmnnz and cusparseDcsrgemm in turn to complete a two-stage SpGEMM, which is similar to MKL. Also, the executiontime of each step is recorded.

CSPARSE is an open-source, single-thread sparse matrixpackage written in C program. It uses the CSC format store thesparse matrices. We call cs multiply to calculate the product

Page 12: A Systematic Survey of General Sparse Matrix-Matrix ... · School of Computer Science and Technology Beijing Institute of Technology Beijing, China tan zn@163.com Yueyan Zhao School

TABLE II: Detailed information of evaluated libraries.

Library Version Compiler Open source Size prediction Accumulator Supported format

MKL 2019 icc 19.0.3.199 No precise - CSC/CSR/BSRcuSPARSE 10.0.130 nvcc 10.0.130 No precise hash-based CSRCSPARSE 3.1.4 icc 19.0.3.199 Yes progressive dense CSCCUSP 0.5.1 nvcc 8.0.61 Yes upper bound sort-based COO/CSRbhsparse Lastest nvcc 8.0.61 Yes hybrid hybrid CSRKokkosKernels 2.8.00 nvcc 10.0.130 Yes precise CPU:dense; GPU:hash-based CSR

Fig. 3: The detailed information of dataset.

of two sparse matrices and also record the execution time ofthis procedure simultaneously.

CUSP is an open-source library for sparse basic linearalgebra and graph computations based on Thrust, C++. Itprovides a flexible API for users and is highly encapsulated.We call multiply to calculate the product of two sparse matricesencoded with the COO format and record the execution timeof this call procedure.

bhSPARSE is an open-source library that provides sparselinear algebra interfaces used for sparse matrix computationson heterogeneous parallel processors. A SpGEMM implemen-tation based on CSR format is included in this library, and itis claimed to be efficient and general for the multiplicationof irregular sparse matrices. It is composed of four stages:calculating upper bound, binning, computing the result matrix,and arranging data. The detailed introduction can be found inpaper [21].

KokkosKernels implements local computational kernels for

linear algebra and graph operations, using the Kokkos shared-memory parallel programming model [85]. It also supportstwo-stage execution and records the execution time of thesymbolic stage and numeric stage, respectively. Moreover,we test its performance on the Intel multi-core platform andNVIDIA GPU platform, respectively.

B. System Setup

The computer used for the experiment runs a 64-bit Ubuntuoperation system. The host memory is up to 16GB. TheCPU of this machine is Intel CoreTM i7-4790K with 4GHzclock frequency. The GPU is NVIDIA Geforce GTX 1080Ti,which is based on the Pascal architecture and equipped with3584 CUDA cores and 11GB device memory. The versions,compilers, open-source information, size prediction method,intermediate result accumulator, and support format of evalu-ated libraries are set out in Table II.

Page 13: A Systematic Survey of General Sparse Matrix-Matrix ... · School of Computer Science and Technology Beijing Institute of Technology Beijing, China tan zn@163.com Yueyan Zhao School

Fig. 4: The proportion of execution time of each phase.Involved matrices are encoded with CSR format. Format con-version, stage1, stage2 and format export represent the formatconversion from COO to CSR, calculation of row pointer arrayof the output matrix, calculation of remaining column indexesand value arrays of the output matrix, format export frominternal representation to CSR format, respectively.

Fig. 5: The proportion of execution time of each phase.Involved matrices are encoded with BSR format. Format con-version, stage1, stage2 and format export represent the formatconversion from COO to BSR, calculation of row pointer arrayof the output matrix, calculation of remaining column indexesand value arrays of the output matrix, format export frominternal representation to BSR format, respectively.

C. Benchmark

The sparse matrices used in our experiment are from theSuiteSparse Matrix Collection (formerly the University ofFlorida Sparse Matrix Collection) [86]. We choose the squarematrices to perform the SpGEMM kernel C = A × A. Thecorresponding dataset is shown in Fig. 3. The dimensions ofmatrices range from 14K to 1M, and the number of non-zeros ranges from 0.4M to 11.5M. These matrices are frommany applications, including Finite Element Method (FEM),Quantum Chromodynamics (QCD), Protein data, electromag-

netics, Circuit simulation, Directed graph, structural problem,and web connectivity. Besides, it can be seen from Fig. 3 thatleft matrices have a regular distribution, most of their non-zeroelements are distributed near main diagonal, while right sparsematrices have an irregular non-zeros distribution.

D. Evaluation Result

We conduct three groups of experiments on the benchmarkto evaluate the performance of the ahead mentioned libraries.

1) Sparse Storage Format: Although a variety of storageformats are currently proposed for sparse matrix, the existingSpGEMM implementations involve few storage formats. CSRis the most commonly used sparse format, which is used inthe SpGEMM implementation of CUSP, MKL, cuSPARSE,bhSPARSE, and KokkosKernels. Besides, MKL supports themultiplication of two sparse matrices encoded with BSRformat, and CSPARSE only supports CSC format.

In this experiment, we compare the SpGEMM performancein MKL, where the involved sparse matrices are encodedwith CSR or BSR format. The SpGEMM kernel in MKLis composed of four phases: format conversion (COO toCSR/BSR), stage1 (the first stage mentioned earlier), stage2(the second stage mentioned earlier), and format export (exportCSR/BSR matrix from internal representation).

Fig. 4 and Fig. 5 provide the proportion of execution timeof each phase where all involved sparse matrices are encodedwith CSR or BSR formats. It can be seen from Fig. 4 that whenthe involved matrices are stored in CSR format, the executiontime of format conversion for most sparse matrices takes up asmall proportion. The execution time of the last three phasesvaries from matrix to matrix. Both stage1 and stage2 accountfor a larger proportion than other phases, while the executiontime of format export phase varies greatly. From Fig. 5, wecan see that the execution time of the stage1 phase takes upa small ratio for most sparse matrices, while the other threephases account for a larger proportion.

Comparison of the execution time of each phase based ondifferent sparse formats is set out in Fig. 6. From Fig. 6(a) wecan see that it takes a longer time to convert the matrix fromCOO to BSR than to CSR on each sparse matrix, and the timedifference is huge on some sparse matrices. As can be seenfrom Fig. 6(b), stage1 based on CSR format, which computesthe row pointer array of output matrix, takes a longer timethan BSR format on most sparse matrices. From Fig. 6(c) wecan see that the SpGEMM based on BSR format gives betterperformance than the SpGEMM based on CSR format on mostirregular sparse matrices, while there is no specific winner forregular sparse matrices. Fig. 6(d) indicates that there is noabsolute advantage on exporting the internal representation toCSR or BSR.

The final performance comparison between CSR and BSR-based SpGEMM is presented in Fig. 7. It can be seen thatneither CSR-based nor BSR-based SpGEMM shows the over-whelming advantage. The specific performance of SpGEMMhas a complex relationship with the chosen sparse format andthe matrix sparsity.

Page 14: A Systematic Survey of General Sparse Matrix-Matrix ... · School of Computer Science and Technology Beijing Institute of Technology Beijing, China tan zn@163.com Yueyan Zhao School

(a) Format conversion. (b) Stage1.

(c) Stage2. (d) Format export.

Fig. 6: Comparison of execution time of each phase in different sparse formats, including CSR and BSR.

Fig. 7: Performance comparison of SpGEMM implementationin MKL where involved sparse matrices are compressed withCSR or BSR formats.

2) SpGEMM Implementation: In this section, we comparethe performance of different SpGEMM implementations. First,we compare the performance of each stage of the libraries

whose SpGEMM implementation predicts the number of non-zeros of the output matrix using the precise method. In existinglibraries, MKL, cuSPARSE, and KokkosKernels utilize theprecise method in the first symbolic phase.

Fig. 8 presents the speedup of the execution time of cuS-PARSE and KokkosKernels to MKL (SpGEMM based onCSR) in the symbolic phase. The SpGEMM in KokkosKer-nels involved mac econ fwd500, scircuit and webbase-1Mmatrices encounter runtime error, so their values are set to0 (the same below). From Fig. 8 we can see that for mostregular matrices, the implementation of the symbolic phasein cuSPARSE is better than other libraries, while the CUDA-based implementation of symbolic phase in KokkosKernelsis the best for most irregular matrices. Besides, the MKLand OpenMP-based implementation of the symbolic phase inKokkosKernels show worse performance than other libraries.

The speedup of the execution time of cuSPARSE andKokkosKernels in the second numeric phase to MKL canbe compared in Fig. 9. It can be seen that the CUDA-based implementation of the numeric phase in KokkosKernelsoutperforms cuSPARSE and OpenMP-based KokkosKernelson each sparse matrix except three problematic matrices

Page 15: A Systematic Survey of General Sparse Matrix-Matrix ... · School of Computer Science and Technology Beijing Institute of Technology Beijing, China tan zn@163.com Yueyan Zhao School

Fig. 8: The speedup of the execution time of cuSPARSE, CUDA-based and OpenMP-based Kokkoskernels in the symbolicphase to MKL (based on CSR).

Fig. 9: The speedup of cuSPARSE, CUDA-based and OpenMP-based Kokkoskernels in the numeric phase to MKL (based onCSR).

and matrix cant. Especially on irregular sparse matrices, itsperformance advantage is considerable.

Fig. 10 presents the proportion of execution time of sym-bolic and numeric phases in different SpGEMM implemen-tations, where MKL 1 and MKL 2 represent the symbolicand numeric phases in MKL, respectively, and others aresimilar. It can be seen from Fig. 10 that the execution timeof the symbolic phase is less than or equal to the numericphase on each sparse matrix in cuSPARSE and OpenMP-based KokkosKernels. Moreover, there are 8 and 12 matricesout of the whole 20 matrices whose time proportions of thesymbolic phase are less than or equal to 30% in cuSPARSEand OpenMP-based SpGEMM, respectively. In MKL andCUDA-based KokkosKernels, however, there are 11 and 16out of 17 matrices, respectively, whose time proportions of

symbolic phase are larger than 30%, and the time proportionsof 3 and 7 out of 17 matrices respectively are larger than 50%.

The final performance of SpGEMM implementation indifferent libraries is summarised in Fig. 11. It can be seen thatCUDA-based KokkosKernels, cuSPARSE, bhSPARSE, andOpenMP-based KokkosKernels outperform other SpGEMMimplementations on 12, 5, 2 and 1 sparse matrices, respec-tively.

VII. CHALLENGES AND FUTURE WORK

SpGEMM has gained much attention in the past decades,and the work has been conducted in many directions. Webelieve that it will be used in many other fields as thedevelopment of IoT, big data, and AI. A systematic literature

Page 16: A Systematic Survey of General Sparse Matrix-Matrix ... · School of Computer Science and Technology Beijing Institute of Technology Beijing, China tan zn@163.com Yueyan Zhao School

(a) MKL. (b) cuSPARSE.

(c) CUDA-based KokkosKernels. (d) OpenMP-based KokkosKernels.

Fig. 10: The proportion of execution time of symbolic and numeric phases in different SpGEMM implementations. MKL 1and MKL 2 represent the symbolic and numeric phases respectively in MKL, and others are similar.

Fig. 11: Performance comparsion of SpGEMM implementation in CSPARSE, MKL, CUSP, bhSPARSE, cuSPARSE, andKokkosKernels. To be fair, the statistics in this figure do not include the time cost of format conversion and format exportd,and the performance of MKL in this figure is based on CSR format.

Page 17: A Systematic Survey of General Sparse Matrix-Matrix ... · School of Computer Science and Technology Beijing Institute of Technology Beijing, China tan zn@163.com Yueyan Zhao School

review sheds light on the potential research directions andsome challenges that require further study.

One of the challenges of SpGEMM is exploring the sparsityof sparse matrices. Researchers find that the non-zero ele-ments distribution dominates the performance of SpMV andSpGEMM on the same architecture. To further explore thepotential performance improvement, automatic format selectalgorithms have been designed for SpMV based on machinelearning models. Significant performance improvement hasbeen observed using auto-tuning and format selection basedon these models. However, the situation for SpGEMM is morecomplicated because two sparse matrices are involved. Theperformance depends on not only the sparsity of the twoinput matrices but also the combination of the sub-matricespartitioned from the input matrices.

Size prediction of the result matrix is also a challengefor SpGEMM. Upper-bound prediction may result in memoryover-allocation, and others may lead to memory re-allocation.Both over-allocation and re-allocation are challenging tasks foracceleration devices, such as GPU, DSP, FPGA, and TPU. On-device memory capacity is limited and may not accommodatesuch a large amount of data. It also takes time to copy datato and from device memory because of separated memoryspace. Precise size prediction not only reduces the overheadof memory management but also indirectly improves theperformance of result accumulating. This is because smallermemory footprint and seldom re-allocation are required foroutput matrix manipulation.

Finally, heterogeneous architecture-oriented optimization isa challenge for diversified systems. CPU is good at processingcomplicated logic, while GPU is good at dense computations.Besides, DSP and FPGA accelerators may be used in differentsystems. One of the critical questions of porting SpGEMMto the heterogeneous system is how to achieve load balanceand minimize the communication traffic. Moreover, each sub-matrix may have its feature in non-zeros distribution. Ideally,relatively dense blocks should be mapped to accelerationdevices, while super sparse blocks should be mapped toCPU. Only in this way can each device give full play to itsarchitecture and optimize the overall computing performanceof SpGEMM.

VIII. CONCLUSION

The design of an efficient SpGEMM algorithm, as well asits implementation, are critical to many large-scale scientificapplications. Therefore it is not surprising that SpGEMM hasattracted much attention from researchers over the years. Inthis survey, we highlight some of the developments in recentyears and emphasize the application, challenging problems,architecture-oriented optimizations, and performance evalua-tion. In concluding, we stress the fact that despite recentprogress, there are still important areas where much workremains to be done, such as different formats support, hetero-geneous architecture-oriented optimization, efficient size pre-diction of target matrix. On the other hand, the heterogeneousarchitecture may give rise to new optimization opportunities,

and efficient implementation in the specific architecture iswithin reach and can be expected to continue in the new future.

REFERENCES

[1] J. Georgii and R. Westermann, “A streaming approach for sparse matrixproducts and its application in galerkin multigrid methods,” ElectronicTransactions on Numerical Analysis, vol. 37, no. 263-275, pp. 3–5, 2010.

[2] N. Bell, S. Dalton, and L. N. Olson, “Exposing fine-grained parallelismin algebraic multigrid methods,” SIAM J. Scientific Computing, vol. 34,no. 4, 2012. [Online]. Available: https://doi.org/10.1137/110838844

[3] G. Ballard, C. Siefert, and J. Hu, “Reducing communication costsfor sparse matrix multiplication within algebraic multigrid,” SIAMJournal on Scientific Computing, vol. 38, no. 3, pp. C203–C231, 2016.[Online]. Available: https://doi.org/10.1137/15M1028807

[4] A. Bienz, “Reducing communication in sparse solvers,” phdthesis,University of Illinois at Urbana-Champaign, Sep. 2018.

[5] T. A. Davis, “Graph algorithms via suitesparse: Graphblas: trianglecounting and k-truss,” in 2018 IEEE High Performance extreme Com-puting Conference (HPEC), Sep. 2018, pp. 1–6.

[6] J. Cohen, “Graph twiddling in a mapreduce world,” Computing inScience and Engg., vol. 11, no. 4, pp. 29–41, Jul. 2009. [Online].Available: https://doi.org/10.1109/MCSE.2009.120

[7] M. M. Wolf, M. Deveci, J. W. Berry, S. D. Hammond, and S. Raja-manickam, “Fast linear algebra-based triangle counting with kokkosker-nels,” in 2017 IEEE High Performance Extreme Computing Conference(HPEC), Sep. 2017, pp. 1–7.

[8] A. Azad, A. Bulu, and J. Gilbert, “Parallel triangle counting andenumeration using matrix algebra,” in 2015 IEEE International Paralleland Distributed Processing Symposium Workshop, May 2015, pp. 804–811.

[9] J. R. Gilbert, S. Reinhardt, and V. B. Shah, “High-performance graphalgorithms from parallel sparse matrices,” in International Workshop onApplied Parallel Computing. Springer, 2006, pp. 260–269.

[10] M. Then, M. Kaufmann, F. Chirigati, T.-A. Hoang-Vu, K. Pham,A. Kemper, T. Neumann, and H. T. Vo, “The more the merrier:Efficient multi-source graph traversal,” Proc. VLDB Endow., vol. 8,no. 4, pp. 449–460, Dec. 2014. [Online]. Available: http://dx.doi.org/10.14778/2735496.2735507

[11] A. Buluc and J. R. Gilbert, “The combinatorial BLAS: design,implementation, and applications,” International Journal of HighPerformance Computing Applications, vol. 25, no. 4, pp. 496–509,2011. [Online]. Available: https://doi.org/10.1177/1094342011403516

[12] T. M. Chan, “More algorithms for all-pairs shortest paths inweighted graphs,” in Proceedings of the Thirty-ninth Annual ACMSymposium on Theory of Computing, ser. STOC ’07. NewYork, NY, USA: ACM, 2007, pp. 590–598. [Online]. Available:http://doi.acm.org/10.1145/1250790.1250877

[13] H. Kaplan, M. Sharir, and E. Verbin, “Colored intersection searching viasparse rectangular matrix multiplication,” in Proceedings of the twenty-second annual symposium on Computational geometry. ACM, 2006,pp. 52–60.

[14] M. Deveci, E. G. Boman, K. D. Devine, and S. Rajamanickam, “Parallelgraph coloring for manycore architectures,” in 2016 IEEE InternationalParallel and Distributed Processing Symposium (IPDPS), May 2016,pp. 892–901.

[15] V. Vassilevska, R. Williams, and R. Yuster, “Finding heaviesth-subgraphs in real weighted graphs, with applications,” CoRR,vol. abs/cs/0609009, 2006. [Online]. Available: http://arxiv.org/abs/cs/0609009

[16] A. Buluc and K. Madduri, “Parallel breadth-first search on distributedmemory systems,” in Proceedings of 2011 International Conference forHigh Performance Computing, Networking, Storage and Analysis, ser.SC ’11. New York, NY, USA: ACM, 2011, pp. 65:1–65:12. [Online].Available: http://doi.acm.org/10.1145/2063384.2063471

[17] W. Liu and B. Vinter, “A framework for general sparse matrix-matrixmultiplication on gpus and heterogeneous processors,” J. ParallelDistrib. Comput., vol. 85, no. C, pp. 47–61, Nov. 2015. [Online].Available: http://dx.doi.org/10.1016/j.jpdc.2015.06.010

[18] F. G. Gustavson, “Two fast algorithms for sparse matrices: Multiplicationand permuted transposition,” ACM Trans. Math. Softw., vol. 4, pp. 250–269, 1978.

[19] I. S. Duff, “A survey of sparse matrix research,” Proceedings of theIEEE, vol. 65, no. 4, pp. 500–535, April 1977.

Page 18: A Systematic Survey of General Sparse Matrix-Matrix ... · School of Computer Science and Technology Beijing Institute of Technology Beijing, China tan zn@163.com Yueyan Zhao School

[20] M. Grossman, C. Thiele, M. Araya-Polo, F. Frank, F. O. Alpak,and V. Sarkar, “A survey of sparse matrix-vector multiplicationperformance on large matrices,” CoRR, vol. abs/1608.00636, 2016.[Online]. Available: http://arxiv.org/abs/1608.00636

[21] W. Liu and B. Vinter, “An efficient GPU general sparse matrix-matrixmultiplication for irregular data,” in 2014 IEEE 28th InternationalParallel and Distributed Processing Symposium, 2014, pp. 370–381.[Online]. Available: https://doi.org/10.1109/IPDPS.2014.47

[22] B. Kitchenham, “Procedures for performing systematic reviews,” Keele,UK, Keele Univ., vol. 33, 08 2004.

[23] R. D. Falgout, “An introduction to algebraic multigrid,” Computing inScience Engineering, vol. 8, no. 6, pp. 24–33, Nov 2006.

[24] W. L. Briggs, V. E. Henson, and S. F. McCormick, A Multigrid Tutorial:Second Edition. Philadelphia, PA, USA: Society for Industrial andApplied Mathematics, 2000.

[25] J. J. Elliott and C. M. Siefert, “Low thread-count gustavson: A multi-threaded algorithm for sparse matrix-matrix multiplication using perfecthashing,” in 2018 IEEE/ACM 9th Workshop on Latest Advances inScalable Algorithms for Large-Scale Systems (scalA), Nov 2018, pp.57–64.

[26] A. Yasar, S. Rajamanickam, M. Wolf, J. Berry, and U. V. atalyurek,“Fast triangle counting using cilk,” in 2018 IEEE High Performanceextreme Computing Conference (HPEC), Sep. 2018, pp. 1–7.

[27] M. M. Wolf, J. W. Berry, and D. T. Stark, “A task-based linear algebrabuilding blocks approach for scalable graph analytics,” in 2015 IEEEHigh Performance Extreme Computing Conference (HPEC), Sep. 2015,pp. 1–6.

[28] L. Wang, Y. Wang, C. Yang, and J. D. Owens, “A comparative studyon exact triangle counting algorithms on the gpu,” in Proceedingsof the ACM Workshop on High Performance Graph Processing, ser.HPGP ’16. New York, NY, USA: ACM, 2016, pp. 1–8. [Online].Available: http://doi.acm.org/10.1145/2915516.2915521

[29] Y. Zhang, L. Wu, G. Wei, and S. Wang, “A novel algorithmfor all pairs shortest path problem based on matrix multiplicationand pulse coupled neural network,” Digital Signal Processing,vol. 21, no. 4, pp. 517 – 521, 2011. [Online]. Available:http://www.sciencedirect.com/science/article/pii/S1051200411000650

[30] D. Eppstein and E. S. Spiro, “The h-index of a graph and its applicationto dynamic subgraph statistics,” in Proceedings of the 11th InternationalSymposium on Algorithms and Data Structures, ser. WADS ’09. Berlin,Heidelberg: Springer-Verlag, 2009, pp. 278–289.

[31] S. Samsi, V. Gadepally, M. B. Hurley, M. Jones, E. K. Kao,S. Mohindra, P. Monticciolo, A. Reuther, S. Smith, W. S. Song,D. Staheli, and J. Kepner, “Static graph challenge: Subgraphisomorphism,” CoRR, vol. abs/1708.06866, 2017. [Online]. Available:http://arxiv.org/abs/1708.06866

[32] V. Gadepally, J. Bolewski, D. Hook, D. Hutchison, B. A. Miller,and J. Kepner, “Graphulo: Linear algebra graph kernels for nosqldatabases,” CoRR, vol. abs/1508.07372, 2015. [Online]. Available:http://arxiv.org/abs/1508.07372

[33] C. E. Tsourakakis, P. Drineas, E. Michelakis, I. Koutis, and C. Faloutsos,“Spectral counting of triangles via element-wise sparsification andtriangle-based link recommendation,” Social Network Analysis andMining, vol. 1, no. 2, pp. 75–81, Apr 2011. [Online]. Available:https://doi.org/10.1007/s13278-010-0001-9

[34] A. Pavan, K. Tangwongsan, S. Tirthapura, and K.-L. Wu, “Countingand sampling triangles from a graph stream,” Proc. VLDB Endow.,vol. 6, no. 14, pp. 1870–1881, Sep. 2013. [Online]. Available:http://dx.doi.org/10.14778/2556549.2556569

[35] N. Wang, J. Zhang, K.-L. Tan, and A. K. H. Tung, “Ontriangulation-based dense neighborhood graph discovery,” Proc. VLDBEndow., vol. 4, no. 2, pp. 58–68, Nov. 2010. [Online]. Available:http://dx.doi.org/10.14778/1921071.1921073

[36] T. Mattson, D. Bader, J. Berry, A. Buluc, J. Dongarra, C. Faloutsos,J. Feo, J. Gilbert, J. Gonzalez, B. Hendrickson, J. Kepner, C. Leiserson,A. Lumsdaine, D. Padua, S. Poole, S. Reinhardt, M. Stonebraker,S. Wallach, and A. Yoo, “Standards for graph algorithm primitives,” in2013 IEEE High Performance Extreme Computing Conference (HPEC),Sep. 2013, pp. 1–2.

[37] A. Buluc and J. R. Gilbert, “Highly parallel sparse matrix-matrixmultiplication,” arXiv preprint arXiv:1006.2183, 2010.

[38] J. R. Gilbert, S. Reinhardt, and V. B. Shah, “A unified frameworkfor numerical and combinatorial computing,” Computing in ScienceEngineering, vol. 10, no. 2, pp. 20–25, March 2008.

[39] M. O. Rabin and V. V. Vazirani, “Maximum matchings in general graphsthrough randomization,” J. Algorithms, vol. 10, no. 4, pp. 557–567,Dec. 1989. [Online]. Available: https://doi.org/10.1016/0196-6774(89)90005-9

[40] K. Censor-Hillel, P. Kaski, J. H. Korhonen, C. Lenzen, A. Paz, andJ. Suomela, “Algebraic methods in the congested clique,” CoRR, vol.abs/1503.04963, 2015. [Online]. Available: http://arxiv.org/abs/1503.04963

[41] V. Weber, T. Laino, A. Pozdneev, I. Fedulova, and A. Curioni,“Semiempirical molecular dynamics (semd) i: Midpoint-based parallelsparse matrixmatrix multiplication algorithm for matrices withdecay,” Journal of Chemical Theory and Computation, vol. 11,no. 7, pp. 3145–3152, 2015, pMID: 26575751. [Online]. Available:https://doi.org/10.1021/acs.jctc.5b00382

[42] K. Akbudak and C. Aykanat, “Simultaneous input and outputmatrix partitioning for outer-product–parallel sparse matrix-matrixmultiplication,” SIAM Journal on Scientific Computing, vol. 36, no. 5,pp. C568–C590, 2014. [Online]. Available: https://doi.org/10.1137/13092589X

[43] F. Gremse, A. Hfter, L. Schwen, F. Kiessling, and U. Naumann,“Gpu-accelerated sparse matrix-matrix multiplication by iterative rowmerging,” SIAM Journal on Scientific Computing, vol. 37, no. 1, pp.C54–C71, 2015. [Online]. Available: https://doi.org/10.1137/130948811

[44] J. Demouth, “Sparse matrix-matrix multiplication on the gpu,” in GPUTechnology Conference 2012, 2012.

[45] Y. Nagasaka, A. Nukada, and S. Matsuoka, “High-performance andmemory-saving sparse general matrix-matrix multiplication for nvidiapascal gpu,” in 2017 46th International Conference on Parallel Pro-cessing (ICPP), Aug 2017, pp. 101–110.

[46] G. V. Demirci and C. Aykanat, “Scaling sparse matrix-matrixmultiplication in the accumulo database,” Distributed and ParallelDatabases, Jan 2019. [Online]. Available: https://doi.org/10.1007/s10619-019-07257-y

[47] M. Deveci, C. Trott, and S. Rajamanickam, “Performance-portablesparse matrix-matrix multiplication for many-core architectures,”in 2017 IEEE International Parallel and Distributed ProcessingSymposium Workshops, IPDPS Workshops 2017, Orlando / BuenaVista, FL, USA, May 29 - June 2, 2017, 2017, pp. 693–702. [Online].Available: https://doi.org/10.1109/IPDPSW.2017.8

[48] E. Cohen, “Size-estimation framework with applications to transitiveclosure and reachability,” J. Comput. Syst. Sci., vol. 55, no. 3, pp.441–453, Dec. 1997. [Online]. Available: http://dx.doi.org/10.1006/jcss.1997.1534

[49] R. R. Amossen, A. Campagna, and R. Pagh, “Better size estimation forsparse matrix products,” 6 2010.

[50] R. Pagh and M. Stockel, “The input/output complexity of sparse matrixmultiplication,” CoRR, vol. abs/1403.3551, 2014. [Online]. Available:http://arxiv.org/abs/1403.3551

[51] Y. Nagasaka, S. Matsuoka, A. Azad, and A. Bulu, “High-performancesparse matrix-matrix products on intel knl and multicore architectures.”

[52] J. Gilbert, C. Moler, and R. Schreiber, “Sparse matrices in matlab:Design and implementation,” SIAM Journal on Matrix Analysis andApplications, vol. 13, no. 1, pp. 333–356, 1992. [Online]. Available:https://doi.org/10.1137/0613024

[53] K. Matam, S. R. Krishna Bharadwaj Indarapu, and K. Kothapalli,“Sparse matrix-matrix multiplication on modern architectures,” in 201219th International Conference on High Performance Computing, Dec2012, pp. 1–10.

[54] E. H. Rubensson and E. Rudberg, “Chunks and tasks: A programmingmodel for parallelization of dynamic algorithms,” Parallel Comput.,vol. 40, no. 7, pp. 328–343, Jul. 2014. [Online]. Available:http://dx.doi.org/10.1016/j.parco.2013.09.006

[55] K. Akbudak and C. Aykanat, “Exploiting locality in sparse matrix-matrix multiplication on many-core architectures,” IEEE Transactionson Parallel and Distributed Systems, vol. 28, no. 8, pp. 2258–2271,Aug 2017.

[56] K. Akbudak, O. Selvitopi, and C. Aykanat, “Partitioning models forscaling parallel sparse matrix-matrix multiplication,” vol. 4, pp. 1–34,2018.

[57] M. Winter, D. Mlakar, R. Zayer, H.-P. Seidel, and M. Steinberger,“Adaptive sparse matrix-matrix multiplication on the gpu,” inProceedings of the 24th Symposium on Principles and Practiceof Parallel Programming, ser. PPoPP ’19. New York, NY, USA:

Page 19: A Systematic Survey of General Sparse Matrix-Matrix ... · School of Computer Science and Technology Beijing Institute of Technology Beijing, China tan zn@163.com Yueyan Zhao School

ACM, 2019, pp. 68–81. [Online]. Available: http://doi.acm.org/10.1145/3293883.3295701

[58] M. Deveci, S. D. Hammond, M. M. Wolf, and S. Rajamanickam,“Sparse matrix-matrix multiplication on multilevel memory architectures: Algorithms and experiments,” CoRR, vol. abs/1804.00695, 2018.[Online]. Available: http://arxiv.org/abs/1804.00695

[59] Y. Chen, K. Li, W. Yang, G. Xiao, X. Xie, and T. Li, “Performance-awaremodel for sparse matrix-matrix multiplication on the sunway taihulightsupercomputer,” vol. 30, pp. 923–938, 2019.

[60] S. E. Kurt, V. Thumma, C. Hong, A. Sukumaran-Rajam, and P. Sadayap-pan, “Characterization of data movement requirements for sparse matrixcomputations on gpus,” in 2017 IEEE 24th International Conference onHigh Performance Computing (HiPC), Dec 2017, pp. 283–293.

[61] F. Gremse, K. Kpper, and U. Naumann, “Memory-efficient sparsematrix-matrix multiplication by row merging on many-core architec-tures,” vol. 40, pp. C429–C449, 2018.

[62] R. A. van de Geijn and J. Watts, “Summa: Scalable universal matrixmultiplication algorithm,” Austin, TX, USA, Tech. Rep., 1995.

[63] A. Buluc and J. R. Gilbert, “On the representation and multiplicationof hypersparse matrices,” in 2008 IEEE International Symposium onParallel and Distributed Processing. IEEE, 2008, pp. 1–11.

[64] ——, “Challenges and advances in parallel sparse matrix-matrix multi-plication,” in 2008 37th International Conference on Parallel Processing.IEEE, 2008, pp. 503–510.

[65] A. Azad, G. Ballard, A. Buluc, J. Demmel, L. Grigori, O. Schwartz,S. Toledo, and S. Williams, “Exploiting multiple levels of parallelismin sparse matrix-matrix multiplication,” CoRR, vol. abs/1510.00844,2015. [Online]. Available: http://arxiv.org/abs/1510.00844

[66] G. Ballard, A. Druinsky, N. Knight, and O. Schwartz, “Hypergraphpartitioning for sparse matrix-matrix multiplication,” ACM Trans.Parallel Comput., vol. 3, no. 3, pp. 18:1–18:34, Dec. 2016. [Online].Available: http://doi.acm.org/10.1145/3015144

[67] O. Selvitopi, G. V. Demirci, A. Turk, and C. Aykanat, “Locality-aware and load-balanced static task scheduling for mapreduce,”Future Generation Computer Systems, vol. 90, pp. 49 – 61,2019. [Online]. Available: http://www.sciencedirect.com/science/article/pii/S0167739X17329266

[68] M. Deveci, C. Trott, and S. Rajamanickam, “Multi-threaded sparsematrix-matrix multiplication for many-core and gpu architectures,”vol. 78, pp. 33–46, 2018.

[69] M. M. A. Patwary, N. R. Satish, N. Sundaram, J. Park, M. J. Anderson,S. G. Vadlamudi, D. Das, S. G. Pudov, V. O. Pirogov, and P. Dubey,Parallel Efficient Sparse Matrix-Matrix Multiplication on MulticorePlatforms, 2015.

[70] J. Liu, X. He, W. Liu, and G. Tan, “Register-aware optimizationsfor parallel sparse matrix–matrix multiplication,” International Journalof Parallel Programming, Jan 2019. [Online]. Available: https://doi.org/10.1007/s10766-018-0604-8

[71] S. Dalton, L. N. Olson, and N. Bell, “Optimizing sparse matrix - matrixmultiplication for the GPU,” ACM Trans. Math. Softw., vol. 41, no. 4, pp.25:1–25:20, 2015. [Online]. Available: https://doi.org/10.1145/2699470

[72] D. Merrill and A. Grimshaw, “High performance and scalable radixsorting: a case study of implementing dynamic parallelism for gpucomputing.” Parallel Processing Letters, vol. 21, pp. 245–272, 06 2011.

[73] G. E. Blelloch, M. A. Heroux, and M. Zagha, “Segmented operationsfor sparse matrix computation on vector multiprocessors,” School ofComputer Science, Carnegie Mellon University, Tech. Rep. CMU-CS-93-173, Aug. 1993.

[74] K. Hou, W. Liu, H. Wang, and W.-c. Feng, “Fast segmentedsort on gpus,” in Proceedings of the International Conference onSupercomputing, ser. ICS ’17. New York, NY, USA: ACM, 2017, pp.12:1–12:10. [Online]. Available: http://doi.acm.org/10.1145/3079079.3079105

[75] M. Deveci, K. Kaya, and U. V. atalyurek, “Hypergraph sparsification andits application to partitioning,” in 2013 42nd International Conferenceon Parallel Processing, Oct 2013, pp. 200–209.

[76] C. Kim, T. Kaldewey, V. W. Lee, E. Sedlar, A. D. Nguyen, N. Satish,J. Chhugani, A. Di Blas, and P. Dubey, “Sort vs. hash revisited:Fast join implementation on modern multi-core cpus,” Proc. VLDBEndow., vol. 2, no. 2, pp. 1378–1389, Aug. 2009. [Online]. Available:https://doi.org/10.14778/1687553.1687564

[77] C. Balkesen, G. Alonso, J. Teubner, and M. T. Ozsu, “Multi-core, main-memory joins: Sort vs. hash revisited,” Proc. VLDB

Endow., vol. 7, no. 1, pp. 85–96, Sep. 2013. [Online]. Available:http://dx.doi.org/10.14778/2732219.2732227

[78] D. Jin and S. G. Ziavras, “A super-programming technique for largesparse matrix multiplication on pc clusters,” IEICE TRANSACTIONS onInformation and Systems, vol. 87, no. 7, pp. 1774–1781, 2004.

[79] I. Bethune, A. Gloess, J. Hutter, A. Lazzaro, H. Pabst, and F. Reid,“Porting of the dbcsr library for sparse matrix-matrix multiplications tointel xeon phi systems.”

[80] J. Siegel, O. Villa, S. Krishnamoorthy, A. Tumeo, and X. Li, “Efficientsparse matrix-matrix multiplication on heterogeneous high performancesystems,” in 2010 IEEE International Conference On Cluster ComputingWorkshops and Posters (CLUSTER WORKSHOPS). IEEE, 2010, pp.1–8.

[81] E. H. Rubensson and E. Rudberg, “Locality-aware parallel block-sparsematrix-matrix multiplication using the chunks and tasks programmingmodel,” Parallel Comput., vol. 57, no. C, pp. 87–106, Sep. 2016.[Online]. Available: https://doi.org/10.1016/j.parco.2016.06.005

[82] C. Y. Lin, Z. Zhang, N. Wong, and H. K. So, “Design space explorationfor sparse matrix-matrix multiplication on fpgas,” in 2010 InternationalConference on Field-Programmable Technology, Dec 2010, pp. 369–372.

[83] E. Jamro, T. Pabis, P. Russek, and K. Wiatr, “The algorithms forfpga implementation of sparse matrices multiplication,” Computing andInformatics, vol. 33, pp. 667–684, 01 2014.

[84] J. Hoberock and N. Bell, Thrust: A parallel template library, 2013,version 1.7.0. [Online]. Available: http://thrust.github.io/

[85] H. C. Edwards, C. R. Trott, and D. Sunderland, “Kokkos: Enablingmanycore performance portability through polymorphic memory accesspatterns,” Journal of Parallel and Distributed Computing, vol. 74, no. 12,pp. 3202 – 3216, 2014, domain-Specific Languages and High-LevelFrameworks for High-Performance Computing. [Online]. Available:http://www.sciencedirect.com/science/article/pii/S0743731514001257

[86] T. A. Davis and Y. Hu, “The university of florida sparse matrixcollection,” ACM Trans. Math. Softw., vol. 38, no. 1, pp. 1:1–1:25, 2011.

[87] Kokkoskernels. [Online]. Available: https://github.com/kokkos/kokkos-kernels

[88] NVIDIA. Nvidia cusparse library. [Online]. Available: https://developer.nvidia.com/cusparse

[89] Intel. Intel math kernel library. [Online]. Available: https://software.intel.com/en-us/mkl

[90] S. Dalton and N. Bell. Cusp : A c++ templated sparse matrix library.[Online]. Available: http://cusplibrary.github.com

[91] T. Davis. Csparse: a concise sparse matrix package. [Online]. Available:http://www.cise.ufl.edu/research/sparse/CSparse