setup.py 3.91 KB
Newer Older
Yizhou Wang's avatar
Yizhou Wang committed
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
import os
from setuptools import setup, find_packages

import torch
from torch.utils.cpp_extension import BuildExtension, CUDAExtension

os.environ['CFLAGS'] = '-Wno-deprecated-declarations'  # suppress warnings in debug mode

def readme():
    with open('README.md', encoding='utf-8') as f:
        content = f.read()
    return content


def get_requirements(filename='requirements.txt'):
    here = os.path.dirname(os.path.realpath(__file__))
    with open(os.path.join(here, filename), 'r') as f:
        requires = [line.replace('\n', '') for line in f.readlines()]
    return requires


def make_cuda_ext(name, module, sources):
    define_macros = []

    if torch.cuda.is_available() or os.getenv('FORCE_CUDA', '0') == '1':
        define_macros += [('WITH_CUDA', None)]
    else:
        raise EnvironmentError('CUDA is required to compile RODNet!')

    return CUDAExtension(
        name='{}.{}'.format(module, name),
        sources=[os.path.join(*module.split('.'), p) for p in sources],
        define_macros=define_macros,
        extra_compile_args={
            'cxx': [],
            'nvcc': [
                '-D__CUDA_NO_HALF_OPERATORS__',
                '-D__CUDA_NO_HALF_CONVERSIONS__',
                '-D__CUDA_NO_HALF2_OPERATORS__',
            ]
        })


if __name__ == '__main__':
    setup(
        name='rodnet',
yizhou-wang's avatar
yizhou-wang committed
47
        version='1.1',
Yizhou Wang's avatar
Yizhou Wang committed
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
        description='RODNet: Object Detection from Radar Data',
        long_description=readme(),
        long_description_content_type='text/markdown',
        url='https://github.com/yizhou-wang/RODNet',
        author='Yizhou Wang',
        author_email='ywang26@uw.edu',

        classifiers=[
            # How mature is this project? Common values are
            #   3 - Alpha
            #   4 - Beta
            #   5 - Production/Stable
            'Development Status :: 3 - Alpha',

            # Indicate who your project is intended for
            'Intended Audience :: Developers',
            'Topic :: Software Development :: Build Tools',

            # Pick your license as you wish
            'License :: OSI Approved :: MIT License',

            # Specify the Python versions you support here. In particular, ensure
            # that you indicate whether you support Python 2, Python 3 or both.
            # These classifiers are *not* checked by 'pip install'. See instead
            # 'python_requires' below.
            'Programming Language :: Python :: 3.6',
            'Programming Language :: Python :: 3.7',
            'Programming Language :: Python :: 3.8',
        ],
        keywords='rodnet, object detection, radar, autonomous driving',

        packages=find_packages(include=["rodnet.*"]),
yizhou-wang's avatar
yizhou-wang committed
80
        package_data={'rodnet.ops': ['*/*.so']},
Yizhou Wang's avatar
Yizhou Wang committed
81
82
        python_requires='>=3.6',
        install_requires=get_requirements(),
yizhou-wang's avatar
yizhou-wang committed
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
        ext_modules=[
            make_cuda_ext(
                name='deform_conv_2d_cuda',
                module='rodnet.ops.dcn',
                sources=[
                    'src/deform_conv_2d_cuda.cpp',
                    'src/deform_conv_2d_cuda_kernel.cu'
                ]),
            make_cuda_ext(
                name='deform_conv_3d_cuda',
                module='rodnet.ops.dcn',
                sources=[
                    'src/deform_conv_3d_cuda.cpp',
                    'src/deform_conv_3d_cuda_kernel.cu'
                ]),
            make_cuda_ext(
                name='deform_pool_2d_cuda',
                module='rodnet.ops.dcn',
                sources=[
                    'src/deform_pool_2d_cuda.cpp',
                    'src/deform_pool_2d_cuda_kernel.cu'
                ]),
            make_cuda_ext(
                name='deform_pool_3d_cuda',
                module='rodnet.ops.dcn',
                sources=[
                    'src/deform_pool_3d_cuda.cpp',
                    'src/deform_pool_3d_cuda_kernel.cu'
                ]),
        ],
        cmdclass={'build_ext': BuildExtension},
Yizhou Wang's avatar
Yizhou Wang committed
114
115
        zip_safe=False
    )