Thread Subject: Multithreading not working?

Subject: Multithreading not working?

From: David Doria

Date: 27 May, 2008 18:21:02

Message: 1 of 4

I just installed matlab 2008a and noticed under "general"
properties "automatic multithreading" is enabled. I have
some code with some "embarrassingly parallel" for loops that
takes hours to run. I ran the code with this option enabled
and there was no activity on more than 1 processor, infact
the one processor is only at 20%. Why would it not use the
other processors?

Thanks

Dave

Subject: Multithreading not working?

From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)

Date: 27 May, 2008 19:06:11

Message: 2 of 4

In article <g1hjee$k00$1@fred.mathworks.com>,
David Doria <daviddoria@gmail.com> wrote:
>I just installed matlab 2008a and noticed under "general"
>properties "automatic multithreading" is enabled. I have
>some code with some "embarrassingly parallel" for loops that
>takes hours to run. I ran the code with this option enabled
>and there was no activity on more than 1 processor, infact
>the one processor is only at 20%. Why would it not use the
>other processors?

The BLAS routines are multithreaded. If you do not happen to
be doing something like \ or (e.g.) singular value decomposition,
then whether Matlab will end up using the BLAS routines or not
will depend on its success in figuring out that a given
expression is can be fully or partially rewritten in terms to
calls to BLAS routines -- and dependant upon Matlab figuring out
that making such a call is worthwhile (there is considerable
overhead to starting multithreading.)


--
   So you found your solution
   What will be your last contribution?
   -- Supertramp (Fool's Overture)

Subject: Multithreading not working?

From: David Doria

Date: 27 May, 2008 19:20:03

Message: 3 of 4

Correction to original post - one cpu is at 100%, i was
reading the monitoring wrong, sorry.

Oh, I thought this would act like openMP does in c++, just
starting threads to "parallelize" a simple loop. Is there
no way to do this?

Subject: Multithreading not working?

From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)

Date: 27 May, 2008 19:35:10

Message: 4 of 4

In article <g1hmt3$bvb$1@fred.mathworks.com>,
David Doria <daviddoria@gmail.com> wrote:

>Oh, I thought this would act like openMP does in c++, just
>starting threads to "parallelize" a simple loop. Is there
>no way to do this?

No, Matlab does not do that at present. It is my understanding,
reading between the lines, that Mathworks is working on improving
Matlab's ability to detect parallizable code.

One of the toolboxes supports a 'parfor' instruction which can
be used to specifically parallize sections.

Other than that -- only to the extent that Matlab manages to figure
out that your expression matches something in BLAS. I -have- seen
Matlab convert some expressions into BLAS calls (I could tell by
the timing)... I was a bit surprised at the sophistication that it
already has in doing that, as the code I had written was not obviously
BLAS-able.
--
   "History is a pile of debris" -- Laurie Anderson

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
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com