Azure VM加载的运行时CuDNN库:8.2.4但源代码是用以下代码编译的:8.6.0

ymdaylpp  于 2023-05-01  发布在  其他
关注(0)|答案(1)|浏览(298)

我尝试在Microsoft Azure Machine Learning Studio GPU机器中的笔记本电脑上安装Keras模型。我收到了一个类似于here所描述的错误:

2023-04-27 09:56:21.098249: E tensorflow/compiler/xla/stream_executor/cuda/cuda_dnn.cc:417] Loaded runtime CuDNN library: 8.2.4 but source was compiled with: 8.6.0.  CuDNN library needs to have matching major version and equal or higher minor version. If using a binary install, upgrade your CuDNN library.  If building from sources, make sure the library loaded at runtime is compatible with the version specified during compile configuration.
2023-04-27 09:56:21.099011: W tensorflow/core/framework/op_kernel.cc:1830] OP_REQUIRES failed at pooling_ops_common.cc:412 : UNIMPLEMENTED: DNN library is not found.
2023-04-27 09:56:21.099050: I tensorflow/core/common_runtime/executor.cc:1197] [/job:localhost/replica:0/task:0/device:GPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): UNIMPLEMENTED: DNN library is not found.
     [[{{node model_2/max_pooling1d_6/MaxPool}}]]
2023-04-27 09:56:21.100704: E tensorflow/compiler/xla/stream_executor/cuda/cuda_dnn.cc:417] Loaded runtime CuDNN library: 8.2.4 but source was compiled with: 8.6.0.  CuDNN library needs to have matching major version and equal or higher minor version. If using a binary install, upgrade your CuDNN library.  If building from sources, make sure the library loaded at runtime is compatible with the version specified during compile configuration.
2023-04-27 09:56:21.101366: W tensorflow/core/framework/op_kernel.cc:1830] OP_REQUIRES failed at pooling_ops_common.cc:412 : UNIMPLEMENTED: DNN library is not found.

Azures机器的解决方案是什么?

vbkedwbf

vbkedwbf1#

您遇到的错误是由于运行时使用的CuDNN库版本(8.2.4)和您的TensorFlow编译时使用的版本(8.要解决此问题,您需要升级CuDNN库以匹配主版本,并具有与编译TensorFlow时使用的版本相同或更高的次版本。
以下是在Microsoft Azure Machine Learning Studio GPU计算机上升级CuDNN库的步骤:
在Unix机器上:
访问:how do I update cuDNN to a newer version?
访问:https://docs.nvidia.com/deeplearning/cudnn/install-guide/index.html

1- First, download the appropriate CuDNN library version (8.6.0 or higher) from NVIDIA's website: https://developer.nvidia.com/cudnn

2- Extract the downloaded archive to a directory of your choice. The extracted directory should contain files

像这样的扩展。h,.so,and。cubin。
3-在Azure Machine Learning Studio GPU计算机上找到现有的CuDNN库。您可以使用以下命令查找已安装的CuDNN库的路径:

sudo find / -name libcudnn.so*

此命令将返回已安装的CuDNN库文件的路径。请注意包含这些文件的目录。
4-备份现有的CuDNN库文件:

sudo mv /path/to/old/cudnn/libcudnn.so /path/to/old/cudnn/libcudnn.so.backup

sudo mv /path/to/old/cudnn/libcudnn.so.8 /path/to/old/cudnn/libcudnn.so.8.backup

sudo mv /path/to/old/cudnn/libcudnn.so.8.2.4 /path/to/old/cudnn/libcudnn.so.8.2.4.backup

将/path/to/old/cudnn/替换为您在步骤3中找到的目录。
5-将新CuDNN库文件复制到相应的目录:

sudo cp /path/to/new/cudnn/include/cudnn*.h /usr/local/cuda/include/

sudo cp /path/to/new/cudnn/lib64/libcudnn* /usr/local/cuda/lib64/

将/path/to/new/cudnn/替换为您在步骤2中解压缩下载的CuDNN归档文件的目录。
6-更新库缓存:
sudo ldconfig
7-在Azure Machine Learning Studio中重新启动你的笔记本,CuDNN库不匹配问题应该会得到解决。
对于Windows Machine:
访问:https://medium.com/geekculture/install-cuda-and-cudnn-on-windows-linux-52d1501a8805
1-下载相应的CuDNN版本(8.6.0或更高版本)从NVIDIA网站下载:https://developer.nvidia.com/cudnn
2-将下载的存档解压缩到您选择的目录中。解压缩的目录应包含扩展名为。h、.dll和。库。
3-将CuDNN库文件复制到相应的目录:

copy cudnn*.dll "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2\bin"

copy cudnn*.h "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2\include"

copy cudnn*.lib "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2\lib\x64"

更换v11。2在目录路径中与您在计算机上安装的CUDA版本相对应。
4-将CuDNN bin目录路径添加到PATH环境变量:
setx PATH“%PATH%;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11。2\bin”

Replace v11.2 in the directory path with the version of CUDA you have installed on your machine.

5- Add CuDNN to your Visual Studio project:
    Open the Visual Studio project, right-click on the project name in Solution Explorer, and choose Properties.
    Click VC++ Directories and append C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2\include to the Include Directories field.
    Click Linker > General and append C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2\lib\x64 to the Additional Library Directories field.
    Click Linker > Input and append cudnn.lib to the Additional Dependencies field and click OK.

就是这样!通过这些步骤,您应该能够在Windows机器上安装CuDNN库并将其用于您的项目。

相关问题