tensorflow-gpu2.x无法检测到GPU设备
生活随笔
收集整理的這篇文章主要介紹了
tensorflow-gpu2.x无法检测到GPU设备
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
tensorflow-gpu2.x無法檢測到GPU設備
1.檢查
在解決問題前檢查一下tensorflow是否只能檢查到CPU,而無法檢查到GPU,而非無法調用GPU。
import tensorflow as tf print(tf.test.is_gpu_available()) gpus = tf.config.experimental.list_physical_devices(device_type='GPU') cpus = tf.config.experimental.list_physical_devices(device_type='CPU') print(gpus, cpus)#打印結果為 #False #[] [PhysicalDevice(name='/physical_device:CPU:0', device_type='CPU')]2.解決方法
2.1問題一:沒安裝對應的cudnn和cudatoolkit依賴
解決辦法:安裝對應的cudnn和cudatoolkit
這個我就不重述了我博文里面有:https://blog.csdn.net/qq_43203949/article/details/108479784.
注意我的安裝環境是:其中Driver Version: 441.83 NVIDIA-SMI 441.83沒有絕對的要求。
2.2問題二:安裝了對應的依賴卻缺失了關鍵文件(cudnn64_7.dll)
如發生一下問題:(在pycharm的紅色字體報告中可以看到)
Could not load dynamic library 'cudnn64_7.dll'; dlerror: cudnn64_7.dll not found解決辦法:去英偉達那里下載對應的cudnn文件,并將缺失文件拷貝到對應的文件夾中即可。
這個我就不重述了,我這個也寫了一個博文:
https://blog.csdn.net/qq_43203949/article/details/108550960.
總結
以上是生活随笔為你收集整理的tensorflow-gpu2.x无法检测到GPU设备的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 添加或删除jupyter noteboo
- 下一篇: 华为和苹果对决笔记本市场华为笔记本对比苹