PaddlePaddle是百度开源的深度学习平台,英文名称为PaddlePaddle,中文名为飞桨。它是基于百度多年的深度学习技术研究和业务应用所开发,集成了深度学习核心框架、基础模型库、端到端开发套件、工具组件和服务平台于一体。
在现有环境中安装paddle
环境中需要提前安装好cuda和cudnn,可以直接用nvidia官方的镜像
1.环境准备
1.1.如何查看您的环境
可以使用以下命令查看本机的操作系统和位数信息:
bash
uname -m && cat /etc/*release
确认需要安装 PaddlePaddle 的 Python 是您预期的位置,因为您计算机可能有多个 Python
根据您的环境您可能需要将说明中所有命令行中的 python3 替换为具体的 Python 路径
bash
which python3
需要确认 python 的版本是否满足要求
使用以下命令确认是 3.8/3.9/3.10/3.11/3.12
bash
python3 --version
需要确认 pip 的版本是否满足要求,要求 pip 版本为 20.2.2 或更高版本
bash
python3 -m ensurepip
bash
python3 -m pip --version
需要确认 Python 和 pip 是 64bit,并且处理器架构是 x86_64(或称作 x64、Intel 64、AMD64)架构。下面的第一行输出的是"64bit",第二行输出的是"x86_64"、"x64"或"AMD64"即可:
bash
python3 -c "import platform;print(platform.architecture()[0]);print(platform.machine())"
2.开始安装
2.1.CPU 版的 PaddlePaddle
bash
python3 -m pip install paddlepaddle==2.6.1 -i https://mirror.baidu.com/pypi/simple
2.2.GPU 版的 PaddlePaddle
2.2.1.CUDA11.2 的 PaddlePaddle
bash
python3 -m pip install paddlepaddle-gpu==2.6.1.post112 -f https://www.paddlepaddle.org.cn/whl/linux/mkl/avx/stable.html
2.2.2.CUDA11.6 的 PaddlePaddle
bash
python3 -m pip install paddlepaddle-gpu==2.6.1.post116 -f https://www.paddlepaddle.org.cn/whl/linux/mkl/avx/stable.html
2.2.3.CUDA11.8 的 PaddlePaddle
bash
python3 -m pip install paddlepaddle-gpu==2.6.1 -i https://mirror.baidu.com/pypi/simple
2.2.4.CUDA12.0 的 PaddlePaddle
bash
python3 -m pip install paddlepaddle-gpu==2.6.1.post120 -f https://www.paddlepaddle.org.cn/whl/linux/mkl/avx/stable.html
3.验证安装
安装完成后您可以使用 python3 进入 python 解释器,输入import paddle ,再输入 paddle.utils.run_check()
如果出现PaddlePaddle is installed successfully!,说明您已成功安装。
python
Python 3.8.19 (default, Mar 20 2024, 19:58:24)
[GCC 11.2.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import paddle
python
>>> paddle.utils.run_check()
Running verify PaddlePaddle program ...
I0524 02:49:29.605748 9796 program_interpreter.cc:212] New Executor is Running.
W0524 02:49:29.607050 9796 gpu_resources.cc:119] Please NOTE: device: 0, GPU Compute Capability: 7.5, Driver API Version: 11.4, Runtime API Version: 11.4
W0524 02:49:29.613905 9796 gpu_resources.cc:164] device: 0, cuDNN Version: 8.2.
I0524 02:49:32.302078 9796 interpreter_util.cc:624] Standalone Executor is Used.
PaddlePaddle works well on 1 GPU.
======================= Modified FLAGS detected =======================
FLAGS(name='FLAGS_selected_gpus', current_value='0', default_value='')
=======================================================================
I0524 02:49:33.759387 9875 tcp_utils.cc:181] The server starts to listen on IP_ANY:57410
I0524 02:49:33.759631 9875 tcp_utils.cc:130] Successfully connected to 127.0.0.1:57410
======================= Modified FLAGS detected =======================
FLAGS(name='FLAGS_selected_gpus', current_value='4', default_value='')
=======================================================================
I0524 02:49:34.278539 9888 tcp_utils.cc:130] Successfully connected to 127.0.0.1:57410
I0524 02:49:34.292114 9888 process_group_nccl.cc:129] ProcessGroupNCCL pg_timeout_ 1800000
W0524 02:49:34.298468 9888 gpu_resources.cc:119] Please NOTE: device: 4, GPU Compute Capability: 7.5, Driver API Version: 11.4, Runtime API Version: 11.4
W0524 02:49:34.305361 9888 gpu_resources.cc:164] device: 4, cuDNN Version: 8.2.
======================= Modified FLAGS detected =======================
FLAGS(name='FLAGS_selected_gpus', current_value='5', default_value='')
=======================================================================
I0524 02:49:34.392978 9897 tcp_utils.cc:130] Successfully connected to 127.0.0.1:57410
I0524 02:49:34.393196 9897 process_group_nccl.cc:129] ProcessGroupNCCL pg_timeout_ 1800000
W0524 02:49:34.405627 9897 gpu_resources.cc:119] Please NOTE: device: 5, GPU Compute Capability: 7.5, Driver API Version: 11.4, Runtime API Version: 11.4
W0524 02:49:34.411123 9897 gpu_resources.cc:164] device: 5, cuDNN Version: 8.2.
======================= Modified FLAGS detected =======================
FLAGS(name='FLAGS_selected_gpus', current_value='2', default_value='')
=======================================================================
I0524 02:49:34.436482 9879 tcp_utils.cc:130] Successfully connected to 127.0.0.1:57410
I0524 02:49:34.473301 9879 process_group_nccl.cc:129] ProcessGroupNCCL pg_timeout_ 1800000
======================= Modified FLAGS detected =======================
FLAGS(name='FLAGS_selected_gpus', current_value='1', default_value='')
=======================================================================
I0524 02:49:34.474831 9877 tcp_utils.cc:130] Successfully connected to 127.0.0.1:57410
I0524 02:49:34.475021 9877 process_group_nccl.cc:129] ProcessGroupNCCL pg_timeout_ 1800000
W0524 02:49:34.481299 9877 gpu_resources.cc:119] Please NOTE: device: 1, GPU Compute Capability: 7.5, Driver API Version: 11.4, Runtime API Version: 11.4
W0524 02:49:34.482425 9879 gpu_resources.cc:119] Please NOTE: device: 2, GPU Compute Capability: 7.5, Driver API Version: 11.4, Runtime API Version: 11.4
W0524 02:49:34.485813 9877 gpu_resources.cc:164] device: 1, cuDNN Version: 8.2.
W0524 02:49:34.490847 9879 gpu_resources.cc:164] device: 2, cuDNN Version: 8.2.
======================= Modified FLAGS detected =======================
FLAGS(name='FLAGS_selected_gpus', current_value='3', default_value='')
=======================================================================
I0524 02:49:34.505313 9885 tcp_utils.cc:130] Successfully connected to 127.0.0.1:57410
======================= Modified FLAGS detected =======================
FLAGS(name='FLAGS_selected_gpus', current_value='7', default_value='')
=======================================================================
I0524 02:49:34.532421 9913 tcp_utils.cc:130] Successfully connected to 127.0.0.1:57410
I0524 02:49:34.575191 9885 process_group_nccl.cc:129] ProcessGroupNCCL pg_timeout_ 1800000
I0524 02:49:34.575328 9913 process_group_nccl.cc:129] ProcessGroupNCCL pg_timeout_ 1800000
W0524 02:49:34.591156 9913 gpu_resources.cc:119] Please NOTE: device: 7, GPU Compute Capability: 7.5, Driver API Version: 11.4, Runtime API Version: 11.4
W0524 02:49:34.594236 9885 gpu_resources.cc:119] Please NOTE: device: 3, GPU Compute Capability: 7.5, Driver API Version: 11.4, Runtime API Version: 11.4
W0524 02:49:34.598922 9913 gpu_resources.cc:164] device: 7, cuDNN Version: 8.2.
W0524 02:49:34.604974 9885 gpu_resources.cc:164] device: 3, cuDNN Version: 8.2.
======================= Modified FLAGS detected =======================
FLAGS(name='FLAGS_selected_gpus', current_value='6', default_value='')
=======================================================================
I0524 02:49:34.614703 9903 tcp_utils.cc:130] Successfully connected to 127.0.0.1:57410
I0524 02:49:34.624086 9903 process_group_nccl.cc:129] ProcessGroupNCCL pg_timeout_ 1800000
I0524 02:49:34.664119 9875 process_group_nccl.cc:129] ProcessGroupNCCL pg_timeout_ 1800000
W0524 02:49:34.665885 9903 gpu_resources.cc:119] Please NOTE: device: 6, GPU Compute Capability: 7.5, Driver API Version: 11.4, Runtime API Version: 11.4
W0524 02:49:34.677251 9903 gpu_resources.cc:164] device: 6, cuDNN Version: 8.2.
W0524 02:49:34.716320 9875 gpu_resources.cc:119] Please NOTE: device: 0, GPU Compute Capability: 7.5, Driver API Version: 11.4, Runtime API Version: 11.4
W0524 02:49:34.727599 9875 gpu_resources.cc:164] device: 0, cuDNN Version: 8.2.
I0524 02:49:40.253692 9879 process_group_nccl.cc:132] ProcessGroupNCCL destruct
I0524 02:49:40.255170 9885 process_group_nccl.cc:132] ProcessGroupNCCL destruct
I0524 02:49:40.280423 9877 process_group_nccl.cc:132] ProcessGroupNCCL destruct
I0524 02:49:40.288800 9913 process_group_nccl.cc:132] ProcessGroupNCCL destruct
I0524 02:49:40.300041 9903 process_group_nccl.cc:132] ProcessGroupNCCL destruct
I0524 02:49:40.301714 9875 process_group_nccl.cc:132] ProcessGroupNCCL destruct
I0524 02:49:40.323594 9888 process_group_nccl.cc:132] ProcessGroupNCCL destruct
I0524 02:49:40.349901 9897 process_group_nccl.cc:132] ProcessGroupNCCL destruct
I0524 02:49:40.728493 9980 tcp_store.cc:289] receive shutdown event and so quit from MasterDaemon run loop
PaddlePaddle works well on 8 GPUs.
PaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.