当前位置:网站首页>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~
边栏推荐
- VBA实战(11) - 工作表(Sheet) 操作汇总
- AQS同步组件-ForkJoin、BlockingQueue阻塞队列解析和用例
- 可能95%的人还在犯的PyTorch错误
- Transformer+Embedding+Self-Attention原理详解
- Probably 95% of the people are still making PyTorch mistakes
- 深度学习--生成对抗网络(Generative Adversarial Nets)
- xmms的均衡器试验成功 音效相当不错 比rockbox可能还要好
- 2022强网杯WP
- Oracle数据库常用函数总结
- Create a table in a MySQL database through Doc
猜你喜欢
自从我使用HiFlow场景连接器后,在也不用担心成为“落汤鸡”了
对话跨国消费品牌DPO:数据安全合规从何做起?8.11直播见!
PoseNet: A Convolutional Network for Real-Time 6-DOF Camera Relocalization论文阅读
【原创】JPA中@PrePersist和@PreUpdate的用法
深度学习--自编码器(AutoEncoder)
多商户商城系统功能拆解26讲-平台端分销设置
The common problems in laptops, continuously updated
Cpolar内网穿透的面板功能介绍
How tall is the B+ tree of the MySQL index?
今天做了手机播放器的均衡器
随机推荐
一天半的结果——xmms on E2
The torch. The stack () official explanation, explanation and example
深度学习--自编码器(AutoEncoder)
如何在gazebo进行 joint的转动控制
上传张最近做的E2用的xmms的界面的截图
caffe ---make all编辑出错
Probably 95% of the people are still making PyTorch mistakes
深度学习--生成对抗网络(Generative Adversarial Nets)
【 original 】 VMware Workstation implementation Openwrt soft routing, the ESXI, content is very detailed!
Since I use the HiFlow scene connector, I don't have to worry about becoming a "dropper" anymore
百度云大文件网页直接下载
unix环境编程 第十五章 15.10 POSIX信号量
研发需求的验收标准应该怎么写? | 敏捷实践
TELNET协议相关RFC
Unix System Programming Chapter 15 15.2 Pipes
pip common commands and changing source files
OpenGL ES2.0编程三部曲(转载自MyArrow)
unix环境编程 第十五章 15.8信号量
想了解API接口,这一篇就够了
数据存储:对dataframe类,使用to_csv()将中文数据写入csv文件