help-octave
[Top][All Lists]
Advanced

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

Re: cellfun and parcellfun


From: Jaroslav Hajek
Subject: Re: cellfun and parcellfun
Date: Thu, 10 Jun 2010 21:08:57 +0200

On Thu, Jun 10, 2010 at 7:24 PM, Robert Patterson <address@hidden> wrote:
> Hi,
>
> I am writing some Monte Carlo simulation code.  The problem can be
> broken down via domain decomposition (several different sub-problems
> that only need to communicate occasionally).  I am implementing this
> decomposition via cellfun, in order to avoid writing explicit loops.  I
> hope to parallelise with parcellfun from the general package on
> octaveforge.
>
> Assuming I can reseed the random number generator with the same values
> each time I run a calculation:
>
> 1. Will I get the same random number at each point in my code when using
> cellfun as I would with a simple loop, or is the order at least stable
> on any one implementation?
>

Yes. Cellfun evaluates sequentially upwards, just like a loop.

> 2. Is it safe to use parcellfun with the built in random number
> generator?
>

Yes. parcellfun is not based on threads, but on process cloning
(fork). Using any function is therefore safe. However, all cloned
process will experience the same sequence of random numbers. The
easiest way to avoid this is to generate all number beforehand or
generate a seed for each input. Eventually, I could create a more
general approach to solve this.

-- 
RNDr. Jaroslav Hajek, PhD
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz



reply via email to

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