Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
69ccbece
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2302
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
69ccbece
编写于
3月 06, 2023
作者:
M
mayang002
提交者:
GitHub
3月 06, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[xpu] support paddle compile with XFT (#51082)
上级
94df383e
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
59 addition
and
1 deletion
+59
-1
CMakeLists.txt
CMakeLists.txt
+13
-0
cmake/external/xpu.cmake
cmake/external/xpu.cmake
+36
-1
python/env_dict.py.in
python/env_dict.py.in
+3
-0
python/setup.py.in
python/setup.py.in
+4
-0
setup.py
setup.py
+3
-0
未找到文件。
CMakeLists.txt
浏览文件 @
69ccbece
...
...
@@ -52,6 +52,7 @@ option(WITH_MPI "Compile PaddlePaddle with MPI" OFF)
option
(
WITH_TENSORRT
"Compile PaddlePaddle with NVIDIA TensorRT"
OFF
)
option
(
WITH_XPU
"Compile PaddlePaddle with BAIDU KUNLUN XPU"
OFF
)
option
(
WITH_XPU_KP
"Compile PaddlePaddle with BAIDU XPU compiler "
OFF
)
option
(
WITH_XPU_XFT
"Compile PaddlePaddle with BAIDU XPU-XFT"
OFF
)
option
(
WITH_MLU
"Compile PaddlePaddle with CAMBRICON MLU"
OFF
)
option
(
WITH_WIN_DUMP_DBG
"Compile with windows core dump debug mode"
OFF
)
option
(
WITH_ASCEND
"Compile PaddlePaddle with ASCEND"
OFF
)
...
...
@@ -74,6 +75,9 @@ endif()
if
(
WITH_GPU AND WITH_XPU_KP
)
message
(
FATAL_ERROR
"Error when compile GPU and XPU2 at the same time"
)
endif
()
if
(
WITH_GPU AND WITH_XPU_XFT
)
message
(
FATAL_ERROR
"Error when compile GPU and XPU-XFT at the same time"
)
endif
()
if
(
WITH_GPU AND WITH_ASCEND
)
message
(
FATAL_ERROR
"Error when compile GPU and ASCEND at the same time"
)
endif
()
...
...
@@ -419,6 +423,15 @@ if(WITH_XPU_KP AND NOT WITH_XPU)
CACHE STRING
"Enable WITH_XPU when compiling with WITH_XPU_KP"
FORCE
)
endif
()
if
(
NOT WITH_XPU AND WITH_XPU_XFT
)
message
(
WARNING
"Enable WITH_XPU when compiling with WITH_XPU_XFT. Force WITH_XPU=ON."
)
set
(
WITH_XPU
ON
CACHE STRING
"Enable WITH_XPU when compiling with WITH_XPU_XFT"
FORCE
)
endif
()
if
(
NOT WITH_XPU AND WITH_XPU_BKCL
)
message
(
WARNING
"Disable BKCL when compiling without XPU. Force WITH_XPU_BKCL=OFF."
)
...
...
cmake/external/xpu.cmake
浏览文件 @
69ccbece
...
...
@@ -6,9 +6,11 @@ include(ExternalProject)
set
(
XPU_PROJECT
"extern_xpu"
)
set
(
XPU_API_LIB_NAME
"libxpuapi.so"
)
set
(
XPU_RT_LIB_NAME
"libxpurt.so"
)
set
(
XPU_XFT_LIB_NAME
"libxft.so"
)
set
(
XPU_BASE_DATE
"20230227"
)
set
(
XPU_XCCL_BASE_VERSION
"1.0.10"
)
set
(
XPU_XFT_BASE_VERSION
"latest"
)
if
(
NOT DEFINED XPU_BASE_URL
)
set
(
XPU_BASE_URL_WITHOUT_DATE
...
...
@@ -22,30 +24,42 @@ set(XPU_XCCL_BASE_URL
"https://klx-sdk-release-public.su.bcebos.com/xccl/release/
${
XPU_XCCL_BASE_VERSION
}
"
)
if
(
NOT XPU_XFT_BASE_URL
)
set
(
XPU_XFT_BASE_URL
"https://klx-sdk-release-public.su.bcebos.com/xft/dev/
${
XPU_XFT_BASE_VERSION
}
"
)
endif
()
if
(
WITH_AARCH64
)
set
(
XPU_XRE_DIR_NAME
"xre-kylin_aarch64"
)
set
(
XPU_XDNN_DIR_NAME
"xdnn-kylin_aarch64"
)
set
(
XPU_XCCL_DIR_NAME
"xccl-kylin_aarch64"
)
set
(
XPU_XFT_DIR_NAME
""
)
# TODO: xft has no kylin output at now.
elseif
(
WITH_SUNWAY
)
set
(
XPU_XRE_DIR_NAME
"xre-deepin_sw6_64"
)
set
(
XPU_XDNN_DIR_NAME
"xdnn-deepin_sw6_64"
)
set
(
XPU_XCCL_DIR_NAME
"xccl-deepin_sw6_64"
)
set
(
XPU_XFT_DIR_NAME
""
)
# TODO: xft has no deepin output at now.
elseif
(
WITH_BDCENTOS
)
set
(
XPU_XRE_DIR_NAME
"xre-bdcentos_x86_64"
)
set
(
XPU_XDNN_DIR_NAME
"xdnn-bdcentos_x86_64"
)
set
(
XPU_XCCL_DIR_NAME
"xccl-bdcentos_x86_64"
)
set
(
XPU_XFT_DIR_NAME
"xft_bdcentos6u3_x86_64_gcc82"
)
elseif
(
WITH_UBUNTU
)
set
(
XPU_XRE_DIR_NAME
"xre-ubuntu_x86_64"
)
set
(
XPU_XDNN_DIR_NAME
"xdnn-ubuntu_x86_64"
)
set
(
XPU_XCCL_DIR_NAME
"xccl-ubuntu_x86_64"
)
set
(
XPU_XFT_DIR_NAME
"xft_ubuntu1604_x86_64"
)
elseif
(
WITH_CENTOS
)
set
(
XPU_XRE_DIR_NAME
"xre-centos7_x86_64"
)
set
(
XPU_XDNN_DIR_NAME
"xdnn-centos7_x86_64"
)
set
(
XPU_XCCL_DIR_NAME
"xccl-bdcentos_x86_64"
)
set
(
XPU_XFT_DIR_NAME
"xft_bdcentos6u3_x86_64_gcc82"
)
else
()
set
(
XPU_XRE_DIR_NAME
"xre-ubuntu_x86_64"
)
set
(
XPU_XDNN_DIR_NAME
"xdnn-ubuntu_x86_64"
)
set
(
XPU_XCCL_DIR_NAME
"xccl-ubuntu_x86_64"
)
set
(
XPU_XFT_DIR_NAME
"xft_ubuntu1604_x86_64"
)
endif
()
set
(
XPU_XRE_URL
...
...
@@ -57,12 +71,16 @@ set(XPU_XDNN_URL
set
(
XPU_XCCL_URL
"
${
XPU_XCCL_BASE_URL
}
/
${
XPU_XCCL_DIR_NAME
}
.tar.gz"
CACHE STRING
""
FORCE
)
set
(
XPU_XFT_URL
"
${
XPU_XFT_BASE_URL
}
/
${
XPU_XFT_DIR_NAME
}
.tar.gz"
)
set
(
XPU_PACK_DEPENCE_URL
"https://baidu-kunlun-public.su.bcebos.com/paddle_depence/pack_paddle_depence.sh"
CACHE STRING
""
FORCE
)
set
(
XPU_CHECK_DEPENCE_URL
"https://baidu-kunlun-public.su.bcebos.com/paddle_depence/check_xpu_dependence.sh"
CACHE STRING
""
FORCE
)
set
(
XPU_XFT_GET_DEPENCE_URL
"https://baidu-kunlun-public.su.bcebos.com/paddle_depence/get_xft_dependence.sh"
CACHE STRING
""
FORCE
)
set
(
SNAPPY_PREFIX_DIR
"
${
THIRD_PARTY_PATH
}
/xpu"
)
set
(
XPU_DOWNLOAD_DIR
"
${
SNAPPY_PREFIX_DIR
}
/src/
${
XPU_PROJECT
}
"
)
...
...
@@ -90,7 +108,9 @@ ExternalProject_Add(
wget
${
XPU_CHECK_DEPENCE_URL
}
&& bash check_xpu_dependence.sh
${
XPU_BASE_URL
}
${
XPU_XCCL_BASE_URL
}
&& wget
${
XPU_PACK_DEPENCE_URL
}
&& bash
pack_paddle_depence.sh
${
XPU_XRE_URL
}
${
XPU_XRE_DIR_NAME
}
${
XPU_XDNN_URL
}
${
XPU_XDNN_DIR_NAME
}
${
XPU_XCCL_URL
}
${
XPU_XCCL_DIR_NAME
}
${
XPU_XDNN_DIR_NAME
}
${
XPU_XCCL_URL
}
${
XPU_XCCL_DIR_NAME
}
&& wget
${
XPU_XFT_GET_DEPENCE_URL
}
&& bash get_xft_dependence.sh
${
XPU_XFT_URL
}
${
XPU_XFT_DIR_NAME
}
DOWNLOAD_NO_PROGRESS 1
UPDATE_COMMAND
""
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=
${
XPU_INSTALL_ROOT
}
...
...
@@ -116,7 +136,22 @@ if(WITH_XPU_BKCL)
set
(
XPU_BKCL_LIB
"
${
XPU_LIB_DIR
}
/
${
XPU_BKCL_LIB_NAME
}
"
)
set
(
XPU_BKCL_INC_DIR
"
${
THIRD_PARTY_PATH
}
/install/xpu/include"
)
include_directories
(
${
XPU_BKCL_INC_DIR
}
)
endif
()
if
(
WITH_XPU_XFT
)
message
(
STATUS
"Compile with XPU XFT!"
)
add_definitions
(
-DPADDLE_WITH_XPU_XFT
)
set
(
XPU_XFT_LIB
"
${
XPU_LIB_DIR
}
/
${
XPU_XFT_LIB_NAME
}
"
)
endif
()
if
(
WITH_XPU_BKCL AND WITH_XPU_XFT
)
target_link_libraries
(
xpulib
${
XPU_API_LIB
}
${
XPU_RT_LIB
}
${
XPU_BKCL_LIB
}
${
XPU_XFT_LIB
}
)
elseif
(
WITH_XPU_BKCL
)
target_link_libraries
(
xpulib
${
XPU_API_LIB
}
${
XPU_RT_LIB
}
${
XPU_BKCL_LIB
}
)
elseif
(
WITH_XPU_XFT
)
target_link_libraries
(
xpulib
${
XPU_API_LIB
}
${
XPU_RT_LIB
}
${
XPU_XFT_LIB
}
)
else
()
target_link_libraries
(
xpulib
${
XPU_API_LIB
}
${
XPU_RT_LIB
}
)
endif
()
...
...
python/env_dict.py.in
浏览文件 @
69ccbece
...
...
@@ -56,6 +56,9 @@ env_dict={
'WITH_XPU_BKCL':'@WITH_XPU_BKCL@',
'XPU_BKCL_LIB':'@XPU_BKCL_LIB@',
'XPU_BKCL_LIB_NAME':'@XPU_BKCL_LIB_NAME@',
'WITH_XPU_XFT':'@WITH_XPU_XFT@',
'XPU_XFT_LIB':'@XPU_XFT_LIB@',
'XPU_XFT_LIB_NAME':'@XPU_XFT_LIB_NAME@',
'THIRD_PARTY_PATH':'@THIRD_PARTY_PATH@',
'SETUP_LOG_FILE':'@SETUP_LOG_FILE@',
'WITH_STRIP':'@WITH_STRIP@',
...
...
python/setup.py.in
浏览文件 @
69ccbece
...
...
@@ -646,6 +646,10 @@ if '${WITH_XPU_BKCL}' == 'ON':
shutil.copy('${XPU_BKCL_LIB}', libs_path)
package_data['paddle.libs']+=['${XPU_BKCL_LIB_NAME}']
if '${WITH_XPU_XFT}' == 'ON':
shutil.copy('${XPU_XFT_LIB}', libs_path)
package_data['paddle.libs']+=['${XPU_XFT_LIB_NAME}']
# remove unused paddle/libs/__init__.py
if os.path.isfile(libs_path+'/__init__.py'):
os.remove(libs_path+'/__init__.py')
...
...
setup.py
浏览文件 @
69ccbece
...
...
@@ -1052,6 +1052,9 @@ def get_package_data_and_package_dir():
shutil
.
copy
(
env_dict
.
get
(
"XPU_BKCL_LIB"
),
libs_path
)
package_data
[
'paddle.libs'
]
+=
[
env_dict
.
get
(
"XPU_BKCL_LIB_NAME"
)]
if
env_dict
.
get
(
"WITH_XPU_XFT"
)
==
'ON'
:
shutil
.
copy
(
env_dict
.
get
(
"XPU_XFT_LIB"
),
libs_path
)
package_data
[
'paddle.libs'
]
+=
[
env_dict
.
get
(
"XPU_XFT_LIB_NAME"
)]
# remove unused paddle/libs/__init__.py
if
os
.
path
.
isfile
(
libs_path
+
'/__init__.py'
):
os
.
remove
(
libs_path
+
'/__init__.py'
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录