Add a line about socket hopefully will avoid port conflicts

This commit is contained in:
Yin Li 2020-07-28 07:38:07 -07:00
parent 0d41bdae26
commit b54fc4ba3a

View File

@ -398,6 +398,7 @@ def dist_init(rank, args):
addr = socket.gethostname() addr = socket.gethostname()
with socket.socket() as s: with socket.socket() as s:
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind((addr, 0)) s.bind((addr, 0))
_, port = s.getsockname() _, port = s.getsockname()