Commit 197bcc48 authored by Michael Carilli's avatar Michael Carilli
Browse files

Warning instead of error if nvcc is not found

parent b56a2088
......@@ -19,7 +19,7 @@ Installation requires CUDA 9 or later, PyTorch 0.4 or later, and Python 3. Insta
cd apex
python setup.py install [--cuda_ext] [--cpp_ext]
.. toctree::
:maxdepth: 1
:caption: AMP: Automatic Mixed Precision
......
......@@ -32,25 +32,29 @@ if "--cpp_ext" in sys.argv:
if "--cuda_ext" in sys.argv:
from torch.utils.cpp_extension import CUDAExtension
sys.argv.remove("--cuda_ext")
ext_modules.append(
CUDAExtension(name='fused_adam_cuda',
sources=['apex/optimizers/csrc/fused_adam_cuda.cpp',
'apex/optimizers/csrc/fused_adam_cuda_kernel.cu'],
extra_compile_args={'cxx': ['-O3',],
'nvcc':['-O3',
'--use_fast_math']}))
ext_modules.append(
CUDAExtension(name='syncbn',
sources=['csrc/syncbn.cpp',
'csrc/welford.cu']))
ext_modules.append(
CUDAExtension(name='fused_layer_norm_cuda',
sources=['apex/normalization/csrc/layer_norm_cuda.cpp',
'apex/normalization/csrc/layer_norm_cuda_kernel.cu'],
extra_compile_args={'cxx': ['-O3',],
'nvcc':['-maxrregcount=50',
'-O3',
'--use_fast_math']}))
if torch.utils.cpp_extension.CUDA_HOME is None:
print("Warning: nvcc is not available. Ignoring --cuda-ext")
else:
ext_modules.append(
CUDAExtension(name='fused_adam_cuda',
sources=['apex/optimizers/csrc/fused_adam_cuda.cpp',
'apex/optimizers/csrc/fused_adam_cuda_kernel.cu'],
extra_compile_args={'cxx': ['-O3',],
'nvcc':['-O3',
'--use_fast_math']}))
ext_modules.append(
CUDAExtension(name='syncbn',
sources=['csrc/syncbn.cpp',
'csrc/welford.cu']))
ext_modules.append(
CUDAExtension(name='fused_layer_norm_cuda',
sources=['apex/normalization/csrc/layer_norm_cuda.cpp',
'apex/normalization/csrc/layer_norm_cuda_kernel.cu'],
extra_compile_args={'cxx': ['-O3',],
'nvcc':['-maxrregcount=50',
'-O3',
'--use_fast_math']}))
setup(
name='apex',
......
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