我需要在 1 個 CPU 上測試多執行緒程式的效能,但我有一台雙 CPU 機器。我需要設定與那些共享插槽的邏輯 CPU 的親和力,否則它們會從大量的 FSB 中受益匪淺。我嘗試了親和力 0-7 和 8-15,但結果差異很大,第一個更快。因此我不知道哪個邏輯CPU 共享它們的套接字。
lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 16
On-line CPU(s) list: 0-15
Thread(s) per core: 1
Core(s) per socket: 8
CPU socket(s): 2
NUMA node(s): 4
Vendor ID: AuthenticAMD
CPU family: 16
Model: 9
Stepping: 1
CPU MHz: 800.000
BogoMIPS: 4000.40
Virtualization: AMD-V
L1d cache: 64K
L1i cache: 64K
L2 cache: 512K
L3 cache: 5118K
NUMA node0 CPU(s): 0-3
NUMA node1 CPU(s): 4-7
NUMA node2 CPU(s): 12-15
NUMA node3 CPU(s): 8-11
~]$ cat /proc/cpuinfo | grep 'core id'
core id : 0
core id : 1
core id : 2
core id : 3
core id : 0
core id : 1
core id : 2
core id : 3
core id : 0
core id : 1
core id : 2
core id : 3
core id : 0
core id : 1
core id : 2
core id : 3
答案1
前 8 個處理器來自一個晶片,後 8 個處理器來自另一個晶片。您可以透過 來區分physical id
。至於性能上的差異 - 我目前不知道。
答案2
2 個 CPU 的延遲很重要。閱讀主機板的數據表,您就會知道其中一個對於運行平台來說是原始且必不可少的。
例如,您可以透過填充socket0和socket0、socket1來運行平台,但不能只透過填充socket1來運行平台。
這就是為什麼你在每一項上都有不同的表現。無論如何,它們應該相似,但不會完全相同。