Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
64914ea4
P
Paddle
项目概览
机器未来
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
64914ea4
编写于
6月 08, 2021
作者:
T
TTerror
提交者:
GitHub
6月 08, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update xpu cmake for kunlun (#33328)
上级
b1355444
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
67 addition
and
49 deletion
+67
-49
cmake/external/xpu.cmake
cmake/external/xpu.cmake
+67
-49
未找到文件。
cmake/external/xpu.cmake
浏览文件 @
64914ea4
...
@@ -7,52 +7,70 @@ SET(XPU_PROJECT "extern_xpu")
...
@@ -7,52 +7,70 @@ SET(XPU_PROJECT "extern_xpu")
SET
(
XPU_API_LIB_NAME
"libxpuapi.so"
)
SET
(
XPU_API_LIB_NAME
"libxpuapi.so"
)
SET
(
XPU_RT_LIB_NAME
"libxpurt.so"
)
SET
(
XPU_RT_LIB_NAME
"libxpurt.so"
)
if
(
NOT XPU_SDK_ROOT
)
IF
(
WITH_AARCH64
)
if
(
WITH_AARCH64
)
SET
(
XPU_XRE_DIR_NAME
"xre-kylin_aarch64"
)
SET
(
XPU_URL
"https://baidu-kunlun-public.su.bcebos.com/paddle_depence/aarch64/xpu_2021_01_13.tar.gz"
CACHE STRING
""
FORCE
)
SET
(
XPU_XDNN_DIR_NAME
"xdnn-kylin_aarch64"
)
elseif
(
WITH_SUNWAY
)
SET
(
XPU_XCCL_DIR_NAME
"xccl-kylin_aarch64"
)
SET
(
XPU_URL
"https://baidu-kunlun-public.su.bcebos.com/paddle_depence/sunway/xpu_2021_01_13.tar.gz"
CACHE STRING
""
FORCE
)
ELSEIF
(
WITH_SUNWAY
)
else
()
SET
(
XPU_XRE_DIR_NAME
"xre-deepin_sw6_64"
)
SET
(
XPU_URL
"https://baidu-kunlun-public.su.bcebos.com/paddle_depence/xpu_2021_05_19.tar.gz"
CACHE STRING
""
FORCE
)
SET
(
XPU_XDNN_DIR_NAME
"xdnn-deepin_sw6_64"
)
endif
()
SET
(
XPU_XCCL_DIR_NAME
"xccl-deepin_sw6_64"
)
ELSEIF
(
WITH_BDCENTOS
)
SET
(
XPU_SOURCE_DIR
"
${
THIRD_PARTY_PATH
}
/xpu"
)
SET
(
XPU_XRE_DIR_NAME
"xre-bdcentos_x86_64"
)
SET
(
XPU_DOWNLOAD_DIR
"
${
XPU_SOURCE_DIR
}
/src/
${
XPU_PROJECT
}
"
)
SET
(
XPU_XDNN_DIR_NAME
"xdnn-bdcentos_x86_64"
)
SET
(
XPU_INSTALL_DIR
"
${
THIRD_PARTY_PATH
}
/install/xpu"
)
SET
(
XPU_XCCL_DIR_NAME
"xccl-bdcentos_x86_64"
)
SET
(
XPU_API_INC_DIR
"
${
THIRD_PARTY_PATH
}
/install/xpu/include"
)
ELSEIF
(
WITH_UBUNTU
)
SET
(
XPU_LIB_DIR
"
${
THIRD_PARTY_PATH
}
/install/xpu/lib"
)
SET
(
XPU_XRE_DIR_NAME
"xre-ubuntu_x86_64"
)
SET
(
XPU_XDNN_DIR_NAME
"xdnn-ubuntu_x86_64"
)
SET
(
XPU_API_LIB
"
${
XPU_LIB_DIR
}
/
${
XPU_API_LIB_NAME
}
"
)
SET
(
XPU_XCCL_DIR_NAME
"xccl-bdcentos_x86_64"
)
SET
(
XPU_RT_LIB
"
${
XPU_LIB_DIR
}
/
${
XPU_RT_LIB_NAME
}
"
)
ELSEIF
(
WITH_CENTOS
)
SET
(
XPU_XRE_DIR_NAME
"xre-centos7_x86_64"
)
SET
(
CMAKE_INSTALL_RPATH
"
${
CMAKE_INSTALL_RPATH
}
"
"
${
XPU_INSTALL_DIR
}
/lib"
)
SET
(
XPU_XDNN_DIR_NAME
"xdnn-centos7_x86_64"
)
SET
(
XPU_XCCL_DIR_NAME
"xccl-bdcentos_x86_64"
)
FILE
(
WRITE
${
XPU_DOWNLOAD_DIR
}
/CMakeLists.txt
ELSE
()
"PROJECT(XPU)
\n
"
SET
(
XPU_XRE_DIR_NAME
"xre-ubuntu_x86_64"
)
"cmake_minimum_required(VERSION 3.0)
\n
"
SET
(
XPU_XDNN_DIR_NAME
"xdnn-ubuntu_x86_64"
)
"install(DIRECTORY xpu/include xpu/lib
\n
"
SET
(
XPU_XCCL_DIR_NAME
"xccl-bdcentos_x86_64"
)
" DESTINATION
${
XPU_INSTALL_DIR
}
)
\n
"
)
ENDIF
()
ExternalProject_Add
(
SET
(
XPU_BASE_URL
"https://baidu-kunlun-product.cdn.bcebos.com/KL-SDK/klsdk-dev/20210527"
)
${
XPU_PROJECT
}
SET
(
XPU_XRE_URL
"
${
XPU_BASE_URL
}
/
${
XPU_XRE_DIR_NAME
}
.tar.gz"
CACHE STRING
""
FORCE
)
${
EXTERNAL_PROJECT_LOG_ARGS
}
SET
(
XPU_XDNN_URL
"
${
XPU_BASE_URL
}
/
${
XPU_XDNN_DIR_NAME
}
.tar.gz"
CACHE STRING
""
FORCE
)
PREFIX
${
XPU_SOURCE_DIR
}
SET
(
XPU_XCCL_URL
"
${
XPU_BASE_URL
}
/
${
XPU_XCCL_DIR_NAME
}
.tar.gz"
CACHE STRING
""
FORCE
)
DOWNLOAD_DIR
${
XPU_DOWNLOAD_DIR
}
SET
(
XPU_PACK_DEPENCE_URL
"https://baidu-kunlun-public.su.bcebos.com/paddle_depence/pack_paddle_depence.sh"
CACHE STRING
""
FORCE
)
DOWNLOAD_COMMAND wget --no-check-certificate
${
XPU_URL
}
-c -q -O xpu.tar.gz
&& tar xvf xpu.tar.gz
SET
(
XPU_SOURCE_DIR
"
${
THIRD_PARTY_PATH
}
/xpu"
)
DOWNLOAD_NO_PROGRESS 1
SET
(
XPU_DOWNLOAD_DIR
"
${
XPU_SOURCE_DIR
}
/src/
${
XPU_PROJECT
}
"
)
UPDATE_COMMAND
""
SET
(
XPU_INSTALL_DIR
"
${
THIRD_PARTY_PATH
}
/install/xpu"
)
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=
${
XPU_INSTALL_ROOT
}
SET
(
XPU_INC_DIR
"
${
THIRD_PARTY_PATH
}
/install/xpu/include"
)
CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=
${
XPU_INSTALL_ROOT
}
SET
(
XPU_LIB_DIR
"
${
THIRD_PARTY_PATH
}
/install/xpu/lib"
)
)
else
()
SET
(
XPU_API_LIB
"
${
XPU_LIB_DIR
}
/
${
XPU_API_LIB_NAME
}
"
)
SET
(
XPU_API_INC_DIR
"
${
XPU_SDK_ROOT
}
/XTDK/include/"
)
SET
(
XPU_RT_LIB
"
${
XPU_LIB_DIR
}
/
${
XPU_RT_LIB_NAME
}
"
)
SET
(
XPU_API_LIB
"
${
XPU_SDK_ROOT
}
/XTDK/shlib/libxpuapi.so"
)
SET
(
XPU_RT_LIB
"
${
XPU_SDK_ROOT
}
/XTDK/runtime/shlib/libxpurt.so"
)
SET
(
CMAKE_INSTALL_RPATH
"
${
CMAKE_INSTALL_RPATH
}
"
"
${
XPU_INSTALL_DIR
}
/lib"
)
SET
(
XPU_LIB_DIR
"
${
XPU_SDK_ROOT
}
/XTDK/shlib/"
)
endif
()
FILE
(
WRITE
${
XPU_DOWNLOAD_DIR
}
/CMakeLists.txt
"PROJECT(XPU)
\n
"
"cmake_minimum_required(VERSION 3.0)
\n
"
"install(DIRECTORY xpu/include xpu/lib
\n
"
" DESTINATION
${
XPU_INSTALL_DIR
}
)
\n
"
)
ExternalProject_Add
(
${
XPU_PROJECT
}
${
EXTERNAL_PROJECT_LOG_ARGS
}
PREFIX
${
XPU_SOURCE_DIR
}
DOWNLOAD_DIR
${
XPU_DOWNLOAD_DIR
}
DOWNLOAD_COMMAND 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
}
DOWNLOAD_NO_PROGRESS 1
UPDATE_COMMAND
""
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=
${
XPU_INSTALL_ROOT
}
CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=
${
XPU_INSTALL_ROOT
}
)
INCLUDE_DIRECTORIES
(
${
XPU_
API_
INC_DIR
}
)
INCLUDE_DIRECTORIES
(
${
XPU_INC_DIR
}
)
ADD_LIBRARY
(
shared_xpuapi SHARED IMPORTED GLOBAL
)
ADD_LIBRARY
(
shared_xpuapi SHARED IMPORTED GLOBAL
)
set_property
(
TARGET shared_xpuapi PROPERTY IMPORTED_LOCATION
"
${
XPU_API_LIB
}
"
)
set_property
(
TARGET shared_xpuapi PROPERTY IMPORTED_LOCATION
"
${
XPU_API_LIB
}
"
)
...
@@ -62,7 +80,7 @@ generate_dummy_static_lib(LIB_NAME "xpulib" GENERATOR "xpu.cmake")
...
@@ -62,7 +80,7 @@ generate_dummy_static_lib(LIB_NAME "xpulib" GENERATOR "xpu.cmake")
TARGET_LINK_LIBRARIES
(
xpulib
${
XPU_API_LIB
}
${
XPU_RT_LIB
}
)
TARGET_LINK_LIBRARIES
(
xpulib
${
XPU_API_LIB
}
${
XPU_RT_LIB
}
)
if
(
WITH_XPU_BKCL
)
IF
(
WITH_XPU_BKCL
)
MESSAGE
(
STATUS
"Compile with XPU BKCL!"
)
MESSAGE
(
STATUS
"Compile with XPU BKCL!"
)
ADD_DEFINITIONS
(
-DPADDLE_WITH_XPU_BKCL
)
ADD_DEFINITIONS
(
-DPADDLE_WITH_XPU_BKCL
)
...
@@ -71,9 +89,9 @@ if (WITH_XPU_BKCL)
...
@@ -71,9 +89,9 @@ if (WITH_XPU_BKCL)
SET
(
XPU_BKCL_INC_DIR
"
${
THIRD_PARTY_PATH
}
/install/xpu/include"
)
SET
(
XPU_BKCL_INC_DIR
"
${
THIRD_PARTY_PATH
}
/install/xpu/include"
)
INCLUDE_DIRECTORIES
(
${
XPU_BKCL_INC_DIR
}
)
INCLUDE_DIRECTORIES
(
${
XPU_BKCL_INC_DIR
}
)
TARGET_LINK_LIBRARIES
(
xpulib
${
XPU_API_LIB
}
${
XPU_RT_LIB
}
${
XPU_BKCL_LIB
}
)
TARGET_LINK_LIBRARIES
(
xpulib
${
XPU_API_LIB
}
${
XPU_RT_LIB
}
${
XPU_BKCL_LIB
}
)
else
(
WITH_XPU_BKCL
)
ELSE
(
WITH_XPU_BKCL
)
TARGET_LINK_LIBRARIES
(
xpulib
${
XPU_API_LIB
}
${
XPU_RT_LIB
}
)
TARGET_LINK_LIBRARIES
(
xpulib
${
XPU_API_LIB
}
${
XPU_RT_LIB
}
)
endif
(
WITH_XPU_BKCL
)
ENDIF
(
WITH_XPU_BKCL
)
if
(
NOT XPU_SDK_ROOT
)
if
(
NOT XPU_SDK_ROOT
)
ADD_DEPENDENCIES
(
xpulib
${
XPU_PROJECT
}
)
ADD_DEPENDENCIES
(
xpulib
${
XPU_PROJECT
}
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录