If you are interested in seeing programmatic threading in MATLAB, drop me a line (I am a product manager for MATLAB). I would love to hear what you have in mind. My email address is:

ken dot atwell at mathworks dot com

Regards,

KEN ATWELL

There is no way to program directly with threads using M-files in a single MATLAB session. You might consider our Parallel Computing Toolbox, depending on what you are trying to do.

–Loren

]]>I’d like to know whether Matlab allows you to program using threads, like java. I need to run two M-Files at the same time. Thanks, Best wishes,

AAV

]]>I need your help related with Multithreading issue of Matlab R2007b.

We just purchased a Quad Core2Duo work station (in total 8 cores), on which we would like to run some simulations. What we would like to do is to see from Windows Task Manager that all 8 cores are working with full speed on our simulations? Is it possible? And if it is possible, how?

We enabled Multithreading property of Matlab R2007b from preferences and it shows us that it is able to use 8 cores for computational efforts. But what we see from Windows Task Manager’s CPU Performance window is that only 1 of the 8 cores is making a peak, and the others are sleeping.

How can we activate all cores to work with their maximum performance at the same time in order to run our simulation under Matlab R2007b?

Best wishes and regards,

Yours respectfully,

K.T.

Again, this function only provides the ability to set the maximum number of computational threads. Can you tell us why this is important in your work? I think even if we provided such function, MATLAB built-in function would not react to this setting, because a) vendor BLAS has their own threading algorithms that MATLAB has not control of, and b) many computation will slow down if we don’t take care how to/whether to multithread.

One good example is sparse in bench.m. You did not observe speed up for sparse becuase it involves a lot of BLAS calls to smaller matrices and vendor BLAS decided it will not multithread. In fact, many customer has observed slow down with sparse in bench.m when multithreading is turned on. This turned out that vendor BLAS are not universally faster with multithreading on. In fact, the multithreaded BLAS can be slower on particular matrice size. Here is one of the many reasons why the default setting for multithreading is off for R2007a and R2007b. We are working with vendors to plug these holes.

The long term goal obviously is to turn on multithreaded computation by default. All users need to know is that MATLAB will take advantage of their latest multi-core chips effectively.

]]>I read in this topic that we are not selecting the number of computational threads but the maximum number of computational threads in the GUI preferences.

I would like to know if the use of the function “setNumberOfComputationalThreads(N)” allow us to select the exact number of thread to use.

In addition, I made benchmarks on matrix-matrix operations with sparse matrix or not (addition, subtraction, multiplication…). I obtained performance improvement on my dual core with matrix-matrix multiplication only ( and not with sparse matrix ).

I know that Intel MKL/BLAS library allows to use multithread with all of this operations ( and on sparse matrix too). Is matlab able to use all mkl functions ?

Thank you in advance for your response,

]]>Thanks for the help though.

David

]]>I had a typo, sorry. I’ve fixed it now. Only through the GUI currently.

–Loren

]]>Oh, fantastic – what is the command to enable it then?

Best,

David

You can only switch the multithreading through the GUI, not the command line in R2007a. You may be able to get programmable control in future releases.

–Loren

]]>