Skip to content

Commit 820ab2e

Browse files
committed
Fix for WSL by disabling Multi-GPU when only 1 GPU is present (also more efficient in general)
1 parent 71ee33f commit 820ab2e

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

Makefile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,30 @@ else
195195
endif
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+
198222
ifeq ($(NO_MULTI_GPU), 1)
199223
$(info → Multi-GPU (NCCL) is manually disabled)
200224
else

0 commit comments

Comments
 (0)