Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
6eabbc80
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
6eabbc80
编写于
1月 27, 2021
作者:
L
Leo Chen
提交者:
GitHub
1月 27, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix compilation on ascend-20.1 (#30722)
fix compilation on ascend-20.1
上级
904cc443
变更
5
展开全部
隐藏空白更改
内联
并排
Showing
5 changed file
with
314 addition
and
140 deletion
+314
-140
CMakeLists.txt
CMakeLists.txt
+5
-0
cmake/external/ascend.cmake
cmake/external/ascend.cmake
+4
-0
cmake/external/protobuf.cmake
cmake/external/protobuf.cmake
+6
-1
paddle/fluid/framework/fleet/ascend_wrapper.h
paddle/fluid/framework/fleet/ascend_wrapper.h
+25
-21
paddle/fluid/pybind/ascend_wrapper_py.cc
paddle/fluid/pybind/ascend_wrapper_py.cc
+274
-118
未找到文件。
CMakeLists.txt
浏览文件 @
6eabbc80
...
...
@@ -32,6 +32,7 @@ option(WITH_TENSORRT "Compile PaddlePaddle with NVIDIA TensorRT" OFF)
option
(
WITH_XPU
"Compile PaddlePaddle with BAIDU KUNLUN XPU"
OFF
)
option
(
WITH_WIN_DUMP_DBG
"Compile with windows core dump debug mode"
OFF
)
option
(
WITH_ASCEND
"Compile PaddlePaddle with ASCEND"
OFF
)
option
(
WITH_ASCEND_CXX11
"Compile PaddlePaddle with ASCEND and CXX11 ABI"
OFF
)
if
(
WITH_GPU AND WITH_XPU
)
message
(
FATAL_ERROR
"Error when compile GPU and XPU at the same time"
)
endif
()
...
...
@@ -61,6 +62,10 @@ if(WITH_MUSL)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-Wno-error=deprecated-declarations -Wno-deprecated-declarations -Wno-error=pessimizing-move -Wno-error=deprecated-copy"
)
endif
()
if
(
WITH_ASCEND AND NOT WITH_ASCEND_CXX11
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-D_GLIBCXX_USE_CXX11_ABI=0"
)
endif
()
if
(
WIN32
)
option
(
MSVC_STATIC_CRT
"use static C Runtime library by default"
ON
)
...
...
cmake/external/ascend.cmake
浏览文件 @
6eabbc80
...
...
@@ -42,6 +42,10 @@ 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
}
)
if
(
EXISTS
${
ATLAS_RUNTIME_INC_DIR
}
/graph/ascend_string.h
)
add_definitions
(
-DPADDLE_WITH_ASCEND_STRING
)
endif
()
ADD_LIBRARY
(
ascend_ge SHARED IMPORTED GLOBAL
)
SET_PROPERTY
(
TARGET ascend_ge PROPERTY IMPORTED_LOCATION
${
atlas_ge_runner_lib
}
)
...
...
cmake/external/protobuf.cmake
浏览文件 @
6eabbc80
...
...
@@ -198,8 +198,13 @@ FUNCTION(build_protobuf TARGET_NAME BUILD_FOR_HOST)
"-Dprotobuf_MSVC_STATIC_RUNTIME=
${
MSVC_STATIC_CRT
}
"
)
ENDIF
()
if
(
WITH_ASCEND AND NOT WITH_ASCEND_CXX11
)
SET
(
PROTOBUF_REPOSITORY https://gitee.com/tianjianhe/protobuf.git
)
SET
(
PROTOBUF_TAG v3.8.0
)
else
()
SET
(
PROTOBUF_REPOSITORY
${
GIT_URL
}
/protocolbuffers/protobuf.git
)
SET
(
PROTOBUF_TAG 9f75c5aa851cd877fb0d93ccc31b8567a6706546
)
endif
()
cache_third_party
(
${
TARGET_NAME
}
REPOSITORY
${
PROTOBUF_REPOSITORY
}
...
...
@@ -234,7 +239,7 @@ FUNCTION(build_protobuf TARGET_NAME BUILD_FOR_HOST)
)
ENDFUNCTION
()
SET
(
PROTOBUF_VERSION 3.
1
.0
)
SET
(
PROTOBUF_VERSION 3.
8
.0
)
IF
(
NOT PROTOBUF_FOUND
)
build_protobuf
(
extern_protobuf FALSE
)
...
...
paddle/fluid/framework/fleet/ascend_wrapper.h
浏览文件 @
6eabbc80
...
...
@@ -39,36 +39,40 @@ namespace framework {
typedef
ge
::
Graph
AscendGraphDesc
;
#ifdef PADDLE_WITH_ASCEND_STRING
using
AscendString
=
AscendString
;
#else
using
AscendString
=
std
::
string
;
#endif
class
AscendInstance
{
public:
virtual
~
AscendInstance
()
{}
AscendInstance
()
{}
std
::
map
<
ge
::
AscendString
,
ge
::
AscendString
>
GetDefaultInitOptions
()
{
std
::
map
<
ge
::
AscendString
,
ge
::
AscendString
>
init_options
;
init_options
[
"ge.exec.deviceId"
]
=
"0"
;
init_options
[
"ge.graphRunMode"
]
=
"1"
;
return
init_options
;
std
::
map
<
AscendString
,
AscendString
>
GetDefaultInitOptions
()
{
std
::
map
<
AscendString
,
AscendString
>
init_options
;
init_options
[
"ge.exec.deviceId"
]
=
"0"
;
init_options
[
"ge.graphRunMode"
]
=
"1"
;
return
init_options
;
}
std
::
map
<
ge
::
AscendString
,
ge
::
AscendString
>
GetDefaultInitSessionOptions
()
{
std
::
map
<
ge
::
AscendString
,
ge
::
AscendString
>
init_options
;
init_options
[
"a"
]
=
"b"
;
init_options
[
"ge.trainFlag"
]
=
"1"
;
return
init_options
;
std
::
map
<
AscendString
,
AscendString
>
GetDefaultInitSessionOptions
()
{
std
::
map
<
AscendString
,
AscendString
>
init_options
;
init_options
[
"a"
]
=
"b"
;
init_options
[
"ge.trainFlag"
]
=
"1"
;
return
init_options
;
}
ge
::
Status
InitGEForUT
(){
return
ge
::
GEInitialize
(
GetDefaultInitOptions
());
}
ge
::
Status
InitGEForUT
()
{
return
ge
::
GEInitialize
(
GetDefaultInitOptions
());
}
void
InitGlobalResouces
()
{
LOG
(
INFO
)
<<
"Begin InitGlobalResouces"
;
session_
.
reset
(
new
ge
::
Session
(
GetDefaultInitSessionOptions
()));
if
(
session_
==
nullptr
)
{
LOG
(
FATAL
)
<<
"new session error:"
<<
session_
;
}
LOG
(
INFO
)
<<
"End InitGlobalResouces"
;
LOG
(
INFO
)
<<
"Begin InitGlobalResouces"
;
session_
.
reset
(
new
ge
::
Session
(
GetDefaultInitSessionOptions
()));
if
(
session_
==
nullptr
)
{
LOG
(
FATAL
)
<<
"new session error:"
<<
session_
;
}
LOG
(
INFO
)
<<
"End InitGlobalResouces"
;
}
static
std
::
shared_ptr
<
AscendInstance
>
GetInstance
()
{
...
...
@@ -191,6 +195,6 @@ class AscendInstance {
private:
static
std
::
shared_ptr
<
AscendInstance
>
ascend_instance_
;
};
}
//
end
namespace framework
}
//
end
namespace paddle
}
// namespace framework
}
// namespace paddle
#endif
paddle/fluid/pybind/ascend_wrapper_py.cc
浏览文件 @
6eabbc80
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录