• 中国计算机学会会刊
  • 中国科技核心期刊
  • 中文核心期刊

Computer Engineering & Science ›› 2025, Vol. 47 ›› Issue (3): 381-391.

• High Performance Computing • Previous Articles     Next Articles

Selection of sparse matrix multiplication algorithms based on supervised learning

PENG Lin,ZHANG Peng,CHEN Junfeng,TANG Tao,HUANG Chun   

  1. (College of Computer Science and Technology,National University of Defense Technology,Changsha 410073,China)
  • Received:2023-11-14 Revised:2024-02-22 Online:2025-03-25 Published:2025-04-01

Abstract: The sparse matrix multiplication algorithms with mainstream row-by-row calculation formulas, including SPA, HASH, and ESC, have significant performance disparities in different sparse matrices. There is no single optimal algorithm for all sparse matrices. A single algorithm cannot always achieve optimal performance on different non-zero element scales, and there is a significant gap between a single algorithm and the optimal selection. To this end, a selection model of sparse matrix multiplication algorithm based on supervised learning is proposed. A given set of matrices is used as the data source to extract the features of the sparse matrices, and performance data is obtained using SPA, HASH, and ESC calculations for training and validation. The resulting model can select the optimal algorithm for a new dataset solely based on the features of the sparse matrix. The experimental results show that this model can achieve a prediction accuracy of over 91%, with an average performance of 98% of the optimal selection, which is more than 1.55 times the performance of a single algorithm. It can also be used in practical library functions and has good generalization ability and practical value. 

Key words: sparse matrix multiplication, SpGEMM, SPA algorithm, HASH algorithm, ESC algorithm, machine learning