OpenMP

Howto - OpenMP and/or Intel MKL

This is not a whyto/howto parallelisation. There are many reasons to do this. Instead, just a quick guide is given here to running such calculations on getfix. Both the GNU-based compilers and the Intel compiler are able to handle the OpenMP protocol if it is included in your source code.

gnu compiler, OpenMP, and LAPACK/BLAS

For the gnu compiler (gcc, g++, gfortran) the basic -fopenmp option will enable any OpenMP commands in your source code.

The system GNU compiled LAPACK and BLAS (-llapack -lblas) are not parallelised.

Intel compiler, OpenMP, and LAPACK/BLAS via Intel MKL

For the Intel compiler (icc, ifort)

  the basic -openmp command will enable any OpenMP commands in your source code.

The Intel MKL compiled LAPACK and BLAS require special commands at compile time:
@@

   -Wl,--start-group -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -Wl,--end-group
@@ which explicitly links to the single-processor version of the intel MKL.

To link to the multi-core Intel MKL do:
@@

   -Wl,--start-group -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -Wl,--end-group -openmp -lpthread
@@

These commands change from compiler version to version.

  The best way to work out the options for the Intel compiler are to use the
  [[https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/|
  https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/]]

Example multicore/OpenMP/Intel MKL script

Slurm openmp example needed.

Note that you are able to separately control the number of threads that OpenMP and the Intel MKL will spawn.

Page last modified on January 17, 2021, at 08:16 PM
Powered by PmWiki