Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Path: blob/master/utils/nms_rotated/setup.py
Views: 475
#!/usr/bin/env python1import os2import subprocess3import time4from setuptools import find_packages, setup56import torch7from torch.utils.cpp_extension import (BuildExtension, CppExtension,8CUDAExtension)9def make_cuda_ext(name, module, sources, sources_cuda=[]):1011define_macros = []12extra_compile_args = {'cxx': []}1314if torch.cuda.is_available() or os.getenv('FORCE_CUDA', '0') == '1':15define_macros += [('WITH_CUDA', None)]16extension = CUDAExtension17extra_compile_args['nvcc'] = [18'-D__CUDA_NO_HALF_OPERATORS__',19'-D__CUDA_NO_HALF_CONVERSIONS__',20'-D__CUDA_NO_HALF2_OPERATORS__',21]22sources += sources_cuda23else:24print(f'Compiling {name} without CUDA')25extension = CppExtension26# raise EnvironmentError('CUDA is required to compile MMDetection!')2728return extension(29name=f'{module}.{name}',30sources=[os.path.join(*module.split('.'), p) for p in sources],31define_macros=define_macros,32extra_compile_args=extra_compile_args)3334# python setup.py develop35if __name__ == '__main__':36#write_version_py()37setup(38name='nms_rotated',39ext_modules=[40make_cuda_ext(41name='nms_rotated_ext',42module='',43sources=[44'src/nms_rotated_cpu.cpp',45'src/nms_rotated_ext.cpp'46],47sources_cuda=[48'src/nms_rotated_cuda.cu',49'src/poly_nms_cuda.cu',50]),51],52cmdclass={'build_ext': BuildExtension},53zip_safe=False)5455