tensorflow.python.framework.errors_impl.InternalError: cudaGetDevice() failed. Status: CUDA driver version is insufficient for CUDA runtime version


安裝TensorFlow 2.0.0以后,運行出現了下面的錯誤:

tensorflow.python.framework.errors_impl.InternalError: cudaGetDevice() failed. Status: CUDA driver version is insufficient for CUDA runtime version

這是由於CUDA驅動版本不滿足CUDA運行版本造成的,之前為了安裝TensorFlow 2.0.0,升級了CUDA運行版本到CUDA 10.0,但是CUDA驅動版本並沒有升級,從而造成了這個錯誤.CUDA驅動版本和CUDA運行版本應該滿足下面這張表的要求(https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html):

運行nvidia-smi后,發現CUDA驅動版本是385.13,而我在安裝的cuda版本是9.0,不滿足上面的要求.

 

先用下面的方法解決一下,看行不行:

https://blog.csdn.net/qq_38163755/article/details/88583016

原因在於conda自動安裝時,CUDA toolkit安裝的是9.2,但是9.2對應的驅動為不小於396,因此就出錯了。
解決方法為在那個環境下卸載CUDA與cudnn,然后安裝合適的版本。
卸載:

conda uninstall cudnn
conda uninstall cudatoolkit

安裝

conda install cudatoolkit=9.0
conda install cudnn

出錯信息暫時消失了。


版本根據需求自定義,下面有版本對應關系。
然后重新用conda install安裝tensorflow-gpu即可。
CUDA各版本與驅動的對應關系可點擊鏈接:https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html

tensorflow-gpu與CUDA和cudnn的對應關系可查看:https://tensorflow.google.cn/install/source

————————————————
版權聲明:本文為CSDN博主「強殖裝甲凱普」的原創文章,遵循CC 4.0 BY-SA版權協議,轉載請附上原文出處鏈接及本聲明。
原文鏈接:https://blog.csdn.net/qq_38163755/article/details/88583016

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM