This commit is contained in:
chen68
2020-08-13 18:51:48 -07:00
parent 327bfaaf7a
commit 5d5308a6ed
8 changed files with 193 additions and 124 deletions
+40 -14
View File
@@ -1,23 +1,49 @@
# faster install # Ubuntu18.04开发环境快速安装脚本
## 说明 #### 介绍
faster install,开发环境快速安装脚本。建议新建虚拟机运行该脚本 该脚本适用于Ubuntu18.04操作系统,可以快速安装C7x的开发环境,包括Python环境与MindStudio
#### 使用前准备
1、Ubuntu18.04版本的虚拟机。
## 使用步骤 2、到网站(https://www.huaweicloud.com/ascend/resource/Software )下载用于安装MindStudio的Toolkit包,名字为Ascend-Toolkit-[version]-x86_64-linux_gcc7.3.0.run、Ascend-Toolkit-[version]-arm-linux_gcc7.3.0.run,将两个包放于$HOME目录下。
1. 下载仓内的faster_install脚本到普通用户的家目录中,保持文件名为faster_install.sh。
2. 运行以下命令,执行脚本安装开发环境。 3、自行配置下载源。(以下给出一种配置源的方法)
**bash faster_install.bash** (1)点击左边如下图“步骤1”中的图标。
![](img/pic1.png "步骤1")
出现以下提示,请分别填写**Y**,下载相应软件包 2)点击图“步骤2”中上方红色框图标
![](img/pic2.png "步骤1")
[INFO] can not find mindstudio.tar.gz in /home/test,Do you want download[Y/N]: Y (3)勾选图“步骤3”中的第5个选项,并选择other选项。
[INFO] can not find Ascend-Toolkit-20.0.RC1-arm64-linux_gcc7.3.0.run in /home/test, Do you want download[Y/N]: Y ![](img/pic3.png "步骤1")
[INFO] can not find Ascend-Toolkit-20.0.RC1-x86_64-linux_gcc7.3.0.run in /home/test, Do you want download[Y/N]: Y
完成后会自动下载软件包并安装相关依赖,由网络决定耗时,正常网络下约耗时40分钟 4)如图选择你所需要的源
![](img/pic4.png "步骤1")
安装完成后会自动打开Mindstudio。 #### 使用方法
![Mindstudio](https://images.gitee.com/uploads/images/2020/0810/174052_91495667_5395865.png "屏幕截图.png") 1、下载快速安装脚本。Ubuntu服务器的命令行中执行以下命令进入$HOME目录。
cd $HOME
命令行中使用以下命令下载faster-install脚本。
git clone
将faster-install目录下的faster-install.sh脚本拷贝到$HOME目录下。
cp ~/faster-install/faster-install.sh .
执行脚本。
bash faster-install.sh
2、安装完成之后会显示以下界面。点击界面中的红色框内的选项。
![](img/pic5.png "界面1")
3、选择下图中的选项,点OK即可。
![](img/pic6.png "界面2")
4、此时会自动关闭MindStudio,重新启动MindStudio即可。到此C7x开发环境安装完成。
+87 -44
View File
@@ -1,23 +1,54 @@
#!/bin/bash #!/bin/bash
main() main()
{ {
sudo apt-get update
if [[ $? -ne 0 ]];then
echo "Update failed.Please check the network."
return 1
fi
read -p "Is this Ubuntu18.04? This script is only available for Ubuntu18.04. If not, please change the script or Ubuntu version. [Y/N]" response
if [ $response"z" = "Nz" ] || [ $response"z" = "nz" ]; then
echo "Exit installation"
return 1
elif [ $response"z" = "Yz" ] || [ $response"z" = "yz" ] || [ $response"z" = "z" ]; then
echo "To be continue."
else
echo "[ERROR] Please input Y/N!"
return 1
fi
mt=`free | tr [:blank:] \\\n | grep [0-9] | sed -n '1p'`
mx=`expr $mt \/ 1024 \/ 1024 + 1`
echo "linux memory is $mx G"
if [ $mx \< 4 ]; then
echo "Linux Mem < 4G, please add mem for using MindStudio."
echo "Exit installation"
return 1
else
echo "Memory is enough. To be continue."
fi
max_num=4
df_num=`df -h |grep /dev/sda1|awk -F'[ G]+' '{print $4}'`
echo "linux space is $df_num G"
if [ $df_num -le $max_num ]; then
echo "Space is not enough, please manually release space to download mindstudio and toolkit."
echo "Exit installation"
return 1
else
echo "Space is enough. To be continue."
fi
echo "The C73 development environment is about to be installed." echo "The C73 development environment is about to be installed."
echo "ubuntu : 18.04" echo "ubuntu : 18.04"
echo "MindStudio: 2.3.3" echo "MindStudio: 2.3.3"
echo "Toolkit: 20.0.RC1"
sudo apt-get update
if [[ $? -ne 0 ]];then
echo "[ERROR] Please check if the network is connected or Check if the sources in /etc/apt/sources.list are available"
return 1
fi
C73_flag=`find $HOME -maxdepth 1 -name "MindStudio-ubuntu" 2> /dev/null` C73_flag=`find $HOME -maxdepth 1 -name "MindStudio-ubuntu" 2> /dev/null`
if [[ $C73_flag ]];then if [[ $C73_flag ]];then
read -p "[INFO] The Mindstudio is existence.Do you want to re-install ? [Y/N]: " response read -p "[INFO] The Mindstudio is existence.Do you want to re-install ? [Y/N]: " response
if [ $response"z" = "Nz" ] || [ $response"z" = "nz" ]; then if [ $response"z" = "Nz" ] || [ $response"z" = "nz" ]; then
echo "Exit installation" echo "To be continue."
return 1
elif [ $response"z" = "Yz" ] || [ $response"z" = "yz" ] || [ $response"z" = "z" ]; then elif [ $response"z" = "Yz" ] || [ $response"z" = "yz" ] || [ $response"z" = "z" ]; then
rm -rf MindStudio-ubuntu rm -rf MindStudio-ubuntu
else else
@@ -28,7 +59,7 @@ main()
package_flag=`find $HOME -maxdepth 1 -name "mindstudio.tar.gz" 2> /dev/null` package_flag=`find $HOME -maxdepth 1 -name "mindstudio.tar.gz" 2> /dev/null`
if [[ ! $package_flag ]];then if [[ ! $package_flag ]];then
read -p "[INFO] can not find mindstudio.tar.gz in $HOME,Do you want download[Y/N]: " response read -p "[INFO] Can not find mindstudio.tar.gz in $HOME,Do you want download[Y/N]: " response
if [ $response"z" = "Nz" ] || [ $response"z" = "nz" ]; then if [ $response"z" = "Nz" ] || [ $response"z" = "nz" ]; then
echo "Exit installation" echo "Exit installation"
return 1 return 1
@@ -40,32 +71,32 @@ main()
fi fi
fi fi
TOOLKIT_flag_arm64=`find $HOME -maxdepth 1 -name "Ascend-Toolkit-20.0.RC1-arm64-linux_gcc7.3.0.run" 2> /dev/null` TOOLKIT_flag=`find ~/Ascend/ascend-toolkit/ -name "20.0.*" 2> /dev/null`
if [[ ! $TOOLKIT_flag ]];then
TOOLKIT_flag_arm64=`find $HOME -maxdepth 1 -name "Ascend-Toolkit-*-arm64-linux_gcc7.3.0.run" 2> /dev/null`
if [[ ! $TOOLKIT_flag_arm64 ]];then if [[ ! $TOOLKIT_flag_arm64 ]];then
read -p "[INFO] can not find Ascend-Toolkit-20.0.RC1-arm64-linux_gcc7.3.0.run in $HOME, Do you want download[Y/N]: " response echo "[Error]:Can not find the Ascend-Toolkit-[version]-arm64-linux_gcc7.3.0.run package, please go to the official website to download the Toolkit installation package you need."
if [ $response"z" = "Nz" ] || [ $response"z" = "nz" ]; then echo "Exit installation."
echo "Exit installation"
return 1 return 1
elif [ $response"z" = "Yz" ] || [ $response"z" = "yz" ] || [ $response"z" = "z" ]; then
TOOLKIT_arm64_Download="YES"
else else
echo "[ERROR] Please input Y/N!" TOOLKIT_arm64="YES"
fi
TOOLKIT_flag_x86_64=`find $HOME -maxdepth 1 -name "Ascend-Toolkit-*-x86_64-linux_gcc7.3.0.run" 2> /dev/null`
if [[ ! $TOOLKIT_flag_x86_64 ]];then
echo "[Error]:Can not find the Ascend-Toolkit-[version]-x86_64-linux_gcc7.3.0.run package, please go to the official website to download the Toolkit installation package you need."
echo "Exit installation."
return 1 return 1
else
TOOLKIT_x86_64="YES"
fi fi
fi fi
TOOLKIT_flag_x86_64=`find $HOME -maxdepth 1 -name "Ascend-Toolkit-20.0.RC1-x86_64-linux_gcc7.3.0.run" 2> /dev/null` PiP_flag=`find / -maxdepth 3 -name "python3.7.5" 2> /dev/null`
if [[ ! $TOOLKIT_flag_x86 ]];then if [[ $PiP_flag ]];then
read -p "[INFO] can not find Ascend-Toolkit-20.0.RC1-x86_64-linux_gcc7.3.0.run in $HOME, Do you want download[Y/N]: " response echo "[INFO] the python3.7.5 is existence."
if [ $response"z" = "Nz" ] || [ $response"z" = "nz" ]; then
echo "Exit installation"
return 1
elif [ $response"z" = "Yz" ] || [ $response"z" = "yz" ] || [ $response"z" = "z" ]; then
TOOLKIT_x86_64_Download="YES"
else else
echo "[ERROR] Please input Y/N!" PiP_Download="YES"
return 1
fi
fi fi
if [[ $MIN_Download ]];then if [[ $MIN_Download ]];then
@@ -77,25 +108,28 @@ main()
fi fi
fi fi
if [[ $TOOLKIT_arm64_Download ]];then if [[ $TOOLKIT_arm64 ]];then
wget -O $HOME/Ascend-Toolkit-20.0.RC1-arm64-linux_gcc7.3.0.run "https://mindstudio--ddk.obs.cn-north-1.myhuaweicloud.com/C73B050/Ascend-Toolkit-20.0.RC1-arm64-linux_gcc7.3.0.run" --no-check-certificate find Ascend-Toolkit-*-arm64-linux_gcc7.3.0.run -exec chmod 777 {} \;
find Ascend-Toolkit-*-arm64-linux_gcc7.3.0.run -exec ./{} --install \;
if [ $? -ne 0 ];then if [ $? -ne 0 ];then
echo "ERROR: download failed, please check Network." echo "ERROR: install failed, please verify that the toolkit-arm64 package is installed."
rm -rf $HOME/Ascend-Toolkit-20.0.RC1-arm64-linux_gcc7.3.0.run rm -rf $HOME/Ascend-Toolkit-20.0.RC1-arm64-linux_gcc7.3.0.run
return 1 return 1
fi fi
fi fi
if [[ $TOOLKIT_x86_64_Download ]];then if [[ $TOOLKIT_x86_64 ]];then
wget -O $HOME/Ascend-Toolkit-20.0.RC1-x86_64-linux_gcc7.3.0.run "https://mindstudio--ddk.obs.cn-north-1.myhuaweicloud.com/C73B050/Ascend-Toolkit-20.0.RC1-x86_64-linux_gcc7.3.0.run" --no-check-certificate find Ascend-Toolkit-*-x86_64-linux_gcc7.3.0.run -exec chmod 777 {} \;
find Ascend-Toolkit-*-x86_64-linux_gcc7.3.0.run -exec ./{} --install \;
if [ $? -ne 0 ];then if [ $? -ne 0 ];then
echo "ERROR: download failed, please check Network." echo "ERROR: install failed, please verify that the toolkit-x86_64 package is installed."
rm -rf $HOME/Ascend-Toolkit-20.0.RC1-x86_64-linux_gcc7.3.0.run rm -rf $HOME/Ascend-Toolkit-20.0.RC1-x86_64-linux_gcc7.3.0.run
return 1 return 1
else
Toolkit_bashrc_flag="YES"
fi fi
fi fi
sudo apt-get install -y gcc g++ make cmake unzip zlib1g zlib1g-dev libsqlite3-dev openssl libssl-dev libffi-dev pciutils net-tools sudo apt-get install -y gcc g++ make cmake unzip zlib1g zlib1g-dev libsqlite3-dev openssl libssl-dev libffi-dev pciutils net-tools
if [ $? -ne 0 ];then if [ $? -ne 0 ];then
echo "[ERROR]: install failed, please check Network." echo "[ERROR]: install failed, please check Network."
@@ -126,6 +160,7 @@ main()
return 1 return 1
fi fi
if [[ $PiP_Download ]];then
cd $HOME cd $HOME
mkdir .pip mkdir .pip
touch .pip/pip.conf touch .pip/pip.conf
@@ -133,6 +168,7 @@ main()
echo "trusted-host = mirrors.aliyun.com" >> .pip/pip.conf echo "trusted-host = mirrors.aliyun.com" >> .pip/pip.conf
echo "index-url = http://mirrors.aliyun.com/pypi/simple/" >> .pip/pip.conf echo "index-url = http://mirrors.aliyun.com/pypi/simple/" >> .pip/pip.conf
find ~/Python-3.7.5.tgz -exec rm -rf {} \;
wget https://www.python.org/ftp/python/3.7.5/Python-3.7.5.tgz wget https://www.python.org/ftp/python/3.7.5/Python-3.7.5.tgz
if [ $? -ne 0 ];then if [ $? -ne 0 ];then
echo "[ERROR]: install failed, please check Network." echo "[ERROR]: install failed, please check Network."
@@ -169,22 +205,29 @@ main()
pip3.7.5 install tensorflow==1.15 --user pip3.7.5 install tensorflow==1.15 --user
pip3.7.5 install pylint --user pip3.7.5 install pylint --user
pip3.7.5 install tornado==5.1.0 --user pip3.7.5 install tornado==5.1.0 --user
Pip_bashrc_flag="YES"
fi
cd $HOME cd ~
chmod 777 Ascend-Toolkit-20.0.RC1-arm64-linux_gcc7.3.0.run
chmod 777 Ascend-Toolkit-20.0.RC1-x86_64-linux_gcc7.3.0.run
./Ascend-Toolkit-20.0.RC1-arm64-linux_gcc7.3.0.run --install
./Ascend-Toolkit-20.0.RC1-x86_64-linux_gcc7.3.0.run --install
tar zxvf mindstudio.tar.gz tar zxvf mindstudio.tar.gz
echo "export install_path=${HOME}/Ascend/ascend-toolkit/20.0.RC1" >> ~/.bashrc if [[ $Min_bashrc_flag ]];then
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 LD_LIBRARY_PATH=${install_path}/atc/lib64:$LD_LIBRARY_PATH" >> ~/.bashrc
echo "export ASCEND_OPP_PATH=${install_path}/opp" >> ~/.bashrc echo "export ASCEND_OPP_PATH=${install_path}/opp" >> ~/.bashrc
fi
if [[ $Toolkit_bashrc_flag ]];then
find ~/Ascend/ascend-toolkit/ -name "20.0.*" -exec echo "export install_path={}" >> ~/.bashrc \;
fi
if [[ $Pip_bashrc_flag ]];then
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
fi
source ~/.bashrc source ~/.bashrc
echo "The C73 environment was successfully deployed, with MindStudio version 2.3.3 and Toolkit version 20.0.RC1" echo "The C73 environment was successfully deployed, with MindStudio version 2.3.3"
echo "MindStudio is about to open." echo "MindStudio is about to open."
bash $HOME/MindStudio-ubuntu/bin/MindStudio.sh bash $HOME/MindStudio-ubuntu/bin/MindStudio.sh
Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB