BLAS control on R
$ export GOTO_NUM_THREADS=1 # The default is the number of the cores.
$ R -q
> library(RhpcBLASctl)
> A<-matrix(runif(3e3^2),3e3,3e3)
> blas_get_num_procs()
[1] 1
> system.time(A%*%A)
user system elapsed
3.992 0.012 4.003
> blas_set_num_threads(4)
> system.time(A%*%A)
user system elapsed
4.332 0.048 1.234
When it uses the MAX core of default, WARMUP(default of GotoBLAS) adjusts OMP_NUM_THREADS of OpenMP to one.
This package is usable in OpenMP based BLAS(Exclude on Windows), ACML, MKL and GotoBLAS.
blasctl_0.1.tar.gz
- Source package
blasctl_0.1.zip
- Windows Binary package
changed package name from blasctl to RhpcBLASctl on CRAN.