[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: data structure for simulation

From: Michael Creel
Subject: Re: data structure for simulation
Date: Wed, 18 Mar 2009 05:55:16 -0700 (PDT)

Francesco Potorti`-2 wrote:
>>> Maybe struct arrays are not the best data structure for this purpose?
>>Maybe. Maybe if you gave more detailed question...
> The general problem is that I am trying to find a good and simple way to
> use a cluster for Montecarlo simulation.  Ideally, I'd like to do that
> from inside Octave, without resorting to an external program like a bash
> script.
> -- 
> Francesco Potortì (ricercatore)        Voice: +39 050 315 3058 (op.2111)
> ISTI - Area della ricerca CNR          Fax:   +39 050 315 2040
> via G. Moruzzi 1, I-56124 Pisa         Email: address@hidden
> (entrance 20, 1st floor, room C71)     Web:
> _______________________________________________
> Help-octave mailing list
> address@hidden

Maybe I can help with that. I have a function of the form
# montecarlo.m: generates a specified number of replications of a function's
output and
# writes them to a user-specified output file.
# USAGE: montecarlo(f, f_args, reps, outfile, nslaves, n_pooled,  n_returns,
# IMPORTANT: f should return a row vector of output from feval(f,f_args)
# For normal evaluation on one machine, only the first 4 arguments are
# * Arg 1: (required) the function that generates a row vector of output
# * Arg 2: (required) the arguments of the function, in a cell
# * Arg 3: (required) the number of replications to generate
# * Arg 4: (required) the output file name
# * Arg 5: (optional) number of compute nodes for parallel runs
# * Arg 6 (optional) number of replications to be pooled together before
they are sent
# back to the master node.
# * Arg 7 (optional) the number of columns of the output returned by f. When
f is very costly
# to evaluate, use this to get a parallel run started immediately. Otherwise
single run must
# be finished before the size is determined. This is bad, since many nodes
will be idle.
# * Arg 8 (optional) verbose: 1 for on, 0 for off
# * Arg 9 (optional) 0/1 switch controlling debug mode, off by default.

This will Monte Carlo any function that takes arguments as a cell, and
writes output as a row vector. I think that in most cases a wrapper can be
written to satisfy this requirement. To do this in parallel, you must have
MPITB installed. I can provide more details if you're interested.


View this message in context:
Sent from the Octave - General mailing list archive at

reply via email to

[Prev in Thread] Current Thread [Next in Thread]