How do I find information about the parallel architecture of my CPU?
I'm Intel(R) Core(TM)2 Duo CPU T6600 @ 2.20GHz (as told to me by cat /proc/cpuinfo
), but I need to go into as much depth as possible re. architecture for working on parallel programming (likely using pthreads
). 开发者_开发问答Any pointers?
The sys filesystem knows all about this:
$ ls /sys/devices/system/cpu
cpu0 cpu2 cpuidle possible sched_mc_power_savings
cpu1 cpu3 online present
$ ls /sys/devices/system/cpu/cpu0/topology/
core_id core_siblings_list thread_siblings
core_siblings physical_package_id thread_siblings_list
Here's the documentation
Using this filesystem, you can find out how many CPUs you have, how many threads they have, which CPUs are next to which other cpus, and which CPUs share caches with which other ones.
For example - Q: which CPUs does cpu0 share it's L2 cache with?
$ cat /sys/devices/system/cpu/cpu0/cache/index2/{type,level,shared_cpu_list}
Unified
2
0-1
A: It shares it's unified L2 cache with cpu1 (and itself).
Another example: Q: which CPUs are in the same physical package as cpu0 (on a larger machine):
cat /sys/devices/system/cpu/cpu0/topology/core_siblings
00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000055
A: cores 0, 2, 4 and 6. (taken from the bit pattern above, lsb=cpu0)
not all linux systems have the sys filesystem in, and it's not always in root. (possibly in proc/sys?). the thread_siblings_list form is not always available, but the thread_siblings (bit pattern) one is.
I found lstopo
of the hwloc project quite useful. This will give you graphical output
(based on information found in /proc
and /sys
as Alex Brown described)
of the topology of your system (see their webpage for an example). From the graphical
output you can easily see
- if hyperthreaded cores are present
- which cpu numbers correspond are different hyperthreads on the same physical core
- how many CPU sockets are used
- which cores share the L3 cache
- if the main memory is common between CPU sockets or whether you are on a NUMA system
etc.
If you need to access this information programmatically, there is some documentation how hwloc
can be used as a library.
To get the lowest detail about the processor a system engineer could run their equivalent to CPUZ and get to the lowest levels when permitted in law for the home or office address where the processor is to be installed and used. Software engineers and developers are not usually permitted to know that level of detail but I can tell you that the architecture can be of the type where a processor spawns or instances a virtual second processor giving close to x1.75 processing equivalent, or there are real physical multiple cores on the same die using technology and control methods as enhancements of previous implementations of the design. The Core processor has an interface for system programmers, application developers to use and this mode of access would be the expectation of Intel, details available from them.
精彩评论