Skip to main content

4.10) Numerical Libraries: Linking To BLAS/LAPACK


When compiling code that makes use of BLAS/LAPACK routines, you need to include the appropriate link lines so that the linker can successfully locate the libraries. Unfortunately, these link lines can be somewhat complicated. To simplify using these libraries ARC2 has some customised environment variables, that are automatically set to the appropriate link options. The value of these variables depends on the particular module loaded.

The variables are:

  • $ARC_LINALG_FFLAGS for use with Fortran code
  • $ARC_LINALG_CFLAGS for use with C/C++

For instance to link a Fortran program, with any of the numerical library modules loaded:

$ ifort -o matmul –O2 –xAVX matmul.f90 $ARC_LINALG_FFLAGS

It is worth noting that Intel provide a link line advisor for their MKL library, and it is located at http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor.