forked from MoonshotAI/MoonEP
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
77 lines (62 loc) · 1.74 KB
/
Copy pathsetup.py
File metadata and controls
77 lines (62 loc) · 1.74 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
"""
moonep build script. Compiles the CUDA extension `moonep._C` (the pybind11
module living in csrc/bindings.cu) into the `moonep` package so it can be
imported as `from moonep import _C` after either:
pip install -e . # editable install (preferred)
or, for a quick in-place build without installing:
python setup.py build_ext --inplace
The .so lands at `moonep/_C.<abi-tag>.so`.
"""
import os
from setuptools import find_packages, setup
from torch.utils.cpp_extension import BuildExtension, CUDAExtension
REPO_ROOT = os.path.abspath(os.path.dirname(__file__))
nvcc_flags = [
"-O3",
"--use_fast_math",
"-std=c++20",
"--expt-extended-lambda",
"--expt-relaxed-constexpr",
"-forward-unknown-to-host-compiler",
"-Xcompiler=-Wno-psabi",
"-Xcompiler=-fno-strict-aliasing",
"-DNDEBUG",
"-lineinfo",
"-diag-suppress=3189",
"-ftemplate-backtrace-limit=0",
"-D__CUDA_NO_HALF_OPERATORS__",
"-D__CUDA_NO_HALF_CONVERSIONS__",
"-D__CUDA_NO_BFLOAT16_CONVERSIONS__",
"-D__CUDA_NO_HALF2_OPERATORS__",
]
cxx_flags = [
"-O3",
"-fno-strict-aliasing",
"-Wno-psabi",
]
ext_modules = [
CUDAExtension(
name="moonep._C",
sources=[
os.path.join("csrc", "bindings.cu"),
],
include_dirs=[
os.path.join(REPO_ROOT, "csrc"),
],
libraries=["cuda"],
extra_compile_args={
"cxx": cxx_flags,
"nvcc": nvcc_flags,
},
),
]
setup(
name="moonep",
version="0.0.1",
packages=find_packages(include=["moonep", "moonep.*"]),
install_requires=[
"nvidia-cutlass-dsl==4.4.2",
],
ext_modules=ext_modules,
cmdclass={"build_ext": BuildExtension},
)