Skip to content

Commit

Permalink
lite installation
Browse files Browse the repository at this point in the history
  • Loading branch information
yysijie committed Jan 15, 2020
1 parent 1cb7410 commit ab433d4
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 111 deletions.
32 changes: 3 additions & 29 deletions setup2.py → setup-fully.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
import time

from setuptools import find_packages, setup, Extension, dist

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

dist.Distribution().fetch_build_eggs(['Cython', 'numpy>=1.11.1'])

import numpy as np
Expand Down Expand Up @@ -118,28 +114,6 @@ def make_cython_ext(name, module, sources):
return extension


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 MMDetection!')

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__':
write_version_py()
setup(
Expand All @@ -166,9 +140,9 @@ def make_cuda_ext(name, module, sources):
license='Apache License 2.0',
setup_requires=['pytest-runner'],
tests_require=['pytest'],
# dependency_links=[
# 'git+https://github.com/open-mmlab/mmdetection#egg=mmdet'
# ],
dependency_links=[
'git+https://github.com/open-mmlab/mmdetection#egg=mmdet'
],
install_requires=get_requirements(),
ext_modules=[
Extension("mmskeleton.ops.nms.cpu_nms",
Expand Down
108 changes: 26 additions & 82 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,7 @@
import subprocess
import time

from setuptools import find_packages, setup, Extension, dist
dist.Distribution().fetch_build_eggs(['Cython', 'numpy>=1.11.1'])

import numpy as np
from Cython.Build import cythonize # noqa: E402

sys.path.append('./src')
from nms.setup_linux import custom_build_ext, CUDA
from setuptools import find_packages, setup


def readme():
Expand Down Expand Up @@ -99,79 +92,30 @@ def get_requirements(filename='requirements.txt'):
return requires


def make_cython_ext(name, module, sources):
extra_compile_args = None
if platform.system() != 'Windows':
extra_compile_args = {
'cxx': ['-Wno-unused-function', '-Wno-write-strings']
}
extension = Extension('{}.{}'.format(
module, name), [os.path.join(*module.split('.'), p) for p in sources],
include_dirs=[np.get_include()],
language='c++',
extra_compile_args=extra_compile_args)
extension, = cythonize(extension)
return extension


if __name__ == '__main__':
write_version_py()
setup(
name='mmskeleton',
version=get_version(),
scripts=['./tools/mmskl'],
description='Open MMLab Skeleton-based Human Understanding Toolbox',
long_description=readme(),
keywords='computer vision, human understanding, action recognition',
url='https://github.com/open-mmlab/mmskeleton',
packages=find_packages(exclude=('configs', 'tools', 'demo')),
package_data={'mmskeleton.ops': ['*/*.so']},
classifiers=[
'Development Status :: 4 - Beta',
'License :: OSI Approved :: Apache Software License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
],
license='Apache License 2.0',
setup_requires=['pytest-runner'],
tests_require=['pytest'],
dependency_links=[
'git+https://github.com/open-mmlab/mmdetection#egg=mmdet'
],
install_requires=get_requirements(),
ext_modules=[
Extension("mmskeleton.ops.nms.cpu_nms",
["mmskeleton/ops/nms/cpu_nms.pyx"],
extra_compile_args={
'gcc': ["-Wno-cpp", "-Wno-unused-function"]
},
include_dirs=[np.get_include()]),
Extension(
'mmskeleton.ops.nms.gpu_nms',
[
'mmskeleton/ops/nms/nms_kernel.cu',
'mmskeleton/ops/nms/gpu_nms.pyx'
],
library_dirs=[CUDA['lib64']],
libraries=['cudart'],
language='c++',
runtime_library_dirs=[CUDA['lib64']],
# this syntax is specific to this build system
# we're only going to use certain compiler args with nvcc and not with
# gcc the implementation of this trick is in customize_compiler() below
extra_compile_args={
'gcc': ["-Wno-unused-function"],
'nvcc': [
'-arch=sm_35', '--ptxas-options=-v', '-c',
'--compiler-options', "'-fPIC'"
]
},
include_dirs=[np.get_include(), CUDA['include']]),
],
cmdclass={'build_ext': custom_build_ext},
zip_safe=False)
setup(name='mmskeleton',
version=get_version(),
scripts=['./tools/mmskl'],
description='Open MMLab Skeleton-based Human Understanding Toolbox',
long_description=readme(),
keywords='computer vision, human understanding, action recognition',
url='https://github.com/open-mmlab/mmskeleton',
packages=find_packages(exclude=('configs', 'tools', 'demo')),
package_data={'mmskeleton.ops': ['*/*.so']},
classifiers=[
'Development Status :: 4 - Beta',
'License :: OSI Approved :: Apache Software License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
],
license='Apache License 2.0',
setup_requires=['pytest-runner'],
tests_require=['pytest'],
install_requires=get_requirements(),
zip_safe=False)

0 comments on commit ab433d4

Please sign in to comment.