1. Overview

There are several versions of BLAS (Basic Linear Algebra Subprograms) and LAPACK (Linear Algebra PACKage) numerical libraries installed on the facility. Currently installed are;

  • Intel’s Maths Kernel Library (MKL)
  • AMD’s Core Maths Library (ACML)
  • Automatically Tuned Linear Algebra Software (ATLAS)

These libraries are all optimised to run on the available hardware.

2. Setting the module environment

The various numerical libraries are available via the module command. Loading a specific module will set the appropriate environmental variables, e.g. $LD_LIBRARY_PATH, and makes available the appropriate runtime libraries for your chosen compiler and bit environments. To load a specific library, e.g. MKL:

$ module load mkl

For more information about using modules please see the modules and the user environment page.

3. Compiler Flags

To simplify linking to the various versions of the numerical libraries, loading the modules as described above will also set up customised environmental variables, $N8HPC_LINALG_FFLAGS for use with Fortran and$N8HPC_LINALG_CFLAGS for C. For the multi-threaded versions of the libraries use $N8HPC_LINALG_MT_FFLAGSfor Fortran and $N8HPC_LINALG_MT_CFLAGS for C.

3.1. Fortran

For instance, to compile a simple Fortran program, named matmul.f90 for example, with the MKL library, first load the module:

$ module load mkl

and to compile the code, with the default Intel compiler use:

$ ifort -o matmul matmul.f90 $N8HPC_LINALG_FFLAGS

To switch to the GNU compiler and a different version of the libraries, e.g. ATLAS:

$ module switch intel gnu
$ module switch mkl atlas

To compile and link to the libraries use:

$ gfortran -o matmul matmul.f90 $N8HPC_LINALG_FFLAGS

 

3.2. C

To compile a simple C program, named matmul.c for example with the MKL library, first load the module:

module load mkl

and to compile the code, with the default Intel compiler use:

icc -o matmul matmul.c $N8HPC_LINALG_CFLAGS

To switch to the GNU compiler and a different version of the libraries, e.g. ATLAS:

$ module switch intel gnu
$ module switch mkl atlas

To compile and link to the libraries use:

$ gcc -o matmul matmul.f90 $N8HPC_LINALG_CFLAGS

 

4. ACML and GNU compilers

Please note that the module acml/5.2.0 will not work with the gnu/native compiler module. This is because that version of ACML was built against a later version of the GNU compiler suite and is incompatible due to requiring a later version of the runtime libraries. Attempts to use this combination of modules will result in errors similar to:

undefined reference to `_gfortran_transfer_integer_write@GFORTRAN_1.4'
undefined reference to `_gfortran_transfer_real_write@GFORTRAN_1.4'
undefined reference to `_gfortran_transfer_character_write@GFORTRAN_1.4'