在研究PaddlePaddle GPU版本安装的过程中,在解释器中运行
>>> import paddle
>>> paddle.utils.run_check()
出现了错误,表明CUDA、CUDNN未安装成功,下面则是介绍如何安装CUDA、CUDNN
Running verify PaddlePaddle program ...
W1126 15:44:35.675730 540 device_context.cc:447] Please NOTE: device: 0, GPU Compute Capability: 6.1, Driver API Version: 11.0, Runtime API Version: 10.2
W1126 15:44:35.676738 540 dynamic_loader.cc:258] Note: [Recommend] copy cudnn into CUDA installation directory.
For instance, download cudnn-10.0-windows10-x64-v7.6.5.32.zip from NVIDIA's official website,
then, unzip it and copy it into C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0
You should do this according to your CUDA installation directory and CUDNN version.
Traceback (most recent call last):
File "" , line 1, in <module>
File "C:\ProgramData\Miniconda3\lib\site-packages\paddle\utils\install_check.py", line 196, in run_check
_run_static_single(use_cuda)
File "C:\ProgramData\Miniconda3\lib\site-packages\paddle\utils\install_check.py", line 124, in _run_static_single
exe.run(startup_prog)
File "C:\ProgramData\Miniconda3\lib\site-packages\paddle\fluid\executor.py", line 1246, in run
six.reraise(*sys.exc_info())
File "C:\ProgramData\Miniconda3\lib\site-packages\six.py", line 703, in reraise
raise value
File "C:\ProgramData\Miniconda3\lib\site-packages\paddle\fluid\executor.py", line 1234, in run
return self._run_impl(
File "C:\ProgramData\Miniconda3\lib\site-packages\paddle\fluid\executor.py", line 1366, in _run_impl
return self._run_program(
File "C:\ProgramData\Miniconda3\lib\site-packages\paddle\fluid\executor.py", line 1463, in _run_program
self._default_executor.run(program.desc, scope, 0, True, True,
RuntimeError: (PreconditionNotMet) The third-party dynamic library (cudnn64_7.dll) that Paddle depends on is not configured correctly. (error code is 126)
Suggestions:
1. Check if the third-party dynamic library (e.g. CUDA, CUDNN) is installed correctly and its version is matched with paddlepaddle you installed.
2. Configure third-party dynamic library environment variables as follows:
- Linux: set LD_LIBRARY_PATH by `export LD_LIBRARY_PATH=...`
- Windows: set PATH by `set PATH=XXX; (at ..\paddle\fluid\platform\dynload\dynamic_loader.cc:285)
连接 https://developer.nvidia.com/cuda-downloads
链接 https://developer.nvidia.com/cuda-toolkit-archive
我的电脑安装的是10.2版本的,
具体安装哪个版本要看你的显卡型号,可在设备管理器中查看
可以在NVIDIA的控制面板中查看CUDA最大安装版本
下载截图如下:
下载后一路安装即可。
在终端中输入nvcc --version
查看CUDA版本,如下,则证明安装成功
cudnn安装需要会员,会员比较好注册,需要一个邮箱,其他自行填写就可。
登陆后,进入下载页 https://developer.nvidia.com/rdp/cudnn-download
这个需要看PaddlePaddle 的官网,需要你安装哪个版本,如果版本错了,那么后面会报错,我就是在这个地方卡住,而且不知道为什么会出错,原来是没有按照文档安装相应的版本。
PaddlePaddle 的官网版本的链接:https://www.paddlepaddle.org.cn/install/quick?docurl=/documentation/docs/zh/install/pip/windows-pip.html
此处标记了安装哪个版本的要求
我的CUDA是10.2的,那么需要安装cuDNN7。那么找到cuDNN7
下载cuDNN这是个压缩包,解压后,复制所有文件,到CUDA的安装目录下,bin目录下的文件复制到CUDA的bin,lib到lib,include到include
我的CUDA的安装目录是CUDA的默认目录:
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2
在您的Python解释器中,输入
>>> import paddle
>>> paddle.utils.run_check()
如果结果如下,那么则安装成功了:
Running verify PaddlePaddle program ...
W1126 16:33:38.690778 3240 device_context.cc:447] Please NOTE: device: 0, GPU Compute Capability: 6.1, Driver API Version: 11.0, Runtime API Version: 10.2
W1126 16:33:38.747905 3240 device_context.cc:465] device: 0, cuDNN Version: 7.6.
PaddlePaddle works well on 1 GPU.
PaddlePaddle works well on 1 GPUs.
PaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.