enh: Update docker Makefile to use only the visible GPUs of machine (#4097)

Update Makefile

Signed-off-by: Venky Ganesh <23023424+venkywonka@users.noreply.github.com>
This commit is contained in:
Venky 2025-05-07 03:01:32 -07:00 committed by GitHub
parent 62cfe74f5f
commit a7c50cc426
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -107,7 +107,15 @@ endef
DOCKER_RUN_OPTS ?= --rm -it --ipc=host --ulimit memlock=-1 --ulimit stack=67108864
DOCKER_RUN_ARGS ?=
GPU_OPTS ?= --gpus=all
# Check if NVIDIA_VISIBLE_DEVICES is set and not empty
NVIDIA_VISIBLE_DEVICES_VAL = $(shell echo $$NVIDIA_VISIBLE_DEVICES)
ifeq ($(NVIDIA_VISIBLE_DEVICES_VAL),)
# If empty or not set, use all GPUs
GPU_OPTS ?= --gpus=all
else
# If set, use the specified devices
GPU_OPTS ?= --gpus='"device=$(NVIDIA_VISIBLE_DEVICES_VAL)"'
endif
SOURCE_DIR ?= $(shell readlink -f ..)
CODE_DIR ?= /code/tensorrt_llm
CCACHE_DIR ?= ${CODE_DIR}/cpp/.ccache