[R-sig-hpc] MPI clusters for dummies

Seija Sirkiä seija.sirkia at csc.fi
Fri Feb 26 16:03:09 CET 2016


Hi all,

I guess I'm missing something really obvious here, but that's how it is, and I need help (and you've helped me before!) :)

I have a tiny test script like this:

##################
library(doMPI,quietly = TRUE)
cl<-startMPIcluster()
registerDoMPI(cl)

system.time(a<-foreach(i=1:4) %do% system.time(sort(runif(1e8))))
a
system.time(a<-foreach(i=1:4) %dopar% system.time(sort(runif(1e8))))
a
##################

I send it to SLURM using a script that asks for 4 cores and ends with
srun R --slave --no-save -f foreachtest.R

This works, both in the sense that I get no errors and in the sense that it clearly actually does the thing in parallel, judging by the time used.

Now suppose I want to do the same with, say, clusterApply from parallel/snow instead, what should I do? I won't flood you with all the ways I've attempted this and the ways they've failed, just that it's makeMPIcluster or getMPIcluster or something like that, right? But for the life of me I can't make it work.

Thank you in advance!

BR,
Seija S.



More information about the R-sig-hpc mailing list