pytorch/test/cpp_extensions/setup.py
Soumith Chintala 0016dad841
[pytorch] minor fixes around binary builds (#6291)
* remove patch

* check that cuda dev environment is also present before running cpp_extension cuda tests

* add OSError to list of exceptions when c++filt is not found
2018-04-04 22:37:13 -04:00

26 lines
809 B
Python

import torch.cuda
from setuptools import setup
from torch.utils.cpp_extension import CppExtension, CUDAExtension
from torch.utils.cpp_extension import CUDA_HOME
ext_modules = [
CppExtension(
'torch_test_cpp_extension', ['extension.cpp'],
extra_compile_args=['-g']),
]
if torch.cuda.is_available() and CUDA_HOME is not None:
extension = CUDAExtension(
'torch_test_cuda_extension', [
'cuda_extension.cpp',
'cuda_extension_kernel.cu',
'cuda_extension_kernel2.cu',
],
extra_compile_args={'cxx': ['-g'],
'nvcc': ['-O2']})
ext_modules.append(extension)
setup(
name='torch_test_cpp_extension',
ext_modules=ext_modules,
cmdclass={'build_ext': torch.utils.cpp_extension.BuildExtension})