Skip to content

Instantly share code, notes, and snippets.

@jlehtoma
Last active August 29, 2015 14:13
Show Gist options
  • Save jlehtoma/397474dd2d4773ed120d to your computer and use it in GitHub Desktop.
Save jlehtoma/397474dd2d4773ed120d to your computer and use it in GitHub Desktop.
# Tell all slaves to return a message identifying themselves.
mpi.remote.exec(paste("I am",mpi.comm.rank(),"of",mpi.comm.size()))
mpi.remote.exec(paste(mpi.comm.get.parent()))
# Send execution commands to the slaves
x <- 5
x <- mpi.remote.exec(rnorm, x)
x
mpi.close.Rslaves()
mpi.quit()
#!/bin/bash
#SBATCH -J rmpi_job
#SBATCH -o output.txt
#SBATCH -e errors.txt
#SBATCH -t hh:mm:ss
#SBATCH --nodes=1
#SBATCH --ntasks=12
#SBATCH --mem-per-cpu=200
#
module load R.latest
srun -n 12 Rmpi --no-save < rmpi_script.R
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment