Code get stuck at dist.init_process_group with 2 machines

Omer_Cohen1: <p>Hey,</p>
<p>I am trying to run simple code on 2 machines (both Windows 10).</p>
<p>When I am running main.py twice on first machine,<br>
the code runs fine (2 processes, 1 on each GPU, 2 GPU’s total).<br>
I have checked that ranks are correct.<br>
Commands:<br>
python main.py --start_rank=0<br>
python main.py --start_rank=1</p>
<p>world_size=2<br>
Backend is ‘gloo’<br>
MASTER_ADDR is 127.0 0.1<br>
MASTER_PORT is a free port.</p>
<p>When I am running main.py once on each machine, the code hangs forever (on both machines) at this line:</p>
<pre><code>  dist.init_process_group(
      backend=args.backend,
      init_method=args.init_method,
      world_size=args.world_size,
      rank=args.rank,
      timeout=timedelta(seconds=30)
  )
</code></pre>
<p>world_size=2<br>
Backend is ‘gloo’.<br>
MASTER_ADDR is the ip of the first machine (machine with rank 0)<br>
MASTER_PORT is a free port.</p>
<p>I was able to ping between the machines,<br>
and created anti-virus rules for connections between them.</p>
<p>I think it might be a connection issue (because it works on first machine) but not sure (because I am not getting timeout after 30 seconds).</p>
<p>Any ideas?</p>

cbalioglu: <p>Which version of PyTorch are you using? In our nightly builds (and in the upcoming v1.11 release) we are outputting warning logs to troubleshoot connection issues during process initialization. Also make sure that your port range is open externally. Ping might work, but connection can still fail in such case.</p>

Omer_Cohen1: <p>Thanks.</p>
<p>I am using 1.10.2</p>
<p>I have opened the connection for all ports between the machines.<br>
I can see that the anti-virus accepts them all.<br>
(Some of them in tcp and some udp).</p>
<p>When i am looking at the logs, i can see that the connections are done in multiple random ports and not just on master port. I gess this is how gloo works ?</p>
<p>Would you recommend me to move to nightly build ? More ideas ?</p>

cbalioglu: <p>If you don’t see any connection failures in the log files, this might also be an issue in your training script. For instance if you don’t call your collective operations in the same order in all your ranks, they will block waiting others.</p>

Omer_Cohen1: <p>The code hangs forever at init_process_group, the are no collective operations before this line.</p>

Yanli_Zhao: <p>Try to export GLOO_SOCKET_IFNAME?</p>

Omer_Cohen1: <p>Yes, i set os.environ[GLOO_SOCKET_IFNAME],</p>
<p>On first machine it is ‘Wi-Fi’<br>
On second machine it is ‘WiFi’</p>
<p>Didn’t help…</p>

HuYang719: <p>Hi Omer, you may need to use <code>ip addr</code> or <code>ifconfig</code> to check the network interface that you need and export it in GLOO_SOCKET_IFNAME. Is the <code>Wi-Fi</code>/<code>WiFI</code> you get from these commands?</p>

Omer_Cohen1: <p>I was able to get the interface name from this command:<br>
‘netsh interface show interface’</p>
<p>then i got this (example on first machine):</p>
<p><img src="https://discuss.pytorch.org/uploads/default/original/3X/6/2/62c8ee2bb82c83458330785b8576cad8ecdb77be.png" alt="image" data-base62-sha1="e5ThzoX33oALcwXOKZJb6HUnTz0" width="306" height="66"></p>
<p>when i tried to use the interface names from ipcofig/all, i got this exceptions:<br>
[enforce fail at …\third_party\gloo\gloo\transport\uv\device.cc:164] false. Unable to find address for: ‘the IFNAME that I tried’<br>
I tried all the interface names…</p>
<p>am I doing it correctly ?</p>

HuYang719: <p>Hi I suggested you use <code>ip addr</code>, you may see something like: <code>lo</code> / <code>eth0</code> /<code>...</code>, you may choose one as interface.</p>

Omer_Cohen1: <p>Hey, I think that ip addr is for linux, and I am working with windows.<br>
I have tried all names from ipconfig/all and non of then worked.<br>
The only one that didn’t give an error was ‘Wi-FI’<br>
(I took it from ‘netsh interface show interface’ command - image in previous message).</p>
<p>Can u think on something else ? why am I not getting timeout ? it just hangs forever…</p>