A physical core refers to an individual processing unit within a CPU. In modern CPUs, a physical core consists of an independent execution unit capable of performing calculations and running instructions.
A logical core, also known as a virtual core or thread, is a concept that arises from the use of technologies like Hyper-Threading or simultaneous multithreading (SMT). These technologies allow a single physical core to behave as if it were multiple logical cores. Some resources inside a physical core are duplicated to streamline this.
In some chip architectures your cores may instead be labelled as performance or efficiency cores. For more information on these, refer to the
.
Compute-bound mathematical operations tend to gain the most benefit from running exclusively on physical cores (or physical "performance" cores where available). However, if your parallel code is not compute bound (for example does significant disk I/O or memory intensive operations) then you may gain some performance benefit from increasing the number of workers above the default value.
To alter the maximum number of workers allowed by the 'Processes' or 'local' profile:
Setting the number of parallel workers too high may impact your performance and machine's stability. Always ensure the machine has enough memory to run the number of MATLAB workers and code you wish to execute. We recommend that if you choose to exceed the default number of workers, you increase this setting gradually and measure your application's performance, memory usage and stability.
- Using the MATLAB GUI: From the Parallel Computing menu > Create and Manager clusters...> inside the 'Cluster Profile Manager' select the 'Processes' or 'local' profile and edit the number of workers (NumWorkers) to start on your local machine.
- Programmatically:
c = parcluster('Processes')
c.NumWorkers = 10;
saveProfile(c)
Note: if you are also altering the NumThreads we recommend that NumWorkers x NumThreads <= Number of Physical Cores on the system.