fix sample means example
This commit is contained in:
parent
e741c8de64
commit
9a406e001e
1
cluster
Submodule
1
cluster
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit d556690348d9667689247704c8a2ddc20e35e632
|
0
demos/sample_means/cluster-master.664+1.729.log
Normal file
0
demos/sample_means/cluster-master.664+1.729.log
Normal file
1
demos/sample_means/cluster-master.665+1.734.log
Normal file
1
demos/sample_means/cluster-master.665+1.734.log
Normal file
@ -0,0 +1 @@
|
|||||||
|
Host: cluster-master Rank(ID): 1 of Size: 2 on comm 1
|
1
demos/sample_means/cluster-master.666+1.717.log
Normal file
1
demos/sample_means/cluster-master.666+1.717.log
Normal file
@ -0,0 +1 @@
|
|||||||
|
Host: cluster-master Rank(ID): 1 of Size: 2 on comm 1
|
1
demos/sample_means/cluster-master.669+1.714.log
Normal file
1
demos/sample_means/cluster-master.669+1.714.log
Normal file
@ -0,0 +1 @@
|
|||||||
|
Host: cluster-master Rank(ID): 1 of Size: 2 on comm 1
|
0
demos/sample_means/cluster-master.677+1.738.log
Normal file
0
demos/sample_means/cluster-master.677+1.738.log
Normal file
1
demos/sample_means/cluster-master.888+1.898.log
Normal file
1
demos/sample_means/cluster-master.888+1.898.log
Normal file
@ -0,0 +1 @@
|
|||||||
|
Host: cluster-master Rank(ID): 1 of Size: 2 on comm 1
|
@ -1,11 +1,26 @@
|
|||||||
arg = commandArgs(TRUE)
|
if ( !is.loaded("mpi_initialize") ){
|
||||||
|
library(Rmpi)
|
||||||
|
}
|
||||||
|
|
||||||
|
number_of_plots = 5
|
||||||
|
nodes = mpi.universe.size()
|
||||||
|
mpi.spawn.Rslaves(nslaves=nodes)
|
||||||
|
|
||||||
|
generate_plot <- function(filename){
|
||||||
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)) }
|
||||||
|
|
||||||
jpeg(paste('plots/', arg, '.jpg', sep=""))
|
jpeg(paste('plots/', filename, '.jpg', sep=""))
|
||||||
|
|
||||||
hist(samples, main="", prob=T)
|
hist(samples, main="", prob=T)
|
||||||
lines(density(samples), col="darkblue", lwd=3)
|
lines(density(samples), col="darkblue", lwd=3)
|
||||||
|
|
||||||
dev.off()
|
dev.off()
|
||||||
|
}
|
||||||
|
|
||||||
|
samples = 1:number_of_plots
|
||||||
|
|
||||||
|
mpi.apply(samples, generate_plot)
|
||||||
|
|
||||||
|
mpi.close.Rslaves()
|
||||||
|
mpi.quit()
|
||||||
|
Loading…
Reference in New Issue
Block a user