Speed of Mathematica on AMD machines
- To: mathgroup at smc.vnet.net
- Subject: [mg126432] Speed of Mathematica on AMD machines
- From: einschlag at gmail.com
- Date: Thu, 10 May 2012 04:57:46 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
We have recently bought an iBuyPower gaming PC for our research group:
AMD FX 8 core, 3.6 GHz, 16 GB RAM
MathematicaMark8 Benchmark 0.86 is not bad, considering the price ~$800 of this PC but I was expecting much more.
Apparently Intel's MKL library used by Mathematica is not optimized for AMD processors.
A test program calculating exponentials of large matrices takes 13 s on the AMD PC and only 8 s on my Mac Pro (Mathematica benchmark 0.7) that has 8 Intel Xeon cores at 2.4 GHz. And on my Lenovo laptop the program runs 9 s. I blame it on the MKL inadequacy for AMD.
TestProgram := Module[{},
NN = 1000;
AMatr = Table[RandomReal[], {i, 1, NN}, {j, 1, NN}];
NExec = 10;
For[i = 1, i < NExec, i++,
MatrixExp[AMatr];
];
]
Execution by iBuyPower PC (AMD FX 8 core, Linux Ubuntu 64 bit)
TestProgram // AbsoluteTiming
{13.230105, Null}
Execution by Mac Pro (Intel Xeon 2 x 4 core)
TestProgram // AbsoluteTiming
{8.126944, Null}
Execution by Lenovo laptop (Intel i7-QM2060, Windows 7 64 bit)
TestProgram // AbsoluteTiming
{9.4275392, Null}
On the other hand, a program compiling in C from Mathematica's help runs very fast on the AMD PC:
TestProgram2 := Module[{},
c = Compile[ {{x, _Real}, {n, _Integer}},
Module[ {sum, inc}, sum = 1.0; inc = 1.0;
Do[inc = inc*x/i; sum = sum + inc, {i, n}]; sum],
CompilationTarget -> "C"];
c[1.6, 10000000];
]
Execution by iBuyPower PC (AMD FX 8 core, Linux Ubuntu 64 bit, GCC compiler)
TestProgram2 // AbsoluteTiming
{0.114427, Null}
Execution by Mac Pro (Intel Xeon 2 x 4 core, GCC compiler)
TestProgram2 // AbsoluteTiming
{0.212875, Null}
Execution by Lenovo laptop (Intel i7-QM2060, Windows 7 64 bit, Microsoft Visual C++)
TestProgram2 // AbsoluteTiming
{0.3540203, Null}
It seems the second test program is not using MKL and thus AMD becomes very efficient.
I will continue testing.
Is there any way to improve Mathematica's performance on AMD machines?
Dmitry