Python's os.cpu_count() returns the wrong number of cores on my Mac.
macOS system report:
Model Name: MacBook Pro
Model Identifier: MacBookPro14,3
Processor Name: Quad-Core Intel Core i7
Processor Speed: 2.9 GHz
Number of Processors: 1
Total Number of Cores: 4
Yet os.cpu_count() returns 8.
Is that a bug or I'm missing something?
This is Python 3.8.6; I also checked the Python v2 that comes with the system (using multiprocessing.cpu_count()) and the result is the same.
os.cpu_count() returns the number of logical processors within the machines CPU, also known as threads. If it returns 8 then your machine has 8 threads, not cores.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With