【发布时间】:2021-09-04 21:10:17
【问题描述】:
我遇到一个问题,当我尝试将 tensorflow 与我的 gpu 一起使用时,它说找不到。这是我正在运行的代码,以查看我有多少 GPU 可用
import tensorflow as tf
import tensorflow_datasets as tfds
print("Num GPUs Available: ", len(tf.config.list_physical_devices('GPU')))
我在运行$ python3 main.py 时收到的消息如下:
2021-09-04 16:52:04.477828: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found
2021-09-04 16:52:04.477963: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
2021-09-04 16:52:07.179742: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found
...
2021-09-04 16:52:07.182033: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1835] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.
Skipping registering GPU devices...
Num GPUs Available: 0
运行$ nvcc -V 给了我
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Wed_Jul_14_19:47:52_Pacific_Daylight_Time_2021
Cuda compilation tools, release 11.4, V11.4.100
Build cuda_11.4.r11.4/compiler.30188945_0
我已按照 tensorflow 网站和 nvidia 网站上的说明进行操作。我的路径包含CUDA_PATH 和CUDA_PATH_V11_4 都指向C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4。错误消息说找不到的cudart64_110.dll 文件在C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4\bin 中。
我想知道为什么我不能使用python3 来运行我的程序。我已经尝试了各种各样的东西,但无法弄清楚我错过了什么。任何帮助将不胜感激。
编辑:当我使用$ python main.py 或通过 Jupyter 笔记本运行它时,它似乎工作正常。看来$ python3 main.py 是唯一不起作用的情况。
【问题讨论】:
-
您拥有的 tensorflow 版本无疑需要与 CUDA 11.4 不同版本的 CUDA 运行时库
-
能告诉我们 TensorFlow 的版本吗?
标签: python python-3.x tensorflow