['-O3', '--use_fast_math'] + version_dependent_macros })) # Check, if ATen/CUDAGenerator.h is found, otherwise use the new ATen/CUDAGeneratorImpl.h, due to breaking change in https://github.com/pytorch/pytorch/pull/36026 generator_flag = [] torch_dir = torch.__path__[0] if os.path.exists(os.path.join(torch_dir, 'include', 'ATen', 'CUDAGenerator.h')): generator_flag = ['-DOLD_GENERATOR'] if "--fast_multihead_attn" in sys.argv: from torch.utils.cpp_extension import CUDAExtension sys.argv.remove("--fast_multihead_attn") from torch.utils.cpp_extension import BuildExtension cmdclass['build_ext'] = BuildExtension.with_options(use_ninja=False) if torch.utils.cpp_extension.CUDA_HOME is None: raise RuntimeError( "--fast_multihead_attn was requested, but nvcc was not found. Are you sure your environment has nvcc available? If you're installing within a container from https://hub.docker.com/r/pytorch/pytorch, only images whose names contain 'devel' will provide nvcc." ) else: # Check, if CUDA11 is installed for compute capability 8.0 cc_flag = [] _, bare_metal_major, _ = get_cuda_bare_metal_version( cpp_extension.CUDA_HOME) if int(bare_metal_major) >= 11: cc_flag.append('-gencode') cc_flag.append('arch=compute_80,code=sm_80') subprocess.run([
return extensions install_requires = ['scipy'] setup_requires = ['pytest-runner'] tests_require = ['pytest', 'pytest-cov'] setup( name='torch_sparse', version='0.6.7', author='Matthias Fey', author_email='*****@*****.**', url='https://github.com/rusty1s/pytorch_sparse', description=('PyTorch Extension Library of Optimized Autograd Sparse ' 'Matrix Operations'), keywords=['pytorch', 'sparse', 'sparse-matrices', 'autograd'], license='MIT', python_requires='>=3.6', install_requires=install_requires, setup_requires=setup_requires, tests_require=tests_require, extras_require={'test': tests_require}, ext_modules=get_extensions() if not BUILD_DOCS else [], cmdclass={ 'build_ext': BuildExtension.with_options(no_python_abi_suffix=True, use_ninja=False) }, packages=find_packages(), )
readme = f.read() setup( # Metadata name=package_name, version=version, author="PyTorch Core Team", author_email="*****@*****.**", url="https://github.com/pytorch/vision", description= "image and video datasets and models for torch deep learning", long_description=readme, license="BSD", # Package info packages=find_packages(exclude=("test", )), package_data={ package_name: ["*.dll", "*.dylib", "*.so", "*.categories"] }, zip_safe=False, install_requires=requirements, extras_require={ "scipy": ["scipy"], }, ext_modules=get_extensions(), cmdclass={ "build_ext": BuildExtension.with_options(no_python_abi_suffix=True), "clean": clean, }, )
if torch.cuda.is_available() and (CUDA_HOME is not None or ROCM_HOME is not None): extension = CUDAExtension( 'torch_test_cpp_extension.torch_library', [ 'torch_library.cu' ], extra_compile_args={'cxx': CXX_FLAGS, 'nvcc': ['-O2']}) ext_modules.append(extension) # todo(mkozuki): Figure out the root cause if (not IS_WINDOWS) and torch.cuda.is_available() and CUDA_HOME is not None: cublas_extension = CUDAExtension( name='torch_test_cpp_extension.cublas_extension', sources=['cublas_extension.cpp'] ) ext_modules.append(cublas_extension) cusolver_extension = CUDAExtension( name='torch_test_cpp_extension.cusolver_extension', sources=['cusolver_extension.cpp'] ) ext_modules.append(cusolver_extension) setup( name='torch_test_cpp_extension', packages=['torch_test_cpp_extension'], ext_modules=ext_modules, include_dirs='self_compiler_include_dirs_test', cmdclass={'build_ext': BuildExtension.with_options(use_ninja=USE_NINJA)})
from setuptools import setup, find_packages from torch.utils.cpp_extension import CUDAExtension, BuildExtension import os import glob libname = "torch_batch_svd" ext_src = glob.glob(os.path.join(libname, 'csrc/*.cpp')) print(ext_src) setup(name=libname, packages=find_packages(exclude=('tests', 'build', 'csrc', 'include', 'torch_batch_svd.egg-info')), ext_modules=[CUDAExtension( libname + '._c', sources=ext_src, libraries=["cusolver", "cublas"], extra_compile_args={'cxx': ['-O2', '-I{}'.format('{}/include'.format(libname))], 'nvcc': ['-O2']} )], cmdclass={'build_ext': BuildExtension.with_options(use_ninja=False)} )
headers += ['src/roi_align_cuda.h'] defines += [('WITH_CUDA', None)] with_cuda = True this_file = os.path.dirname(os.path.realpath(__file__)) print(this_file) extra_objects = ['src/roi_align_kernel.cu.o'] extra_objects = [os.path.join(this_file, fname) for fname in extra_objects] # ffi = create_extension( # '_ext.roi_align', # headers=headers, # sources=sources, # define_macros=defines, # relative_to=__file__, # with_cuda=with_cuda, # extra_objects=extra_objects # ) # fix upper torch 1.0.1 ffi = BuildExtension('_ext.roi_align', headers=headers, sources=sources, define_macros=defines, relative_to=__file__, with_cuda=with_cuda, extra_objects=extra_objects) if __name__ == '__main__': ffi.build()
setup( name='odtk', version='0.2.5', description='Fast and accurate single shot object detector', author = 'NVIDIA Corporation', packages=['retinanet', 'retinanet.backbones'], ext_modules=[CUDAExtension('retinanet._C', ['csrc/extensions.cpp', 'csrc/engine.cpp', 'csrc/cuda/decode.cu', 'csrc/cuda/decode_rotate.cu', 'csrc/cuda/nms.cu', 'csrc/cuda/nms_iou.cu'], extra_compile_args={ 'cxx': ['-std=c++14', '-O2', '-Wall'], 'nvcc': [ '-std=c++14', '--expt-extended-lambda', '--use_fast_math', '-Xcompiler', '-Wall', '-gencode=arch=compute_60,code=sm_60', '-gencode=arch=compute_61,code=sm_61', '-gencode=arch=compute_70,code=sm_70', '-gencode=arch=compute_72,code=sm_72', '-gencode=arch=compute_75,code=sm_75', '-gencode=arch=compute_75,code=compute_75' ], }, libraries=['nvinfer', 'nvinfer_plugin', 'nvonnxparser']) ], cmdclass={'build_ext': BuildExtension.with_options(no_python_abi_suffix=True)}, install_requires=[ 'torch>=1.0.0a0', 'torchvision', 'apex @ git+https://github.com/NVIDIA/apex', 'pycocotools @ git+https://github.com/nvidia/cocoapi.git#subdirectory=PythonAPI', 'pillow', 'requests', ], entry_points = {'console_scripts': ['odtk=retinanet.main:main']} )
), ] # Python interface setup( name="MinkowskiEngine", version=find_version("MinkowskiEngine", "__init__.py"), install_requires=["torch", "numpy"], packages=[ "MinkowskiEngine", "MinkowskiEngine.utils", "MinkowskiEngine.modules" ], package_dir={"MinkowskiEngine": "./MinkowskiEngine"}, ext_modules=ext_modules, include_dirs=[str(SRC_PATH), str(SRC_PATH / "3rdparty"), *include_dirs], cmdclass={"build_ext": BuildExtension.with_options(use_ninja=True)}, author="Christopher Choy", author_email="*****@*****.**", description="a convolutional neural network library for sparse tensors", long_description=read("README.md"), long_description_content_type="text/markdown", url="https://github.com/NVIDIA/MinkowskiEngine", keywords=[ "pytorch", "Minkowski Engine", "Sparse Tensor", "Convolutional Neural Networks", "3D Vision", "Deep Learning", ], zip_safe=False,
# It's an old-style class in Python 2.7... distutils.command.clean.clean.run(self) setuptools.setup( name=package_name, version=version, author="Christian Puhrsch", author_email="*****@*****.**", description="NestedTensors for PyTorch", long_description=readme, long_description_content_type="text/markdown", url="https://github.com/pytorch/nestedtensor", packages=setuptools.find_packages(), classifiers=[ "Programming Language :: Python :: 3", "Operating System :: OS Independent", ], zip_safe=True, cmdclass={ "clean": clean, "build_ext": BuildExtension.with_options(no_python_abi_suffix=True, use_ninja=os.environ.get( "USE_NINJA", False)), }, install_requires=requirements, ext_modules=get_extensions(), )
from torch.utils.cpp_extension import BuildExtension sources = ['src/nms.c'] headers = ['src/nms.h'] defines = [] with_cuda = False if torch.cuda.is_available(): print('Including CUDA code.') sources += ['src/nms_cuda.c'] headers += ['src/nms_cuda.h'] defines += [('WITH_CUDA', None)] with_cuda = True this_file = os.path.dirname(os.path.realpath(__file__)) print(this_file) extra_objects = ['src/cuda/nms_kernel.cu.o'] extra_objects = [os.path.join(this_file, fname) for fname in extra_objects] ffi = BuildExtension('_ext.nms', headers=headers, sources=sources, define_macros=defines, relative_to=__file__, with_cuda=with_cuda, extra_objects=extra_objects, extra_compile_args=['-std=c99']) if __name__ == '__main__': ffi.build()
class FBGEMM_GPU_BuildExtension(BuildExtension.with_options(no_python_abi_suffix=True)): def build_extension(self, ext): generate_jinja_files() super().build_extension(ext)
extra_objects += ['src/cuda/dcn_v2_psroi_pooling_cuda_double.cu.o'] with_cuda = True else: raise ValueError('CUDA is not available') extra_compile_args = ['-fopenmp', '-std=c99'] this_file = os.path.dirname(os.path.realpath(__file__)) print(this_file) sources = [os.path.join(this_file, fname) for fname in sources] headers = [os.path.join(this_file, fname) for fname in headers] extra_objects = [os.path.join(this_file, fname) for fname in extra_objects] ffi = BuildExtension('_ext.dcn_v2_double', headers=headers, sources=sources, define_macros=defines, relative_to=__file__, with_cuda=with_cuda, extra_objects=extra_objects, extra_compile_args=extra_compile_args) # ffi = create_extension( # '_ext.dcn_v2_double', # headers=headers, # sources=sources, # define_macros=defines, # relative_to=__file__, # with_cuda=with_cuda, # extra_objects=extra_objects, # extra_compile_args=extra_compile_args # ) if __name__ == '__main__':