fix sample means example
This commit is contained in:
parent
9a406e001e
commit
adc762ec13
@ -7,6 +7,7 @@ nodes = mpi.universe.size()
|
|||||||
mpi.spawn.Rslaves(nslaves=nodes)
|
mpi.spawn.Rslaves(nslaves=nodes)
|
||||||
|
|
||||||
generate_plot <- function(filename){
|
generate_plot <- function(filename){
|
||||||
|
print(mpi.comm.rank())
|
||||||
samples = rep(NA, 100000)
|
samples = rep(NA, 100000)
|
||||||
for ( i in 1:100000 ){ samples[i] = mean(rexp(40, 0.2)) }
|
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
|
samples = 1:number_of_plots
|
||||||
|
|
||||||
mpi.apply(samples, generate_plot)
|
mpi.applyLB(samples, generate_plot)
|
||||||
|
|
||||||
mpi.close.Rslaves()
|
mpi.close.Rslaves()
|
||||||
mpi.quit()
|
mpi.quit()
|
||||||
|
5
demos/sample_means/mpi_generate_plots.sh
Normal file
5
demos/sample_means/mpi_generate_plots.sh
Normal file
@ -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
|
0
demos/sample_means/plots/.gitkeep
Normal file
0
demos/sample_means/plots/.gitkeep
Normal file
@ -1,9 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#SBATCH --nodes=1
|
#SLURM --ntasks=5
|
||||||
#SBATCH --ntasks-per-node=1
|
|
||||||
|
|
||||||
cd $SLURM_SUBMIT_DIR
|
cd $SLURM_SUBMIT_DIR
|
||||||
|
|
||||||
mkdir plots/
|
mkdir plots/
|
||||||
|
|
||||||
R --vanilla -f generate_plots.R --args "plot$SLURM_ARRAY_TASK_ID"
|
mpiexec -n 1 R --vanilla -f generate_plots.R
|
||||||
|
Loading…
Reference in New Issue
Block a user