Path: news.mathworks.com!not-for-mail
From: "Doug Hull" <hull@mathworks.SPAMPROOFcom>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Avoiding loops
Date: Wed, 21 Jan 2009 16:41:02 +0000 (UTC)
Organization: The MathWorks Inc
Lines: 29
Message-ID: <gl7j6u$auh$1@fred.mathworks.com>
References: <gkkcva$4ka$1@fred.mathworks.com> <gl2lsh$1cv$1@fred.mathworks.com> <gl4g4c$mmh$1@fred.mathworks.com> <gl4nrp$omn$1@fred.mathworks.com> <gl7ftv$h2k$1@fred.mathworks.com>
Reply-To: "Doug Hull" <hull@mathworks.SPAMPROOFcom>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1232556062 11217 172.30.248.35 (21 Jan 2009 16:41:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 21 Jan 2009 16:41:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 869436
Xref: news.mathworks.com comp.soft-sys.matlab:512966



>  toc
> 
> 22.60 sec.

> %code using parallelization
> 
> Now, i start matlabpool and suply (parfor) by (for)  in the second loop of nx:

> 101.39 sec
> 
> The time is more slower paralelizing it, 
> Please Doug, do you know what I am doing wrong?
> 
> My laptop is a centrino duo ...i.e with two processors.

Jose,

There are several things that can lead to this.

1.) You are parallelizing over the INNER loop.  I would have done it across the outer loop.  You are setting up 1000 jobs of 1000 tasks each.  There is fixed overhead with each job and task.  I would recommend the outer loop, so you have 1 job of 1000 tasks.

2.) Your problem is very small by PCT standards, the fixed overhead may be too much to overcome.

3.) I am not sure how many MATLAB labs are working in your MATLAB pool.

Try changing the structure as specified in the first point, we can see what happens from there.

-Doug