Processors
Intel® Processors, Tools, and Utilities
14530 Discussions

Xeon - way to get number of cores per processor

jaroslawmusial
Beginner
1,113 Views

Hi. What is the "bulletproof" way of getting number of processor cores for Xeons (especially old ones)? 

I am asking because there is value called  Maximum number of processor cores in physical processor package (CPUID EAX[31:26] ) which usually shows good value but for some reason for old processors it may be wrong. For example Intel Processor E7220, 2 cores per processor - for 4-way server it showed 4 cores per processor. Oddly /proc/cpuinfo shows good value.

Could someone help with that?

0 Kudos
4 Replies
n_scott_pearson
Super User
1,094 Views

I use the Extended Topology Enumeration Leaf (0x0B) if it is supported:

  • Invoking CPUID with EAX = 0x0B, ECX = 0x00 will yield NumThreadsPerCore in EBX[0:15].
  • Invoking CPUID with EAX = 0x0B, ECX = 0x01 will yield NumThreads in EBX[0:15].
  • NumCores = NumThreads / NumThreadsPerCore.

If the Extended Topology Enumeration Leaf (0x0B) is not supported, my fallback is to use the Deterministic Cache Parameters

  • Invoking CPUID with EAX = 0x01, ECX = 0x00 will yield NumThreads in EBX[16:23].
  • Invoking CPUID with EAX = 0x04, ECX = 0x00 will yield NumCoresLessOne in EAX[26:31].
  • NumCores = NumCoresLessOne + 1.
  • NumThreadsPerCore = NumThreads / NumCores.

Hope this helps,

...S

0 Kudos
jaroslawmusial
Beginner
1,079 Views

Thanks

We do it in similar way but unfortunately  that  is when we also observe double core count. 

 

Any idea what else we could take a look at? 

0 Kudos
n_scott_pearson
Super User
1,069 Views

No that's the two ways that were recommended to me by the processor folks (*many* moons ago). I was in the Desktop Boards org, so rarely had to deal with multiprocessor situations, however.

You could try posting this question in the Servers forum; you should see more Xeon-savvy folks over there...

...S

0 Kudos
jaroslawmusial
Beginner
1,038 Views

Hi

Thanks, I will post question in that forum.

0 Kudos
Reply