Commit 1ed61e4b authored by Konstantin Lopuhin's avatar Konstantin Lopuhin Committed by Francisco Massa
Browse files

Allow forcing GPU build with FORCE_CUDA=1 (#927)

* Allow forcing GPU build with FORCE_CUDA=1

This is convenient to e.g. build with GPU support inside a docker image

* Document FORCE_CUDA
parent f5167537
......@@ -41,6 +41,9 @@ From source:
# or, for OSX
# MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++ python setup.py install
By default, GPU support is built if CUDA is found and ``torch.cuda.is_available()`` is true.
It's possible to force building GPU support by setting ``FORCE_CUDA=1`` environment variable,
which is useful when building a docker image.
Image Backend
=============
......
......@@ -92,7 +92,7 @@ def get_extensions():
define_macros = []
extra_compile_args = {}
if torch.cuda.is_available() and CUDA_HOME is not None:
if (torch.cuda.is_available() and CUDA_HOME is not None) or os.getenv('FORCE_CUDA', '0') == '1':
extension = CUDAExtension
sources += source_cuda
define_macros += [('WITH_CUDA', None)]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment