[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Octave: Parallelizing a for-loop in Octave.
From: |
Carlo De Falco |
Subject: |
Re: Octave: Parallelizing a for-loop in Octave. |
Date: |
Thu, 1 Oct 2015 19:29:45 +0000 |
On 1 Oct 2015, at 14:22, Constantine Frangos <address@hidden> wrote:
>
> Hi all,
>
> I am using Octave 3.8 on an intel quad-core cpu running ubuntu linux.
>
> In Matlab, there is a construct for parallelizing a single for-loop
> as follows:
>
> function test_parallel;
> ...............
> N = 1000;
> results_vec = zeros(1,N);
>
> parfor i1 = 1:N
> %Some computations producing y.
> results_vec(i1) = y;
> end;
> .............
> %end of function.
>
> How can the above construct be implemented in Octave (in order
> to run on a quad-core cpu) ?
>
> Thanks.
> Regards,
> Constantine.
the "parfor" construct also exists in Octave but it is only there for
compatibility,
the code will be actually be executed serially.
You can obtain behaviour similar to "parfor" using "parcellfun" from the
"parallel" package.
c.