0 Star 0 Fork 85

ascend-ci-bot/mxDriving

forked from Ascend/mxDriving 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
setup.py 1.76 KB
一键复制 编辑 原始数据 按行查看 历史
import glob
import os
import subprocess
from pathlib import Path
from typing import Union
import torch
from setuptools import find_packages, setup
from torch.utils.cpp_extension import BuildExtension
from utils import extension
BASE_DIR = os.path.dirname(os.path.realpath(__file__))
VERSION = torch.__version__
full_components = ["common", "preprocess", "fused", "point", "detection", "spconv"]
source_file = glob.glob(os.path.join("./bind/", "*.cpp"))
include_dirs = [os.path.join(BASE_DIR, "include")]
for part in full_components:
source_file += glob.glob(os.path.join(f"./mx_driving/{part}/ops/csrc/", "*.cpp"))
exts = []
ext1 = extension.NpuExtension(
name="ads_c",
sources=source_file,
include_dirs=include_dirs,
extra_compile_args=[
'-D__FILENAME__="$$(notdir $$(abspath $$<))"',
"-fprofile-arcs",
"-ftest-coverage",
"-fPIC",
"-fstack-protector-all",
],
extra_link_args=[
"-Wl,-z,relro",
"-Wl,-z,now",
"-s"
],
libraries=["gcov"],
)
exts.append(ext1)
def get_sha(pytorch_root: Union[str, Path]) -> str:
try:
return (
subprocess.check_output(["git", "rev-parse", "HEAD"], cwd=pytorch_root).decode("ascii").strip() # Compliant
)
except Exception:
return "Unknown"
VERSION = "1.0.0"
ads_root = Path(__file__).parent
sha = get_sha(ads_root)
if not os.getenv("BUILD_WITHOUT_SHA"):
VERSION += "+git" + sha[:7]
setup(
name="mx_driving",
version=VERSION,
description="A Library of acceleration for autonomous driving systems on Ascend-NPU.",
keywords="mx_driving",
ext_modules=exts,
author="Ascend Contributors",
cmdclass={"build_ext": BuildExtension},
packages=find_packages(),
include_package_data=True,
)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ascend-ci-bot/mxDriving.git
git@gitee.com:ascend-ci-bot/mxDriving.git
ascend-ci-bot
mxDriving
mxDriving
branch_v6.0.0-RC3

搜索帮助

0d507c66 1850385 C8b1a773 1850385