-
Notifications
You must be signed in to change notification settings - Fork 40
/
setup.py
67 lines (59 loc) · 2.09 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
from setuptools import setup
import os
import os.path as osp
import warnings
from torch.utils.cpp_extension import BuildExtension, CUDAExtension
ROOT_DIR = osp.dirname(osp.abspath(__file__))
__version__ = None
exec(open('svox2/version.py', 'r').read())
CUDA_FLAGS = []
INSTALL_REQUIREMENTS = []
include_dirs = [osp.join(ROOT_DIR, "svox2", "csrc", "include")]
# From PyTorch3D
cub_home = os.environ.get("CUB_HOME", None)
if cub_home is None:
prefix = os.environ.get("CONDA_PREFIX", None)
if prefix is not None and os.path.isdir(prefix + "/include/cub"):
cub_home = prefix + "/include"
if cub_home is None:
warnings.warn(
"The environment variable `CUB_HOME` was not found."
"Installation will fail if your system CUDA toolkit version is less than 11."
"NVIDIA CUB can be downloaded "
"from `https://github.com/NVIDIA/cub/releases`. You can unpack "
"it to a location of your choice and set the environment variable "
"`CUB_HOME` to the folder containing the `CMakeListst.txt` file."
)
else:
include_dirs.append(os.path.realpath(cub_home).replace("\\ ", " "))
try:
ext_modules = [
CUDAExtension('svox2.csrc', [
'svox2/csrc/svox2.cpp',
'svox2/csrc/svox2_kernel.cu',
'svox2/csrc/render_lerp_kernel_cuvol.cu',
'svox2/csrc/render_lerp_kernel_nvol.cu',
'svox2/csrc/render_svox1_kernel.cu',
'svox2/csrc/misc_kernel.cu',
'svox2/csrc/loss_kernel.cu',
'svox2/csrc/optim_kernel.cu',
], include_dirs=include_dirs,
optional=False),
]
except:
import warnings
warnings.warn("Failed to build CUDA extension")
ext_modules = []
setup(
name='svox2',
version=__version__,
author='Alex Yu',
author_email='alexyu99126@gmail.com',
description='PyTorch sparse voxel volume extension, including custom CUDA kernels',
long_description='PyTorch sparse voxel volume extension, including custom CUDA kernels',
ext_modules=ext_modules,
setup_requires=['pybind11>=2.5.0'],
packages=['svox2', 'svox2.csrc'],
cmdclass={'build_ext': BuildExtension},
zip_safe=False,
)