-
Notifications
You must be signed in to change notification settings - Fork 4
/
setup.py
58 lines (49 loc) · 1.85 KB
/
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
from setuptools import setup
from torch.utils.cpp_extension import BuildExtension, CUDAExtension, CppExtension
from os.path import join
CPU_ONLY = False
project_root = 'Correlation_Module'
source_files = ['correlation_sampler.cpp']
with open("README.md", "r") as fh:
long_description = fh.read()
def launch_setup():
if CPU_ONLY:
assert(False)
Extension = CppExtension
macro = []
else:
Extension = CUDAExtension
source_files.append('correlation_cuda_kernel.cu')
macro = [("USE_CUDA", None)]
sources = [join(project_root, file) for file in source_files]
setup(
name='spatial_correlation_sampler',
version="0.2.0",
author="Clément Pinard",
author_email="clement.pinard@ensta-paristech.fr",
description="Correlation module for pytorch",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/ClementPinard/Pytorch-Correlation-extension",
install_requires=['torch>=1.1', 'numpy'],
ext_modules=[
Extension('spatial_correlation_sampler_backend',
sources,
define_macros=macro,
extra_compile_args={'cxx': ['-fopenmp'], 'nvcc':[]},
extra_link_args=['-lgomp'])
],
package_dir={'': project_root},
packages=['spatial_correlation_sampler'],
cmdclass={
'build_ext': BuildExtension
},
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: POSIX :: Linux",
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering :: Artificial Intelligence"
])
if __name__ == '__main__':
launch_setup()