Journal of Computer Applications

    Next Articles

Adaptive computing optimization of sparse matrix-vector multiplication based on heterogeneous platforms

LI Bo, HUANG Jianqiang*, HUANG Dongqiang, WANG Xiaoying   

  1. Department of Computer Technology and Applications, Qinghai University
  • Received:2023-12-11 Revised:2024-02-07 Accepted:2024-02-01 Online:2024-03-12 Published:2024-03-12
  • About author:LI Bo, born in 1998, M. S. candidate. His research interest is high performance computing. HUANG Jianqiang, born in 1985, Ph. D., professor. His research interests include high performance computing, performance analysis. HUANG Dongqiang, born in 1998, M. S. candidate. His research interest is high performance computing. WANG Xiaoying, born in 1982, Ph. D., professor. Her research interests include smart grid, high performance computing, computer architecture.
  • Supported by:
    This work is partially supported by Natural Science Foundation of Qinghai Province (2022-ZJ-701), National Natural Science Foundation of China (62062053).

基于异构平台的稀疏矩阵向量乘自适应计算优化

李博,黄建强*,黄东强,王晓英   

  1. 青海大学 计算机技术与应用系
  • 作者简介:李博(1998—),男,山东菏泽人,硕士研究生,CCF会员,主要研究方向:高性能计算;黄建强(1985—),男,陕西西安人,教授,博士,CCF高级会员,主要研究方向:高性能计算、性能分析;黄东强(1998—),男,福建莆田人,硕士研究生,CCF会员,主要研究方向:高性能计算;王晓英(1982-),女,吉林双辽人,教授,博士,CCF高级会员,主要研究方向:智能电网、高性能计算、体系结构。
  • 基金资助:
    青海省科技厅应用基础研究项目(2022-ZJ-701);国家自然科学基金资助项目(62062053)。

Abstract: Sparse Matrix-Vector Multiplication (SpMV) is an important numerical linear algebra operation. Existing optimizations for SpMV suffer from issues such as incomplete consideration of preprocessing and communication time, lack of universality in storage structures. To address these challenges, an adaptive optimization scheme for sparse matrix-vector multiplication on heterogeneous platforms was proposed. Pearson correlation coefficients are utilized to determine highly correlated feature parameters. Two algorithms, eXtreme Gradient Boosting (XGBoost) and Light Gradient Boosting Machine (LightGBM), based on Gradient Boosting Decision Trees (GBDT), were employed to train predictive models to determine the optimal storage format for a given sparse matrix. Grid search was used to determine the optimal hyperparameters during model training, achieving an accuracy of over 85% for both algorithms in selecting the most suitable storage structure. Furthermore, for sparse matrices with the hybrid (HYB) storage format, the ELLPACK (ELL) format was computed on the GPU, while the Coordinate format was computed on the CPU, establishing a CPU+GPU parallel hybrid computing mode. Additionally, for sparse matrices with small data sizes, hardware platform selection was performed to improve computational speed. Experimental results demonstrate that the adaptive computational optimization achieves an average speedup of 1.4 times compared to the Compressed Sparse Row (CSR) storage format in the cuSPARSE library, and average speedups of 2.1 times and 2.6 times compared to the HYB and ELL formats, respectively.

Key words: Keywords: Sparse Matrix-Vector Multiplication (SpMV), adaptive optimization, Pearson correlation coefficient, eXtreme Gradient Boosting (XGBoost), Light Gradient Boosting Machine (LightGBM) 

摘要: 稀疏矩阵向量乘(SpMV)是一种重要的数值线性代数运算,现有的稀疏矩阵向量乘优化存在预处理及通信时间考虑不全面、存储结构不具有普适性等问题。为了解决这些问题,提出异构平台下稀疏矩阵向量乘的自适应优化方案,通过利用皮尔逊相关系数确定相关度高的特征参数,并分别使用基于梯度提升决策树(GBDT)的极端梯度提升(XGBoost)和轻量级梯度提升(LightGBM)两种算法进行预测模型的训练以确定某一稀疏矩阵更优的存储格式。利用网格搜索确定模型训练时更优的模型超参数,使两种算法对选择更适合的存储结构的准确率都达到了85%以上。其次,对于预测存储结构为混合(HYB)格式的稀疏矩阵,在GPU上计算其中的等长列(ELL)存储格式部分,在CPU上计算坐标(COO)存储格式部分,建立基于CPU+GPU的并行混合计算模式;同时为小数据量的稀疏矩阵选择硬件平台,提高运算速度。实验结果表明,自适应计算优化相较于cuSPARSE库中的压缩稀疏行(CSR)存储格式计算的平均加速比可以达到1.4,相较于按照混合和等长列存储格式计算的平均加速比则可以达到2.1和2.6。

关键词: 稀疏矩阵向量乘, 自适应优化, 皮尔逊相关系数, 极端梯度提升, 轻量级梯度提升机器学习