-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
36 lines (32 loc) · 832 Bytes
/
setup.py
File metadata and controls
36 lines (32 loc) · 832 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env python3
"""
Build script for CUDA add operator.
Usage: python setup.py build
"""
from setuptools import setup, Extension
from torch.utils.cpp_extension import BuildExtension, CUDAExtension
import os
os.environ['CC'] = 'gcc'
os.environ['CXX'] = 'g++'
this_dir = os.path.dirname(os.path.abspath(__file__))
setup(
name='torch_add_cuda',
version='0.1',
ext_modules=[
CUDAExtension(
name='torch_add_cuda',
sources=[
'src/add_pybind.cpp',
'src/add_cuda.cu',
],
include_dirs=[os.path.join(this_dir, 'include')],
extra_compile_args={
'cxx': ['-O3'],
'nvcc': ['-O3', '--use_fast_math']
},
)
],
cmdclass={
'build_ext': BuildExtension
},
)