Windows运行SSD使用GPU比CPU还慢

操作系统和版本

Windows10 x64

Python版本

Python: python3.6.4 64bit

硬件配置

CPU:酷睿i9-7900X

GPU: Nvidia GeForce GTX 1080 TI

内存:32G

CUDA: CUDA 9.0

mxnet: 根据官方教程安装(pip install mxnet-cu90 --pre)

问题的记录

使用ssd算法中demo.py进行测试。
1、使用GPU测试
E:_MyWorkspace\mxnet-ssd>python demo.py --gpu 0
C:\ProgramData\Anaconda3\lib\site-packages\h5py_init.py:36: FutureWarning: Conversion of the second argument of issubdtype from float t_
o np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type.
_ from .conv import register_converters as register_converters
Using mxnet as:
<module ‘mxnet’ from ‘C:\ProgramData\Anaconda3\lib\site-packages\mxnet\init.py’>
Warning: using pre-installed version of mxnet may cause unexpected error…
(export MXNET_EXAMPLE_SSD_DISABLE_PRE_INSTALLED=1) to prevent loading pre-installed mxnet.
[09:59:34] c:\jenkins\workspace\mxnet\mxnet\src\nnvm\legacy_json_util.cc:209: Loading symbol saved by previous version v0.10.1. Attempting to
_ upgrade…

[09:59:34] c:\jenkins\workspace\mxnet\mxnet\src\nnvm\legacy_json_util.cc:217: Symbol successfully upgraded!
[09:59:37] c:\jenkins\workspace\mxnet\mxnet\src\operator\nn\cudnn./cudnn_algoreg-inl.h:107: Running performance tests to find the best convo
lution algorithm, this can take a while… (setting env variable MXNET_CUDNN_AUTOTUNE_DEFAULT to 0 to disable)
Detection time for 1 images: 26.1040 sec
2、使用CPU测试
E:_MyWorkspace\mxnet-ssd>python demo.py --cpu
C:\ProgramData\Anaconda3\lib\site-packages\h5py_init.py:36: FutureWarning: Conversion of the second argument of issubdtype from float t_
o np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type.
_ from .conv import register_converters as register_converters
Using mxnet as:
<module ‘mxnet’ from ‘C:\ProgramData\Anaconda3\lib\site-packages\mxnet\init.py’>
Warning: using pre-installed version of mxnet may cause unexpected error…
(export MXNET_EXAMPLE_SSD_DISABLE_PRE_INSTALLED=1) to prevent loading pre-installed mxnet.
[10:00:18] c:\jenkins\workspace\mxnet\mxnet\src\nnvm\legacy_json_util.cc:209: Loading symbol saved by previous version v0.10.1. Attempting to
_ upgrade…

[10:00:18] c:\jenkins\workspace\mxnet\mxnet\src\nnvm\legacy_json_util.cc:217: Symbol successfully upgraded!
Detection time for 1 images: 0.7453 sec

怎样复现问题

安装完成后运行demo

尝试过的解决方法

现在的状况:

其他

GPU 0: GeForce GTX 1080 Ti (UUID: GPU-c7773645-fc0a-4c6e-8c8e-ad0be42bd9bb)
GPU 1: GeForce GTX 1080 Ti (UUID: GPU-6e926660-f476-4220-d3ae-7bf0970d220a)

nvcc: NVIDIA ® Cuda compiler driver
Copyright © 2005-2017 NVIDIA Corporation
Built on Fri_Sep__1_21:08:32_Central_Daylight_Time_2017
Cuda compilation tools, release 9.0, V9.0.176

你只有測試一張嗎?
畢竟要context switch 第一張可能會慢
測試看看一次多張一點

MXNET_CUDNN_AUTOTUNE_DEFAULT gpu在autotune当然慢,连续测试多个就行了

2赞

厉害了 确实是这个原因

autotune可以关掉吗,我按照教程设置MXNET_CUDNN_AUTOTUNE_DEFAULT=0都不起作用