Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 617
Dervin Thunk Avatar asked Nov 26 '10 11:11

Dervin Thunk


People also ask

What are the parallel processing architectures?

There are three basic parallel processing hardware architectures in the server market such as symmetric multiprocessing (SMP), massively parallel processing (MPP), and non-uniform memory architecture (NUMA).

Is my computer AMD64?

If it's x64, then it's AMD64, if it's x86, then it's i386 :) If you are unable to find “This PC” on your desktop, then open the start menu, then click on the settings icon, then click on “System”, then click on “About”, and you should be able to see the 'system type' there.

How do I find my Windows architecture command line?

Go to Start » Run and then type cmd . Now you will be in command prompt. There you can type systeminfo and then press enter.

How do I find my MAC architecture?

To determine system type for macOSOpen the Apple menu and choose About This Mac. Click the System Report button. If you do not see a System Report button, click the More Info button and then click the System Report button. Under the Hardware panel, locate the Processor Name in the Hardware Overview.


2 Answers

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.

like image 54
Alex Brown Avatar answered Oct 15 '22 08:10

Alex Brown


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.

like image 21
Andre Holzner Avatar answered Oct 15 '22 10:10

Andre Holzner