File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -195,6 +195,30 @@ else
195195endif
196196
197197# Check if NCCL is available, include if so, for multi-GPU training
198+ # If exactly 1 GPU is detected and FORCE_MULTI_GPU != 1, default to NO_MULTI_GPU
199+ ifneq ($(OS ) , Windows_NT)
200+ ifneq ($(call file_exists_in_path, nvidia-smi),)
201+ GPU_COUNT := $(strip $(shell nvidia-smi -L 2>/dev/null | grep -c "^GPU ") )
202+ endif
203+ endif
204+
205+ ifeq ($(strip $(FORCE_MULTI_GPU ) ) ,1)
206+ ifeq ($(GPU_COUNT),1)
207+ $(info → Detected 1 GPU but FORCE_MULTI_GPU=1; building with MULTI_GPU)
208+ endif
209+ else
210+ ifeq ($(GPU_COUNT),1)
211+ ifeq ($(origin NO_MULTI_GPU), undefined)
212+ NO_MULTI_GPU := 1
213+ $(info → Detected exactly 1 GPU; defaulting to NO_MULTI_GPU. Set FORCE_MULTI_GPU=1 to override.)
214+ endif
215+ ifeq ($(origin NO_USE_MPI), undefined)
216+ NO_USE_MPI := 1
217+ $(info → Disabling MPI as well since NO_MULTI_GPU is active.)
218+ endif
219+ endif
220+ endif
221+
198222ifeq ($(NO_MULTI_GPU ) , 1)
199223 $(info → Multi-GPU (NCCL) is manually disabled)
200224else
You can’t perform that action at this time.
0 commit comments