Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
cd809d8c
S
Serving
项目概览
PaddlePaddle
/
Serving
大约 1 年 前同步成功
通知
186
Star
833
Fork
253
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
105
列表
看板
标记
里程碑
合并请求
10
Wiki
2
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Serving
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
105
Issue
105
列表
看板
标记
里程碑
合并请求
10
合并请求
10
Pages
分析
分析
仓库分析
DevOps
Wiki
2
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
cd809d8c
编写于
11月 24, 2021
作者:
S
ShiningZhang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
support ascend_cl+arm for ascend910
上级
b0953a3f
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
118 addition
and
1 deletion
+118
-1
CMakeLists.txt
CMakeLists.txt
+5
-0
cmake/external/ascend.cmake
cmake/external/ascend.cmake
+89
-0
cmake/paddlepaddle.cmake
cmake/paddlepaddle.cmake
+11
-1
core/general-server/CMakeLists.txt
core/general-server/CMakeLists.txt
+4
-0
paddle_inference/paddle/include/paddle_engine.h
paddle_inference/paddle/include/paddle_engine.h
+2
-0
python/paddle_serving_app/local_predict.py
python/paddle_serving_app/local_predict.py
+2
-0
python/pipeline/local_service_handler.py
python/pipeline/local_service_handler.py
+5
-0
未找到文件。
CMakeLists.txt
浏览文件 @
cd809d8c
...
...
@@ -168,6 +168,11 @@ if(SERVER)
if
(
WITH_ROCM
)
include
(
hip
)
endif
()
if
(
WITH_ASCEND_CL
)
include
(
external/ascend
)
list
(
APPEND EXTERNAL_LIBS ascend ascend_cl
)
endif
()
endif
()
...
...
cmake/external/ascend.cmake
0 → 100644
浏览文件 @
cd809d8c
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#NOTE: Logic is from
# https://github.com/mindspore-ai/graphengine/blob/master/CMakeLists.txt
if
(
DEFINED ENV{ASCEND_CUSTOM_PATH}
)
set
(
ASCEND_DIR $ENV{ASCEND_CUSTOM_PATH}
)
else
()
set
(
ASCEND_DIR /usr/local/Ascend
)
endif
()
if
(
EXISTS
${
ASCEND_DIR
}
/ascend-toolkit/latest/fwkacllib/include/graph/ascend_string.h
)
# It means CANN 20.2 +
add_definitions
(
-DPADDLE_WITH_ASCEND_STRING
)
endif
()
if
(
WITH_ASCEND OR WITH_ASCEND_CL
)
set
(
ASCEND_DRIVER_DIR
${
ASCEND_DIR
}
/driver/lib64
)
set
(
ASCEND_DRIVER_COMMON_DIR
${
ASCEND_DIR
}
/driver/lib64/common
)
set
(
ASCEND_DRIVER_SHARE_DIR
${
ASCEND_DIR
}
/driver/lib64/share
)
set
(
ASCEND_RUNTIME_DIR
${
ASCEND_DIR
}
/fwkacllib/lib64
)
set
(
ASCEND_ATC_DIR
${
ASCEND_DIR
}
/atc/lib64
)
set
(
ASCEND_ACL_DIR
${
ASCEND_DIR
}
/acllib/lib64
)
set
(
STATIC_ACL_LIB
${
ASCEND_ACL_DIR
}
)
set
(
ASCEND_MS_RUNTIME_PATH
${
ASCEND_RUNTIME_DIR
}
${
ASCEND_ACL_DIR
}
${
ASCEND_ATC_DIR
}
)
set
(
ASCEND_MS_DRIVER_PATH
${
ASCEND_DRIVER_DIR
}
${
ASCEND_DRIVER_COMMON_DIR
}
)
set
(
ATLAS_RUNTIME_DIR
${
ASCEND_DIR
}
/ascend-toolkit/latest/fwkacllib/lib64
)
set
(
ATLAS_RUNTIME_INC_DIR
${
ASCEND_DIR
}
/ascend-toolkit/latest/fwkacllib/include
)
set
(
ATLAS_ACL_DIR
${
ASCEND_DIR
}
/ascend-toolkit/latest/acllib/lib64
)
set
(
ATLAS_ATC_DIR
${
ASCEND_DIR
}
/ascend-toolkit/latest/atc/lib64
)
set
(
ATLAS_MS_RUNTIME_PATH
${
ATLAS_RUNTIME_DIR
}
${
ATLAS_ACL_DIR
}
${
ATLAS_ATC_DIR
}
)
set
(
atlas_graph_lib
${
ATLAS_RUNTIME_DIR
}
/libgraph.so
)
set
(
atlas_ge_runner_lib
${
ATLAS_RUNTIME_DIR
}
/libge_runner.so
)
set
(
atlas_acl_lib
${
ATLAS_RUNTIME_DIR
}
/libascendcl.so
)
INCLUDE_DIRECTORIES
(
${
ATLAS_RUNTIME_INC_DIR
}
)
ADD_LIBRARY
(
ascend_ge SHARED IMPORTED GLOBAL
)
SET_PROPERTY
(
TARGET ascend_ge PROPERTY IMPORTED_LOCATION
${
atlas_ge_runner_lib
}
)
ADD_LIBRARY
(
ascend_graph SHARED IMPORTED GLOBAL
)
SET_PROPERTY
(
TARGET ascend_graph PROPERTY IMPORTED_LOCATION
${
atlas_graph_lib
}
)
ADD_LIBRARY
(
atlas_acl SHARED IMPORTED GLOBAL
)
SET_PROPERTY
(
TARGET atlas_acl PROPERTY IMPORTED_LOCATION
${
atlas_acl_lib
}
)
add_custom_target
(
extern_ascend DEPENDS ascend_ge ascend_graph atlas_acl
)
endif
()
if
(
WITH_ASCEND_CL
)
set
(
ASCEND_CL_DIR
${
ASCEND_DIR
}
/ascend-toolkit/latest/fwkacllib/lib64
)
set
(
ascend_hccl_lib
${
ASCEND_CL_DIR
}
/libhccl.so
)
set
(
ascendcl_lib
${
ASCEND_CL_DIR
}
/libascendcl.so
)
set
(
acl_op_compiler_lib
${
ASCEND_CL_DIR
}
/libacl_op_compiler.so
)
set
(
FWKACLLIB_INC_DIR
${
ASCEND_DIR
}
/ascend-toolkit/latest/fwkacllib/include
)
set
(
ACLLIB_INC_DIR
${
ASCEND_DIR
}
/ascend-toolkit/latest/acllib/include
)
message
(
STATUS
"FWKACLLIB_INC_DIR
${
FWKACLLIB_INC_DIR
}
"
)
message
(
STATUS
"ASCEND_CL_DIR
${
ASCEND_CL_DIR
}
"
)
INCLUDE_DIRECTORIES
(
${
FWKACLLIB_INC_DIR
}
)
INCLUDE_DIRECTORIES
(
${
ACLLIB_INC_DIR
}
)
ADD_LIBRARY
(
ascendcl SHARED IMPORTED GLOBAL
)
SET_PROPERTY
(
TARGET ascendcl PROPERTY IMPORTED_LOCATION
${
ascendcl_lib
}
)
ADD_LIBRARY
(
ascend_hccl SHARED IMPORTED GLOBAL
)
SET_PROPERTY
(
TARGET ascend_hccl PROPERTY IMPORTED_LOCATION
${
ascend_hccl_lib
}
)
ADD_LIBRARY
(
acl_op_compiler SHARED IMPORTED GLOBAL
)
SET_PROPERTY
(
TARGET acl_op_compiler PROPERTY IMPORTED_LOCATION
${
acl_op_compiler_lib
}
)
add_custom_target
(
extern_ascend_cl DEPENDS ascendcl acl_op_compiler
)
endif
()
cmake/paddlepaddle.cmake
浏览文件 @
cd809d8c
...
...
@@ -75,6 +75,14 @@ elseif (WITH_LITE)
endif
()
elseif
(
WITH_ROCM
)
SET
(
PADDLE_LIB_VERSION
"
${
PADDLE_VERSION
}
/rocm"
)
elseif
(
WITH_ASCEND_CL
)
message
(
"cpu arch:
${
CMAKE_SYSTEM_PROCESSOR
}
"
)
if
(
CMAKE_SYSTEM_PROCESSOR STREQUAL
"x86_64"
)
MESSAGE
(
"paddle lib is unknown."
)
SET
(
PADDLE_LIB_VERSION
"paddle-unknown"
)
elseif
(
CMAKE_SYSTEM_PROCESSOR STREQUAL
"aarch64"
)
SET
(
PADDLE_LIB_VERSION
"
${
PADDLE_VERSION
}
/cxx_c/Linux/ASCEND/arm64_gcc8.2_openblas"
)
endif
()
else
()
if
(
WITH_AVX
)
if
(
WITH_MKLML
)
...
...
@@ -93,6 +101,8 @@ if(WITH_LITE)
elseif
(
WITH_ASCEND_CL
)
SET
(
PADDLE_LIB_PATH
"http://paddle-serving.bj.bcebos.com/inferlib/
${
PADDLE_LIB_VERSION
}
/paddle_inference_install_dir.tgz "
)
endif
()
elseif
(
WITH_ASCEND_CL
)
SET
(
PADDLE_LIB_PATH
"http://paddle-serving.bj.bcebos.com/inferlib/
${
PADDLE_LIB_VERSION
}
/paddle_inference.tgz "
)
else
()
SET
(
PADDLE_LIB_PATH
"http://paddle-inference-lib.bj.bcebos.com/
${
PADDLE_LIB_VERSION
}
/paddle_inference.tgz"
)
endif
()
...
...
@@ -163,7 +173,7 @@ endif()
ADD_LIBRARY
(
paddle_inference STATIC IMPORTED GLOBAL
)
SET_PROPERTY
(
TARGET paddle_inference PROPERTY IMPORTED_LOCATION
${
PADDLE_INSTALL_DIR
}
/lib/libpaddle_inference.a
)
if
(
WITH_ASCEND_CL
AND WITH_LITE
)
if
(
WITH_ASCEND_CL
)
SET_PROPERTY
(
TARGET paddle_inference PROPERTY IMPORTED_LOCATION
${
PADDLE_INSTALL_DIR
}
/lib/libpaddle_inference.so
)
endif
()
...
...
core/general-server/CMakeLists.txt
浏览文件 @
cd809d8c
...
...
@@ -31,6 +31,10 @@ target_link_libraries(serving pdserving)
target_link_libraries
(
serving cube-api
)
target_link_libraries
(
serving utils
)
target_link_libraries
(
serving utf8proc
)
if
(
WITH_ASCEND_CL
)
target_link_libraries
(
serving ascendcl acl_op_compiler
)
endif
()
if
(
WITH_GPU
)
target_link_libraries
(
serving
${
CUDA_LIBRARIES
}
)
...
...
paddle_inference/paddle/include/paddle_engine.h
浏览文件 @
cd809d8c
...
...
@@ -293,6 +293,8 @@ class PaddleInferenceEngine : public EngineCore {
<<
FLAGS_nnadapter_context_properties
<<
",nnadapter_model_cache_dir="
<<
FLAGS_nnadapter_model_cache_dir
;
}
else
{
config
.
EnableNpu
(
gpu_id
);
}
}
...
...
python/paddle_serving_app/local_predict.py
浏览文件 @
cd809d8c
...
...
@@ -236,6 +236,8 @@ class LocalPredictor(object):
.
set_device_names
([
nnadapter_device_names
])
\
.
set_context_properties
(
nnadapter_context_properties
)
\
.
set_model_cache_dir
(
nnadapter_model_cache_dir
)
else
:
config
.
enable_npu
(
gpu_id
)
# set cpu low precision
if
not
use_gpu
and
not
use_lite
:
if
precision_type
==
paddle_infer
.
PrecisionType
.
Int8
:
...
...
python/pipeline/local_service_handler.py
浏览文件 @
cd809d8c
...
...
@@ -136,6 +136,11 @@ class LocalServiceHandler(object):
devices
=
[
int
(
x
)
for
x
in
devices
.
split
(
","
)]
self
.
_use_lite
=
True
self
.
_use_ascend_cl
=
True
elif
device_type
==
6
:
# Ascend 910 ARM CPU
self
.
_device_name
=
"arm"
devices
=
[
int
(
x
)
for
x
in
devices
.
split
(
","
)]
self
.
_use_ascend_cl
=
True
else
:
_LOGGER
.
error
(
"LocalServiceHandler initialization fail. device_type={}"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录