-
Notifications
You must be signed in to change notification settings - Fork 630
Linking to Intel Math Kernel Libraries in Linux and macOS
Go to the site:
https://software.intel.com/en-us/performance-libraries
fill out the personal data form, and from the list of Intel Performance Libraries for Linux download the Intel Math Kernel Library. In a terminal go to your ~/Downloads
directory and unzip the downloaded file (in this case l_mkl_2017.4.239.tgz
):
$ tar -xvf l_mkl_2017.4.239.tgz
then within the ~/Downloads/l_mkl_2017.4.239/
directory execute:
$ ./install_GUI.sh
Which will open the following installation window:
Select "Install as root using sudo" and provide your superuser password. accept Terms and License agreement, and in the next window (options) you should see:
Select the "Customize..." button. Hit "Next" and you will be prompted to the following window:
In this window select the boxes "Cluster support for C/C++" and "Cluster support for Fortran", as shown above. This is a very important step that will give the MPI capability to the library that FDS requires. Hit "Next" and in the following window "Install".
If you are working in Linux, once the installation is complete, go to your ~/.bashrc startup file and add the following lines:
# MKL Environment Variables:
export INTEL_COMPILERS_AND_LIBS=/opt/intel/compilers_and_libraries_2017/linux
source $INTEL_COMPILERS_AND_LIBS/mkl/bin/mklvars.sh intel64
These lines define the environment variables that are used by the Math Kernel Library in your 64 bit system. In particular, the variable MKL_ROOT
is of interest for us, as it is used for the makefile instructions for building FDS.
Don't forget to either source the startup file, log out and log in, or open a new terminal for your environment changes to take place.
Note that I installed a 2017 version of the library. If you installed version 2018, use compilers_and_libraries_2018
in your above defined INTEL_COMPILERS_AND_LIBS
path.
Additions of MPI and MKL environment variables (as you just did in your ~/.bashrc) can alternatively be done by defining Modules. The interested reader is referred to the wiki Modules.
You can go back to instructions on compiling and running FDS with GNU Fortran in Ubuntu Linux here, or Debian here.
In macOS we need to build a custom MKL mpi wrapper. Assuming you have access to the MPI C compiler wrapper mpicc
from your command window (you followed the instructions here), navigate to the following directory:
$cd /opt/intel/compilers_and_libraries_2017/mac/mkl/interfaces/mklmpi/
and type:
$ sudo make libintel64 interface=lp64 MPICC='mpicc'
provide your admin password. This will create a custom wrapper library libmkl_blacs_custom_lp64.a
for your Homebrew installed open-mpi. This library is a parallel version of BLAS (Basic Linear Algebra Subprograms) that employs MPI, and is used, among others, by the MKL sparse cluster solver.
Note that I installed a 2017 version of the library. If you installed version 2018, use compilers_and_libraries_2018
in the above defined directory path. If you are using macOS Catalina you will want to get the latest version of MKL (2020 as of this edit).
Next add the sourcing of MKL environment variables to your ~/.bash_profile
:
# MKL Environment Variables:
export INTEL_COMPILERS_AND_LIBS=/opt/intel/compilers_and_libraries_2017/mac
source $INTEL_COMPILERS_AND_LIBS/mkl/bin/mklvars.sh intel64
Don't forget to source the startup file ~/.bash_profile
. Again, note that if you installed version 2018, use compilers_and_libraries_2018
in your above defined INTEL_COMPILERS_AND_LIBS
path. Same for version 2020 (required by Catalina), compilers_and_libraries_2020
in INTEL_COMPILERS_AND_LIBS
.
You can go back to instructions on compiling and running FDS with GNU Fortran in macOS here.