PARFOR not using all logical cores

83 views (last 30 days)
Shlomo Geva
Shlomo Geva on 14 Aug 2019
Answered: Jackson Burns on 14 Aug 2019
I have seen this quastion asked many times over several years, and I was notable to find a satisfactory answer, let alone a solution - if exists.
Matlab does not seem to use all available logical cores.
True for at least two Macs I tested. One with 2018b and the other with 2019a.
The Mac has 4 physical cores, and 8 logical cores - MATLAB only uses 4 cores.
Does PARFOR only use the physical cores?
Otherwise, how can it be "convinced" to use all logical cores?
The suggestion to edit the parallel preferences is not useful and it does not make a difference.
Does anyone have an actual solution or can advise authoritatively not to waste time on this?
Thanks!!
More Info:
This is MATLAB's report on what's going on:
>> feature('numCores')
MATLAB detected: 4 physical cores.
MATLAB detected: 8 logical cores.
MATLAB was assigned: 8 logical cores by the OS.
MATLAB is using: 4 logical cores.
MATLAB is not using all logical cores because hyper-threading is enabled.
ans =
4
Matlab Version:
-----------------------------------------------------------------------------------------------------
MATLAB Version: 9.5.0.1033004 (R2018b) Update 2
MATLAB License Number: 31
Operating System: Mac OS X Version: 10.13.6 Build: 17G8030
Java Version: Java 1.8.0_152-b16 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
-----------------------------------------------------------------------------------------------------
Computer:
MacBook Pro (15-inch, 2017)
Processor 2.9 Ghz Intel Core i7
Memory 16GB 2133 MHz LPDDR3

Answers (1)

Jackson Burns
Jackson Burns on 14 Aug 2019
This answer to the same question gives a comprehensive explanation. The short version: No, MATLAB will not make use of all logical cores because of hyperthreading.

Community Treasure Hunt

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

Start Hunting!

Translated by