Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
6bba8e57
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看板
未验证
提交
6bba8e57
编写于
11月 06, 2020
作者:
Q
QingshuChen
提交者:
GitHub
11月 06, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix batch_norm_xpu bug & remove xpusimulator dependence (#28430)
*test=kunlun
上级
ced5c40c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
10 addition
and
15 deletion
+10
-15
cmake/external/xpu.cmake
cmake/external/xpu.cmake
+4
-8
paddle/fluid/operators/batch_norm_op_xpu.cc
paddle/fluid/operators/batch_norm_op_xpu.cc
+5
-4
python/setup.py.in
python/setup.py.in
+1
-3
未找到文件。
cmake/external/xpu.cmake
浏览文件 @
6bba8e57
...
...
@@ -4,30 +4,26 @@ endif()
INCLUDE
(
ExternalProject
)
SET
(
XPU_PROJECT
"extern_xpu"
)
SET
(
XPU_URL
"https://baidu-kunlun-public.su.bcebos.com/paddle_depence/xpu.tar.gz"
CACHE STRING
""
FORCE
)
SET
(
XPU_URL
"https://baidu-kunlun-public.su.bcebos.com/paddle_depence/xpu
_2020_09_22_api_2020_11_05
.tar.gz"
CACHE STRING
""
FORCE
)
SET
(
XPU_SOURCE_DIR
"
${
THIRD_PARTY_PATH
}
/xpu"
)
SET
(
XPU_DOWNLOAD_DIR
"
${
XPU_SOURCE_DIR
}
/src/
${
XPU_PROJECT
}
"
)
SET
(
XPU_INSTALL_DIR
"
${
THIRD_PARTY_PATH
}
/install/xpu"
)
SET
(
XPU_API_INC_DIR
"
${
THIRD_PARTY_PATH
}
/install/xpu/api/include"
)
SET
(
XPU_RUNTIME_INC_DIR
"
${
THIRD_PARTY_PATH
}
/install/xpu/runtime/include"
)
SET
(
XPU_API_INC_DIR
"
${
THIRD_PARTY_PATH
}
/install/xpu/include"
)
SET
(
XPU_LIB_DIR
"
${
THIRD_PARTY_PATH
}
/install/xpu/lib"
)
SET
(
XPU_API_LIB_NAME
"libxpuapi.so"
)
SET
(
XPU_RT_LIB_NAME
"libxpurt.so"
)
SET
(
XPU_SIM_LIB_NAME
"libxpusim.so"
)
SET
(
XPU_API_LIB
"
${
XPU_LIB_DIR
}
/
${
XPU_API_LIB_NAME
}
"
)
SET
(
XPU_RT_LIB
"
${
XPU_LIB_DIR
}
/
${
XPU_RT_LIB_NAME
}
"
)
SET
(
XPU_SIM_LIB
"
${
XPU_LIB_DIR
}
/
${
XPU_SIM_LIB_NAME
}
"
)
SET
(
CMAKE_INSTALL_RPATH
"
${
CMAKE_INSTALL_RPATH
}
"
"
${
XPU_INSTALL_DIR
}
/lib"
)
INCLUDE_DIRECTORIES
(
${
XPU_API_INC_DIR
}
)
INCLUDE_DIRECTORIES
(
${
XPU_RUNTIME_INC_DIR
}
)
FILE
(
WRITE
${
XPU_DOWNLOAD_DIR
}
/CMakeLists.txt
"PROJECT(XPU)
\n
"
"cmake_minimum_required(VERSION 3.0)
\n
"
"install(DIRECTORY xpu/
api xpu/runtim
e xpu/lib
\n
"
"install(DIRECTORY xpu/
includ
e xpu/lib
\n
"
" DESTINATION
${
XPU_INSTALL_DIR
}
)
\n
"
)
ExternalProject_Add
(
...
...
@@ -50,5 +46,5 @@ set_property(TARGET shared_xpuapi PROPERTY IMPORTED_LOCATION "${XPU_API_LIB}")
# for cc_library(xxx SRCS xxx.c DEPS xpulib)
generate_dummy_static_lib
(
LIB_NAME
"xpulib"
GENERATOR
"xpu.cmake"
)
TARGET_LINK_LIBRARIES
(
xpulib
${
XPU_API_LIB
}
${
XPU_RT_LIB
}
${
XPU_SIM_LIB
}
)
TARGET_LINK_LIBRARIES
(
xpulib
${
XPU_API_LIB
}
${
XPU_RT_LIB
}
)
ADD_DEPENDENCIES
(
xpulib
${
XPU_PROJECT
}
)
paddle/fluid/operators/batch_norm_op_xpu.cc
浏览文件 @
6bba8e57
...
...
@@ -15,6 +15,7 @@ limitations under the License. */
#ifdef PADDLE_WITH_XPU
#include "paddle/fluid/operators/batch_norm_op.h"
#include "xpu/refactor/nn.h"
namespace
paddle
{
namespace
operators
{
...
...
@@ -72,10 +73,10 @@ class BatchNormXPUKernel : public framework::OpKernel<T> {
auto
*
variance_out_data
=
variance_out
->
data
<
T
>
();
auto
*
saved_mean_data
=
saved_mean
->
data
<
T
>
();
auto
*
saved_variance_data
=
saved_variance
->
data
<
T
>
();
int
r
=
xpu
::
batch_norm
_train_forward
(
dev_ctx
.
x_context
(),
epsilon
,
momentum
,
N
,
C
,
H
,
W
,
x_data
,
y
_data
,
scale_data
,
bias_data
,
mean_out_data
,
variance_out
_data
,
saved_mean_data
,
saved_variance_data
);
int
r
=
xpu
::
batch_norm
<
T
>
(
dev_ctx
.
x_context
(),
x_data
,
y_data
,
N
,
C
,
H
,
W
,
epsilon
,
momentum
,
scale_data
,
bias
_data
,
saved_mean_data
,
saved_variance
_data
,
mean_out_data
,
variance_out_data
,
true
);
PADDLE_ENFORCE_EQ
(
r
,
XPU_SUCCESS
,
platform
::
errors
::
External
(
"XPU API(batch_norm_train_forward) return "
...
...
python/setup.py.in
浏览文件 @
6bba8e57
...
...
@@ -319,10 +319,8 @@ if '${WITH_XPU}' == 'ON':
raise Exception("patch ${XPU_API_LIB} failed, command: %s" % command)
shutil.copy('${XPU_API_LIB}', libs_path)
shutil.copy('${XPU_RT_LIB}', libs_path)
shutil.copy('${XPU_SIM_LIB}', libs_path)
package_data['paddle.libs']+=['${XPU_API_LIB_NAME}',
'${XPU_RT_LIB_NAME}',
'${XPU_SIM_LIB_NAME}']
'${XPU_RT_LIB_NAME}']
# copy libfuild_framework.so to libs
if os.name != 'nt' and sys.platform != 'darwin':
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录