The Flop (Floating Point Operations per Second) Rate of MATLAB Code
古いコメントを表示
Hello, I know Intel MKL / IPP libraries performance in simple operations (Multiplication, Summation, Matrix Multiplication, Vector Multiplication) gets something like 80-95% of the theoretical performance of the CPU (Measured in FLOPS).
http://software.intel.com/en-us/articles/parallelism-in-the-intel-math-kernel-library http://software.intel.com/en-us/intel-mkl
Yet, doing so using MATLAB I get much worse results.
I have this simple script:
numElements = 2 ^ 16;
numIter = 100;
vecX = randn(numElements, 1, 'single');
vecY = randn(numElements, 1, 'single');
initTime = tic();
for ii = 1:numIter
vecX .* vecY;
end
stopTime = toc(initTime);
gFlops = (numElements * numIter) / stopTime
Yet I get only 1.1 GFLOPS on my i7-860 Which should be closer to 2.8GHz (Frequency) * 4 (Cores) * 4 (Single Precisio Operations per Cycle as SSE Vector - 128 Bit) = 44.8 GFLOPS.
Yet I get something like 1.4 GFLOPS. Which is only 3% of the theoretical performance.
How can MATLAB be so inefficient?
2 件のコメント
Amit
2014 年 1 月 28 日
BTW, MATLAB is only using 1 core, I'd believe. And for a benchmark, is there anything else running besides MATLAB?
Royi Avital
2014 年 2 月 19 日
採用された回答
その他の回答 (1 件)
Walter Roberson
2014 年 1 月 28 日
0 投票
single() is often slower than double()
Your arrays are not that big; I am not sure that it is kicking in calls to the libraries.
2 件のコメント
Royi Avital
2014 年 1 月 28 日
Walter Roberson
2014 年 1 月 29 日
Try with timeit. Or if you have an older MATLAB that does not have that built-in, you can get timeit from the File Exchange.
カテゴリ
ヘルプ センター および File Exchange で Startup and Shutdown についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!