Skip to content

Commit

Permalink
Remove extension code in setup (#4)
Browse files Browse the repository at this point in the history
* Remove extension code in setup

* Update author in setup
  • Loading branch information
linyq17 committed Nov 24, 2021
1 parent b7ea18d commit 5e4aa6d
Showing 1 changed file with 2 additions and 31 deletions.
33 changes: 2 additions & 31 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
# Copyright (c) OpenMMLab. All rights reserved.
import os
import os.path as osp
import platform
Expand All @@ -7,10 +7,6 @@
import warnings
from setuptools import find_packages, setup

import torch
from torch.utils.cpp_extension import (BuildExtension, CppExtension,
CUDAExtension)


def readme():
with open('README.md', encoding='utf-8') as f:
Expand All @@ -27,30 +23,6 @@ def get_version():
return locals()['__version__']


def make_cuda_ext(name, module, sources, sources_cuda=[]):
define_macros = []
extra_compile_args = {'cxx': []}

if torch.cuda.is_available() or os.getenv('FORCE_CUDA', '0') == '1':
define_macros += [('WITH_CUDA', None)]
extension = CUDAExtension
extra_compile_args['nvcc'] = [
'-D__CUDA_NO_HALF_OPERATORS__',
'-D__CUDA_NO_HALF_CONVERSIONS__',
'-D__CUDA_NO_HALF2_OPERATORS__',
]
sources += sources_cuda
else:
print(f'Compiling {name} without CUDA')
extension = CppExtension

return extension(
name=f'{module}.{name}',
sources=[os.path.join(*module.split('.'), p) for p in sources],
define_macros=define_macros,
extra_compile_args=extra_compile_args)


def parse_requirements(fname='requirements.txt', with_version=True):
"""Parse the package dependencies listed in a requirements file but strips
specific versioning information.
Expand Down Expand Up @@ -187,7 +159,7 @@ def add_mim_extension():
description='OpenMMLab FewShot Learning Toolbox and Benchmark',
long_description=readme(),
long_description_content_type='text/markdown',
author='OpenMMLab',
author='MMFewShot Contributors',
author_email='openmmlab@gmail.com',
keywords='computer vision, few shot learning',
url='https://github.com/open-mmlab/mmfewshot',
Expand All @@ -211,5 +183,4 @@ def add_mim_extension():
'optional': parse_requirements('requirements/optional.txt'),
},
ext_modules=[],
cmdclass={'build_ext': BuildExtension},
zip_safe=False)

0 comments on commit 5e4aa6d

Please sign in to comment.