Huawei V100R020C00 Installation Manual

Page 1
Atlas Data Center V100R020C00
CANN Software Installation Guide (Inference)
Issue 01
Date 2021-03-02
HUAWEI TECHNOLOGIES CO., LTD.
Page 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 specied 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 eort 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.
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. i
Page 3
Atlas Data Center CANN Software Installation Guide (Inference) Contents

Contents

1 Installation Precautions......................................................................................................... 1
2 Hardware Requirements........................................................................................................ 2
2.1 Atlas 300I Inference Card (Model 3010).........................................................................................................................2
2.2 Atlas 800 Inference Server (Model 3000).......................................................................................................................3
2.3 Atlas 800 Inference Server (Model 3010).......................................................................................................................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 EulerOS (ARM)................................................................................................................................................................... 20
3.3.4 CentOS (x86 OS)............................................................................................................................................................... 26
3.3.5 Ubuntu (x86)...................................................................................................................................................................... 32
3.3.6 BClinux (x86)...................................................................................................................................................................... 38
3.4 Pure Development................................................................................................................................................................ 44
3.4.1 Installing the Development Kit..................................................................................................................................... 44
3.5 Development + Commissioning....................................................................................................................................... 46
3.5.1 Installing the Ascend AI Device Driver and Firmware.......................................................................................... 46
3.5.2 Installing the Development Kit..................................................................................................................................... 47
3.6 Performing Post-installation Operations...................................................................................................................... 50
4 Installing the Operating Environment............................................................................. 53
4.1 Obtaining Software Packages...........................................................................................................................................53
4.2 Installation on a Physical Machine................................................................................................................................. 56
4.2.1 Preparations for Installation.......................................................................................................................................... 56
4.2.2 Installing the Ascend AI Device Driver and Firmware.......................................................................................... 57
4.2.3 Installing the Inference Software.................................................................................................................................58
4.2.4 Performing Post-installation Operations...................................................................................................................61
4.3 Installation in a Container................................................................................................................................................. 63
4.3.1 Installing the Inference Card Driver and Firmware and Upgrading the MCU on the Host.....................63
4.3.2 Installing the Toolbox on the Host.............................................................................................................................. 64
4.3.3 Installing Ascend Docker on the Host........................................................................................................................ 64
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. ii
Page 4
Atlas Data Center CANN Software Installation Guide (Inference) Contents
4.3.4 Creating an Inference Container Image.................................................................................................................... 65
4.3.5 Starting and Verifying a Container Image................................................................................................................71
5 Common Operations............................................................................................................ 74
Conguring the NIC IP Address....................................................................................................................................... 74
5.1
5.2 Conguring a System Network Proxy............................................................................................................................77
5.3 Installing CMake 3.5.2......................................................................................................................................................... 77
5.4 Uninstalling the CANN Software.....................................................................................................................................78
5.5 Setting User Account Validity Period............................................................................................................................. 79
5.6 Performing Fault Diagnostics........................................................................................................................................... 80
5.7 Performing a Software and Hardware Compatibility Test......................................................................................83
6 FAQs..........................................................................................................................................87
6.1 What Do I Do If the "Software Has Been Installed" During RUN Package Installation?............................ 87
6.2 pip3.7.5 install numpy Error.............................................................................................................................................. 87
6.3 The error message "subprocess.CalledProcessError: Command '('lsb_release', '-a')' return non-zero exit
status 1 " is displayed during pip3.7.5 installation...........................................................................................................88
6.4 What Do I Do If "Could not
pip3.7.5 install Is Run?................................................................................................................................................................89
nd a version that satises the requirement xxx" Is Displayed When
7 Reference.................................................................................................................................91
7.1 Parameters.............................................................................................................................................................................. 91
7.2 Default Mounted Contents of Ascend Docker Runtime.......................................................................................... 93
7.3 About CCEC Compiler.......................................................................................................................................................... 94
7.4 HCC Overview........................................................................................................................................................................ 95
A Change History...................................................................................................................... 96
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. iii
Page 5
Atlas Data Center CANN Software Installation Guide (Inference) 1 Installation Precautions

1 Installation Precautions

Development Environment
The development environment is used to convert model applications, and develop operators.
If you need to debug an application (for example, an image classication application) in the development environment in addition to developing and compiling the application, you need to inference cards) 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
rmware corresponding to the inference card.
and
Operating Environment
The operating environment is an environment for running applications developed by users. The operating environment must be congured with Ascend AI devices (such as inference cards). Applications depend on the package, Toolbox, driver, and rmware to perform oine accelerated inference.
The operating environment includes the following two scenarios:
Physical machine scenario: The inference card driver, 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.
les, develop and compile
congure Ascend AI devices (such as
oine inference engine
rmware, oine
a. The inference card driver,
b. The oine 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.
The applications then run as containers.
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 1
rmware, and Toolbox are installed on a host.
Page 6
Atlas Data Center CANN Software Installation Guide (Inference) 2 Hardware Requirements

2 Hardware Requirements

2.1 Atlas 300I Inference Card (Model 3010)

2.2 Atlas 800 Inference Server (Model 3000)
2.3 Atlas 800 Inference Server (Model 3010)
2.1 Atlas 300I Inference Card (Model 3010)
Before installing the development and operating environments, you need to prepare the hardware environment based on the scenario.
Scenario
Development environment
Development and commissioning environment
Operating environment
Table 2-1 Supported OSs
OS
Ubuntu OS version: Ubuntu
Version How to Obtain
18.04.1
OS architecture: x86
Hardware
General-purpose server
Inference server with Atlas 300I inference card (model 3010)
Ocial Ubuntu website
Download the recommended version ubuntu-18.04.1-server-
amd64.iso from http://old-
releases.ubuntu.com/releases/
18.04.1/.
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 2
Page 7
Atlas Data Center CANN Software Installation Guide (Inference) 2 Hardware Requirements
OS Version How to Obtain
CentOS OS version: CentOS 7.6
OS architecture: x86
BClinux OS version: BClinux 7.6
OS architecture: x86
Ocial CentOS website
Download the required version from
http://vault.centos.org/7.6.1810/ isos/x86_64/. The recommended
version is CentOS-7-x86_64­DVD-1810.iso.
Ocial BClinux website

2.2 Atlas 800 Inference 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
Development and commissionin g environment
Operating environment
General-purpose server
Atlas 800 inference server (model 3000)
-
For details about how to install the server, set basic server parameters, and install the OS, see the
Inference Server User Guide (Model
3000)
. After the OS is installed, congure an IP address for the service network port. For details, see 5.1
Conguring the NIC IP Address.
Atlas 800 AI
Table 2-2 Supported OSs
OS
Ubuntu OS version: Ubuntu
CentOS OS version: CentOS 7.6
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 3
Version How to Obtain
Ocial Ubuntu website
18.04.1
OS architecture: ARM
OS architecture: ARM
Download the recommended version ubuntu-18.04.1-server-
arm64.iso from http://old-
releases.ubuntu.com/releases/
18.04.1/.
Ocial 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/.
Page 8
Atlas Data Center CANN Software Installation Guide (Inference) 2 Hardware Requirements
OS Version How to Obtain
EulerOS OS version: EulerOS 2.8
OS architecture: ARM
Ocial EulerOS website

2.3 Atlas 800 Inference Server (Model 3010)

Before installing the development and operating environments, you need to prepare the hardware environment based on the scenario.
Scenario Hardware Description
Development environment
Development and commissioning environment
Operating environment
General-purpose server
Atlas 800 inference server (model
3010)
-
For details about how to install the server, set basic server parameters, and install the OS, see the
Inference Server User Guide (Model
3010)
. After the OS is installed, congure an IP address for the service network port. For details, see 5.1
Conguring the NIC IP Address.
Atlas 800 AI
Table 2-3 Supported OSs
OS
Ubuntu OS version: Ubuntu
CentOS OS version: CentOS 7.6
BClinux OS version: BClinux 7.6
Version How to Obtain
18.04.1
OS architecture: x86
OS architecture: x86
OS architecture: x86
Ocial Ubuntu website
Download the recommended version ubuntu-18.04.1-server-
amd64.iso from http://old-
releases.ubuntu.com/releases/
18.04.1/.
Ocial CentOS website
Download the required version from
http://vault.centos.org/7.6.1810/ isos/x86_64/. The recommended
version is CentOS-7-x86_64­DVD-1810.iso.
Ocial BClinux website
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 4
Page 9
Atlas Data Center CANN Software Installation Guide (Inference) 3 Installing the Development Environment

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 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 install the development kit Ascend-cann-toolkit_
{arch}_{gcc_version}
a. 3.2 Obtaining Software Packages
b. 3.3 Preparations for Installation
c. 3.4 Pure Development
In addition to converting model and developing operators, you need to debug applications in the development environment (for example, debugging image classication applications in the development environment). In this case, you need to device in the development environment and install the driver and rmware of the Ascend AI device, and development kit (Ascend-cann-
toolkit_
following sections:
{version}
le conversion,
congure the Ascend AI device, and only need to
{version}
.run). For details, see the following sections:
les, developing and compiling applications,
congure the Ascend AI
_linux-
{arch}_{gcc_version}
.run). For details, see the
_linux-
a. 3.2 Obtaining Software Packages
b. 3.3 Preparations for Installation
c. 3.5 Development + Commissioning
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 5
Page 10
Atlas Data Center CANN Software Installation Guide (Inference) 3 Installing the Development Environment

3.2 Obtaining Software Packages

Downloading Software Packages
Before installing the software, obtain software packages and digital signature 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 rmware 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 800 inference server (model 3000)
Atlas 800 inference server (model 3010)
Inference server with Atlas 300I inference card (model 3010)
Atlas 300I inference card (model 3000)
Atlas 300I inference card (model 3010)
For details, see Table 3-1 and Table 3-2.
For details, see Table 3-1 and Table 3-3.
les
Table 3-1 CANN software packages
Packa ge Type
Devel opme nt kit
Package Name Description How to
Ascend-cann­toolkit_
{arch}_{gcc_version}
{version}
_linux-
.run
It is used for application development, operator customization, and model conversion. The development kit contains the library for developing applications and development auxiliary tools such as the Ascend Tensor Compiler (ATC) for model conversion.
les required
Obtain
Link
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 6
Page 11
Atlas Data Center CANN Software Installation Guide (Inference) 3 Installing the Development Environment
Table 3-2 Atlas 300I inference card (model 3000) software packages
Packag e Type
Driver packag e
Firmwa re packag e
MCU packag e
Package Name Description How to
Obtain
A300-3000-npu­driver_
{version}_{os}
aarch64.run
A300-3000-npu­rmware_
{version}
● A300-3000­mcu_
{version}
● A300-3000­mcu_
{version}
-
.run
.bin
.hpm
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.
Ascend rmware installation package
The MCU is an out-of-band management module of the Atlas 300 AI inference card to provide functions
Link
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
Package
Package Name Description How to
Type
Driver package
Firmware package
A300-3010-npu­driver_
{version}_{os}
X86_64.run
A300-3010-npu­rmware_
{version}
-
.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.
Ascend rmware installation package
Obtain
Link
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 7
Page 12
NO TE
Atlas Data Center CANN Software Installation Guide (Inference) 3 Installing the Development Environment
Package Type
MCU package
Package Name Description How to
Obtain
● A300-3010­mcu_
{version}
● A300-3010­mcu_
{version}
.bin
.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.
{version}
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.
indicates the software version,
{arch}
indicates the processor architecture, and
{os}

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
Python 3.7.5
cmake 3.5.1+
protobuf 3.11.3+
numpy 1.13.3+
Version
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 8
Page 13
Atlas Data Center CANN Software Installation Guide (Inference) 3 Installing the Development Environment
Parameter Version
gcc You can run the gcc --version command on the OS to
query the GCC version. If the GCC version is earlier
gcc-c++
than 7.3.0, you can obtain the GCC 4.8.5 development kit. If the GCC version is 7.3.0 or later, you can obtain the GCC 7.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.
make
unzip
zlib-devel
lib-devel
openssl-devel
sqlite-devel
blas-devel
lapack-devel
openblas-devel
pciutils
net-tools
attrs
psutil
decorator
scipy
sympy
c
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 le and save the
le:
vi ~/.bashrc source ~/.bashrc
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 9
Page 14
Atlas Data Center CANN Software Installation Guide (Inference) 3 Installing the Development Environment
Creating Installation and Running Users
Table 3-5 lists the users for installing and running the driver, rmware, and CANN
software.
Table 3-5 Installation and running user list
Package
Installation User Running User
Type
Driver and
The user must be root. The user must be a non-root user.
rmware
installation package
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=
usergroup=
user group
parameter) when installing the software package.
user name
--install-
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
rst.
To create a non-root user, run the following commands as the root user:
1. Create a non-root user.
groupadd useradd -g
usergroup
usergroup
-d /home/
username
-m
username
2. Set the password of the non-root user.
passwd
username
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 10
Page 15
NO TE
NO TE
Atlas Data Center CANN Software Installation Guide (Inference) 3 Installing the Development Environment
● 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 dierent, 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
Validity Period.
le or using the chage command. For details, see 5.5 Setting User Account
(Optional)
Conguring 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
chmod u+w /etc/sudoers vi /etc/sudoers
2. Under root ALL=(ALL) ALL in the le, add the following content:
username
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
ALL=(ALL:ALL) NOPASSWD:SETENV:/usr/bin/yum, /usr/bin/pip, /bin/tar, /bin/mkdir, /bin/
Replace username with the name of the common user who executes the installation script.
Ensure that the last line of the /etc/sudoers le is #includedir /etc/sudoers.d. Otherwise, add it manually.
3. Run :wq! to save the
le:
le.
4. Run the following command to revoke the write permission on the /etc/ sudoers le:
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 le with an available source or use an image source. For details about how to
Conguring a System Network Proxy.
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 11
congure a network proxy, see 5.2
Page 16
NO TE
Atlas Data Center CANN Software Installation Guide (Inference) 3 Installing the Development Environment
Installing Dependencies
● 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 cmake --version rpm -qa|grep gcc-c++ rpm -qa |grep unzip rpm -qa |grep zlib-devel rpm -qa |grep 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
lib-devel
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) gcc-c++-4.8.5 GNU Make cmake version unzip-6.0-21.el7.aarch64 zlib-devel-
lib-devel-
openssl-devel­sqlite-devel­blas-devel-3.4.2-8.el7.aarch64 lapack-devel­openblas-devel­pciutils-3.5.1-3.el7.aarch64 net-tools-2.0-0.24.20131004git.el7.aarch64
4.8.5
20150623 (Red Hat 4.8.5-39)
4.1
3.5.1
1.2.7-18.el7
3.0.13-18.el7
3.7.17-8.el7_7.1
3.4.2-8.el7
.aarch64
.aarch64
1.0.2k-19.el7
.aarch64
0.3.3-2.el7.
.aarch64
.aarch64
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 lib-devel openssl-devel sqlite-devel blas­devel lapack-devel openblas-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
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 12
Page 17
Atlas Data Center CANN Software Installation Guide (Inference) 3 Installing the Development Environment
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 conguration, build, and installation commands:
cd Python-3.7.5 ./congure --prex=/usr/local/python3.7.5 --enable-shared make sudo make install
--prex parameter species the Python installation path. You can change
The 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
--prex=/usr/local/python3.7.5 as an example. After the conguration, 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
le provided by the system
and run the following command:
Copy the compiled le 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 le 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
le to
the /usr/lib directory.
sudo cp /usr/local
Replace the path of the libpython3.7m.so.1.0
/python3.7.5/lib
/libpython3.7m.so.1.0 /usr/lib
le 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
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 13
Page 18
Atlas Data Center CANN Software Installation Guide (Inference) 3 Installing the Development Environment
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==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 pip3.7.5 install grpcio==1.32.0 pip3.7.5 install grpcio-tools==1.32.0 pip3.7.5 install requests
c
During the command execution, if the network connection fails and the message "Could not
nd a version that satises the requirement
the fault by referring to 6.4 What Do I Do If "Could not
satises 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
Python 3.7.5
cmake 3.5.1+
Version
xxx
" is displayed, rectify
nd a version that
protobuf 3.11.3+
g++ 7.3.0 or later
gcc 7.3.0 or later
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 14
Page 19
Atlas Data Center CANN Software Installation Guide (Inference) 3 Installing the Development Environment
Parameter Version
make
zlib1g
zlib1g-dev
libsqlite3-dev
openssl
libssl-dev
lib-dev
unzip
pciutils
net-tools
libblas-dev
gfortran
libblas3
libopenblas-dev
attrs
psutil
decorator
numpy
scipy
sympy
c
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 le and save the
le:
vi ~/.bashrc source ~/.bashrc
Creating Installation and Running Users
Table 3-7 lists the users for installing and running the driver,
software.
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 15
rmware, and CANN
Page 20
NO TE
Atlas Data Center CANN Software Installation Guide (Inference) 3 Installing the Development Environment
Table 3-7 Installation and running user list
Package
Installation User Running User
Type
Driver and
The user must be root. The user must be a non-root user.
rmware
installation package
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=
usergroup=
user group
parameter) when installing the software package.
user name
--install-
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
To create a non-root user, run the following commands as the root user:
1. Create a non-root user.
groupadd useradd -g
usergroup
usergroup
-d /home/
username
-m
username
2. Set the password of the non-root user.
passwd
username
● 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 dierent, 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 le or using the chage command. For details, see 5.5 Setting User Account
Validity Period.
rst.
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 16
Page 21
NO TE
NO TE
Atlas Data Center CANN Software Installation Guide (Inference) 3 Installing the Development Environment
(Optional) Conguring 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 le:
chmod u+w /etc/sudoers vi /etc/sudoers
2. Add the following content below # User privilege
username
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
ALL=(ALL:ALL) NOPASSWD:SETENV:/usr/bin/apt-get, /usr/bin/pip, /bin/tar, /bin/
Replace username with the name of the common user who executes the installation script.
Ensure that the last line of the /etc/sudoers le is #includedir /etc/sudoers.d. Otherwise, add it manually.
3. Run :wq! to save the
le.
4. Run the following command to revoke the write permission on the /etc/ sudoers
chmod u-w /etc/sudoers
le:
specication of the le:
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 details about how to congure a network proxy, see 5.2 Conguring a System
Network Proxy.
Installing Dependencies
● 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.
le with an available source or use an image source. For
Run the following commands to check whether the dependencies such as GCC, Make, and Python are installed:
gcc --version g++ --version
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 17
Page 22
Atlas Data Center CANN Software Installation Guide (Inference) 3 Installing the Development Environment
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
lib-dev| grep lib-dev| grep ii
dpkg -l 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 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 les
lib-dev:arm64
unzip 6.0-21ubuntu1 amd64 De-archiver for .zip les 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
3.2.1-8 arm64 Foreign Function Interface library (development les)
les
les)
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 lib-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 conguration, build, and installation commands:
cd Python-3.7.5 ./congure --prex=/usr/local/python3.7.5 --enable-shared
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 18
Page 23
Atlas Data Center CANN Software Installation Guide (Inference) 3 Installing the Development Environment
make sudo make install
The
--prex parameter species 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
--prex=/usr/local/python3.7.5 as an example. After the conguration, 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
le provided by the system
and run the following command:
Copy the compiled
sudo cp /usr/local/
le libpython3.7m.so.1.0 to /usr/lib64:
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
cp: overwrite 'libpython3.7m.so.1.0'?y
If the /usr/lib64 directory does not exist in the environment, copy the
le provided by the system.
le to
the /usr/lib directory.
sudo cp /usr/local
Replace the path of the libpython3.7m.so.1.0
/python3.7.5/lib
/libpython3.7m.so.1.0 /usr/lib
le 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.) The Model Accuracy Analyzer in the Toolkit depends on protobuf and SciPy.
Proling
depends on protobuf, grpcio, grpcio-tools, and requests.
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
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 19
Page 24
Atlas Data Center CANN Software Installation Guide (Inference) 3 Installing the Development Environment
pip3.7.5 install decorator pip3.7.5 install numpy pip3.7.5 install protobuf== pip3.7.5 install scipy pip3.7.5 install sympy pip3.7.5 install c pip3.7.5 install grpcio==1.32.0 pip3.7.5 install grpcio-tools==1.32.0 pip3.7.5 install requests
3.11.3
During the command execution, if the network connection fails and the message "Could not
nd a version that satises the requirement
xxx
" is displayed, rectify
the fault by referring to 6.4 What Do I Do If "Could not nd a version that
satises the requirement xxx" Is Displayed When pip3.7.5 install Is Run?.
----End

3.3.3 EulerOS (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-8 Dependency information
Parameter
Version
Python 3.7.5
cmake 3.5.1+
protobuf 3.11.3+
gcc 7.3.0 or later
gcc-c++ 7.3.0 or later
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 20
Page 25
Atlas Data Center CANN Software Installation Guide (Inference) 3 Installing the Development Environment
Parameter Version
make
unzip
zlib-devel
lib-devel
openssl-devel
sqlite-devel
pciutils
net-tools
lapack
lapack-devel
blas
blas-devel
gcc-gfortran
attrs
psutil
decorator
numpy
scipy
sympy
c
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
le and save the
le:
vi ~/.bashrc source ~/.bashrc
Creating Installation and Running Users
Table 3-9 lists the users for installing and running the driver, rmware, and CANN
software.
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 21
Page 26
NO TE
Atlas Data Center CANN Software Installation Guide (Inference) 3 Installing the Development Environment
Table 3-9 Installation and running user list
Package
Installation User Running User
Type
Driver and
The user must be root. The user must be a non-root user.
rmware
installation package
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=
usergroup=
user group
parameter) when installing the software package.
user name
--install-
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
To create a non-root user, run the following commands as the root user:
1. Create a non-root user.
groupadd useradd -g
usergroup
usergroup
-d /home/
username
-m
username
2. Set the password of the non-root user.
passwd
username
● 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 dierent, 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 le or using the chage command. For details, see 5.5 Setting User Account
Validity Period.
rst.
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 22
Page 27
NO TE
NO TE
NO TE
Atlas Data Center CANN Software Installation Guide (Inference) 3 Installing the Development Environment
(Optional) Conguring 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 le:
chmod u+w /etc/sudoers vi /etc/sudoers
2. Under root ALL=(ALL) ALL in the le, add the following content:
username
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.
3. Run :wq! to save the
4. Run the following command to revoke the write permission on the /etc/ sudoers
chmod u-w /etc/sudoers
ALL=(ALL:ALL) NOPASSWD:SETENV:/usr/bin/yum, /usr/bin/pip, /bin/tar, /bin/mkdir, /bin/
Ensure that the last line of the /etc/sudoers le is #includedir /etc/sudoers.d. Otherwise, add it manually.
le.
le:
Checking the Source Validity
The 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 repolist
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/ xxxx.repo
congure a network proxy, see 5.2 Conguring a System Network Proxy.
le with an available source or use an image source. For details about how to
Installing Dependencies
● 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 1 to 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:
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 23
Page 28
Atlas Data Center CANN Software Installation Guide (Inference) 3 Installing the Development Environment
gcc --version gcc-c++ --version make --version cmake --version rpm -qa|grep gcc-c++ rpm -qa |grep unzip rpm -qa |grep zlib-devel rpm -qa |grep rpm -qa |grep openssl-devel rpm -qa |grep sqlite-devel rpm -qa |grep unzip rpm -qa |grep pciutils rpm -qa |grep net-tools rpm -qa |grep lapack rpm -qa |grep lapack-devel rpm -qa |grep blas rpm -qa |grep blas-devel rpm -qa |grep gcc-gfortran
lib-devel
If the following information is displayed, the installation is complete. Go to the next step.
gcc (GCC) 7.3.0 gcc-c++-7.3.0 GNU Make 4.2.1 cmake version 3.12.1 unzip-6.0-40.eulerosv2r8.aarch64 zlib-devel-1.2.11-14.eulerosv2r8.aarch64
lib-devel-3.1-18.h3.eulerosv2r8.aarch64
openssl-devel-1.1.1-3.h7.eulerosv2r8.aarch64 sqlite-devel-3.24.0-2.h4.eulerosv2r8.aarch64 unzip-6.0-40.eulerosv2r8.aarch64 pciutils-3.5.1-3.el7.aarch64 net-tools-2.0-0.24.20131004git.el7.aarch64 lapack-3.8.0-10.eulerosv2r8.aarch64 lapack-devel-3.8.0-10.eulerosv2r8.aarch64 blas-3.8.0-10.eulerosv2r8.aarch64 blas-devel-3.8.0-10.eulerosv2r8.aarch64 gcc-gfortran-7.3.0-20190804.h22.eulerosv2r8.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 lib-devel openssl-devel sqlite-devel pciutils net-tools lapack lapack-devel blas blas-devel gcc-gfortran
Step 2 Check whether the Python development environment is installed.
The development kit depends on the Python environment. Run the python -- version and pip --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
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 24
Page 29
NO TE
Atlas Data Center CANN Software Installation Guide (Inference) 3 Installing the Development Environment
3. Go to the decompressed folder, create an installation directory, and run the conguration, build, and installation commands.
cd Python-3.7.5 mkdir
/usr/local/python3.7.5
./congure --prex=/usr/local/python3.7.5 --enable-loadable-sqlite-extensions --enable-shared make && make install
The --enable-shared parameter is used to compile the libpython3.7m.so.1.0 dynamic library.
4. Run the following command to copy the libpython3.7m.so.1.0 dynamic library:
a. The yum tool strongly depends on the libpython3.7m.so.1.0 le provided
by the system. Therefore, you need to back up the libpython3.7m.so.1.0 le. Run the following commands:
cd /usr/lib64 cp libpython3.7m.so.1.0 libpython3.7m.so.1.0.bak
If /usr/lib64 does not exist in the environment, use the actual path.
b. Copy the compiled
sudo cp /usr/local/
le libpython3.7m.so.1.0 to /usr/lib64:
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 le provided by the system.
cp: overwrite 'libpython3.7m.so.1.0'?
If the /usr/lib64 directory does not exist in the environment, copy the le 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 le as required.
c. If you need to use the yum tool, run the following command to restore
the libpython3.7m.so.1.0.bak le backed up in a:
mv libpython3.7m.so.1.0.bak libpython3.7m.so.1.0
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 sudo rm -rf /usr/bin/pip3.7 sudo rm -rf /usr/bin/python3.7.5 sudo rm -rf /usr/bin/pip3.7.5
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 --version pip3.7 --version 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
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 25
Page 30
Atlas Data Center CANN Software Installation Guide (Inference) 3 Installing the Development Environment
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 pip3.7.5 install grpcio==1.32.0 pip3.7.5 install grpcio-tools==1.32.0 pip3.7.5 install requests
c
During the command execution, if the network connection fails and the message "Could not
nd a version that satises the requirement
the fault by referring to 6.4 What Do I Do If "Could not
xxx
" is displayed, rectify
nd a version that
satises the requirement xxx" Is Displayed When pip3.7.5 install Is Run?.
----End

3.3.4 CentOS (x86 OS)

Environment Requirements
The following software or dependencies need to be installed for the development kit, Python, auxiliary development tools, and application compilation.
Table 3-10 Dependency information
Parameter
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
gcc-c++
Version
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.
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 26
Page 31
Atlas Data Center CANN Software Installation Guide (Inference) 3 Installing the Development Environment
Parameter Version
make
unzip
zlib-devel
lib-devel
openssl-devel
sqlite-devel
blas-devel
lapack-devel
openblas-devel
pciutils
net-tools
attrs
psutil
decorator
scipy
sympy
c
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 le and save the
le:
vi ~/.bashrc source ~/.bashrc
Creating Installation and Running Users
Table 3-11 lists the users for installing and running the driver, rmware, and
CANN software.
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 27
Page 32
NO TE
Atlas Data Center CANN Software Installation Guide (Inference) 3 Installing the Development Environment
Table 3-11 Installation and running user list
Package
Installation User Running User
Type
Driver and
The user must be root. The user must be a non-root user.
rmware
installation package
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=
usergroup=
user group
parameter) when installing the software package.
user name
--install-
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
To create a non-root user, run the following commands as the root user:
1. Create a non-root user.
groupadd useradd -g
usergroup
usergroup
-d /home/
username
-m
username
2. Set the password of the non-root user.
passwd
username
● 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 dierent, 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 le or using the chage command. For details, see 5.5 Setting User Account
Validity Period.
rst.
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 28
Page 33
NO TE
NO TE
Atlas Data Center CANN Software Installation Guide (Inference) 3 Installing the Development Environment
(Optional) Conguring 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
chmod u+w /etc/sudoers vi /etc/sudoers
2. Under root ALL=(ALL) ALL in the
username
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.
3. Run :wq! to save the le.
4. Run the following command to revoke the write permission on the /etc/ sudoers le:
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
le:
le, add the following content:
ALL=(ALL:ALL) NOPASSWD:SETENV:/usr/bin/yum, /usr/bin/pip, /bin/tar, /bin/mkdir, /bin/
Ensure that the last line of the /etc/sudoers le is #includedir /etc/sudoers.d. Otherwise, add it manually.
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
le with an available source or use an
image source. For details about how to congure a network proxy, see 5.2
Conguring a System Network Proxy.
Installing Dependencies
● 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 1 to 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
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 29
Page 34
Atlas Data Center CANN Software Installation Guide (Inference) 3 Installing the Development Environment
cmake --version rpm -qa|grep gcc-c++ rpm -qa |grep unzip rpm -qa |grep zlib-devel rpm -qa |grep lib-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 the following information is displayed, the installation is complete. Go to the next step.
gcc (GCC) gcc-c++-4.8.5 GNU Make cmake version unzip-6.0-21.el7.x86_64 zlib-devel-
lib-devel-
openssl-devel­sqlite-devel­blas-devel­lapack-devel­openblas-devel­pciutils-3.5.1-3.el7.aarch64 net-tools-2.0-0.24.20131004git.el7.aarch64
4.8.5
20150623 (Red Hat 4.8.5-39)
4.1
3.5.1
1.2.7-18.el7
3.0.13-18.el7
3.7.17-8.el7_7.1
3.4.2-8.el7
3.4.2-8.el7
.x86_64
.x86_64
1.0.2k-19.el7
.x86_64
.x86_64
0.3.3-2.el7.
.x86_64
.aarch64
x86_64
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 lib-devel openssl-devel sqlite-devel blas­devel lapack-devel openblas-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
19.2.3
pip
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
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 30
Page 35
Atlas Data Center CANN Software Installation Guide (Inference) 3 Installing the Development Environment
3. Go to the decompressed folder and run the following conguration, build, and installation commands:
cd Python-3.7.5 ./congure --prex=/usr/local/python3.7.5 --enable-shared make sudo make install
The --prex parameter species 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
--prex=/usr/local/python3.7.5 as an example. After the conguration, 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
le provided by the system
and run the following command:
Copy the compiled le 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 le 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
le 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 le 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
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 31
Page 36
Atlas Data Center CANN Software Installation Guide (Inference) 3 Installing the Development Environment
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 pip3.7.5 install grpcio==1.32.0 pip3.7.5 install grpcio-tools==1.32.0 pip3.7.5 install requests
c
During the command execution, if the network connection fails and the message "Could not
nd a version that satises the requirement
xxx
" is displayed, rectify
the fault by referring to 6.4 What Do I Do If "Could not nd a version that
satises 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.5 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-12 Dependency information
Parameter
Python 3.7.5
cmake 3.5.1+
protobuf 3.11.3+
g++ 7.3.0 or later
gcc 7.3.0 or later
Version
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 32
Page 37
Atlas Data Center CANN Software Installation Guide (Inference) 3 Installing the Development Environment
Parameter Version
make
zlib1g
zlib1g-dev
libsqlite3-dev
openssl
libssl-dev
lib-dev
unzip
pciutils
net-tools
attrs
psutil
decorator
numpy
scipy
sympy
c
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 le and save the
le:
vi ~/.bashrc source ~/.bashrc
Creating Installation and Running Users
Table 3-13 lists the users for installing and running the driver, rmware, and
CANN software.
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 33
Page 38
NO TE
Atlas Data Center CANN Software Installation Guide (Inference) 3 Installing the Development Environment
Table 3-13 Installation and running user list
Package
Installation User Running User
Type
Driver and
The user must be root. The user must be a non-root user.
rmware
installation package
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=
usergroup=
user group
parameter) when installing the software package.
user name
--install-
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
To create a non-root user, run the following commands as the root user:
1. Create a non-root user.
groupadd useradd -g
usergroup
usergroup
-d /home/
username
-m
username
2. Set the password of the non-root user.
passwd
username
● 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 dierent, 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 le or using the chage command. For details, see 5.5 Setting User Account
Validity Period.
rst.
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 34
Page 39
NO TE
NO TE
Atlas Data Center CANN Software Installation Guide (Inference) 3 Installing the Development Environment
(Optional) Conguring 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 le:
chmod u+w /etc/sudoers vi /etc/sudoers
2. Add the following content below # User privilege
username
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
ALL=(ALL:ALL) NOPASSWD:SETENV:/usr/bin/apt-get, /usr/bin/pip, /bin/tar, /bin/
Replace username with the name of the common user who executes the installation script.
Ensure that the last line of the /etc/sudoers le is #includedir /etc/sudoers.d. Otherwise, add it manually.
3. Run :wq! to save the
le.
4. Run the following command to revoke the write permission on the /etc/ sudoers
chmod u-w /etc/sudoers
le:
specication of the le:
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 details about how to congure a network proxy, see 5.2 Conguring a System
Network Proxy.
Installing Dependencies
● 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.
le with an available source or use an image source. For
Run the following commands to check whether the dependencies such as GCC, Make, and Python are installed:
gcc --version g++ --version
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 35
Page 40
Atlas Data Center CANN Software Installation Guide (Inference) 3 Installing the Development Environment
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
lib-dev| grep lib-dev| grep ii
dpkg -l 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 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 lib-dev:amd64 3.2.1-8 amd64 Foreign Function Interface library (development les) unzip 6.0-21ubuntu1 amd64 De-archiver for .zip les pciutils 1:3.5.2-1ubuntu1.1 amd64 Linux PCI Utilities net-tools 1.60+git20161116.90da8a0-1ubuntu1 amd64 NET-3 networking toolkit
les
les
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 lib-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
19.2.3
pip
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 conguration, build, and installation commands:
cd Python-3.7.5 ./congure --prex=/usr/local/python3.7.5 --enable-shared make sudo make install
--prex parameter species the Python installation path. You can change
The 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
--prex=/usr/local/python3.7.5 as an example. After the
conguration, compilation, and installation commands are executed, the
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 36
Page 41
Atlas Data Center CANN Software Installation Guide (Inference) 3 Installing the Development Environment
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 le provided by the system and run the following command:
Copy the compiled le 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
cp: overwrite 'libpython3.7m.so.1.0'?y
le provided by the system.
If the /usr/lib64 directory does not exist in the environment, copy the le 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 le 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== pip3.7.5 install scipy pip3.7.5 install sympy pip3.7.5 install pip3.7.5 install grpcio==1.32.0 pip3.7.5 install grpcio-tools==1.32.0 pip3.7.5 install requests
c
3.11.3
During the command execution, if the network connection fails and the message "Could not
nd a version that satises the requirement
xxx
" is displayed, rectify
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 37
Page 42
Atlas Data Center CANN Software Installation Guide (Inference) 3 Installing the Development Environment
the fault by referring to 6.4 What Do I Do If "Could not nd a version that
satises the requirement xxx" Is Displayed When pip3.7.5 install Is Run?.
----End

3.3.6 BClinux (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-14 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
gcc-c++
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.
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 38
Page 43
Atlas Data Center CANN Software Installation Guide (Inference) 3 Installing the Development Environment
Parameter Version
make
unzip
zlib-devel
lib-devel
openssl-devel
sqlite-devel
blas-devel
lapack-devel
openblas-devel
pciutils
net-tools
attrs
psutil
decorator
scipy
sympy
c
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 le and save the
le:
vi ~/.bashrc source ~/.bashrc
Creating Installation and Running Users
Table 3-15 lists the users for installing and running the driver, rmware, and
CANN software.
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 39
Page 44
NO TE
Atlas Data Center CANN Software Installation Guide (Inference) 3 Installing the Development Environment
Table 3-15 Installation and running user list
Package
Installation User Running User
Type
Driver and
The user must be root. The user must be a non-root user.
rmware
installation package
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=
usergroup=
user group
parameter) when installing the software package.
user name
--install-
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
To create a non-root user, run the following commands as the root user:
1. Create a non-root user.
groupadd useradd -g
usergroup
usergroup
-d /home/
username
-m
username
2. Set the password of the non-root user.
passwd
username
● 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 dierent, 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 le or using the chage command. For details, see 5.5 Setting User Account
Validity Period.
rst.
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 40
Page 45
NO TE
NO TE
Atlas Data Center CANN Software Installation Guide (Inference) 3 Installing the Development Environment
(Optional) Conguring 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 le:
chmod u+w /etc/sudoers vi /etc/sudoers
2. Under root ALL=(ALL) ALL in the le, add the following content:
username
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.
3. Run :wq! to save the le.
ALL=(ALL:ALL) NOPASSWD:SETENV:/usr/bin/yum, /usr/bin/pip, /bin/tar, /bin/mkdir, /bin/
Ensure that the last line of the /etc/sudoers le is #includedir /etc/sudoers.d. Otherwise, add it manually.
4. Run the following command to revoke the write permission on the /etc/ sudoers
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 clean all
Update the image source.
yum makecache
If the message "Your license is invalid" is displayed, obtain the OS authentication license.
If an error is reported during yum makecache command execution or dependency installation, check whether the network is connected, or replace the source in the /etc/yum.repos.d/BCLinux-Base.repo image source (the BCLinux uses the CentOS 7.6 source). For details about how to congure a network proxy, see 5.2 Conguring a System Network Proxy.
Installing Dependencies
le:
le with an available source or use an
● 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 1 to 3.
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 41
Page 46
Atlas Data Center CANN Software Installation Guide (Inference) 3 Installing the Development Environment
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 cmake --version rpm -qa|grep gcc-c++ rpm -qa |grep unzip rpm -qa |grep zlib-devel rpm -qa |grep 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
lib-devel
If the following information is displayed, the installation is complete. Go to the next step.
gcc (GCC) gcc-c++-4.8.5 GNU Make cmake version unzip-6.0-21.el7.x86_64 zlib-devel-
lib-devel-
openssl-devel­sqlite-devel­blas-devel­lapack-devel­openblas-devel­pciutils-3.5.1-3.el7.aarch64 net-tools-2.0-0.24.20131004git.el7.aarch64
4.8.5
20150623 (Red Hat 4.8.5-39)
4.1
3.5.1
1.2.7-18.el7
3.0.13-18.el7
3.7.17-8.el7_7.1
3.4.2-8.el7
3.4.2-8.el7
.x86_64
.x86_64
1.0.2k-19.el7
.x86_64
.x86_64
0.3.3-2.el7.
.x86_64
.aarch64
x86_64
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 lib-devel openssl-devel sqlite-devel blas­devel lapack-devel openblas-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:
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 42
Page 47
Atlas Data Center CANN Software Installation Guide (Inference) 3 Installing the Development Environment
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 conguration, build, and installation commands:
cd Python-3.7.5 ./congure --prex=/usr/local/python3.7.5 --enable-shared make sudo make install
--prex parameter species the Python installation path. You can change
The 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
--prex=/usr/local/python3.7.5 as an example. After the conguration, 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
le provided by the system
and run the following command: Copy the compiled
sudo cp /usr/local/
le libpython3.7m.so.1.0 to /usr/lib64:
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
cp: overwrite 'libpython3.7m.so.1.0'?y
le provided by the system.
If the /usr/lib64 directory does not exist in the environment, copy the le 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 le 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
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 43
Page 48
Atlas Data Center CANN Software Installation Guide (Inference) 3 Installing the Development Environment
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==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 pip3.7.5 install grpcio==1.32.0 pip3.7.5 install grpcio-tools==1.32.0 pip3.7.5 install requests
c
During the command execution, if the network connection fails and the message "Could not
nd a version that satises the requirement
the fault by referring to 6.4 What Do I Do If "Could not
xxx
" is displayed, rectify
nd a version that
satises 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.4 Pure Development

3.4.1 Installing the Development Kit

Prerequisites
Prepare for the installation by referring to 3.3 Preparations for Installation.
Obtain the development kit Ascend-cann-toolkit_
{arch}_{gcc_version}
Procedure
Step 1 Log in to the installation environment as the installation user of the software
packages.
.run by referring to 3.2 Obtaining Software Packages.
{version}
_linux-
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
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 44
Page 49
NO TE
NO TE
Atlas Data Center CANN Software Installation Guide (Inference) 3 Installing the Development Environment
In the preceding command, .run indicates the development kit Ascend-cann-
toolkit_
{version}
_linux-
{arch}
_gcc
x.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 le:
./*.run --check
Step 6 (Optional) Specify the software installation path.
If you need to specify the installation path, you need to create it rst. 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}
In the preceding command,
/Ascend
${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
specied 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.
● The development kits of multiple versions can be installed by dierent users in the same development environment. The users must be in the same group as the Driver running user. If the owner groups are dierent, 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 non-root user for privilege escalation.
● The --quiet option is not supported when the development kit Ascend-cann-
toolkit_
● If the following information is displayed during the installation of the development kit
Ascend-cann-toolkit_
asking you whether to perform a hot reset, enter n. After the installation is complete, restart the OS for the setting to take eect. In the current version, only n is supported.
The installation of aicpu_kernels needs to restart the device to take eect, do you want to hot_reset the device? [y/n] n
{version}
_linux-
{arch}_{gcc_version}
{version}
_linux-
{arch}_{gcc_version}
.run is installed in an x86 system.
le may be replaced by a
.run in the x86 system,
--
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 45
Page 50
Atlas Data Center CANN Software Installation Guide (Inference) 3 Installing the Development Environment
If the following information is displayed, the software is successfully installed:
[INFO]
xxx
[INFO] process end
xxx
----End
install success
indicates the name of the software package to be installed.
Log File and Software Package Paths
Table 3-16 Paths to the log
Item Path
Installation log path
Path for recording information such as the software package version, CPU architecture, GCC version, and installation path after the installation
Table 3-17 describes the variables in Table 3-16.
Table 3-17 Variable description
${install_path}
ascend_install.log
${install_path}
ascend_toolkit_install.info
le and software package
/ascend-toolkit/latest/
/ascend-toolkit/latest/
{arch}-
{arch}-
linux_gcc
linux_gcc
x.x.x
x.x.x
/
/
Variable
{arch}-
${install_path} Software package installation path.
linux_gcc
x.x.x
Description
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.

3.5 Development + Commissioning

3.5.1 Installing the Ascend AI Device Driver and Firmware

The following table lists the inference card models congured for each server.
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 46
Page 51
NO TE
Atlas Data Center CANN Software Installation Guide (Inference) 3 Installing the Development Environment
Hardware Inference Card Model
Atlas 800 inference server (model
3000)
Atlas 800 inference server (model
3010)
Inference server with Atlas 300I inference card (model 3010)
To install the inference card driver and rmware and upgrade the MCU, perform the following steps:
Step 1 Check the kernel version of the OS. For details, see "Installation and Maintenance
> Checking the Environment" in the
or
(Model 3000)
Step 2 Install the inference card driver and rmware. For details, see "Installation and
Maintenance > Installing the Driver and Firmware" in the
Atlas 300I Inference Card User Guide (Model 3010)
Card User Guide (Model 3000)
3010)
.
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).
Atlas 300I inference card (model 3000)
Atlas 300I inference card (model 3010)
Atlas 300I Inference Card User Guide
.
Atlas 300I Inference
or
Atlas 300I Inference Card User Guide (Model
----End
● Obtain the user guide based on the inference card model.
● 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.

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_
{arch}_{gcc_version}
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
.run by referring to 3.2 Obtaining Software Packages.
{version}
_linux-
Step 1 Log in to the installation environment as the installation user of the software
packages.
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 47
Page 52
NO TE
Atlas Data Center CANN Software Installation Guide (Inference) 3 Installing the Development Environment
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
In the preceding command, .run indicates the development kit Ascend-cann­toolkit_
{version}
_linux-
{arch}
_gcc
x.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 le:
./*.run --check
Step 6 (Optional) Specify the software installation path.
If you need to specify the installation path, you need to create it rst. 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}
In the preceding command,
/Ascend
${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
specied 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.
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 48
Page 53
NO TE
Atlas Data Center CANN Software Installation Guide (Inference) 3 Installing the Development Environment
● The development kits of multiple versions can be installed by dierent users in the same development environment. The users must be in the same group as the Driver running user. If the owner groups are dierent, 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 non-root user for privilege escalation.
● The --quiet option is not supported when the development kit Ascend-cann-
toolkit_
● If the following information is displayed during the installation of the development kit
Ascend-cann-toolkit_
asking you whether to perform a hot reset, enter n. After the installation is complete, restart the OS for the setting to take
The installation of aicpu_kernels needs to restart the device to take eect, do you want to hot_reset the device? [y/n] n
{version}
_linux-
{arch}_{gcc_version}
{version}
.run is installed in an x86 system.
_linux-
{arch}_{gcc_version}
eect. In the current version, only n is supported.
le may be replaced by a
.run in the x86 system,
If the following information is displayed, the software is successfully installed:
[INFO]
xxx
[INFO] process end
xxx
install success
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.
${install_path}
cd
/ascend-toolkit/latest/
2. Install the AICPU operator package.
./Ascend310-aicpu_kernels-
The AICPU does not support the specied installation path and shares the installation path of the driver.
----End
Log File and Software Package Paths
Table 3-18 Paths to the log
Item
Installation log path
Path
${install_path}
ascend_install.log
le and software package
{arch}
-linux_gcc
{version}
.run --full
/ascend-toolkit/latest/
{arch}-
x.x.x
/aicpu
linux_gcc
x.x.x
/
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 49
Page 54
Atlas Data Center CANN Software Installation Guide (Inference) 3 Installing the Development Environment
Item Path
Path for recording information such as the software package version, CPU architecture, GCC version, and installation path after the installation
Table 3-19 describes the variables in Table 3-18.
Table 3-19 Variable description
Variable Description
{arch}-
linux_gcc
${install_path}
ascend_toolkit_install.info
x.x.x
/ascend-toolkit/latest/
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.
{arch}-
linux_gcc
x.x.x
/
${install_path} Software package installation path.

3.6 Performing Post-installation Operations

Conguring Environment Variables
Step 1 Log in to the server as the root user.
Step 2 Run the vi ~/.bashrc command.
Step 3 Add environment variables in Table 3-20 to the .bashrc
le.
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 50
Page 55
Atlas Data Center CANN Software Installation Guide (Inference) 3 Installing the Development Environment
Table 3-20 Environment variables
Scenario Environment Variable
Inference (development environment)
Step 4 Run source .bashrc to make the environment variables take
----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 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:
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
eect.
conguring the environment
1. Log in to the server as the root user.
2. Run the usermod -a -G HwHiAiUser to the HwHiAiUser user group. 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.
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 51
{username}
{username}
command to add the user
indicates the name of the non-
Page 56
Atlas Data Center CANN Software Installation Guide (Inference) 3 Installing the Development Environment
Figure 3-1 Number of the installed card
2. Run the ascend-dmi -dg -c health status. 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/ directory, run the following command:
ascend-dmi -c -p /home/
For details about how to check software and hardware compatibility, see 5.7
Performing a Software and Hardware Compatibility Test.
----End
{card-number}
{card-number}
indicates the card number. Replace it as
xxx
/Ascend
-l 1 command to query the
xxx
/Ascend
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 52
Page 57
Atlas Data Center CANN Software Installation Guide (Inference) 4 Installing the Operating Environment

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 operating environment based on the following table. The versions of the software packages must be consistent.
Hardware
Atlas 800 inference server (model 3000)
Atlas 800 inference server (model 3010)
Inference server with Atlas 300I inference card (model
3010)
Ascend AI Device How to Obtain
Atlas 300I inference card (model 3000)
Atlas 300I inference card (model 3010)
les required for installing the
For details, see Table 4-1 and Table 4-2.
For details, see Table 4-1 and Table 4-3.
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 53
Page 58
Atlas Data Center CANN Software Installation Guide (Inference) 4 Installing the Operating Environment
Table 4-1 CANN software packages
Packag
Package Name Description How
e Type
Oine
inferenc e engine
Ascend-cann­nnrt_
{version}
{arch}_{gcc_version}
package
Toolbox Ascend-cann-
toolbox_
{version}
{arch}_{gcc_version}
Ascend Docker
Ascend-docker­runtime_
{arch}
{version}_{os}-
.tar.gz
_linux-
_linux-
.run
.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).
It contains AICPU operators, which are used for inference model calling.
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.
to Obtain
Link
Table 4-2 Atlas 300I inference card (model 3000) software packages
Packag
Package Name Description How to
e Type
Driver packag e
Firmwa re
A300-3000-npu­driver_
{version}_{os}
aarch64.run
A300-3000-npu­rmware_
{version}
-
.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.
Ascend rmware
installation package packag e
Obtain
Link
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 54
Page 59
Atlas Data Center CANN Software Installation Guide (Inference) 4 Installing the Operating Environment
Packag
Package Name Description How to
e Type
MCU packag e
● A300-3000­mcu_
{version}
● A300-3000­mcu_
{version}
.bin
.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
Package
Package Name Description How to
Type
Obtain
Obtain
Driver package
Firmware package
MCU package
A300-3010-npu­driver_
{version}_{os}
X86_64.run
A300-3010-npu­rmware_
{version}
● A300-3010­mcu_
{version}
● A300-3010­mcu_
{version}
.run
.bin
.hpm
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
Ascend rmware installation package
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.
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 55
Page 60
NO TE
Atlas Data Center CANN Software Installation Guide (Inference) 4 Installing the Operating Environment
{version}
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.
indicates the software version,
{arch}
indicates the processor architecture, and

4.2 Installation on a Physical Machine

4.2.1 Preparations for Installation

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
le:
vi ~/.bashrc source ~/.bashrc
{os}
le and save the
Creating Installation and Running Users
Table 4-4 lists the users for installing and running the driver,
software.
Table 4-4 Installation and running user list
Package Type
Driver and
rmware
installation package
CANN software package
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.
Installation User Running User
The user must be root. The user must be a non-root user.
The user can be root or non-root. For details, see the content below the table.
rmware, and CANN
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 56
Page 61
NO TE
Atlas Data Center CANN Software Installation Guide (Inference) 4 Installing the Operating Environment
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=
usergroup=
user group
parameter) when installing the software package.
user name
--install-
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
rst.
To create a non-root user, run the following commands as the root user:
1. Create a non-root user.
groupadd useradd -g
usergroup
usergroup
-d /home/
username
-m
username
2. Set the password of the non-root user.
passwd
username
● 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 dierent, 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 le or using the chage command. For details, see 5.5 Setting User Account
Validity Period.

4.2.2 Installing the Ascend AI Device Driver and Firmware

The following table lists the inference card models congured for each server.
Hardware
Atlas 800 inference server (model
3000)
Atlas 800 inference server (model
3010)
Inference server with Atlas 300I inference card (model 3010)
Inference Card Model
Atlas 300I inference card (model 3000)
Atlas 300I inference card (model 3010)
To install the inference card driver and
rmware and upgrade the MCU, perform
the following steps:
Step 1 Check the kernel version of the OS. For details, see "Installation and Maintenance
> Checking the Environment" in the
(Model 3000)
or
Atlas 300I Inference Card User Guide (Model 3010)
Atlas 300I Inference Card User Guide
.
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 57
Page 62
NO TE
Atlas Data Center CANN Software Installation Guide (Inference) 4 Installing the Operating Environment
Step 2 Install the inference card driver and rmware. For details, see "Installation and
Maintenance > Installing the Driver and Firmware" in the
Card User Guide (Model 3000)
3010)
.
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).
----End
● Obtain the user guide based on the inference card model.
● 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.
or
Atlas 300I Inference Card User Guide (Model
Atlas 300I Inference

4.2.3 Installing the Inference Software

Prerequisites
Procedure
Step 1 Log in to the installation environment as the installation user of the software
Prepare for the installation by referring to 4.2.1 Preparations for Installation.
Before installing the software, ensure that the inference card driver and rmware have been installed in the installation environment.
Obtain the oine inference engine package Ascend-cann-
nnrt_
{version}
toolbox_
Obtaining Software Packages.
The AICPU operator package in the toolbox must be installed as the root user. If you install the toolbox as a non-root user, you need to switch to the root user to install the AICPU operator package.
Obtain and install the oine inference engine package and utility tool package. The installation sequence is not required and the installation procedures are the same. The detailed installation procedure is as follows:
package.
For details about the installation user requirements, see Creating Installation and
Running Users.
_linux-
{version}
{arch}_{gcc_version}
_linux-
{arch}_{gcc_version}
.run and Toolbox Ascend-cann-
.run by referring to 4.1
Step 2 Upload the
(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
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 58
oine inference engine package and utility kit obtained to any path
Page 63
NO TE
Atlas Data Center CANN Software Installation Guide (Inference) 4 Installing the Operating Environment
*.run indicates the software package name, for example, the oine inference engine package Ascend-cann-nnrt_ actual package name.
{version}
_linux-
{arch}_{gcc_version}
.run. Replace it with the
Step 5 Run the following command to check the consistency and integrity of the software
package installation le:
./*.run --check
Step 6 (Optional) Specify the software installation path.
If you need to specify the installation path, you need to create it rst. 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}
In the preceding command,
/Ascend
${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
specied 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.
--
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 59
Page 64
NO TE
Atlas Data Center CANN Software Installation Guide (Inference) 4 Installing the Operating Environment
● The oine inference engine package and utility kit can be installed by dierent users in the same operating environment. However, for dierent users, the installed versions must be the same, and users must be in the same group as the Driver running user. Otherwise, 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 non-root user for privilege escalation.
● The --quiet option is not supported when the Toolbox Ascend-cann-
toolbox_
● If the following information is displayed during the installation of the Toolbox Ascend­cann-toolbox_
whether to perform a hot reset, enter n. After the installation is complete, restart the OS for the setting to take
The installation of aicpu_kernels needs to restart the device to take eect, do you want to hot_reset the device? [y/n] n
{version}
{version}
_linux-
{arch}_{gcc_version}
_linux-
eect. In the current version, only n is supported.
.run is installed in an x86 system.
{arch}_{gcc_version}
.run in the x86 system, asking you
le may be replaced by a
If the following information is displayed, the software is successfully installed:
[INFO]
xxx
[INFO] process end
xxx
install success
indicates the name of the software package to be installed.
Step 8 If a non-root user is used to install the toolbox in the previous step, perform this
step. Switch to the root user (you can also run the sudo command) and run the installation command.
1. Go to the directory where the AICPU operator package is stored.
${install_path}
cd
/toolbox/latest/
2. Install the AICPU operator package.
./Ascend310-aicpu_kernels-
The AICPU does not support the specied installation path and shares the installation path of the driver.
----End
Log File and Software Package Paths
The toolbox is used as an example to describe the paths of log package paths.
Table 4-5 Paths to the log
Item
Installation log path
Path
${install_path}
ascend_install.log
le and software package
xxx
-linux_gcc
{version}
.run --full
/toolbox/latest/
x.x.x
{arch}-
/aicpu
le and software
linux_gcc
x.x.x
/
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 60
Page 65
Atlas Data Center CANN Software Installation Guide (Inference) 4 Installing the Operating Environment
Item Path
Path for recording information such as the software package version, CPU architecture, GCC version, and installation path after the installation
Table 4-6 describes the variables in Table 4-5.
Table 4-6 Variable description
Variable Description
{arch}-
linux_gcc
${install_path}
ascend_toolkit_install.info
x.x.x
/toolbox/latest/
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.
{arch}-
linux_gcc
x.x.x
/
${install_path} Software package installation path.

4.2.4 Performing Post-installation Operations

The operations described in this section cannot be performed on an Atlas 200 AI accelerator module (model 3000) that functions as a PCIe slave device (EP mode).
Conguring Environment Variables
Step 1 Log in to the server as the root user.
Step 2 Run the vi ~/.bashrc command.
Step 3 Add environment variables in Table 4-7 to the .bashrc
le.
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 61
Page 66
Atlas Data Center CANN Software Installation Guide (Inference) 4 Installing the Operating Environment
Table 4-7 Environment variables
Scenario Environment Variable
Inference (operating environment)
Step 4 Run source .bashrc to make the environment variables take eect.
----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 conguring 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:
install_path=/usr/local/Ascend #Change the path based on the site requirements.
export PATH=${install_path}/toolbox/latest/Ascend-DMI/bin:$ {PATH}
export LD_LIBRARY_PATH=/usr/local/dcmi:${install_path}/ toolbox/latest/Ascend-DMI/lib64:${install_path}/nnrt/latest/ acllib/lib64:/usr/local/Ascend/driver/lib64:${LD_LIBRARY_PATH}
export PYTHONPATH=${install_path}/nnrt/latest/pyACL/ python/site-packages/acl:$PYTHONPATH
1. Log in to the server as the root user.
2. Run the usermod -a -G HwHiAiUser to the HwHiAiUser user group. root user. Replace it with the actual user name.
To verify the installation, perform the following steps:
Step 1 Check the device health status.
Run the ascend-dmi -dg -l 0 command to query health information.
For details about how to check the device health status, see "Tool Usage Guide > Performing Fault Diagnostics" in the .
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/ directory, run the following command:
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 62
{username}
{username}
command to add the user
indicates the name of the non-
xxx
/Ascend
Page 67
NO TE
Atlas Data Center CANN Software Installation Guide (Inference) 4 Installing the Operating Environment
ascend-dmi -c -p /home/
For details about how to check software and hardware compatibility, see "Tool Usage Guide > Performing a Software and Hardware Compatibility Test" in the .
----End
xxx
/Ascend

4.3 Installation in a Container

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

Creating a Running User
You must install the driver and you must run the driver and cannot be in the root user group. The following uses the default running user HwHiAiUser of the driver as an example.) Before the installation, you need to create a running user.
To create the HwHiAiUser user, perform the following steps as user root:
rmware as the root user. After the installation,
rmware as a non-root user. (The running user
1. Create the HwHiAiUser user.
groupadd HwHiAiUser
useradd -g HwHiAiUser -d /home/HwHiAiUser -m
2. Set the password of the HwHiAiUser user.
passwd HwHiAiUser
● The owner group of the running user is HwHiAiUser.
● 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 le or using the chage command. For details, see 5.5 Setting User Account
Validity Period.
HwHiAiUser
Installing the Inference Card Driver and Firmware and Upgrading the MCU
The following table lists the inference card models
Hardware
Atlas 800 inference server (model
3000)
Inference Card Model
Atlas 300I inference card (model 3000)
congured for each server.
Atlas 800 inference server (model
3010)
Inference server with Atlas 300I inference card (model 3010)
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 63
Atlas 300I inference card (model 3010)
Page 68
NO TE
Atlas Data Center CANN Software Installation Guide (Inference) 4 Installing the Operating Environment
To install the inference card driver and rmware and upgrade the MCU, perform the following steps:
Step 1 Check the kernel version of the OS. For details, see "Installation and Maintenance
> Checking the Environment" in the
(Model 3000)
Step 2 Install the inference card driver and rmware. For details, see "Installation and
Maintenance > Installing the Driver and Firmware" in the
or
Atlas 300I Inference Card User Guide (Model 3010)
Card User Guide (Model 3000)
3010)
.
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).
----End
● Obtain the user guide based on the inference card model.
● 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.
Atlas 300I Inference Card User Guide
.
Atlas 300I Inference
or
Atlas 300I Inference Card User Guide (Model

4.3.2 Installing the Toolbox on the Host

The Ascend-Toolbox-{version}-x.x.x-linux_gccx.x.x.run tool package cannot be installed in the container. Therefore, you need to install the tool package by referring to 4.2.3 Installing the Inference Software. The tool package contains the AICPU operator. Therefore, the AICPU operator must be installed.

4.3.3 Installing Ascend Docker on the Host

Ascend Docker provides Ascend NPU-based containerization support for all AI training and inference jobs so that AI jobs can run smoothly on Ascend devices as Docker containers.
Prerequisites
The Docker program has been installed in the packaging environment and the Docker version is 18.03 or later.
The Ascend Docker software package has been obtained in 4.1 Obtaining
Software Packages based on the OS and platform type.
Installing Ascend Docker
Step 1 Upload the obtained software package to the server.
Step 2 Go to the directory where the software package is stored and run the following
command to decompress the Ascend Docker software package:
tar -xzvf Ascend-docker-runtime_
Step 3 Run the following command to switch to the directory where the decompressed
installation le is stored:
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 64
{version}_{os}-{arch}
.tar.gz
Page 69
NO TE
Atlas Data Center CANN Software Installation Guide (Inference) 4 Installing the Operating Environment
cd build
Step 4 Run the required command to install Ascend Docker based on the OS type.
OS Command
Ubuntu sudo dpkg -i ascend-docker-runtime_
CentOS sudo rpm -i ascend-docker-runtime-
{version}
indicates the software version, and
<arch>
indicates the CPU architecture.
Step 5 Run the following command to restart Docker:
sudo systemctl restart docker
----End

4.3.4 Creating an Inference Container Image

Mapping Between Host and Container OSs
Table 4-8 lists the mapping between host OSs and container OSs. (Ubuntu 18.04
is recommended as the container OS.)
{version}_{arch}
{version}.{arch}
.deb
.rpm
Table 4-8 Mapping between host and container OSs
Architec ture
x86 Ubuntu
Host OS Version
Host Kernel Version Container OS Version
4.15.0-29-generic Ubuntu 18.04
18.04.1
CentOS 7.6 3.10.0-957.el7.x86_64CentOS 7.6
ARM Ubuntu
4.15.0-29-generic Ubuntu 18.04
18.04.1
CentOS 7.6 4.14.0-115.el7a.
0.1.aarch64
CentOS 7.6
NOTE
The driver needs to be installed in the container.
Ubuntu 18.04
CentOS 7.6
NOTE
The driver needs to be installed in the container.
CentOS 7.6
Ubuntu 18.04
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 65
Page 70
NO TE
Atlas Data Center CANN Software Installation Guide (Inference) 4 Installing the Operating Environment
● You do not need to install the driver in the container for an OS that does not have the note "The driver needs to be installed in the container" in Table 4-8.
● In the container image OS scenario, only services in the running state are supported, and services in the development state are not supported.
● Currently, the container image OS can be Ubuntu 18.04.1 and 18.04.4.
Prerequisites
Obtain the software packages and the Dockerle and script les required for packaging images by referring to Table 4-9.
In a software package name,
{arch}
indicates the operating system architecture, and
the GCC version.
The user environment needs to connect to the network to pull images. If the network is not connected, see 5.2
The container OS image can be obtained from Docker Hub. For example, to pull the Ubuntu 18.04 container image, run the following command:
docker pull ubuntu:18.04
The ARM CentOS 7.6 cannot be obtained from Docker Hub. If you need to use the CentOS 7.6 image, you can obtain it from AscendHub. After the image is obtained, run the following command to rename the image:
docker tag swr.cn-south-1.myhuaweicloud.com/public-ascendhub/centos:7.6.1810 arm64v8/centos:7
{version}
indicates the software package version,
{gcc_version}
Conguring a System Network Proxy.
indicates
Table 4-9 Required software
Software Package
Ascend-cann­nnrt_
{version}
_linux-
{arch}_{gcc_version}
A300-30x0-npu­driver_ 6-gcc4.8.5-
{version}_
{arch}
centos7.
.run
.run
Description How to Obtain
Oine inference engine package
Driver installation package. According to
Table 4-8, if the driver
needs to be installed in the container, obtain this software package.
Dockerle Required for creating an
image
Service inference program package
Service inference program package. The .tgz format is supported.
install.sh Installation script of the
service inference program.
See 2.
● ARM: Link
● x86: Link
Prepared by users
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 66
Page 71
Atlas Data Center CANN Software Installation Guide (Inference) 4 Installing the Operating Environment
Software Package Description How to Obtain
run.sh Script for running the
service inference program.
Procedure
Step 1 Log in to the server as the root user.
Step 2 Create a directory for uploading the software package (for example, /home/test).
mkdir -p /home/test
Step 3 Upload the software package to the /home/test directory.
Ascend-cann-nnrt_
A300-30x0-npu-driver_ driver if it does not need to be installed in the container.)
Service inference program package
{version}
{version}_
_linux-
{arch}_{gcc_version}
centos7.6-gcc4.8.5-
.run
{arch}
.run (Ignore this
Step 4 Perform the following steps to create a
1. Go to the software package upload directory and run the following command to create a
Dockerle (for example, Dockerle):
vi Dockerle
2. Write the following content to the le and run the :wq command to save the le. The Dockerle content is edited in the following two scenarios:
The driver does not need to be installed in the container. The following
uses Ubuntu 18.04 as an example. For details, see Compilation Sample.
# Obtain the container image ubuntu:18.04. FROM ubuntu:18.04
# Specify the oine inference engine package and user ID. ARG NNRT_PKG ARG ASCEND_BASE=/usr/local/Ascend ARG HWHIAIUSER_UID ARG HWHIAIUSER_GID
# Environment variables ENV LD_LIBRARY_PATH=\ $LD_LIBRARY_PATH:\ $ASCEND_BASE/driver/lib64:\ $ASCEND_BASE/nnrt/latest/acllib/lib64
# Specify the main directory of the working container and copy the installation package. WORKDIR /root COPY $NNRT_PKG .
Dockerle:
# Install the RUN umask 0022 && \ if [ "$(uname -m)" = "aarch64" ] && [ ! -d "/lib64" ]; \ then \ mkdir /lib64 && ln -sf /lib/ld-linux-aarch64.so.1 /lib64/ld-linux-aarch64.so.1; \
&& \ groupadd HwHiAiUser && \ useradd -g HwHiAiUser -d /home/HwHiAiUser -m HwHiAiUser && \ groupmod -g $HWHIAIUSER_GID HwHiAiUser && \ usermod -u $HWHIAIUSER_UID HwHiAiUser && \
oine inference engine package.
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 67
Page 72
Atlas Data Center CANN Software Installation Guide (Inference) 4 Installing the Operating Environment
chmod +x ${NNRT_PKG} && \ ./${NNRT_PKG} --quiet --install && \ rm ${NNRT_PKG}
# Copy the service program package and script le. ARG DIST_PKG COPY $DIST_PKG . COPY install.sh . COPY run.sh /usr/local/bin/
# Run the installation script. RUN chmod +x /usr/local/bin/run.sh && \ sh install.sh && \ rm $DIST_PKG && \ rm install.sh
# Program that is run by default when the container is started. CMD run.sh
The driver needs to be installed in the container. The following uses
CentOS ARM 7.6 as an example. For details, see Compilation Sample.
FROM arm64v8/centos:7
# Specify the oine inference engine package, driver package, and user ID.
ARG NNRT_PKG ARG DRIVER_PKG ARG ASCEND_BASE=/usr/local/Ascend ARG HWHIAIUSER_UID ARG HWHIAIUSER_GID
# Environment variables ENV LD_LIBRARY_PATH=\ $LD_LIBRARY_PATH:\ $ASCEND_BASE/driver/lib64:\ $ASCEND_BASE/nnrt/latest/acllib/lib64
# Specify the main directory of the working container and copy the installation package. WORKDIR /root COPY $NNRT_PKG . COPY $DRIVER_PKG .
# Install the RUN umask 0022 && \ groupadd HwHiAiUser && \ useradd -g HwHiAiUser -d /home/HwHiAiUser -m HwHiAiUser && \ groupmod -g $HWHIAIUSER_GID HwHiAiUser && \ usermod -u $HWHIAIUSER_UID HwHiAiUser && \ chmod +x ${DRIVER_PKG} && \ chmod +x ${NNRT_PKG} && \ ./${DRIVER_PKG} --docker && \ ./${NNRT_PKG} --quiet --install && \ rm ${DRIVER_PKG} && \ rm ${NNRT_PKG}
# Copy the service program package and script ARG DIST_PKG COPY $DIST_PKG . COPY install.sh . COPY run.sh /usr/local/bin/
# Run the installation script. RUN chmod +x /usr/local/bin/run.sh && \ sh install.sh && \ rm $DIST_PKG && \ rm install.sh
oine inference engine package and driver package.
le.
# Program that is run by default when the container is started. CMD run.sh
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 68
Page 73
NO TE
NO TE
Atlas Data Center CANN Software Installation Guide (Inference) 4 Installing the Operating Environment
The procedure for preparing the install.sh and run.sh scripts is the same as that for preparing the Dockerle. Compilation Sample shows the le content.
– In this document, the driver running user is HwHiAiUser. If you specify another
user as the driver running user, change the user name to the actual one.
– After creating the Dockerle, run the following command to change the permission
on the Dockerle:
chmod 600 Dockerle
Step 5 Go to the directory where the software packages are stored and run the following
command to create a container image:
docker build -t DRIVER_PKG= HWHIAIUSER_GID=
image-name
drivepackage-name
gid
In the preceding command, --build-arg DRIVER_PKG=
--build-arg NNRT_PKG=
--build-arg HWHIAIUSER_UID=
--build-arg DIST_PKG=
nnrt-name
distpackage-name
drivepackage-name
--build-arg
uid
--build-arg
.
is the specied driver package. If you do not need to install the driver in the container, delete it. Do not omit . at the end of the command. Table 4-10 describes the parameters in the command.
Table 4-10 Command parameter description
Parameter
image-name
Description
Species the image name and tag. Change them based on the actual situation.
--build-arg Parameters in the Dockerle.
NNRT_PKG
nnrt-name
: species the name of the oine inference engine package. Do not omit the le name extension. Replace it with the actual one.
DRIVER_PKG
drivepackage-name
: species the name of the driver package. Do not omit the le name extension. Replace it with the actual one.
HWHIAIUSER_UI D
HWHIAIUSER_GID
uid
: species the UID of HwHiAiUser. Replace it with the
UID of HwHiAiUser on the host.
gid
: species the GID of HwHiAiUser. Replace it with the
Gid of HwHiAiUser on the host.
DIST_PKG
distpackage-name
: species the name of the compressed package of the service inference program. Do not omit the le name extension. Replace it with the actual one.
Run the following command to query the UID and GID of the HwHiAiUser user on the host:
id HwHiAiUser
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 69
Page 74
Atlas Data Center CANN Software Installation Guide (Inference) 4 Installing the Operating Environment
If "Successfully built xxx" is displayed, the image is successfully created.
Step 6 After the image is created, run the following command to view the image
information:
docker images
Example:
REPOSITORY TAG IMAGE ID CREATED SIZE workload-image v1.0 1372d2961ed2 About an hour ago 249MB
----End
Compilation Sample
Pay attention to the following points when compiling a
Dockerle:
1. Replace the statement for pulling the basic image:
FROM ubuntu:18.04
Obtain the ubuntu: 18.04 image. You need to replace the image based on the container OS. For details, see Table 4-11.
Table 4-11 Example
Container OS Version Image Example
CentOS 7.6 Arm FROM arm64v8/centos:7
CentOS 7.6 x86 FROM centos:7.6.1810
Ubuntu 18.04 x86
FROM ubuntu:18.04
Ubuntu 18.04 ARM
2. Software packages corresponding to the container OS
Obtain the oine inference engine package of the corresponding GCC version based on the container OS. For details, see Table 4-12.
Table 4-12 Software packages corresponding to the container OS
Container OS Version
CentOS 7.6 Arm
CentOS 7.6 x86
Ubuntu 18.04 x86
Ubuntu 18.04
Oine Inference Engine Package
Ascend-cann­nnrt_
{version}
{arch}
_gcc4.8.5.run
_linux-
Ascend-cann­nnrt_
{version}
{arch}
_gcc7.3.0.run
_linux-
How to Obtain
Oine inference engine package:
Link
ARM
Example of compiling install.sh
#!/bin/bash
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 70
Page 75
Atlas Data Center CANN Software Installation Guide (Inference) 4 Installing the Operating Environment
# Create log-related les. mkdir -p /usr/slog mkdir -p /var/log/npu/slog/slogd chown -Rf HwHiAiUser:HwHiAiUser /usr/slog chown -Rf HwHiAiUser:HwHiAiUser /var/log/npu/slog
# Go to the working directory of the container and decompress the service inference program package. cd /root tar xf dist.tar
Example of compiling run.sh
#!/bin/bash
# Verify the installation of the npu-smi tool. npu-smi info
# Start the slogd daemon process. su HwHiAiUser --command "env LD_LIBRARY_PATH=/usr/local/Ascend/add-ons:$LD_LIBRARY_PATH /usr/ local/Ascend/driver/tools/slogd &" sleep 1 ps -ef | grep -v grep | grep "tools/slogd"
# Access the directory where the executable cd /root/dist #Run the executable ./main
le.
le of the service inference program is located.

4.3.5 Starting and Verifying a Container Image

Prerequisites
A container image has been created.
The Docker program has been installed in the packaging environment.
rmware, and Toolbox Ascend-cann-
{arch}_{gcc_version}
.run have been installed on the
Procedure
The inference card driver,
toolbox_
{version}
_linux-
host before starting the container.
See Table 4-13 to start the container image and verify the installation of the npu- smi tool and startup of the slogd daemon process.
Table 4-13 Command
Scenario
The driver is
Command
docker run -it -e ASCEND_VISIBLE_DEVICES=
xxx image-name
not installed in the container.
The driver is installed in the container.
docker run -it -e ASCEND_VISIBLE_DEVICES= ASCEND_RUNTIME_OPTIONS= smi:/usr/local/bin/npu-smi
NODRV
-v /usr/local/bin/npu-
image-name
xxx
-e
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 71
Page 76
Atlas Data Center CANN Software Installation Guide (Inference) 4 Installing the Operating Environment
Table 4-14 Parameter description
Parameter Description
-e ASCEND_VISIBLE_DEVICES=
xxx
Use the ASCEND_VISIBLE_DEVICES environment variable to specify the NPU device to be mounted to the container, and use the device sequence number to specify the device. You can specify a single device or a device range. The two types of devices can be used together. Example:
1. -e ASCEND_VISIBLE_DEVICES=0 indicates that device 0 (/dev/davinci0) is mounted to the container.
2. -e ASCEND_VISIBLE_DEVICES=1,3 indicates that devices 1 and 3 are mounted to the container.
3. -e ASCEND_VISIBLE_DEVICES=0-2 indicates that devices 0 to 2 (including devices 0 and 2) are mounted to the container. The
eect is the same as that
of
-e ASCEND_VISIBLE_DEVICES=0,1,2
4. ASCEND_VISIBLE_DEVICES=0-2,4: indicates that devices 0 to 2 and device 4 are mounted to the container. The eect is the same as that of
-e ASCEND_VISIBILE_DEVICES=0,1,2,4
image-name
Image name and tag. Change them based on the actual situation.
-e ASCEND_RUNTIME_OPTIONS=
DRV
NO
Only NPU devices and management devices (for example: /dev/davinci0, /dev/ davinci_manager, /dev/hisi_hdc, and /dev/devmm_svm) are mounted to the container to support driver installation in the container.
-v /usr/local/bin/npu-smi:/usr/ local/bin/npu-smi
Mount the npu-smi tool to the container. Change the value as required.
If the information similar to the following is displayed, the npu-smi tool is available and the slogd daemon process is started:
+------------------------------------------------------------------------------+ | npu-smi 20.0.0 Version: 1.73.T5.0.B050 | +-------------------+-----------------+----------------------------------------+ | NPU Name | Health | Power(W) Temp(C) | | Chip Device | Bus-Id | AICore(%) Memory-Usage(MB) | +===================+=================+========================================+ | 2048 310 | OK | 12.8 41 | | 0 0 | 0000:81:00.0 | 0 2457 / 8192 |
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 72
Page 77
NO TE
Atlas Data Center CANN Software Installation Guide (Inference) 4 Installing the Operating Environment
+===================+=================+========================================+ HwHiAiU+ 24 1 0 13:08 ? 00:00:00 /usr/local/Ascend/driver/tools/slogd
● In the preceding command example, the service program is run by default. If you need to directly access the container, add /bin/bash to the end of the command. An example is provided as follows:
docker run -it -e ASCEND_VISIBLE_DEVICES=
● The preceding command lists only the minimum mounting content. You can add the contents as required.
● For the default contents mounted to Ascend Docker Runtime, see 7.2 Default Mounted
Contents of Ascend Docker Runtime. If you use a specied path to install the driver on
the host, you need to mount the directories and les listed in Table 7-2. The following is an example:
docker run -it -e ASCEND_VISIBLE_DEVICES= slog.conf:/var/log/npu/conf/slog/slog.conf -v driver -v local/dcmi -v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi
In the preceding command,
● When the docker run command is used to start a container, the -e ASCEND_RUNTIME_OPTIONS=VERBOSE environment variable is added to print logs to /var/log/ascend-docker-runtime.log for debugging and fault locating. This function is disabled by default.
${install_path}
/add-ons:
${install_path}
${install_path}
xxx image-name
xxx
-v /var/log/npu/conf/slog/
${install_path}
/add-ons -v /usr/local/dcmi:/usr/
/bin/bash
/driver:
${install_path}
image-name
indicates the driver installation path.
/
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 73
Page 78
Atlas Data Center CANN Software Installation Guide (Inference) 5 Common Operations

5 Common Operations

5.1 Conguring the NIC IP Address
Conguring a System Network Proxy
5.2
5.3 Installing CMake 3.5.2
5.4 Uninstalling the CANN Software
5.5 Setting User Account Validity Period
5.6 Performing Fault Diagnostics
5.7 Performing a Software and Hardware Compatibility Test
5.1
Conguring the NIC IP Address on CentOS/EulerOS/BC_Linux
Conguring the NIC IP Address
After the OS is installed, you need to congure the IP address of the NIC on the iBMC remote management page to remotely connect to the server. The conguration method is as follows.
Step 1 Log in to the OS as the root user.
Step 2 Go to the
congured. NIC enp2s0f0 is used as an example. The NIC and path vary depending on the site requirements.
/etc/syscong/network-scripts/ifcfg-enp2s0f0
vi
Step 3 Congure the service IP address, subnet mask, and gateway of the corresponding
NIC, as shown in Figure 5-1.
conguration le of the NIC for which an IP address needs to be
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 74
Page 79
NO TE
Atlas Data Center CANN Software Installation Guide (Inference) 5 Common Operations
Figure 5-1 Setting network parameters
BOOTPROTO indicates the IP address type of the device. For a static IP address, set this parameter to static or none. For a dynamic IP address, set this parameter to dhcp so that the IP address can be obtained automatically.
● Set ONBOOT to yes to enable automatic network connection.
PREFIX indicates the network bit. If the value is 22, the subnet mask is 255.255.252.0.
Step 4 Restart the network service.
service network restart
Step 5 Check whether the IP address is
congured successful.
ifcong
----End
Conguring the NIC IP Address on Ubuntu
Step 1 Log in to the OS as the root user.
Step 2 Go to the
NIC and path vary depending on the site requirements.
vi /etc/netplan/01-netcfg.yaml
conguration le of the NIC. NIC enp125s0f0 is used as an example. The
Step 3
Congure the service IP address, subnet mask, and gateway, as shown in Figure
5-2.
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 75
Page 80
Atlas Data Center CANN Software Installation Guide (Inference) 5 Common Operations
Figure 5-2 Conguring the IP address
Step 4 Apply the conguration le.
netplan apply
Step 5 Check whether the IP address is
ifcong
----End
congured successful.
Conguring the NIC IP Address on Debian
Step 1 Log in to the OS as the root user.
Step 2 Go to the
and path vary depending on the site requirements.
vi /etc/network/interfaces
Step 3
Congure the service IP address, subnet mask, and gateway of the corresponding NIC, as shown in Figure 5-3.
Figure 5-3
conguration le of the NIC. NIC eno1 is used as an example. The NIC
Conguring the IP address
Step 4 Restart the network service.
service network restart
Step 5 Check whether the IP address is congured successful.
ifcong
----End
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 76
Page 81
NO TE
Atlas Data Center CANN Software Installation Guide (Inference) 5 Common Operations
5.2 Conguring a System Network Proxy
The following procedure is a general method for conguring a network proxy. It may not be applicable to all network environments. The method of conguring the network proxy depends on the actual network environment.
Prerequisites
Ensure that the network cable of the server is connected and the proxy server can connect to the external network.
The
Conguring a System Network Proxy
Step 1 Log in to the user environment as the root user.
conguration proxy is based on the condition that the server is located on
an intranet and cannot be directly connected to the external network.
Step 2 Run the following command to edit the
vi /etc/prole
/etc/prole le:
Add the following content to the le, save the le, and exit:
export http_proxy="http:// export https_proxy="
user:password@proxyserverip:port
http://user:password@proxyserverip:port
"
"
In the preceding commands, user indicates the username on the intranet, password indicates the user password, proxyserverip indicates the IP address of the proxy server, and port indicates the port number.
Step 3 Run the following command to make the
source /etc/prole
conguration take eect.
Step 4 Run the following command to check whether the external network is connected:
wget www.baidu.com
If the HTML le can be downloaded, the server is connected to the external network successfully.
If a certicate error occurs when you use a proxy to connect to the network, you need to install the certicate of the proxy server before downloading third-party components.
----End

5.3 Installing CMake 3.5.2

1. Run the wget command to download the source code package of CMake to any directory on the server:
wget https://cmake.org/les/v3.5/cmake-3.5.2.tar.gz --no-check-certicate
2. Run the following command to go to the download directory and decompress the source code package:
tar -zxvf cmake-3.5.2.tar.gz
3. Go to the decompressed folder and run the following conguration, compilation, and installation commands:
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 77
Page 82
Atlas Data Center CANN Software Installation Guide (Inference) 5 Common Operations
cd cmake-3.5.2 ./bootstrap --prex=/usr make sudo make install
4. After the installation is complete, run the cmake --version command again to check the version number.

5.4 Uninstalling the CANN Software

If you uninstall only the inference engine, development kit, or Toolbox, you can uninstall them in any sequence. However, if you also need to uninstall the inference card driver, you need to uninstall other software packages before uninstalling the driver.
Method 1: Uninstalling a Software Package
To uninstall an installed software package, perform the following steps:
Step 1 Log in to the installation environment as the installation user of the software
package.
Step 2 Go to the directory where the software packages are stored.
Step 3 Uninstall the software package.
If you specify a path when installing a software package, run the ./
package name
software package.
<path>
indicates the specied software package installation path. Replace the
software package name with the actual package name.
If you do not specify a path when installing the software package, run the./
software package name
package.
If the following information is displayed, the software is successfully uninstalled:
[INFO]
xxx
[INFO] process end
xxx
uninstall success
indicates the name of the software package to be uninstalled.
----End
Method 2: Using a Script
You can also use the uninstallation script to uninstall the. The following describes how to uninstall the development suite package.
.run --uninstall --install-path=
.run --uninstall command to uninstall the software
<path>
software
to uninstall the
Step 1 Go to the directory where the uninstallation script of the software is stored.
Generally, the script is stored in the script directory.
cd
<path>
{path}
in a
/ascend-toolkit/latest/xxx-linux_gccx.x.x/script
indicates the tool installation directory. If the software package is installed
specied directory, replace it with the specied directory. If this parameter is
not specied, the default directory is used.
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 78
Page 83
NO TE
Atlas Data Center CANN Software Installation Guide (Inference) 5 Common Operations
xxx-linux_gccx.x.x indicates the OS architecture and GCC version. Replace them as required.
Step 2 Run the ./uninstall.sh command to run the script.
----End

5.5 Setting User Account Validity Period

Run the chage command to set the validity period of a user account for security purposes.
Command:
chage [-m mindays] [-M maxdays] [-d lastday] [-I inactive] [-E expiredate] [-W warndays] user
Table 5-1 describes the parameters.
Table 5-1 Parameters description
Parameter Description
-m Minimum time (in days) for which the password must be used. The password cannot be changed during this period. The value 0 indicates that the password can be changed at any time.
-M Maximum validity period (days) of a password. The value 1 indicates that the validity check of the password can be disabled.
-d Last password change date.
-I Maximum idle period (in days) after which the user account will be disabled. After the specied time period has expired, the password will be invalid.
-E Date when the user account expires. The user account is unavailable when the account validity period has expired.
-W Number of days in advance users are notied that their passwords are about to expire.
-l Lists the current settings. It helps non-privileged users to determine the time when their passwords or accounts expire.
Table 5-1 lists only common parameters. You can run the chage --help command to display detailed parameter description.
● The date is in the format of indicates that the user account test will expire on December 1, 2020.
User must be specied. Replace it with the actual user name. The default user name is root.
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 79
YYYY-MM-DD
. For example, chage -E 2020-12-01 test
Page 84
Atlas Data Center CANN Software Installation Guide (Inference) 5 Common Operations
For example, to change the validity period of the test user to December 1, 2020, run the following command:
chage -E 2020-12-01 test

5.6 Performing Fault Diagnostics

Function
Obtain the chip health information and perform computing power, power consumption, and bandwidth tests on the chip, and determine the health status of the current product based on the test results.
Commands for Querying Test Parameters
You can run either of the following commands to list the parameters of the fault diagnostics command:
ascend-dmi -dg -h
ascend-dmi -dg --help
Table 5-2 describes the parameters.
Table 5-2 Parameter description
Parameter
[-dg, diagnosis] Performs a fault diagnostic test of
[-c, --card] Species a card for diagnostics. If
[-l, --level] Species the diagnosis level. If this
Description Mandatory/
the entire card.
this parameter is not specied, fault diagnostics will be performed on all cards by default.
You can run the ascend-dmi info command to obtain the numbers of the installed cards.
parameter is not specied, a level 0 diagnosis will be performed by default.
The following options are available:
0: performs a diagnosis test on the chip health.
1: performs a diagnosis test on the power consumption, bandwidth, and computing power of the card.
Optional
Mandatory
Optional
Optional
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 80
Page 85
NO TE
Atlas Data Center CANN Software Installation Guide (Inference) 5 Common Operations
Parameter Description Mandatory/
Optional
Example
Leave -c and -l
unspecied
Performs a level 0 diagnosis of all cards.
Optional
To ensure the correctness and accuracy of the test result, perform the fault diagnostic test separately.
The command output on an inference server is similar to that on a training server. The following uses the screenshots on an inference server as an example.
Perform a level 0 diagnosis test on card No. 65.
ascend-dmi -dg -c 65 -l 0
In the command, 65 is the number of the card to be tested. You can run the ascend-dmi info command to obtain the card number information.
If information shown in Figure 5-4 is displayed, the tool is running properly. For details about the parameters, see Table 5-3.
Figure 5-4 Fault diagnosis example (level 0)
Perform a level 1 diagnosis test on card No. 65.
ascend-dmi -dg -c 65 -l 1
In the command, 65 is the number of the card to be tested. You can run the ascend-dmi info command to obtain the card number information.
If information shown in Figure 5-5 is displayed, the tool is running properly. For details about the parameters, see Table 5-3.
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 81
Page 86
Atlas Data Center CANN Software Installation Guide (Inference) 5 Common Operations
Figure 5-5 Fault diagnosis example (level 1)
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 82
Page 87
Atlas Data Center CANN Software Installation Guide (Inference) 5 Common Operations
Table 5-3 Parameter description
Parameter Description
Card Indicates the card number.
Device Indicates the chip number.
Health Indicates the chip health status.
Flops Test Indicates the computing power test.
Duration (ms) Indicates the test duration in ms.
Computing Power (TFLOPS) Indicates the computing power.
Bandwidth Test Indicates the bandwidth test type.
Bandwidth (MB/s) Indicates the bandwidth in MB/s.
Power Test Indicates the power consumption test.
Max Power (W) Indicates the maximum power
consumption.
Average Power (W) Indicates the average power
consumption.
Max AI Core (%) Indicates the maximum AI core usage.
Average AI Core (%) Indicates the average AI core usage.
Max Temp (C) Indicates the maximum temperature.
Average Temp (C) Indicates the average temperature.
Max Voltage (V) Indicates the maximum voltage.
Average Voltage (V) Indicates the average voltage.

5.7 Performing a Software and Hardware Compatibility Test

Function
Test the hardware and software compatibility by obtaining the hardware information, architecture, driver version, rmware version, and software version information.
Commands for Querying Test Parameters
You can run either of the following commands to list the parameters of the compatibility test command:
ascend-dmi -c -h
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 83
Page 88
NO TE
Atlas Data Center CANN Software Installation Guide (Inference) 5 Common Operations
ascend-dmi -c --help
Table 5-4 describes the parameters.
Table 5-4 Parameter description
Parameter Description Mandatory/Optional
[-c, compatible] Checks the compatibility
of software and hardware versions.
[-p, --path] Species the installation
path of the software package to be checked.
The default path is used when the software package is installed by the root user. Therefore, you do not need to set this parameter.
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
Mandatory
Optional
The compatibility check tool checks the following software packages:
toolkit: development kit
nnrt:
nnae: deep learning acceleration engine
tfplugin: framework plug-in
toolbox: utility
npu_driver: driver
oine inference engine
npu_rmware: rmware
Example
Perform a software and hardware version compatibility test.
ascend-dmi -c
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 84
Page 89
Atlas Data Center CANN Software Installation Guide (Inference) 5 Common Operations
Figure 5-6 shows that the tool is running properly (the inference server is used as
an example). For details about the parameters, see Table 5-5.
Figure 5-6 Software and hardware compatibility test example
Table 5-5 Parameter description
Parameter
Description
System Information Displays the system information.
Architecture Indicates the architecture.
Product Type Indicates the hardware type.
Package Information Displays the package information.
NPU_Driver Indicates the NPU driver version.
NPU_Firmware Indicates the NPU rmware version.
Installed Software Lists the software installed.
Compatibility Check Result Displays the compatibility check
result.
Package Indicates the package name.
Version Indicates the version.
Status Indicates the status.
Dependencies Lists the dependency.
Unknown Packages Lists the packages that cannot be
identied.
WARNING Warning information.
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 85
Page 90
NO TE
Atlas Data Center CANN Software Installation Guide (Inference) 5 Common Operations
When an error is detected, the command output may contain the following information:
Unknown Packages: lists all packages that do not comply with the formats recorded in the system.
WARNING: The software package of an unknown version is installed or the Ascend-DMI tool needs to be updated.
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 86
Page 91
Atlas Data Center CANN Software Installation Guide (Inference) 6 FAQs

6 FAQs

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

6.2 pip3.7.5 install numpy Error

6.3 The error message "subprocess.CalledProcessError: Command '('lsb_release', '­a')' return non-zero exit status 1 " is displayed during pip3.7.5 installation.
6.4 What Do I Do If "Could not Displayed When pip3.7.5 install Is Run?
nd a version that satises the requirement xxx" Is
6.1 What Do I Do If the "Software Has Been Installed" During RUN Package Installation?
Symptom
The following message is displayed during installation:
run package is already installed, install failed
Solution
The software package cannot be installed repeatedly. You need to uninstall the software package and then install it. For details, see 5.4 Uninstalling the CANN
Software.
6.2 pip3.7.5 install numpy Error
Symptom
When you run the pip3.7 install numpy command to install the dependency, the error message "Could not build wheels for numpy which use PEP 517 and cannot be install directly" is displayed, as shown in the following
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 87
gure.
Page 92
Atlas Data Center CANN Software Installation Guide (Inference) 6 FAQs
Possible Causes
The default gcc version installed in the CentOS system is too early. As a result, the NumPy fails to be installed.
Procedure
Run the following commands to install virt-manager-common and virt-manager:
export CFLAGS=-std=c99 pip3.7 install numpy==1.17.2
Note that the CFLAGS ag is always valid in the active window.
export CFLAGS=
ag must be changed back after being used. Otherwise, the

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

Symptom
During dependency installation, the error message "subprocess.CalledProcessError: Command '('lsb_release', '-a')' return non-zero exit status 1 " is displayed when you run the pip3.7.5 install xxx command to install related software. The error message is as follows:
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 88
Page 93
Atlas Data Center CANN Software Installation Guide (Inference) 6 FAQs
Possible Causes
When the subprocess module of Python 3.7.5 is executed, the system displays a message indicating that the lsb_release.py module cannot be found when the lsb_release -a command is executed. The lib path of Python 3.7.5 is /usr/local/ python3.7.5/lib/python3.7/. The lsb_release.py module does not exist in the path. Therefore, an error is reported.
Procedure
Step 1 Run the following command to search for the missing
nd / -name lsb_release
After the preceding command is executed, the following path is obtained. The path is only an example and may vary according to the actual situation.
/usr/bin/lsb_release
Step 2 Run the following command to delete the /usr/bin/lsb_release le in Step 1:
rm /usr/bin/lsb_release
Step 3 Run the pip3.7.5 list command to check whether the fault is rectied.
----End
le lsb_release.py:
6.4 What Do I Do If "Could not nd a version that satises the requirement xxx" Is Displayed When pip3.7.5 install Is Run?
Symptom
During dependency installation, when the pip3.7.5 install xxx command is used to install related software, a message is displayed indicating that the network cannot be connected and the message "Could not requirement xxx" is displayed.
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 89
nd a version that satises the
Page 94
Atlas Data Center CANN Software Installation Guide (Inference) 6 FAQs
Figure 6-1 Message displayed upon pip3 install
Possible Causes
The pip source is not congured.
Procedure
Congure the pip source as follows:
Step 1 Run the following command as the installation user of the software package:
cd ~/.pip
If a message indicating that the directory does not exist is displayed, run the following commands to create and go to the directory:
mkdir ~/.pip cd ~/.pip
Create a pip.conf le in the .pip directory:
touch pip.conf
Step 2 Edit the pip.conf
le.
Run the vi pip.conf command to open the pip.conf le and edit the le as follows.
[global] # Huawei source is used as an example. Replace it based on the actual situation. index-url = https://mirrors.huaweicloud.com/repository/pypi/simple trusted-host = mirrors.huaweicloud.com timeout = 120
Step 3 Run the :wq! command to save the
----End
le and exit.
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 90
Page 95
NO TICE
Atlas Data Center CANN Software Installation Guide (Inference) 7 Reference

7 Reference

7.1 Parameters

7.2 Default Mounted Contents of Ascend Docker Runtime
7.3 About CCEC Compiler
7.4 HCC Overview
7.1 Parameters
One-click installation is supported in the command line. You can select parameters as required to complete the installation. All parameters are optional.
Installation command format: ./*.run [options]
For details, see Table 7-1.
If the parameters queried by running the ./*.run --help command are not described in the following table, this parameter is reserved or applies to other chip versions. You do not need to pay attention to this parameter.
Table 7-1 Parameters supported by the installation package
Parameter
Description
--help | -h Queries help information.
--version Queries version information.
--info Queries software package construction information.
--list Queries the software package list.
--check Checks the consistency and integrity of software packages.
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 91
Page 96
Atlas Data Center CANN Software Installation Guide (Inference) 7 Reference
Parameter Description
--quiet Silent installation, skipping interactive messages.
--noexec Decompresses a software package to the current directory without running the installation script. This parameter is used together with --extract=<path>. The format is as follows:
--noexec --extract=<path>
--extract=<path> Decompresses a software package to a specied directory.
--tar arg1
[arg2 ...]
Runs the tar command on the software package. Use the arguments following tar as the command arguments. For example, the --tar xvf command indicates that the .run package will be decompressed to the current directory.
--install Installs a software package. You can specify the installation path --install-path=<path> or use the default installation path.
--install-for-all Allows all users to have the same installation group permission.
If this option is included in installation or upgrade command, all users have the same permission on the directories and les created by the runle installer as the installation group.
This parameter must be used together with one of the parameters --install, --devel, and --upgrade, for example, ./
*.run --install --install-for-all.
NOTE
Make sure the security risks are considered before you include this option.
--install-
username=<user name>
Initial installation: You can specify the running user name. Otherwise, HwHiAiUser is used by default.
Overwrite: The user name used in the last installation is adopted.
This parameter must be used together with --install- usergroup=<usergroup>.
--install-
usergroup=<user group>
Initial installation: You can specify the running user group name. Otherwise, HwHiAiUser is used by default.
Overwrite: The user group name used in the last installation is adopted.
This parameter must be used together with --install- username=<username>.
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 92
Page 97
Atlas Data Center CANN Software Installation Guide (Inference) 7 Reference
Parameter Description
--install-
path=<path>
--uninstall Uninstalls the software that has been installed.
--upgrade Upgrades the software that has been installed. The system
--devel Installs a software package in development mode, that is,
Species the installation path. If you do not specify the installation path, the default installation path is used.
● For installation as user root, the default installation path
is /usr/local/Ascend.
● For installation as a non-root user, the default
installation path is ${HOME}/Ascend.
If this parameter is used to specify the installation directory, the running user must have the read and write permissions on the
automatically checks the version number. If the version number is not in ascending order, the upgrade cannot be performed.
install only the les required by the development environment.
specied installation directory.

7.2 Default Mounted Contents of Ascend Docker Runtime

In addition to NPUs and management devices (/dev/davinciX, /dev/ davinci_manager, /dev/hisi_hdc, and dev/devmm_svm), Ascend Docker Runtime
mounts the following directories and default.
Table 7-2 Default mounted directories and
Directory
/usr/local/Ascend/driver/lib64 Directory for storing user-mode libraries
/usr/local/Ascend/driver/tools Directory for storing tools provided by
/usr/local/Ascend/driver/include Directory for storing the header le
/usr/local/Ascend/add-ons Directory for storing third-party libraries.
les to containers in read-only mode by
les
Description
provided by the driver.
the driver. (Not all tools support the container scenario.)
(dsmi_common_interface.h) provided by the driver.
/usr/local/dcmi Directory for storing DCMI header les
and libraries.
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 93
Page 98
Atlas Data Center CANN Software Installation Guide (Inference) 7 Reference
Directory Description
/usr/local/bin/npu-smi Directory for storing les and the npu-
smi tool.
/var/log/npu/conf/slog/slog.conf Directory for storing the conguration
le of the log service.

7.3 About CCEC Compiler

The built-in CCEC compiler in Ascend AI Software Stack implements the TBE operator build, and compiles the Code Compute Engine (CCE) operator generated by the CodeGen module into an executable that can run on the Ascend AI ProcessorHiSilicon SoC. During graph build, the TBE automatically invokes the CCEC compiler, free from manual calling.
The CCEC compiler is stored in the ccec_compiler directory in the ATC or FwkACLlib installation path. The main binary tools are listed in the following table.
Table 7-3 CCEC compiler tools
Tool Name
clang ccec_compiler/bi
llvm­objdum p
Relative Path Description Risk Analysis
n/clang
ccec_compiler/bi n/llvm-objdump
CCE operator compiler.
Automatically invoked to build the TBE operators. It cannot be invoked separately.
Debugger, providing the function of printing the operator function name and oset address information for fault locating.
When the AI Core Error Analyzer is used to parse AI Core errors, this tool is automatically invoked to locate the function error during TBE operator development. It cannot be called be invoked separately.
Attackers may use the existing debugger or compiler to build new programs, causing secondary attack on the system.
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 94
Page 99
Atlas Data Center CANN Software Installation Guide (Inference) 7 Reference
Tool Name
lld ccec_compiler/bi
Relative Path Description Risk Analysis
n/lld

7.4 HCC Overview

The Toolkit runle provides the Huawei Compiler Collection (HCC) for compiling drivers and applications on the device side. The HCC is stored in the toolchain/ hcc/ directory in the Toolkit installation path. The following table describes the binary tools in the directory.
Table 7-4 HCC tools
Single-architecture CCE operator linker.
During TBE operator build, this tool is automatically used to link operators to form a complete executable program. It cannot be called be invoked separately.
Tool
gcc hcc/bin/aarch64-target-linux-gnu-gcc Compiles a source le into an
ld hcc/bin/aarch64-target-linux-gnu-
readelf hcc/bin/aarch64-target-linux-gnu-
Relative Path Description
executable.
This tool is used to compile user code on the device side.
Adds all symbols to the
gnu-ld
gnu-readelf
dynamic symbol table to create a dynamically linked executable.
This tool is used to link the intermediate complete executable le during user code compilation on the device side.
Displays the information contained in the ELF header at the start of the le.
This tool is used to display the information contained in the ELF header of the operator library binary the start of the le, for debugging purposes.
les to a
le at
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 95
Page 100
Atlas Data Center CANN Software Installation Guide (Inference) A Change History

A Change History

Date Description
2020-07-21 This issue is the rst ocial release.
Issue 01 (2021-03-02) Copyright © Huawei Technologies Co., Ltd. 96
Loading...