Re: # of Physical processors in a Unix system



pbaronia wrote:
Hi all, How do we find the number of physiscal processors in a linux
system. To be very specific I am NOT talking about the logical
processors.

regards, Prashant

It's a fuzzy line between multicore and multiprocessor thanks to things like Hyperthreads and shared caches. Sometimes you need to know where the cache is.

Intel has app note AP-485, which tells you how to use the CPUID instruction to determine this.

http://www.intel.com/design/xeon/applnots/241618.htm

CPUID is an unprivileged instruction, but there is a Linux cpuid module that provides device nodes that let you read the output of the CPUID instruction: /dev/cpu/[01234]/cpuid. It might not be loaded by default, in which case you can do a 'modprobe cpuid' to bring it in.

Be warned, the app note is difficult to follow due to all the legacy baggage it documents. It claims that there is identification for unique caches, but I have yet to try it on Woodcrest.

I am just starting to look at this on Opteron, but naturally AMD chose to do something completely different as far as CPU identification.

Good luck.

John
.



Relevant Pages

  • BTW: IMHO there is rich sample of using CPUID in the web (open source lib. under the MPL)
    ... CarbonSoft cxCpu 4 provides a comprehensive class library allowing you, ... having to worry about different vendor's implementation of the CPUID ... The CPUID instruction takes a single parameter that identifies the execution ... The execution level determines what information is to be returned, ...
    (borland.public.delphi.language.basm)
  • Re: Test whether rdmsr instruction is supported.
    ... All modern processors support cpuid. ... in HAL without any speacial tricks like affinity or raising irql. ... Volodymyr, could you provide a symbol which contains this code. ... "...if you want to use the CPUID instruction to check processor ...
    (microsoft.public.development.device.drivers)
  • Re: Source code for CPUCount20 Intel utility
    ... > Hi Vladimir, ... > Thanks for the code suggstion and the link to CPUID utility. ... > Microsoft example about how to use CPUID instruction. ... > (sigle/multiple core processor). ...
    (microsoft.public.win32.programmer.kernel)
  • New Application: CPUID Explorer
    ... I've uploaded a new utility program that shows how to use the CPUID instruction to ... It is now available from my MVP Tips site. ...
    (microsoft.public.vc.mfc)