forked from rmurai0610/MASt3R-SLAM
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
63 lines (55 loc) · 1.88 KB
/
Copy pathsetup.py
File metadata and controls
63 lines (55 loc) · 1.88 KB
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
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()
# Backend paths
backend_dir = None
if os.path.exists(os.path.join(ROOT, "splatt3r_slam/backend")):
backend_dir = "splatt3r_slam"
if backend_dir is None:
print("Warning: No backend directory found in splatt3r_slam")
ext_modules = []
else:
include_dirs = [
os.path.join(ROOT, f"{backend_dir}/backend/include"),
os.path.join(ROOT, "thirdparty/eigen"),
]
sources = [
f"{backend_dir}/backend/src/gn.cpp",
]
extra_compile_args = {
"cxx": ["-O3"],
}
if has_cuda:
from torch.utils.cpp_extension import CUDAExtension
sources.append(f"{backend_dir}/backend/src/gn_kernels.cu")
sources.append(f"{backend_dir}/backend/src/matching_kernels.cu")
# CUDA 13 dropped sm_<75 (Maxwell/Pascal/Volta); this list covers
# Turing through Hopper on CUDA 13.x toolchains. Developed with
# nvcc 13.3 on dual RTX A6000 (sm_86).
extra_compile_args["nvcc"] = [
"-O3",
"-gencode=arch=compute_75,code=sm_75",
"-gencode=arch=compute_80,code=sm_80",
"-gencode=arch=compute_86,code=sm_86",
"-gencode=arch=compute_89,code=sm_89",
"-gencode=arch=compute_90,code=sm_90",
]
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!")
ext_modules = []
setup(
ext_modules=ext_modules,
cmdclass={"build_ext": BuildExtension} if ext_modules else {},
)