网络编程
位置:首页>> 网络编程>> Python编程>> 基于Tensorflow使用CPU而不用GPU问题的解决

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

作者:JR_Chan  发布时间:2022-01-01 22:53:08 

标签: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版本

 首先查看cuda版本:


cat /usr/local/cuda/version.txt

 以及cudnn版本:


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

重新安装对应版本Tensorflow

 根据前面查看得到的cuda和cudnn版本,到Tensorflow官网查看对应的Tensorflow-GPU版本,然后用conda install tensorflow-gpu=[version]重新安装(把[version]换成对应的版本比如1.12)就OK了。

来源:https://blog.csdn.net/JR_Chan/article/details/101374175

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com