s5s
s5s

Reputation: 12144

Matlab 2011a Use all Cores Available on 64 bit Linux?

Hi I've looked online but I can't seem to find the answer whether I need to do anything to make matlab use all cores? From what I understand multi-threading has been supported since 2007. On my machine matlab only uses one core @100% and the rest hang at ~2%. I'm using a 64 bit Linux (Mint 12). On my other computer which has only 2 cores and is 32 bit Matlab seems to be utilizing both cores @100%. Not all of the time but in sufficient number of cases. On the 64 bit, 4 core PC this never happens.

Do I have to do anything in 64 bit to get Matlab to use all the cores whenever possible? I had to do some custom linking after install as Matlab wasn't finding the libraries (eg. libc.so.6) because it wasn't looking in the correct places.

Upvotes: 1

Views: 7054

Answers (2)

Prabhakar
Prabhakar

Reputation: 1

MATLAB has only one single thread for Computation.

That said, multiple threads would be created for certain functions which use the multithreaded features of the BLAS libraries that it uses underneath.

Thus, you would only be able to gain a 'multi threaded' advantage if you are calling functions which use these multi-threaded blas libraries.

This link has information on the list of functions which are multithreaded.

Now for the use of your cores, that would depend on your OS. I believe the OS would have to load balance your threads to be used on all cores. One CANNOT set affinities to threads from within MATLAB. One can however set worker MATLAB processes to have affinities to cores from within the Parallel Computing toolbox.

However, you could always try setting the affinity for the MATLAB process to all your processors manually by the details available at the following link for Linux

Windows users can simply right click on the process in the task manager and set affinity.

My understanding is that this is only a request to the OS and is not a hard binding rule that the OS must adhere to.

Upvotes: 0

jpjacobs
jpjacobs

Reputation: 9549

By standard, since the latest release, you can use 12 cores using the Parallel Computing Toolbox. Without this toolbox, I guess you're out of luck. Any additional cores could be accessed by the MATLAB Distributed Computing Server, where you actually pay per number of worker threads.

To make matlab use your multiple cores you have to do

matlabpool open

And it of course works better if you actually have multithreaded code (like using the spmd function or parfor loops)

More info at the Matlab homepage

Upvotes: 2

Related Questions