MATLAB: Is SUM not multithreaded on a dual core machine in MATLAB 7.8 (R2009a)

MATLAB

The MEAN function is multithreaded via SUM. However, executing MEAN in multithreading mode performs similar to single threading mode.
>> x = rand(1000);
>> tic; mean(mean(x)); toc
Elapsed time is 0.002357 seconds.
Using ‘-singleCompThread’:
>> x = rand(1000);
>> tic; mean(mean(x)); toc
Elapsed time is 0.002660 seconds.

Best Answer

SUM is memory bound. The issue directly relates to throughput on the CPU(s). The following results illustrate this:
1. Two cores share one BUS
>> x = rand(1000);
>> tic; mean(mean(x)); toc
Elapsed time is 0.002357 seconds.
2. Two cores with two BUSES
>> x = rand(1000);
>> tic; mean(mean(x)); toc
Elapsed time is 0.001802 seconds.
3. Using ‘-singleCompThread’:
>> x = rand(1000);
>> tic; mean(mean(x)); toc
Elapsed time is 0.002660 seconds.
Related Question