Single R script on multiple nodes

问题内容:

I would like to utilize CPU cores from multiple nodes to execute a single R script. Each node contains 16 cores.

So far my code looks like the following:

ncores <- 16

List_1 <- list(...)
List_2 <- list(...)

cl <- makeCluster(ncores)
registerDoParallel(cl)
getDoParWorkers()

foreach(L_1=List_1) %:% 
foreach(L_2=List_2) %dopar% {
...
}

stopCluster(cl)

I execute it via the following command in a UNIX shell:

mpirun -np 1 R --no-save < file_path_R_script.R > another_file_path.Rout

That works fine on a single node. However, I have not figured out whether it is sufficient to increase ncores to 32 once I have access to a second node. Does R include the additional 16 cores on the other node automatically? Or do I have to make use of another R package?

问题评论:

    
You can tell mpirun to consider other hosts. It is part of your local MPI setup.

原文地址:

https://stackoverflow.com/questions/47757035/single-r-script-on-multiple-nodes

添加评论

友情链接:蝴蝶教程