MATLAB: difference between Multithreading and Multicore

后端 未结 3 1021
闹比i
闹比i 2020-12-19 21:42

I have an i7-M620 processor that have 2 physical cores and 2 threads (multi-threaded CPU) per core (a total of 4 threads). When I use the MATLAB Parallel Computing Toolbox,

3条回答
  •  执念已碎
    2020-12-19 22:38

    My desktop station has one i7-2600 CPU, and the OS is the newest Linux Mint. I have tested parallel computing of MATLAB 2012b, which by default the NumWorker is 4 (the core number of i7-2600), I modified the local cluster profile to be 8 of the value of NumWorker, then I did the comparison with the workers setting to be 4 and 8 (just as @rubenvb posted).

    The results show that in the serial mode, the time consuming is about 429 sec, while in the parallel mode (with matlabpool open 4) the time consuming is about 254 sec and 218 sec for 8 workers, i.e. boosted by 40.79% and 49.18%, respectively.

    And I further investigated my code carefully, and found that inside the parallel body, MATLAB vectorization optimization is also implemented, i.e. extra CPU resource is required for such kind of boosting, thus for the NumWorkers of 8 case (i.e. hyper-thread enabled), it do not have enough idle CPU resource to boost vectorization, in some degree it is CPU resource competition, which reduce the parallel efficiency. This is also the reason that when NumWorkers of 4 almost with the equal boosting efficiency.

    The conclusion is that parallel computation in MATLAB is quit helpful and simply to implement but should be used carefully, this is all my personal opinion.

提交回复
热议问题