How can I limit the number of computational threads used by MATLAB in MATLAB 7.10 (R2010a)?

46 visualizzazioni (ultimi 30 giorni)
I am working on multi-user multi-core machines and would like to balance resource allocations for multiple instances of MATLAB sessions.

Risposta accettata

MathWorks Support Team
MathWorks Support Team il 2 Dic 2020
Modificato: MathWorks Support Team il 3 Dic 2020
Multithreaded computations, introduced in MATLAB 7.4 (R2007a), are turned on by default as of MATLAB 7.6 (R2008a) release. The followings are options to change the number of computational threads in MATLAB:
1. Setting the Number of Threads from Multithreading menu in Preferences Panel (available in R2007a through R2008b releases)
2. Using the MAXNUMCOMPTHREADS function (available in R2007b through R2010a). This function issues a warning as of R2009b release.
3. Start MATLAB with ‘-singleCompThread’ option
4. Setting CPU affinity for a MATLAB process at the operating system level
Note that the capability to adjust the number of computational threads in a single MATLAB session using Preferences Panel is no longer available in MATLAB 7.8 (R2009a) or later releases. Also, as of MATLAB 7.9 (R2009b), using MAXNUMCOMPTHREADS throws the following warning:
ERROR: maxNumCompThreads will be removed in a future release. Please remove any instances of this function from your code.
The primary reason for this change is that products that MATLAB is dependent upon have the ability to spawn threads from the currently-executing thread. This makes it infeasible to monitor and/or limit the number of computational threads at any given time in a MATLAB process.
There will be no direct replacement that allows users to specify the number of computational threads. Suggested methods to control threading levels in MATLAB are as below:
1. Set the '-singleCompThread' option when starting MATLAB to limit MATLAB to a single computational thread.
2. Specify a given set of CPUs (cores) that are available for use by the MATLAB process by setting CPU affinity provided by the operating system. This allows MATLAB to use more than one computational threads.
For more information on setting CPU affinity for a MATLAB process, refer to the Related Answers:
and

Più risposte (0)

Categorie

Scopri di più su Introduction to Installation and Licensing in Help Center e File Exchange

Prodotti


Release

R2009b

Community Treasure Hunt

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

Start Hunting!

Translated by