一种以FLOPs作为线性代数算法判别指标的测试方法
A Test for FLOPs as a Discriminant for Linear Algebra Algorithms
AI总结:
本研究针对FLOPs作为线性代数算法性能判别指标可能失效的问题,提出迭代测试排序的方法,验证FLOPs最小的算法是否对应最优性能,识别异常案例以辅助性能差异根因分析。
摘要:
线性代数表达式在无数科学计算中发挥着核心作用,通常通过调用一系列现有基础库(如BLAS和LAPACK提供的库)来完成计算。这一调用序列对应一种计算策略,即一种算法,通常针对同一个线性代数表达式存在多种可选算法。这些算法虽然在数学上等价,但性能可能存在显著差异。Julia、Armadillo、Linnea等多种面向矩阵计算的高级语言和工具,都通过最小化浮点运算次数(FLOPs)来进行算法选择。然而,可能存在多种FLOPs数量相同(或几乎相同)的算法;在很多情况下,这些算法的执行时间在统计上无显著差异,可任意选择其中一种作为最优算法。但也完全可能出现执行时间差异显著的情况(尽管FLOPs计数几乎相同),甚至最小化FLOPs的算法未必是执行时间最短的算法。本研究提出了一套方法,用于测试FLOPs作为线性代数算法判别指标的可靠性。该方法以(针对某一线性代数表达式实例的)一组算法为输入,将它们按性能等级排序,即允许多个算法共享同一排名。为此,我们迭代测量这些算法的性能,直到排名的变化收敛到接近零的值。如果所有FLOPs最少的算法都被归入最优排名,则FLOPs对该实例是有效的判别指标;否则该实例被视为异常案例,可用于探究性能差异的根本原因。
英文摘要:
Linear algebra expressions, which play a central role in countless scientific computations, are often computed via a sequence of calls to existing libraries of building blocks (such as those provided by BLAS and LAPACK). A sequence identifies a computing strategy, i.e., an algorithm, and normally for one linear algebra expression many alternative algorithms exist. Although mathematically equivalent, those algorithms might exhibit significant differences in terms of performance. Several high-level languages and tools for matrix computations such as Julia, Armadillo, Linnea, etc., make algorithmic choices by minimizing the number of Floating Point Operations (FLOPs). However, there can be several algorithms that share the same (or have nearly identical) number of FLOPs; in many cases, these algorithms exhibit execution times which are statistically equivalent and one could arbitrarily select one of them as the best algorithm. It is however not unlikely to find cases where the execution times are significantly different from one another (despite the FLOP count being almost the same). It is also possible that the algorithm that minimizes FLOPs is not the one that minimizes execution time. In this work, we develop a methodology to test the reliability of FLOPs as discriminant for linear algebra algorithms. Given a set of algorithms (for an instance of a linear algebra expression) as input, the methodology ranks them into performance classes; i.e., multiple algorithms are allowed to share the same rank. To this end, we measure the algorithms iteratively until the changes in the ranks converge to a value close to zero. FLOPs are a valid discriminant for an instance if all the algorithms with minimum FLOPs are assigned the best rank; otherwise, the instance is regarded as an anomaly, which can then be used in the investigation of the root cause of performance differences.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。