1 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
| 5a9bce1274 |
feat: add InfiniBand support and fix multi-node DDP for distributed training
Some checks failed
CI / SlowTests (ubuntu-latest, 3.12, 2.6.0, 0.21.0) (push) Has been cancelled
CI / SlowTests (ubuntu-latest, 3.12, 2.7.0, 0.22.0) (push) Has been cancelled
CI / SlowTests (ubuntu-latest, 3.12, 2.8.0, 0.23.0) (push) Has been cancelled
CI / SlowTests (ubuntu-latest, 3.12, 2.9.0, 0.24.0) (push) Has been cancelled
CI / SlowTests (ubuntu-latest, 3.13, 2.11.0, 0.26.0) (push) Has been cancelled
CI / SlowTests (ubuntu-latest, 3.13, latest) (push) Has been cancelled
CI / SlowTests (ubuntu-latest, 3.8, 1.8.0, 0.9.0) (push) Has been cancelled
CI / SlowTests (windows-latest, 3.13, latest) (push) Has been cancelled
CI / IsolatedExports (push) Has been cancelled
CI / GPU (push) Has been cancelled
CI / RaspberryPi (push) Has been cancelled
CI / NVIDIA_Jetson (JetPack5.1.2, 1.23.5, https://github.com/ultralytics/assets/releases/download/v0.0.0/onnxruntime_gpu-1.16.3-cp38-cp38-linux_aarch64.whl, 3.8, jetson-jp512, https://github.com/ultralytics/assets/releases/download/v0.0.0/torch-2.2.0-cp38-c… (push) Has been cancelled
CI / NVIDIA_Jetson (JetPack6.2, 1.26.4, https://github.com/ultralytics/assets/releases/download/v0.0.0/onnxruntime_gpu-1.20.0-cp310-cp310-linux_aarch64.whl, 3.10, jetson-jp62, https://github.com/ultralytics/assets/releases/download/v0.0.0/torch-2.5.0a0+872d… (push) Has been cancelled
CI / Conda (ubuntu-latest, 3.12) (push) Has been cancelled
Publish Docker Images / Build (, Dockerfile-arm64, linux/arm64, ubuntu-24.04-arm, latest-arm64) (push) Has been cancelled
Publish Docker Images / Build (, Dockerfile-jetson-jetpack4, linux/arm64, ubuntu-24.04-arm, latest-jetson-jetpack4) (push) Has been cancelled
Publish Docker Images / Build (, Dockerfile-jetson-jetpack5, linux/arm64, ubuntu-24.04-arm, latest-jetson-jetpack5) (push) Has been cancelled
Publish Docker Images / Build (, Dockerfile-jetson-jetpack6, linux/arm64, ubuntu-24.04-arm, latest-jetson-jetpack6) (push) Has been cancelled
Publish Docker Images / Build (, Dockerfile-nvidia-arm64, linux/arm64, ubuntu-24.04-arm, latest-nvidia-arm64) (push) Has been cancelled
Publish Docker Images / Build (Dockerfile-jupyter,Dockerfile-cpu,Dockerfile-runner-cpu,Dockerfile-python-export, Dockerfile-python, linux/amd64, ubuntu-latest, latest-python) (push) Has been cancelled
Publish Docker Images / Build (Dockerfile-runner,Dockerfile-export, Dockerfile, linux/amd64, ubuntu-latest, latest) (push) Has been cancelled
Publish Docs / Docs (push) Has been cancelled
Publish to PyPI / check (push) Has been cancelled
CI / Summary (push) Has been cancelled
Publish Docker Images / trigger-actions (push) Has been cancelled
Publish Docker Images / notify (push) Has been cancelled
Publish to PyPI / build (push) Has been cancelled
Publish to PyPI / publish (push) Has been cancelled
Publish to PyPI / sbom (push) Has been cancelled
Publish to PyPI / notify (push) Has been cancelled
## InfiniBand / RDMA support (Dockerfile + entrypoint)
- Base image switched to registry.d-robotics.cc/.../yolo_distributed:v20260611_fix
- Install IB user-space libs: libibverbs1, librdmacm1, ibverbs-providers,
rdma-core, infiniband-diags, perftest
- Set NCCL IB env vars at build time (NCCL_IB_DISABLE=0, NCCL_IB_GID_INDEX=3,
NCCL_IB_HCA=mlx5, NCCL_IB_TC=106, NCCL_IB_SL=5, NCCL_NET_GDR_LEVEL=2)
- entrypoint.sh: print IB device info (ibv_devices) on startup for diagnostics
## Multi-node DDP bug fixes (ultralytics/engine/trainer.py)
Three bugs that only surface with NNODES > 1:
1. Wrong device index in _setup_ddp():
- Before: torch.cuda.set_device(RANK) and torch.device("cuda", RANK)
- After: torch.cuda.set_device(LOCAL_RANK) and torch.device("cuda", LOCAL_RANK)
- RANK is the global rank (0-15 across 2 nodes); LOCAL_RANK is the per-node
GPU index (0-7). Using global RANK as a CUDA device index fails on node 1
where RANK 8-15 don't correspond to real GPU indices.
2. Wrong device_ids in DistributedDataParallel constructor:
- Before: device_ids=[RANK]
- After: device_ids=[LOCAL_RANK], find_unused_parameters=False,
gradient_as_bucket_view=True
- Same RANK vs LOCAL_RANK confusion; also adds gradient_as_bucket_view for
lower memory overhead and disables find_unused_parameters (no unused params
in this model, the flag was causing a spurious warning).
3. Pod hangs after training completes (final_eval deadlock):
- Root cause: final_eval() called self.validator(model=best.pt) on ALL ranks
without a RANK guard. The standalone validator path uses
torch.device("cuda", RANK) — valid for ranks 0-7 on the master node but
invalid for ranks 8-15 on the worker node, causing immediate crash. Those
crashed ranks never reached the torch_distributed_zero_first barrier inside
the validator, so rank 0 waited at that barrier forever → pod hung for 20+
minutes until manual deletion.
- Fix: call dist.destroy_process_group() on all ranks before the validator,
then guard the validator call with if RANK in {-1, 0}. This lets worker
ranks exit cleanly and runs final validation only on rank 0 (which already
has the full best.pt checkpoint).
## DetectionValidator dist guard (docker/distributed/detect_val.py)
- After destroy_process_group(), dist.get_world_size() raises ValueError because
no default process group exists. DetectionValidator.gather_stats() and
_gather_image_metrics() call dist.get_world_size() unconditionally.
- Fix: add `if not dist.is_initialized(): return` at the top of both methods.
When rank 0 runs the standalone validator after destroying the group, the
stats are already fully accumulated from rank 0's inference on all images —
there is nothing to gather.
## Build script (build_docker.sh)
- Added REPO_ROOT so the build context is the repo root (needed because COPY
paths like ultralytics/engine/trainer.py are relative to repo root)
- Added DOCKER_PLATFORM variable (default linux/amd64) for cross-platform builds
- Default tag suffix changed from _fix to _ib
## VCJob manifests
- vcjob-ib.yaml: reference manifest with IB env vars, H20-3e nodeSelector,
PVC dataset mount, rdma/hca resource, batch=128
- vcjob-ib3.yaml: same manifest pointing to v20260611_ib3 (fully fixed image)
Tested on 2-node × 8-GPU H20-3e cluster. Both master and worker pods exit
with status Completed after 100 epochs; final validation metrics are printed
and results saved to /workspace/runs/detect/train/.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|