def get_id_within_node(comm=None):
from mpi4py import MPI
if comm is None: comm = MPI.COMM_WORLD
rank = comm.rank
nodename = MPI.Get_processor_name()
nodelist = comm.allgather(nodename)
return len([i for i in nodelist[:rank] if i==nodename])
评论列表
文章目录