简体   繁体   English

使用SNOW的R 2.11 Windows 64位中的并行处理不太有效

[英]Parallel processing in R 2.11 Windows 64-bit using SNOW not quite working

I'm running R 2.11 64-bit on a WinXP64 machine with 8 processors. 我在具有8个处理器的WinXP64机器上运行R 2.11 64位。 With R 2.10.1 the following code spawned 6 R processes for parallel processing: 使用R 2.10.1,以下代码产生了6个并行处理的R进程:


require(foreach)
require(doSNOW)
cl = makeCluster(6, type='SOCK')
registerDoSNOW(cl)
bl2 = foreach(i=icount(length(unqmrno))) %dopar% {
    (Some code here)
}
stopCluster(cl)

When I run the same code in R 2.11 Win64, the 6 R processes are not spawning, and the code hangs. 当我在R 2.11 Win64中运行相同的代码时,6 R进程不会产生,代码会挂起。 I'm wondering if this is a problem with the port of SNOW to 2.11-64bit, or if any additional code is required on my part. 我想知道这是否是SNOW端口到2.11-64bit的问题,或者我是否需要任何额外的代码。 Thanks 谢谢

BTW, this works just fine on my multicore machine at home running Ubuntu Karmic 64-bit and R 2.11. 顺便说一下,这在家用运行Ubuntu Karmic 64位和R 2.11的多核机器上运行得很好。 Unfortunately I have to work on Win64 at work 不幸的是,我必须在工作中使用Win64

The code seems to be working here. 代码似乎在这里工作。

R version 2.11.0 (2010-04-22) 
x86_64-pc-mingw32 
other attached packages:
[1] doSNOW_1.0.3    snow_0.3-3      foreach_1.3.0   codetools_0.2-2
[5] iterators_1.0.3
loaded via a namespace (and not attached):
[1] tools_2.11.0

Check your sessionInfo() to make sure your versions match mine. 检查您的sessionInfo()以确保您的版本与我的匹配。 One thing I noted is that on my Windows 7 machine the first attempt to makeCluster made a request for a firewall exception. 我注意到的一件事是,在我的Windows 7机器上,第一次尝试使用makeCluster请求防火墙例外。 If you did not explicitly make allowances for the socket communication that could be why it is hanging. 如果你没有明确地允许套接字通信,这可能是它挂起的原因。 The defaults it opened (ugly as it is) was all TCP and UDP ports when operating under the private profile. 它打开的默认值(丑陋)是在私有配置文件下运行时的所有TCP和UDP端口。

It is an old question, but I encountered the same problems with R-2.13.1 64 on Win 64 bits. 这是一个老问题,但我在Win 64位上遇到了与R-2.13.1 64相同的问题。

doSNOW was working fine with R 32-bits but not with R 64-bits, and was hanging at "cl = makeCluster(6, type='SOCK')" as well. DoSNOW在R 32位时运行良好,但在R 64位时运行不正常,并且还挂在“​​cl = makeCluster(6,type ='SOCK')”。

To resolve the problem I eventually added "C:\\Program Files\\R\\R-2.13.1\\bin\\x64" to the %PATH% environment variable (win+pause/advanced system settings/advanced/environment variables/system variables). 为了解决这个问题,我最终将“C:\\ Program Files \\ R \\ R-2.13.1 \\ bin \\ x64”添加到%PATH%环境变量(win + pause / advanced系统设置/高级/环境变量/系统变量) 。 Make also sure to allow the R connections in Windows Firewall, and that C:\\Program Files\\R\\R-2.13.1\\bin contains copy of the 32-bits version of R.exe and Rscript.exe (not the x64 ones). 确保在Windows防火墙中允许R连接,并且C:\\ Program Files \\ R \\ R-2.13.1 \\ bin包含32位版本的R.exe和Rscript.exe(不是x64版本)的副本)。

After doing this, when running makeCluster() 12 processes are started, 6 32 bits and 6 64 bits, but during the calculations only the 64 bits one are used. 执行此操作后,当运行makeCluster()时,启动12个进程,6个32位和6个64位,但在计算过程中仅使用64位。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM