[RndTbl] reliable way of counting real CPUs under Linux?

Adam Thompson athompso at athompso.net
Mon Apr 21 10:15:14 CDT 2014


On 14-04-21 09:02 AM, Grigory Shamov wrote:
> Do you know if AMD Opterons support HT?
>
> model name	: Quad-Core AMD Opteron(tm) Processor 2376
> flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat
> pse36 clflush mmx fxsr sse sse2 *ht* etc. etc.
>
> model name	: Six-Core AMD Opteron(tm) Processor 2431
> flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat
> pse36 clflush mmx fxsr sse sse2 *ht* etc. etc.
>
Not historically, but apparently some newer ones may.  The output you 
show above certainly suggests that they do.

To count physical sockets, physical cores, and virtual cores (aka HT), 
look at the "physical id", "siblings", "core id", and "cpu cores" values 
in /proc/cpuinfo.

If "siblings" > "cpu cores", HT (or something similar) is turned on and 
functioning.

Actual # of physical cores should be #-of-distinct-physical-ids * "cpu 
cores".  Note that some very strange systems may not always have 
constant "cpu cores" value for every physical socket.  I don't think 
you'll encounter this situation in your work, but better to not make 
assumptions.

-- 
-Adam Thompson
  athompso at athompso.net



More information about the Roundtable mailing list