diff --git a/p2p_role_maker.py b/p2p_role_maker.py new file mode 100644 index 0000000000000000000000000000000000000000..0876f09fccb126864bb2a4965364b8855e8f3fd2 --- /dev/null +++ b/p2p_role_maker.py @@ -0,0 +1,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