Thread Subject:
Backslash operator inside parfor-loop

Subject: Backslash operator inside parfor-loop

From: Vincent

Date: 24 Jul, 2012 16:27:15

Message: 1 of 2

Hi all,

I need to solve a lot of A\b equations inside a Monte Carlo simulation. So using the parfor-loop seems appropriate. But I'm having some questions on how this is parallellized.

When solving A\b, this is already parallellized by, I guess, the external packages it is using. Changing the number of threads by maxNumCompThreads reveals some (bad) scaling of the operator.

If I now put a parfor loop around it and open a matlabpool, what is happening to matlab and the operator? Will each worker say to the underlying packages it has only processor available and hence solve it serially? Or will their be some conflict that can cost me some performance? I would prefer to solve the systems by just one processor since the MC-simulation will scale better then the matrix decomposition.

I'm currently working on a shared memory quadcore workstation.


thanks,
Vincent

Subject: Backslash operator inside parfor-loop

From: Edric M Ellis

Date: 25 Jul, 2012 07:44:48

Message: 2 of 2

"Vincent " <vincentdegroof@gmail.com> writes:

> I need to solve a lot of A\b equations inside a Monte Carlo
> simulation. So using the parfor-loop seems appropriate. But I'm having
> some questions on how this is parallellized.
>
> When solving A\b, this is already parallellized by, I guess, the
> external packages it is using. Changing the number of threads by
> maxNumCompThreads reveals some (bad) scaling of the operator.
>
> If I now put a parfor loop around it and open a matlabpool, what is
> happening to matlab and the operator?

The MATLAB workers operating on the body of your PARFOR loop are in
'single computational thread' mode. So, if your operation is already
being multithreaded by MATLAB, using PARFOR may actually slow things
down. (It depends on lots of things such as the ratio of the amount of
stuff that you can parallelize using PARFOR vs. the amount of stuff that
MATLAB can multithread).

Cheers,

Edric.

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us