parfor number of cores

21 次查看(过去 30 天)
Alessandro
Alessandro 2025-8-13
编辑: Torsten 2025-8-18
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.

采纳的回答

Epsilon
Epsilon 2025-8-17
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 个评论
Walter Roberson
Walter Roberson 2025-8-17
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 ?
Alessandro
Alessandro 2025-8-17
编辑:Alessandro 2025-8-18
Thanks for spotting this inconsistency, @Walter Roberson. I am using R2024b and I have edited the question accordingly.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Parallel Computing Fundamentals 的更多信息

产品


版本

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by