怎么允许宏(excel如何允许宏)
1661
2022-05-29
1 前提准备
基于华为Ascend处理器开发AI应用程序,一般需要搭建开发环境和运行环境。这里我们基于在非昇腾设备上(X86架构的PC)安装CANN开发环境。非昇腾AI设备无需安装固件(NPU)与驱动(driver),仅能用于代码开发、编译等不依赖于昇腾设备的开发活动。非昇腾AI设备开发环境示意图如下所示:
其中的Linux 操作系统的安装是基于Vitual Box虚拟机进行安装的,可以参考之前的博文《VitualBox安装Ubuntu并安装增强功能》。由图可知,CANN toolkit依赖性于Linux OS依赖项,如Python3.7等。因此,首先需要安装OS依赖项,这里我们选用Ubuntu18.04,关于依赖性安装可以参考之前的博客《Ubuntu安装CANN相关依赖》。本文重点在于介绍如何安装CANN toolkit。
2 CANN toolkit安装
在基础Linux环境搭建完成后,需要登录华为相关网站(下载软件有权限要求,否则可能无法下载),并获取相关权限后,首先可以在Windows操作系统上下载两种架构(x86和aarch64)的CANN toolkit开发套件包Ascend-cann-toolkit_xxx.run 。例如本次安装的版本为CANN 5.0.2 (版本需要和其他软硬件匹配,比如MindStudio 3.0.2 匹配CANN 5.0.2):
Ascend-cann-toolkit_5.0.2.1_linux-aarch64.run
Ascend-cann-toolkit_5.0.2.1_linux-x86_64.run
注意:若开发环境为x86_64架构,运行环境为aarch64架构,开发环境上需同时部署x86_64和aarch64架构的开发套件,后续编译应用时需要调用aarch64架构开发套件的ACLlib库。另外,安装CANN toolkit开发套件包前请确保安装目录可用空间大于7G 。
这里为了方便从Windows操作系统和虚拟机直接传递文件,可以在Vitual Box中设置共享文件夹,示意图如下:
另外,就需要将文件下载到C:\share_folder 共享文件中,示意图如下:
此时启动虚拟机Ubuntu后,可以通过命令行访问共享文件夹中的文件,下面首先切换到root用户进行CANN安装。示意图如下:
然后打开终端命令行,执行如下命令进行CANN toolkit安装:
jack@jack-pc:~$ su root Password: root@jack-pc:/home/jack# cd /media/sf_share_folder/ #设置可执行权限 chmod +x Ascend-cann-toolkit_5.0.2.1_linux-x86_64.run chmod +x Ascend-cann-toolkit_5.0.2.1_linux-aarch64.run #安装 ./Ascend-cann-toolkit_5.0.2.1_linux-x86_64.run --install ./Ascend-cann-toolkit_5.0.2.1_linux-aarch64.run --install
输出过程示意如下:
Verifying archive integrity... 100% SHA256 checksums are OK. All good.
Uncompressing ASCEND_RUN_PACKAGE 100%
[Toolkit] [20211113-19:52:13] [INFO] mkdir /usr/local/Ascend/ascend-toolkit/5.0.2.1/x86_64-linux
[Toolkit] [20211113-19:52:14] [INFO] mkdir /var/log/ascend_seclog/
[Toolkit] [20211113-19:52:14] [INFO] touch /var/log/ascend_seclog/ascend_toolkit_install.log
[Toolkit] [20211113-19:52:14] [INFO] LogFile:/var/log/ascend_seclog/ascend_toolkit_install.log
[Toolkit] [20211113-19:52:14] [INFO] install start
[Toolkit] [20211113-19:52:14] [INFO] The install path is /usr/local/Ascend !
[Toolkit] [20211113-19:52:14] [WARNING] driver package maybe not installed
[Toolkit] [20211113-19:52:14] [WARNING] driver package maybe not installed
[Toolkit] [20211113-19:52:15] [INFO] install package Ascend-acllib-1.78.23.34.230-linux.x86_64.run start
[Toolkit] [20211113-19:52:26] [INFO] Ascend-acllib-1.78.23.34.230-linux.x86_64.run --devel --quiet --nox11 install success
[Toolkit] [20211113-19:52:26] [INFO] install package Ascend-pyACL-5.0.2.1-linux.x86_64.run start
[Toolkit] [20211113-19:52:29] [INFO] Ascend-pyACL-5.0.2.1-linux.x86_64.run --devel --quiet --nox11 install success
[Toolkit] [20211113-19:52:29] [INFO] install package Ascend-atc-1.78.23.34.230-linux.x86_64.run start
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
[Toolkit] [20211113-19:54:26] [INFO] Ascend-atc-1.78.23.34.230-linux.x86_64.run --devel --pylocal --quiet --nox11 install success
[Toolkit] [20211113-19:54:26] [INFO] install package Ascend-opp-1.78.23.34.230-linux.x86_64.run start
[Toolkit] [20211113-19:56:21] [INFO] Ascend-opp-1.78.23.34.230-linux.x86_64.run --devel --quiet --nox11 install success
[Toolkit] [20211113-19:56:23] [INFO] install package Ascend-toolkit-1.78.23.34.230-linux.x86_64.run start
[Toolkit] [20211113-19:59:14] [INFO] Ascend-toolkit-1.78.23.34.230-linux.x86_64.run --devel --pylocal --quiet --nox11 install success
[Toolkit] [20211113-19:59:14] [INFO] install package Ascend310-aicpu_kernels-1.78.23.34.230.run start
[Toolkit] [20211113-19:59:15] [INFO] Ascend310-aicpu_kernels-1.78.23.34.230.run --devel --quiet --nox11 install success
[Toolkit] [20211113-19:59:15] [INFO] install package Ascend910-aicpu_kernels-1.78.23.34.230.run start
[Toolkit] [20211113-19:59:17] [INFO] Ascend910-aicpu_kernels-1.78.23.34.230.run --devel --quiet --nox11 install success
[Toolkit] [20211113-19:59:17] [INFO] install package Ascend710-aicpu_kernels-1.78.23.34.230.run start
[Toolkit] [20211113-19:59:18] [INFO] Ascend710-aicpu_kernels-1.78.23.34.230.run --devel --quiet --nox11 install success
[Toolkit] [20211113-19:59:18] [INFO] install package Ascend310-aicpu_kernels_minirc-1.78.23.34.230.run start
[Toolkit] [20211113-19:59:20] [INFO] Ascend310-aicpu_kernels_minirc-1.78.23.34.230.run --devel --quiet --nox11 install success
[Toolkit] [20211113-19:59:20] [INFO] install package Ascend-test-ops-5.0.2.1.run start
[Toolkit] [20211113-19:59:20] [INFO] Ascend-test-ops-5.0.2.1.run --full --quiet --nox11 install success
[Toolkit] [20211113-19:59:20] [INFO] /etc/Ascend/ascend_cann_install.info generate success
[Toolkit] [20211113-19:59:20] [INFO] Please make sure that:
Offline infer develop (cannot coexist with other scenes):
LD_LIBRARY_PATH includes :
/usr/local/Ascend/ascend-toolkit/latest/acllib/lib64:
PYTHONPATH includes :
/usr/local/Ascend/ascend-toolkit/latest/pyACL/python/site-packages/acl:
/usr/local/Ascend/ascend-toolkit/latest/toolkit/python/site-packages:
ASCEND_AICPU_PATH includes :
/usr/local/Ascend/ascend-toolkit/latest:
ASCEND_OPP_PATH includes :
/usr/local/Ascend/ascend-toolkit/latest/opp:
TOOLCHAIN_HOME includes :
/usr/local/Ascend/ascend-toolkit/latest/toolkit:
Third party AI framework develop (cannot coexist with other scenes):
PATH includes :
/usr/local/Ascend/ascend-toolkit/latest/fwkacllib/ccec_compiler/bin:
/usr/local/Ascend/ascend-toolkit/latest/fwkacllib/bin:
LD_LIBRARY_PATH includes :
/usr/local/Ascend/ascend-toolkit/latest/fwkacllib/lib64:
PYTHONPATH includes :
/usr/local/Ascend/ascend-toolkit/latest/fwkacllib/python/site-packages:
/usr/local/Ascend/ascend-toolkit/latest/toolkit/python/site-packages:
ASCEND_OPP_PATH includes :
/usr/local/Ascend/ascend-toolkit/latest/opp:
ASCEND_AICPU_PATH includes :
/usr/local/Ascend/ascend-toolkit/latest:
TOOLCHAIN_HOME includes :
/usr/local/Ascend/ascend-toolkit/latest/toolkit:
Model transformation and operator develop (cannot coexist with other scenes):
PATH includes :
/usr/local/Ascend/ascend-toolkit/latest/atc/ccec_compiler/bin:
/usr/local/Ascend/ascend-toolkit/latest/atc/bin:
LD_LIBRARY_PATH includes :
/usr/local/Ascend/ascend-toolkit/latest/atc/lib64:
PYTHONPATH includes :
/usr/local/Ascend/ascend-toolkit/latest/atc/python/site-packages:
/usr/local/Ascend/ascend-toolkit/latest/toolkit/python/site-packages:
ASCEND_OPP_PATH includes :
/usr/local/Ascend/ascend-toolkit/latest/opp:
TOOLCHAIN_HOME includes :
/usr/local/Ascend/ascend-toolkit/latest/toolkit:
[Toolkit] [20211113-19:59:20] [INFO] If your service is started using the shell script, you can call the /usr/local/Ascend/ascend-toolkit/set_env.sh script to configure environment variables. Note that this script can not be executed mannually.
[Toolkit] [20211113-19:59:21] [INFO] Ascend-cann-toolkit_5.0.2.1_linux-x86_64 install success,The install path is /usr/local/Ascend !
下面可以到安装的目录中 /usr/local/Ascend进行查看,命令如下:
jack@jack-pc:/usr/local/Ascend/ascend-toolkit/5.0.2.1$ cd ~ jack@jack-pc:~$ cd /usr/local/Ascend/ jack@jack-pc:/usr/local/Ascend$ ls ascend-toolkit jack@jack-pc:/usr/local/Ascend$ cd ascend-toolkit/ jack@jack-pc:/usr/local/Ascend/ascend-toolkit$ ls 5.0 5.0.2.1 latest set_env.sh jack@jack-pc:/usr/local/Ascend/ascend-toolkit$ cd latest jack@jack-pc:/usr/local/Ascend/ascend-toolkit/latest$ ls acllib arm64-linux opp_linux.arm64 python tools acllib_linux.arm64 atc opp_linux.x86_64 targets var acllib_linux.x86_64 opp pyACL toolkit x86_64-linux jack@jack-pc:/usr/local/Ascend/ascend-toolkit/latest$
示意图如下所示:
3 配置交叉编译环境
最后,对于Atlas 200 AI加速模块 (RC场景)和Atlas 500 小站(运行环境aarch64架构)来说,当开发环境是一台X86 PC进行环境搭建时,需要在开发环境中安装交叉编译工具,具体命令如下:
#检查是否安装 aarch64-linux-gnu-g++ --version #安装(root) apt-get install g++-aarch64-linux-gnu
安装成功后,再次验证,执行如下命令:
root@jack-pc:/home/jack# aarch64-linux-gnu-g++ --version aarch64-linux-gnu-g++ (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04) 7.5.0 Copyright (C) 2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
具体CANN更多安装细节文档,可以参考官网 https://support.huawei.com/enterprise/zh/doc/EDOC1100206656/4f20a9ed 。
AI平台 Atlas 200 DK开发者套件 Linux Ubuntu
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。