当前位置:首页 >> 脚本专栏

基于Tensorflow使用CPU而不用GPU问题的解决

之前的文章讲过用Tensorflow的object detection api训练MobileNetV2-SSDLite,然后发现训练的时候没有利用到GPU,反而CPU占用率贼高(可能会有Could not dlopen library 'libcudart.so.10.0'之类的警告)。经调查应该是Tensorflow的GPU版本跟服务器所用的cuda及cudnn版本不匹配引起的。知道问题所在之后就好办了。

检查cuda和cudnn版本

"htmlcode">

cat /usr/local/cuda/version.txt

"htmlcode">

cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2

重新安装对应版本Tensorflow

"_blank" href="https://tensorflow.google.cn/install/source#tested_build_configurations">Tensorflow官网查看对应的Tensorflow-GPU版本,然后用conda install tensorflow-gpu=[version]重新安装(把[version]换成对应的版本比如1.12)就OK了。

以上这篇基于Tensorflow使用CPU而不用GPU问题的解决就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。