How to limit CPU availabilty to Matlab

19 ビュー (過去 30 日間)
Sumesh KS
Sumesh KS 2022 年 6 月 14 日
編集済み: Dhritishman 2022 年 6 月 15 日
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:

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by