mirror of
https://github.com/karpathy/llm.c.git
synced 2026-07-27 20:25:09 -04:00
Fix for WSL by disabling Multi-GPU when only 1 GPU is present (also more efficient in general)
This commit is contained in:
parent
71ee33f62c
commit
820ab2eff3
1 changed files with 24 additions and 0 deletions
24
Makefile
24
Makefile
|
|
@ -195,6 +195,30 @@ else
|
|||
endif
|
||||
|
||||
# Check if NCCL is available, include if so, for multi-GPU training
|
||||
# If exactly 1 GPU is detected and FORCE_MULTI_GPU != 1, default to NO_MULTI_GPU
|
||||
ifneq ($(OS), Windows_NT)
|
||||
ifneq ($(call file_exists_in_path, nvidia-smi),)
|
||||
GPU_COUNT := $(strip $(shell nvidia-smi -L 2>/dev/null | grep -c "^GPU "))
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(FORCE_MULTI_GPU)),1)
|
||||
ifeq ($(GPU_COUNT),1)
|
||||
$(info → Detected 1 GPU but FORCE_MULTI_GPU=1; building with MULTI_GPU)
|
||||
endif
|
||||
else
|
||||
ifeq ($(GPU_COUNT),1)
|
||||
ifeq ($(origin NO_MULTI_GPU), undefined)
|
||||
NO_MULTI_GPU := 1
|
||||
$(info → Detected exactly 1 GPU; defaulting to NO_MULTI_GPU. Set FORCE_MULTI_GPU=1 to override.)
|
||||
endif
|
||||
ifeq ($(origin NO_USE_MPI), undefined)
|
||||
NO_USE_MPI := 1
|
||||
$(info → Disabling MPI as well since NO_MULTI_GPU is active.)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(NO_MULTI_GPU), 1)
|
||||
$(info → Multi-GPU (NCCL) is manually disabled)
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue