mirror of
https://github.com/foomo/gsamservice.git
synced 2025-10-16 12:35:37 +00:00
44 lines
1.2 KiB
Makefile
44 lines
1.2 KiB
Makefile
# Get version of CUDA and enable it for compilation if CUDA > 11.0
|
|
# This solves https://github.com/IDEA-Research/Grounded-Segment-Anything/issues/53
|
|
# and https://github.com/IDEA-Research/Grounded-Segment-Anything/issues/84
|
|
# when running in Docker
|
|
# Check if nvcc is installed
|
|
NVCC := $(shell which nvcc)
|
|
ifeq ($(NVCC),)
|
|
# NVCC not found
|
|
USE_CUDA := 0
|
|
NVCC_VERSION := "not installed"
|
|
else
|
|
NVCC_VERSION := $(shell nvcc --version | grep -oP 'release \K[0-9.]+')
|
|
USE_CUDA := $(shell echo "$(NVCC_VERSION) > 11" | bc -l)
|
|
endif
|
|
|
|
# Add the list of supported ARCHs
|
|
ifeq ($(USE_CUDA), 1)
|
|
TORCH_CUDA_ARCH_LIST := "7.0;7.5;8.0;8.6+PTX"
|
|
BUILD_MESSAGE := "Trying to build the image with CUDA support"
|
|
else
|
|
TORCH_CUDA_ARCH_LIST :=
|
|
BUILD_MESSAGE := "CUDA $(NVCC_VERSION) is not supported"
|
|
endif
|
|
|
|
build:
|
|
docker build --build-arg USE_CUDA=$(USE_CUDA) \
|
|
--build-arg TORCH_ARCH=$(TORCH_CUDA_ARCH_LIST) \
|
|
--progress=plain -t gsam2 .
|
|
|
|
run:
|
|
docker run -d --gpus all \
|
|
--restart unless-stopped \
|
|
--name=gsam2 \
|
|
--ipc=host -p 13337:13337 gsam2
|
|
|
|
run-bash:
|
|
docker run -it --rm --gpus all \
|
|
-v "${PWD}":/home/appuser/host \
|
|
--entrypoint bash \
|
|
--name=gsam2 \
|
|
--network=host \
|
|
--ipc=host gsam2
|
|
|