blas_atlas


Introduction:

BLAS_ATLAS describes the way that a version of the Basic Linear
Algebra Subprograms (BLAS) can be accessed from the ATLAS library.

The ATLAS library includes versions of the BLAS that have been
“automatically tuned” for best performance on the given computer system.
Thus, using the BLAS in the ATLAS library may result in significantly
faster linear algebra performance than would be observed by simply
compiling and linking to a source code copy of the BLAS.

The BLAS are organized into Level 1 (vector-vector),
Level 2 (matrix-vector) and Level 3 (matrix-matrix) operations. The BLAS
carry out many useful linear algebra tasks, include vector norms,
matrix-vector and matrix-matrix multiplication. ATLAS reorganizes the
the BLAS functions to be optimized for a particular computer, so that
they have superior performance across a wide range of parameter values.

Using ATLAS, the BLAS routines can be accessed by C, C++ or FORTRAN
calling programs. Depending on the language used, there are different
requirements to successfully call the BLAS functions.

For C and C++ programs, there are two options:

  • the “F2C interface” requires the user to declare each ATLAS function
    as an external, to append an underscore to the function name,
    and to call every argument by reference, like so:

    dgemm_ ( &transa_char, &transb_char, &m, &n, &k, &alpha, a, &lda, b,
    &ldb, &beta, c, &ldc );

  • the “C interface” requires the user to prepend the string
    cblas_ to the name of every function, inserts an additional
    initial argument that specifies whether matrix storage is row major
    or column major, and allows scalar input arguments to be passed by value:

    cblas_dgemm ( CblasColMajor, transa, transb, m, n, k, alpha, a, lda, b,
    ldb, beta, c, ldc );

For FORTRAN calling programs, the interface is the same as calling a
compiled FORTRAN version of the BLAS. For example:

call dgemm ( transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc )

where transa and transb are characters, m, n, k, lda, ldb, and ldc are
integers, alpha and beta are double precision scalars, and a, b, and c
are double precision two-dimensional arrays.

Web site:

Reference:

  1. Charles Lawson, Richard Hanson, David Kincaid, Fred Krogh,
    Algorithm 539:
    Basic Linear Algebra Subprograms for Fortran Usage,
    ACM Transactions on Mathematical Software,
    Volume 5, Number 3, September 1979, pages 308-323.
  2. Jack Dongarra, Jeremey Du Croz, Sven Hammarling, Richard Hanson,
    An extended set of FORTRAN Basic Linear Algebra Subprograms,
    ACM Transactions on Mathematical Software,
    Volume 14, Number 1, March 1988, pages 1-17.
  3. Jack Dongarra, Jeremey Du Croz, Iain Duff, Sven Hammarling,
    A set of Level 3 Basic Linear Algebra Subprograms,
    ACM Transactions on Mathematical Software,
    Volume 16, Number 1, March 1990, pages 1-17.
  4. Clint Whaley, Jack Dongarra,
    Automatically Tuned Linear Algebra Software,
    LAPACK Working Note 131.

Usage:

On any ARC cluster, check the installation details
by typing “module spider atlas”.

ATLAS requires that several modules be loaded before it can be run.
A sample set of commands for NewRiver might be:

      module purge
      module load gcc/6.1.0
      module load atlas/3.11.36
    

Examples:

Here is an example batch script which uses a FORTRAN program which
calls BLAS routines within the ATLAS library:

#! /bin/bash
#
#PBS -l walltime=00:05:00
#PBS -l nodes=1:ppn=1
#PBS -W group_list=newriver
#PBS -q open_q
#PBS -j oe
#
cd $PBS_O_WORKDIR
#
module purge
module load gcc/6.1.0
module load atlas/3.11.36
#
gfortran -c blas_test.f90

gfortran -o blas_atlas_test blas_test.o -L$ATLAS_LIB -llapack -lptf77blas -ltatlas -lgfortran -lm

./blas_atlas_test

A complete set of files to carry out a similar example calculation are
available in
blas_atlas_example.tar