当前位置:网站首页>Solve 1. tensorflow runs using CPU but not GPU 2. GPU version number in tensorflow environment 3. Correspondence between tensorflow and cuda and cudnn versions 4. Check cuda and cudnn versions
Solve 1. tensorflow runs using CPU but not GPU 2. GPU version number in tensorflow environment 3. Correspondence between tensorflow and cuda and cudnn versions 4. Check cuda and cudnn versions
2022-08-09 10:45:00 【Fuzzy Pack】
This article mainly addresses the following three questions,After ten minutes to understand,Any similar problem is the same:
- 查看
tensorflow
环境下的GPU
版本号 - 解决
tensorflow
运行使用CPU
不使用GPU
tensorflow
和cuda
以及cudnn
版本对应问题
solutions to these three problems,To solve the problem from the beginning.
并且We assume you will use Anaconda
virtual environment and installationtensorflow-gpu
,也会安装CUDA
和CUDNN
安装Anadonda
安装tensorflow-gpu
安装CUDA和CUDNN
问题一:查看版本
查看CUDA
和CUDNN
版本
# 查看cuda版本
$ nvcc -V
$output ==>
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Sun_Jul_28_19:07:16_PDT_2019
Cuda compilation tools, release 10.1, V10.1.243
# 查看cudnn版本
$ cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2
$output ==>
#define CUDNN_MAJOR 7
#define CUDNN_MINOR 6
#define CUDNN_PATCHLEVEL 5
--
#define CUDNN_VERSION (CUDNN_MAJOR * 1000 + CUDNN_MINOR * 100 + CUDNN_PATCHLEVEL)
'''7.6.5'''
重点来了:查看tensorflow
环境下的GPU
The version number is as follows to view your current environment(The virtual environment may be this environment)
$ ipython
In [1]: import tensorflow as tf
In [2]: gpu_device_name = tf.test.gpu_device_name()
'''output==>'''
.............省略..........................
name: GeForce GTX 1060 6GB major: 6 minor: 1 memoryClockRate(GHz): 1.7085
pciBusID: 0000:27:00.0
问题二:GPU不工作
如果你的tensorflow
不能使用GPU
只能使用CPU
(注解:How to know how to use itcpu,通过NVIDIA-SMI
There is no load on the line)
In fact, this time you will find through the above method,You will find these words under your graphics card:
2019-12-29 12:10:23.761412: 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; LD_LIBRARY_PATH: /usr/local/cuda/lib64:
2019-12-29 12:10:23.761455: 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; LD_LIBRARY_PATH: /usr/local/cuda/lib64:
2019-12-29 12:10:23.761493: 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; LD_LIBRARY_PATH: /usr/local/cuda/lib64:
2019-12-29 12:10:23.761532: 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; LD_LIBRARY_PATH: /usr/local/cuda/lib64:
2019-12-29 12:10:23.761571: 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; LD_LIBRARY_PATH: /usr/local/cuda/lib64:
2019-12-29 12:10:23.761609: 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: /usr/local/cuda/lib64:
2019-12-29 12:10:23.764661: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcudnn.so.7
2019-12-29 12:10:23.764728: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1663] Cannot dlopen some GPU libraries. Skipping registering GPU devices...
All these files are not found,所以才会使用gpu而不是cpu
解决方法
注意:If not foundso.9.0
就更改为so.9.0
,Other versions have been changed.
We can change the soft link as follows:
- libcudart
# cuda是cuda-版本的软链接,下面一样
sudo ln -s /usr/local/cuda/lib64/libcudart.so.10.1 /usr/local/cuda/lib64/libcudart.so.10.0
- libcufft
sudo ln -s /usr/local/cuda/lib64/libcufft.so.10.1.168 /usr/local/cuda/lib64/libcufft.so.10.0
- libcurand
sudo ln -s /usr/local/cuda/lib64/libcurand.so.10.1.168 /usr/local/cuda/lib64/libcurand.so.10.0
- libcusolver
sudo ln -s /usr/local/cuda/lib64/libcusolver.so.10.1.168 /usr/local/cuda/lib64/libcusolver.so.10.0
- libcusparse
sudo ln -s /usr/local/cuda/lib64/libcusparse.so.10.1.168 /usr/local/cuda/lib64/libcusparse.so.10.0
- libcublas
# 这里10.1版本是这样的
sudo ln -s /usr/lib/x86_64-linux-gnu/libcublas.so.10.2.0.168 /usr/local/cuda/lib64/libcublas.so.10.0
注意:这里如果是10.0
版本及以下的,如果/usr/lib/x86_64-linux-gnu/
目录下没有libcublas
库,可以在/usr/local/cuda10.1/targets/x86_64-linux/lib/
查找libcublas
库.
问题三:匹配问题
we pass the question1就发现:如果不匹配,就会出现报错,This error is often the cause of a mismatch,It will also tell you what the version corresponds to.You can solve this problem~
边栏推荐
- The common problems in laptops, continuously updated
- 工作--今天的学习
- 商业技术解决方案与高阶技术专题 - 数据可视化专题
- 深度学习--自编码器(AutoEncoder)
- How to quickly get through the mirror release process?
- Since I use the HiFlow scene connector, I don't have to worry about becoming a "dropper" anymore
- 1005 继续(3n+1)猜想 (25 分)
- 详细的np.matmul / np.dot / np.multiply / tf.matmul / tf.multiply / *
- Unix Environment Programming Chapter 15 15.3 Functions popen and pclose
- 深度学习--神经网络(基础讲解)
猜你喜欢
Electron application development best practices
深度学习--自编码器(AutoEncoder)
深度学习--循环神经网络(Recurrent Neural Network)
华为VRRP+MSTP联动接口检测实验案例
机器学习--线性回归(Linear Regression)
LM小型可编程控制器软件(基于CoDeSys)笔记二十六:plc的数据存储区(模拟量输入通道部分)
多商户商城系统功能拆解26讲-平台端分销设置
arcgis制图之天地图符号样式配置
批量转换经纬度的网页实现方法
PoseNet: A Convolutional Network for Real-Time 6-DOF Camera Relocalization Paper Reading
随机推荐
1005 继续(3n+1)猜想 (25 分)
Cpolar内网穿透的面板功能介绍
一键完成物联网产品注册,快速体验在线调试设备
kubernetes中不可见的OOM
faster-rcnn learn
Netscope:神经网络结构在线可视化工具
xmms的歌词显示及音量控制OK
非科班毕业生,五面阿里:四轮技术面+HR一面已拿offer
MySQL和MyEclipse的数据库连接操作
TELNET协议相关RFC
Create a table in a MySQL database through Doc
2022强网杯WP
Database connection operations for MySQL and MyEclipse
史上最小白之《Word2vec》详解
Since I use the HiFlow scene connector, I don't have to worry about becoming a "dropper" anymore
常用语言图表库总结
在犹豫中度过了老多天,今天的工作时记录
Multi-merchant mall system function disassembly 26 lectures - platform-side distribution settings
一天半的结果——xmms on E2
autogluon安装,使用指南,代码