fmincon does not use every cores of AMD Ryzen CPU

3 次查看(过去 30 天)
Hi,
I have just switched my from an Intel i5-9600KF (6C, 6T) PC to an AMD Ryzen 3800X (8C, 16T), and fmincon solver does not use the every cores / threads of the processor, the CPU usage is about 20-40%. Previously, on the Intel CPU, all cores were run on 100%. Now, the code run much slower on the new, faster CPU....
Could you please help me? Is this even caused by the new CPU? Of course I use the same Windows and MATLAB versions, with the same software packages, etc. all softwares are the same.
Thank you for your help in advance!

回答(1 个)

Animesh
Animesh 2023-3-7
Hello,
If you are using the “fmincon” function in MATLAB and it does not appear to be using all the cores of your AMD Ryzen CPU, there are a few things you can try to resolve the issue:
  • Check the number of workers: Make sure that MATLAB is using the correct number of workers. You can check this by typing "maxNumCompThreads" in the MATLAB command window. If the output is less than the number of CPU cores you have, you can increase the number of workers by typing "maxNumCompThreads(n)", where "n" is the number of workers you want to use.
  • Check the optimization options: Make sure that you have set the optimization options to use parallel computing. You can do this by setting the "UseParallel" option to "true" in the optimization options structure. For example:
options = optimoptions('fmincon', 'UseParallel', true);
  • Check the optimization problem: If the optimization problem is not well-suited for parallel computing, you may not see a significant speedup by using multiple cores. In some cases, using more cores may even slow down the optimization process. You may want to try different optimization techniques or approaches to see if you can improve the performance.
  • Check the hardware settings: You may want to check your computer's power settings to make sure that the CPU is not being throttled or limited in some way. You can also try updating your computer's drivers or firmware to see if that helps improve performance.
By trying these steps, you should be able to determine the cause of the issue and find a solution that will allow you to use all the cores of your AMD Ryzen CPU for fmincon optimization in MATLAB.

类别

Help CenterFile Exchange 中查找有关 Get Started with Optimization Toolbox 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by