From 8359b5190be9b5f88066d7d4a2f67af732daf802 Mon Sep 17 00:00:00 2001 From: dongdaxiang Date: Tue, 26 Mar 2019 14:48:38 +0800 Subject: [PATCH] run pre-commit check files and fix code style problem test=develop --- p2p_role_maker.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 p2p_role_maker.py diff --git a/p2p_role_maker.py b/p2p_role_maker.py new file mode 100644 index 00000000000..0876f09fccb --- /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 -- GitLab