[Solved] DDP/DistributedDataParallel Error: RuntimeError: Address already in use

An error is reported when testing pytorch multi card:
store = tcpstore (master_addr, master_port, world_size, start_daemon, timeout)
runtimeerror: address already in use

After investigation, there is another task running with DDP.

Solution:
manually specify an idle port

python -m torch.distributed.launch --master_port 145622

View port occupancy:
terminal input
netstat - nultp

Read More: