Pergunta

I run (k)Ubuntu 12.04.2 and R 3.0.1

I wrote a bunch of code that used to run in parallel, but now it no longer does. Not even this runs in parallel any more:

library(doMC)
registerDoMC(4)
Results = foreach (i = 1:1e6, .combine = "c") %dopar% {
  sqrt(i)
}

And that definitely should. What I think broke it is either the R 3.0.1 update or a -dev, -devel BLAS package I installed. (openBLAS I think)

I've tried system(sprintf("taskset -p 0xffffffff %d", Sys.getpid())) as suggested elsewhere, and get this result:

pid 2415's current affinity mask: 1
pid 2415's new affinity mask: f

I've also tried running R with:

taskset 0xffff R

However after either of these steps running the loop still only uses one core.

I want parallel processing back! How can I get it?

Foi útil?

Solução

I found the solution! Ironically, to get parallel processing back I had to do both of the steps I mentioned in the Q at the same time

So, start R with

taskset 0xffff R

Then run

system(sprintf("taskset -p 0xffffffff %d", Sys.getpid()))

Within R.

Voila, parallel processing returns

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top