parfor number of cores
18 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I am using a machine with an intel processor with 14 physical cores (among those, 6 performance cores). If I run this code I get an error message.
numWorkers = 8;
p = parpool(numWorkers);
n = 10;
parfor i=1:n
disp(i)
end
The error message is the following:
Error using parpool (line 132)
Too many workers requested. The profile "Threads" has the NumWorkers property set to a
maximum of 6 workers but 8 workers were requested. Either request a number of workers
less than NumWorkers, or increase the value of the NumWorkers property for the profile
(up to a maximum of 512 for thread-based pools).
I don't understand the error message. Does this mean that the maximum number of cores I can use on my machine is 6, even though it has 14 physical cores? Matlab cannot use cores that are not performance cores?
Thanks in advance for any feedback on this.
0 commentaires
Réponse acceptée
Epsilon
le 17 Août 2025
Hi Alessandro,
The Parallel Computing Toolbox in MATLAB supports both Performance (P) and Efficiency (E) cores. P cores offer high computational power and are ideal for compute-bound tasks, while E cores are optimized for power efficiency and better suited for lighter workloads. Starting with R2024a, the 'Processes' profile defaults to using a number of workers equal to the number of P cores on the machine, ensuring optimal performance for intensive computations.
You can adjust the number of workers either through the MATLAB GUI or programmatically:
In the GUI, navigate to Parallel Computing > Create and Manage Clusters, then select the 'Processes'profile in the Cluster Profile Manager and edit the NumWorkers setting.
Programmatically, use:
c = parcluster('Processes')
c.NumWorkers = 10;
saveProfile(c)
Note: For non-compute-bound tasks such as disk I/O or memory-intensive operations, increasing the number of workers beyond the default may improve performance. However, if you're also modifying the number of threads, ensure that the product of workers and threads does not exceed the number of physical cores. Always increase the number of workers gradually and monitor performance, memory usage, and system stability to avoid degradation or crashes. Make sure your system has sufficient memory to support the configured number of MATLAB workers and the workload being executed.
For more details you may also refer to:
3 commentaires
Walter Roberson
le 17 Août 2025
I ran this in my Matlab 2024b
I am a bit confused about which version you are using? Your question is marked as you using R2025a, but your discussion is R2024b ?
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Parallel Computing Fundamentals dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!