sfInit() snowfall package in R hangs on Windows 7

305 views Asked by At

I have been trying to follow some guides for utilizing all (4) of my processors on my work machine running Windows 7. They all suggest the snowfall() package. However when I run the following code, R runs until I terminate it. In other words, R hangs.

sfInit(parallel = TRUE, cpus = 4)

same result with

sfInit(parallel = TRUE, cpus = 2)

and again with

sfInit(parallel = TRUE)

for the curious, my Sys.info()

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

and...

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
1

There are 1 answers

0
Liz Young On BEST ANSWER

while not directly using snowfall, I was able to achieve my desired results by running the following

library(doParallel)
win7 <- makeCluster(4) 
registerDoParallel(win7)
#... rest of code to run in parallel ...
#... using doParallel specific syntax