Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3ae89c7

Browse files
author
mcarilli
authored
Seems to work locally (#490)
1 parent e6cb749 commit 3ae89c7

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

examples/docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Base image must at least have pytorch and CUDA installed.
2-
ARG BASE_IMAGE=nvcr.io/nvidia/pytorch:19.03-py3
2+
ARG BASE_IMAGE=nvcr.io/nvidia/pytorch:19.07-py3
33
FROM $BASE_IMAGE
44
ARG BASE_IMAGE
55
RUN echo "Installing Apex on top of ${BASE_IMAGE}"

setup.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,20 @@
55
from pip._internal import main as pipmain
66
import sys
77
import warnings
8+
import os
89

910
if not torch.cuda.is_available():
10-
print("\nWarning: Torch did not find available GPUs on this system.\n",
11-
"If your intention is to cross-compile, this is not an error.\n")
11+
# https://github.com/NVIDIA/apex/issues/486
12+
# Extension builds after https://github.com/pytorch/pytorch/pull/23408 attempt to query torch.cuda.get_device_capability(),
13+
# which will fail if you are compiling in an environment without visible GPUs (e.g. during an nvidia-docker build command).
14+
print('\nWarning: Torch did not find available GPUs on this system.\n',
15+
'If your intention is to cross-compile, this is not an error.\n'
16+
'By default, Apex will cross-compile for Pascal (compute capabilities 6.0, 6.1, 6.2),\n'
17+
'Volta (compute capability 7.0), and Turing (compute capability 7.5).\n'
18+
'If you wish to cross-compile for a single specific architecture,\n'
19+
'export TORCH_CUDA_ARCH_LIST="compute capability" before running setup.py.\n')
20+
if os.environ.get("TORCH_CUDA_ARCH_LIST", None) is None:
21+
os.environ["TORCH_CUDA_ARCH_LIST"] = "6.0;6.1;6.2;7.0;7.5"
1222

1323
print("torch.__version__ = ", torch.__version__)
1424
TORCH_MAJOR = int(torch.__version__.split('.')[0])

0 commit comments

Comments
 (0)