fix sample means example

master
Garrett Mills 5 years ago
parent 9a406e001e
commit adc762ec13

@ -7,6 +7,7 @@ nodes = mpi.universe.size()
mpi.spawn.Rslaves(nslaves=nodes)
generate_plot <- function(filename){
print(mpi.comm.rank())
samples = rep(NA, 100000)
for ( i in 1:100000 ){ samples[i] = mean(rexp(40, 0.2)) }
@ -20,7 +21,7 @@ generate_plot <- function(filename){
samples = 1:number_of_plots
mpi.apply(samples, generate_plot)
mpi.applyLB(samples, generate_plot)
mpi.close.Rslaves()
mpi.quit()

@ -0,0 +1,5 @@
#!/bin/bash
mkdir plots/
mpiexec --allow-run-as-root -n 1 --hostfile /kube-openmpi/generated/hostfile R --vanilla -f generate_plots.R > mpi.out

@ -1,9 +1,8 @@
#!/bin/bash
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
#SLURM --ntasks=5
cd $SLURM_SUBMIT_DIR
mkdir plots/
R --vanilla -f generate_plots.R --args "plot$SLURM_ARRAY_TASK_ID"
mpiexec -n 1 R --vanilla -f generate_plots.R

Loading…
Cancel
Save