On Shaheen Cray XC40, Math Kernel Libraries (MKL) can be used as an alternative to the default LibSci, the Cray scientific libraries package, containing the BLAS, LAPACK, ScaLAPACK and FFT libraries.
Use MKL with the Intel compilers (PrgEnv-intel) as follows:
> module swap PrgEnv-cray PrgEnv-intel
> module unload cray-libsci
> ftn -o exe code.f -mkl or cc –o exe code.c –mkl
The flag “-mkl” by default will use the threaded libraries as if you choose “-mkl=parallel”. If you need sequential libraries, use “-mkl=sequential” flag and if ScaLAPACK with threaded libraries is needed, use “-mkl=cluster” flag option.
Nevertheless, it is highly advised to get the right sequence of linking depending on your choice on calling the MKL library in your code ( threaded or sequential, statically or dynamically) by using the Intel MKL link line advisor, https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor . This website will help you to have the optimised and correct way to compile it either with Intel combined with an openmp code or other compilers like GNU.
For GNU, you can keep the PrgEnv-gnu module and you will need to load the intel module to get the MKLROOT environment variable if needed.