How to limit CPU availabilty to Matlab

62 次查看(过去 30 天)
When i running Matlab simulation on my Linux PC (20 cores), it consuming all cores, is there any way to limit CPU availability to Matlab (Use only 10 cores).

回答(2 个)

Raymond Norris
Raymond Norris 2022-6-14
Try
maxNumCompThreads(10);

Dhritishman
Dhritishman 2022-6-15
编辑:Dhritishman 2022-6-15
LASTN = maxNumCompThreads(N)
sets the maximum number of computational threads to N, and returns the previous maximum number of computational threads, LASTN. N in your case is 10.
You can also use
LASTN = maxNumCompThreads('automatic')
which will set the maximum number of computational threads to the most desirable number according to MATLAB.
You can read more about it here:

类别

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

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by