Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
f6cf1f9f
P
Paddle-Lite
项目概览
PaddlePaddle
/
Paddle-Lite
通知
338
Star
4
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
271
列表
看板
标记
里程碑
合并请求
78
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle-Lite
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
271
Issue
271
列表
看板
标记
里程碑
合并请求
78
合并请求
78
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
f6cf1f9f
编写于
4月 16, 2020
作者:
Y
yanghongtian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add hw_ascend_npu build script
上级
b4ec6c3b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
127 addition
and
2 deletion
+127
-2
lite/kernels/hw_ascend_npu/bridges/CMakeLists.txt
lite/kernels/hw_ascend_npu/bridges/CMakeLists.txt
+2
-2
lite/tools/build_hw_ascend_npu.sh
lite/tools/build_hw_ascend_npu.sh
+125
-0
未找到文件。
lite/kernels/hw_ascend_npu/bridges/CMakeLists.txt
浏览文件 @
f6cf1f9f
...
...
@@ -14,8 +14,8 @@ lite_cc_library(subgraph_bridge_graph_hw_ascend_npu
set
(
hw_ascend_npu_subgraph_bridge_deps subgraph_bridge_registry subgraph_bridge_utility_hw_ascend_npu subgraph_bridge_graph_hw_ascend_npu
)
lite_cc_library
(
subgraph_bridge_act_op_hw_ascend_npu SRCS act_op.cc DEPS
${
hw_ascend_npu_
builder_lib
s
}
${
hw_ascend_npu_
subgraph_bridge_dep
s
}
)
${
hw_ascend_npu_
subgraph_bridge_dep
s
}
${
hw_ascend_npu_
builder_lib
s
}
)
set
(
hw_ascend_npu_subgraph_bridges
subgraph_bridge_graph_hw_ascend_npu
...
...
lite/tools/build_hw_ascend_npu.sh
0 → 100755
浏览文件 @
f6cf1f9f
#!/bin/bash
set
-ex
# global variables with default value
ASCEND_HOME
=
"/usr/local/Ascend"
# Ascend SDK root directory
TARGET_NAME
=
"test_subgraph_pass"
# default target
BUILD_EXTRA
=
ON
# ON(with sequence ops)/OFF
WITH_TESTING
=
ON
# ON/OFF
function
print_usage
{
echo
-e
"
\n
USAGE:"
echo
echo
"----------------------------------------"
echo
-e
"--hw_ascend_npu_sdk_root=<huawei ascend npu sdk directory>"
echo
-e
"--target_name=<target name>"
echo
"----------------------------------------"
echo
}
# readonly variables with default value
readonly
CMAKE_COMMON_OPTIONS
=
"-DWITH_LITE=ON
\
-DLITE_WITH_LIGHT_WEIGHT_FRAMEWORK=OFF
\
-DWITH_PYTHON=OFF
\
-DLITE_WITH_ARM=OFF"
readonly
NUM_CORES_FOR_COMPILE
=
2
echo
"-------------NUM_CORES_FOR_COMPILE =
$NUM_CORES_FOR_COMPILE
"
readonly
THIRDPARTY_TAR
=
https://paddle-inference-dist.bj.bcebos.com/PaddleLite/third-party-05b862.tar.gz
readonly
workspace
=
$(
pwd
)
function
prepare_thirdparty
{
if
[
!
-d
$workspace
/third-party
-o
-f
$workspace
/third-party-05b862.tar.gz
]
;
then
rm
-rf
$workspace
/third-party
if
[
!
-f
$workspace
/third-party-05b862.tar.gz
]
;
then
wget
$THIRDPARTY_TAR
fi
tar
xzf third-party-05b862.tar.gz
else
#git submodule update --init --recursive
echo
"-------------"
fi
}
# for code gen, a source file is generated after a test, but is dependended by some targets in cmake.
# here we fake an empty file to make cmake works.
function
prepare_workspace
{
# in build directory
# 1. Prepare gen_code file
GEN_CODE_PATH_PREFIX
=
lite/gen_code
mkdir
-p
./
${
GEN_CODE_PATH_PREFIX
}
touch
./
${
GEN_CODE_PATH_PREFIX
}
/__generated_code__.cc
# 2.Prepare debug tool
DEBUG_TOOL_PATH_PREFIX
=
lite/tools/debug
mkdir
-p
./
${
DEBUG_TOOL_PATH_PREFIX
}
cp
../
${
DEBUG_TOOL_PATH_PREFIX
}
/analysis_tool.py ./
${
DEBUG_TOOL_PATH_PREFIX
}
/
# clone submodule
# git submodule update --init --recursive
prepare_thirdparty
}
function
build_hw_ascend_npu
{
build_dir
=
${
workspace
}
/build.lite.hw_ascend_npu
mkdir
-p
$build_dir
cd
$build_dir
export
LD_LIBRARY_PATH
=
"
$LD_LIBRARY_PATH
:
$PWD
/third_party/install/mklml/lib"
prepare_workspace
cmake ..
\
${
CMAKE_COMMON_OPTIONS
}
\
-DWITH_GPU
=
OFF
\
-DWITH_MKLDNN
=
OFF
\
-DLITE_WITH_X86
=
ON
\
-DWITH_MKL
=
ON
\
-DLITE_WITH_HW_ASCEND_NPU
=
ON
\
-DLITE_BUILD_EXTRA
=
${
BUILD_EXTRA
}
\
-DWITH_TESTING
=
${
WITH_TESTING
}
\
-DASCEND_HOME
=
${
HW_ASCEND_NPU_SDK_ROOT
}
make
-j
$NUM_CORES_FOR_COMPILE
cd
-
echo
"Done"
}
function
main
{
# Parse command line.
for
i
in
"
$@
"
;
do
case
$i
in
--target_name
=
*
)
TARGET_NAME
=
"
${
i
#*=
}
"
shift
;;
--build_extra
=
*
)
BUILD_EXTRA
=
"
${
i
#*=
}
"
shift
;;
--hw_ascend_npu_sdk_root
=
*
)
HW_ASCEND_NPU_SDK_ROOT
=
"
${
i
#*=
}
"
shift
;;
build
)
HW_ASCEND_NPU_SDK_ROOT
=
"
${
ASCEND_HOME
}
"
build_hw_ascend_npu
shift
;;
full_publish
)
TARGET_NAME
=
publish_inference
HW_ASCEND_NPU_SDK_ROOT
=
"
${
ASCEND_HOME
}
"
build_hw_ascend_npu
shift
;;
*
)
# unknown option
print_usage
exit
1
;;
esac
done
}
main
$@
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录