Intel® Math Kernel Library (Intel® MKL) and Modulefiles

Published: 11/08/2019  

Last Updated: 11/08/2019

By Viraj Malia

Modulefiles[1] are commonly used utilities to set up the environment on Linux and Unix based platforms and HPC clusters running such operating systems. Intel® Math Kernel Library (Intel® MKL) provides modulefiles starting with the Intel® MKL 2020 release.

The Intel® MKL modulefiles can configure Intel® MKL for IA-32 and Intel® 64 architectures on Linux* and MacOS* operating systems. Modulefiles are an alternative to shell scripts to set up the build/run environment. They provide fast switching and avoid cluttering of the environment.

Note: Ensure “module” package is installed and ready to be used on your system. Installation of module package is beyond the scope of this article.

To use modulefiles included in the MKL package, tell your module[2] utility where they are:
        $module use /path/to/<mkl_directory>/bin

You can check if your modules are available to use by using the command
        $module avail

If you choose to use Intel® MKL for IA-32, you can load the specific module and all the necessary environment variables will be set up automatically.
        $module load mkl-32

For Intel® MKL Intel® 64 architecture:
        $module load mkl

Note: All existing variables will retain their original values and new values will be prepended to the following variables: LD_LIBRARY_PATH, LIBRARY_PATH, CPATH, PKG_CONFIG_PATH, NLSPATH, TBBROOT. Since MKLROOT should contain only one path, its original value will be replaced with a new value.

Unloading the module will reset the modified environment variables to their original values and new variables that were created will be undefined. MKLROOT will be undefined on module unload.
        $module unload mkl

Based on your preference, Intel® MKL environment scripts can be used instead of modulefiles to set up Intel® MKL environment.

[1] https://linux.die.net/man/4/modulefile
[2] https://linux.die.net/man/1/module
 

Product and Performance Information

1

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.