Bureaucrats, cc_docs_admin, cc_staff
2,918
edits
(Removed the spaces before each line of code (for copy-pasting) and added 2 lines to the R script to get rid of error messages.) |
(replace source tags with File template) |
||
Line 128: | Line 128: | ||
<!--T:32--> | <!--T:32--> | ||
{{File | |||
|name=test.R | |||
|lang="r" | |||
|contents= | |||
#Tell all slaves to return a message identifying themselves. | #Tell all slaves to return a message identifying themselves. | ||
library("Rmpi") | library("Rmpi") | ||
Line 145: | Line 148: | ||
mpi.close.Rslaves() | mpi.close.Rslaves() | ||
mpi.quit() | mpi.quit() | ||
}} | |||
<!--T:33--> | <!--T:33--> | ||
Line 151: | Line 154: | ||
<!--T:34--> | <!--T:34--> | ||
{{File | |||
|name=job.sh | |||
|lang="bash" | |||
|contents= | |||
#!/bin/bash | #!/bin/bash | ||
#SBATCH --account=def- | #SBATCH --account=def-someacct # replace this with your own account | ||
#SBATCH --ntasks=5 # number of MPI processes | #SBATCH --ntasks=5 # number of MPI processes | ||
#SBATCH --mem-per-cpu=2048M # memory; default unit is megabytes | #SBATCH --mem-per-cpu=2048M # memory; default unit is megabytes | ||
Line 161: | Line 167: | ||
export R_LIBS=~/local/R_libs/ | export R_LIBS=~/local/R_libs/ | ||
mpirun -np 1 R CMD BATCH test.R test.txt | mpirun -np 1 R CMD BATCH test.R test.txt | ||
}} | |||
<!--T:35--> | <!--T:35--> |