FLOPs作为稠密线性代数算法的判别式
FLOPs as a Discriminant for Dense Linear Algebra Algorithms
摘要:
涉及矩阵和向量的表达式(称为线性代数表达式)通常通过一系列调用BLAS和LAPACK等库中提供的高度优化的内核进行评估。一个核序列代表一个算法,一般来说,由于结合性、代数恒等式和多个核,一个表达式可以通过许多不同的算法来计算。这些算法在数学上都是等价的(即,在精确的算术中,它们都计算相同的结果),但在执行时间方面往往有明显的不同。当面临决策时,高级语言、库和工具(如Julia、Armadillo和Linnea)会选择最小化FLOP计数的算法。在本文中,我们测试的有效性的FLOP计数作为一个判别密集的线性代数算法,分析“异常”:问题的情况下,最快的算法不执行最少的FLOP。为此,我们专注于相对简单的表达式,并分析异常发生的时间和原因。我们发现,异常存在,并倾向于集群成大的连续区域。一方面,表情异常是罕见的,而另一方面,它们是丰富的。我们的结论是,FLOPs是不是一个足够可靠的判别式,即使在建立高度优化的内核的算法。另外,即使过滤掉内核间缓存的影响,大多数异常仍然存在。我们推测,结合FLOP计数与内核性能模型将显着提高我们的能力,选择最佳的算法。
英文摘要:
Expressions that involve matrices and vectors, known as linear algebra expressions, are commonly evaluated through a sequence of invocations to highly optimised kernels provided in libraries such as BLAS and LAPACK. A sequence of kernels represents an algorithm, and in general, because of associativity, algebraic identities, and multiple kernels, one expression can be evaluated via many different algorithms. These algorithms are all mathematically equivalent (i.e., in exact arithmetic, they all compute the same result), but often differ noticeably in terms of execution time. When faced with a decision, high-level languages, libraries, and tools such as Julia, Armadillo, and Linnea choose by selecting the algorithm that minimises the FLOP count. In this paper, we test the validity of the FLOP count as a discriminant for dense linear algebra algorithms, analysing "anomalies": problem instances for which the fastest algorithm does not perform the least number of FLOPs. To do so, we focused on relatively simple expressions and analysed when and why anomalies occurred. We found that anomalies exist and tend to cluster into large contiguous regions. For one expression anomalies were rare, whereas for the other they were abundant. We conclude that FLOPs is not a sufficiently dependable discriminant even when building algorithms with highly optimised kernels. Plus, most of the anomalies remained as such even after filtering out the inter-kernel cache effects. We conjecture that combining FLOP counts with kernel performance models will significantly improve our ability to choose optimal algorithms.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。