How can I use BLAS/LAPACK routines?

For the Intel compiler, you can also use the Intel MKL (Math Kernel Library). The user documentation to this can most easily be found by loading the intel module:

module load intel/20.4

then issue "which ifort", which gives you the path to the compiler, for instance for the compiler /sw/comp/intel/Compiler/compilerpro-, the documentation can be found in /sw/comp/intel/Compiler/compilerpro-

The version of the mkl to link to depends on whether you want the sequential version, or the threaded version. For MPI programs you should typically use the sequential version if the program performs multiple calls to the blas/lapack routines. You must also know what size of integers your program uses. If you do not give special compiler options, your program will normally use 32 bit integers, 64 bit longs, and 64 bit pointers. This is termed lp64, and you should for a sequential version of mkl link your program with:

ifort -o test.x test.f90 -lmkl_intel_lp64 -lmkl_sequential -lmkl_core

and for a threaded mkl link with

ifort -o test.x test.f90 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread
Last modified: 2021-06-10