Path: news.mathworks.com!not-for-mail
From: "Steven Lord" <slord@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Parfor counts backward?
Date: Wed, 7 Oct 2009 11:54:06 -0400
Organization: The MathWorks, Inc.
Lines: 37
Message-ID: <haidi0$9qa$1@fred.mathworks.com>
References: <haich2$38a$1@fred.mathworks.com>
Reply-To: "Steven Lord" <slord@mathworks.com>
NNTP-Posting-Host: lords.dhcp.mathworks.com
X-Trace: fred.mathworks.com 1254930816 10058 172.31.44.65 (7 Oct 2009 15:53:36 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 7 Oct 2009 15:53:36 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
X-RFC2646: Format=Flowed; Original
Xref: news.mathworks.com comp.soft-sys.matlab:575649



"Yoav" <yoav.farkash@utoronto.ca> wrote in message 
news:haich2$38a$1@fred.mathworks.com...
> Hi,
>
> When using a parfor loop without the matlabpool open it is supposed to 
> default to a regular for loop (see documentation). This works fine but it 
> seems to be counting from the END of the numbering array to the beginning. 
> For example, run the following code without opening a matlab pool:
>
> parfor x = 1:10
>    disp(x);
> end
>
> And instead of seeing 1, 2, 3...10 (as you would with a for loop)  you see 
> 10, 9, 8... 1.
>
> Any idea why it happens this way? It shouldn't matter much for results 
> collection but still a curious behaviour.

http://www.mathworks.com/access/helpdesk/help/toolbox/distcomp/brb2x2l-1.html#brb2x57

You should not depend on the order in which the iterations in your PARFOR 
loop are executed; each iteration of the loop body must be independent of 
the others.

http://www.mathworks.com/access/helpdesk/help/toolbox/distcomp/brb2x2l-1.html#brdew7t-1

I believe this is designed to encourage that, but you shouldn't assume that 
it will always be the case that the loop runs in this particular order.

-- 
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ