[论文解读] High-performance sparse matrix-matrix products on Intel KNL and multicore architectures
本文通过解决基于堆和哈希表的算法中的内存分配与线程调度瓶颈,优化了英特尔 KNL 和多核系统上的稀疏矩阵-矩阵乘法(SpGEMM)。结果表明,未排序输出可显著提升性能,基于哈希的 SpGEMM 在大多数真实世界图工作负载中优于 Intel MKL 和 Kokkos-Kernels,尤其在高压缩比下表现更优。
Sparse matrix-matrix multiplication (SpGEMM) is a computational primitive that is widely used in areas ranging from traditional numerical applications to recent big data analysis and machine learning. Although many SpGEMM algorithms have been proposed, hardware specific optimizations for multi- and many-core processors are lacking and a detailed analysis of their performance under various use cases and matrices is not available. We firstly identify and mitigate multiple bottlenecks with memory management and thread scheduling on Intel Xeon Phi (Knights Landing or KNL). Specifically targeting multi- and many-core processors, we develop a hash-table-based algorithm and optimize a heap-based shared-memory SpGEMM algorithm. We examine their performance together with other publicly available codes. Different from the literature, our evaluation also includes use cases that are representative of real graph algorithms, such as multi-source breadth-first search or triangle counting. Our hash-table and heap-based algorithms are showing significant speedups from libraries in the majority of the cases while different algorithms dominate the other scenarios with different matrix size, sparsity, compression factor and operation type. We wrap up in-depth evaluation results and make a recipe to give the best SpGEMM algorithm for target scenario. A critical finding is that hash-table-based SpGEMM gets a significant performance boost if the nonzeros are not required to be sorted within each row of the output matrix.
研究动机与目标
- 识别并解决在多核和英特尔 KNL 架构上 SpGEMM 的性能瓶颈,尤其是内存管理与线程调度方面。
- 评估并优化现代共享内存平台上现有的 SpGEMM 算法——特别是基于堆和哈希表的算法。
- 提供一种基于矩阵特征(如大小、稀疏度、压缩比以及输入/输出是否排序)的实用、数据驱动的 SpGEMM 算法选择方案。
- 将性能评估范围从合成矩阵扩展到真实图工作负载,包括多源 BFS 和三角形计数。
- 证明未排序输出可在多种 SpGEMM 实现中带来显著的性能提升。
提出的方法
- 开发了一种针对英特尔 KNL 优化的基于哈希表的 SpGEMM 算法,减少了内存分配开销,并改善了线程间的负载均衡。
- 通过最小化动态内存分配并针对高线程数环境调优线程调度,优化了基于堆的共享内存 SpGEMM 算法。
- 使用微基准测试分析内存访问模式,并隔离与 KNL 上 MCDRAM 使用相关的性能瓶颈,尤其在不同矩阵密度下的表现。
- 在多种工作负载下,对多个公开的 SpGEMM 实现(包括 Intel MKL 和 Kokkos-Kernels)在真实和合成矩阵上进行了评估。
- 提出了一种基于压缩比和稀疏度的性能方案,针对真实世界数据和合成数据分别给出推荐。
实验结果
研究问题
- RQ1内存分配与线程调度在多核和英特尔 KNL 架构上的 SpGEMM 性能中起到何种影响?
- RQ2在多源 BFS 和三角形计数等真实图工作负载下,基于堆和哈希表的 SpGEMM 算法的性能特征如何?
- RQ3在 KNL 上,MCDRAM 的利用率如何随矩阵密度和 SpGEMM 工作负载特征而变化?
- RQ4在哪些场景下,未排序输出相比排序输出能为 SpGEMM 带来性能优势?
- RQ5用户应依据哪些标准选择最适合特定矩阵类型和硬件平台的最优 SpGEMM 算法?
主要发现
- 基于哈希表的 SpGEMM 算法在大多数真实世界图工作负载中优于 Intel MKL 和 Kokkos-Kernels,尤其在高压缩比下表现更优。
- 基于堆的 SpGEMM 算法在低压缩比输入(如三角形计数中的 L×U 乘法)中占主导地位,尤其当输出未排序时。
- 未排序输出在所有 SpGEMM 实现中均带来显著性能提升,其中基于哈希和基于堆的代码性能增益最大。
- 对于密度较高的矩阵(平均每行非零元素数 >4),MCDRAM 可显著提升性能,此时 SpGEMM 受带宽限制;但对于更稀疏的矩阵,MCDRAM 的收益微乎其微。
- 对于具有均匀稀疏度的合成矩阵,基于哈希的实现几乎在所有配置下占优,而基于堆的方法在极稀疏或均匀分布的数据中表现最佳。
- KNL 上 SpGEMM 的性能对矩阵特征高度敏感:压缩比、稀疏度和非零元素分布模式决定了算法的主导地位,验证了数据感知算法选择策略的必要性。
阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。