-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
43 lines (35 loc) · 939 Bytes
/
setup.py
File metadata and controls
43 lines (35 loc) · 939 Bytes
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
import os
from setuptools import setup
from torch.utils.cpp_extension import (
BuildExtension,
CUDAExtension,
)
def get_extensions():
debug_mode = os.getenv("DEBUG", "0") == "1"
if debug_mode:
print("Compiling in debug mode")
extra_link_args = []
extra_compile_args = {
"nvcc": [
"-O3" if not debug_mode else "-O0",
],
}
if debug_mode:
extra_compile_args["nvcc"].append("-g")
extra_link_args.extend(["-O0", "-g"])
ext_modules = [
CUDAExtension(
"patchmatch._C",
["src/patchmatch/patchmatch.cu"],
extra_compile_args=extra_compile_args,
extra_link_args=extra_link_args,
)
]
return ext_modules
setup(
packages=["patchmatch"],
package_dir={"": "src"},
py_modules=["patchmatch.ops"],
ext_modules=get_extensions(),
cmdclass={"build_ext": BuildExtension},
)