From 31b1e81124ac248c78aff82cb941a7157011caab Mon Sep 17 00:00:00 2001 From: gouzi <530971494@qq.com> Date: Thu, 1 Dec 2022 00:55:00 +0800 Subject: [PATCH 1/7] [tools] remove deprecated api , fix macOS get version error --- tools/summary_env.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tools/summary_env.py b/tools/summary_env.py index ec63f764c01bf2..26da11f34065d3 100644 --- a/tools/summary_env.py +++ b/tools/summary_env.py @@ -44,13 +44,12 @@ def get_paddle_info(): def get_os_info(): - plat = platform.system() if platform.system() == "Darwin": - plat = "macOs" - ver = platform.mac_ver()[0] + plat = "macOS" + ver = run_shell_command('sw_vers -productVersion').strip('\n') elif platform.system() == "Linux": - plat = distro.linux_distribution()[0] - ver = distro.linux_distribution()[1] + plat = distro.id() + ver = distro.version() elif platform.system() == "Windows": plat = "Windows" ver = platform.win32_ver()[0] From b8a348d7fee78b4c7167bf0102445e9862095ba2 Mon Sep 17 00:00:00 2001 From: gouzi <530971494@qq.com> Date: Thu, 1 Dec 2022 18:51:58 +0800 Subject: [PATCH 2/7] [tools] Rename the value that returns null --- tools/summary_env.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/tools/summary_env.py b/tools/summary_env.py index 26da11f34065d3..497e92b8497a31 100644 --- a/tools/summary_env.py +++ b/tools/summary_env.py @@ -39,8 +39,8 @@ def get_paddle_info(): envs['paddle_version'] = paddle.__version__ envs['paddle_with_cuda'] = paddle.fluid.core.is_compiled_with_cuda() except: - envs['paddle_version'] = None - envs['paddle_with_cuda'] = None + envs['paddle_version'] = 'N/A' + envs['paddle_with_cuda'] = 'N/A' def get_os_info(): @@ -54,8 +54,8 @@ def get_os_info(): plat = "Windows" ver = platform.win32_ver()[0] else: - plat = None - ver = None + plat = 'N/A' + ver = 'N/A' envs['os_info'] = "{0} {1}".format(plat, ver) @@ -78,7 +78,7 @@ def get_cuda_info(): if out: envs['cuda_version'] = out.split('V')[-1].strip() else: - envs['cuda_version'] = None + envs['cuda_version'] = 'N/A' def get_cudnn_info(): @@ -87,7 +87,7 @@ def _get_cudnn_ver(cmd): if out: return out.split(' ')[-1].strip() else: - return None + return 'N/A' if platform.system() == "Windows": cudnn_dll_path = run_shell_command('where cudnn*') @@ -97,7 +97,7 @@ def _get_cudnn_ver(cmd): ) cmd = 'type "{0}" | findstr "{1}" | findstr /v "CUDNN_VERSION"' else: - envs['cudnn_version'] = None + envs['cudnn_version'] = 'N/A' return else: cudnn_header_path = run_shell_command( @@ -116,7 +116,10 @@ def _get_cudnn_ver(cmd): cmd.format(cudnn_header_path, 'CUDNN_PATCHLEVEL') ) - envs['cudnn_version'] = "{0}.{1}.{2}".format(major, minor, patch_level) + if major != 'N/A': + envs['cudnn_version'] = "{0}.{1}.{2}".format(major, minor, patch_level) + else: + envs['cudnn_version'] = 'N/A' def get_driver_info(): @@ -126,7 +129,7 @@ def get_driver_info(): driver_ver.split('Driver Version:')[1].strip().split(' ')[0] ) else: - driver_ver = None + driver_ver = 'N/A' envs['nvidia_driver_version'] = driver_ver From ef5ac7e3566333c55f137e4b047068a799e375c4 Mon Sep 17 00:00:00 2001 From: gouzi <530971494@qq.com> Date: Thu, 1 Dec 2022 18:58:41 +0800 Subject: [PATCH 3/7] [tools] add gcc, clang, cmak, libc version --- tools/summary_env.py | 46 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/tools/summary_env.py b/tools/summary_env.py index 497e92b8497a31..b628d561006bfa 100644 --- a/tools/summary_env.py +++ b/tools/summary_env.py @@ -22,6 +22,10 @@ Paddle With CUDA: {paddle_with_cuda} OS: {os_info} +GCC version: {gcc_version} +Clang version: {clang_version} +CMake version: {cmake_version} +Libc version: {libc_version} Python version: {python_version} CUDA version: {cuda_version} @@ -59,6 +63,44 @@ def get_os_info(): envs['os_info'] = "{0} {1}".format(plat, ver) +def get_gcc_version(): + try: + envs['gcc_version'] = ( + run_shell_command("gcc --version").split('\n')[0].split("gcc ")[1] + ) + except: + envs['gcc_version'] = 'N/A' + + +def get_clang_version(): + try: + envs['clang_version'] = ( + run_shell_command("clang --version") + .split('\n')[0] + .split("clang version ")[1] + ) + except: + envs['clang_version'] = 'N/A' + + +def get_cmake_version(): + try: + envs['cmake_version'] = ( + run_shell_command("cmake --version") + .split('\n')[0] + .split("cmake ")[1] + ) + except: + envs['cmake_version'] = 'N/A' + + +def get_libc_version(): + if platform.system() == "Linux": + envs['libc_version'] = ' '.join(platform.libc_ver()) + else: + envs['libc_version'] = 'N/A' + + def get_python_info(): envs['python_version'] = sys.version.split(' ')[0] @@ -136,6 +178,10 @@ def get_driver_info(): def main(): get_paddle_info() get_os_info() + get_gcc_version() + get_clang_version() + get_cmake_version() + get_libc_version() get_python_info() get_cuda_info() get_cudnn_info() From a2cabfdb451905a125c70a7d400854b6e57c2028 Mon Sep 17 00:00:00 2001 From: gouzi <530971494@qq.com> Date: Thu, 1 Dec 2022 19:00:01 +0800 Subject: [PATCH 4/7] [tools] fix cudnn read error --- tools/summary_env.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/summary_env.py b/tools/summary_env.py index b628d561006bfa..75c080f18ed428 100644 --- a/tools/summary_env.py +++ b/tools/summary_env.py @@ -144,12 +144,16 @@ def _get_cudnn_ver(cmd): else: cudnn_header_path = run_shell_command( 'whereis "cudnn.h" | awk \'{print $2}\'' - ) + ).strip('\n') if cudnn_header_path: - cudnn_header_path = cudnn_header_path.strip() cmd = 'cat "{0}" | grep "{1}" | grep -v "CUDNN_VERSION"' + if _get_cudnn_ver(cmd.format(cudnn_header_path, 'CUDNN_MAJOR')): + cudnn_header_path = run_shell_command( + 'whereis "cudnn_version.h" | awk \'{print $2}\'' + ).strip('\n') + else: - envs['cudnn_version'] = None + envs['cudnn_version'] = 'N/A' return major = _get_cudnn_ver(cmd.format(cudnn_header_path, 'CUDNN_MAJOR')) From 96e46ec01b88cda646983881208fa643d3f0e98c Mon Sep 17 00:00:00 2001 From: gouzi <530971494@qq.com> Date: Thu, 1 Dec 2022 19:01:40 +0800 Subject: [PATCH 5/7] [tools] add gpu devices list, drive based --- tools/summary_env.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tools/summary_env.py b/tools/summary_env.py index 75c080f18ed428..73fcfbcf2de9ed 100644 --- a/tools/summary_env.py +++ b/tools/summary_env.py @@ -31,6 +31,7 @@ CUDA version: {cuda_version} cuDNN version: {cudnn_version} Nvidia driver version: {nvidia_driver_version} +Nvidia driver List: {nvidia_gpu_driver} """ envs = {} @@ -179,6 +180,18 @@ def get_driver_info(): envs['nvidia_driver_version'] = driver_ver +def get_nvidia_gpu_driver(): + if platform.system() != "Windows" and platform.system() != "Linux": + envs['nvidia_gpu_driver'] = 'N/A' + return + nvidia_smi = 'nvidia-smi' + gpu_list = run_shell_command(nvidia_smi + " -L") + result = "\n" + for gpu_info in gpu_list.split("\n"): + result += gpu_info.split(" (UUID:")[0] + "\n" + envs['nvidia_gpu_driver'] = result + + def main(): get_paddle_info() get_os_info() @@ -190,6 +203,7 @@ def main(): get_cuda_info() get_cudnn_info() get_driver_info() + get_nvidia_gpu_driver() print('*' * 40 + envs_template.format(**envs) + '*' * 40) From cca5ca0e600db6f73b6201410fef5ae0a07f5711 Mon Sep 17 00:00:00 2001 From: gouzi <530971494@qq.com> Date: Thu, 8 Dec 2022 23:11:10 +0800 Subject: [PATCH 6/7] [issue] update 3_build-installation-issue.yml --- .github/ISSUE_TEMPLATE/3_build-installation-issue.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/ISSUE_TEMPLATE/3_build-installation-issue.yml b/.github/ISSUE_TEMPLATE/3_build-installation-issue.yml index bb48906e5ea48f..a81bdb3a5443bc 100644 --- a/.github/ISSUE_TEMPLATE/3_build-installation-issue.yml +++ b/.github/ISSUE_TEMPLATE/3_build-installation-issue.yml @@ -49,11 +49,16 @@ body: Paddle With CUDA: OS: + GCC version: + Clang version: + CMake version: + Libc version: Python version: CUDA version: cuDNN version: Nvidia driver version: + Nvidia driver List: **************************************** validations: required: true From d5ff7d44deb098c03a8479b7fc5b39581e9348ff Mon Sep 17 00:00:00 2001 From: gouzi <530971494@qq.com> Date: Fri, 9 Dec 2022 12:06:33 +0800 Subject: [PATCH 7/7] [tools] fix get gpu list AttributeError --- tools/summary_env.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tools/summary_env.py b/tools/summary_env.py index 73fcfbcf2de9ed..2cd4ade4b06c94 100644 --- a/tools/summary_env.py +++ b/tools/summary_env.py @@ -184,12 +184,15 @@ def get_nvidia_gpu_driver(): if platform.system() != "Windows" and platform.system() != "Linux": envs['nvidia_gpu_driver'] = 'N/A' return - nvidia_smi = 'nvidia-smi' - gpu_list = run_shell_command(nvidia_smi + " -L") - result = "\n" - for gpu_info in gpu_list.split("\n"): - result += gpu_info.split(" (UUID:")[0] + "\n" - envs['nvidia_gpu_driver'] = result + try: + nvidia_smi = 'nvidia-smi' + gpu_list = run_shell_command(nvidia_smi + " -L") + result = "\n" + for gpu_info in gpu_list.split("\n"): + result += gpu_info.split(" (UUID:")[0] + "\n" + envs['nvidia_gpu_driver'] = result + except: + envs['nvidia_gpu_driver'] = 'N/A' def main():