无法加载动态库“cudnn64_8.dll”;dlerror: cudnn64_8.dll 未找到

Doc*_*pus 6 python tensorflow

使用 tensorflow 2.4.1

当我运行我的程序时,我收到此错误并且无法使用我的gpu.

我在用CUDA 11.0cudnn 8.0

2021-02-07 03:36:18.132005: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudart64_110.dll
WARNING:tensorflow:From D:/PycharmProjects/pythonProject/models/kp?,i.py:5: is_gpu_available (from tensorflow.python.framework.test_util) is deprecated and will be removed in a future version.
Instructions for updating:
Use `tf.config.list_physical_devices('GPU')` instead.
2021-02-07 03:36:19.735127: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2021-02-07 03:36:19.739052: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library nvcuda.dll
2021-02-07 03:36:20.715634: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1720] Found device 0 with properties: 
pciBusID: 0000:01:00.0 name: GeForce GTX 1650 computeCapability: 7.5
coreClock: 1.56GHz coreCount: 16 deviceMemorySize: 4.00GiB deviceMemoryBandwidth: 119.24GiB/s
2021-02-07 03:36:20.716281: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudart64_110.dll
2021-02-07 03:36:20.723519: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cublas64_11.dll
2021-02-07 03:36:20.724040: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cublasLt64_11.dll
2021-02-07 03:36:20.729436: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cufft64_10.dll
2021-02-07 03:36:20.731800: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library curand64_10.dll
2021-02-07 03:36:20.741580: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cusolver64_10.dll
2021-02-07 03:36:20.745576: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cusparse64_11.dll
2021-02-07 03:36:20.746657: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library 'cudnn64_8.dll'; dlerror: cudnn64_8.dll not found
2021-02-07 03:36:20.746971: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1757] 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...
2021-02-07 03:36:20.836861: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1261] Device interconnect StreamExecutor with strength 1 edge matrix:
2021-02-07 03:36:20.837144: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1267]      0 
2021-02-07 03:36:20.837314: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1280] 0:   N 
2021-02-07 03:36:20.837493: I tensorflow/compiler/jit/xla_gpu_device.cc:99] Not creating XLA devices, tf_xla_enable_xla_devices not set
Run Code Online (Sandbox Code Playgroud)

小智 30

我想我可以帮助您提供一个cudnn64_8.dll文件(这是下载链接:https://www.dll-files.com/cudnn64_8.dll.html)。当你得到文件后,你可以把它放在你的bin目录中。例如,通常在windows平台中,您可以将其放入C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3\bin.

  • 我对下载这个 .dll 文件有点怀疑,但它有效 (4认同)

小智 24

丢失的 dll 文件位于 cuDNN 文件夹中。我通过将文件复制cudnn64_8.dll到 CUDA 文件夹(即C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6\bin.

cuDNN 被列为张量流工作的要求,您可以在此处下载。不过,您需要先注册一个开发者帐户。

  • 来自nvidia官方文档:将以下文件复制到CUDA工具包目录中。将 <安装路径>\cuda\bin\cudnn*.dll 复制到 C:\Program Files\NVIDIA GPU Compute Toolkit\CUDA\vx.x\bin。将 <installpath>\cuda\include\cudnn*.h 复制到 C:\Program Files\NVIDIA GPU Compute Toolkit\CUDA\vx.x\include。将 <安装路径>\cuda\lib\x64\cudnn*.lib 复制到 C:\Program Files\NVIDIA GPU Compute Toolkit\CUDA\vx.x\lib\x64。 (4认同)

nip*_*pun 9

观看此视频来解决此问题,
由于 CUDA 文件夹中缺少 Microsoft Visual Studio C++ 可重现文件,因此出现此文件未找到错误。
额外的;
使用PyTorch in conda environment,没有额外的 CUDA 和 Cudnn 安装,因为在输入 后conda install pytorch, conda 将 CUDA 和 cudnn 安装到该 conda 环境中。


Sin*_*ias 5

在遵循 CuDNN 的所有安装说明后,我也遇到了这个问题。问题的根本原因很简单。在安装说明中,它告诉您将添加<root>\NVIDIA\CUDNN\v8.x到您的PATH. 至少对于 Tensorflow 来说,这恰好是错误的。您需要添加<root>\NVIDIA\CUDNN\v8.x\bin到您的PATH. 这应该可以解决问题。它对我有用。

我看到几个答案谈论将cudnn64_8.dll文件移动到C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6\bin. 这样做的原因是,PATH当您安装 CUDA 时,CUDA 会自动将该 bin 目录添加到您的目录中。因此,将 移动到cudnn64_8.dll那里可以有效地将其添加到您的PATH.

我宁愿把东西放在适当的位置,所以我更喜欢这种方式。