I need to test performance of a multithreaded program on 1 CPU, but I have a dual CPU machine. I need to set affinity to those logical CPU's, that share their socket, oterwise they strongly benefit from larger number of FSB's. I tried affinity 0-7 and 8-15, but the results differ considerably, the first being faster. Therefore I do not know which logical CPU's share their socket.
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