p2p_role_maker.py 505 字节
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17


class P2PRoleMakers(object):
    def __init__(self):
        from mpi4py import MPI
        self.comm = MPI.COMM_WORLD
        self.MPI = MPI

    def get_endpoints(self, port_start):
        rank = self.comm.Get_rank()
        size = self.comm.Get_size()
        import socket
        local_ip = socket.gethostbyname(socket.gethostname())
        hostname = socket.gethostname()
        all_ips = self.comm.allgather(local_ip)
        all_ports = [str(port_start + rank) for ]
        return all_ports