CANN训练营第三季_昇腾CANN算子精讲课_TBE算子Sinh开发笔记_环境搭建(一)
一、环境配置
华为云服务器:AI加速型 | ai1s.large.4 | 2vCPUs | 8GiB | 1 * HUAWEI Ascend 310/1 * 8G
操作系统:Ubuntu 18.04
CANN版本:6.0.RC1.alpha001
MINDSTUDIO版本:5.0.RC3
Python版本:3.7.5
二、购买弹性云服务器
三、为服务器配置个人账户HwHiAiUser(可选)
1)添加用户组和用户
groupadd HwHiAiUser
useradd -g HwHiAiUser -d /home/HwHiAiUser -m HwHiAiUser -s /bin/bash
2)增加个人账户下代码补全功能
grep 用户名 /etc/passwd
vi /etc/passwd
HwHiAiUser:x:1000:1000::/home/HwHiAiUser:/bin/bash
3)更新个人账户密码
passwd HwHiAiUser
四、卸载服务器自带的CANN版本并安装6.0RC1.alpha001版本
1)查看服务器自带的CANN版本
cd /usr/local/Ascend/ascend-toolkit/latest/x86_64-linux/
cat version.info
2)卸载旧的CANN版本
脚本卸载:进入toolkit软件的卸载脚本所在路径(nnrt目录结构同toolkit)
cd <path>/ascend-toolkit/<version>/{arch}-linux/script
./uninstall.sh
3)找到并下载自己需要的版本,我的是Ascend-cann-toolkit_6.0.0.alpha001_linux-x86_64.run
apt install lrzsz
rz Ascend-cann-toolkit_6.0.0.alpha001_linux-x86_64.run
chmod 777 Ascend-cann-toolkit_6.0.0.alpha001_linux-x86_64.run
./Ascend-cann-toolkit_6.0.0.alpha001_linux-aarch64.run --check
./Ascend-cann-toolkit_6.0.0.alpha001_linux-aarch64.run –install
4)再次运行1)中命令,查看当前版本是否为6.0.0.alpha001。
五、安装MINDSTUDIO(我选择的是root用户下,也可以选择HwHiAiUser或自己的账户)
1)登录到root用户并更新
apt-get update
2)检查root用户的umask值是否是0022
umask
3)umask如果不是0022(可选)
在任意目录下执行如下命令,打开.bashrc文件:
vi ~/.bashrc
在文件最后一行后面添加umask 0022内容。
执行:wq!
命令保存文件并退出。
执行source ~/.bashrc
命令使其立即生效。
4)安装依赖并检查是否安装Pthon,gcc等依赖软件。
gcc --version
g++ --version
make --version
cmake --version
dpkg -l zlib1g-dev| grep zlib1g-dev| grep ii
dpkg -l libbz2-dev| grep libbz2-dev| grep ii
dpkg -l libsqlite3-dev| grep libsqlite3-dev| grep ii
dpkg -l libssl-dev| grep libssl-dev| grep ii
dpkg -l libffi-dev| grep libffi-dev| grep ii
dpkg -l unzip| grep unzip| grep ii
dpkg -l pciutils| grep pciutils| grep ii
dpkg -l net-tools| grep net-tools| grep ii
dpkg -l libblas-dev| grep libblas-dev| grep ii
dpkg -l gfortran| grep gfortran| grep ii
dpkg -l libblas3| grep libblas3| grep ii
dpkg -l liblapack-dev| grep liblapack-dev| grep ii
dpkg -l openssh-server| grep openssh-server| grep ii
dpkg -l xterm| grep xterm| grep ii
dpkg -l firefox| grep firefox| grep ii
dpkg -l xdg-utils| grep xdg-utils| grep ii
dpkg -l libdbus-glib-1-dev | grep libdbus-glib-1-dev | grep ii
dpkg -l gdb | grep gdb | grep ii
检查结果
gcc (Ubuntu 7.3.0-3ubuntu1~18.04) 7.3.0
g++ (Ubuntu 7.3.0-3ubuntu1~18.04) 7.3.0
GNU Make 4.1
cmake version 3.10.2
zlib1g-dev:arm64 1:1.2.11.dfsg-0ubuntu2 arm64 compression library - development
libbz2-dev:arm64 1.0.6-8.1ubuntu0.2 arm64 high-quality block-sorting file compressor library - development
libsqlite3-dev:arm64 3.22.0-1ubuntu0.3 arm64 SQLite 3 development files
libssl-dev:arm64 1.1.1-1ubuntu2.1~18.04.6 arm64 Secure Sockets Layer toolkit - development files
libffi-dev:arm64 3.2.1-8 arm64 Foreign Function Interface library (development files)
unzip 6.0-21ubuntu1 arm64 De-archiver for .zip files
pciutils 1:3.5.2-1ubuntu1 arm64 Linux PCI Utilities
net-tools 1.60+git20161116.90da8a0-1ubuntu1 arm64 NET-3 networking toolkit
libblas-dev:arm64 3.7.1-4ubuntu1 arm64 Basic Linear Algebra Subroutines 3, static library
gfortran 4:7.4.0-1ubuntu2.3 arm64 GNU Fortran 95 compiler
libblas3:arm64 3.7.1-4ubuntu1 arm64 Basic Linear Algebra Reference implementations, shared library
liblapack-dev:arm64 3.7.1-4ubuntu1 arm64 Library of linear algebra routines 3 - static version
openssh-server 1:7.6p1-4ubuntu0.5 arm64 secure shell (SSH) server, for secure access from remote machines
xterm 330-1ubuntu2 arm64 X terminal emulator
firefox 83.0+build2-0ubuntu0.18.04.2 arm64 Safe and easy web browser from Mozilla
xdg-utils 1.1.2-1ubuntu2.5 all desktop integration utilities from freedesktop.org
ii libdbus-glib-1-dev 0.110-2 arm64 deprecated library for D-Bus IPC (development files)
ii gdb 8.1.1-0ubuntu1 arm64 GNU Debugger
5)缺失的软件可以一个个安装,也可以用下列命令一起安装
sudo apt-get install -y gcc g++ make cmake zlib1g-dev libbz2-dev libsqlite3-dev libssl-dev libffi-dev unzip pciutils net-tools libblas-dev gfortran libblas3 liblapack-dev openssh-server xterm firefox xdg-utils libdbus-glib-1-dev gdb
6)安装python3.7.5
如果系统自带就不用安装了。
cd Python-3.7.5
./configure --prefix=/usr/local/python3.7.5 --enable-loadable-sqlite-extensions --enable-shared
make
sudo make install
用于设置Python3.7.5库文件路径
export LD_LIBRARY_PATH=/usr/local/python3.7.5/lib:$LD_LIBRARY_PATH
如果用户环境存在多个Python3版本,则指定使用python3.7.5版本
export PATH=/usr/local/python3.7.5/bin:$PATH
vim ~/.bashrc
source ~/.bashrc
python3 --version
7)安装并更新pip
pip3 install --upgrade pip
pip3 --version
更新pip源为华为源(可选,可提高速度)
cd ~/.pip
mkdir ~/.pip
cd ~/.pip
vi pip.conf
更改内容为:
[global]
#以华为源为例,请根据实际情况进行替换。
index-url = https://mirrors.huaweicloud.com/repository/pypi/simple
trusted-host = mirrors.huaweicloud.com
timeout = 120
:wq!
8)更新python软件包(这里可以创建一个虚拟环境)
pip3 install numpy
pip3 install decorator
pip3 install sympy
pip3 install cffi
pip3 install pyyaml
pip3 install pathlib2
pip3 install psutil
pip3 install protobuf
pip3 install scipypip3 install requests
pip3 install grpcio
pip3 install pylint
pip3 install absl-py
9)将umask改回0027
10) 安装mindStudio
tar -zxvf MindStudio_{version}_linux.tar.gz
cd MindStudio/bin./MindStudio.sh
./MindStudio.sh
推荐用mobaXterm来运行服务器,运行mindStudio界面时如果碰到无法显示图形化界面的问题。
显示出错问题参考:
https://www.hiascend.com/document/detail/zh/mindstudio/50RC3/instg/instg_000035.html
*MINDSTUDIIO安装参考:*https://www.hiascend.com/document/detail/zh/mindstudio/50RC3/instg/instg_000014.html
- 点赞
- 收藏
- 关注作者
评论(0)