def get_cmds(): cmds = versioneer.get_cmdclass() if not (BUILD_CPP or BUILD_CUDA): return cmds cmds.update({"build_ext": BuildExtension.with_options(no_python_abi_suffix=True)}) return cmds
setup_requires = ['pytest-runner'] tests_require = ['pytest', 'pytest-cov', 'scipy'] setup( name='torch_cluster', version='1.5.7', author='Matthias Fey', author_email='*****@*****.**', url='https://github.com/rusty1s/pytorch_cluster', description=('PyTorch Extension Library of Optimized Graph Cluster ' 'Algorithms'), keywords=[ 'pytorch', 'geometric-deep-learning', 'graph-neural-networks', 'cluster-algorithms', ], 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(), )
# Final effective mask is the bitwise OR of each op BUILD_MASK = (DS_BUILD_LAMB | DS_BUILD_TRANSFORMER | DS_BUILD_SPARSE_ATTN) install_ops = [] if BUILD_MASK & DS_BUILD_LAMB: install_ops.append('lamb') if BUILD_MASK & DS_BUILD_TRANSFORMER: install_ops.append('transformer') if BUILD_MASK & DS_BUILD_SPARSE_ATTN: install_ops.append('sparse-attn') if len(install_ops) == 0: print("Building without any cuda/cpp extensions") print(f'BUILD_MASK={BUILD_MASK}, install_ops={install_ops}') cmdclass = {} cmdclass['build_ext'] = BuildExtension.with_options(use_ninja=False) TORCH_MAJOR = int(torch.__version__.split('.')[0]) TORCH_MINOR = int(torch.__version__.split('.')[1]) if not torch.cuda.is_available(): # Fix to allow docker buils, similar to https://github.com/NVIDIA/apex/issues/486 print( "[WARNING] Torch did not find cuda available, if cross-compling or running with cpu only " "you can ignore this message. Adding compute capability for Pascal, Volta, and Turing " "(compute capabilities 6.0, 6.1, 6.2)") if os.environ.get("TORCH_CUDA_ARCH_LIST", None) is None: os.environ["TORCH_CUDA_ARCH_LIST"] = "6.0;6.1;6.2;7.0;7.5" # Fix from apex that might be relevant for us as well, related to https://github.com/NVIDIA/apex/issues/456 version_ge_1_1 = []
# It's an old-style class in Python 2.7... distutils.command.clean.clean.run(self) setuptools.setup( name=package_name, version=package_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( use_ninja=os.environ.get("NT_USE_NINJA", False)), }, install_requires=requirements, ext_modules=get_extensions(), )
'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' ], }, library_dirs=['/usr/local/lib/'], libraries=[ 'nvinfer', 'nvinfer_plugin', 'nvonnxparser', 'opencv_core', 'opencv_highgui', 'opencv_imgproc', 'opencv_imgcodecs' ]) ], 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==6.2.2', 'requests', ], entry_points={'console_scripts': ['retinanet=retinanet.main:main']})
import torch from setuptools import setup from torch.utils.cpp_extension import BuildExtension, CUDAExtension cxx_args = ['-std=c++14'] nvcc_args = [ #'-gencode', 'arch=compute_50,code=sm_50', #'-gencode', 'arch=compute_52,code=sm_52', '-gencode', 'arch=compute_60,code=sm_60', # '-gencode', 'arch=compute_61,code=sm_61', '-gencode', 'arch=compute_75,code=sm_75', '-gencode', 'arch=compute_75,code=compute_75' ] setup(name='local_attn_reshape_cuda', ext_modules=[ CUDAExtension( 'local_attn_reshape_cuda', ['local_attn_reshape_cuda.cc', 'local_attn_reshape_kernel.cu'], extra_compile_args={ 'cxx': cxx_args, 'nvcc': nvcc_args }) ], cmdclass={'build_ext': BuildExtension.with_options(use_ninja=False)})
from setuptools import setup from torch.utils.cpp_extension import BuildExtension, CppExtension setup( name="warp_perspective", ext_modules=[ CppExtension( "warp_perspective", ["example_app/warp_perspective/op.cpp"], libraries=["opencv_core", "opencv_imgproc"], ) ], cmdclass={"build_ext": BuildExtension.with_options(no_python_abi_suffix=True)}, )
), ] # 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,
] if torch.cuda.is_available() and (CUDA_HOME is not None or ROCM_HOME is not None): extension = CUDAExtension('torch_test_cpp_extension.cuda', [ 'cuda_extension.cpp', 'cuda_extension_kernel.cu', 'cuda_extension_kernel2.cu', ], extra_compile_args={ 'cxx': CXX_FLAGS, 'nvcc': ['-O2'] }) ext_modules.append(extension) 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) 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)})
# 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(), )
class FBGEMM_GPU_BuildExtension( BuildExtension.with_options(no_python_abi_suffix=True)): def build_extension(self, ext): generate_jinja_files() super().build_extension(ext)
from setuptools import find_packages from setuptools import setup from torch.utils.cpp_extension import BuildExtension, CUDAExtension setup( name='fused_lamb', description="Fused LAMB Optimizer for PyTorch native AMP training", packages=find_packages(exclude=('test', )), # NOQA ext_modules=[ CUDAExtension(name='fused_lamb_CUDA', sources=[ 'csrc/frontend.cpp', 'csrc/multi_tensor_l2norm_kernel.cu', 'csrc/multi_tensor_lamb.cu', ], extra_compile_args={ 'nvcc': [ '-lineinfo', '-O3', '--use_fast_math', ], }), ], cmdclass={ 'build_ext': BuildExtension.with_options(use_ninja=True), }, )