py-cpuinfo icon indicating copy to clipboard operation
py-cpuinfo copied to clipboard

Wrong processors count reporting 64 instead of 80

Open gdelfino opened this issue 7 years ago • 3 comments

I am getting the wrong value here:

>>> import cpuinfo
>>> cpuinfo.get_cpu_info()["count"]
64

The correct value is 80 and can be obtained with PowerShell:

Get-WmiObject -class Win32_Processor | Select-Object -ExpandProperty NumberOfLogicalProcessors | Measure-Object -Sum | Select -Expand Sum
80

The specs of the machine are:

  • Operating System: Windows Server 2012 R2
  • Python version: 3.6.4
  • Version of py-cpuinfo: 3.3.0
PS C:\Users\DelfinoG> Get-WmiObject -class Win32_Processor | Select-Object Caption,DeviceID,Manufacturer,Name,NumberOfCo
res,NumberOfLogicalProcessors


Caption                   : Intel64 Family 6 Model 85 Stepping 4
DeviceID                  : CPU0
Manufacturer              : GenuineIntel
Name                      : Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz
NumberOfCores             : 20
NumberOfLogicalProcessors : 40

Caption                   : Intel64 Family 6 Model 85 Stepping 4
DeviceID                  : CPU1
Manufacturer              : GenuineIntel
Name                      : Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz
NumberOfCores             : 20
NumberOfLogicalProcessors : 40

Any workaround to get that 80 from Python directly?

gdelfino avatar Jan 26 '18 22:01 gdelfino

Right now I am using multiprocessing to get the cpu count:

import multiprocessing
print(multiprocessing.cpu_count())

I'll have to look at other ways to do it more accurately: https://stackoverflow.com/questions/1006289/how-to-find-out-the-number-of-cpus-using-python/

It would also be nice to have the number of physical or virtual cores: #7

workhorsy avatar Jan 27 '18 02:01 workhorsy

This bug has more information on the problem: https://bugs.python.org/issue30581

workhorsy avatar Feb 02 '21 15:02 workhorsy

Hello,I had the same problem on windows, but not on linux, @gdelfino have you solved this problem?

kShines avatar Feb 11 '22 06:02 kShines