help-octave
[Top][All Lists]
Advanced

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

Re: Writing a parallel 'for loop'


From: c.
Subject: Re: Writing a parallel 'for loop'
Date: Fri, 1 Aug 2014 07:45:46 +0200

On 1 Aug 2014, at 04:16, Nadeera Gunaratne <address@hidden> wrote:

>       • Call 'ARL_fun(L)' in a parallel loop with given L value
>       • 'ARL_fun(L)' come up with a integer value and store those values in a 
> array.


If your parallelization consists of something like

  for ii = 1 : N
     L =  ....
     array_of_ints = ARL_fun (L);
  endfor

you should have a look at the function "pararrayfun" from package "parallel".
to use it you would rewrite the above code as

   or ii = 1 : N
     L(ii) =  ....
  endfor

  array_of_ints = pararrayfun (number_of_processes, @ARL_fun, L);

look at the documentation of pararrayfun or parcellfun for more info.

HTH,
c.


reply via email to

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