1

我一直在尝试遵循一些指南,以便在运行 Windows 7 的工作机器上使用我的所有 (4) 个处理器。它们都建议使用 snowfall() 包。但是,当我运行以下代码时,R 会一直运行,直到我终止它。换句话说,R 挂起。

sfInit(parallel = TRUE, cpus = 4)

结果相同

sfInit(parallel = TRUE, cpus = 2)

并再次与

sfInit(parallel = TRUE)

对于好奇,我的 Sys.info()

                 sysname                      release                      version                     nodename 
               "Windows"                          "7" "build 7601, Service Pack 1"                 "<REDACTED>" 
                 machine                        login                         user               effective_user 
                   "x86"                  "<REDACTED>"                  "<REDACTED>"                  "<REDACTED>" 

和...

sessionInfo()
R version 3.2.0 (2015-04-16)
Platform: i386-w64-mingw32/i386 (32-bit)
Running under: Windows 7 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] parallel  stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] actuar_1.1-8       fitdistrplus_1.0-4 MASS_7.3-40        doParallel_1.0.8   doSNOW_1.0.12     
[6] iterators_1.0.7    foreach_1.4.2      snowfall_1.84-6    snow_0.3-13       

loaded via a namespace (and not attached):
[1] compiler_3.2.0   tools_3.2.0      survival_2.38-1  splines_3.2.0    codetools_0.2-11
4

1 回答 1

0

虽然不直接使用降雪,但我能够通过运行以下命令来达到我想要的结果

library(doParallel)
win7 <- makeCluster(4) 
registerDoParallel(win7)
#... rest of code to run in parallel ...
#... using doParallel specific syntax 
于 2015-06-17T15:10:17.630 回答