# Is matrix multiplication automatically done in parallel in Mathematica 9?

In good old Mathematica versions (5.2, 6.0), matrix multiplication was automatically done in parallel. For example, on an 8-core machine, define two square real matrices:

m1 = Table[Random[Real], {256}, {256}];
m2 = Table[Random[Real], {256}, {256}];


The total CPU time used in all cores to compute a dot product is:

Tsingle = Timing[m1.m2][[1]]


0.010999 Second

The real time needed for the calculation is:

Tparallel = AbsoluteTiming[m1.m2][[1]]


0.001546 Second

For large matrices, the ratio is almost equal to the number of cores (8):

Tsingle / Tparallel


7.114489004

Repeating the same calculation in newer Mathematica versions (8.0, 9.0) gives Tsingle equal to Tparallel, which seems to indicate that new Mathematica versions dropped automatic parallelization of the Dot command. Is this true?
I would be thankful if anyone can advise how to regain this functionality, i.e. compute Dot products in parallel (automatically or manually).

• This may be due to changes in how timing works, see the documentation: "On certain computer systems with several CPUs, the Mathematica kernel may sometimes spawn additional threads on different CPUs. On some operating systems, Timing may ignore these additional threads. On other operating systems, it may give the total time spent in all threads, which may exceed the result from AbsoluteTiming." Nov 2 '13 at 23:22
• It is still done in parallel, but you should use RandomReal and not Table because the former produces a packed array while the latter does not. By the way, a 256-by-256 matrix is not really big enough for parallelization to be particularly noticeable, so you should test with a larger matrix as well. For any remaining discrepancies, I agree with @s0rce's comment. Nov 2 '13 at 23:24

Not really an answer but too long for a comment, Timing doesn't appear different then AbsoluteTiming, I have 9.0.1 on Win7 x64.

n = 2^12;
m1 = RandomReal[1, {n, n}];
m2 = RandomReal[1, {n, n}];
Tsingle = Timing[m1.m2;][[1]]
Tparallel = AbsoluteTiming[m1.m2;][[1]]
Tsingle/Tparallel

1.435209
1.589091
0.90316