ArticleslgStudy

computer science

Automatically Tuned Linear Algebra Software

Automatically Tuned Linear Algebra Software is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Automatically Tuned Linear Algebra Software rather than just read about it. In short: Automatically Tuned Linear Algebra Software (ATLAS) is a software library for linear algebra. It provides a mature open source implementation of BLAS APIs for C and FORTRAN 77.

Key takeaways

  • Automatically Tuned Linear Algebra Software belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Automatically Tuned Linear Algebra Software to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Automatically Tuned Linear Algebra Software from memory before moving on to harder problems.

Reference excerpt

Automatically Tuned Linear Algebra Software (ATLAS) is a software library for linear algebra. It provides a mature open source implementation of BLAS APIs for C and FORTRAN 77. ATLAS is often recommended as a way to automatically generate an optimized BLAS library. While its performance often trails that of specialized libraries written for one specific hardware platform, it is often the first or even only optimized BLAS implementation available on new systems and is a large improvement over the generic BLAS available at Netlib. For this reason, ATLAS is sometimes used as a performance baseline for comparison with other products. ATLAS runs on most Unix-like operating systems and on Microsoft Windows (using Cygwin). It is released under a BSD-style license without advertising clause, and many well-known mathematics applications including MATLAB, Mathematica, Scilab, SageMath, and some builds of GNU Octave may use it.

Functionality ATLAS provides a full implementation of the BLAS APIs as well as some additional functions from LAPACK, a higher-level library built on top of BLAS. In BLAS, functionality is divided into three groups called levels 1, 2 and 3.

Level 1 contains vector operations of the form 𝐲←α𝐱+𝐲 as well as scalar dot products and vector norms, among other things. Level 2 contains matrix-vector operations of the form 𝐲←αA𝐱+β𝐲 as well as solving T𝐱=𝐲 for 𝐱 with T being triangular, among other things. Level 3 contains matrix-matrix operations such as the widely used General Matrix Multiply (GEMM) operation C←αAB+βC as well as solving B←αT−1B for triangular matrices T, among other things.

Optimization approach The optimization approach is called Automated Empirical Optimization of Software (AEOS), which identifies four fundamental approaches to computer assisted optimization of which ATLAS employs three:

Parameterization—searching over the parameter space of a function, used for blocking factor, cache edge, etc. Multiple implementation—searching through various approaches to implementing the same function, e.g., for SSE support before intrinsics made them available in C code Code generation—programs that write programs incorporating what knowledge they can about what will produce the best performance for the system Optimization of the level 1 BLAS uses parameterization and multiple implementation Every ATLAS level 1 BLAS function has its own kernel. Since it would be difficult to maintain thousands of cases in ATLAS there is little architecture specific optimization for Level 1 BLAS. Instead multiple implementation is relied upon to allow for compiler optimization to produce high performance implementation for the system. Optimization of the level 2 BLAS uses parameterization and multiple implementation With N2 data and N2 operations to perform the function is usually limited by bandwidth to memory, and thus there is not much opportunity for optimization All routines in the ATLAS level 2 BLAS are built from two Level 2 BLAS kernels: GEMV—matrix by vector multiply update: 𝐲←αA𝐱+β𝐲 GER—general rank 1 update from an outer product: A←α𝐱𝐲T+A Optimization of the level 3 BLAS uses code generation and the other two techniques Since we have N3 ops with only N2 data, there are many opportunities for optimization

Level 3 BLAS Most of the Level 3 BLAS is derived from GEMM, so that is the primary focus of the optimization.

O(n3) operations vs. O(n2) data The intuition that the n3 operations will dominate over the n2 data accesses only works for roughly square matrices. The real measure should be some kind of surface area to volume. The difference becomes important for very non-square matrices.

Can it afford to copy? Copying the inputs allows the data to be arranged in a way that provides optimal access for the kernel functions, but this comes at the cost of allocating temporary space, and an extra read and write of the inputs. So the first question GEMM faces is, can it afford to copy the inputs? If so,

Put into block major format with good alignment Take advantage of user contributed kernels and cleanup Handle the transpose cases with the copy: make everything into TN (transpose - no-transpose) Deal with α in the copy If not,

Use the nocopy version Make no assumptions on the stride of matrix A and B in memory Handle all transpose cases explicitly No guarantee about alignment of data Support α specific code Run the risk of TLB issues, bad strides, etc. The actual decision is made through a simple heuristic which checks for "skinny cases".

Cache edge For 2nd Level Cache blocking a single cache edge parameter is used. The high level choose an order to traverse the blocks: ijk, jik, ikj, jki, kij, kji. These need not be the same order as the product is done within a block. Typically chosen orders are ijk or jik. For jik the ideal situation would be to copy A and the NB wide panel of B. For ijk swap the role of A and B. Choosing the bigger of M or N for the outer loop reduces the footprint of the copy. But for large K ATLAS does not even allocate such a large amount of memory. Instead it defines a parameter, Kp, to give best use of the L2 cache. Panels are limited to Kp in length. It first tries to allocate (in the jik case) M⋅p+NB⋅Kp+NB⋅NB. If that fails it tries 2⋅Kp⋅NB+NB⋅NB. (If that fails it uses the no-copy version of GEMM, but this case is unlikely for reasonable choices of cache edge.) Kp is a function of cache edge and NB.

LAPACK When integrating the ATLAS BLAS with LAPACK an important consideration is the choice of blocking factor for LAPACK. If the ATLAS blocking factor is small enough the blocking factor of LAPACK could be set to match that of ATLAS. To take advantage of recursive factorization, ATLAS provides replacement routines for some LAPACK routines. These simply overwrite the corresponding LAPACK routines from Netlib.

Need for installation Installing ATLAS on a particular platform is a challenging process which is typically done by a system vendor or a local expert and made available to a wider audience. For many systems, architectural default parameters are available; these are essentially saved searches plus the results of hand tuning. If the arch defaults work they will likely get 10–15% better performance than the install search. On such systems the installation process is greatly simplified.

See also List of open-source mathematical libraries

References

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Automatically Tuned Linear Algebra Software

Start with the simplest possible case. Write down what Automatically Tuned Linear Algebra Software claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Automatically Tuned Linear Algebra Software before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Automatically Tuned Linear Algebra Software ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Automatically Tuned Linear Algebra Software

In research
Automatically Tuned Linear Algebra Software appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Automatically Tuned Linear Algebra Software in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Automatically Tuned Linear Algebra Software is common in secondary-school and first-year university syllabi. It links to neighbouring topics C (programming language) libraries, Fortran libraries, Numerical linear algebra, so understanding it makes those chapters shorter.
In everyday life
Look for Automatically Tuned Linear Algebra Software outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Automatically Tuned Linear Algebra Software” →

How to study Automatically Tuned Linear Algebra Software in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Automatically Tuned Linear Algebra Software means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Automatically Tuned Linear Algebra Software out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Automatically Tuned Linear Algebra Software in simple terms?

Automatically Tuned Linear Algebra Software (ATLAS) is a software library for linear algebra. It provides a mature open source implementation of BLAS APIs for C and FORTRAN 77.

Why does Automatically Tuned Linear Algebra Software matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Automatically Tuned Linear Algebra Software?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Automatically Tuned Linear Algebra Software.

Tags

  • C (programming language) libraries
  • Fortran libraries
  • Numerical linear algebra
  • Numerical software
  • Software using the BSD license

Keep exploring