Same code taking 15x longer to execute on a faster machine
Mostra commenti meno recenti
I recently upgraded to a faster computer (from a 16Gb i7 processor to a 32Gb RYZEN processor with a 16Gb NIVIDIA RTX GPU (CUDA compatible)).
I used to execute the following code in a matter of 5-10 seconds on my older machine (MATLAB 2021a). Now it is taking >2 minutes on a way faster machine (MATLAB 2022b).
I think it is related to a certain memory allocation setting in MATLAB which I might have applied on my previous machine, but I can't remember it anymore.
Is there someone who could help me in resolving this issue, please? For example, which setting I could modulate to execute this code faster?
Or is it is related to the MATLAB version?
dE00=zeros(6,7362497,"single"); %dE00 refers to a numerical value of color difference
% lab_NF contains six CIELAB color values (L*, a* and b*) while labDB is a
% database of 7362497 CIELAB color values.
for nClrs=1:7362497
dE00(1:6,nClrs)=deltaE2000(lab_NF(1:6,1:3),labDB(nClrs,1:3));
end
Thanks in advance!
17 Commenti
What function are you using? It's not either of these
because those doesn't support the way you're using it.
It's not this one
because that doesn't either, and it doesn't return the same size output.
So what is it?
Aiman Raza
il 17 Nov 2022
Bruno Luong
il 17 Nov 2022
Modificato: Bruno Luong
il 17 Nov 2022
What is the spec of the older computer? I guess it's intel base? Some people complain the slowness of AMD proessor possibly due to the library.
Have you run
bench
command?
I believe TMW claims many operations of small matrices is faster on R2022b (see the release note).
There is memory setting for java heap space, but I don't think it affects the computation speed.
Bruno Luong
il 17 Nov 2022
Modificato: Bruno Luong
il 17 Nov 2022
BTW I run your code with random input
dE00=zeros(6,7362497,"single"); %dE00 refers to a numerical value of color difference
% lab_NF contains six CIELAB color values (L*, a* and b*) while labDB is a
% database of 7362497 CIELAB color values.
lab_NF = rand(6,3,'single');
labDB = rand(7362497,3,'single');
tic
for nClrs=1:7362497
dE00(1:6,nClrs)=deltaE2000(lab_NF(1:6,1:3),labDB(nClrs,1:3));
end
toc
It takes 90 seconds on my computer (Intel + Windows 11 + R2022b)
Aiman Raza
il 17 Nov 2022
Bruno Luong
il 17 Nov 2022
I don't believe the MATLAB version has anything to do with it. I see constant improvement of speed over time, but nothing that can explain x 15. Also your code does seem to use any gpu so Nvidia card is irrelevant.
Aiman Raza
il 17 Nov 2022
Bruno Luong
il 17 Nov 2022
I don't want to answer speeding up your code here. It's off topic.
Aiman Raza
il 17 Nov 2022
Star Strider
il 17 Nov 2022
This has been a problem for a while.
See a relevant discussion here: How can I use the BLAS and LAPACK implementations included in AMD Optimizing CPU Libraries (AOCL) with MATLAB R2022a? - .
All of my computers have AMD processors because I prefer them.
.
Bruno Luong
il 17 Nov 2022
Modificato: Bruno Luong
il 17 Nov 2022
@Star Strider can you please run the code (the one I posted) and post the result?
Aiman Raza
il 17 Nov 2022
Bruno Luong
il 17 Nov 2022
What you should double check is this:
"I used to execute the following code in a matter of 5-10 seconds on my older machine "
Aiman Raza
il 17 Nov 2022
Bruno Luong
il 17 Nov 2022
My laptop intel is quite recent, and it is no where 15 s, as I mention 90 seconds.
To be sure I'll download R2021a and do the same tic/toc.
Bruno Luong
il 17 Nov 2022
Modificato: Bruno Luong
il 17 Nov 2022
I run gain the code on my Intel laptop
R2021a: 85 seconds
R2022b: 87 seconds
Aiman Raza
il 17 Nov 2022
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Loops and Conditional Statements in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
