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
4 views (last 30 days)
Show older comments
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
Walter Roberson
on 3 Nov 2021
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.
Mario Malic
on 5 Nov 2021
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
Answers (0)
See Also
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!