From 2882ec6b9e992cc28604bdfa327c6f82c0e19aea Mon Sep 17 00:00:00 2001 From: Andrej Karpathy Date: Fri, 16 Aug 2024 17:22:30 +0000 Subject: [PATCH] fix makefile for multigpu setups --- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 6fa511d..73b8372 100644 --- a/Makefile +++ b/Makefile @@ -49,7 +49,9 @@ endif ifneq ($(CI),true) # if not in CI, then use the GPU query ifndef GPU_COMPUTE_CAPABILITY # set to defaults if: make GPU_COMPUTE_CAPABILITY= ifneq ($(call file_exists_in_path, nvidia-smi),) - GPU_COMPUTE_CAPABILITY = $(shell nvidia-smi --query-gpu=compute_cap --format=csv,noheader | sed 's/\.//g') + # Get the compute capabilities of all GPUs + # Remove decimal points, sort numerically in ascending order, and select the first (lowest) value + GPU_COMPUTE_CAPABILITY=$(nvidia-smi --query-gpu=compute_cap --format=csv,noheader | sed 's/\.//g' | sort -n | head -n 1) GPU_COMPUTE_CAPABILITY := $(strip $(GPU_COMPUTE_CAPABILITY)) endif endif