[機器學習]cudaGetDevice() failed.解決的方法

Denny Chang
2 min readMay 10, 2020

--

在GPU上運行TensorFlow程序時報錯
cudaGetDevice() failed. Status: CUDA driver version is insufficient for CUDA runtime version

這是由於Cuda 驅動跟Cuda運行版本不一致導致。

1. 先來查查Tensorflow-GPU的配置需求

https://tensorflow.google.cn/install/source_windows#gpu

我使用tensorflow 2.0,因此CUDA版本需要10以上(這邊指的是CUDA ToolKit版本,而我也是安裝10以上,因此這邊設置正確)

2. 接著查查顯示卡的驅動版本

https://tensorflow.google.cn/install/source_windows#gpu

對應表中可以得知,想要使用Cuda Toolkit 10,windows的驅動版本就要411.31以上。

我本身是沒事不會更新驅動,一查果然就是版本太舊了,驅動更新上去就沒事了,結案

遇到要到處查,留個紀錄也好

--

--