Skip to content
Prev 1410 / 2152 Next

Trying to change OPENBLAS_NUM_THREADS from within R

Dear Simons,

I gave it a quick try, moving the random matrix generation outside the
benchmarked code (i.e. looking at crossprod only).

I have R 2.15.0 on 2 different OSs (one Ubuntu 12.04, one CentOS 5). On
both I don't seem to be able to  change the number of used threads with
the environment variables.

The Ubuntu is stuck to using 2 cores, the CentOS uses 6. So I think
there's more going on here.

here's the code, it can be called rather conveniently with R CMD batch:

qq <- matrix(rnorm(25e6),5e3,5e3)

li<-list()
for(i in 1:12){
   li[[i]] <- matrix(rnorm(25e6),5e3)
}
library (microbenchmark)
system(sprintf('taskset -p 0xffffffff %d', Sys.getpid()))

timing <- microbenchmark(lapply(li,crossprod, qq),times=10)

cat (file = "timings.txt", timing$time, "\n", append = TRUE)

Best,

Claudia

Am 30.06.2012 17:19, schrieb Simon Urbanek: