Skip to main content
QUICK REVIEW

[Paper Review] The Linear Algebra Mapping Problem

Christos Psarras, Henrik Barthels|arXiv (Cornell University)|Nov 21, 2019
Parallel Computing and Optimization TechniquesComputer Science38 references7 citations
TL;DR

This paper introduces the Linear Algebra Mapping Problem, identifying the performance gap between high-level linear algebra code and low-level optimized libraries. It evaluates languages like MATLAB, Julia, and NumPy in translating high-level matrix expressions into efficient kernel calls, revealing significant suboptimalities in current compilers and interpreters, and proposes guidelines for better language and library design to close this gap.

ABSTRACT

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.

Motivation & Objective

  • To identify the performance gap between high-level linear algebra abstractions and low-level optimized libraries like BLAS and LAPACK.
  • To investigate how effectively popular high-level languages map high-level matrix expressions to efficient low-level kernels.
  • To evaluate the impact of both general compiler optimizations and linear algebra-specific optimizations on performance.
  • To provide concrete guidelines for improving future languages and libraries in linear algebra computation.

Proposed method

  • The study defines the Linear Algebra Mapping Problem as the challenge of efficiently translating high-level matrix expressions into optimal low-level kernel calls.
  • A benchmark of test problems is designed to assess support for common subexpression elimination, loop-invariant code motion, and matrix-specific optimizations like optimal parenthesization.
  • The benchmark is executed across multiple languages: MATLAB, Octave, Julia, R, Armadillo (C++), Eigen (C++), and NumPy (Python).
  • Performance is measured by comparing execution times against known optimal kernel usage, evaluating both general and linear algebra-specific optimizations.
  • The analysis focuses on how well compilers and interpreters map mathematical notation to efficient numerical kernels, especially for matrices with special properties.

Experimental results

Research questions

  • RQ1How well do high-level languages map matrix expressions to optimal BLAS and LAPACK kernels?
  • RQ2To what extent do current compilers and interpreters exploit common subexpression elimination and loop-invariant code motion in linear algebra code?
  • RQ3How effective are the languages in selecting appropriate kernels for matrices with specific properties?
  • RQ4What are the performance bottlenecks in the translation from high-level syntax to low-level kernels?

Key findings

  • The translation from high-level matrix expressions to low-level kernels is typically vastly suboptimal, leading to significant performance degradation.
  • Even with sophisticated high-level languages, the performance gap between optimal and actual execution remains substantial.
  • Common subexpression elimination and loop-invariant code motion are often not applied effectively in linear algebra contexts.
  • Optimal parenthesization of matrix products and kernel selection based on matrix properties are frequently overlooked by current compilers and interpreters.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.