Repository: pytorch
Issue: Error when running DDP examples to train between nodes
Labels: oncall: distributed

### 🐛 Describe the bug

I'm running this example on two nodes each with 4 V100 GPUs:
https://github.com/pytorch/examples/blob/main/distributed/ddp-tutorial-series/multinode.py

The command I use on node1 is always the same, it's like this:
```
torchrun --nproc_per_node=4 --nnodes=2 --node_rank=1 --rdzv_id=456 --rdzv_backend=c10d --rdzv_endpoint=10.12.3.162:10010 multinode.py 50 10
``` 

On node0,  I tried two ways:
# using ip
when I use this: 
```
NCCL_DEBUG=INFO torchrun --nproc_per_node=4 --nnodes=2 --node_rank=0 --rdzv_id=456 --rdzv_backend=c10d --rdzv_endpoint=10.12.3.162:10010 multinode.py 50 10
```
The error message is:
```
[2024-04-18 10:46:28,089] torch.distributed.run: [WARNING] master_addr is only used for static rdzv_backend and when rdzv_endpoint is not specified.
[2024-04-18 10:46:28,089] torch.distributed.run: [WARNING] 
[2024-04-18 10:46:28,089] torch.distributed.run: [WARNING] *****************************************
[2024-04-18 10:46:28,089] torch.distributed.run: [WARNING] Setting OMP_NUM_THREADS environment variable for each process to be 1 in default, to avoid your system being overloaded, please further tune the variable for optimal performance in your application as needed. 
[2024-04-18 10:46:28,089] torch.distributed.run: [WARNING] *****************************************
[2024-04-18 10:46:28,089] torch.distributed.launcher.api: [INFO] Starting elastic_operator with launch configs:
[2024-04-18 10:46:28,089] torch.distributed.launcher.api: [INFO]   entrypoint       : multinode.py
[2024-04-18 10:46:28,089] torch.distributed.launcher.api: [INFO]   min_nodes        : 2
[2024-04-18 10:46:28,089] torch.distributed.launcher.api: [INFO]   max_nodes        : 2
[2024-04-18 10:46:28,089] torch.distributed.launcher.api: [INFO]   nproc_per_node   : 4
[2024-04-18 10:46:28,089] torch.distributed.launcher.api: [INFO]   run_id           : 456
[2024-04-18 10:46:28,089] torch.distributed.launcher.api: [INFO]   rdzv_backend     : c10d
[2024-04-18 10:46:28,089] torch.distributed.launcher.api: [INFO]   rdzv_endpoint    : 10.12.3.162:10010
[2024-04-18 10:46:28,089] torch.distributed.launcher.api: [INFO]   rdzv_configs     : {'timeout': 900}
[2024-04-18 10:46:28,089] torch.distributed.launcher.api: [INFO]   max_restarts     : 0
[2024-04-18 10:46:28,089] torch.distributed.launcher.api: [INFO]   monitor_interval : 5
[2024-04-18 10:46:28,089] torch.distributed.launcher.api: [INFO]   log_dir          : None
[2024-04-18 10:46:28,089] torch.distributed.launcher.api: [INFO]   metrics_cfg      : {}
[2024-04-18 10:46:28,089] torch.distributed.launcher.api: [INFO] 
[E socket.cpp:922] [c10d] The client socket has timed out after 60s while trying to connect to (10.12.3.162, 10010).
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/torch/distributed/elastic/rendezvous/c10d_rendezvous_backend.py", line 155, in _create_tcp_store
    store = TCPStore(
TimeoutError: The client socket has timed out after 60s while trying to connect to (10.12.3.162, 10010).

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/bin/torchrun", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/dist-packages/torch/distributed/elastic/multiprocessing/errors/__init__.py", line 346, in wrapper
    return f(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/torch/distributed/run.py", line 806, in main
    run(args)
  File "/usr/local/lib/python3.10/dist-packages/torch/distributed/run.py", line 797, in run
    elastic_launch(
  File "/usr/local/lib/python3.10/dist-packages/torch/distributed/launcher/api.py", line 134, in __call__
    return launch_agent(self._config, self._entrypoint, list(args))
  File "/usr/local/lib/python3.10/dist-packages/torch/distributed/launcher/api.py", line 237, in launch_agent
    rdzv_handler=rdzv_registry.get_rendezvous_handler(rdzv_parameters),
  File "/usr/local/lib/python3.10/dist-packages/torch/distributed/elastic/rendezvous/registry.py", line 65, in get_rendezvous_handler
    return handler_registry.create_handler(params)
  File "/usr/local/lib/python3.10/dist-packages/torch/distributed/elastic/rendezvous/api.py", line 258, in create_handler
    handler = creator(params)
  File "/usr/local/lib/python3.10/dist-packages/torch/distributed/elastic/rendezvous/registry.py", line 36, in _create_c10d_handler
    backend, store = create_backend(params)
  File "/usr/local/lib/python3.10/dist-packages/torch/distributed/elastic/rendezvous/c10d_rendezvous_backend.py", line 250, in create_backend
    store = _create_tcp_store(params)
  File "/usr/local/lib/python3.10/dist-packages/torch/distributed/elastic/rendezvous/c10d_rendezvous_backend.py", line 175, in _create_tcp_store
    raise RendezvousConnectionError(
torch.distributed.elastic.rendezvous.api.RendezvousConnectionError: The connection to the C10d store has failed. See inner exception for details.

```
# using localhost
when I use this: 
```
NCCL_DEBUG=INFO torchrun --nproc_per_node=4 --nnodes=2 --node_rank=0 --rdzv_id=456 --rdzv_backend=c10d --rdzv_endpoint=localhost:10010 multinode.py 50 10
```
the error message is: 
```
[2024-04-18 10:41:06,648] torch.distributed.run: [WARNING] master_addr is only used for static rdzv_backend and when rdzv_endpoint is not specified.
[2024-04-18 10:41:06,648] torch.distributed.run: [WARNING] 
[2024-04-18 10:41:06,648] torch.distributed.run: [WARNING] *****************************************
[2024-04-18 10:41:06,648] torch.distributed.run: [WARNING] Setting OMP_NUM_THREADS environment variable for each process to be 1 in default, to avoid your system being overloaded, please further tune the variable for optimal performance in your application as needed. 
[2024-04-18 10:41:06,648] torch.distributed.run: [WARNING] *****************************************
[2024-04-18 10:41:06,648] torch.distributed.launcher.api: [INFO] Starting elastic_operator with launch configs:
[2024-04-18 10:41:06,648] torch.distributed.launcher.api: [INFO]   entrypoint       : multinode.py
[2024-04-18 10:41:06,648] torch.distributed.launcher.api: [INFO]   min_nodes        : 2
[2024-04-18 10:41:06,648] torch.distributed.launcher.api: [INFO]   max_nodes        : 2
[2024-04-18 10:41:06,648] torch.distributed.launcher.api: [INFO]   nproc_per_node   : 4
[2024-04-18 10:41:06,648] torch.distributed.launcher.api: [INFO]   run_id           : 456
[2024-04-18 10:41:06,648] torch.distributed.launcher.api: [INFO]   rdzv_backend     : c10d
[2024-04-18 10:41:06,648] torch.distributed.launcher.api: [INFO]   rdzv_endpoint    : localhost:10010
[2024-04-18 10:41:06,648] torch.distributed.launcher.api: [INFO]   rdzv_configs     : {'timeout': 900}
[2024-04-18 10:41:06,648] torch.distributed.launcher.api: [INFO]   max_restarts     : 0
[2024-04-18 10:41:06,648] torch.distributed.launcher.api: [INFO]   monitor_interval : 5
[2024-04-18 10:41:06,648] torch.distributed.launcher.api: [INFO]   log_dir          : None
[2024-04-18 10:41:06,648] torch.distributed.launcher.api: [INFO]   metrics_cfg      : {}
[2024-04-18 10:41:06,648] torch.distributed.launcher.api: [INFO] 
[2024-04-18 10:41:06,651] torch.distributed.elastic.agent.server.local_elastic_agent: [INFO] log directory set to: /tmp/torchelastic_qyrbz46x/456_9l4f66tp
[2024-04-18 10:41:06,651] torch.distributed.elastic.agent.server.api: [INFO] [default] starting workers for entrypoint: python
[2024-04-18 10:41:06,651] torch.distributed.elastic.agent.server.api: [INFO] [default] Rendezvous'ing worker group
[2024-04-18 10:41:17,820] torch.distributed.elastic.agent.server.api: [INFO] [default] Rendezvous complete for workers. Result:
[2024-04-18 10:41:17,820] torch.distributed.elastic.agent.server.api: [INFO]   restart_count=0
[2024-04-18 10:41:17,820] torch.distributed.elastic.agent.server.api: [INFO]   master_addr=10-12-3-162
[2024-04-18 10:41:17,820] torch.distributed.elastic.agent.server.api: [INFO]   master_port=40649
[2024-04-18 10:41:17,820] torch.distributed.elastic.agent.server.api: [INFO]   group_rank=0
[2024-04-18 10:41:17,820] torch.distributed.elastic.agent.server.api: [INFO]   group_world_size=2
[2024-04-18 10:41:17,820] torch.distributed.elastic.agent.server.api: [INFO]   local_ranks=[0, 1, 2, 3]
[2024-04-18 10:41:17,820] torch.distributed.elastic.agent.server.api: [INFO]   role_ranks=[0, 1, 2, 3]
[2024-04-18 10:41:17,820] torch.distributed.elastic.agent.server.api: [INFO]   global_ranks=[0, 1, 2, 3]
[2024-04-18 10:41:17,820] torch.distributed.elastic.agent.server.api: [INFO]   role_world_sizes=[8, 8, 8, 8]
[2024-04-18 10:41:17,820] torch.distributed.elastic.agent.server.api: [INFO]   global_world_sizes=[8, 8, 8, 8]
[2024-04-18 10:41:17,820] torch.distributed.elastic.agent.server.api: [INFO] 
[2024-04-18 10:41:17,820] torch.distributed.elastic.agent.server.api: [INFO] [default] Starting worker group
[2024-04-18 10:41:17,821] torch.distributed.elastic.agent.server.local_elastic_agent: [INFO] Environment variable 'TORCHELASTIC_ENABLE_FILE_TIMER' not found. Do not start FileTimerServer.
[2024-04-18 10:41:17,821] torch.distributed.elastic.multiprocessing: [INFO] Setting worker0 reply file to: /tmp/torchelastic_qyrbz46x/456_9l4f66tp/attempt_0/0/error.json
[2024-04-18 10:41:17,822] torch.distributed.elastic.multiprocessing: [INFO] Setting worker1 reply file to: /tmp/torchelastic_qyrbz46x/456_9l4f66tp/attempt_0/1/error.json
[2024-04-18 10:41:17,822] torch.distributed.elastic.multiprocessing: [INFO] Setting worker2 reply file to: /tmp/torchelastic_qyrbz46x/456_9l4f66tp/attempt_0/2/error.json
[2024-04-18 10:41:17,822] torch.distributed.elastic.multiprocessing: [INFO] Setting worker3 reply file to: /tmp/torchelastic_qyrbz46x/456_9l4f66tp/attempt_0/3/error.json
10-12-3-162:7990:7990 [0] NCCL INFO Bootstrap : Using eno3:10.12.3.162<0>
10-12-3-162:7990:7990 [0] NCCL INFO NET/Plugin: Failed to find ncclNetPlugin_v7 symbol.
10-12-3-162:7990:7990 [0] NCCL INFO NET/Plugin: Loaded net plugin NCCL RDMA Plugin v6 (v6)
10-12-3-162:7990:7990 [0] NCCL INFO NET/Plugin: Failed to find ncclCollNetPlugin_v7 symbol.
10-12-3-162:7990:7990 [0] NCCL INFO NET/Plugin: Loaded coll plugin SHARP (v6)
10-12-3-162:7990:7990 [0] NCCL INFO cudaDriverVersion 12020
NCCL version 2.19.3+cuda12.2
10-12-3-162:7993:7993 [3] NCCL INFO cudaDriverVersion 12020
10-12-3-162:7993:7993 [3] NCCL INFO Bootstrap : Using eno3:10.12.3.162<0>
10-12-3-162:7993:7993 [3] NCCL INFO NET/Plugin: Failed to find ncclNetPlugin_v7 symbol.
10-12-3-162:7993:7993 [3] NCCL INFO NET/Plugin: Loaded net plugin NCCL RDMA Plugin v6 (v6)
10-12-3-162:7993:7993 [3] NCCL INFO NET/Plugin: Failed to find ncclCollNetPlugin_v7 symbol.
10-12-3-162:7993:7993 [3] NCCL INFO NET/Plugin: Loaded coll plugin SHARP (v6)
10-12-3-162:7991:7991 [1] NCCL INFO cudaDriverVersion 12020
10-12-3-162:7991:7991 [1] NCCL INFO Bootstrap : Using eno3:10.12.3.162<0>
10-12-3-162:7991:7991 [1] NCCL INFO NET/Plugin: Failed to find ncclNetPlugin_v7 symbol.
10-12-3-162:7991:7991 [1] NCCL INFO NET/Plugin: Loaded net plugin NCCL RDMA Plugin v6 (v6)
10-12-3-162:7991:7991 [1] NCCL INFO NET/Plugin: Failed to find ncclCollNetPlugin_v7 symbol.
10-12-3-162:7991:7991 [1] NCCL INFO NET/Plugin: Loaded coll plugin SHARP (v6)
10-12-3-162:7992:7992 [2] NCCL INFO cudaDriverVersion 12020
10-12-3-162:7992:7992 [2] NCCL INFO Bootstrap : Using eno3:10.12.3.162<0>
10-12-3-162:7992:7992 [2] NCCL INFO NET/Plugin: Failed to find ncclNetPlugin_v7 symbol.
10-12-3-162:7992:7992 [2] NCCL INFO NET/Plugin: Loaded net plugin NCCL RDMA Plugin v6 (v6)
10-12-3-162:7992:7992 [2] NCCL INFO NET/Plugin: Failed to find ncclCollNetPlugin_v7 symbol.
10-12-3-162:7992:7992 [2] NCCL INFO NET/Plugin: Loaded coll plugin SHARP (v6)
10-12-3-162:7990:8056 [0] NCCL INFO Plugin Path : /opt/hpcx/nccl_rdma_sharp_plugin/lib/libnccl-net.so
10-12-3-162:7990:8056 [0] NCCL INFO P2P plugin IBext
10-12-3-162:7990:8056 [0] NCCL INFO NET/IB : No device found.
10-12-3-162:7990:8056 [0] NCCL INFO NET/IB : No device found.
10-12-3-162:7990:8056 [0] NCCL INFO NET/Socket : Using [0]eno3:10.12.3.162<0>
10-12-3-162:7990:8056 [0] NCCL INFO Using non-device net plugin version 0
10-12-3-162:7990:8056 [0] NCCL INFO Using network Socket
10-12-3-162:7993:8057 [3] NCCL INFO Plugin Path : /opt/hpcx/nccl_rdma_sharp_plugin/lib/libnccl-net.so
10-12-3-162:7993:8057 [3] NCCL INFO P2P plugin IBext
10-12-3-162:7991:8058 [1] NCCL INFO Plugin Path : /opt/hpcx/nccl_rdma_sharp_plugin/lib/libnccl-net.so
10-12-3-162:7991:8058 [1] NCCL INFO P2P plugin IBext
10-12-3-162:7991:8058 [1] NCCL INFO NET/IB : No device found.
10-12-3-162:7993:8057 [3] NCCL INFO NET/IB : No device found.
10-12-3-162:7993:8057 [3] NCCL INFO NET/IB : No device found.
10-12-3-162:7991:8058 [1] NCCL INFO NET/IB : No device found.
10-12-3-162:7993:8057 [3] NCCL INFO NET/Socket : Using [0]eno3:10.12.3.162<0>
10-12-3-162:7991:8058 [1] NCCL INFO NET/Socket : Using [0]eno3:10.12.3.162<0>
10-12-3-162:7993:8057 [3] NCCL INFO Using non-device net plugin version 0
10-12-3-162:7991:8058 [1] NCCL INFO Using non-device net plugin version 0
10-12-3-162:7993:8057 [3] NCCL INFO Using network Socket
10-12-3-162:7991:8058 [1] NCCL INFO Using network Socket
10-12-3-162:7992:8059 [2] NCCL INFO Plugin Path : /opt/hpcx/nccl_rdma_sharp_plugin/lib/libnccl-net.so
10-12-3-162:7992:8059 [2] NCCL INFO P2P plugin IBext
10-12-3-162:7992:8059 [2] NCCL INFO NET/IB : No device found.
10-12-3-162:7992:8059 [2] NCCL INFO NET/IB : No device found.
10-12-3-162:7992:8059 [2] NCCL INFO NET/Socket : Using [0]eno3:10.12.3.162<0>
10-12-3-162:7992:8059 [2] NCCL INFO Using non-device net plugin version 0
10-12-3-162:7992:8059 [2] NCCL INFO Using network Socket
10-12-3-162:7992:8059 [2] NCCL INFO comm 0x55fb534bb0f0 rank 2 nranks 8 cudaDev 2 nvmlDev 2 busId 86000 commId 0xf76176b1431c4d7e - Init START
10-12-3-162:7993:8057 [3] NCCL INFO comm 0x55ab8e7a13b0 rank 3 nranks 8 cudaDev 3 nvmlDev 3 busId af000 commId 0xf76176b1431c4d7e - Init START
10-12-3-162:7990:8056 [0] NCCL INFO comm 0x561c69446ec0 rank 0 nranks 8 cudaDev 0 nvmlDev 0 busId 18000 commId 0xf76176b1431c4d7e - Init START
10-12-3-162:7991:8058 [1] NCCL INFO comm 0x560213348b30 rank 1 nranks 8 cudaDev 1 nvmlDev 1 busId 3b000 commId 0xf76176b1431c4d7e - Init START
10-12-3-162:7990:8056 [0] NCCL INFO Setting affinity for GPU 0 to 5555,55555555
10-12-3-162:7990:8056 [0] NCCL INFO NVLS multicast support is not available on dev 0
10-12-3-162:7991:8058 [1] NCCL INFO Setting affinity for GPU 1 to 5555,55555555
10-12-3-162:7991:8058 [1] NCCL INFO NVLS multicast support is not available on dev 1
10-12-3-162:7992:8059 [2] NCCL INFO Setting affinity for GPU 2 to aaaa,aaaaaaaa
10-12-3-162:7992:8059 [2] NCCL INFO NVLS multicast support is not available on dev 2
10-12-3-162:7993:8057 [3] NCCL INFO Setting affinity for GPU 3 to aaaa,aaaaaaaa
10-12-3-162:7993:8057 [3] NCCL INFO NVLS multicast support is not available on dev 3
10-12-3-162:7992:8059 [2] NCCL INFO Trees [0] 3/-1/-1->2->1 [1] 3/-1/-1->2->1
10-12-3-162:7992:8059 [2] NCCL INFO P2P Chunksize set to 131072
10-12-3-162:7993:8057 [3] NCCL INFO Trees [0] -1/-1/-1->3->2 [1] -1/-1/-1->3->2
10-12-3-162:7991:8058 [1] NCCL INFO Trees [0] 2/-1/-1->1->0 [1] 2/-1/-1->1->0
10-12-3-162:7993:8057 [3] NCCL INFO P2P Chunksize set to 131072
10-12-3-162:7991:8058 [1] NCCL INFO P2P Chunksize set to 131072
10-12-3-162:7990:8056 [0] NCCL INFO Channel 00/02 :    0   3   2   1   4   7   6   5
10-12-3-162:7990:8056 [0] NCCL INFO Channel 01/02 :    0   3   2   1   4   7   6   5
10-12-3-162:7990:8056 [0] NCCL INFO Trees [0] 1/4/-1->0->-1 [1] 1/-1/-1->0->4
10-12-3-162:7990:8056 [0] NCCL INFO P2P Chunksize set to 131072
10-12-3-162:7992:8059 [2] NCCL INFO Channel 00/0 : 2[2] -> 1[1] via P2P/CUMEM
10-12-3-162:7992:8059 [2] NCCL INFO Channel 01/0 : 2[2] -> 1[1] via P2P/CUMEM
10-12-3-162:7990:8056 [0] NCCL INFO Channel 00/0 : 5[1] -> 0[0] [receive] via NET/Socket/0
10-12-3-162:7990:8056 [0] NCCL INFO Channel 01/0 : 5[1] -> 0[0] [receive] via NET/Socket/0
10-12-3-162:7990:8056 [0] NCCL INFO Channel 00/0 : 0[0] -> 3[3] via P2P/CUMEM
10-12-3-162:7990:8056 [0] NCCL INFO Channel 01/0 : 0[0] -> 3[3] via P2P/CUMEM
10-12-3-162:7993:8057 [3] NCCL INFO Channel 00/0 : 3[3] -> 2[2] via P2P/CUMEM
10-12-3-162:7993:8057 [3] NCCL INFO Channel 01/0 : 3[3] -> 2[2] via P2P/CUMEM
10-12-3-162:7991:8058 [1] NCCL INFO Channel 00/0 : 1[1] -> 4[0] [send] via NET/Socket/0
10-12-3-162:7991:8058 [1] NCCL INFO Channel 01/0 : 1[1] -> 4[0] [send] via NET/Socket/0

10-12-3-162:7991:8061 [1] misc/socket.cc:484 NCCL WARN socketStartConnect: Connect to fe80::cc98:c6ff:fe61:1aac%50<52367> failed : Network is unreachable
10-12-3-162:7991:8061 [1] NCCL INFO misc/socket.cc:565 -> 2
10-12-3-162:7991:8061 [1] NCCL INFO misc/socket.cc:619 -> 2
10-12-3-162:7991:8061 [1] NCCL INFO transport/net_socket.cc:335 -> 2
10-12-3-162:7991:8061 [1] NCCL INFO transport/net.cc:677 -> 2

10-12-3-162:7991:8061 [1] misc/socket.cc:484 NCCL WARN socketStartConnect: Connect to fe80::cc98:c6ff:fe61:1aac%50<50557> failed : Network is unreachable
10-12-3-162:7991:8061 [1] NCCL INFO misc/socket.cc:565 -> 2
10-12-3-162:7991:8061 [1] NCCL INFO misc/socket.cc:619 -> 2
10-12-3-162:7991:8061 [1] NCCL INFO transport/net_socket.cc:335 -> 2
10-12-3-162:7991:8061 [1] NCCL INFO transport/net.cc:677 -> 2
10-12-3-162:7991:8058 [1] NCCL INFO transport/net.cc:304 -> 2
10-12-3-162:7991:8058 [1] NCCL INFO transport.cc:148 -> 2
10-12-3-162:7991:8058 [1] NCCL INFO init.cc:1117 -> 2
10-12-3-162:7991:8058 [1] NCCL INFO init.cc:1396 -> 2
10-12-3-162:7991:8058 [1] NCCL INFO group.cc:64 -> 2 [Async thread]
10-12-3-162:7991:7991 [1] NCCL INFO group.cc:418 -> 2
10-12-3-162:7991:7991 [1] NCCL INFO group.cc:95 -> 2
10-12-3-162:7991:8061 [1] NCCL INFO misc/socket.cc:806 -> 3

10-12-3-162:7991:8061 [1] proxy.cc:1533 NCCL WARN [Service thread] Could not receive type from localRank 2, res=3, closed=0

10-12-3-162:7991:8061 [1] proxy.cc:1557 NCCL WARN [Proxy Service 1] Failed to execute operation Init from rank 2, retcode 3

10-12-3-162:7992:8059 [2] misc/socket.cc:50 NCCL WARN socketProgress: Connection closed by remote peer 10-12-3-162<55133>
10-12-3-162:7992:8059 [2] NCCL INFO misc/socket.cc:750 -> 6

10-12-3-162:7992:8059 [2] proxy.cc:1172 NCCL WARN Socket recv failed while polling for opId=0x7fe19f1554c0
10-12-3-162:7992:8059 [2] NCCL INFO proxy.cc:1076 -> 3
10-12-3-162:7992:8059 [2] NCCL INFO transport/p2p.cc:240 -> 3
10-12-3-162:7992:8059 [2] NCCL INFO transport/p2p.cc:325 -> 3
10-12-3-162:7992:8059 [2] NCCL INFO transport/p2p.cc:455 -> 3
10-12-3-162:7992:8059 [2] NCCL INFO transport.cc:148 -> 3
10-12-3-162:7992:8059 [2] NCCL INFO init.cc:1117 -> 3
10-12-3-162:7992:8059 [2] NCCL INFO init.cc:1396 -> 3
10-12-3-162:7992:8059 [2] NCCL INFO group.cc:64 -> 3 [Async thread]
10-12-3-162:7992:7992 [2] NCCL INFO group.cc:418 -> 3
10-12-3-162:7992:7992 [2] NCCL INFO group.cc:95 -> 3
10-12-3-162:7990:8056 [0] NCCL INFO Connected all rings
10-12-3-162:7990:8056 [0] NCCL INFO Channel 00/0 : 0[0] -> 1[1] via P2P/CUMEM
10-12-3-162:7990:8056 [0] NCCL INFO Channel 01/0 : 0[0] -> 1[1] via P2P/CUMEM
Traceback (most recent call last):
  File "/data/weilong.yu/torch_examples/distributed/ddp-tutorial-series/multinode.py", line 112, in <module>
    main(args.save_every, args.total_epochs, args.batch_size)
  File "/data/weilong.yu/torch_examples/distributed/ddp-tutorial-series/multinode.py", line 99, in main
    trainer = Trainer(model, train_data, optimizer, save_every, snapshot_path)
  File "/data/weilong.yu/torch_examples/distributed/ddp-tutorial-series/multinode.py", line 38, in __init__
    self.model = DDP(self.model, device_ids=[self.local_rank])
  File "/usr/local/lib/python3.10/dist-packages/torch/nn/parallel/distributed.py", line 797, in __init__
    _verify_param_shape_across_processes(self.process_group, parameters)
  File "/usr/local/lib/python3.10/dist-packages/torch/distributed/utils.py", line 265, in _verify_param_shape_across_processes
    return dist._verify_params_across_processes(process_group, tensors, logger)
torch.distributed.DistBackendError: NCCL error in: /opt/pytorch/pytorch/torch/csrc/distributed/c10d/ProcessGroupNCCL.cpp:1207, internal error - please report this issue to the NCCL developers, NCCL version 2.19.3
ncclInternalError: Internal check failed.
Last error:
Socket recv failed while polling for opId=0x7fe19f1554c0
Traceback (most recent call last):
  File "/data/weilong.yu/torch_examples/distributed/ddp-tutorial-series/multinode.py", line 112, in <module>
    main(args.save_every, args.total_epochs, args.batch_size)
  File "/data/weilong.yu/torch_examples/distributed/ddp-tutorial-series/multinode.py", line 99, in main
    trainer = Trainer(model, train_data, optimizer, save_every, snapshot_path)
  File "/data/weilong.yu/torch_examples/distributed/ddp-tutorial-series/multinode.py", line 38, in __init__
    self.model = DDP(self.model, device_ids=[self.local_rank])
  File "/usr/local/lib/python3.10/dist-packages/torch/nn/parallel/distributed.py", line 797, in __init__
    _verify_param_shape_across_processes(self.process_group, parameters)
  File "/usr/local/lib/python3.10/dist-packages/torch/distributed/utils.py", line 265, in _verify_param_shape_across_processes
    return dist._verify_params_across_processes(process_group, tensors, logger)
torch.distributed.DistBackendError: NCCL error in: /opt/pytorch/pytorch/torch/csrc/distributed/c10d/ProcessGroupNCCL.cpp:1207, unhandled system error (run with NCCL_DEBUG=INFO for details), NCCL version 2.19.3
ncclSystemError: System call (e.g. socket, malloc) or external library call failed or device error. 
Last error:
socketStartConnect: Connect to fe80::cc98:c6ff:fe61:1aac%50<50557> failed : Network is unreachable
10-12-3-162:7993:8062 [3] NCCL INFO [Service thread] Connection closed by localRank 2
[2024-04-18 10:41:27,835] torch.distributed.elastic.multiprocessing.api: [WARNING] Sending process 7990 closing signal SIGTERM
[2024-04-18 10:41:27,836] torch.distributed.elastic.multiprocessing.api: [WARNING] Sending process 7993 closing signal SIGTERM
[2024-04-18 10:41:29,504] torch.distributed.elastic.multiprocessing.api: [ERROR] failed (exitcode: 1) local_rank: 1 (pid: 7991) of binary: /usr/bin/python
[2024-04-18 10:41:29,513] torch.distributed.elastic.multiprocessing.errors: [INFO] ('local_rank %s FAILED with no error file. Decorate your entrypoint fn with @record for traceback info. See: https://pytorch.org/docs/stable/elastic/errors.html', 1)
Traceback (most recent call last):
  File "/usr/local/bin/torchrun", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/dist-packages/torch/distributed/elastic/multiprocessing/errors/__init__.py", line 346, in wrapper
    return f(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/torch/distributed/run.py", line 806, in main
    run(args)
  File "/usr/local/lib/python3.10/dist-packages/torch/distributed/run.py", line 797, in run
    elastic_launch(
  File "/usr/local/lib/python3.10/dist-packages/torch/distributed/launcher/api.py", line 134, in __call__
    return launch_agent(self._config, self._entrypoint, list(args))
  File "/usr/local/lib/python3.10/dist-packages/torch/distributed/launcher/api.py", line 264, in launch_agent
    raise ChildFailedError(
torch.distributed.elastic.multiprocessing.errors.ChildFailedError: 
============================================================
multinode.py FAILED
------------------------------------------------------------
Failures:
[1]:
  time      : 2024-04-18_10:41:27
  host      : 10-12-3-162
  rank      : 2 (local_rank: 2)
  exitcode  : 1 (pid: 7992)
  error_file: <N/A>
  traceback : To enable traceback see: https://pytorch.org/docs/stable/elastic/errors.html
------------------------------------------------------------
Root Cause (first observed failure):
[0]:
  time      : 2024-04-18_10:41:27
  host      : 10-12-3-162
  rank      : 1 (local_rank: 1)
  exitcode  : 1 (pid: 7991)
  error_file: <N/A>
  traceback : To enable traceback see: https://pytorch.org/docs/stable/elastic/errors.html
============================================================

```

### Versions

```
Collecting environment information...
PyTorch version: 2.1.0a0+32f93b1
Is debug build: False
CUDA used to build PyTorch: 12.2
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.3 LTS (x86_64)
GCC version: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Clang version: Could not collect
CMake version: version 3.27.6
Libc version: glibc-2.35

Python version: 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0] (64-bit runtime)
Python platform: Linux-5.4.0-174-generic-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: 12.2.140
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: 
GPU 0: Tesla V100-SXM2-32GB
GPU 1: Tesla V100-SXM2-32GB
GPU 2: Tesla V100-SXM2-32GB
GPU 3: Tesla V100-SXM2-32GB

Nvidia driver version: 535.154.05
cuDNN version: Probably one of the following:
/usr/lib/x86_64-linux-gnu/libcudnn.so.8.9.5
/usr/lib/x86_64-linux-gnu/libcudnn_adv_infer.so.8.9.5
/usr/lib/x86_64-linux-gnu/libcudnn_adv_train.so.8.9.5
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_infer.so.8.9.5
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_train.so.8.9.5
/usr/lib/x86_64-linux-gnu/libcudnn_ops_infer.so.8.9.5
/usr/lib/x86_64-linux-gnu/libcudnn_ops_train.so.8.9.5
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Architecture:                       x86_64
CPU op-mode(s):                     32-bit, 64-bit
Address sizes:                      46 bits physical, 48 bits virtual
Byte Order:                         Little Endian
CPU(s):                             48
On-line CPU(s) list:                0-47
Vendor ID:                          GenuineIntel
Model name:                         Intel(R) Xeon(R) Silver 4214R CPU @ 2.40GHz
CPU family:                         6
Model:                              85
Thread(s) per core:                 2
Core(s) per socket:                 12
Socket(s):                          2
Stepping:                           7
CPU max MHz:                        3500.0000
CPU min MHz:                        1000.0000
BogoMIPS:                           4800.00
Flags:                              fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cdp_l3 invpcid_single intel_ppin ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm mpx rdt_a avx512f avx512dq rdseed adx smap clflushopt clwb intel_pt avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts pku ospke avx512_vnni md_clear flush_l1d arch_capabilities
Virtualization:                     VT-x
L1d cache:                          768 KiB (24 instances)
L1i cache:                          768 KiB (24 instances)
L2 cache:                           24 MiB (24 instances)
L3 cache:                           33 MiB (2 instances)
NUMA node(s):                       2
NUMA node0 CPU(s):                  0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46
NUMA node1 CPU(s):                  1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47
Vulnerability Gather data sampling: Mitigation; Microcode
Vulnerability Itlb multihit:        KVM: Mitigation: Split huge pages
Vulnerability L1tf:                 Not affected
Vulnerability Mds:                  Not affected
Vulnerability Meltdown:             Not affected
Vulnerability Mmio stale data:      Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Retbleed:             Mitigation; Enhanced IBRS
Vulnerability Spec store bypass:    Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Vulnerability Spectre v1:           Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:           Mitigation; Enhanced IBRS, IBPB conditional, RSB filling, PBRSB-eIBRS SW sequence
Vulnerability Srbds:                Not affected
Vulnerability Tsx async abort:      Mitigation; TSX disabled

Versions of relevant libraries:
[pip3] numpy==1.22.2
[pip3] onnx==1.14.0
[pip3] pytorch-quantization==2.1.2
[pip3] torch==2.1.0a0+32f93b1
[pip3] torch-tensorrt==0.0.0
[pip3] torchdata==0.7.0a0
[pip3] torchtext==0.16.0a0
[pip3] torchvision==0.16.0a0
[pip3] triton==2.1.0+e621604
[conda] Could not collect

```

cc @mrshenli @pritamdamania87 @zhaojuanmao @satgera @rohan-varma @gqchen @aazzolini @osalpekar @jiayisuse @H-Huang @kwen2501 @awgu @penguinwu @fegin @XilunWu @wanchaol @fduwjj @wz337 @tianyu-l @wconstab @yf225 @chauhang @d4l3k