paddle2.0简要安装过程

导读

paddle的坑实在是太多了,得好好整理一下。

基本库

在这里说明一下,我需要安装的是paddle-gpu 2.0 2.0 2.0版本,jupytercuda 10.0 10.0 10.0版本。

推荐各位最好使用Ubuntu-18.04安装,因为paddle本身的特点,其代码依赖与更新速度都相当保守。当然也有可能是开源框架的缘故,作为一个商业公司也不可能花这么多的人力财力维护一个不会生成收益的框架。而一旦使用最新的系统架构,那必然将导致代码架构的不兼容,并引发一系列的问题。如果解决了小的问题发现了不可能解决的系统兼容问题,那时就得完全推倒重新开始。虽然知识巩固了一遍,但是无效时间增加了,得不偿失。

好了,说回正题。我们先安装基本的代码库:

apt-get update && apt-get upgrade -y && apt-get install vim gcc g++ -y

我们现在还没有CUDA,这个可以先暂时放着不管。即使没有也是能够安装的。但也还是说明一下,由于我个人需要同时兼容 1.8.5 1.8.5 1.8.5 2.0 2.0 2.0两个版本的paddle,所以我只能选择CUDA 10.0 10.0 10.0版本。

首先安装强化学习框架和飞桨的GPU版本:

pip install gym==0.21.0 && python -m pip install paddlepaddle-gpu==2.0.2.post100 -f https://paddlepaddle.org.cn/whl/mkl/stable.htm

飞桨是有官网说明的,点击此处跳转。官网也说明了使用Ubuntu 18.04 18.04 18.04版本安装,很大程度上其实是因为Ubuntu 20.04 20.04 20.04版本更新了gccg++库, 18.04 18.04 18.04默认最高 7.5 7.5 7.5,而 20.04 20.04 20.04默认 9.0 9.0 9.0 22.04 22.04 22.04默认 11.2 11.2 11.2,故Ubuntu 18.04 18.04 18.04以上版本使得基于较早版本的飞桨不再兼容。

而选择gym 0.21.0 0.21.0 0.21.0版本也是因为新版本的gym的部分库有所更新。这倒是无所谓,各位看着自己手上的代码是多少版本的就下载什么版本,与paddle关系不大。

cuda

然后就是下载cuda。这个不得不提一嘴,这个官网实在是慢得磨人心智。由于CSDN只能上传1GB内容,所以也没办法了。各位各显神通吧。

下载好了之后,就可以执行了:

./cuda_10.0.130_410.48_linux.run

然后就会报错:

Can’t locate Tie/File.pm in @INC (you may need to install the Tie::File module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.26.1 /usr/local/share/perl/5.26.1 /usr/lib/x86_64-linux-gnu/perl5/5.26 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.26 /usr/share/perl/5.26 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at ./cuda-installer.pl line 5.

BEGIN failed–compilation aborted at ./cuda-installer.pl line 5.

这个错误直接上网搜是没有结果的,所以只能推理:

Tie:File module是存在于perl库中的一个文件,所以直接下载就好了:

apt-get install perl -y

然后就出现了安装界面。首先是大片大片的法律条文,按回车慢慢看,按空格快速掠过。

如果已经正确安装了nvidia驱动,那么接下来的选项最好是:

Do you accept the previously read EULA?
accept

Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 410.48?
n

Install the CUDA 10.0 Toolkit?
y

Enter Toolkit Location
直接回车,默认就行

Do you want to install a symbolic link at /usr/local/cuda?
y

Install the CUDA 10.0 Samples?
y

Enter CUDA Samples Location
直接回车选择默认的/root,我这里选择的是/usr/local/cuda-10.0/samples

最后,就会给出这些东西:

===========
= Summary =
===========

Driver:   Not Selected
Toolkit:  Installed in /usr/local/cuda-10.0
Samples:  Installed in /usr/local/cuda-10.0/samples

Please make sure that
 -   PATH includes /usr/local/cuda-10.0/bin
 -   LD_LIBRARY_PATH includes /usr/local/cuda-10.0/lib64
 -      or, add /usr/local/cuda-10.0/lib64 to /etc/ld.so.conf and run ldconfig as root

To uninstall the CUDA Toolkit, run the uninstall script in /usr/local/cuda-10.0/bin

Please see CUDA_Installation_Guide_Linux.pdf in /usr/local/cuda-10.0/doc/pdf for detailed information on setting up CUDA.

***WARNING: Incomplete installation!
This installation did not install the CUDA Driver.
A driver of version at least 384.00 is required for CUDA 10.0 functionality to work.
To install the driver using this installer, run the following command,
  replacing <CudaInstaller> with the name of this run file:
    sudo <CudaInstaller>.run -silent -driver

Logfile is /tmp/cuda_install_12857.log

这个时候我们尝试一下:nvcc -V

啥都没发生,甚至还报错:没这东西。不过仔细一看,东西都在,甚至软连接也整好了。那我们试试:

/usr/local/cuda/bin/nvcc -V

结果输出了这些:

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2018 NVIDIA Corporation
Built on Sat_Aug_25_21:08:01_CDT_2018
Cuda compilation tools, release 10.0, V10.0.130

那不就是说成功了嘛。

配个环境:

# 1. 在/etc/profile.d/文件夹下新建cuda的配置文件
vim /etc/profile.d/cuda.sh

# 2. 配置
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-10.0/lib64
export PATH=$PATH:/usr/local/cuda-10.0/bin
export CUDA_HOME=$CUDA_HOME:/usr/local/cuda-10.0

# 3. 生效
source /etc/profile

# 4. 查看结果
nvcc -V

完成。

其他库

要安装jupyter的话,那就得看我的上一篇文章了:jupyter和pyzmq之间的一些个奇葩坑

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

ordinary_brony

代码滞销,救救码农

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值