我的 RTX2070 gpu 有 tensorflow 2.0 workig。我做了一个 Windows 更新,所以我可以使用 tf-nightly。不喜欢它所以卸载它并重新安装tensorflow 2.3.0。运行以前在 GPU 上运行良好的 Python 代码,但它没有使用 GPU。尝试了很多东西。最后才重新开始。重新安装 Anaconda,创建新环境。卸载 Cuda toolkit 10.1 并重新安装。在目录 c:\Tools 中安装了 cuDnn SDK 7.6。检查路径环境变量以包含
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin;
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\extras\CUPTI\lib64;
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include;
C:\tools\cuda\bin;%PATH%
#then ran this code:
import tensorflow as tf
from tensorflow.python.client import device_lib
print(device_lib.list_local_devices())
print(tf.__version__)
print("Num GPUs Available: ", len(tf.config.experimental.list_physical_devices('GPU')))
tf.test.is_gpu_available()
#I get the result
[name: "/device:CPU:0"
device_type: "CPU"
memory_limit: 268435456
locality {
}
incarnation: 15177607927005893519
, name: "/device:XLA_CPU:0" …Run Code Online (Sandbox Code Playgroud)