【DeepLearning】TensorFlow使用GPU

问题:tensorflow安装后,没有识别到GPU,只能用CPU运行计算。

解决步骤:

1、安装cuda https://developer.nvidia.com/cuda-toolkit-archive

2、安装cuda对应的cuDNN,下载需要NVIDIA账号 cuDNN Archive | NVIDIA Developer

3、试试能不能识别到GPU

>>> import tensorflow as tf
>>> hello =tf.constant('hello, tensorflow')
2022-08-17 10:19: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2022-08-17 10:19: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1532] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 2780 MB memory:  -> device: 0, name: NVIDIA GeForce GTX 1050, pci bus id: 0000:01:00.0, compute capability: 6.1

如果报错“Could not load library cudnn_cnn_infer64_8.dll. Error code 126 Please make sure cudnn_cnn_infer64_8.”

前往这里如下所示位置下载一个zlib包,解压缩后找到zlibwapi.dll文件,剪切到C:\Windows\System32位置下面

 

参考链接:

GTX1050+cuda9.0+cuDNN+pytorch+anaconda环境搭建_颖火虫盟主的博客-优快云博客_gtx1050支持cuda吗Could not load library cudnn_cnn_infer64_8.dll. Error code 126 Please make sure cudnn_cnn_infer64_8._illumiD的博客-优快云博客

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值