gpu版在cpu上运行时若程序有import torch且set_cpu_math_library_num_threads()大于1则会异常退出
Created by: Microkitty
- 版本、环境信息: 1)PaddlePaddle版本:paddlepaddle_gpu-1.7.2.post107-cp36-cp36m-manylinux1_x86_64.whl(从pip下载) 2)CPU:Intel(R) Xeon(R) CPU E5-2678 v3 @ 2.50GHz,没有特意安装过MKL/OpenBlas/MKLDNN/等数学库(pip好像会自动安装依赖) 3)GPU:GeForce RTX 2080Ti(Driver Version: 430.50)、CUDA10.1.243和CUDNN7.6.3 4)系统环境:CentOS Linux release 7.6.1810,Python 3.6.9 |Anaconda
- 复现信息: 0)在安装有上述系统和GPU的机器上通过pip往python里安装好gpu版的paddle 1)程序里必须import torch(用的是1.3.1,其它版本没测过)才会出现,否则正常运行 2)设置export CUDA_VISIBLE_DEVICES=禁用GPU让paddle在cpu运行(其实是一台机器需要部署多个独立进程,一个在GPU上,其它在cpu上,测试阶段禁用GPU是为了模拟那些cpu进程是否能正常运行) 3)设置OMP_NUM_THREADS环境变量限制cpu核数(cpu进程较多需要限制每个进程占用核数,当然先抛开运行速度不管,测试阶段只启动了一个cpu多核进程) 4)问题一,这不是重点问题。当设置OMP_NUM_THREADS大于1时启动后报警告如下: WARNING: OMP_NUM_THREADS set to 4, not 1. The computation speed will not be optimized if you use data parallel. It will fail if this PaddlePaddle binary is compiled with OpenBlas since OpenBlas does not support multi-threads.(为什么OMP只能设为1?什么叫多核不能优化运算?openblas怎么会不支持多线程?这些警告都不合理啊!像caffe/mxnet/pytorch都可以通过设置OMP/MKL/OPENBLAS_NUM_THREADS等环境变量限制cpu核数啊,莫非paddle不行?) PLEASE USE OMP_NUM_THREADS WISELY.(用OMP_NUM_THREADS是因为程序里混用了paddle和pytorch,需要用OMP限制pytorch核数 ) 5)问题二,这才是重点问题。如果程序里import torch了,当set_cpu_math_library_num_threads(1)时正常运行,当set_cpu_math_library_num_threads(4)时异常退出,退出前输出如下信息: Intel MKL function load error: cpu specific dynamic library is not loaded.
- 问题描述: