Tensorflow: Cannot dlopen some GPU libraries. Skipping registering GPU devices...

Cannot dlopen some GPU libraries. Skipping registering GPU devices…

很久没搞Tensorflow了,又出了一些问题,这里作个备份

可能的问题为:

1,cuda和安装的tensorflow版本不对应

可参考:Tensorflow与cuda版本对应关系

2, 未成功加载cuda的动态库,可通过代码如下测试

import tensorflow as tf
tf.test.gpu_device_name()

如果出现如下错误:

2020-05-26 13:41:11.299037: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcudart.so.10.0'; dlerror: libcudart.so.10.0: cannot open shared object file: No such file or directory
2020-05-26 13:41:11.299176: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcublas.so.10.0'; dlerror: libcublas.so.10.0: cannot open shared object file: No such file or directory
2020-05-26 13:41:11.299257: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcufft.so.10.0'; dlerror: libcufft.so.10.0: cannot open shared object file: No such file or directory
2020-05-26 13:41:11.299336: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcurand.so.10.0'; dlerror: libcurand.so.10.0: cannot open shared object file: No such file or directory
2020-05-26 13:41:11.299413: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcusolver.so.10.0'; dlerror: libcusolver.so.10.0: cannot open shared object file: No such file or directory
2020-05-26 13:41:11.299490: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Could not dlopen library 'libcusparse.so.10.0'; dlerror: libcusparse.so.10.0: cannot open shared object file: No such file or directory

可能是未配置 LD_LIBRARY_PATH

vim ~/.bashrc

打开 .bashrc 并在尾部添加如下代码(cuda版本改为你自己的,这里是9.2)

export LD_LIBRARY_PATH="/usr/local/cuda-9.2/lib64:$LD_LIBRARY_PATH" 

然后使其生效

source ~/.bashrc

3,其他可参考

tensorflow运行使用CPU不使用GPU

附:cudnn安装方法

sudo cp cuda/include/cudnn*.h /usr/local/cuda/include/
sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64/
sudo chmod a+r /usr/local/cuda/include/cudnn*.h
sudo chmod a+r /usr/local/cuda/lib64/libcudnn*

#cd /usr/local/cuda/lib64
#sudo ln -sf libcudnn.so.7.6.3 libcudnn.so.7
#sudo ln -sf libcudnn.so.7 libcudnn.so
#sudo ldconfig

参考:
1 . Ubuntu:安装cudnn10.1
2. Installation Guide :: NVIDIA Deep Learning cuDNN Document

评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值