未验证 提交 468f0e91 编写于 作者: H houj04 提交者: GitHub

[XPU] add xpu version info into version.show() (#49960)

上级 ba67361b
......@@ -7,16 +7,20 @@ set(XPU_PROJECT "extern_xpu")
set(XPU_API_LIB_NAME "libxpuapi.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)
set(XPU_BASE_URL_WITHOUT_DATE
"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()
set(XPU_BASE_URL "${XPU_BASE_URL}")
endif()
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)
set(XPU_XRE_DIR_NAME "xre-kylin_aarch64")
......
......@@ -75,6 +75,18 @@ def get_cudnn_version():
else:
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():
try:
cmd = ['git', 'describe', '--exact-match', '--tags', 'HEAD', '2>/dev/null']
......@@ -98,11 +110,13 @@ patch = '%(patch)s'
rc = '%(rc)d'
cuda_version = '%(cuda)s'
cudnn_version = '%(cudnn)s'
xpu_version = '%(xpu)s'
xpu_xccl_version = '%(xpu_xccl)s'
istaged = %(istaged)s
commit = '%(commit)s'
with_mkl = '%(with_mkl)s'
__all__ = ['cuda', 'cudnn', 'show']
__all__ = ['cuda', 'cudnn', 'show', 'xpu', 'xpu_xccl']
def show():
"""Get the version of paddle if `paddle` package if tagged. Otherwise, output the corresponding commit id.
......@@ -125,6 +139,10 @@ def show():
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:
.. code-block:: python
......@@ -139,12 +157,16 @@ def show():
# rc: 0
# cuda: '10.2'
# cudnn: '7.6.5'
# xpu: '20230114'
# xpu_xccl: '1.0.7'
# Case 2: paddle is not tagged
paddle.version.show()
# commit: cfa357e984bfd2ffa16820e354020529df434f7d
# cuda: '10.2'
# cudnn: '7.6.5'
# xpu: '20230114'
# xpu_xccl: '1.0.7'
"""
if istaged:
print('full_version:', full_version)
......@@ -156,6 +178,8 @@ def show():
print('commit:', commit)
print('cuda:', cuda_version)
print('cudnn:', cudnn_version)
print('xpu:', xpu_version)
print('xpu_xccl:', xpu_xccl_version)
def mkl():
return with_mkl
......@@ -193,6 +217,40 @@ def cudnn():
"""
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()
......@@ -213,6 +271,8 @@ def cudnn():
'version': '${PADDLE_VERSION}',
'cuda': get_cuda_version(),
'cudnn': get_cudnn_version(),
'xpu': get_xpu_version(),
'xpu_xccl': get_xpu_xccl_version(),
'commit': commit,
'istaged': is_taged(),
'with_mkl': '@WITH_MKL@'})
......
......@@ -345,6 +345,22 @@ def get_cudnn_version():
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():
try:
cmd = [
......@@ -383,11 +399,13 @@ patch = '%(patch)s'
rc = '%(rc)d'
cuda_version = '%(cuda)s'
cudnn_version = '%(cudnn)s'
xpu_version = '%(xpu)s'
xpu_xccl_version = '%(xpu_xccl)s'
istaged = %(istaged)s
commit = '%(commit)s'
with_mkl = '%(with_mkl)s'
__all__ = ['cuda', 'cudnn', 'show']
__all__ = ['cuda', 'cudnn', 'show', 'xpu', 'xpu_xccl']
def show():
"""Get the version of paddle if `paddle` package if tagged. Otherwise, output the corresponding commit id.
......@@ -410,6 +428,10 @@ def show():
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:
.. code-block:: python
......@@ -424,12 +446,16 @@ def show():
# rc: 0
# cuda: '10.2'
# cudnn: '7.6.5'
# xpu: '20230114'
# xpu_xccl: '1.0.7'
# Case 2: paddle is not tagged
paddle.version.show()
# commit: cfa357e984bfd2ffa16820e354020529df434f7d
# cuda: '10.2'
# cudnn: '7.6.5'
# xpu: '20230114'
# xpu_xccl: '1.0.7'
"""
if istaged:
print('full_version:', full_version)
......@@ -441,6 +467,8 @@ def show():
print('commit:', commit)
print('cuda:', cuda_version)
print('cudnn:', cudnn_version)
print('xpu:', xpu_version)
print('xpu_xccl:', xpu_xccl_version)
def mkl():
return with_mkl
......@@ -478,6 +506,40 @@ def cudnn():
"""
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()
......@@ -500,6 +562,8 @@ def cudnn():
'version': env_dict.get("PADDLE_VERSION"),
'cuda': get_cuda_version(),
'cudnn': get_cudnn_version(),
'xpu': get_xpu_version(),
'xpu_xccl': get_xpu_xccl_version(),
'commit': commit,
'istaged': is_taged(),
'with_mkl': env_dict.get("WITH_MKL"),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册