由于华为云GPU服务器自带的显卡驱动版本比较低,不适配当前新版的PaddlePaddle版本,所以先进行显卡驱动的升级。
nvidia-smi
cat /usr/local/cuda/version.txt
yum remove nvidia-*
rpm -qa|grep -i nvid|sort
yum remove kmod-nvidia-*
sudo reboot
sh NVIDIA-Linux-x86_64-440.118.02.run
Anaconda是1个常用的python包管理程序,里面可以设置好多个python环境。
wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-2021.05-Linux-x86_64.sh --no-check-certificate
sh Anaconda3-2021.05-Linux-x86_64.sh
然后提示你是否同意,输入yes
安装过程中会询问你安装的位置,一般不用更改,输入回车就行,它会自动解压缩
最后会提示是否初始化Anaconda的一些配置,记得输入yes
vim ~/.bashrc #编辑环境配置文件
export PATH="~/anaconda3/bin:$PATH" # 在第一行加入这个
vim 输入 i 可以编辑,编辑好了之后按 Esc, 然后输入 :wq 保存修改
source ~/.bash_profile
最后验证一下是否配置成功,没有保存的话就是配置成功了!
conda create --name paddle_env python=3.8 --channel https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda activate paddle_env
因为经常需要从paddle仓库中下载代码,需要用到git,这里需要先把git环境安装好。
进入到要下载的目录
cd /usr/local
用wegt命令进行下载
wget https://www.kernel.org/pub/software/scm/git/git-2.19.2.tar.gz
在已下载的目录解压到/usr/local目录下
tar -xzvf git-2.19.2.tar.gz -C /usr/local
进入解压后的git目录
cd /usr/local/git-2.19.2
执行make configure
make configure
注意:执行此命令时,开始出错,错误如下:
错误信息1:
configure: Setting lib to ‘lib’ (the default)
configure: Will try -pthread then -lpthread to enable POSIX Threads.
configure: CHECKS for site configuration
checking for gcc… no
checking for cc… no
checking for cl.exe… no
configure: error: in/opt/git-2.19.0': configure: error: no acceptable C compiler found in $PATH See
config.log’ for more details
解决办法:通过yum providers gcc 和 yum providers cc 查询到c编译器没有安装,可通过执行yum -y install gcc安装gcc包及对> 应的依赖。错误信息2:
GIT_VERSION = 2.19.2
GEN configure
bin/sh:autoconf:未找到命令
make:***[configure]错误127
解决办法:通过yum providers autoconf 查询到没有安装autoconf,可通过执行yum -y install autoconf安装包及对应的依赖。
配置目录
./configure --prefix=/usr/local/git
执行 make profix=/usr/local/git等待编译完成
make profix=/usr/local/git
注意:执行此命令时,开始出错,错误如下:
错误信息1:
* new build flags
CC credential-store.o
In file included from credential-store.c:1:0:
cache.h:20:18: fatal error: zlib.h: No such file or directory
#include
compilation terminated.
make: *** [credential-store.o] Error 1
解决办法:缺少zlib库,通过sudo yum install zlib-devel安装包及对应的依赖。
执行make install进行安装
make install
echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/profile
source /etc/profile //使修改的文件生效
git --version
如果显示:git version 2.19.2 则证明安装成功!
PaddlePaddle 是百度开源的深度学习框架
PaddlePaddle官网:https://www.paddlepaddle.org.cn
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes
conda install paddlepaddle-gpu==2.3.0 cudatoolkit=10.2 --channel https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/Paddle/