doSMP不想启动一些工人

时间:2022-06-11 13:50:30

I use to load the doSMP package in R.

我用来在R中加载doSMP包。

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 !

我曾多次尝试过rmSessions(all = TRUE),但问题仍然存在!

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

尽管如此,getDoParWorkers()表明我没有注册并行后端...

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 doSMP1
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

1 个解决方案

#1


1  

The call to rmSessions() could be constructed as :

对rmSessions()的调用可以构造为:

rmSessions(all.names=TRUE)

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

(而不是全部= TRUE),在我的电脑上工作得很好。如果那真的不起作用:

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.

应该让他们打开。正如错误信息中所解释的那样。在奇怪的情况下问题是持久的,重启Windows通常是唯一的解决方案。这也有记载。

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

在任何情况下,你应该确保你总是调用stopWorkers(w)无论发生什么。这样可以避免这个问题。

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

接下来,如果要检查DoParWorkers,首先必须在可见之前注册它们:

> 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.

请再次仔细阅读文档。你必须严格遵守它,否则你将在你的计算机上进行时髦的生意。如果你不小心对待它,DoSMP可能是一个恶毒的混蛋。

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

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

http://cran.r-project.org/web/packages/doSMP/vignettes/gettingstartedSMP.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.

PS:如果您尝试了所有这些,并更新到R的最新版本和您使用的软件包,但仍然无效,那么请给我们一个可重现的示例(您的代码无法使用正确的代码重现)并包括所有版本号。


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.

在旁注中,我停止使用doSMP,因为它经常使我的R陷入僵局。还有其他后端可以更好地工作,至少对我而言。我将snow和doSnow包一起用于registerDoSnow()函数。事实上,对于大多数平行的东西,你也可以降雪。它是雪的前端,对我来说很好。

#1


1  

The call to rmSessions() could be constructed as :

对rmSessions()的调用可以构造为:

rmSessions(all.names=TRUE)

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

(而不是全部= TRUE),在我的电脑上工作得很好。如果那真的不起作用:

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.

应该让他们打开。正如错误信息中所解释的那样。在奇怪的情况下问题是持久的,重启Windows通常是唯一的解决方案。这也有记载。

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

在任何情况下,你应该确保你总是调用stopWorkers(w)无论发生什么。这样可以避免这个问题。

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

接下来,如果要检查DoParWorkers,首先必须在可见之前注册它们:

> 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.

请再次仔细阅读文档。你必须严格遵守它,否则你将在你的计算机上进行时髦的生意。如果你不小心对待它,DoSMP可能是一个恶毒的混蛋。

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

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

http://cran.r-project.org/web/packages/doSMP/vignettes/gettingstartedSMP.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.

PS:如果您尝试了所有这些,并更新到R的最新版本和您使用的软件包,但仍然无效,那么请给我们一个可重现的示例(您的代码无法使用正确的代码重现)并包括所有版本号。


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.

在旁注中,我停止使用doSMP,因为它经常使我的R陷入僵局。还有其他后端可以更好地工作,至少对我而言。我将snow和doSnow包一起用于registerDoSnow()函数。事实上,对于大多数平行的东西,你也可以降雪。它是雪的前端,对我来说很好。