title: pytorch : Runtime error using Distributed with gloo
body: <p>I am trying to use the PyTorch distributed package and gloo backend.</p>
  
  <p>But, I get the following error.</p>
  
  <p>Master:</p>
  
  <pre class="lang-py prettyprint-override"><code>Traceback (most recent call last):
    File "Distributed.py", line 169, in &lt;module&gt;
      init_processes(args.rank, size, run)
    File "Distributed.py", line 80, in init_processes
      dist.init_process_group(backend=backend, rank=rank, world_size=size)
    File "/usr/local/lib/python3.5/dist-packages/torch/distributed/__init__.py", line 49, in init_process_group
      group_name, rank)
  RuntimeError: [enforce fail at /pytorch/torch/lib/gloo/gloo/transport/tcp/device.cc:127] rp != nullptr. Unable to find address for: &lt;My specified Ip&gt; at /pytorch/torch/lib/THD/process_group/General.cpp:17
  </code></pre>
  
  <p>And otrher worker get:</p>
  
  <pre class="lang-py prettyprint-override"><code>RuntimeError: [enforce fail at /pytorch/torch/lib/gloo/gloo/transport/tcp/device.cc:127] rp != nullptr. Unable to find address for: 10.37.0.1 at /pytorch/torch/lib/THD/process_group/General.cpp:17
  </code></pre>
  
  <p>Below is how I initialize:</p>
  
  <pre class="lang-py prettyprint-override"><code>def init_processes(rank, size, fn, backend='gloo'):
      """ Initialize the distributed environment. """
  
      os.environ['MASTER_ADDR'] = &lt;My specified Ip&gt;
      os.environ['MASTER_PORT'] = '8888' if rank == 0 else '31566'
  
      print("Init Processes -&gt;", 'backend:', backend, 'rank:', rank, 'MASTER_ADDR:', os.environ['MASTER_ADDR'],
            'MASTER_PORT:', os.environ['MASTER_PORT'])
      dist.init_process_group(backend=backend, rank=rank, world_size=size)
      fn(rank, size)
  </code></pre>
  
  <p>Any thoughts on what may be causing this or how I can fix it ? Thx</p>
  
  <p>ps. I use docker env with python 3.5 and PyTorch 0.3.1 with cuda9.0.</p>