Sparse matrices are an integral part of scientific simulations. As hardware evolves new sparse matrix storage formats are proposed aiming to exploit optimizations specific to the new hardware. In the era of heterogeneous computing, users often are required to use multiple formats for their applications to remain optimal across the different available hardware, resulting in larger development times and maintenance overhead. A potential solution to this problem is the use of a lightweight auto-tuner driven by Machine Learning (ML) that would select for the user an optimal format from a pool of available formats that will match the characteristics of the sparsity pattern, target hardware and operation to execute. In this paper, we introduce Morpheus-Oracle, a library that provides a lightweight ML auto-tuner capable of accurately predicting the optimal format across multiple backends, targeting the major HPC architectures aiming to eliminate any format selection input by the end-user. From more than 2000 real-life matrices, we achieve an average classification accuracy and balanced accuracy of 92.63% and 80.22% respectively across the available systems. The adoption of the auto-tuner results in average speedup of 1.1x on CPUs and 1.5x to 8x on NVIDIA and AMD GPUs, with maximum speedups reaching up to 7x and 1000x respectively.
翻译:稀疏矩阵是科学模拟中的核心组成部分。随着硬件发展,新的稀疏矩阵存储格式不断被提出,旨在利用特定于新硬件的优化技术。在异构计算时代,用户往往需要针对不同硬件使用多种格式以保持最优性能,这导致开发时间与维护成本显著增加。解决该问题的一种潜在方案是采用轻量级机器学习驱动的自动调优器,该调优器能够根据稀疏模式特征、目标硬件及待执行操作,自动从可用格式池中为用户选择最优格式。本文提出Morpheus-Oracle库,其提供一种轻量级机器学习自动调优器,能够跨多个后端准确预测最优格式,瞄准主要HPC架构,旨在消除终端用户对格式选择的任何干预。基于超过2000个真实矩阵,我们在所有可用系统上分别实现了92.63%的平均分类准确率与80.22%的平衡准确率。该自动调优器的采用在CPU上带来平均1.1倍的加速,在NVIDIA和AMD GPU上实现1.5倍至8倍的加速,且最大加速比分别可达7倍与1000倍。