开发者

doSMP does not want to start some workers

开发者 https://www.devze.com 2023-04-02 22:06 出处:网络
I use to load the doSMP package in R. However, today, it does not work and I do not understand why... I have tried rmSessions(all=TRUE) several times, but the problem is still there !

I use to load the doSMP package in R.

However, today, it does not work and I do not understand why...

I have tried rmSessions(all=TRUE) several times, but the problem is still there !

Nonetheless, getDoParWorkers() shows that I have not registered a parallel backend...

Do you have a solution for me?

Error message:

> library(doSMP)
Le chargement a nécessité le package : foreach
Le chargement a nécessité le package : iterators
Le chargement a nécessité le package : codetools
foreach: simple, scalable parallel programming from REvolution Computing
Use REvolution R for scalability, fault tolerance and more.
http://www.revolution-computing.com
Le chargement a nécessité le package : revoIPC
> w <- startWorkers(4)
Erreur dans startWorkers(4) : unable to create a task queue: limit exceeded
De plus : Messages d'avis :
1: In startWorkers(4) : there is an existing doSMP session using doSMP开发者_如何学JAVA1
2: In startWorkers(4) : there is an existing doSMP session using doSMP2
3: In startWorkers(4) : there is an existing doSMP session using doSMP3
4: In startWorkers(4) : there is an existing doSMP session using doSMP4
5: In startWorkers(4) : there is an existing doSMP session using doSMP5
6: In startWorkers(4) : there is an existing doSMP session using doSMP6
7: In startWorkers(4) : there is an existing doSMP session using doSMP7
8: In startWorkers(4) : there is an existing doSMP session using doSMP8
9: In startWorkers(4) :
possible leak of worker sessions: consider using FORCE=TRUE
> getDoParWorkers()
[1] 1


The call to rmSessions() could be constructed as :

rmSessions(all.names=TRUE)

(and not all=TRUE), which works perfectly fine on my computer. If that really doesn't work :

w <- startWorkers(4,FORCE=TRUE) 

should get them opened. As explained in the error message by the way. In the odd case the problem is persistent, rebooting Windows is often the only solution. This is also documented.

In any case, you should make sure that you always call stopWorkers(w) whatever happens. This will avoid the problem.

Next to that, if you want to check the DoParWorkers, you first have to register them before they're visible :

> w <- startWorkers(4)
> getDoParWorkers()
[1] 1
> registerDoSMP(w)
> getDoParWorkers()
[1] 4

Please go thoroughly through the documentation again. You really have to comply to it strictly, or you will get funky business going on in your computer. DoSMP can be a vicious bastard if you don't treat it with caution.

http://cran.r-project.org/web/packages/doSMP/doSMP.pdf

http://cran.r-project.org/web/packages/doSMP/vignettes/gettingstartedSMP.pdf

PS : If you tried all of this, and updated to the last versions of R and the packages you use, and it still doesn't work, then please give us a reproducible example (yours can't be reproduced with the correct code) and include all version numbers.


On a sidenote, I stopped using doSMP as it deadlocks my R pretty often. There are other backends to foreach that work better, at least for me. I use snow in combination with the doSnow package for the registerDoSnow() function. In fact, you could as well us snowfall for most parallel things. It's a frontend for snow and works fine for me.

0

精彩评论

暂无评论...
验证码 换一张
取 消