Simple parallization with R

Example Script

library(parallel)

cl = makeCluster(detectCores())

wait <- function(i){
    Sys.sleep(1)
    invisible(NULL)
}

# this should take 10 seconds
system.time(lapply(1:10, wait))

# this should take less time depending on the number of cores you have
system.time(parLapply(cl, 1:10, wait))

# when you're all done
stopCluster(cl)

On Janus

library(parallel)

# you need to specify the same number of total cores here as the job script
nodes = 100
ppn = 12
ncores = nodes * ppn

cl <- makeCluster(ncores,type="MPI")
# call a parallel operation
stopCluster(cl)
mpi.quit()