Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Avoiding loops
Date: Wed, 21 Jan 2009 17:07:01 +0000 (UTC)
Organization: Univ of Newcastle upon Tyne
Lines: 39
Message-ID: <gl7knl$rn1$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> <gl7j6u$auh$1@fred.mathworks.com>
Reply-To: <HIDDEN>
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 1232557621 28385 172.30.248.35 (21 Jan 2009 17:07:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 21 Jan 2009 17:07:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1511480
Xref: news.mathworks.com comp.soft-sys.matlab:512979


"Doug Hull" <hull@mathworks.SPAMPROOFcom> wrote in message <gl7j6u$auh$1@fred.mathworks.com>...
> 
> >  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

Hello Doug, You right, now we improved a lot respect to the inner loop...
time=21.39, but still not so big diiferences wit my code without paralelization:
time=22.83.
As you say, my problem is very small for using PCT, 
then, i will try to approach in other way to solve my  montecarlo integration
of a more efficient form.
Thanks a lot for your help Doug,
Jose.