Recent site activity

Getting started‎ > ‎

Using numerical libraries

Blas/Lapack

On any platform, vendor provided numerical libraries should be used. Other factor to consider in selecting Blas/Lapack is the compilers.

When a toolchain file is used, the proper links to Blas/Lapack should be provided in the toolchain file. For example, JaguarGNU.cmake contains

set(ACML_HOME /opt/acml/4.3.0/gfortran64)
set(ACML_LIBRARIES ${ACML_HOME}/lib/libacml.a ${ACML_HOME}/lib/libacml_mv.a)
link_libraries(${ACML_LIBRARIES})


CMake/FindLAPACK.cmake is the responsible module and tries to figure out what to use. QMCPACK uses only serial Blas/Lapack and one should set the number of threads that control numerical libraries to one or link the serial libraries. Note that some libraries still require a link to a fortran library.

Environment variables on LINUX to guide cmake

  • MKL to set all the libraries as recommended by on-line tool .

    • Intel compilers on x86_64 platform
MKL="-LMKLPATH -lmkl_intel_lp64 -lmkl_sequential -lmkl_core"

It is important to select sequential MKL library.
    • GNU compiler on x86_64,
MKL="-L$MKLPATH -Wl,--start-group -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -Wl,--end-group -lpthread"

    • GNU compiler on ia32,
MKL="-L$MKLPATH -lmkl_intel -lmkl_sequential -lmkl_core -lpthread"
  • MKL_HOME to set the MKL top directory and let cmake select the proper libraries
This was the primary method to set MKL libraries but with recent changes (and more changes to come with upgrades), the automatic detection is rather unreliable.

  • LAPACK to use the system-provided Blas/Lapack. For example, on x86_64,
LAPACK="-L/usr/lib64 -llapack -lblas"

LAPACK can be set to ACML specific links or ATLAS links. Consult the documentation for these libraries.

To be absolutely sure to use serial MKL routines for the runs, set these environments in your login or batch script.


MKL_NUM_THREADS=1

MKL_DOMAIN_NUM_THREADS=MKL_ALL=1
MKL_DYNAMIC=FALSE
MKL_SERIAL=YES


Environment variables on Mac OS

  • If nothing is set, the native library is used. Recommended when using GNU compilers.
  • Using MKL with Intel compilers on ia32 (same as LINUX on ia32)
MKL="-L$MKLPATH -lmkl_intel -lmkl_sequential -lmkl_core -lpthread"

On AIX or with IBM XL compilers

Always use toolchain files and link ESSL, Lapack (some Lapack functions are missing in ESSL) by hand. Examples include

config/LOP6_xlC_xlc.cmake
config/LOP6_xlC_gnu.cmake
config/BluePrintXL.cmake
On huygens.sara.nl, following links are used

set(XLF_LIBS -L/opt/ibmcmp/xlf/12.1/lib64 -lxlf90_r)
link_libraries(-L/sara/sw/lapack/3.1.1/lib -llapack -lessl -lmassvp6_64 -lmass_64 ${XLF_LIBS})