安装飞桨paddle
paddle官网提供了相应系统的安装流程。
我的环境是Ubuntu 18.04 + Python 3.6 + GTX 970X,切记paddle暂没编译Python 3.8+版本,现只支持3.5.1+/3.6/3.7。
安装显卡驱动
1# 查看适合显卡的驱动信息,安装带recommended的版本
2➜ ~ ubuntu-drivers devices
3== /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 ==
4modalias : pci:v000010DEd000013D8sv00001558sd00006555bc03sc02i00
5vendor : NVIDIA Corporation
6model : GM204M [GeForce GTX 970M]
7driver : nvidia-driver-410 - third-party free
8driver : nvidia-driver-440 - third-party free recommended
9driver : nvidia-driver-435 - distro non-free
10driver : nvidia-driver-390 - distro non-free
11driver : nvidia-driver-415 - third-party free
12driver : xserver-xorg-video-nouveau - distro free builtin
13# 安装驱动
14➜ ~ sudo apt-get purge nvida*
15➜ ~ sudo add-apt-repository ppa:graphics-drivers/ppa -y
16➜ ~ sudo apt-get update&& sudo apt-get install nvidia-driver-440
17# 重启电脑
18➜ ~ sudo reboot
19# 验证,查看驱动信息
20➜ ~ nvidia-smi
21Sat Aug 15 23:47:23 2020
22+-----------------------------------------------------------------------------+
23| NVIDIA-SMI 440.82 Driver Version: 440.82 CUDA Version: 10.2 |
24|-------------------------------+----------------------+----------------------+
25| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
26| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
27|===============================+======================+======================|
28| 0 GeForce GTX 970M Off | 00000000:01:00.0 Off | N/A |
29| N/A 54C P0 19W / N/A | 487MiB / 3024MiB | 0% Default |
30+-------------------------------+----------------------+----------------------+
31
32+-----------------------------------------------------------------------------+
33| Processes: GPU Memory |
34| GPU PID Type Process name Usage |
35|=============================================================================|
36| 0 2681 G /usr/lib/xorg/Xorg 173MiB |
37| 0 2873 G /usr/bin/gnome-shell 128MiB |
38| 0 6132 G ...AAAAAAAAAAAACAAAAAAAAAA= --shared-files 181MiB |
39+-----------------------------------------------------------------------------+
安装cuda
cuda是intel推出的给予新的并行编程模型和指令集架构的通用计算架构,能利用GPU的并行计算引擎。安装时,需要版本与GPU Driver版本一致,因此需要参考cuda官方https://developer.nvidia.com/cuda-downloads
。
安装cuDNN
登录https://developer.nvidia.com/rdp/cudnn-download
下载cuDNN安装包,下载包时需要根据自己的系统进行选择。
下载完毕后,依次安装
libcudnn7_7.6.5.32-1+cuda10.2_amd64.deb
、
libcudnn7-dev_7.6.5.32-1+cuda10.2_amd64.deb
和
libcudnn7-doc_7.6.5.32-1+cuda10.2_amd64.deb
。
安装Paddle
1➜ ~ sudo pip3 install scikit-build
2➜ ~ sudo pip3 install camke
3➜ ~ sudo python3 -m pip install paddlepaddle-gpu==1.8.3.post107 -i https://mirror.baidu.com/pypi/simple
4# 验证
5➜ ~ python3
6>>> import paddle.fluid
7>>> paddle.fluid.install_check.run_check()
8Running Verify Fluid Program ...
9W0815 22:57:50.517565 25313 device_context.cc:252] Please NOTE: device: 0, CUDA Capability: 52, Driver API Version: 10.2, Runtime API Version: 10.0
10W0815 22:57:50.603076 25313 device_context.cc:260] device: 0, cuDNN Version: 7.6.
11Your Paddle Fluid works well on SINGLE GPU or CPU.
12Your Paddle Fluid works well on MUTIPLE GPU or CPU.
13Your Paddle Fluid is installed successfully! Let's start deep Learning with Paddle Fluid now14
参考
https://mp.weixin.qq.com/s/-05xJNGxDMMt9pVI-fVYhA
https://aistudio.baidu.com/aistudio/education/group/info/1297