-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathsetup.py
25 lines (22 loc) · 785 Bytes
/
setup.py
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
from torch import cuda
from torch.utils.cpp_extension import BuildExtension, CUDAExtension
from setuptools import setup
sources = ['src/similar.cu',
'src/weighting.cu',
'localAttention.cpp']
if __name__ == '__main__':
assert cuda.is_available(), 'Please install CUDA for GPU support.'
extra_compile_args = {"nvcc": [
"-DCUDA_HAS_FP16=1",
"-D__CUDA_NO_HALF_OPERATORS__",
"-D__CUDA_NO_HALF_CONVERSIONS__",
"-D__CUDA_NO_HALF2_OPERATORS__"],
"cxx": []
}
setup(
name='localAttention',
ext_modules=[CUDAExtension('localAttention', sources,
extra_compile_args = extra_compile_args),
],
cmdclass={'build_ext': BuildExtension},
)