From: daniel sentenac on
I have a C code running a m file .so library compiled with mcc matlab 2009. I use a dual Xeon cpu machine, each cpu having 4 cores (8 hyperthreaded cores for each cpu).
At launch time a certain number of threads is created by the application which is not always the same (most of the time is 4 and occasionally 5). In both cases, the application uses both cpu, but when using 4 threads, 95% of the load is concentrated on one cpu, with cpu swapping occuring all the time, as if matlab was constantly looking for improvement alternatives after each cycle. On the other hand, when running with 5 threads the load is well distributed between the 2 cpus not exceeding 30% load, with a stable configuration behavior. As a result, the computation elapsed time for the matlab function is 30% faster when using 5 threads, instead of 4 threads, without saturating the total cpu available ! Clearly, the 5 threads situation is by far the best one. It seems that the automatic thread management by matlab 2009 is not working well. Is it improved with matlab 2010 ?