How to tell if number of CPUs includes SMT
Sorry if this is the wrong place to ask this...
I currently find the number of CPUs installed on a server by using
but when I run on certain Intel processor machines, Hyper-Threading (HT, aka SMT) is enabled and artificially seems to increase the number of processors reported by sysconf(). To get around this, I grep through /proc/cpuinfo looking for "ht" in the flags. Now I find that on some AMD processors I see "ht" in the flags, but this doesn't seem to increase the number of processors being reported, so I am incorrectly reducing the number of processors I think are available for use.
How or what causes the kernel to increase the number of real processors due to HT? Is there a way to find the true number of processors not counting HT?