Differences

This shows you the differences between two versions of the page.

Link to this comparison view

habrok:advanced_job_management:blas_threads [2026/02/27 14:54] – created fokkehabrok:advanced_job_management:blas_threads [2026/02/27 15:01] (current) fokke
Line 1: Line 1:
 ====== Controlling the number of threads for OpenBLAS and Intel MKL ====== ====== Controlling the number of threads for OpenBLAS and Intel MKL ======
  
 +The number of threads for the OpenBLAS and Intel MKL numerical libraries is set to 1 on loading their module. 
 +This to prevent their parallelization to interfere with the parallelization the code using these libraries.
  
 +It can for example happen that both R and the OpenBLAS library used by R fire up threads for parallelizing the work. This can lead to using many more program threads than the number of CPU cores allocated to your job. Since this only increases the overhead and does not lead to any gain it must be prevented.
 +
 +We therefore set the environment variable ''OPENBLAS_NUM_THREADS'' or ''MKL_NUM_THREADS'' to 1 when loading the ''OpenBLAS'' or ''imkl'' module respectively. If you do want to make use of the parallelization of these libraries you should set the environment variable in your job script to a different value **after** having loaded the 
 +module.
 +
 +Note that the ''OpenBLAS'' module is a dependency in the ''gfbf'' and ''foss'' toolchains used by many applications.
 +
 +The ''imkl'' module is a dependency for the ''intel'' toolchain and the software built with that.