Two critical fixes:
1. Set device BEFORE initializing process group (PyTorch best practice)
2. Add NCCL environment variables to handle same GPU IDs across nodes:
- NCCL_LL_THRESHOLD=0
- NCCL_ALGO=Ring
- NCCL_PROTO=Simple
This fixes the "Duplicate GPU detected" error when both nodes
have GPUs with the same PCI bus ID.
Co-Authored-By: Claude <noreply@anthropic.com>