mpirun结合numactl对每个进程进行精细的核心、内存绑定

1
2
3
4
5
6
7
8
9
#!/bin/bash
rank=$PMI_RANK
case $rank in
0) numactl --physcpubind=0-15 --membind=0 "$@" ;;
1) numactl --physcpubind=16-31 --membind=0 "$@" ;;
2) numactl --physcpubind=32-47 --membind=1 "$@" ;;
3) numactl --physcpubind=48-63 --membind=1 "$@" ;;
*) echo "Unsupported rank $rank"; exit 1 ;;
esac

对于intel mpi:

1
mpirun -genv I_MPI_PIN=off bind.sh hostname

可以使用numactl -s来打印绑定情况:

1
mpirun -genv I_MPI_PIN=off bind.sh numactl -s

mpirun结合numactl对每个进程进行精细的核心、内存绑定

https://blog.zrhan.top/2025/04/17/mpirun结合numactl对每个进程进行精细的核心、内存绑定/

作者

ZRHan

发布于

2025-04-17

更新于

2025-04-17

许可协议