maxNumCompThreads - Control maximum number of computational threads - MATLAB (original) (raw)
Main Content
Control maximum number of computational threads
Syntax
Description
[N](#mw%5F8d9ade76-0d96-41b4-ab00-a90ef5bc7e76) = maxNumCompThreads
returns the current maximum number of computational threads.
Currently, the maximum number of computational threads is equal to the number of physical cores on your machine.
[LASTN](#mw%5Fcdfe71cb-9251-4114-b680-9f9805fae5a5) = maxNumCompThreads([n](#mw%5F612516ab-6e5f-4df9-9e87-5f656afc9de3))
sets the maximum number of computational threads to n
and returns the previous maximum number of computational threads, LASTN
.
[LASTN](#mw%5Fcdfe71cb-9251-4114-b680-9f9805fae5a5) = maxNumCompThreads('automatic')
sets the maximum number of computational threads using what the MATLAB® software determines to be the most desirable. It additionally returns the previous maximum number of computational threads, LASTN
.
Note
Setting the maximum number of computational threads usingmaxNumCompThreads
does not propagate to your next MATLAB session.
You can set the -singleCompThread
option when starting MATLAB to limit MATLAB to a single computational thread. By default, MATLAB makes use of the multithreading capabilities of the computer on which it is running.
On Windows® platforms with multiple processor groups, the default maximum number of computational threads is equal to the number of physical cores within the processor group that is running MATLAB.
Examples
Display the current maximum number of computational threads.
Input Arguments
Maximum number of computational threads, specified as a positive integer scalar.
Output Arguments
Current maximum number of computational threads, returned as a positive integer scalar.
Previous maximum number of computational threads, returned as a positive integer scalar.
Version History
Introduced in R2007b