|
"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.
|