Skip to content

Commit

Permalink
deps: fix CUDA detection
Browse files Browse the repository at this point in the history
  • Loading branch information
bertsky committed Feb 2, 2022
1 parent ef6e0f2 commit 3da5fba
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
PYTHON = python3
PIP = pip3
PYTHONIOENCODING=utf8
SHELL = /bin/bash

help:
@echo
Expand Down Expand Up @@ -31,9 +32,10 @@ deps:
CUDA_VERSION=$$(nvidia-smi --version | sed -n '/CUDA Version/{s/.*CUDA Version: //;s/ .*//;p}'); \
elif command -v pkg-config &>/dev/null; then \
CUDA_VERSION=$$(pkg-config --list-all | sed -n '/^cudart/{s/cudart-//;s/ .*//;p;q}'); \
else \
echo >&2 "Cannot find CUDA runtime library, assuming CPU-only"; CUDA_VERSION=CPU; \
fi && echo "Detected CUDA version $$CUDA_VERSION" && \
fi && \
if test -z "$$CUDA_VERSION"; then \
echo "Cannot find CUDA runtime library, assuming CPU-only"; CUDA_VERSION=CPU; \
fi && echo "Detected CUDA version: $$CUDA_VERSION" && \
if test "$$CUDA_VERSION" = CPU; then CUDA=cpu; else CUDA=cu$${CUDA_VERSION//.}; fi && \
$(PIP) install -r requirements.txt \
-f 'https://dl.fbaipublicfiles.com/detectron2/wheels/$$CUDA/torch1.10/index.html'
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ To install Python dependencies:
Which is the equivalent of:

pip install -r requirements.txt -f https://dl.fbaipublicfiles.com/detectron2/wheels/cu113/torch1.10/index.html # for CUDA 11.3
pip install -r requirements.txt -f https://dl.fbaipublicfiles.com/detectron2/wheels/cpu/torch1.10/index.html # for CPU only

To install this module, then do:

Expand Down

0 comments on commit 3da5fba

Please sign in to comment.