Effacer les filtres
Effacer les filtres

My code is slower on a more powerful machine?

18 vues (au cours des 30 derniers jours)
Ali Almakhmari
Ali Almakhmari le 3 Août 2023
Réponse apportée : Ashutosh le 23 Août 2023
Hey guys, I ran my code on my Windows 10 machine that has 8 cores of CPU and 16 GB of RAM on MATLAB 2022b. And then ran the same code on a Linux Ubuntu machine that has 128 cores of CPU and 512 GB of RAM on MATLAB 2020b. The code was significantly slower on the Linux machine even though the machine is MUCH more powerful. Is it due to a difference in the OS or a difference in the MATLAB version? Or is it something else? I am not sure. Here is my code (its basically a code to train a neural network to fit a variable in terms of other 7 variables):
Table=AM03_a02b; %a table of 2000 rows and 18 columns of decimal values
Input=Matrix(1:end,[1:3,7:10]); %the inputs to the neural network that will be used in the training
Output=Matrix(1:end,13); %the output of the neural network that will be used in the training
% Resizing The Matricies
ANN=newff(Input,Output,[100 100 100]); %a neural network with three layers and 100 neurals per layer
ANN.trainFcn = 'trainrp';
ANN.trainParam.epochs=1000; %a total of 1000 iterations
% Training Process

Réponse acceptée

Ashutosh le 23 Août 2023
The following could be the possible reasons for such performance in Linux as compared to Windows:
  • As Windows machine is using MATLAB R2022b it would have better performance optimizations as compared to R2020b. Try to update MATLAB version to latest release in Linux machine.
  • MATLAB has support for parallel computing, but the code is not able to utilize it effectively resulting in inefficient performance. Try to explore Parallel Computing Toolbox to improve performance.
  • Try to profile the MATLAB code using built in profiler ("profile" function) to identify the performance bottlenecks by tracking the execution time and work on improving it.
Following links are helpful in improving performance:

Plus de réponses (0)


En savoir plus sur Image Data Workflows dans Help Center et File Exchange




Community Treasure Hunt

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

Start Hunting!

Translated by