arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 1911.09421cs.MScs.PL
收藏

线性代数映射问题。线性代数语言和库的现状

The Linear Algebra Mapping Problem. Current state of linear algebra languages and libraries

Christos Psarras, Henrik Barthels, Paolo Bientinesi

摘要:

我们观察到线性代数库的开发人员和最终用户之间的脱节。一方面,数值线性代数和高性能社区在高度复杂的数值内核和库的开发和优化方面投入了大量精力,旨在最大限度地利用输入矩阵的属性和目标计算平台的架构特征。另一方面,最终用户越来越不可能通过用C或Fortran编写代码来直接使用所述库的易出错和耗时的过程;相反,诸如Matlab、Julia、Eigen和Armadillo等提供更高抽象级别的语言和库变得越来越流行。用户有机会使用与数学描述非常相似的语法来编码矩阵计算;然后由编译器或解释器在内部将输入程序映射到较低级别的内核,如BLAS和LAPACK等库所提供的。不幸的是,我们的经验表明,就性能而言,这种转换通常是非常次优的。在本文中,我们首先介绍了线性代数映射问题,然后研究如何有效地测试问题的基准是由流行的高级程序设计语言解决。具体来说,我们考虑Matlab,Octave,Julia,R,Armadillo(C++),Eigen(C++)和NumPy(Python);基准测试旨在测试标准编译器优化,如公共子表达式消除和循环不变代码运动,以及线性代数特定的优化,如矩阵乘积的最佳括号化和具有属性的矩阵的内核选择。本研究的目的是为支持线性代数计算的语言和库的开发提供具体的指导方针。

英文摘要:

We observe a disconnect between the developers and the end users of linear algebra libraries. On the one hand, the numerical linear algebra and the high-performance communities invest significant effort in the development and optimization of highly sophisticated numerical kernels and libraries, aiming at the maximum exploitation of both the properties of the input matrices, and the architectural features of the target computing platform. On the other hand, end users are progressively less likely to go through the error-prone and time consuming process of directly using said libraries by writing their code in C or Fortran; instead, languages and libraries such as Matlab, Julia, Eigen and Armadillo, which offer a higher level of abstraction, are becoming more and more popular. Users are given the opportunity to code matrix computations with a syntax that closely resembles the mathematical description; it is then a compiler or an interpreter that internally maps the input program to lower level kernels, as provided by libraries such as BLAS and LAPACK. Unfortunately, our experience suggests that in terms of performance, this translation is typically vastly suboptimal. In this paper, we first introduce the Linear Algebra Mapping Problem, and then investigate how effectively a benchmark of test problems is solved by popular high-level programming languages. Specifically, we consider Matlab, Octave, Julia, R, Armadillo (C++), Eigen (C++), and NumPy (Python); the benchmark is meant to test both standard compiler optimizations such as common subexpression elimination and loop-invariant code motion, as well as linear algebra specific optimizations such as optimal parenthesization of a matrix product and kernel selection for matrices with properties. The aim of this study is to give concrete guidelines for the development of languages and libraries that support linear algebra computations.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑