-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathsetup.py
52 lines (45 loc) · 1.33 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
from pathlib import Path
from setuptools import setup
import torch
from torch.utils.cpp_extension import BuildExtension, CppExtension
import os
ROOT = os.path.dirname(os.path.abspath(__file__))
has_cuda = torch.cuda.is_available()
include_dirs = [
os.path.join(ROOT, "mast3r_slam/backend/include"),
os.path.join(ROOT, "thirdparty/eigen"),
]
sources = [
"mast3r_slam/backend/src/gn.cpp",
]
extra_compile_args = {
"cores": ["j8"],
"cxx": ["-O3"],
}
if has_cuda:
from torch.utils.cpp_extension import CUDAExtension
sources.append("mast3r_slam/backend/src/gn_kernels.cu")
sources.append("mast3r_slam/backend/src/matching_kernels.cu")
extra_compile_args["nvcc"] = [
"-O3",
"-gencode=arch=compute_60,code=sm_60",
"-gencode=arch=compute_61,code=sm_61",
"-gencode=arch=compute_70,code=sm_70",
"-gencode=arch=compute_75,code=sm_75",
"-gencode=arch=compute_80,code=sm_80",
"-gencode=arch=compute_86,code=sm_86",
]
ext_modules = [
CUDAExtension(
"mast3r_slam_backends",
include_dirs=include_dirs,
sources=sources,
extra_compile_args=extra_compile_args,
)
]
else:
print("CUDA not found, cannot compile backend!")
setup(
ext_modules=ext_modules,
cmdclass={"build_ext": BuildExtension},
)