Skip to content

Instantly share code, notes, and snippets.

@yuhangwang
Last active January 30, 2020 19:53
Show Gist options
  • Save yuhangwang/db05aa774a360258c004ee0b34cdf0dd to your computer and use it in GitHub Desktop.
Save yuhangwang/db05aa774a360258c004ee0b34cdf0dd to your computer and use it in GitHub Desktop.
GNU compiler + Intel MKL & MPI library linking

GNU Fortran compiler

-L${MKLROOT}/lib/intel64 -Wl,--no-as-needed -lmkl_scalapack_lp64 -lmkl_gf_lp64 -lmkl_gnu_thread -lmkl_core -lmkl_blacs_intelmpi_lp64 -lgomp -lpthread -lm -ldl

compiler option: -m64 -I${MKLROOT}/include

GNU C Compiler

-L${MKLROOT}/lib/intel64 -Wl,--no-as-needed -lmkl_scalapack_lp64 -lmkl_intel_lp64 -lmkl_gnu_thread -lmkl_core -lmkl_blacs_intelmpi_lp64 -lgomp -lpthread -lm -ldl

compiler option: -m64 -I${MKLROOT}/include

Notes:

  • Set the INCLUDE, MKLROOT, LD_LIBRARY_PATH, LIBRARY_PATH, CPATH and NLSPATH environment variables in the command shell using one of mklvars script files in the 'bin' subdirectory of the Intel(R) MKL installation directory. Please see also the Intel(R) MKL User Guide.
  • Please be sure that you have used the recommended compiler options for the selected interface layer. Caution: linking Intel(R) MKL libraries with your objects compiled for different interface layer may lead to run-time errors.
  • If you are using a non-default MPI, assign the same appropriate value to MKL_BLACS_MPI on all nodes. Set MKL_BLACS_MPI variable to one of the following values: INTELMPI, MPICH2 or MSMPI.

Intel's GNU compiler wrapper

wrapper GNU Lanuage
mpicc gcc C
mpigxx g++ C/C++
mpif77 f77 Fortran 77
mpif90 gfortran Fortran 95

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment