Same code taking 15x longer to execute on a faster machine
显示 更早的评论
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 个评论
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
2022-11-17
Bruno Luong
2022-11-17
编辑:Bruno Luong
2022-11-17
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
2022-11-17
编辑:Bruno Luong
2022-11-17
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
2022-11-17
Bruno Luong
2022-11-17
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
2022-11-17
Bruno Luong
2022-11-17
I don't want to answer speeding up your code here. It's off topic.
Aiman Raza
2022-11-17
Star Strider
2022-11-17
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
2022-11-17
编辑:Bruno Luong
2022-11-17
@Star Strider can you please run the code (the one I posted) and post the result?
Aiman Raza
2022-11-17
Bruno Luong
2022-11-17
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
2022-11-17
Bruno Luong
2022-11-17
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
2022-11-17
编辑:Bruno Luong
2022-11-17
I run gain the code on my Intel laptop
R2021a: 85 seconds
R2022b: 87 seconds
Aiman Raza
2022-11-17
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
