代码拉取完成,页面将自动刷新
#!/bin/bash
#================================================================
# Copyright (C) 2020 Sangfor Ltd. All rights reserved.
#
# 文件名称:Atlas_Istall_Tool.sh
# 创 建 者:evan
# 创建日期:2020年12月14日
# 描 述:
#
#================================================================
#My_SET Config###############################
#################安装配置定义##################
#是否创建用户
add_HwHiAiUser_set=-1
# "你想要创建一个 HwHiAiUser用户, 和HwHiAiUser用户组吗?"
# -1(默认):不配置 add_HwHiAiUser_set=-1
# yes:是 配置为 add_HwHiAiUser_set=yes
# no:否 配置为 add_HwHiAiUser_set=no
#安装系统依赖配置
Use_os_pack_set=-1
# "-1(默认) 不配置"
# "1 下载并安装 OS依赖"
# "2 卸载OS 依赖"
# "3 更新OS包"
# "4 单独下载OS包"
# "5 离线安装OS依赖"
# "b 跳过系统环境包 安装"
#安装Python配置
install_Python_set=-1
# "-1(默认) 不配置"
# "0. (推荐)安装Python,在线安装Python第三方库(请提前准备Python-3.7.5.tgz在Python目录下,如果没有请选3)"
# "1. 仅安装Python,离线安装(如果没有包先下载Python-3.7.5.tgz)"
# "2. 跳过Python安装,进入Python第三方库下载或安装 "
# "3. 下载Python-3.7.5.tgz包(需要联网环境,且下载时间过长)"
# "b. 跳过 "
#安装Python第三方库配置
install_pip_IDE_set=-1
# "-1(默认) 不配置"
# "0:Python依赖 离线安装"
# "1:Python依赖 在线安装"
# "(不可配置)2:Python依赖 下载更新"
# "(不可配置)3:Python 卸载 "
# "b:跳过 Python依赖安装 "
#选择推理还是训练
atlas_Inf_or_Tra_set=-1
# "-1(默认) 不配置"
# "0: 推理环境"
# "1: 训练环境"
# "b:跳过 "
#选择Atlas版本
atlas_V_set=-1
# "-1(默认) 不配置"
# " please input num[0-1]"
# "0. 安装 Atlas 20.0V"
# "1. 安装 Atlas 20.1V"
#选择推理环境配置
install_A300_set=-1
# "-1(默认) 不配置"
# "0.安装开发和运行环境,Atlas-driver和CANN、NNRT(包含toolbox)"
# "1.安装纯运行环境,Atlas-driver和NNRT(包含toolbox)"
# "2.安装纯开发环境,CANN包"
# "3.单独安装运行推理包,NNRT包(包含toolbox)"
# "4.单独安装运行驱动,Atlas-driver"
# "b. 跳过 "
#选择训练环境配置
install_A9000_set=-1
# "-1(默认) 不配置"
# "0.安装训练 开发与运行环境driver和cann、nnae(包含TFPlugin、toolbox)"
# "1.安装训练 运行环境驱动driver"
# "2.安装训练 开发环境cann(包含TFPlugin)"
# "3.安装训练 运行环境nnae(包含TFPlugin、toolbox)"
# "b. 跳过 "
#配置是否清屏
set_clear=0
#0:不清除日志
#1:清除日志
#配置是否打印日志
set_log=1
#0:不打印日志
#1:打印日志
#set infer配置自定义推理软件包
set_F_A300=""
set_F_A301=""
set_F_A300_cann=""
set_F_A300_nnrt=""
set_F_A300_toolbox=""
#set train配置自定义训练软件包
set_F_A9000=""
set_F_A9001=""
set_F_A9000_cann=""
set_F_A9000_fwk=""
set_F_A9000_nnae=""
set_F_A9000_toolbox=""
#set 通用软件包的Url
set_Url_A300_driver_x86=""
set_Url_A300_firmware_aarch64=""
set_Url_A300_cann_x86="https://mirrors.huaweicloud.com/ascend/autoarchive/CANN/5.0.2.alpha001/Ascend-cann-toolkit_5.0.2.alpha001_linux-x86_64.run"
set_Url_A300_cann_aarch64="https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/CANN/5.0.2.alpha005/Ascend-cann-toolkit_5.0.2.alpha005_linux-aarch64.run"
################################My_SET Config end
#path################################
########-Atlas_Istall_Tool目录#########
# |--Atlas_Istall_Tool ***Atlas_Istall_Tool文件夹
# |--Atlas_V20_0 ***Atlas软件包 20.0
# |--Atlas_cann ***Atlas cann软件包
# |--Atlas_driver ***Atlas driver软件包
# |--Atlas_V20_1 ***Atlas软件包 20.1
# --|Atlas_cann ***Atlas cann软件包
# --|Atlas_driver ***Atlas driver软件包
# |--CentOS7.6_arm ***Atlas 需要的系统依赖,根据安装设备自动选择
# |--CentOS7.6_x86 Atlas 需要的系统依赖,根据安装设备自动选择
# |--Python3.7_Pack_arm ***Atlas 需要的Python以及依赖,根据安装设备自动选择
# |--Python_IDE ***python依赖
# |--Python3.7_Pack_x86 ***Atlas 需要的Python以及依赖,根据安装设备自动选择
# |--Python_IDE ***python依赖
# |--Ubuntu18.04_arm ***Atlas 需要的系统依赖,根据安装设备自动选择
# |--Ubuntu18.04_x86 ***Atlas 需要的系统依赖,根据安装设备自动选择,
# |--Atlas_Istall_Tool.sh ***总目录
# **Atlas 需要的系统依赖,根据安装设备选择,其他系统不需要可以裁剪
# ***脚本会自动识别系统与架构选择系统文件夹,“安装系统依赖配置”中选择3更新OS包后,会自动把文件保存在此
#
########Atlas_Istall_Tool目录-end#########
#atlas_install_sh_path
Atlas_install_sh_path=""
#os_path
F_ubuntu_x86="Ubuntu18.04_x86"
F_ubuntu_arm="Ubuntu18.04_arm"
F_centos_x86="CentOS7.6_x86"
F_centos_arm="CentOS7.6_arm"
#python_path
Python_Pack="Python_Pack"
F_python_x86="Python3.7_Pack_x86"
F_python_arm="Python3.7_Pack_arm"
F_Python_IDE="Python_IDE"
Python_IDE_Path="Python3.7_Pack_x86"
#atlas_path
#current_path
current_path=""
#Log_path
F_Log=""
################################path
#OS_pack################################
centos_arm_pack="gcc gcc-c++ make cmake unzip zlib-devel libffi-devel openssl-devel pciutils net-tools sqlite-devel blas-devel lapack-devel openblas-devel gcc-gfortran python-devel dkms"
centos_x86_pack="gcc gcc-c++ make cmake unzip zlib-devel libffi-devel openssl-devel pciutils net-tools sqlite-devel blas-devel lapack-devel openblas-devel gcc-gfortran python-devel dkms"
ubuntu_arm_pack=" gcc g++ make cmake zlib1g \
zlib1g-dev libbz2-dev openssl libsqlite3-dev libssl-dev \
libxslt1-dev libffi-dev unzip pciutils net-tools libblas-dev \
gfortran libblas3 libopenblas-dev dkms"
ubuntu_x86_pack="gcc g++ make cmake zlib1g zlib1g-dev libbz2-dev libsqlite3-dev openssl \
libssl-dev libxslt1-dev libffi-dev unzip pciutils net-tools dkms"
################################OS_pack-end
#Atlas pack 包################################
F_A300="./A300-3000-NPU_Driver"
F_A301="./A300-3000-NPU_Firmware"
F_A300_cann="./Ascend-Toolkit"
F_A300_nnrt=""
F_A300_toolbox=""
F_A9000=""
F_A9001=""
F_A9000_cann=""
F_A9000_fwk=""
F_A9000_nnae=""
F_A9000_toolbox=""
################################
#python################################
#训练环境
#CANN软件包python依赖
#numpy>=1.13.3/ decorator>=4.4.0/ sympy 1.4/ cffi 1.12.3/
#pyyaml pathlib2 grpcio grpcio-tools protobuf scipy requests psutil
pip_pack="numpy==1.16.0 decorator sympy cffi pyyaml pathlib2 grpcio grpcio-tools psutil protobuf==3.11.3 scipy requests"
pip_pack20_0="attrs psutil numpy==1.16.0 decorator protobuf==3.11.3 scipy sympy cffi grpcio grpcio-tools requests"
#python_packet_url="https://pypi.tuna.tsinghua.edu.cn/simple"
python_packet_url="http://mirrors.aliyun.com/pypi/simple"
#python_packet_url="https://pypi.douban.com/simple"
#pip3.7 install -i http://mirrors.aliyun.com/pypi/simple attrs psutil decorator numpy==1.16.0 protobuf==3.11.3 scipy sympy cffi grpcio grpcio-tools requests
################################python-end
#A300
#A900
function check_OS()
{
IsUbuntu=`cat /etc/os-release | grep "PRETTY_NAME"`
IsX86=`uname -m`
OS_v=0
OS_pack_list=""
#OS_v : 0:无系统 1:Ubuntu x86 2:Ubuntu arm 3:centOS x86 4:centOS arm
#麒麟V10 PRETTY_NAME="Kylin Linux Advanced Server V10 (Tercel)"
echo "正在检查系统环境"
echo " OS is $IsUbuntu"
#echo " "$IsX86
if [[ $IsUbuntu =~ "Ubuntu 18.04" ]]
then
echo " Ubuntu 18.04. "
download_cmd="apt-get download"
install_cmd="apt-get install -y"
uninstall_cmd="apt-get remove --purge"
off_install_cmd="dpkg -i"
OSV_="Ubuntu"
if [[ $IsX86 =~ "x86_64" ]]
then
echo " x86. "
OS_v=1
OS_pack_list=$ubuntu_x86_pack
IsUbuntu="Ubuntu18.04_x86"
Python_IDE_Path="Python3.7_IDE_x86"
else
echo " arm. "
OS_v=2
OS_pack_list=$ubuntu_arm_pack
IsUbuntu="Ubuntu18.04_arm"
Python_IDE_Path="Python3.7_IDE_arm"
fi
elif [[ $IsUbuntu =~ "CentOS Linux 7" ]]
then
echo " CentOS Linux 7"
download_cmd="yum install -y --downloadonly --downloaddir=./"
install_cmd="yum install -y"
uninstall_cmd="yum remove -y"
off_install_cmd="rpm -ivh"
OSV_="Centos"
if [[ $IsX86 =~ "x86_64" ]]
then
echo " x86. "
OS_v=3
IsUbuntu="CentOS7.6_x86"
OS_pack_list=$centos_x86_pack
Python_IDE_Path="Python3.7_IDE_x86"
else
echo " arm. "
OS_v=4
IsUbuntu="CentOS7.6_arm"
OS_pack_list=$centos_arm_pack
Python_IDE_Path="Python3.7_IDE_arm"
fi
else
echo "This system is not supported. "
echo "set default OS: CentOS Linux 7 arm"
download_cmd="yum install -y --downloadonly --downloaddir=./"
install_cmd="yum install -y"
uninstall_cmd="yum remove -y"
off_install_cmd="rpm -ivh"
OSV_="Centos"
if [[ $IsX86 =~ "x86_64" ]]
then
echo " x86. "
OS_v=3
IsUbuntu="CentOS7.6_x86"
OS_pack_list=$centos_x86_pack
Python_IDE_Path="Python3.7_IDE_x86"
else
echo " arm. "
OS_v=4
IsUbuntu="CentOS7.6_arm"
OS_pack_list=$centos_arm_pack
Python_IDE_Path="Python3.7_IDE_arm"
fi
fi
}
#选择yes or no 返回值REPLACE
function input_choose()
{
read -p " Please select Yes or No [Y/n]: " REPLACE
case $REPLACE in
[yY][eE][sS]|[yY])
REPLACE="yes"
echo "You have chosen $REPLACE"
rm -rf $r_item_rmgit
;;
[nN][oO]|[nN])
REPLACE="no"
echo "You have chosen $REPLACE"
;;
*)
echo "Input error, should be [Y/n]."
exit 1
esac
}
#选择0-5的数值 返回数值 REPLACE1
function input_num_choose()
{
echo "input [e/E]: exit"
input_num_choose_stat=0
read -p " input num choose [0-$1]: " REPLACE1
case $REPLACE1 in
[0])
num_choose=0
echo "choose_num: $num_choose"
;;
[1])
num_choose=1
echo "choose_num: $num_choose"
;;
[2])
num_choose=2
echo "choose_num: $num_choose"
;;
[3])
num_choose=3
echo "choose_num: $num_choose"
;;
[4])
num_choose=4
echo "choose_num: $num_choose"
;;
[5])
num_choose=5
echo "choose_num: $num_choose"
;;
[6])
num_choose=6
echo "choose_num: $num_choose"
;;
[7])
num_choose=7
echo "choose_num: $num_choose"
;;
[8])
num_choose=8
echo "choose_num: $num_choose"
;;
[9])
num_choose=9
echo "choose_num: $num_choose"
;;
[bB])
num_choose="b"
echo "choose_num: $num_choose"
;;
[eE])
num_choose="E"
exit -1
echo "choose_num: $num_choose"
;;
*)
input_num_choose_stat=1
echo "Input error, should be [1-$1]."
esac
if [ $input_num_choose_stat == 1 ]; then
echo "输入错误请重新输入"
input_num_choose
fi
}
#安装OS系统包
function Use_os_pack()
{
# $1 的对应选择
#1 下载并安装 install_cmd
#2 卸载 uninstall_cmd
#3 更新系统包 download_cmd
#4 下载系统包 download_cmd
#5 离线安装 off_install_cmd
#check_OS
clear_display Use_os_pack
echo "# Start! download or install ubuntu_pack deb#"
echo "#############################################"
echo " please input num[1-6]"
echo "1 在线安装OS依赖(需要在联网环境)"
echo "2 卸载OS依赖"
echo "3 在线更新OS包(更新本系统的OS离线依赖包到#./$IsUbuntu/#目录下)"
echo "4 单独下载OS包(并按时间和系统创建文件夹,保存在./目录下)"
echo "5 离线安装OS依赖(需要在离线系统目录下存放依赖)"
echo "b 跳过系统环境包 安装"
echo "输入 e or E:退出"
if [[ $Use_os_pack_set -ne -1 ]]
then
os_num=$Use_os_pack_set
else
num_choose=0
input_num_choose 5
os_num=$num_choose
fi
F1=$IsUbuntu
if [[ $os_num == 4 ]]
then
F1=$IsUbuntu"_"$T1
echo "创建下载路径: "$F1
else
echo "记得在对应文件夹放好安装包哦!"
#add 这里可以做一个检查
fi
echo "cd directory "$F1
#touch $T1
sudo mkdir -p $F1
chmod +x $F1
cd $F1
echo " os-release $OS_v"
cmd_num=0
for os_pack_name in ${OS_pack_list[@]};do
echo "选择系统包:$os_pack_name"
if [[ $os_num == 1 ]]
then
$install_cmd $os_pack_name
if [[ $os_pack_name == "cmake" ]]
then
echo "安装cmake "
chmod +x cmake*
tar zxvf cmake-*
cd cmake-*
./bootstrap --prefix=/usr
make
sudo make install
cd ..
continue
fi
elif [[ $os_num == 2 ]]
then
$uninstall_cmd $os_pack_name
echo "离线安装 OS pack"
elif [[ $os_num == 3 ]] || [[ $os_num == 4 ]]
then
$download_cmd $os_pack_name
echo "下载 OS pack"
elif [[ $os_num == 5 ]]
then
if [[ $os_pack_name == "cmake" ]]
then
echo "安装cmake "
chmod +x cmake*
tar zxvf cmake-*
cd cmake-*
./bootstrap --prefix=/usr
make
sudo make install
cd ..
continue
fi
$off_install_cmd *
break
elif [[ $os_num == "b" ]]
then
echo "跳过 安装系统包"
break;
echo "Error cmd"
fi
if [ $? -ne 0 ]; then
((cmd_num++))
echo " os-release $OS_v error num: $cmd_num pack: $os_pack_name"
fi
done
cd ..
#回调该函数
if [[ $os_num == 2 ]] || [[ $os_num == 3 ]] || [[ $os_num == 4 ]]
then
echo " "
Use_os_pack
fi
echo "安装 OS 系统包退出"
echo "###############################"
}
function install_python3.7_IDE()
{
clear_display install_python3.7_IDE
echo "# choose install_python3.7_IDE#"
echo "###############################"
sudo chmod +x "Python-3.7.5.tgz"
sudo ls -l |grep ^d |grep "Python-3.7.5"
if [[ $? == 1 ]]
then
sudo tar zxvf "Python-3.7.5.tgz"
else
echo "The "python3.7.5" folder already exists in the current directory. If you need to reinstall python3.7.5, please delete the "python3.7.5" folder and install it."
#当前目录已经存在“python3.7.5”文件夹,如果需要重新安装python3.7.5,请删除“python3.7.5”文件夹后安装。
fi
cd "Python-3.7.5"
#make clean
./configure --prefix=/usr/local/python3.7.5 --enable-shared
make
sudo make install
if [[ $? == 0 ]]
then
echo "Python3.7.5 installed Successfully!"
fi
sudo cp /usr/local/python3.7.5/lib/libpython3.7m.so.1.0 /usr/lib64
sudo cp /usr/local/python3.7.5/lib/libpython3.7m.so.1.0 /usr/lib
sudo rm -rf /usr/bin/python3.7.5
sudo rm -rf /usr/bin/python3.7
sudo rm -rf /usr/bin/pip3.7.5
sudo rm -rf /usr/bin/pip3.7
sudo ln -s /usr/local/python3.7.5/bin/python3 /usr/bin/python3.7.5
sudo ln -s /usr/local/python3.7.5/bin/python3 /usr/bin/python3.7
sudo ln -s /usr/local/python3.7.5/bin/python3 /usr/bin/python3
sudo ln -s /usr/local/python3.7.5/bin/pip3 /usr/bin/pip3.7.5
sudo ln -s /usr/local/python3.7.5/bin/pip3 /usr/bin/pip3.7
sudo ln -s /usr/local/python3.7.5/bin/pip3 /usr/bin/pip3
#返回函数初始目录
cd $current_path
python3.7.5 --version
pip3.7.5 --version
}
function install_pip_IDE()
{
# 0 pip离线安装 1pip在线安装 2pip下载更新 3pip卸载
clear_display install_pip_IDE
mkdir -p $Python_IDE_Path
sudo chmod +x $Python_IDE_Path
cd $Python_IDE_Path
echo "请选择pip 镜像源"
echo "0:华为镜像源 "
echo "1:清华镜像源 "
echo "2:豆瓣镜像源 "
echo "3:阿里镜像源 "
echo "b:跳过,默认系统镜像源 "
num_choose=0
input_num_choose 3
choose_num_pip=$num_choose
#python_packet_url="https://pypi.tuna.tsinghua.edu.cn/simple"
#python_packet_url="http://mirrors.aliyun.com/pypi/simple"
#python_packet_url="https://pypi.douban.com/simple"
case $choose_num_pip in
[0])
echo "选择华为镜像源 "
python_packet_url="https://mirrors.huaweicloud.com/repository/pypi/simple"
;;
[1])
echo "选择清华镜像源 "
python_packet_url="https://pypi.tuna.tsinghua.edu.cn/simple"
;;
[2])
echo "选择豆瓣镜像源 "
python_packet_url="https://pypi.douban.com/simple"
;;
[3])
echo "选择阿里镜像源 "
python_packet_url="http://mirrors.aliyun.com/pypi/simple"
;;
[b])
echo "跳过,默认系统镜像源 "
;;
esac
echo "#############################"
echo "choose install_Python IDE"
echo "#############################"
echo " please input num[1-4]"
echo "0:离线安装 Python第三方库(Python_IDE_x86/arm目录下没有Python依赖,请在联网环境下选择2下载更新,默认选择本机的架构下载依赖包)"
echo "1:在线安装 Python第三方库 "
echo "2:下载更新 Python第三方库的离线安装包 "
echo "3:卸载 该脚本安装过的Python第三方库 "
echo "b:跳过 Python依赖安装 "
#选项2和3由于需要回调,不能将"install_pip_IDE_set"配置 为2或者3
# mkdir -p $F_Python_IDE
# sudo chmod +x $F_Python_IDE
# cd $F_Python_IDE
cmd_num=0
choose_num_pip=0
if [[ $install_pip_IDE_set -ne -1 ]]
then
choose_num_pip=$install_pip_IDE_set
else
num_choose=0
input_num_choose 3
choose_num_pip=$num_choose
fi
echo "upgrade pip -->20"
for pip_name in ${pip_pack[@]};do
case $choose_num_pip in
[0])
pip3.7 install --no-deps --upgrade --find-links=. pip-20*
#pip3.7 install --no-deps *
pip3.7 install --no-deps --find-links=. -r "Python_IDE.txt"
if [ $? -ne 0 ]; then
echo "Python 依赖上一次安装失败,尝试重新安装..."
mv "Python_IDE.txt" ../
pip3.7 install --no-deps *
mv ../"Python_IDE.txt" .
fi
break #未判断是否为tar.gz包
;;
[1])
pip3.7 install --upgrade "pip" --index-url $python_packet_url
pip3.7 install --index-url $python_packet_url $pip_name
;;
[2])
#更新Python依赖
# pip3.7 download --index-url https://pypi.tuna.tsinghua.edu.cn/simple pip
pip3.7 download --index-url $python_packet_url pip
pip3.7 download --index-url $python_packet_url $pip_name
;;
[3])
pip3.7 uninstall -y $pip_name
;;
[b])
echo " 跳过 Python依赖安装"
;;
*)
echo "检测错误"
if [ $0 -ne 0 ]; then
((cmd_num++))
echo " "
echo "E$cmd_num Error 安装 install_pip_IDE"
fi
esac
if [ $0 -ne 0 ]; then
((cmd_num++))
fi
done
#更新Python 包后 更新 Python_IDE.txt
if [[ $choose_num_pip -eq 2 ]]
then
echo "正在更新Python_IDE.txt"
pip3.7 freeze > "Python_IDE.txt"
fi
if [ $cmd_num -ne 0 ]; then
echo "pip3.7.5 install报错 subprocess.CalledProcessError:Command '('lsb_release', '-a')' return non-zero exit status 1"
echo "https://support.huaweicloud.com/instg-cli-cann330-alpha002/atlasrun_03_0178.html"
fi
#返回函数初始目录
cd $current_path
#回调该函数
if [[ $choose_num_pip == 2 ]] || [[ $choose_num_pip == 3 ]]
then
echo " "
install_pip_IDE
fi
}
function install_Python()
{
#0 安装Python 以及pip
#1 安装Python
#2 安装pip
#check_OS
#返回主目录
cd $Atlas_install_sh_path
clear_display install_Python
#设置python_pack的目录
Python_Pack="$Atlas_install_sh_path/Python_Pack"
echo "Python_Pack is $Python_Pack"
sudo mkdir -p "$Python_Pack"
sudo chmod +x $Python_Pack
cd $Python_Pack
echo "# install python starting... #"
echo "##############################"
echo " please input num[0-3]"
echo "0.(推荐)离线安装Python,在线安装Python第三方库(请提前准备Python-3.7.5.tgz在Python目录下,如果没有请先选3)"
echo "1. 仅安装Python,离线安装(如果没有包先下载Python-3.7.5.tgz)"
echo "2. 跳过Python安装,进入Python第三方库下载或安装 "
echo "3. 下载Python-3.7.5.tgz包(需要联网环境,且下载时间过长)"
echo "b. 跳过 "
if [[ $install_Python_set -ne -1 ]]
then
choose_num_py=$install_Python_set
else
num_choose=0
input_num_choose 3
choose_num_py=$num_choose
fi
Display_current_path
echo "install python choose_num_py:$choose_num_py "
case $choose_num_py in
[0])
install_python3.7_IDE
install_pip_IDE
;;
[1])
install_python3.7_IDE
;;
[2])
install_pip_IDE
;;
[3])
wget https://www.python.org/ftp/python/3.7.5/Python-3.7.5.tgz
;;
[b])
echo " 退出Python安装"
;;
*)
echo "Input error, should be [0-4]."
exit 10
esac
#返回主目录
cd $Atlas_install_sh_path
echo "install python exit..."
echo "#############################"
}
#增加9000的选择
function choose_Atlas_version()
{
echo "###########"
echo "Please Select the version of the Atlas"
echo "###########"
echo " please input num[0-1]"
echo "0. 安装 Atlas 20.0V"
echo "1. 安装 Atlas 20.1V"
echo "2. 安装 Atlas 20.2V"
echo "3. 安装 Atlas 3.3V"
echo "4. 安装 Atlas 自定义版本"
echo "b. 跳过 "
check_gcc_version
CentOS_Atlas_gcc="gcc4.8.5"
if [[ $gcc_num == 7 ]]
then
CentOS_Atlas_gcc="gcc7.3.0"
elif [[ $gcc_num == 4 ]]
then
CentOS_Atlas_gcc="gcc4.8.5"
fi
echo "(仅CentOS受影响)根据OS安装的gcc版本 选择Atlas_gcc $CentOS_Atlas_gcc"
#IsUbuntu="CentOS7.6_arm""CentOS7.6_x86""Ubuntu18.04_arm""Ubuntu18.04_x86"
#选择Atlas版本
if [[ $atlas_V_set -ne -1 ]]
then
#如果有默认选项,就使用默认版本选项
atlas_V=$atlas_V_set
else
#否则,自己选择版本
num_choose=0
input_num_choose 4
atlas_V=$num_choose
fi
case $atlas_V in
[0])
choose_Atlas_version_path="Atlas_V20_0"
echo "你选择了 atlas20.0版本软件 系统为:$IsUbuntu"
echo "提示:CentOS7.6 请将gcc升级到7.3+才能使用训练环境"
if [[ $IsUbuntu == "CentOS7.6_arm" ]]
then
F_A300="./A300-3000-NPU_Driver-20.0.0-ARM64-CentOS7.6_$CentOS_Atlas_gcc.run"
F_A301="./A300-3000-NPU_Firmware-1.73.5.1.b050.run"
F_A300_cann="./Ascend-Toolkit-20.0.RC1-arm64-linux_$CentOS_Atlas_gcc.run"
F_A300_nnrt="./Ascend-NNRT-20.0.RC1-arm64-linux_$CentOS_Atlas_gcc.run"
F_A300_toolbox="./Ascend-Toolbox-20.0.RC1-arm64-linux_$CentOS_Atlas_gcc.run"
F_A9000="./A800-9000-NPU_Driver-20.0.RC1-ARM64-CentOS7.6_gcc7.3.0.run"
F_A9001="./A800-9000-NPU_Firmware-1.73.1005.1.b050.run"
F_A9000_cann="./Ascend-Toolkit-20.0.RC1-arm64-linux_gcc7.3.0.run"
F_A9000_fwk="./Ascend-TFPlugin-20.0.RC1-arm64-linux_gcc7.3.0.run"
F_A9000_nnae="./Ascend-NNAE-20.0.RC1-arm64-linux_gcc7.3.0.run"
F_A9000_toolbox="./Ascend-Toolbox-20.0.RC1-arm64-linux_gcc7.3.0.run"
elif [[ $IsUbuntu == "CentOS7.6_x86" ]]
then
F_A300="./A300-3010-NPU_Driver-20.0.0-X86_64-CentOS7.6_$CentOS_Atlas_gcc.run"
F_A301="./A300-3010-NPU_Firmware-1.73.5.1.b050.run"
F_A300_cann="./Ascend-Toolkit-20.0.RC1-x86_64-linux_$CentOS_Atlas_gcc.run"
F_A300_nnrt="./Ascend-NNRT-20.0.RC1-x86_64-linux_$CentOS_Atlas_gcc.run"
F_A300_toolbox="./Ascend-Toolbox-20.0.RC1-x86_64-linux_$CentOS_Atlas_gcc.run"
F_A9000="./A800-9010-NPU_Driver-20.0.RC1-X86_64-CentOS7.6_gcc7.3.0.run"
F_A9001="./A800-9010-NPU_Firmware-1.73.1005.1.b050.run"
F_A9000_cann="./Ascend-Toolkit-20.0.RC1-x86_64-linux_gcc7.3.0.run"
F_A9000_fwk="./Ascend-TFPlugin-20.0.RC1-x86_64-linux_gcc7.3.0.run"
F_A9000_nnae="./Ascend-NNAE-20.0.RC1-x86_64-linux_gcc7.3.0.run"
F_A9000_toolbox="./Ascend-Toolbox-20.0.RC1-x86_64-linux_gcc7.3.0.run"
elif [[ $IsUbuntu == "Ubuntu18.04_arm" ]]
then
F_A300="./A300-3000-NPU_Driver-20.0.0-ARM64-Ubuntu18.04.run"
F_A301="./A300-3000-NPU_Firmware-1.73.5.1.b050.run"
F_A300_cann="./Ascend-Toolkit-20.0.RC1-arm64-linux_gcc7.3.0.run"
F_A300_nnrt="./Ascend-NNRT-20.0.RC1-arm64-linux_gcc7.3.0.run"
F_A300_toolbox="./Ascend-Toolbox-20.0.RC1-arm64-linux_gcc7.3.0.run"
F_A9000="./A800-9000-NPU_Driver-20.0.RC1-ARM64-Ubuntu18.04.run"
F_A9001="./A800-9000-NPU_Firmware-1.73.1005.1.b050.run"
F_A9000_cann="./Ascend-Toolkit-20.0.RC1-arm64-linux_gcc7.3.0.run"
F_A9000_fwk="./Ascend-TFPlugin-20.0.RC1-arm64-linux_gcc7.3.0.run"
F_A9000_nnae="./Ascend-NNAE-20.0.RC1-arm64-linux_gcc7.3.0.run"
F_A9000_toolbox="./Ascend-Toolbox-20.0.RC1-arm64-linux_gcc7.3.0.run"
elif [[ $IsUbuntu == "Ubuntu18.04_x86" ]]
then
F_A300="./A300-3010-NPU_Driver-20.0.0-X86_64-Ubuntu18.04.run"
F_A301="./A300-3010-NPU_Firmware-1.73.5.1.b050.run"
F_A300_cann="./Ascend-Toolkit-20.0.RC1-x86_64-linux_gcc7.3.0.run"
F_A300_nnrt="./Ascend-NNRT-20.0.RC1-x86_64-linux_gcc7.3.0.run"
F_A300_toolbox="./Ascend-Toolbox-20.0.RC1-x86_64-linux_gcc7.3.0.run"
F_A9000="./A800-9010-NPU_Driver-20.0.RC1-X86_64-Ubuntu18.04.run"
F_A9001="./A800-9010-NPU_Firmware-1.73.1005.1.b050.run"
F_A9000_cann="./Ascend-Toolkit-20.0.RC1-x86_64-linux_gcc7.3.0.run"
F_A9000_fwk="./Ascend-TFPlugin-20.0.RC1-x86_64-linux_gcc7.3.0.run"
F_A9000_nnae="./Ascend-NNAE-20.0.RC1-x86_64-linux_gcc7.3.0.run"
F_A9000_toolbox="./Ascend-Toolbox-20.0.RC1-x86_64-linux_gcc7.3.0.run"
fi
;;
[1])
choose_Atlas_version_path="Atlas_V20_1"
echo "你选择了 atlas20.1版本软件 系统为:$IsUbuntu "
if [[ $IsUbuntu == "CentOS7.6_arm" ]]
then
F_A300="./A300-3000-npu-driver_20.1.0_centos7.6-$CentOS_Atlas_gcc-aarch64.run"
F_A301="./A300-3000-npu-firmware_1.75.22.0.220.run"
F_A300_cann="./Ascend-cann-toolkit_20.1.rc1_linux-aarch64.run"
F_A300_nnrt="./Ascend-cann-nnrt_20.1.rc1_linux-aarch64.run"
F_A300_toolbox="./Ascend-mindstudio-toolbox_20.1.rc1_linux-aarch64.run"
F_A9000="./A800-9000-npu-driver_20.1.0_centos7.6-gcc7.3.0-aarch64.run"
F_A9001="./A300-3000-npu-firmware_1.75.22.0.220.run"
F_A9000_cann="./Ascend-cann-toolkit_20.1.rc1_linux-aarch64.run"
F_A9000_fwk="./Ascend-fwk-tfplugin_20.1.rc1_linux-aarch64.run"
F_A9000_nnae="./Ascend-cann-nnae_20.1.rc1_linux-aarch64.run"
F_A9000_toolbox="./Ascend-mindstudio-toolbox_20.1.rc1_linux-aarch64.run"
elif [[ $IsUbuntu == "CentOS7.6_x86" ]]
then
F_A300="./A300-3010-npu-driver_20.1.0_centos7.6-$CentOS_Atlas_gcc-x86_64.run"
F_A301="./A300-3010-npu-firmware_1.75.22.0.220.run"
F_A300_cann="./Ascend-cann-toolkit_20.1.rc1_linux-x86_64.run"
F_A300_nnrt="./Ascend-cann-nnrt_20.1.rc1_linux-x86_64.run"
F_A300_toolbox="./Ascend-mindstudio-toolbox_20.1.rc1_linux-x86_64.run"
F_A9000="./A800-9010-npu-driver_20.1.0_centos7.6-gcc7.3.0-x86_64.run"
F_A9001="./A800-9010-npu-firmware_1.75.22.0.220.run"
F_A9000_cann="./Ascend-cann-toolkit_20.1.rc1_linux-x86_64.run"
F_A9000_fwk="./Ascend-fwk-tfplugin_20.1.rc1_linux-x86_64.run"
F_A9000_nnae="./Ascend-cann-nnae_20.1.rc1_linux-x86_64.run"
F_A9000_toolbox="./Ascend-mindstudio-toolbox_20.1.rc1_linux-x86_64.run"
elif [[ $IsUbuntu == "Ubuntu18.04_arm" ]]
then
F_A300="./A300-3000-npu-driver_20.1.0_ubuntu18.04-aarch64.run"
F_A301="./A300-3000-npu-firmware_1.75.22.0.220.run"
F_A300_cann="./Ascend-cann-toolkit_20.1.rc1_linux-aarch64.run"
F_A300_nnrt="./Ascend-cann-nnrt_20.1.rc1_linux-aarch64.run"
F_A300_toolbox="./Ascend-mindstudio-toolbox_20.1.rc1_linux-aarch64.run"
F_A9000="./A800-9000-npu-driver_20.1.0_centos7.6-gcc7.3.0-aarch64.run"
F_A9001="./A800-9000-npu-firmware_1.75.22.0.220.run"
F_A9000_cann="./Ascend-cann-toolkit_20.1.rc1_linux-aarch64.run"
F_A9000_fwk="./Ascend-fwk-tfplugin_20.1.rc1_linux-aarch64.run"
F_A9000_nnae="./Ascend-cann-nnae_20.1.rc1_linux-aarch64.run"
F_A9000_toolbox="./Ascend-mindstudio-toolbox_20.1.rc1_linux-aarch64.run"
elif [[ $IsUbuntu == "Ubuntu18.04_x86" ]]
then
F_A300="./A300-3010-npu-driver_20.1.0_ubuntu18.04-x86_64.run"
F_A301="./A300-3010-npu-firmware_1.75.22.0.220.run"
F_A300_cann="./Ascend-cann-toolkit_20.1.rc1_linux-x86_64.run"
F_A300_nnrt="./Ascend-cann-nnrt_20.1.rc1_linux-x86_64.run"
F_A300_toolbox="./Ascend-mindstudio-toolbox_20.1.rc1_linux-x86_64.run"
F_A9000="./A800-9010-npu-driver_20.1.0_ubuntu18.04-x86_64.run"
F_A9001="./A800-9010-npu-firmware_1.75.22.0.220.run"
F_A9000_cann="./Ascend-cann-toolkit_20.1.rc1_linux-x86_64.run"
F_A9000_fwk="./Ascend-fwk-tfplugin_20.1.rc1_linux-x86_64.run"
F_A9000_nnae="./Ascend-cann-nnae_20.1.rc1_linux-x86_64.run"
F_A9000_toolbox="./Ascend-mindstudio-toolbox_20.1.rc1_linux-x86_64.run"
fi
;;
[3])
choose_Atlas_version_path="Atlas_V20_1"
echo "你选择了 atlas3.3版本软件 系统为:$IsUbuntu "
F_A300="A300-3000-3010-npu-driver_20.2.0_ubuntu18.04-aarch64.run"
if [[ $IsUbuntu == "CentOS7.6_arm" ]]
then
F_A300="./A300-3000-3010-npu-driver_20.2.0_centos7.6-aarch64.run"
#https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/turing/resourcecenter/Software/20.2.0/A300-3000%201.0.9/A300-3000-3010-npu-driver_20.2.0_centos7.6-aarch64.run
F_A301="./A300-3000-3010-npu-firmware_1.76.22.3.220.run"
#https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/turing/resourcecenter/Software/20.2.0/A300-3000%201.0.9/A300-3000-3010-npu-firmware_1.76.22.3.220.run
F_A300_cann="./Ascend-cann-toolkit_3.3.0.alpha001_linux-aarch64.run"
#https://repo.huaweicloud.com/ascend/autoarchive/CANN/3.3.0.alpha001/Ascend-cann-toolkit_3.3.0.alpha001_linux-aarch64.run
F_A300_nnrt="./"
F_A300_toolbox="./"
F_A9000="./"
F_A9001="./"
F_A9000_cann="./"
F_A9000_fwk="./"
F_A9000_nnae="./"
F_A9000_toolbox="./"
elif [[ $IsUbuntu == "CentOS7.6_x86" ]]
then
F_A300="./A300-3010-npu-driver_20.2.0_centos7.6-x86_64.run"
#https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/turing/resourcecenter/Software/20.2.0/A300-3010%201.0.9/A300-3010-npu-driver_20.2.0_centos7.6-x86_64.run
F_A301="./A300-3000-3010-npu-firmware_1.76.22.3.220.run"
F_A300_cann="./"
F_A300_nnrt="./"
F_A300_toolbox="./"
F_A9000="./"
F_A9001="./"
F_A9000_cann="./"
F_A9000_fwk="./"
F_A9000_nnae="./"
F_A9000_toolbox="./"
elif [[ $IsUbuntu == "Ubuntu18.04_arm" ]]
then
F_A300="./A300-3000-3010-npu-driver_20.2.0_ubuntu18.04-aarch64.run"
F_A301="./A300-3000-3010-npu-firmware_1.76.22.3.220.run"
F_A300_cann="./Ascend-cann-toolkit_3.3.0.alpha001_linux-aarch64.run"
#https://repo.huaweicloud.com/ascend/autoarchive/CANN/3.3.0.alpha001/Ascend-cann-toolkit_3.3.0.alpha001_linux-aarch64.run
F_A300_nnrt="./"
F_A300_toolbox="./"
F_A9000="./"
F_A9001="./"
F_A9000_cann="./"
F_A9000_fwk="./"
F_A9000_nnae="./"
F_A9000_toolbox="./"
elif [[ $IsUbuntu == "Ubuntu18.04_x86" ]]
then
F_A300="./A300-3010-npu-driver_20.2.0_ubuntu18.04-x86_64.run"
#https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/turing/resourcecenter/Software/20.2.0/A300-3010%201.0.9/A300-3010-npu-driver_20.2.0_ubuntu18.04-x86_64.run
F_A301="./A300-3000-3010-npu-firmware_1.76.22.3.220.run"
F_A300_cann="./"
F_A300_nnrt="./"
F_A300_toolbox="./"
F_A9000="./"
F_A9001="./"
F_A9000_cann="./"
F_A9000_fwk="./"
F_A9000_nnae="./"
F_A9000_toolbox="./"
fi
;;
[4])
echo "你说你想要自由,我便放手给你自由。"
echo "安装自定义通用版本"
choose_Atlas_version_path="Atlas_V0_0"
echo "#你选择了 自定义版本软件 系统为:$IsUbuntu,请务必确保软件版本与系统匹配!#"
wget "https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/CANN/5.0.2.alpha005/Ascend-cann-toolkit_5.0.2.alpha005_linux-aarch64.run" --no-check-certificate
F_A300=$set_F_A300
F_A301=$set_F_A301
F_A300_cann=$set_F_A300_cann
F_A300_nnrt=$set_F_A300_nnrt
F_A300_toolbox=$set_F_A300_toolbox
F_A9000=$set_F_A9000
F_A9001=$set_F_A9001
F_A9000_cann=$set_F_A9000_cann
F_A9000_fwk=$set_F_A9000_fwk
F_A9000_nnae=$set_F_A9000_nnae
F_A9000_toolbox=$set_F_A9000_toolbox
;;
[b])
echo "跳过 安装atlas软件此步骤! "
;;
*)
echo "Input error, should be [0-2]."
exit 1
esac
}
function Display_current_path()
{
current_path=`pwd`
echo "Display current path:$current_path"
}
function install_Atlas_IDE()
{
clear_display install_Atlas_IDE
echo "# $IsUbuntu install_Atlas_IDE starting#"
echo "#######################################"
#选择推理还是训练
atlas_Inf_or_Tra
#选择Atlas版本
choose_Atlas_version
sudo mkdir -p $choose_Atlas_version_path
sudo chmod +x $choose_Atlas_version_path
cd $choose_Atlas_version_path
if [[ $NPU_IorT == "Inf" ]]
then
install_A300
elif [[ $NPU_IorT == "Tra" ]]
then
install_A9000
fi
}
#安装A300-driver和CANN-toolkit
function install_A300_driv()
{
echo "install_A300_driv starting"
sudo mkdir -p $Atlas_driver
sudo chmod +x $Atlas_driver
cd $Atlas_driver
$F_A300 --full
$F_A301 --full
cd ..
}
function install_A300_cann()
{
mkdir -p $Atlas_cann
chmod +x $Atlas_cann
cd $Atlas_cann
#选择在线下载安装还是离线安装 0 离线 1在线
num_choose=0
input_num_choose 2
if [[ $num_choose -ne 1 ]]
then
$F_A300_cann --install
else
echo "download the $set_Url_A300_cann_aarch64"
wget $set_Url_A300_cann_aarch64 --no-check-certificate
F_A300_cann=`ls . |grep Ascend-cann-toolkit*run`
echo "install_A300_cann starting: $F_A300_cann "
$F_A300_cann --install
fi
cd ..
}
function install_A300_nnrt()
{
mkdir -p $Atlas_cann
chmod +x $Atlas_cann
cd $Atlas_cann
echo " install_A300_nnrt starting"
$F_A300_nnrt --install
$F_A300_toolbox --install
cd ..
}
Atlas_driver="Atlas_driver"
Atlas_cann="Atlas_cann"
function install_A300()
{
clear_display install_A300
echo "########################################"
echo "这是你的版本选择,请确保以下软件包存在"
echo "驱动:$F_A300"
echo "MCU固件:$F_A301"
echo "CANN:$F_A300_cann"
echo "CANN:$F_A300_nnrt"
echo "纯运行环境需要安装驱动和固件,纯开发环境需安装CANN-Toolkit"
echo "#########################################"
echo "# $IsUbuntu install_A300 starting#"
echo "##################################"
echo " please input num[0-4]"
echo "0.安装开发和运行环境,Atlas-driver和CANN、NNRT(包含toolbox)"
echo "1.安装纯运行环境,Atlas-driver和NNRT(包含toolbox)"
echo "2.安装纯开发环境,CANN包"
echo "3.单独安装运行推理包,NNRT包(包含toolbox)"
echo "4.单独安装运行驱动,Atlas-driver"
echo "b. 跳过 "
if [[ $install_A300_set -ne -1 ]]
then
A300_num=$install_A300_set
else
num_choose=0
input_num_choose 4
A300_num=$num_choose
fi
case $A300_num in
[0])
install_A300_driv
install_A300_cann
install_A300_nnrt
;;
[1])
install_A300_driv
install_A300_nnrt
;;
[2])
install_A300_cann
;;
[3])
install_A300_nnrt
;;
[4])
install_A300_driv
;;
[B][b])
echo "跳过A300安装"
;;
*)
echo "Input error, should be [0-5]."
exit 1
esac
echo "安装 atlas300 软件 exit..."
echo "###############################"
}
#安装A9000-driver和CANN-toolkit
function install_A9000_driv()
{
sudo mkdir -p $Atlas_driver
sudo chmod +x $Atlas_driver
cd $Atlas_driver
echo "install_A9000_driv starting"
$F_A9000 --full
$F_A9001 --full
cd ..
}
function install_A9000_cann()
{
sudo mkdir -p $Atlas_cann
sudo chmod $Atlas_cann
cd $Atlas_cann
echo "install_A300_cann starting"
$F_A9000_cann --install
$F_A9000_fwk --install
cd ..
}
function install_A9000_nnae()
{
sudo mkdir -p $Atlas_cann
sudo chmod $Atlas_cann
cd $Atlas_cann
echo " install_A9000_nnae starting"
$F_A9000_nnae --install
$F_A9000_fwk --install
$F_A9000_toolbox --install
cd ..
}
function install_A9000()
{
#check_OS
clear_display install_A9000
echo "########################################"
echo "这是你的版本选择,请确保以下软件包存在"
echo "驱动:$F_A9000"
echo "MCU固件:$F_A9001"
echo "CANN:$F_A9000_cann"
echo "NNAE:$F_A9000_nnae"
echo "FWK:$F_A9000_fwk"
echo "纯运行环境需要安装驱动和固件,纯开发环境需安装CANN-Toolkit(训练环境还需要安装Ascend-fwk-tfplugin)"
echo "#########################################"
echo " 开始安装 A9000训练环境"
echo " please input num[0-3]"
echo "0.安装训练 开发与运行环境driver和cann、nnae(包含TFPlugin、toolbox)"
echo "1.安装训练 运行环境驱动driver"
echo "2.安装训练 开发环境cann(包含TFPlugin)"
echo "3.安装训练 运行环境nnae(包含TFPlugin、toolbox)"
echo "b. 跳过 "
if [[ $install_A9000_set -ne -1 ]]
then
A9000_num=$install_A9000_set
else
num_choose=0
input_num_choose 3
A9000_num=$num_choose
fi
case $A9000_num in
[0])
install_A9000_driv
install_A9000_cann
install_A9000_nnae
;;
[1])
install_A9000_driv
;;
[2])
install_A9000_cann
;;
[3])
install_A9000_nnae
;;
[b])
echo "跳过A9000安装"
;;
*)
echo "Input error, should be [0-3]."
exit 1
esac
echo "安装 atlas9000 软件 exit..."
echo "###########################"
}
function add_cann_env()
{
echo 'install_path=/usr/local/Ascend/ascend-toolkit/latest/arm64-linux_gcc7.3.0'\
>>~/.bashrc
#install_path=/usr/local/Ascend/ascend-toolkit/latest/x86_64-linux_gcc7.3.0
#install_path=/usr/local/Ascend/ascend-toolkit/latest/x86_64-linux
echo 'export PATH=/usr/local/python3.7.5/bin:${install_path}/atc/ccec_compiler/bin:${install_path}/atc/bin:$PATH'\
>>~/.bashrc
echo 'export PYTHONPATH=${install_path}/atc/python/site-packages/te:${install_path}/atc/python/site-packages/topi:$PYTHONPATH'\
>>~/.bashrc
echo 'export LD_LIBRARY_PATH=${install_path}/atc/lib64:$LD_LIBRARY_PATH'\
>>~/.bashrc
echo 'export ASCEND_OPP_PATH=${install_path}/opp'\
>>~/.bashrc
}
function check_network()
{
echo "check network ..."
local pingres=`ping -c 1 baidu.com | sed -n '/64 bytes from/p'`
if [ -z "$pingres" ]
then
echo "network error..."
else
echo "check network ok..."
fi
}
function check_gcc_version()
{
gcc_version=`gcc -dumpversion`
gcc_num=(${gcc_version//./ })
#${gcc_num[@]}
gcc_num=${gcc_num[0]}
}
function add_HwHiAiUser()
{
clear_display add_HwHiAiUser
echo "你想要创建一个 HwHiAiUser用户, 和HwHiAiUser用户组吗?"
echo "#注意:如果你已经创建过HwHiAiUser用户,可以输入no.当然你也可以重复创建,会删除原HwHiAiUser的权限,重新修改HwHiAiUser用户为ALL权限"
echo "如果你想问我是否可以不用创建HwHiAiUser用户,虽然可以但不推荐,因为后面使用某些功能的时候可能会报错哦!"
echo "请输入yes or no ?:"
if [[ $add_HwHiAiUser_set -ne -1 ]]
then
REPLACE=$add_HwHiAiUser_set
else
input_choose
fi
if [[ $REPLACE == "yes" ]]
then
echo "Start groupadd HwHiAiUser"
groupadd HwHiAiUser
sudo useradd -g HwHiAiUser -d /home/HwHiAiUser -m HwHiAiUser
sudo chmod u+w /etc/sudoers
#ucmd="HwHiAiUser ALL=(ALL:ALL) NOPASSWD:SETENV:/usr/bin/apt-get, /usr/bin/pip, /bin/tar, /bin/mkdir, /bin/rm, /bin/sh, /bin/cp, /bin/bash, /usr/bin/make install, /bin/ln -s /usr/local/python3.7.5/bin/python3 /usr/bin/python3.7, /bin/ln -s /usr/local/python3.7.5/bin/pip3 /usr/bin/pip3.7, /bin/ln -s /usr/local/python3.7.5/bin/python3 /usr/bin/python3.7.5, /bin/ln -s /usr/local/python3.7.5/bin/pip3 /usr/bin/pip3.7.5, /usr/bin/unzip"
sudo sed -i '/ HwHiAiUser /d' /etc/sudoers
#sed -i '/# User privilege specification/a\ HwHiAiUser ALL=(ALL:ALL) NOPASSWD:SETENV:/usr/bin/apt-get, /usr/bin/pip, /bin/tar, /bin/mkdir, /bin/rm, /bin/sh, /bin/cp, /bin/bash, /usr/bin/make install, /bin/ln -s /usr/local/python3.7.5/bin/python3 /usr/bin/python3.7, /bin/ln -s /usr/local/python3.7.5/bin/pip3 /usr/bin/pip3.7, /bin/ln -s /usr/local/python3.7.5/bin/python3 /usr/bin/python3.7.5, /bin/ln -s /usr/local/python3.7.5/bin/pip3 /usr/bin/pip3.7.5, /usr/bin/unzip' /etc/sudoers
sudo sed -i '/root ALL=(ALL)/a\ HwHiAiUser ALL=(ALL:ALL) ALL ' /etc/sudoers
sudo chmod u-w /etc/sudoers
echo "success groupadd HwHiAiUser"
else
echo "not need add HwHiAiUser"
fi
}
function atlas_Inf_or_Tra()
{
echo "############################"
echo "请选择推理环境 还是 训练环境"
echo "NPU_IorT: 'Inf' or 'Tra' "
echo "0: 推理环境"
echo "1: 训练环境"
echo "b:跳过 "
if [[ $atlas_Inf_or_Tra_set -ne -1 ]]
then
NPU_IorT_num=$atlas_Inf_or_Tra_set
else
num_choose=0
input_num_choose 1
NPU_IorT_num=$num_choose
fi
case $NPU_IorT_num in
[0])
echo "我选择推理环境"
NPU_IorT="Inf"
;;
[1])
echo "我选择训练环境"
NPU_IorT="Tra"
;;
[b])
echo "我不在乎推理还是训练,默认为选择推理"
NPU_IorT="Inf"
;;
*)
echo "Input error, should be [0-2]."
exit 1
esac
}
function clear_display()
{
if [[ set_clear -eq 1 ]]
then
clear
fi
Display_current_path
echo "########################$1########################"
}
function Install_Tool_Atlas()
{
clear_display Install_Tool_Atlas
Atlas_install_sh_path=$current_path
echo "Atlas_install_sh_path is $current_path !"
echo "这是一个Atlas IDE 快速安装工具"
echo " #我们致力于带给你极致的体验与使用快乐!"
echo "正在给当前目录文件添加权限"
chmod +x -R *
NPU_IorT="Inf"
check_OS
add_HwHiAiUser
#check_network
Use_os_pack
install_Python
install_Atlas_IDE
#add_cann_env
}
function main()
{
clear_display main
echo "在脚本的配置菜单My_SET Config中 #set_log# = $set_log.若想修改选项,请编辑此脚本的My_SET Config栏中的set_log"
if [[ $set_log == 1 ]]
then
T1=`date +%Y%m%d`
echo "date: $T1"
F_Log="$current_path/Install_Tool_Atlas_$T1.log"
echo "Create the $F_Log"
touch $F_Log
Install_Tool_Atlas 2>&1 | tee $F_Log
else
Install_Tool_Atlas
fi
}
#########Atlas_Istall_Tool 的脚本函数################
#My_SET Config
# Install_Tool_Atlas
# clear_display
# atlas_Inf_or_Tra
# add_HwHiAiUser
# check_gcc_version
# check_network
# add_cann_env
# install_A9000
# install_A9000_nnae
# install_A9000_cann
# install_A9000_driv
# install_A300
# install_A300_nnrt
# install_A300_cann
# install_A300_driv
# install_Atlas_IDE
# Display_current_path
# choose_Atlas_version
# install_Python
# install_pip_IDE
# install_python3.7_IDE
# Use_os_pack
# input_num_choose
# input_choose
# check_OS
#####################################################
#待完善功能,
#1.增加回调的退出机制,避免重复进入。
#2.增加远程执行脚本
#3.增加同一设备上拉取不同系统软件包
#启动
main
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。