Hello all,
Attached are two files, montecarlo.m and mc_example.m that implement
parallel Monte Carlo simulation of a user defined function. The function
just needs to return a row vector, and montecarlo.m will stack the
replications into a matrix. This implementation is basic and illustrative.
At
http://pareto.uab.es/mcreel/Econometrics/MyOctaveFiles/Econometrics/MonteCarlo/and
http://pareto.uab.es/mcreel/Econometrics/Examples/Parallel/montecarlo/ there
is a more sophisticated version that uses MPITB.

The basic version is susceptible to the crash of a node, and will not
balance the load between nodes of different speed. To implement that,
MPI_Iprobe would be needed.

To use it, doe something like

mich...@tuolumne:~/Desktop/openmpi_ext/src$ mpirun -np 2 octave -q --eval
mc_example
Sending block to 0
I have sent  4
I have sent  15
I have sent  2
   1.00000   0.96457   1.23784
   1.00000   1.20805   1.19109
   1.00000   1.21014   1.15861
   1.00000   0.93194   0.83522
   1.00000   0.73157   1.36160
   0.00000   1.07361   0.96141
   0.00000   1.32715   1.06895
   0.00000   0.73529   0.94909
   0.00000   1.24376   1.02082
   0.00000   1.05802   1.20701
mich...@tuolumne:~/Desktop/openmpi_ext/src$


In that, the first column is the MPI rank of the node that generated the
rest of the row, which is the output of the function that is being
simulated..

Cheers, Michael

Attachment: mc_example.m
Description: Binary data

Attachment: montecarlo.m
Description: Binary data

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Octave-dev mailing list
Octave-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to