MPI && OMP 相关
CPU 结构:
threads per core : 超线程
cores per socket : 每个 socket 核数
sockets
MPI
每个 mpi 进程有 affinity mask,长度为 CPU cores
--bind-to core
: affinity mask 中只有对应 core 一位被 set
--bind-to socket
: affinity mask 中 socket 对应 所有 core 被 set
--bind-to none
多机
hostfile :
i1 slots=2 max-slots=8
i2 slots=2 max-slots=8
`which mpirun` -np 2 --host i1:1,i2:1 hostname
`which mpirun` -np 4 --hostfile ./hostfile hostname
使用脚本时开头要加 #!/bin/bash
OMP
OMP_DISPLAY_ENV=true
输出 OMP 绑定情况
OMP_PLACES=threads
, OMP_PLACES=cores
,
OMP_PLACES=sockets
hyperthread cpu 分布:/sys/devices/system/cpu/cpu0/topology$ cat thread_siblings_list