Код: Выделить всё
import os
from mpi4py import MPI
import psutil
comm = MPI.COMM_WORLD
rank = comm.Get_rank()
PID = os.getpid()
cpu_affinity = psutil.Process().cpu_num()
print(f'rank: {rank} has PID: {PID} with affinity {cpu_affinity}')
Код: Выделить всё
rank: 5 has PID: 2451954 with affinity 16
rank: 2 has PID: 2451923 with affinity 15
rank: 0 has PID: 2451911 with affinity 20
rank: 4 has PID: 2451944 with affinity 18
rank: 3 has PID: 2451935 with affinity 16
rank: 1 has PID: 2451919 with affinity 17
С --display-map:
Код: Выделить всё
Data for JOB [62540,1] offset 0 Total slots allocated 24
======================== JOB MAP ========================
Data for node: triton Num slots: 24 Max slots: 0 Num procs: 6
Process OMPI jobid: [62540,1] App: 0 Process rank: 0 Bound: UNBOUND
Process OMPI jobid: [62540,1] App: 0 Process rank: 1 Bound: UNBOUND
Process OMPI jobid: [62540,1] App: 0 Process rank: 2 Bound: UNBOUND
Process OMPI jobid: [62540,1] App: 0 Process rank: 3 Bound: UNBOUND
Process OMPI jobid: [62540,1] App: 0 Process rank: 4 Bound: UNBOUND
Process OMPI jobid: [62540,1] App: 0 Process rank: 5 Bound: UNBOUND
=============================================================
Код: Выделить всё
[triton.ecn.purdue.edu:2486163] MCW rank 0 is not bound (or bound to all available processors)
[triton.ecn.purdue.edu:2486163] MCW rank 1 is not bound (or bound to all available processors)
[triton.ecn.purdue.edu:2486163] MCW rank 2 is not bound (or bound to all available processors)
[triton.ecn.purdue.edu:2486163] MCW rank 3 is not bound (or bound to all available processors)
[triton.ecn.purdue.edu:2486163] MCW rank 4 is not bound (or bound to all available processors)
[triton.ecn.purdue.edu:2486163] MCW rank 5 is not bound (or bound to all available processors)
Я попробовал --map-by core без передачи --cpu-set и фактически назначает каждый процесс определенному ядру, но не позволяет мне выбирать, какие процессоры я хочу использовать (
Код: Выделить всё
--map-by coreПодробнее здесь: https://stackoverflow.com/questions/793 ... ing-mpirun
Мобильная версия