-
Notifications
You must be signed in to change notification settings - Fork 489
/
Copy pathsetup.py
52 lines (46 loc) · 1.35 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
import os
import sys
import torch
from skbuild import setup
extra_cmake_args = []
if sys.platform == "linux":
_nvcc_paths = (
[]
if os.getenv("CMAKE_CUDA_COMPILER") is None
else [os.getenv("CMAKE_CUDA_COMPILER")]
) + [
"/usr/bin/nvcc",
"/usr/local/bin/nvcc",
"/usr/local/cuda/bin/nvcc",
"/usr/cuda/bin/nvcc",
]
for _nvcc_path in _nvcc_paths:
try:
os.stat(_nvcc_path)
extra_cmake_args.append(f"-DCMAKE_CUDA_COMPILER={_nvcc_path}")
break
except FileNotFoundError:
pass
else:
raise RuntimeError(f"Cannot find nvcc in [{','.join(_nvcc_paths)}]")
if os.getenv("CUDA_TOOLKIT_ROOT_DIR") is None:
extra_cmake_args.append(
f'-DCUDA_TOOLKIT_ROOT_DIR={os.path.abspath(os.path.join(os.path.dirname(_nvcc_path), ".."))}'
)
else:
extra_cmake_args.append(
f"-DCUDA_TOOLKIT_ROOT_DIR={os.getenv('CUDA_TOOLKIT_ROOT_DIR')}"
)
setup(
name="torchrec_dynamic_embedding",
package_dir={"": "src"},
packages=["torchrec_dynamic_embedding"],
cmake_args=[
"-DCMAKE_BUILD_TYPE=Release",
f"-DTDE_TORCH_BASE_DIR={os.path.dirname(torch.__file__)}",
"-DTDE_WITH_TESTING=OFF",
]
+ extra_cmake_args,
cmake_install_dir="src",
version="0.0.1",
)