当前位置:网站首页>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 Anacondavirtual 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环境下的GPUThe 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-SMIThere 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~
边栏推荐
- 985毕业,工作3年,分享从阿里辞职到了国企的一路辛酸和经验
- unix环境编程 第十五章 15.7消息队列
- 情感分析SowNLP词库
- 【原创】VMware Workstation实现Openwrt软路由功能,非ESXI,内容非常详细!
- 解决1.tensorflow运行使用CPU不使用GPU 2.tensorflow环境下的GPU版本号 3.tensorflow和cuda以及cudnn版本对应问题 4.查看cuda和cudnn版本
- 乘积量化(PQ)
- pip常见命令和更改源文件
- For versions corresponding to tensorflow and numpy, report FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecate
- 深度学习--循环神经网络(Recurrent Neural Network)
- 中断系统结构及中断控制
猜你喜欢

OpenSSF的开源软件风险评估工具:Scorecards

研发需求的验收标准应该怎么写? | 敏捷实践

商业技术解决方案与高阶技术专题 - 数据可视化专题

2022年台湾省矢量数据(点线面)及数字高程数据下载

Shell script combat (2nd edition) / People's Posts and Telecommunications Press Script 1 Find programs in the PATH

shell脚本实战(第2版)/人民邮电出版社 脚本2 验证输入:仅限字母和数字

深度学习--神经网络(基础讲解)

对话跨国消费品牌DPO:数据安全合规从何做起?8.11直播见!

ESIM(Enhanced Sequential Inference Model)- 模型详解

985毕业,工作3年,分享从阿里辞职到了国企的一路辛酸和经验
随机推荐
1001 害死人不偿命的(3n+1)猜想 (15 分)
pip common commands and changing source files
基于STM32设计的环境检测设备
笔记本电脑使用常见问题,持续更新
numpy库中的函数 bincount() where() diag() all()
unix环境编程 第十五章 15.9 共享存储
Unix Environment Programming Chapter 14 14.4 I/O Multiplexing
Cluster understanding
Official explanation, detailed explanation and example of torch.cat() function
torch.cat()函数的官方解释,详解以及例子
真香!肝完Alibaba这份面试通关宝典,我成功拿下今年第15个Offer
Oracle数据库常用函数总结
snmp++编译错误问题解决方法
985毕业,工作3年,分享从阿里辞职到了国企的一路辛酸和经验
数据存储:对dataframe类,使用to_csv()将中文数据写入csv文件
实测办公场景下,国产远程控制软件的表现力如何?(技术解析)
activemq message persistence
stimulus.js 初体验
力扣(LeetCode)220. 存在重复元素 III(2022.08.08)
一键完成物联网产品注册,快速体验在线调试设备