The relationship of several concepts:
Number(logical CPU) = Number(physical CPU) * Number(cores per physical CPU) * Number(Threads per core)
For Linux
-
Get from the file /proc/cpuinfo
Number of Physical CPU:cat /proc/cpuinfo | grep “physical id” | sort | uniq | wc -l
Number of Cores per Physical CPU:
cat /proc/cpuinfo | grep “cpu cores” | uniq
Number of Logical CPU:
cat /proc/cpuinfo | grep “processor” | wc -l
Number of Threads per Core:
Number(logical CPU) / Number(physical CPU) / Number(cores per physical CPU)
Sample: 2 physical cpu, 8 cores per physical cpu, 32 logical cpu, 32/8/2=2 threads per core
-
Use command “lscpu”
CPU(s): number of logical CPU
Thread(s) per core:
Core(s) per socket:
CPU socket(s):
L1d cache: Level 1 data cache
L1I cache: Level 1 index cache
L2 cache: Level 2 cache
L3 cache: Level 3 cacheSample: 32 logic cpu, 2 threads per core, 8 cores per physical cpu, 2 physical cpu
For Windows
Execute the commands:
cmd
wmic
cpu get *
Sample:
1 row: 1 physical cpu
NumberOfCores: 4 cores per physical cpu
NumberOfLogicalProcessors: 8 logical cpu
Number of thread per core: 8/4/1=2