Core i7/i9 and Ryzen 7/9 and Threadripper etc owners: Please test your speed with my script. Looking for the suitable CPU for a Matlab computer

Hi, I know that this question has been asked very often. But me too, I am looking for the fastest computer to run some very specific Matlab tasks. I am unsure if hyperthreading, the number of cores or the speed per core is the most important for my specific tasks. So I wrote a quick&dirty script with the most time-consuming operations that I will be running, and I am hoping that some of you run the benchmark and report their results. I am also looking forward to general recommendations.
This script tests the speed of cross-correlation, correlation coefficient, CLAHE and spline interpolation (the m-file is attached too). You will need the image processing toolbox. Please post your results and your CPU type, Thank you very much for your help!!!
William
clear all
close all
clc
disp('Preheating CPU...')
for i=1:100
A=rand(1500,1500);
A=sin(cos(A));
end
clear A
disp('Starting tests...')
%% Cross correlation
num=10000;
A=rand(64,64,num);
B=rand(64,64,num);
tic
for i=1:3
result_conv = fftshift(fftshift(real(ifft2(conj(fft2(A)).*fft2(B))), 1), 2);
end
cross_corr_speed=toc/num/64/64/i *1000*1000*1000;
disp(['Cross-correlation = ' num2str(cross_corr_speed) ' ns/correlation/pixel'])
%% Correlation coefficient
tic
for i=1:num
corr_result=corr2(A(:,:,i),B(:,:,i));
corr_result=corr2(B(:,:,i),A(:,:,i));
end
corr_coeff_speed=toc/num/2/64/64 *1000*1000*1000;
disp(['Correlation coefficient = ' num2str(corr_coeff_speed) ' ns/correlation/pixel'])
clear A B
num=20;
A=rand(2000,2000,num);
%% CLAHE
tic
for i=1:num
B=adapthisteq(A(:,:,i),'NumTiles',[15 15]);
end
CLAHE_speed=toc/num/2000/2000 *1000*1000*1000;
disp(['CLAHE = ' num2str(CLAHE_speed) ' ns/pixel'])
clear B
%% Interp2
[X,Y] = meshgrid(-30:30);
V = peaks(X,Y);
[Xq,Yq] = meshgrid(-30:0.01:30);
tic
for i=1:10
Vq = interp2(X,Y,V,Xq,Yq,'spline');
end
interp_speed=toc/numel(Vq)/i *1000*1000*1000;
disp(['Interpolation = ' num2str(interp_speed) ' ns/pixel'])
v=ver('MATLAB');
disp(['-> Using MATLAB version ' v.Version ' ' v.Release ' on ' computer '.'])
%{
My results:
Prozessor Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz, 2712 MHz, 2 Kern(e), 4 logische(r) Prozessor(en)
Installierter physischer Speicher (RAM) 8,00 GB
Cross-correlation = 42.7083 ns/correlation/pixel
Correlation coefficient = 27.2742 ns/correlation/pixel
CLAHE = 66.2395 ns/pixel
Interpolation = 12.4732 ns/pixel
-> Using MATLAB version 9.7 (R2019b) on PCWIN64.
%}

19 Comments

Prozessor Intel(R) Core(TM) i5-1035G1 CPU @ 1.00GHz, 1190 MHz, 4 Kern(e), 8 logische(r) Prozessor(en)
Installierter physischer Speicher (RAM) 8.00 GB
Cross-correlation = 40.7898 ns/correlation/pixel
Correlation coefficient = 21.0188 ns/correlation/pixel
CLAHE = 67.0392 ns/pixel
Interpolation = 13.202 ns/pixel
-> Using MATLAB version 9.10 (R2021a) on PCWIN64.
Please allow me this levity:
  • AMD Phenom(tm) II X6 1045T Processor @ 2700 MHz max
  • 8GB ram
  • Cross-correlation = 162.2735 ns/correlation/pixel
  • Correlation coefficient = 59.2965 ns/correlation/pixel
  • CLAHE = 303.5223 ns/pixel
  • Interpolation = 42.174 ns/pixel
  • -> Using MATLAB version 8.6 (R2015b) on GLNXA64.
or alternatively:
  • AMD Athlon(tm) II X2 250 Processor @ 3000 MHz max
  • 4GB ram
  • Cross-correlation = 682.9672 ns/correlation/pixel
  • Correlation coefficient = 107.4185 ns/correlation/pixel
  • CLAHE = 211.1276 ns/pixel
  • Interpolation = 231.4174 ns/pixel
  • -> Using MATLAB version 7.9 (R2009b) on GLNXA64.
Without a doubt, this hardware is highly recommended. Out of all the other moist garbage that was sharing the same dumpster, this is indeed the most optimized for Matlab.
Wow, why are your computers almost 10x slower than my old laptop...? Or is there something wrong with my script? This is almost what I think...
A distinct possibility is improvements made to efficiency or multithreading between R2009b/R2015b and something newer. Other than that, I really don't know.
I would say that might be part of it.
Using the same X6 1045T system with R2019b:
  • Cross-correlation = 46.2862 ns/correlation/pixel
  • Correlation coefficient = 34.4991 ns/correlation/pixel
  • CLAHE = 217.9592 ns/pixel
  • Interpolation = 38.2736 ns/pixel
  • -> Using MATLAB version 9.7 (R2019b) on GLNXA64.
Edit: it's a laptop so there's no confusion.
My results:
Prozessor Ryzen 7 5800U
Installierter physischer Speicher (RAM) 32,00 GB 3200 Mhz
Cross-correlation = 19.4043 ns/correlation/pixel
Correlation coefficient = 9.2769 ns/correlation/pixel
CLAHE = 31.0966 ns/pixel
Interpolation = 9.2674 ns/pixel
-> Using MATLAB version 9.10 (R2021a) on PCWIN64.
I'll give my two cents too (though my CPU isn't a latest reslease):
Intel(R) Core(TM) i5-8600K CPU @ 3.60GHz, (turbo up to 4.30 GHz), 9 MB Intel® Smart Cache, 6 cores 6 threds.
Cross-correlation = 19.236 ns/correlation/pixel
Correlation coefficient = 28.3609 ns/correlation/pixel
CLAHE = 37.8137 ns/pixel
Interpolation = 7.7348 ns/pixel
-> Using MATLAB version 9.6 (R2019a) on PCWIN64.
Intel(R) Core(TM) i7-4771 CPU @ 3.50GHz, 4 core, 32 GB ram (late 2013)
Cross-correlation = 27.7339 ns/correlation/pixel
Correlation coefficient = 11.5872 ns/correlation/pixel
CLAHE = 41.4351 ns/pixel
Interpolation = 10.0465 ns/pixel
-> Using MATLAB version 9.10 (R2021a) on MACI64.
... so a little slower than Harry Laing's but also 4 generations earlier.
CPU Type 10-Core Intel Core i9-7900X, 3966 MHz (40 x 99)
Number of cores: 10
Memory: 64 GB RAM, DDR4-3000
Cross-correlation = 12.5209 ns/correlation/pixel
Correlation coefficient = 11.6707 ns/correlation/pixel
CLAHE = 46.9698 ns/pixel
Interpolation = 10.9432 ns/pixel
-> Using MATLAB version 9.10 (R2021a) on PCWIN64.
Interesting, that i9 is about twice as fast as my 2013 i7 for cross-correlation, but is otherwise slightly slower.
I somehow have the impression that my code isn't really great for testing and comparing performance... But I don't know how to do it better :(
CPU Type: 10-core Intel Core I9-10910, 3.6 GHz
Number of Cores: 10
Memory: 8 GB RAM, DDR4-2667
Cross-correlation = 26.8204 ns/correlation/pixel
Correlation coefficient = 10.1997 ns/correlation/pixel
CLAHE = 31.1563 ns/pixel
Interpolation = 11.8234 ns/pixel
-> Using MATLAB version 9.10 (R2021a) on MACI64.
Processor: Ryzen 9 5950x Running at 4.60GHz
Number of Cores: 16 (I think?)
Memory: 128GB DDR4-3600
Cross-correlation = 15.8027 ns/correlation/pixel
Correlation coefficient = 8.0007 ns/correlation/pixel
CLAHE = 33.0447 ns/pixel
Interpolation = 7.2428 ns/pixel
-> Using MATLAB version 9.11 (R2021b) on PCWIN64.
Currently encountering a hyper-threading related issue however which makes me think my system isn't using the CPU fully, I'll edit the post if I fix this and it leads to faster results:
feature('numcores')
MATLAB detected: 16 physical cores.
MATLAB detected: 32 logical cores.
MATLAB was assigned: 32 logical cores by the OS.
MATLAB is using: 16 logical cores.
MATLAB is not using all logical cores because hyper-threading is enabled.
It is normal that MATLAB does not use workers according to logical cores. For technical reasons, using logical cores for compute-bound tasks can reduce performance.
You can edit your default cluster profile in order to increase the number of workers used past the number of physical cores.
[Sorry for hijacking your post OP]
I have no experience with parallel computing to be honest, I'm encountering a consistent 'issue' in that my CPU is using 50% utilisation at most on programs which are running for a long time (PhD simulations with a lot of big matrix calculations and use of massive interpolations from the partial differential equation toolbox).
If I load a parpool with 32 workers, I can get 100% cpu usage as it's loading the pool, but then I'm assuming the fact I have no parfor loops etc means it doesn't know to utilise all 32 workers..?
I have trawled the forums and a lot of the threads are quite old, I saw you mention here "https://uk.mathworks.com/matlabcentral/answers/791324-matlab-only-uses-half-of-the-number-of-logical-cores-how-can-i-use-all-of-them" something relevent more recently, but I wasn't sure what to conclude. I can't find hyper-threading anywhere in preferences and am unsure whether I'd benefit from turning it off or not?
I have disabled the hyperthreading of an Intel CPU in the BIOS, but couldn't see any speed difference with parfor loops and my specific calculation task.
It is common for CPU meters to report 50% when all physical cores are in use, because they often calculate activity as-if logical cores had equivalent computation ability to physical cores.
Hyperthreading is not additional computation units: it is instead hardware assistance to switch to a new process as soon as an existing process gives up a physical core for any reason (such as pause() or asking for I/O or waiting for user input). (As well, apparently on some hardware, a hyperthread can use an integer logic unit while the main core is using the floating point unit.)
When hyperthreads are active, and there is work queued for them, the physical cores do not get as much rest, and so tend to heat up more, and the hardware may need to lower the clock rate in order to keep the system from overheating.
Preheating CPU...
Starting tests...
Cross-correlation = 19.7436 ns/correlation/pixel
Correlation coefficient = 7.2303 ns/correlation/pixel
CLAHE = 29.6015 ns/pixel
Interpolation = 7.2098 ns/pixel
-> Using MATLAB version 9.11 (R2021b) on PCWIN64.
i7 11700, 32 GB ram

Sign in to comment.

Answers (0)

Products

Release

R2019b

Tags

Asked:

on 25 Mar 2021

Commented:

on 5 Nov 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!