user88595
user88595

Reputation: 195

Using matlabpool with a specified number of workers

I've been using the command matlabpool open 8 for a while in order to speed up things. However I just tried using it and am denied 8 cores and now limited to 4.

My laptop is an i7 with 4 cores but hyperthreaded which meant I had no issue making matlab working on 8 virtual cores.

Simultaneously I noticed the following warning message:

Warning: matlabpool will be removed in a future release. Use parpool instead.

Seems like MathsWorks decided this was a great update for some reason.

Any ideas how I can get my code running on 8 cores again?

Note: I was using R2010b (I think) and now using R2014b.

Upvotes: 1

Views: 338

Answers (1)

Sam Roberts
Sam Roberts

Reputation: 24127

It looks like @horchler has provided you with a direct solution to your question in the comments.

However, I would recommend sticking to the default 4 workers suggested by MATLAB, and not using 8. You're very unlikely to get significant speedup by moving to 8, and you're even likely to slow things down a bit.

You have four physical cores, and they can only do so much work. Hyperthreading enables the operating system to pretend that there are 8 cores, by interleaving operations done on pairs of virtual cores.

This is great for applications such as Outlook, which are not compute-intensive, but require lots of operations to appear simultaneous in order, for example, to keep a GUI responsive while checking for email over a network connection.

But for compute-intensive applications such as MATLAB, it will not give you any sort of real speed up, as the operations are just interleaved - you haven't increased the amount of work that the 4 real, physical cores can do. In addition, there's a small overhead in performing the hyperthreading.

In my experience, MATLAB will benefit slightly by turning hyperthreading off. (Of course other things, such as Outlook, won't: your choice).

Upvotes: 3

Related Questions