Linking Scientific Libraries

1.  AMD Core Math Library - ACML

The AMD Core Math Library provides a free set of thoroughly optimized and threaded math routines for HPC, scientific, engineering and related compute-intensive applications. ACML consists of the following main components:

  • A full implementation of Level 1, 2 and 3 Basic Linear Algebra Subroutines (BLAS), with key routines optimized for high performance on AMD Opteron processors.
  • A full suite of Linear Algebra (LAPACK) routines. As well as taking advantage of the highly-tuned BLAS kernels, a key set of LAPACK routines has been further optimized to achieve considerably higher performance than standard LAPACK implementations.
  • A comprehensive suite of Fast Fourier Transforms (FFTs) in both single-, double-, single-complex and double-complex data types.
  • Fast scalar, vector, and array math transcendental library routines optimized for high performance on AMD Opteron processors.
  • Random Number Generators in both single- and double-precision.

For further details and in-depth user documentation please check here.

The ACML is provided with an interface for Intel, GNU and PGI compilers. The use of this library is recommended for running on the AMD equipped machines (essentialy blade and smp queues). To link the ACML to your code you have to first load the module that matches your compiler, e.g.:

$ module load acml/gnu

This will create the environment variable ACML_LIB, which contains the path to both static and dynamic versions of the library. This variable can be used in your makefiles and compiling scripts or directly at command line. To link the ACML dynamically you should type something like

$ ifort mysource.f90 -L$ACML_LIB -lacml -o myexe

If you need to link also the ACML Vector Math functions type something like

$ ifort mysource.f90 -L$ACML_LIB -lacml -lacml_mv -o myexe

To link the library statically you should type something like

$ pgcc mysource.c $ACML_LIB/libacml.a -o myexe

IMPORTANT! If you linked the ACML dynamically remember to load the corresponding module at run time in order to provide the path to the library.

1.1  Multi-threaded ACML

The ACML library is available also with multithreading support. The modules that provide access to this versions are labeled with the -mp suffix, e.g.:

$ module load acml/intel-mp

To link the ACML dynamically with the multithreading support you should type something like

$ ifort mysource.f90 -L$ACML_LIB -lacml_mp -o myexe

2.  Intel Math Kernel Library - MKL

Intel® Math Kernel Library (Intel® MKL) is a library of highly optimized, extensively threaded math routines for science, engineering, and financial applications that require maximum performance. Core math functions include BLAS, LAPACK, ScaLAPACK, Sparse Solvers, Fast Fourier Transforms, Vector Math, and more. For further details please check here.

The MKL is provided with an interface for Intel and GNU compilers. You are strongly recommended to use it when running on Intel equipped nodes (zebra) and for notoriously unstable codes (e.g. cp2k) even on AMD equipped machines.

To link the MKL you should load the appropriate module

$ module load mkl

which will create the MKL_LIB environment variable that will contain the exact path to the library. To link the MKL to your code dynamically and without thread support you should type something like

$ ifort mysource.f90 -L$MKL_LIB -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -o myexe

This combination should fit most users. Other options are described in the following sections.

To link the MKL statically you should instead type something like

IMPORTANT! If you linked the MKL dynamically remember to load the corresponding module at run time in order to provide the path to the library.

2.1  GNU compilers + MKL

2.2  Multi-threaded MKL

3.  BLACS and ScaLAPack

4.  FFTW v. 2 and v. 3

FFTW is a C subroutine library for computing the discrete Fourier transform (DFT) in one or more dimensions, of arbitrary input size, and of both real and complex data (as well as of even/odd data, i.e. the discrete cosine/sine transforms or DCT/DST). For further details and in-depth user documentation please check here.

The FFTW is provided in two main versions, (v. 2 is provided for compatibility), both with an interface for Intel, GNU and PGI compilers. To link the FFTW to your code you have to first load the module that matches the version you want and your compiler, e.g.:

$ module load fftw3/intel

This will create the environment variables FFTW_INC and FFTW_LIB, which contain the path to both static and dynamic versions of the library and its include-files. These variables can be used in your makefiles and compiling scripts or directly at command line. To link the FFTW dynamically you should type something like

$ gfortran mysource.f90 -I$FFTW_INC -L$FFTW_LIB -lfftw3 -o myexe

To link it statically you should type something like

$ pgcc mysource.c $-I$FFTW_INC $FFTW_LIB/libfftw3.a -o myexe

IMPORTANT! If you linked the FFTW dynamically remember to load the corresponding module at run time in order to provide the path to the library.

A special single precision version of the FFTW3 library is also provided, the appropriate module is called fftw3/3.2-sp. To link this library you should type something like

icc mysource.c $-I$FFTW_INC $FFTW_LIB/libfftw3f.a -o myexe@

NOTE: The single precision library is available only for the Intel compilers

5.  HDF5