MATLAB: Enable multi-threading on a parfor loop

multi-threadingparforr2012b

Hi everyone,
I have a read a lot of stuff on multi-threading on Matlab but i am a bit lost between all the versions/revisions on this topic. I have a code that mostly runs a parfor loop. This sends to my workers work to do, in single-threaded mode as i can see on my task manager. My question is : despite the overlapping issues that may arise, is there a way in Matlab 2012b and higher to force the multi-thread mode on this parfor loop ?
Thanks in advance,
Alex

Best Answer

You can use the maxNumCompThreads function (from within an SPMD block for example) to control the number of threads used by the workers. (Yes, this function is deprecated, but unfortunately there is currently no alternative).