How to use doMC under Windows or alternative implementation of parallel processing for glmnet?

I work on Win7 OS with R 3.3.1 in Rstudio. The intention is to use glmnet with parallel processing. From the help ?glmnet :

parallel : If TRUE , use parallel foreach for each fold. Must register in parallel before hand, for example doMC or others. See the example below.

From the above example:

 # Parallel require(doMC) registerDoMC(cores=4) 

install.packages('doMC') package return is not available. Manual CRAN verification gives UNIX downloadable code, but Windows binaries are not available.

Can I use doMC as code under my Win7 operating system or what is a useful alternative?

+5
source share
1 answer

As written in vignette before doMC

The doMC package acts as the interface between foreach and the multi-core functionality of the parallel package, originally written by Simon Urbanek and included in parallel for R2.14.0. multi-core functionality currently only works with operating systems that support the fork system call (which means that Windows is not supported)

Instead, you can use the snow package and the SOCK cluster. (thanks @HongOoi for the hint that loading doSNOW is not really required.)

 library(doParallel) #the following line will create a local 4-node snow cluster workers=makeCluster(4,type="SOCK") registerDoParallel(workers) foreach(i=1:4) %dopar% Sys.getpid() 
+8
source

Source: https://habr.com/ru/post/1259287/


All Articles