Last active
August 29, 2015 14:21
-
-
Save sachsmc/83598f4f6269d5f952f5 to your computer and use it in GitHub Desktop.
MPI Apply on Biowulf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# navigate to directory | |
cd Simulation | |
# Get OpenMPI in our PATH. openmpi_ipath and openmpi_ib | |
module load R | |
# module load openmpi/1.4.4/gnu/eth loaded above so not needed anymore | |
`which mpirun` -n 1 -machinefile $PBS_NODEFILE R --vanilla >Run1.out<<EOF | |
# begin R code | |
library(Rmpi) | |
# load stuff if necessary | |
# source("mysims.R") | |
mpi.spawn.Rslaves(nslaves=$np) | |
onerun<-function(number){ | |
set.seed(number+14) | |
# do something | |
boots <- rnorm(100) | |
# return something | |
return(boots) | |
} | |
results <- Rmpi::mpi.applyLB(1:1000, onerun) | |
finishedout <- do.call(rbind, results) | |
write.csv(finishedout, "Run.csv", row.names=FALSE) | |
mpi.close.Rslaves() | |
mpi.quit() | |
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
qsub -v np=52 -l walltime=424:00:00, nodes=26 simRun.bat |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
np should be 2 times the number of nodes, because the default nodes each have 2 processors.