未验证 提交 7a6f4d64 编写于 作者: L Leo Chen 提交者: GitHub

Add a tool to collect environments (#24971)

* add summary_env, test=develop

* update issue template, test=develop

* refine link, test=develop
Co-authored-by: Nroot <root@yq01-gpu-255-129-15-00.epc.baidu.com>
上级 c85c7b22
......@@ -10,6 +10,7 @@ about: 您可以提出您的建议。 You could use this template for reporting
1)PaddlePaddle版本:请提供您的PaddlePaddle版本号,例如1.1
2)CPU/GPU:您是否使用GPU进行训练,如是,请提供您的CUDA和cuDNN版本号
3)系统环境:请您描述系统类型、版本,例如Mac OS 10.14
注:您可以通过执行[summary_env.py](https://github.com/PaddlePaddle/Paddle/blob/develop/tools/summary_env.py)获取以上信息。
- 复现信息:如为报错,请给出复现环境、复现步骤
- 建议描述:请您详细描述,您认为需优化的功能
......@@ -21,6 +22,7 @@ Please make sure that this is a feature request.
-CPU: including CPUMKL/OpenBlas/MKLDNN version
-GPU: including CUDA/CUDNN version
-OS Platform (eg.Mac OS 10.14)
Note: You can get most of the information by running [summary_env.py](https://github.com/PaddlePaddle/Paddle/blob/develop/tools/summary_env.py).
**To Reproduce**
Steps to reproduce the behavior
**Describe the feature and the current behavior/state.**
......
......@@ -13,6 +13,7 @@ about: 您可以提问预测中报错、应用等问题。 You could use this te
   2)CPU:预测若用CPU,请提供CPU型号,MKL/OpenBlas/MKLDNN/等数学库使用情况
   3)GPU:预测若用GPU,请提供GPU型号、CUDA和CUDNN版本号
   4)系统环境:请您描述系统类型、版本(如Mac OS 10.14),Python版本
注:您可以通过执行[summary_env.py](https://github.com/PaddlePaddle/Paddle/blob/develop/tools/summary_env.py)获取以上信息。
-预测信息
   1)C++预测:请您提供预测库安装包的版本信息,及其中的version.txt文件
   2)CMake包含路径的完整命令
......@@ -33,6 +34,7 @@ If there is no solution,please make sure that this is an inference issue includi
-Cmake orders
-C++version.txt
-API information
Note: You can get most of the information by running [summary_env.py](https://github.com/PaddlePaddle/Paddle/blob/develop/tools/summary_env.py).
**To Reproduce**
Steps to reproduce the behavior
**Describe your current behavior**
......
......@@ -14,6 +14,7 @@ about: 您可以提问安装、编译出现报错等问题。 You could use this
   2)CPU:请提供CPU型号,MKL/OpenBlas/MKLDNN/等数学库的使用情况
   3)GPU:请提供GPU型号,CUDA和CUDNN版本号
   4)系统环境:请说明系统类型、版本(如Mac OS 10.14)、Python版本
注:您可以通过执行[summary_env.py](https://github.com/PaddlePaddle/Paddle/blob/develop/tools/summary_env.py)获取以上信息。
- 安装方式信息:
1)pip安装/docker安装
2)本地编译:请提供cmake命令,编译命令
......@@ -32,7 +33,9 @@ If there is no solution,please make sure that this is an installation issue incl
-OS Platform (eg. Mac OS 10.14)
-Python version
- Install method: pip install/install with docker/build from source(without docker)/build within docker
- Other special cases that you think may be related to this problem, eg. offline install, special internet condition  
- Other special cases that you think may be related to this problem, eg. offline install, special internet condition
Note: You can get most of the information by running [summary_env.py](https://github.com/PaddlePaddle/Paddle/blob/develop/tools/summary_env.py).  
**To Reproduce**
Steps to reproduce the behavior
**Describe your current behavior**
......
......@@ -14,6 +14,7 @@ about: 您可以提问模型、算法、数据集方向的使用报错等问题
   2)CPU:请提供CPU型号,MKL/OpenBlas/MKLDNN/等数学库的使用情况
   3)GPU:请提供GPU型号,CUDA和CUDNN版本号
   4)系统环境:请说明系统类型、版本(例如Mac OS 10.14),Python版本
注:您可以通过执行[summary_env.py](https://github.com/PaddlePaddle/Paddle/blob/develop/tools/summary_env.py)获取以上信息。
- 模型信息
   1)模型名称 2)使用数据集名称 3)使用算法名称 4)模型链接
- 复现信息:如为报错,请给出复现环境、复现步骤
......@@ -29,6 +30,7 @@ If there is no solution,please make sure that this is a issue of models includin
-OS Platform (eg.Mac OS 10.14)
-Python version
-Name of Models&Dataset/details of operator
Note: You can get most of the information by running [summary_env.py](https://github.com/PaddlePaddle/Paddle/blob/develop/tools/summary_env.py).
**To Reproduce**
Steps to reproduce the behavior
**Describe your current behavior**
......
......@@ -14,6 +14,7 @@ about: 如上述分类未包含您的问题,可在此提出。 You could use t
   3)系统环境:请您描述系统类型、版本,例如Mac OS 10.14
   4)Python版本号
   5)显存信息
注:您可以通过执行[summary_env.py](https://github.com/PaddlePaddle/Paddle/blob/develop/tools/summary_env.py)获取以上信息。
- 复现信息:如为报错,请给出复现环境、复现步骤
- 问题描述:请详细描述您的问题,同步贴出报错信息、日志/代码关键片段
......@@ -26,6 +27,7 @@ If there is no solution,please provide us with the following details :
-GPU: including CUDA/cuDNN version
-OS Platform and Distribution(eg.Mac OS 10.14)
-Python version
Note: You can get most of the information by running [summary_env.py](https://github.com/PaddlePaddle/Paddle/blob/develop/tools/summary_env.py).
**To Reproduce**
Steps to reproduce the behavior
**Describe your current behavior**
......
......@@ -14,6 +14,7 @@ about: 您可以提问训练中报错、应用、出core等问题。 You could u
   2)CPU:预测若用CPU,请提供CPU型号,MKL/OpenBlas/MKLDNN/等数学库使用情况
   3)GPU:预测若用GPU,请提供GPU型号、CUDA和CUDNN版本号
   4)系统环境:请您描述系统类型、版本,例如Mac OS 10.14,Python版本
注:您可以通过执行[summary_env.py](https://github.com/PaddlePaddle/Paddle/blob/develop/tools/summary_env.py)获取以上信息。
- 训练信息
   1)单机/多机,单卡/多卡
   2)显存信息
......@@ -31,6 +32,7 @@ If there is no solution,please make sure that this is a training issue including
-OS Platform (eg.Mac OS 10.14)
-Other imformation: Distriuted training/informantion of operator/
Graphics card storage
Note: You can get most of the information by running [summary_env.py](https://github.com/PaddlePaddle/Paddle/blob/develop/tools/summary_env.py).
**To Reproduce**
Steps to reproduce the behavior
**Describe your current behavior**
......
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import sys
import platform
import subprocess
envs_template = """
Paddle version: {paddle_version}
Paddle With CUDA: {paddle_with_cuda}
OS: {os_info}
Python version: {python_version}
CUDA version: {cuda_version}
cuDNN version: {cudnn_version}
Nvidia driver version: {nvidia_driver_version}
"""
envs = {}
def get_paddle_info():
try:
import paddle
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
def get_os_info():
plat = platform.system()
if platform.system() == "Darwin":
plat = "macOs"
ver = platform.mac_ver()[0]
elif platform.system() == "Linux":
plat = platform.linux_distribution()[0]
ver = platform.linux_distribution()[1]
elif platform.system() == "Windows":
plat = "Windows"
ver = platform.win32_ver()[0]
else:
plat = None
ver = None
envs['os_info'] = "{} {}".format(plat, ver)
def get_python_info():
envs['python_version'] = sys.version.split(' ')[0]
def run_shell_command(cmd):
out, err = subprocess.Popen(
cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
shell=True).communicate()
if err:
return None
else:
return out.decode('utf-8')
def get_cuda_info():
out = run_shell_command('nvcc --version')
if out:
envs['cuda_version'] = out.split('V')[-1].strip()
else:
envs['cuda_version'] = None
def get_cudnn_info():
def _get_cudnn_ver(cmd):
out = run_shell_command(cmd)
if out:
return out.split(' ')[-1].strip()
else:
return None
if platform.system() == "Windows":
cudnn_dll_path = run_shell_command('where cudnn*')
if cudnn_dll_path:
cudnn_header_path = cudnn_dll_path.split('bin')[
0] + 'include\cudnn.h'
cmd = 'type "{}" | findstr "{}" | findstr /v "CUDNN_VERSION"'
else:
envs['cudnn_version'] = None
return
else:
cudnn_header_path = run_shell_command(
'whereis "cudnn.h" | awk \'{print $2}\'')
if cudnn_header_path:
cudnn_header_path = cudnn_header_path.strip()
cmd = 'cat "{}" | grep "{}" | grep -v "CUDNN_VERSION"'
else:
envs['cudnn_version'] = None
return
major = _get_cudnn_ver(cmd.format(cudnn_header_path, 'CUDNN_MAJOR'))
minor = _get_cudnn_ver(cmd.format(cudnn_header_path, 'CUDNN_MINOR'))
patch_level = _get_cudnn_ver(
cmd.format(cudnn_header_path, 'CUDNN_PATCHLEVEL'))
envs['cudnn_version'] = "{}.{}.{}".format(major, minor, patch_level)
def get_driver_info():
driver_ver = run_shell_command('nvidia-smi')
if driver_ver:
driver_ver = driver_ver.split('Driver Version:')[1].strip().split(' ')[
0]
else:
driver_ver = None
envs['nvidia_driver_version'] = driver_ver
def main():
get_paddle_info()
get_os_info()
get_python_info()
get_cuda_info()
get_cudnn_info()
get_driver_info()
print(envs_template.format(**envs))
if __name__ == '__main__':
main()
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册