• No results found

CANN Software Installation Guide (A , A500 Pro-3000)

N/A
N/A
Protected

Academic year: 2021

Share "CANN Software Installation Guide (A , A500 Pro-3000)"

Copied!
82
0
0

Loading.... (view fulltext now)

Full text

(1)

CANN Software Installation Guide

(A200-3000, A500 Pro-3000)

Issue 01

(2)

No part of this document may be reproduced or transmitted in any form or by any means without prior written consent of Huawei Technologies Co., Ltd.

Trademarks and Permissions

and other Huawei trademarks are trademarks of Huawei Technologies Co., Ltd.

All other trademarks and trade names mentioned in this document are the property of their respective holders.

Notice

The purchased products, services and features are stipulated by the contract made between Huawei and the customer. All or part of the products, services and features described in this document may not be within the purchase scope or the usage scope. Unless otherwise specified in the contract, all statements, information, and recommendations in this document are provided "AS IS" without warranties, guarantees or representations of any kind, either express or implied.

The information in this document is subject to change without notice. Every effort has been made in the preparation of this document to ensure accuracy of the contents, but all statements, information, and recommendations in this document do not constitute a warranty of any kind, express or implied.

(3)

Contents

1 Installation Precautions... 1

2 Hardware Requirements... 3

2.1 Atlas 200 AI Accelerator Module (Model 3000)...3

2.2 Atlas 500 Pro AI Edge Server (Model 3000)... 4

3 Installing the Development Environment... 5

3.1 Before You Start... 5

3.2 Obtaining Software Packages... 6

3.3 Preparations for Installation... 8

3.3.1 CentOS (ARM)... 8

3.3.2 Ubuntu (ARM)... 14

3.3.3 Ubuntu (x86)... 20

3.4 Pure Development... 26

3.4.1 Installing the Development Kit... 26

3.5 Development + Commissioning... 28

3.5.1 Installing the Ascend AI Device Driver and Firmware... 28

3.5.2 Installing the Development Kit... 29

3.6 Performing Post-installation Operations... 32

4 Installing the Operating Environment... 35

4.1 Obtaining Software Packages...35

4.2 Installation on a Physical Machine... 37

4.2.1 Preparations for Installation... 38

4.2.2 Installing the Ascend AI Device Driver and Firmware... 39

4.2.3 Installing the Inference Software... 40

4.2.4 Performing Post-installation Operations...43

4.3 Installation in a Container... 44

4.3.1 Installing the Inference Card Driver and Firmware and Upgrading the MCU on the Host...45

4.3.2 Installing the Toolbox on the Host... 46

4.3.3 Installing Ascend Docker on the Host... 46

4.3.4 Creating an Inference Container Image... 47

4.3.5 Starting and Verifying a Container Image...53

5 Common Operations... 56

(4)

5.2 Configuring a System Network Proxy...59

5.3 Installing CMake 3.5.2... 59

5.4 Uninstalling the CANN Software...60

5.5 Setting User Account Validity Period... 61

5.6 Performing Fault Diagnostics... 62

5.7 Performing a Software and Hardware Compatibility Test...65

6 FAQs...69

6.1 What Do I Do If the "Software Has Been Installed" During RUN Package Installation?... 69

6.2 pip3.7.5 install numpy Error... 69

6.3 The error message "subprocess.CalledProcessError: Command '('lsb_release', '-a')' return non-zero exit status 1 " is displayed during pip3.7.5 installation...70

6.4 What Do I Do If "Could not find a version that satisfies the requirement xxx" Is Displayed When pip3.7.5 install Is Run?...71

7 Reference...73

7.1 Parameters... 73

7.2 Default Mounted Contents of Ascend Docker Runtime... 75

7.3 About CCEC Compiler... 76

7.4 HCC Overview... 77

(5)

1

Installation Precautions

Development Environment

The development environment is used to convert model files, develop and compile applications, and develop operators.

If you need to debug an application (for example, an image classification application) in the development environment in addition to developing and compiling the application, you need to configure Ascend AI devices (such as inference cards or AI accelerator modules) in the development environment. The pure development environment requires only the development kit to be installed.

In the development + commissioning scenario, you also need to install the driver and firmware corresponding to the inference card or AI accelerator module.

Operating Environment

The operating environment is an environment for running applications developed by users. The operating environment must be configured with Ascend AI devices (such as inference cards or AI accelerator modules). Applications depend on the offline inference engine package, Toolbox, driver, and firmware to perform offline accelerated inference.

The operating environment includes the following two scenarios:

● Physical machine scenario: The inference card driver, firmware, offline inference engine package, and Toolbox are installed on a physical machine. Applications developed by users run on the physical machine.

● In the container scenario, you need to install Docker.

a. The inference card driver, firmware, and Toolbox are installed on a host. b. The offline inference engine package, user-developed applications, and

basic container images are encapsulated into a service inference image. c. In the operating environment, the image is used to start the containers.

(6)

NO TE

If the configured Ascend AI device is an Atlas 200 AI accelerator module (model 3000), the application operating environment supports only physical machines.

(7)

2

Hardware Requirements

2.1 Atlas 200 AI Accelerator Module (Model 3000) 2.2 Atlas 500 Pro AI Edge Server (Model 3000)

2.1 Atlas 200 AI Accelerator Module (Model 3000)

Before installing the development and operating environments, you need to prepare the hardware environment based on the scenario.

Scenario Hardware

Development

environment General-purpose server

Development and commissioning environment

Inference devices with Atlas 200 AI accelerator module (model 3000)

Operating environment

Table 2-1 Supported OSs

OS Version How to Obtain

Ubuntu OS version: Ubuntu 18.04.1

OS architecture: x86

Official Ubuntu website

Download the recommended version ubuntu-18.04.1-server-amd64.iso from

http://old-releases.ubuntu.com/releases/ 18.04.1/.

(8)

2.2 Atlas 500 Pro AI Edge Server (Model 3000)

Before installing the development and operating environments, you need to prepare the hardware environment based on the scenario.

Scenario Hardware Description

Development

environment General-purpose server -Development

and

commissioning environment

Atlas 500 Pro AI edge

server (model 3000) For details about how to installthe server, set basic server parameters, and install the OS, see the Atlas 500 Pro AI Edge Server User Guide (Model 3000). After the OS is installed, configure an IP address for the service network port. For details, see 5.1 Configuring the NIC IP Address.

Operating environment

Table 2-2 Supported OSs

OS Version How to Obtain

Ubuntu OS version: Ubuntu

18.04.1

OS architecture: ARM

Official Ubuntu website

Download the recommended version ubuntu-18.04.1-server-arm64.iso from

http://old-releases.ubuntu.com/releases/ 18.04.1/.

CentOS OS version: CentOS

7.6

OS architecture: ARM

Official CentOS website

Download the recommended version

CentOS-7-aarch64-Everything-1810.iso from https:// archive.kernel.org/centos-vault/ altarch/7.6.1810/isos/aarch64/.

(9)

3

Installing the Development Environment

3.1 Before You Start

3.2 Obtaining Software Packages 3.3 Preparations for Installation 3.4 Pure Development

3.5 Development + Commissioning

3.6 Performing Post-installation Operations

3.1 Before You Start

● If the development environment is used only for model file conversion, application development and compilation, and operator development, the development environment can be a general-purpose server or a PC. In this case, you do not need to configure the Ascend AI device, and only need to install the development kit Ascend-cann-toolkit_

{version}_linux-{arch}_{gcc_version}.run). For details, see the following sections: a. 3.2 Obtaining Software Packages

b. 3.3 Preparations for Installation

c. 3.4 Pure Development

● In addition to converting model files, developing and compiling applications, and developing operators, you need to debug applications in the development environment (for example, debugging image classification applications in the development environment). In this case, you need to configure the Ascend AI device in the development environment and install the driver and firmware of the Ascend AI device, and development kit

(Ascend-cann-toolkit_{version}_linux-{arch}_{gcc_version}.run). For details, see the following sections:

a. 3.2 Obtaining Software Packages

b. 3.3 Preparations for Installation

(10)

3.2 Obtaining Software Packages

Downloading Software Packages

Before installing the software, obtain software packages and digital signature files based on the actual scenario. The versions of the software packages must be consistent.

● In the pure development scenario, only the development kit needs to be installed. For details, see Table 3-1.

● In the development + commissioning scenario, you need to install the driver firmware and development kit of the Ascend AI device. You can obtain the required software packages according to the following table.

Hardware Ascend AI Device How to Obtain

Atlas 500 Pro AI edge

server (model 3000) Atlas 300Iinference card (model 3000)

For details, see Table 3-1

and Table 3-2. Inference devices with

Atlas 200 AI accelerator module (model 3000)

Atlas 200 AI

accelerator module (model 3000)

For details, see Table 3-1

and Table 3-3.

Table 3-1 CANN software packages Packa

ge Type

Package Name Description How to

Obtain Devel opme nt kit Ascend-cann- toolkit_{version}_linux-{arch}_{gcc_version}.run

It is used for application development, operator customization, and model conversion. The

development kit contains the library files required for developing

applications and development auxiliary tools such as the Ascend Tensor Compiler (ATC) for model conversion.

(11)

Table 3-2 Atlas 300I inference card (model 3000) software packages Packag

e Type Package Name Description How toObtain

Driver packag e A300-3000-npu- driver_{version}_{os}-aarch64.run

Inference card driver installation package

NOTE

The npu-smi tool package is integrated in the driver package. The npu-smi tool is automatically installed during the driver installation.

Link Firmwa re packag e

A300-3000-npu-firmware_{version}.run Ascend firmwareinstallation package MCU packag e ● A300-3000-mcu_{version}.bin ● A300-3000-mcu_{version}.hpm

The MCU is an out-of-band management module of the Atlas 300 AI inference card to provide functions such as card monitoring and fault reporting. ● To upgrade the MCU

using the npu-smi tool, obtain the .bin MCU package.

● To upgrade the MCU using the iBMC, obtain the .hpm MCU package.

Table 3-3 Atlas 300I inference card (model 3010) software packages Packag

e Type Package Name Host OSVersion Description Howto Obtain Driver

packag e

A200-3000-npu-driver_{version}_{os}-X86_64.run Ubuntu18.04.1 Driverinstallati on package Link Firmwa re packag e A200-3000-npu-firmware_{version}.run Firmware installati on package

(12)

NO TE

{version} indicates the software version, {arch} indicates the processor architecture, and {os}

indicates the OS version. Obtain the software package based on the GCC version planned or deployed onsite. You can run the gcc --version command on the OS to query the GCC version. If the GCC version is earlier than 7.3.0, obtain the GCC 4.8.5 software package, if the GCC version is 7.3.0 or later, obtain the GCC 7.3.0 software package. The GCC versions of the software packages installed in the development environment and operating environment must be the same. Otherwise, the applications compiled in the development environment fail to run in the operating environment.

3.3 Preparations for Installation

3.3.1 CentOS (ARM)

Environment Requirements

The following software or dependencies need to be installed for the development kit, Python, auxiliary development tools, and application compilation.

Table 3-4 Dependency information

Parameter Version

Python 3.7.5

cmake 3.5.1+

protobuf 3.11.3+

numpy 1.13.3+

gcc You can run the gcc --version command on the OS to

query the GCC version. If the GCC version is earlier than 7.3.0, you can obtain the gcc4.8.5 development kit. If the gcc version is 7.3.0 or later, you can obtain the gcc7.3.0 development kit. The GCC versions of the software packages installed in the development environment and operating environment must be the same. Otherwise, the applications compiled in the development environment fail to run in the operating environment.

(13)

Parameter Version make unzip zlib-devel libffi-devel openssl-devel sqlite-devel blas-devel lapack-devel openblas-devel pciutils net-tools attrs psutil decorator scipy sympy cffi grpcio grpcio-tools requests

There is no version requirement. The version to be installed is subject to the source provided by the OS.

Check the umask of the root user.

1. Log in to the installation environment as the root user. 2. Check the umask value of the root user.

umask

3. If the umask value is not 0022, append "umask 0022" to the file and save the file:

vi ~/.bashrc source ~/.bashrc

Creating Installation and Running Users

Table 3-5 lists the users for installing and running the firmware and CANN software.

(14)

Table 3-5 Installation and running user list Package

Type Installation User Running User Driver and

firmware installation package

The user must be root. The user must be a non-root user.

CANN software package

The user can be root or non-root. For details, see the content below the table.

For installation as the root user:

After installation as the root user, you must switch to a non-root user for execution (the running user must not belong to the root user group). Therefore, you need to create a running user before the installation.

If the created user is HwHiAiUser, you can directly install the software packages as the HwHiAiUser user. The default installation user is HwHiAiUser.

If the created user is not HwHiAiUser, you need to specify the running user (by using the --install-username=user name

--install-usergroup=user group parameter) when installing the software package. Perform the following operations to create a user.

For installation as a non-root user:

In this scenario, the installation and running users must be the same. – If a non-root user exists, you do not need to create one.

– If you want to use a new non-root user, you need to create the user first. To create a non-root user, run the following commands as the root user:

1. Create a non-root user. groupadd usergroup

useradd -g usergroup -d /home/username -m username 2. Set the password of the non-root user.

passwd username NO TE

● If the CANN software package is installed by a non-root user, the owner group of the user must be the same as that of the driver running user. If they are different, add them to the Driver running user group.

● The created running user cannot belong to the root user group.

● After the HwHiAiUser user is created, do not disable the login authentication function of the user.

● The password validity period is 90 days. You can change the validity period in the /etc/

login.defs file or using the chage command. For details, see 5.5 Setting User Account Validity Period.

(15)

(Optional) Configuring the Permission of the Installation User

Skip the following part if you install as the root user.

Before installing the development kit, you need to download the dependencies, which require sudo yum permission. Run the following commands as the root user:

1. Open the /etc/sudoers file: chmod u+w /etc/sudoers

vi /etc/sudoers

2. Under root ALL=(ALL) ALL in the file, add the following content:

username ALL=(ALL:ALL) NOPASSWD:SETENV:/usr/bin/yum, /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

Replace username with the name of the common user who executes the installation script.

NO TE

Ensure that the last line of the /etc/sudoers file is #includedir /etc/sudoers.d. Otherwise, add it manually.

3. Run :wq! to save the file.

4. Run the following command to revoke the write permission on the /etc/ sudoers file:

chmod u-w /etc/sudoers

Setting the Source

Development kit installation requires the download of related dependencies. Ensure that the installation environment can be connected to the network. Run the following command as the root user to check whether the source is valid: yum makecache

If an error is reported during command execution or dependency installation, check whether the network connection is normal, or replace the source in the /etc/yum.repos.d/CentOS-Base.repo file with an available source or use an image source. For details about how to configure a network proxy, see 5.2 Configuring a System Network Proxy.

Installing Dependencies

NO TE

● If you install Python and its dependencies as the root user, perform Step 1 to Step 3. Note that the sudo keywords in the commands need to be deleted if any.

● If you install Python and its dependencies as a non-root user, run the su - username command to switch to the non-root user and perform Step 1 to Step 3.

Step 1 Check whether the Python dependencies and GCC software are installed. Run the following commands to check whether the dependencies such as GCC, Make, and Python are installed:

gcc --version gcc-c++ --version make --version

(16)

cmake --version rpm -qa|grep gcc-c++ rpm -qa |grep unzip rpm -qa |grep zlib-devel rpm -qa |grep libffi-devel rpm -qa |grep openssl-devel rpm -qa |grep sqlite-devel rpm -qa |grep blas-devel rpm -qa |grep lapack-devel rpm -qa |grep openblas-devel rpm -qa |grep pciutils rpm -qa |grep net-tools

If information similar to the following is displayed (the version number varies according to the actual OS), the tool has been installed. Go to the next step. gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39) gcc-c++-4.8.5 GNU Make 4.1 cmake version 3.5.1 unzip-6.0-21.el7.aarch64 zlib-devel-1.2.7-18.el7.aarch64 libffi-devel-3.0.13-18.el7.aarch64 openssl-devel-1.0.2k-19.el7.aarch64 sqlite-devel-3.7.17-8.el7_7.1.aarch64 blas-devel-3.4.2-8.el7.aarch64 lapack-devel-3.4.2-8.el7.aarch64 openblas-devel-0.3.3-2.el7.aarch64 pciutils-3.5.1-3.el7.aarch64 net-tools-2.0-0.24.20131004git.el7.aarch64

Otherwise, run the following command to install the software. You can change the following command to install only some of them as required.

sudo yum install -y gcc gcc-c++ make cmake unzip zlib-devel libffi-devel openssl-devel sqlite-devel blas-devel lapack-blas-devel openblas-blas-devel pciutils net-tools

In the preceding steps, if the error message "No package libopenblas available" is displayed during the installation of openblas-devel, you need to install the

extension package of the Linux enterprise edition and then install openblas-devel again. Run the following command to install the extension package:

sudo yum install epel-release

If the CMake version installed using the preceding method is earlier than 3.5.1, see

5.3 Installing CMake 3.5.2.

Step 2 Check whether the Python development environment is installed.

The development kit depends on the Python environment. Run the python3.7.5 --version and pip3.7.5 ----version commands to check whether Python has been installed. If the following information is displayed, Python has been installed. Go to the next step.

Python 3.7.5

pip 19.2.3 from /usr/local/python3.7.5/lib/python3.7/site-packages/pip (python 3.7) Otherwise, use the following procedure to install Python 3.7.5:

1. Run the wget command to download the source code package of Python 3.7.5 to any directory of the installation environment. The command is as follows:

wget https://www.python.org/ftp/python/3.7.5/Python-3.7.5.tgz

2. Run the following command to go to the download directory and decompress the source code package:

(17)

3. Go to the decompressed folder and run the following configuration, build, and installation commands:

cd Python-3.7.5

./configure --prefix=/usr/local/python3.7.5 --enable-shared make

sudo make install

The --prefix parameter specifies the Python installation path. You can change it based on the site requirements. The --enable-shared parameter is used to compile the libpython3.7m.so.1.0 dynamic library.

This document uses --prefix=/usr/local/python3.7.5 as an example. After the configuration, compilation, and installation commands are executed, the installation package is output to the /usr/local/python3.7.5 directory, and the libpython3.7m.so.1.0 dynamic library is output to the /usr/local/

python3.7.5/lib/libpython3.7m.so.1.0 directory.

4. Check whether libpython3.7m.so.1.0 exists in /usr/lib64 or /usr/lib. If yes, skip this step or back up the libpython3.7m.so.1.0 file provided by the system and run the following command:

Copy the compiled file libpython3.7m.so.1.0 to /usr/lib64: sudo cp /usr/local/python3.7.5/lib/libpython3.7m.so.1.0 /usr/lib64

When the following information is displayed, enter y to overwrite the libpython3.7m.so.1.0 file provided by the system.

cp: overwrite 'libpython3.7m.so.1.0'?y

If the /usr/lib64 directory does not exist in the environment, copy the file to the /usr/lib directory.

sudo cp /usr/local/python3.7.5/lib/libpython3.7m.so.1.0 /usr/lib

Replace the path of the libpython3.7m.so.1.0 file as required. 5. Run the following commands to set the soft link:

sudo ln -s /usr/local/python3.7.5/bin/python3 /usr/bin/python3.7 sudo ln -s /usr/local/python3.7.5/bin/pip3 /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/pip3 /usr/bin/pip3.7.5

If a message indicating that the link already exists is displayed during the command execution, run the following command to delete the existing link and run the command again:

sudo rm -rf /usr/bin/python3.7.5 sudo rm -rf /usr/bin/pip3.7.5 sudo rm -rf /usr/bin/python3.7 sudo rm -rf /usr/bin/pip3.7

6. After the installation is complete, run the following commands to check the installation version. If the required version information is displayed, the installation is successful.

python3.7.5 --version pip3.7.5 --version

Step 3 Install the Python 3 development environment.

Before the installation, run the pip3.7.5 list command to check whether the dependencies have been installed. If yes, skip this step. If not, run the following command to install the dependencies: (If only some of the software is not installed, modify the following command to install selected software only.) If you install Python and its dependencies as a non-root user, add --user at the end of each command in this step to ensure that the installation is successful. Example command: pip3.7.5 install attrs --user

(18)

pip3.7.5 install attrs pip3.7.5 install psutil pip3.7.5 install decorator pip3.7.5 install numpy==1.17.2 pip3.7.5 install protobuf==3.11.3 pip3.7.5 install scipy

pip3.7.5 install sympy pip3.7.5 install cffi

pip3.7.5 install grpcio==1.32.0 pip3.7.5 install grpcio-tools==1.32.0 pip3.7.5 install requests

During the command execution, if the network connection fails and the message "Could not find a version that satisfies the requirement xxx" is displayed, rectify the fault by referring to 6.4 What Do I Do If "Could not find a version that satisfies the requirement xxx" Is Displayed When pip3.7.5 install Is Run?. If an error is reported during the NumPy installation, rectify the fault by referring to 6.2 pip3.7.5 install numpy Error.

----End

3.3.2 Ubuntu (ARM)

Environment Requirements

The following software or dependencies need to be installed for the development kit, Python, auxiliary development tools, and application compilation.

Table 3-6 Dependency information

Parameter Version Python 3.7.5 cmake 3.5.1+ protobuf 3.11.3+ g++ 7.3.0 or later gcc 7.3.0 or later

(19)

Parameter Version make zlib1g zlib1g-dev libsqlite3-dev openssl libssl-dev libffi-dev unzip pciutils net-tools libblas-dev gfortran libblas3 libopenblas-dev attrs psutil decorator numpy scipy sympy cffi grpcio grpcio-tools requests

There is no version requirement. The version to be installed is subject to the source provided by the OS.

Check the umask of the root user.

1. Log in to the installation environment as the root user. 2. Check the umask value of the root user.

umask

3. If the umask value is not 0022, append "umask 0022" to the file and save the file:

vi ~/.bashrc source ~/.bashrc

Creating Installation and Running Users

Table 3-7 lists the users for installing and running the firmware and CANN software.

(20)

Table 3-7 Installation and running user list Package

Type Installation User Running User Driver and

firmware installation package

The user must be root. The user must be a non-root user.

CANN software package

The user can be root or non-root. For details, see the content below the table.

For installation as the root user:

After installation as the root user, you must switch to a non-root user for execution (the running user must not belong to the root user group). Therefore, you need to create a running user before the installation.

If the created user is HwHiAiUser, you can directly install the software packages as the HwHiAiUser user. The default installation user is HwHiAiUser.

If the created user is not HwHiAiUser, you need to specify the running user (by using the --install-username=user name

--install-usergroup=user group parameter) when installing the software package. Perform the following operations to create a user.

For installation as a non-root user:

In this scenario, the installation and running users must be the same. – If a non-root user exists, you do not need to create one.

– If you want to use a new non-root user, you need to create the user first. To create a non-root user, run the following commands as the root user:

1. Create a non-root user. groupadd usergroup

useradd -g usergroup -d /home/username -m username 2. Set the password of the non-root user.

passwd username NO TE

● If the CANN software package is installed by a non-root user, the owner group of the user must be the same as that of the driver running user. If they are different, add them to the Driver running user group.

● The created running user cannot belong to the root user group.

● After the HwHiAiUser user is created, do not disable the login authentication function of the user.

● The password validity period is 90 days. You can change the validity period in the /etc/

login.defs file or using the chage command. For details, see 5.5 Setting User Account Validity Period.

(21)

(Optional) Configuring the Permission of the Installation User

Skip the following part if you install as the root user.

Before installing the development kit, you need to download the dependencies, which require sudo apt-get permission. Run the following commands as the root user:

1. Open the /etc/sudoers file: chmod u+w /etc/sudoers

vi /etc/sudoers

2. Add the following content below # User privilege specification of the file: username 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

Replace username with the name of the common user who executes the installation script.

NO TE

Ensure that the last line of the /etc/sudoers file is #includedir /etc/sudoers.d. Otherwise, add it manually.

3. Run :wq! to save the file.

4. Run the following command to revoke the write permission on the /etc/ sudoers file:

chmod u-w /etc/sudoers

Checking the Source Validity

Development kit installation requires the download of related dependencies. Ensure that the installation environment can be connected to the network.

Run the following command as the root user to check whether the source is valid: apt-get update

If an error is reported during command execution or dependency installation, check whether the network connection is normal, or replace the source in

the /etc/apt/sources.list file with an available source or use an image source. For details about how to configure a network proxy, see 5.2 Configuring a System Network Proxy.

Installing Dependencies

NO TE

● If you install Python and its dependencies as the root user, perform Step 1 to Step 3. Note that the sudo keywords in the commands need to be deleted if any.

● If you install Python and its dependencies as a non-root user, run the su - username command to switch to the non-root user and perform Step 1 to Step 3.

Step 1 Check whether the Python dependencies and GCC software are installed. Run the following commands to check whether the dependencies such as GCC, Make, and Python are installed:

gcc --version g++ --version

(22)

make --version cmake --version

dpkg -l zlib1g| grep zlib1g| grep ii dpkg -l zlib1g-dev| grep zlib1g-dev| grep ii dpkg -l libsqlite3-dev| grep libsqlite3-dev| grep ii dpkg -l openssl| grep openssl| 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 libopenblas-dev| grep libopenblas-dev| grep ii

If the following information is displayed, the installation is complete. Go to the next step.

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:arm64 1:1.2.11.dfsg-0ubuntu2 arm64 compression library - runtime zlib1g-dev:arm64 1:1.2.11.dfsg-0ubuntu2 arm64 compression library - development libsqlite3-dev:arm64 3.22.0-1ubuntu0.3 arm64 SQLite 3 development files

openssl 1.1.1-1ubuntu2.1~18.04.6 arm64 Secure Sockets Layer toolkit - cryptographic utility 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 amd64 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 libopenblas-dev:arm64 0.2.20+ds-4 arm64 Optimized BLAS (linear algebra) library (development files) Otherwise, run the following command to install the software. You can change the following command to install only some of them as required.

sudo apt-get install -y gcc g++ make cmake zlib1g zlib1g-dev libsqlite3-dev openssl libssl-dev libffi-dev unzip pciutils net-tools libblas-dev gfortran libblas3 libopenblas-dev

Step 2 Check whether the Python development environment is installed.

The development kit depends on the Python environment. Run the python3.7.5 --version and pip3.7.5 ----version commands to check whether Python has been installed. If the following information is displayed, Python has been installed. Go to the next step.

Python 3.7.5

pip 19.2.3 from /usr/local/python3.7.5/lib/python3.7/site-packages/pip (python 3.7) Otherwise, use the following procedure to install Python 3.7.5:

1. Run the wget command to download the source code package of Python 3.7.5 to any directory of the installation environment. The command is as follows:

wget https://www.python.org/ftp/python/3.7.5/Python-3.7.5.tgz

2. Run the following command to go to the download directory and decompress the source code package:

tar -zxvf Python-3.7.5.tgz

3. Go to the decompressed folder and run the following configuration, build, and installation commands:

cd Python-3.7.5

(23)

make

sudo make install

The --prefix parameter specifies the Python installation path. You can change it based on the site requirements. The --enable-shared parameter is used to compile the libpython3.7m.so.1.0 dynamic library.

This document uses --prefix=/usr/local/python3.7.5 as an example. After the configuration, compilation, and installation commands are executed, the installation package is output to the /usr/local/python3.7.5 directory, and the libpython3.7m.so.1.0 dynamic library is output to the /usr/local/

python3.7.5/lib/libpython3.7m.so.1.0 directory.

4. Check whether libpython3.7m.so.1.0 exists in /usr/lib64 or /usr/lib. If yes, skip this step or back up the libpython3.7m.so.1.0 file provided by the system and run the following command:

Copy the compiled file libpython3.7m.so.1.0 to /usr/lib64: sudo cp /usr/local/python3.7.5/lib/libpython3.7m.so.1.0 /usr/lib64

When the following information is displayed, enter y to overwrite the libpython3.7m.so.1.0 file provided by the system.

cp: overwrite 'libpython3.7m.so.1.0'?y

If the /usr/lib64 directory does not exist in the environment, copy the file to the /usr/lib directory.

sudo cp /usr/local/python3.7.5/lib/libpython3.7m.so.1.0 /usr/lib

Replace the path of the libpython3.7m.so.1.0 file as required. 5. Run the following commands to set the soft link:

sudo ln -s /usr/local/python3.7.5/bin/python3 /usr/bin/python3.7 sudo ln -s /usr/local/python3.7.5/bin/pip3 /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/pip3 /usr/bin/pip3.7.5

If a message indicating that the link already exists is displayed during the command execution, run the following command to delete the existing link and run the command again:

sudo rm -rf /usr/bin/python3.7.5 sudo rm -rf /usr/bin/pip3.7.5 sudo rm -rf /usr/bin/python3.7 sudo rm -rf /usr/bin/pip3.7

6. After the installation is complete, run the following commands to check the installation version. If the required version information is displayed, the installation is successful.

python3.7.5 --version pip3.7.5 --version

Step 3 Install the Python 3 development environment.

Before the installation, run the pip3.7.5 list command to check whether the dependencies have been installed. If yes, skip this step. If not, run the following command to install the dependencies: (If only some of the software is not installed, modify the following command to install selected software only.) If you install Python and its dependencies as a non-root user, add --user at the end of each command in this step to ensure that the installation is successful. Example command: pip3.7.5 install attrs --user

pip3.7.5 install attrs pip3.7.5 install psutil pip3.7.5 install decorator pip3.7.5 install numpy

(24)

pip3.7.5 install protobuf==3.11.3 pip3.7.5 install scipy

pip3.7.5 install sympy pip3.7.5 install cffi

pip3.7.5 install grpcio==1.32.0 pip3.7.5 install grpcio-tools==1.32.0 pip3.7.5 install requests

During the command execution, if the network connection fails and the message "Could not find a version that satisfies the requirement xxx" is displayed, rectify the fault by referring to 6.4 What Do I Do If "Could not find a version that satisfies the requirement xxx" Is Displayed When pip3.7.5 install Is Run?. ----End

3.3.3 Ubuntu (x86)

Environment Requirements

The following software or dependencies need to be installed for the development kit, Python, auxiliary development tools, and application compilation.

Table 3-8 Dependency information

Parameter Version Python 3.7.5 cmake 3.5.1+ protobuf 3.11.3+ g++ 7.3.0 or later gcc 7.3.0 or later

(25)

Parameter Version make zlib1g zlib1g-dev libsqlite3-dev openssl libssl-dev libffi-dev unzip pciutils net-tools attrs psutil decorator numpy scipy sympy cffi grpcio grpcio-tools requests

There is no version requirement. The version to be installed is subject to the source provided by the OS.

Check the umask of the root user.

1. Log in to the installation environment as the root user. 2. Check the umask value of the root user.

umask

3. If the umask value is not 0022, append "umask 0022" to the file and save the file:

vi ~/.bashrc source ~/.bashrc

Creating Installation and Running Users

Table 3-9 lists the users for installing and running the firmware and CANN software.

(26)

Table 3-9 Installation and running user list Package

Type Installation User Running User Driver and

firmware installation package

The user must be root. The user must be a non-root user.

CANN software package

The user can be root or non-root. For details, see the content below the table.

For installation as the root user:

After installation as the root user, you must switch to a non-root user for execution (the running user must not belong to the root user group). Therefore, you need to create a running user before the installation.

If the created user is HwHiAiUser, you can directly install the software packages as the HwHiAiUser user. The default installation user is HwHiAiUser.

If the created user is not HwHiAiUser, you need to specify the running user (by using the --install-username=user name

--install-usergroup=user group parameter) when installing the software package. Perform the following operations to create a user.

For installation as a non-root user:

In this scenario, the installation and running users must be the same. – If a non-root user exists, you do not need to create one.

– If you want to use a new non-root user, you need to create the user first. To create a non-root user, run the following commands as the root user:

1. Create a non-root user. groupadd usergroup

useradd -g usergroup -d /home/username -m username 2. Set the password of the non-root user.

passwd username NO TE

● If the CANN software package is installed by a non-root user, the owner group of the user must be the same as that of the driver running user. If they are different, add them to the Driver running user group.

● The created running user cannot belong to the root user group.

● After the HwHiAiUser user is created, do not disable the login authentication function of the user.

● The password validity period is 90 days. You can change the validity period in the /etc/

login.defs file or using the chage command. For details, see 5.5 Setting User Account Validity Period.

(27)

(Optional) Configuring the Permission of the Installation User

Skip the following part if you install as the root user.

Before installing the development kit, you need to download the dependencies, which require sudo apt-get permission. Run the following commands as the root user:

1. Open the /etc/sudoers file: chmod u+w /etc/sudoers

vi /etc/sudoers

2. Add the following content below # User privilege specification of the file: username 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

Replace username with the name of the common user who executes the installation script.

NO TE

Ensure that the last line of the /etc/sudoers file is #includedir /etc/sudoers.d. Otherwise, add it manually.

3. Run :wq! to save the file.

4. Run the following command to revoke the write permission on the /etc/ sudoers file:

chmod u-w /etc/sudoers

Checking the Source Validity

Development kit installation requires the download of related dependencies. Ensure that the installation environment can be connected to the network.

Run the following command as the root user to check whether the source is valid: apt-get update

If an error is reported during command execution or dependency installation, check whether the network connection is normal, or replace the source in

the /etc/apt/sources.list file with an available source or use an image source. For details about how to configure a network proxy, see 5.2 Configuring a System Network Proxy.

Installing Dependencies

NO TE

● If you install Python and its dependencies as the root user, perform 1 to 3. Note that the sudo keywords in the commands need to be deleted if any.

● If you install Python and its dependencies as a non-root user, run the su - username command to switch to the non-root user and perform Step 1 to Step 3.

Step 1 Check whether the Python dependencies and GCC software are installed. Run the following commands to check whether the dependencies such as GCC, Make, and Python are installed:

gcc --version g++ --version

(28)

make --version cmake --version

dpkg -l zlib1g| grep zlib1g| grep ii dpkg -l zlib1g-dev| grep zlib1g-dev| grep ii dpkg -l libsqlite3-dev| grep libsqlite3-dev| grep ii dpkg -l openssl| grep openssl| 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

If the following information is displayed, the installation is complete. Go to the next step.

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:amd64 1:1.2.11.dfsg-0ubuntu2 amd64 compression library - runtime zlib1g-dev:amd64 1:1.2.11.dfsg-0ubuntu2 amd64 compression library - development libsqlite3-dev:amd64 3.22.0-1ubuntu0.3 amd64 SQLite 3 development files

openssl 1.1.1-1ubuntu2.1~18.04.5 amd64 Secure Sockets Layer toolkit - cryptographic utility libssl-dev:amd64 1.1.1-1ubuntu2.1~18.04.5 amd64 Secure Sockets Layer toolkit - development files libffi-dev:amd64 3.2.1-8 amd64 Foreign Function Interface library (development files)

unzip 6.0-21ubuntu1 amd64 De-archiver for .zip files pciutils 1:3.5.2-1ubuntu1.1 amd64 Linux PCI Utilities

net-tools 1.60+git20161116.90da8a0-1ubuntu1 amd64 NET-3 networking toolkit

Otherwise, run the following command to install the software. You can change the following command to install only some of them as required.

sudo apt-get install -y gcc g++ make cmake zlib1g zlib1g-dev libsqlite3-dev openssl libssl-dev libffi-dev unzip pciutils net-tools

Step 2 Check whether the Python development environment is installed.

The development kit depends on the Python environment. Run the python3.7.5 --version and pip3.7.5 ----version commands to check whether Python has been installed. If the following information is displayed, Python has been installed. Go to the next step.

Python 3.7.5

pip 19.2.3 from /usr/local/python3.7.5/lib/python3.7/site-packages/pip (python 3.7) Otherwise, use the following procedure to install Python 3.7.5:

1. Run the wget command to download the source code package of Python 3.7.5 to any directory of the installation environment. The command is as follows:

wget https://www.python.org/ftp/python/3.7.5/Python-3.7.5.tgz

2. Run the following command to go to the download directory and decompress the source code package:

tar -zxvf Python-3.7.5.tgz

3. Go to the decompressed folder and run the following configuration, build, and installation commands:

cd Python-3.7.5

./configure --prefix=/usr/local/python3.7.5 --enable-shared make

sudo make install

The --prefix parameter specifies the Python installation path. You can change it based on the site requirements. The --enable-shared parameter is used to compile the libpython3.7m.so.1.0 dynamic library.

This document uses --prefix=/usr/local/python3.7.5 as an example. After the configuration, compilation, and installation commands are executed, the

(29)

installation package is output to the /usr/local/python3.7.5 directory, and the libpython3.7m.so.1.0 dynamic library is output to the /usr/local/

python3.7.5/lib/libpython3.7m.so.1.0 directory.

4. Check whether libpython3.7m.so.1.0 exists in /usr/lib64 or /usr/lib. If yes, skip this step or back up the libpython3.7m.so.1.0 file provided by the system and run the following command:

Copy the compiled file libpython3.7m.so.1.0 to /usr/lib64: sudo cp /usr/local/python3.7.5/lib/libpython3.7m.so.1.0 /usr/lib64

When the following information is displayed, enter y to overwrite the libpython3.7m.so.1.0 file provided by the system.

cp: overwrite 'libpython3.7m.so.1.0'?y

If the /usr/lib64 directory does not exist in the environment, copy the file to the /usr/lib directory.

sudo cp /usr/local/python3.7.5/lib/libpython3.7m.so.1.0 /usr/lib

Replace the path of the libpython3.7m.so.1.0 file as required. 5. Run the following commands to set the soft link:

sudo ln -s /usr/local/python3.7.5/bin/python3 /usr/bin/python3.7 sudo ln -s /usr/local/python3.7.5/bin/pip3 /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/pip3 /usr/bin/pip3.7.5

If a message indicating that the link already exists is displayed during the command execution, run the following command to delete the existing link and run the command again:

sudo rm -rf /usr/bin/python3.7.5 sudo rm -rf /usr/bin/pip3.7.5 sudo rm -rf /usr/bin/python3.7 sudo rm -rf /usr/bin/pip3.7

6. After the installation is complete, run the following commands to check the installation version. If the required version information is displayed, the installation is successful.

python3.7.5 --version pip3.7.5 --version

Step 3 Install the Python 3 development environment.

Before the installation, run the pip3.7.5 list command to check whether the dependencies have been installed. If yes, skip this step. If not, run the following command to install the dependencies: (If only some of the software is not installed, modify the following command to install selected software only.) If you install Python and its dependencies as a non-root user, add --user at the end of each command in this step to ensure that the installation is successful. Example command: pip3.7.5 install attrs --user

pip3.7.5 install attrs pip3.7.5 install psutil pip3.7.5 install decorator pip3.7.5 install numpy

pip3.7.5 install protobuf==3.11.3 pip3.7.5 install scipy

pip3.7.5 install sympy pip3.7.5 install cffi

pip3.7.5 install grpcio==1.32.0 pip3.7.5 install grpcio-tools==1.32.0 pip3.7.5 install requests

During the command execution, if the network connection fails and the message "Could not find a version that satisfies the requirement xxx" is displayed, rectify

(30)

the fault by referring to 6.4 What Do I Do If "Could not find a version that satisfies the requirement xxx" Is Displayed When pip3.7.5 install Is Run?. ----End

3.4 Pure Development

3.4.1 Installing the Development Kit

Prerequisites

● You have prepared for the installation by referring to 3.3 Preparations for Installation.

You have obtained the development kit

Ascend-cann-toolkit_{version}_linux-{arch}_{gcc_version}.run by referring to 3.2 Obtaining Software Packages.

Procedure

Step 1 Log in to the installation environment as the installation user of the software packages.

Ensure that the installation user of the software package is the same as the installation dependency user in 3.3 Preparations for Installation.

Step 2 Upload the obtained development kit to any directory (for example, /home/ package) in the installation environment.

Step 3 Go to the directory where the software packages are stored. Step 4 Grant the execute permission on the software package.

chmod +x *.run NO TE

In the preceding command, .run indicates the development kit

Ascend-cann-toolkit_{version}_linux-{arch}_gccx.x.x.run. Replace it with the actual package name.

Step 5 Run the following command to check the consistency and integrity of the software package installation file:

./*.run --check

Step 6 (Optional) Specify the software installation path.

● If you need to specify the installation path, you need to create it first. For example, if the installation path is /home/work, run the mkdir -p /home/ work command to create an installation path and then select the path to install the software.

● If you do not specify an installation path, the software is installed in the default path. The default installation paths are as follows:

root user: /usr/local/Ascend – Non-root user: ${HOME}/Ascend

(31)

In the preceding command, ${HOME} indicates the directory of the current user.

Step 7 Install the software. (The following commands support install-for-all and --install-path=<path>. For details about the parameters, see 7.1 Parameters.) ● If the installation is performed as a non-root user, run the following

command: ./*.run --install

If the installation is performed as the root user:

As the default running user HwHiAiUser, run the following command: ./*.run --install

– As a specified running user, run the following command:

./*.run --install-username=username --install-usergroup=usergroup --install

where, --install-username and --install-usergroup are used to specify the running users.

NO TE

● The development kits of multiple versions can be installed by different users in the same development environment. The users must be in the same group as the Driver running user. If the owner groups are different, add the users to the group of the Driver running user.

● If the installation is performed by the root user, do not to specify the installation path

in the directory of a non-root user. Otherwise, the root user file may be replaced by a

non-root user for privilege escalation.

● The --quiet option is not supported when the development kit

Ascend-cann-toolkit_{version}_linux-{arch}_{gcc_version}.run is installed in an x86 system.

● If the following information is displayed during the installation of the development kit

Ascend-cann-toolkit_{version}_linux-{arch}_{gcc_version}.run in the x86 system,

asking you whether to perform a hot reset, enter n. After the installation is complete, restart the OS for the setting to take effect. In the current version, only n is supported.

The installation of aicpu_kernels needs to restart the device to take effect, do you want to hot_reset the device? [y/n] n

If the following information is displayed, the software is successfully installed: [INFO] xxx install success

[INFO] process end

xxx indicates the name of a software package to be installed. ----End

Log File and Software Package Paths

Table 3-10 Paths to the log file and software package

Item Path

Installation log

(32)

Item Path Path for recording information such as the software package version, CPU architecture, GCC version, and installation path after the installation ${install_path}/ascend-toolkit/latest/{arch}-linux_gccx.x.x/ ascend_toolkit_install.info

Table 3-11 describes the variables in Table 3-10. Table 3-11 Variable description

Variable Description

{arch}-linux_gccx.x.x Architecture directory, which is named after the combination of the CPU architecture, Linux branch, and GCC version of the software package.

NOTE

Multiple versions can be installed.

${install_path} Software package installation path.

3.5 Development + Commissioning

3.5.1 Installing the Ascend AI Device Driver and Firmware

Select an installation procedure based on the product mode.

Hardware Ascend AI Device Installation Procedure Atlas 500 Pro AI edge

server (model 3000) Atlas 300I inferencecard (model 3000) See Card Driver Firmware andInstalling the Inference Upgrading the MCU.

Inference devices with Atlas 200 AI accelerator module (model 3000)

Atlas 200 AI

accelerator module (model 3000)

See Installing the AI Accelerator Module Driver and Firmware.

(33)

Installing the Inference Card Driver Firmware and Upgrading the MCU

Step 1 Check the system environment. For details, see "Installation and Maintenance > Checking the Environment" in the Atlas 300I Inference Card User Guide (Model 3000).

Step 2 Install the inference card driver and firmware. For details, see "Installation and Maintenance" > "Installing the Driver and Firmware" in the Atlas 300I Inference Card User Guide (Model 3000).

Step 3 Upgrade the MCU. For details, see "Upgrading Components" > "Upgrading the MCU" in the Atlas 300I Inference Card 1.0.7 Upgrade Guide (Models 3000, 3010).

NO TE

● The microcontroller unit (MCU) is an out-of-band management module of the inference card. It provides functions such as board monitoring and fault reporting. The inference card has been integrated with the initial version before delivery. To ensure that all functions are available, upgrade the MCU to the latest version.

----End

Installing the AI Accelerator Module Driver and Firmware

Step 1 Check the system environment. For details, see "Checking the Environment" in the Atlas 200 AI Accelerator Module 1.0.7 Software Installation and Maintenance Guide (Model 3000).

Step 2 Install the driver and firmware. For details, see "Installing the Driver and Firmware on the Host" in the Atlas 200 AI Accelerator Module 1.0.7 Software Installation and Maintenance Guide (Model 3000).

----End

3.5.2 Installing the Development Kit

Prerequisites

● Prepare for the installation by referring to 3.3 Preparations for Installation. ● Obtain the development kit Ascend-cann-toolkit_

{version}_linux-{arch}_{gcc_version}.run by referring to 3.2 Obtaining Software Packages.

● The AICPU operator package in the development kit must be installed as the root user. If you install the development kit as a non-root user, you need to switch to the root user to install the AICPU operator package.

Procedure

Step 1 Log in to the installation environment as the installation user of the software packages.

Ensure that the installation user of the software package is the same as the installation dependency user in 3.3 Preparations for Installation.

Step 2 Upload the obtained development kit to any directory (for example, /home/ package) in the installation environment.

(34)

Step 3 Go to the directory where the software packages are stored. Step 4 Grant the execute permission on the software package.

chmod +x *.run NO TE

In the preceding command, .run indicates the development kit

Ascend-cann-toolkit_{version}_linux-{arch}_gccx.x.x.run. Replace it with the actual package name.

Step 5 Run the following command to check the consistency and integrity of the software package installation file:

./*.run --check

Step 6 (Optional) Specify the software installation path.

● If you need to specify the installation path, you need to create it first. For example, if the installation path is /home/work, run the mkdir -p /home/ work command to create an installation path and then select the path to install the software.

● If you do not specify an installation path, the software is installed in the default path. The default installation paths are as follows:

root user: /usr/local/Ascend – Non-root user: ${HOME}/Ascend

In the preceding command, ${HOME} indicates the directory of the current user.

Step 7 Install the software. (The following commands support install-for-all and --install-path=<path>. For details about the parameters, see 7.1 Parameters.) ● If the installation is performed as a non-root user, run the following

command: ./*.run --install

If the installation is performed as the root user:

As the default running user HwHiAiUser, run the following command: ./*.run --install

– As a specified running user, run the following command:

./*.run --install-username=username --install-usergroup=usergroup --install

where, --install-username and --install-usergroup are used to specify the running users.

(35)

NO TE

● The development kits of multiple versions can be installed by different users in the same development environment. The users must be in the same group as the Driver running user. If the owner groups are different, add the users to the group of the Driver running user.

● If the installation is performed by the root user, do not to specify the installation path

in the directory of a non-root user. Otherwise, the root user file may be replaced by a

non-root user for privilege escalation.

● The --quiet option is not supported when the development kit

Ascend-cann-toolkit_{version}_linux-{arch}_{gcc_version}.run is installed in an x86 system.

● If the following information is displayed during the installation of the development kit

Ascend-cann-toolkit_{version}_linux-{arch}_{gcc_version}.run in the x86 system,

asking you whether to perform a hot reset, enter n. After the installation is complete, restart the OS for the setting to take effect. In the current version, only n is supported.

The installation of aicpu_kernels needs to restart the device to take effect, do you want to hot_reset the device? [y/n] n

If the following information is displayed, the software is successfully installed: [INFO] xxx install success

[INFO] process end

xxx indicates the name of the software package to be installed.

Step 8 If a non-root user is used to install the development kit in the previous step, perform this step. Switch to the root user (you can also run the sudo command) and run the following installation command:

1. Go to the directory where the AICPU operator package is stored. cd ${install_path}/ascend-toolkit/latest/{arch}-linux_gccx.x.x/aicpu 2. Install the AICPU operator package.

./Ascend310-aicpu_kernels-{version}.run --full

The AICPU does not support the specified installation path and shares the installation path of the driver.

----End

Log File and Software Package Paths

Table 3-12 Paths to the log file and software package

Item Path

Installation log

(36)

Item Path Path for recording information such as the software package version, CPU architecture, GCC version, and installation path after the installation ${install_path}/ascend-toolkit/latest/{arch}-linux_gccx.x.x/ ascend_toolkit_install.info

Table 3-13 describes the variables in Table 3-12. Table 3-13 Variable description

Variable Description

{arch}-linux_gccx.x.x Architecture directory, which is named after the combination of the CPU architecture, Linux branch, and GCC version of the software package.

NOTE

Multiple versions can be installed.

${install_path} Software package installation path.

3.6 Performing Post-installation Operations

This section applies only to the Atlas 500 Pro AI edge server (model 3000).

Configuring Environment Variables

Step 1 Log in to the server as the root user. Step 2 Run the vi ~/.bashrc command.

(37)

Table 3-14 Environment variables

Scenario Environment Variable Inference

(development environment)

install_path=/usr/local/Ascend #Change the path based on the site requirements. export PATH=${install_path}/ascend-toolkit/latest/dmi/bin:$ {PATH} export LD_LIBRARY_PATH=/usr/local/dcmi:/usr/local/Ascend/ add-ons:${install_path}/ascend-toolkit/latest/dmi/lib64:$ {install_path}/ascend-toolkit/latest/acllib/lib64:/usr/local/ Ascend/driver/lib64:${LD_LIBRARY_PATH} export PYTHONPATH=${install_path}/ascend-toolkit/latest/ pyACL/python/site-packages/acl:$PYTHONPATH

Step 4 Run source .bashrc to make the environment variables take effect. ----End

Verifying the Installation

You can use the Ascend-DMI tool to check the compatibility between the device health information and software and hardware. After configuring the environment variables, you can use the tool in any directory. You can use the tool as the root user or a non-root user. If you use the tool as a non-root user, perform the following steps to add the user group for running the software package. (If --install-for-all is used during software package installation, skip this operation.) For example, the default user group for running the software package is

HwHiAiUser (you can run the source /etc/ascend_install.info; echo $ {UserGroup} command to query the user group for running the software package). Perform the following steps to add the user to the HwHiAiUser user group:

1. Log in to the server as the root user.

2. Run the usermod -a -G HwHiAiUser {username} command to add the user to the HwHiAiUser user group. {username} indicates the name of the non-root user. Replace it with the actual user name.

To verify the installation, perform the following steps: Step 1 Check the device health status.

1. Run the ascend-dmi info command and obtain the card number from the Card parameter in the displayed table, as shown in the red box in Figure 3-1.

(38)

Figure 3-1 Number of the installed card

2. Run the ascend-dmi -dg -c {card-number} -l 1 command to query the health status. {card-number} indicates the card number. Replace it as required.

For details about how to check the device health status, see 5.6 Performing Fault Diagnostics.

Step 2 Check the software and hardware compatibility.

● If you use the default path when installing the software package: Run the ascend-dmi -c command to check the software and hardware compatibility.

● You need to set this parameter if the default installation path is not used. For example, if the software package is installed in the /home/xxx/Ascend directory, run the following command:

ascend-dmi -c -p /home/xxx/Ascend

For details about how to check software and hardware compatibility, see 5.7 Performing a Software and Hardware Compatibility Test.

(39)

4

Installing the Operating Environment

4.1 Obtaining Software Packages 4.2 Installation on a Physical Machine 4.3 Installation in a Container

4.1 Obtaining Software Packages

Downloading Software Packages

Obtain software packages and digital signature files required for installing the operating environment based on the following table. The versions of the software packages must be consistent.

Hardware Ascend AI Device Obtaining Software

Packages Atlas 500 Pro AI edge

server (model 3000) Atlas 300I inferencecard (model 3000) For details, see and Table 4-2. Table 4-1 Inference devices with

Atlas 200 AI accelerator module (model 3000)

Atlas 200 AI

accelerator module (model 3000)

For details, see Table 4-1

(40)

Table 4-1 CANN software packages Packag

e Type Package Name Description Howto

Obtain Offline inferenc e engine package Ascend-cann- nnrt_{version}_linux-{arch}_{gcc_version}.run

It contains the ACL library ACLlib, which is used for model inference of applications. Obtain the software packages based on the CPU architecture (x86_64 or aarch64).

Link

Toolbox

Ascend-cann- toolbox_{version}_linux-{arch}_{gcc_version}.run

It contains AICPU operators, which are used for inference model calling.

Ascend

Docker Ascend-docker- runtime_{version}_{os}-{arch}.tar.gz

The container engine plug-in Ascend Docker provides Ascend NPU-based containerization support for all AI inference jobs so that AI jobs can run smoothly on Ascend devices as Docker containers.

● The RPM format applies to CentOS.

● The DEB format applies to Ubuntu and Debian.

Table 4-2 Atlas 300I inference card (model 3000) software packages Packag

e Type Package Name Description How toObtain

Driver packag e A300-3000-npu- driver_{version}_{os}-aarch64.run

Inference card driver installation package

NOTE

The npu-smi tool package is integrated in the driver package. The npu-smi tool is automatically installed during the driver installation.

Link Firmwa re packag e

(41)

Packag

e Type Package Name Description How toObtain

MCU packag e ● A300-3000-mcu_{version}.bin ● A300-3000-mcu_{version}.hpm

The MCU is an out-of-band management module of the Atlas 300 AI inference card to provide functions such as card monitoring and fault reporting. ● To upgrade the MCU

using the npu-smi tool, obtain the .bin MCU package.

● To upgrade the MCU using the iBMC, obtain the .hpm MCU package.

Table 4-3 Atlas 300I inference card (model 3010) software packages Packag

e Type Package Name Host OSVersion Description Howto Obtain Driver

packag e

A200-3000-npu-driver_{version}_{os}-X86_64.run Ubuntu18.04.1 Driverinstallati on package Link Firmwa re packag e A200-3000-npu-firmware_{version}.run Firmware installati on package NO TE

{version} indicates the software version, {arch} indicates the processor architecture, and {os}

indicates the OS version. Obtain the software package based on the GCC version planned or deployed onsite. You can run the gcc --version command on the OS to query the GCC version. If the GCC version is earlier than 7.3.0, obtain the GCC 4.8.5 software package, if the GCC version is 7.3.0 or later, obtain the GCC 7.3.0 software package. The GCC versions of the software packages installed in the development environment and operating environment must be the same. Otherwise, the applications compiled in the development environment fail to run in the operating environment.

References

Related documents

our options. This gives you clear water, so you are not riding the wakes of the other boats, and you get clear air. When it got light and lumpy we had the space to put the bow

Bibb, Bryan, Bulloch, Chatham, Lowndes, Muscogee, Putnam, Toombs, Upson, Ware.

For the poorest farmers in eastern India, then, the benefits of groundwater irrigation have come through three routes: in large part, through purchased pump irrigation and, in a

The Early Years Lead position (EY Lead) will continue to help school boards further integrate early years programs and services, and ensure inclusion of child care and family

Caffeic acid and its ester caftaric acid are known to be influenced by the presence of iron [12], but in our experiments they were found as candidate biomarkers for oxygen level,

Fonte: Rui Baptista, slides de apoio à disciplina de Organização e Gestão das Instituições Financeiras, Business School, Pós Graduação em Gestão Bancária e Seguradora, Coimbra..

At societal level, whereas the social economy order has remained marginalized regarding work regulation, both the state and the market have developed under the

Nazario Moreno, the enigmatic spiritual leader of the cartel, was allegedly killed in a shootout with government forces in December 2010 and soon after various factions