python - Python3 找不到 CUDA dll 文件
问题描述
我遇到一个问题,当我尝试将 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
来运行我的程序。我已经尝试了各种各样的东西,但无法弄清楚我错过了什么。任何帮助,将不胜感激。
编辑:当我使用或通过 Jupyter 笔记本运行它时,它似乎工作正常。$ python main.py
这似乎$ python3 main.py
是唯一不起作用的情况。
解决方案
这是适用于 Tensorflow-gpu 版本的 CUDA 版本列表。
https://www.tensorflow.org/install/source#linux
检查安装和下载该版本。
推荐阅读
- php - 对象包含太多列
- javascript - 如何制作将文本添加到 div 的可点击按钮
- vespa - 按“vespa.ai”中的日期属性对结果集进行排序
- c++ - 如何实现 WTSRegisterSessionNotification 功能
- jquery - 有没有办法在浏览器中使用 require 函数而不使用 Browserify、RequireJs 或类似的包
- python - 是否可以检查列表中的项目是否存在于变量中?
- android - AsyncTask 未在 oncreate 中执行
- visual-studio - TFS 脱机,联机显示许多文件的方式已更改
- scala - Spark-Scala 代码在 Spark-Shell 中运行完成,但通过 Spark-Submit 无限运行
- regex - 同一个 perl 命名正则表达式提取的多个名称