使用 lscpu
命令,可以查看 CPU 信息,具体如下:
[root@node_name ~]$ lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 72
On-line CPU(s) list: 0-71
Thread(s) per core: 2
Core(s) per socket: 18
Socket(s): 2
NUMA node(s): 2
Vendor ID: GenuineIntel
CPU family: 6
Model: 85
Model name: Intel(R) Xeon(R) Gold 5220 CPU @ 2.20GHz
Stepping: 7
CPU MHz: 999.963
CPU max MHz: 3900.0000
CPU min MHz: 1000.0000
BogoMIPS: 4400.00
Virtualization: VT-x
L1d cache: 32K
L1i cache: 32K
L2 cache: 1024K
L3 cache: 25344K
NUMA node0 CPU(s): 0-17,36-53
NUMA node1 CPU(s): 18-35,54-71
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ssstant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx cid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb cat_l3 cdp_l3 istibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm mpx rdt_at clwb intel_pt avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat_req pku ospke avx512_vnni md_clear spec_ctrl intel_stibp flush_l1d arch_capabilities
其中,各结果字段的含义如下:
字段名 | 字段含义 | 字段样例值 |
---|---|---|
Architecture | CPU 架构类型 | x86_64 |
CPU op-mode(s) | CPU 支持的操作模式 | 32-bit, 64-bit |
Byte Order | 系统字节序(包括大端 Big Endian 或小端 Little Endian ) | Little Endian |
CPU(s) | 逻辑 CPU 个数(物理 CPU 核心数 × \times × 每个核心的线程数) | 72 |
Thread(s) per core | 每个 CPU 核心的线程数(基于超线程技术) | 2 |
Core(s) per socket | 每个 CPU 插槽核数(每个物理 CPU 的核心数) | 18 |
Socket(s) | CPU 插槽数(物理 CPU 数量) | 2 |
NUMA node(s) | 非统一内存访问节点数量 | 2 |
Vendor ID | CPU 制造商(如 Intel 或 AMD ) | GenuineIntel |
CPU family | CPU 系列 | 6 |
Model | CPU 型号 | 85 |
Model name | CPU 型号名称 | Intel(R) Xeon(R) Gold 5220 CPU @ 2.20GHz |
Stepping | CPU 的制造版本号(用于区分一系列不同批次的 CPU) | 7 |
CPU MHz | CPU 的时钟频率 | 999.963 |
CPU max MHz | CPU 的最大时钟频率 | 3900.0000 |
CPU min MHz | CPU 的最小时钟频率 | 1000.0000 |
BogoMIPS | 指每秒钟执行一百万次基准测试循环所需的处理器时间 | 4400.00 |
Virtualization | CPU 支持的虚拟化技术 | VT-x |
L1d cache | 一级数据缓存 (Data Cache) | 32K |
L1i cache | 一级指令缓存 (Instruction Cache) | 32K |
L2 cache | 二级缓存 | 1024K |
L3 cache | 三级缓存 | 25344K |
NUMA node0 CPU(s) | 表示第 1 个 NUMA 节点上可用的 CPU 数量 | 0-17,36-53 |
NUMA node1 CPU(s) | 表示第 2 个 NUMA 节点上可用的 CPU 数量 | 18-35,54-71 |
Flags | 表示 CPU 支持的特性,如 SSE、AVX 等指令集扩展 | 略 |
其中,各类基本概念如下:
CPU 插槽数(Socket(s)
)是指主板上的 CPU 插槽数量,即可以插入 CPU 的物理位置。这决定了主板可以支持的 CPU 类型和数量。
CPU 核心数(Core(s)
)是指 CPU 内部的处理器核心数量,每个核心都可以独立执行指令。更多的 CPU 核心通常意味着更好的多任务处理能力和更高的性能。
CPU 线程数(Thread(s)
)是指每个 CPU 核心可以同时运行的线程数量。通过超线程技术,一个物理 CPU 核心可以模拟出多个逻辑核心,从而提高处理器的并发处理能力。一般来说,线程数越多,处理器越能够同时处理更多的任务。
逻辑 CPU 个数(CPU(s)
)等于 “每个核心的进程数”(Thread(s) per core
)乘以 “每个插槽的核心数”(Core(s) per socket
)再乘以 “插槽数”(Socket(s)
),即
CPU(s)
=
"Socket(s)"
×
"Core(s)
per
socket"
×
"Thread(s)
per
core"
\texttt{CPU(s)} = \texttt{"Socket(s)"} \times \texttt{"Core(s) per socket"} \times \texttt{"Thread(s) per core"}
CPU(s)="Socket(s)"×"Core(s) per socket"×"Thread(s) per core"
NUMA (Non-Uniform Memory Access) 是一种计算机架构,其处理器和内存分布在多个节点中。每个 NUMA 节点都包含一组处理器和内存,这些处理器和内存之间的访问速度比跨越节点的访问速度更快。因此,在使用 NUMA 架构的系统中,将任务分配给就近的 NUMA 节点(即具有最快访问速度的节点)可以获得更好的性能。