"docs/git@developer.sourcefind.cn:OpenDAS/vision.git" did not exist on "a9e4cea0cdb350de950b9bccd989fad19f826d8d"
Commit 8b78601b authored by rusty1s's avatar rusty1s
Browse files

generic install

parent 77bb0595
import platform import platform
import os.path as osp
from glob import glob
from setuptools import setup, find_packages from setuptools import setup, find_packages
from sys import argv from sys import argv
import torch import torch
from torch.utils.cpp_extension import CppExtension, CUDAExtension, CUDA_HOME from torch.utils.cpp_extension import CppExtension, CUDAExtension, CUDA_HOME
cxx_extra_compile_args = []
nvcc_extra_compile_args = []
TORCH_MAJOR = int(torch.__version__.split('.')[0]) TORCH_MAJOR = int(torch.__version__.split('.')[0])
TORCH_MINOR = int(torch.__version__.split('.')[1]) TORCH_MINOR = int(torch.__version__.split('.')[1])
extra_compile_args = [] extra_compile_args = []
if (TORCH_MAJOR > 1) or (TORCH_MAJOR == 1 and TORCH_MINOR > 2): if (TORCH_MAJOR > 1) or (TORCH_MAJOR == 1 and TORCH_MINOR > 2):
extra_compile_args += ['-DVERSION_GE_1_3'] cxx_extra_compile_args += ['-DVERSION_GE_1_3']
nvcc_extra_compile_args += ['-DVERSION_GE_1_3']
cmdclass = {'build_ext': torch.utils.cpp_extension.BuildExtension}
ext_modules = [ ext_modules = []
exts = [e.split(osp.sep)[-1][:-4] for e in glob(osp.join('cpu', '*.cpp'))]
ext_modules += [
CppExtension( CppExtension(
'torch_sparse.spspmm_cpu', f'torch_sparse.{ext}_cpu', [f'cpu/{ext}.cpp'],
['cpu/spspmm.cpp'], extra_compile_args=cxx_extra_compile_args) for ext in exts
extra_compile_args=extra_compile_args,
),
] ]
cmdclass = {'build_ext': torch.utils.cpp_extension.BuildExtension}
GPU = True
for arg in argv:
if arg == '--cpu':
GPU = False
argv.remove(arg)
if CUDA_HOME is not None and GPU: if CUDA_HOME is not None and '--cpu' not in argv:
if platform.system() == 'Windows': if platform.system() == 'Windows':
extra_link_args = ['cusparse.lib'] extra_link_args = ['cusparse.lib']
else: else:
extra_link_args = ['-lcusparse', '-l', 'cusparse'] extra_link_args = ['-lcusparse', '-l', 'cusparse']
exts = [e.split(osp.sep)[-1][:-4] for e in glob(osp.join('cuda', '*.cpp'))]
ext_modules += [ ext_modules += [
CUDAExtension( CUDAExtension(
'torch_sparse.spmm_cuda', f'torch_sparse.{ext}_cuda',
['cuda/spmm.cpp', 'cuda/spmm_kernel.cu'], [f'cuda/{ext}.cpp', f'cuda/{ext}_kernel.cu'],
extra_compile_args=extra_compile_args, extra_compile_args={
), 'cxx': cxx_extra_compile_args,
CUDAExtension( 'nvcc': nvcc_extra_compile_args,
'torch_sparse.spspmm_cuda', },
['cuda/spspmm.cpp', 'cuda/spspmm_kernel.cu'],
extra_link_args=extra_link_args, extra_link_args=extra_link_args,
extra_compile_args=extra_compile_args, ) for ext in exts
),
CUDAExtension(
'torch_sparse.unique_cuda',
['cuda/unique.cpp', 'cuda/unique_kernel.cu'],
extra_compile_args=extra_compile_args,
),
] ]
__version__ = '0.4.3' __version__ = '0.4.3'
...@@ -67,12 +61,7 @@ setup( ...@@ -67,12 +61,7 @@ setup(
author_email='matthias.fey@tu-dortmund.de', author_email='matthias.fey@tu-dortmund.de',
url=url, url=url,
download_url='{}/archive/{}.tar.gz'.format(url, __version__), download_url='{}/archive/{}.tar.gz'.format(url, __version__),
keywords=[ keywords=['pytorch', 'sparse', 'sparse-matrices', 'autograd'],
'pytorch',
'sparse',
'sparse-matrices',
'autograd',
],
install_requires=install_requires, install_requires=install_requires,
setup_requires=setup_requires, setup_requires=setup_requires,
tests_require=tests_require, tests_require=tests_require,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment