3.6.1.1 Modifying the Number of Threads for MKL on Linux

You can change the number of threads to be used by MKL by editing the system environment variable MKL_NUM_THREADS. For example, the following statement in the Bash shell, causes MKL to use 3 threads:

export MKL_NUM_THREADS=3

After setting MKL_NUM_THREADS to 3, the output of Sys.BlasLapack shows a value of 3 for $nthreads.

R> Sys.BlasLapack()
     $vendor
     [1] "Intel Math Kernel Library (Intel MKL)"
     $nthreads
     [1] 3