Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
468f0e91
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2298
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看板
未验证
提交
468f0e91
编写于
1月 29, 2023
作者:
H
houj04
提交者:
GitHub
1月 29, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[XPU] add xpu version info into version.show() (#49960)
上级
ba67361b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
157 addition
and
29 deletion
+157
-29
cmake/external/xpu.cmake
cmake/external/xpu.cmake
+6
-2
python/setup.py.in
python/setup.py.in
+75
-15
setup.py
setup.py
+76
-12
未找到文件。
cmake/external/xpu.cmake
浏览文件 @
468f0e91
...
@@ -7,16 +7,20 @@ set(XPU_PROJECT "extern_xpu")
...
@@ -7,16 +7,20 @@ 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"
)
set
(
XPU_BASE_DATE
"20230114"
)
set
(
XPU_XCCL_BASE_VERSION
"1.0.7"
)
if
(
NOT DEFINED XPU_BASE_URL
)
if
(
NOT DEFINED XPU_BASE_URL
)
set
(
XPU_BASE_URL_WITHOUT_DATE
set
(
XPU_BASE_URL_WITHOUT_DATE
"https://baidu-kunlun-product.su.bcebos.com/KL-SDK/klsdk-dev"
)
"https://baidu-kunlun-product.su.bcebos.com/KL-SDK/klsdk-dev"
)
set
(
XPU_BASE_URL
"
${
XPU_BASE_URL_WITHOUT_DATE
}
/
20230114
"
)
set
(
XPU_BASE_URL
"
${
XPU_BASE_URL_WITHOUT_DATE
}
/
${
XPU_BASE_DATE
}
"
)
else
()
else
()
set
(
XPU_BASE_URL
"
${
XPU_BASE_URL
}
"
)
set
(
XPU_BASE_URL
"
${
XPU_BASE_URL
}
"
)
endif
()
endif
()
set
(
XPU_XCCL_BASE_URL
set
(
XPU_XCCL_BASE_URL
"https://klx-sdk-release-public.su.bcebos.com/xccl/release/1.0.7"
)
"https://klx-sdk-release-public.su.bcebos.com/xccl/release/
${
XPU_XCCL_BASE_VERSION
}
"
)
if
(
WITH_AARCH64
)
if
(
WITH_AARCH64
)
set
(
XPU_XRE_DIR_NAME
"xre-kylin_aarch64"
)
set
(
XPU_XRE_DIR_NAME
"xre-kylin_aarch64"
)
...
...
python/setup.py.in
浏览文件 @
468f0e91
...
@@ -75,6 +75,18 @@ def get_cudnn_version():
...
@@ -75,6 +75,18 @@ def get_cudnn_version():
else:
else:
return 'False'
return 'False'
def get_xpu_version():
if '@WITH_XPU@' == 'ON':
return '@XPU_BASE_DATE@'
else:
return 'False'
def get_xpu_xccl_version():
if '@WITH_XPU_BKCL@' == 'ON':
return '@XPU_XCCL_BASE_VERSION@'
else:
return 'False'
def is_taged():
def is_taged():
try:
try:
cmd = ['git', 'describe', '--exact-match', '--tags', 'HEAD', '2>/dev/null']
cmd = ['git', 'describe', '--exact-match', '--tags', 'HEAD', '2>/dev/null']
...
@@ -91,18 +103,20 @@ def is_taged():
...
@@ -91,18 +103,20 @@ def is_taged():
def write_version_py(filename='paddle/version/__init__.py'):
def write_version_py(filename='paddle/version/__init__.py'):
cnt = '''# THIS FILE IS GENERATED FROM PADDLEPADDLE SETUP.PY
cnt = '''# THIS FILE IS GENERATED FROM PADDLEPADDLE SETUP.PY
#
#
full_version = '%(major)d.%(minor)d.%(patch)s'
full_version = '%(major)d.%(minor)d.%(patch)s'
major = '%(major)d'
major = '%(major)d'
minor = '%(minor)d'
minor = '%(minor)d'
patch = '%(patch)s'
patch = '%(patch)s'
rc = '%(rc)d'
rc = '%(rc)d'
cuda_version = '%(cuda)s'
cuda_version = '%(cuda)s'
cudnn_version = '%(cudnn)s'
cudnn_version = '%(cudnn)s'
istaged = %(istaged)s
xpu_version = '%(xpu)s'
commit = '%(commit)s'
xpu_xccl_version = '%(xpu_xccl)s'
with_mkl = '%(with_mkl)s'
istaged = %(istaged)s
commit = '%(commit)s'
__all__ = ['cuda', 'cudnn', 'show']
with_mkl = '%(with_mkl)s'
__all__ = ['cuda', 'cudnn', 'show', 'xpu', 'xpu_xccl']
def show():
def show():
"""Get the version of paddle if `paddle` package if tagged. Otherwise, output the corresponding commit id.
"""Get the version of paddle if `paddle` package if tagged. Otherwise, output the corresponding commit id.
...
@@ -125,6 +139,10 @@ def show():
...
@@ -125,6 +139,10 @@ def show():
cudnn: the cudnn version of package. It will return `False` if CPU version paddle package is installed
cudnn: the cudnn version of package. It will return `False` if CPU version paddle package is installed
xpu: the xpu version of package. It will return `False` if non-XPU version paddle package is installed
xpu_xccl: the xpu xccl version of package. It will return `False` if non-XPU version paddle package is installed
Examples:
Examples:
.. code-block:: python
.. code-block:: python
...
@@ -139,12 +157,16 @@ def show():
...
@@ -139,12 +157,16 @@ def show():
# rc: 0
# rc: 0
# cuda: '10.2'
# cuda: '10.2'
# cudnn: '7.6.5'
# cudnn: '7.6.5'
# xpu: '20230114'
# xpu_xccl: '1.0.7'
# Case 2: paddle is not tagged
# Case 2: paddle is not tagged
paddle.version.show()
paddle.version.show()
# commit: cfa357e984bfd2ffa16820e354020529df434f7d
# commit: cfa357e984bfd2ffa16820e354020529df434f7d
# cuda: '10.2'
# cuda: '10.2'
# cudnn: '7.6.5'
# cudnn: '7.6.5'
# xpu: '20230114'
# xpu_xccl: '1.0.7'
"""
"""
if istaged:
if istaged:
print('full_version:', full_version)
print('full_version:', full_version)
...
@@ -156,6 +178,8 @@ def show():
...
@@ -156,6 +178,8 @@ def show():
print('commit:', commit)
print('commit:', commit)
print('cuda:', cuda_version)
print('cuda:', cuda_version)
print('cudnn:', cudnn_version)
print('cudnn:', cudnn_version)
print('xpu:', xpu_version)
print('xpu_xccl:', xpu_xccl_version)
def mkl():
def mkl():
return with_mkl
return with_mkl
...
@@ -165,7 +189,7 @@ def cuda():
...
@@ -165,7 +189,7 @@ def cuda():
Returns:
Returns:
string: Return the version information of cuda. If paddle package is CPU version, it will return False.
string: Return the version information of cuda. If paddle package is CPU version, it will return False.
Examples:
Examples:
.. code-block:: python
.. code-block:: python
...
@@ -182,7 +206,7 @@ def cudnn():
...
@@ -182,7 +206,7 @@ def cudnn():
Returns:
Returns:
string: Return the version information of cudnn. If paddle package is CPU version, it will return False.
string: Return the version information of cudnn. If paddle package is CPU version, it will return False.
Examples:
Examples:
.. code-block:: python
.. code-block:: python
...
@@ -193,6 +217,40 @@ def cudnn():
...
@@ -193,6 +217,40 @@ def cudnn():
"""
"""
return cudnn_version
return cudnn_version
def xpu():
"""Get xpu version of paddle package.
Returns:
string: Return the version information of xpu. If paddle package is non-XPU version, it will return False.
Examples:
.. code-block:: python
import paddle
paddle.version.xpu()
# '20230114'
"""
return xpu_version
def xpu_xccl():
"""Get xpu xccl version of paddle package.
Returns:
string: Return the version information of xpu xccl. If paddle package is non-XPU version, it will return False.
Examples:
.. code-block:: python
import paddle
paddle.version.xpu_xccl()
# '1.0.7'
"""
return xpu_xccl_version
'''
'''
commit = git_commit()
commit = git_commit()
...
@@ -213,6 +271,8 @@ def cudnn():
...
@@ -213,6 +271,8 @@ def cudnn():
'version': '${PADDLE_VERSION}',
'version': '${PADDLE_VERSION}',
'cuda': get_cuda_version(),
'cuda': get_cuda_version(),
'cudnn': get_cudnn_version(),
'cudnn': get_cudnn_version(),
'xpu': get_xpu_version(),
'xpu_xccl': get_xpu_xccl_version(),
'commit': commit,
'commit': commit,
'istaged': is_taged(),
'istaged': is_taged(),
'with_mkl': '@WITH_MKL@'})
'with_mkl': '@WITH_MKL@'})
...
@@ -463,7 +523,7 @@ shutil.copy('${WARPCTC_LIBRARIES}', libs_path)
...
@@ -463,7 +523,7 @@ shutil.copy('${WARPCTC_LIBRARIES}', libs_path)
shutil.copy('${WARPRNNT_LIBRARIES}', libs_path)
shutil.copy('${WARPRNNT_LIBRARIES}', libs_path)
package_data['paddle.libs']+=[
package_data['paddle.libs']+=[
os.path.basename('${LAPACK_LIB}'),
os.path.basename('${LAPACK_LIB}'),
os.path.basename('${BLAS_LIB}'),
os.path.basename('${BLAS_LIB}'),
os.path.basename('${GFORTRAN_LIB}'),
os.path.basename('${GFORTRAN_LIB}'),
os.path.basename('${GNU_RT_LIB_1}')]
os.path.basename('${GNU_RT_LIB_1}')]
...
...
setup.py
浏览文件 @
468f0e91
...
@@ -345,6 +345,22 @@ def get_cudnn_version():
...
@@ -345,6 +345,22 @@ def get_cudnn_version():
return
'False'
return
'False'
def
get_xpu_version
():
with_xpu
=
env_dict
.
get
(
"WITH_XPU"
)
if
with_xpu
==
'ON'
:
return
env_dict
.
get
(
"XPU_BASE_DATE"
)
else
:
return
'False'
def
get_xpu_xccl_version
():
with_xpu_xccl
=
env_dict
.
get
(
"WITH_XPU_BKCL"
)
if
with_xpu_xccl
==
'ON'
:
return
env_dict
.
get
(
"XPU_XCCL_BASE_VERSION"
)
else
:
return
'False'
def
is_taged
():
def
is_taged
():
try
:
try
:
cmd
=
[
cmd
=
[
...
@@ -376,18 +392,20 @@ def is_taged():
...
@@ -376,18 +392,20 @@ def is_taged():
def
write_version_py
(
filename
=
'paddle/version/__init__.py'
):
def
write_version_py
(
filename
=
'paddle/version/__init__.py'
):
cnt
=
'''# THIS FILE IS GENERATED FROM PADDLEPADDLE SETUP.PY
cnt
=
'''# THIS FILE IS GENERATED FROM PADDLEPADDLE SETUP.PY
#
#
full_version = '%(major)d.%(minor)d.%(patch)s'
full_version = '%(major)d.%(minor)d.%(patch)s'
major = '%(major)d'
major = '%(major)d'
minor = '%(minor)d'
minor = '%(minor)d'
patch = '%(patch)s'
patch = '%(patch)s'
rc = '%(rc)d'
rc = '%(rc)d'
cuda_version = '%(cuda)s'
cuda_version = '%(cuda)s'
cudnn_version = '%(cudnn)s'
cudnn_version = '%(cudnn)s'
istaged = %(istaged)s
xpu_version = '%(xpu)s'
commit = '%(commit)s'
xpu_xccl_version = '%(xpu_xccl)s'
with_mkl = '%(with_mkl)s'
istaged = %(istaged)s
commit = '%(commit)s'
__all__ = ['cuda', 'cudnn', 'show']
with_mkl = '%(with_mkl)s'
__all__ = ['cuda', 'cudnn', 'show', 'xpu', 'xpu_xccl']
def show():
def show():
"""Get the version of paddle if `paddle` package if tagged. Otherwise, output the corresponding commit id.
"""Get the version of paddle if `paddle` package if tagged. Otherwise, output the corresponding commit id.
...
@@ -410,6 +428,10 @@ def show():
...
@@ -410,6 +428,10 @@ def show():
cudnn: the cudnn version of package. It will return `False` if CPU version paddle package is installed
cudnn: the cudnn version of package. It will return `False` if CPU version paddle package is installed
xpu: the xpu version of package. It will return `False` if non-XPU version paddle package is installed
xpu_xccl: the xpu xccl version of package. It will return `False` if non-XPU version paddle package is installed
Examples:
Examples:
.. code-block:: python
.. code-block:: python
...
@@ -424,12 +446,16 @@ def show():
...
@@ -424,12 +446,16 @@ def show():
# rc: 0
# rc: 0
# cuda: '10.2'
# cuda: '10.2'
# cudnn: '7.6.5'
# cudnn: '7.6.5'
# xpu: '20230114'
# xpu_xccl: '1.0.7'
# Case 2: paddle is not tagged
# Case 2: paddle is not tagged
paddle.version.show()
paddle.version.show()
# commit: cfa357e984bfd2ffa16820e354020529df434f7d
# commit: cfa357e984bfd2ffa16820e354020529df434f7d
# cuda: '10.2'
# cuda: '10.2'
# cudnn: '7.6.5'
# cudnn: '7.6.5'
# xpu: '20230114'
# xpu_xccl: '1.0.7'
"""
"""
if istaged:
if istaged:
print('full_version:', full_version)
print('full_version:', full_version)
...
@@ -441,6 +467,8 @@ def show():
...
@@ -441,6 +467,8 @@ def show():
print('commit:', commit)
print('commit:', commit)
print('cuda:', cuda_version)
print('cuda:', cuda_version)
print('cudnn:', cudnn_version)
print('cudnn:', cudnn_version)
print('xpu:', xpu_version)
print('xpu_xccl:', xpu_xccl_version)
def mkl():
def mkl():
return with_mkl
return with_mkl
...
@@ -478,6 +506,40 @@ def cudnn():
...
@@ -478,6 +506,40 @@ def cudnn():
"""
"""
return cudnn_version
return cudnn_version
def xpu():
"""Get xpu version of paddle package.
Returns:
string: Return the version information of xpu. If paddle package is non-XPU version, it will return False.
Examples:
.. code-block:: python
import paddle
paddle.version.xpu()
# '20230114'
"""
return xpu_version
def xpu_xccl():
"""Get xpu xccl version of paddle package.
Returns:
string: Return the version information of xpu xccl. If paddle package is non-XPU version, it will return False.
Examples:
.. code-block:: python
import paddle
paddle.version.xpu_xccl()
# '1.0.7'
"""
return xpu_xccl_version
'''
'''
commit
=
git_commit
()
commit
=
git_commit
()
...
@@ -500,6 +562,8 @@ def cudnn():
...
@@ -500,6 +562,8 @@ def cudnn():
'version'
:
env_dict
.
get
(
"PADDLE_VERSION"
),
'version'
:
env_dict
.
get
(
"PADDLE_VERSION"
),
'cuda'
:
get_cuda_version
(),
'cuda'
:
get_cuda_version
(),
'cudnn'
:
get_cudnn_version
(),
'cudnn'
:
get_cudnn_version
(),
'xpu'
:
get_xpu_version
(),
'xpu_xccl'
:
get_xpu_xccl_version
(),
'commit'
:
commit
,
'commit'
:
commit
,
'istaged'
:
is_taged
(),
'istaged'
:
is_taged
(),
'with_mkl'
:
env_dict
.
get
(
"WITH_MKL"
),
'with_mkl'
:
env_dict
.
get
(
"WITH_MKL"
),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录