Huawei V100R020C00 Installation Manual

Huawei V100R020C00 Installation Manual

Atlas Data Center V100R020C00

CANN Software Installation Guide (Inference)

Issue

01

Date

2021-03-02

HUAWEI TECHNOLOGIES CO., LTD.

Copyright © Huawei Technologies Co., Ltd. 2021. All rights reserved.

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 c fi 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 ff 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

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

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

5.1

nfi

n

the NIC IP Address.......................................................................................................................................

 

74

5.2

nfi

n

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 fin a version that

fi the requirement xxx" Is Displayed When

pip3.7.5 install Is Run?................................................................................................................................................................

 

89

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

Atlas Data Center

 

CANN Software Installation Guide (Inference)

1 Installation Precautions

1Installation Precautions

Development Environment

The development environment is used to convert model fi

develop and compile

applications, and develop operators.

 

 

 

If you need to debug an application (for example, an image c

fic

n

application) in the development environment in addition to developing and

compiling the application, you need to c nfi

Ascend AI devices (such as

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 and fi mw corresponding to the inference card.

Operating Environment

The operating environment is an environment for running applications developed

by users. The operating environment must be c nfi

with Ascend AI devices

(such as inference cards). Applications depend on the

ffl n inference engine

package, Toolbox, driver, and fi mw

to perform ffl n accelerated inference.

The operating environment includes the following two scenarios:

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

In the container scenario, you need to install Docker.

a.

The inference card driver, fi mw

and Toolbox are installed on a host.

b.

The ffl n 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

Atlas Data Center

 

CANN Software Installation Guide (Inference)

2 Hardware Requirements

2Hardware Requirements

2.1Atlas 300I Inference Card (Model 3010)

2.2Atlas 800 Inference Server (Model 3000)

2.3Atlas 800 Inference Server (Model 3010)

2.1Atlas 300I Inference Card (Model 3010)

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

Scenario

 

Hardware

 

 

 

 

 

Development

 

General-purpose server

environment

 

 

 

 

 

 

 

Development and

Inference server with Atlas 300I inference card

commissioning

 

(model 3010)

 

environment

 

 

 

 

 

 

 

Operating environment

 

 

 

 

 

 

Table 2-1 Supported OSs

 

 

 

 

 

 

OS

Version

 

How to Obtain

 

 

 

Ubuntu

OS version: Ubuntu

ffic Ubuntu website

 

18.04.1

 

Download the recommended

 

 

 

 

OS architecture: x86

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

Atlas Data Center

 

 

 

CANN Software Installation Guide (Inference)

 

2 Hardware Requirements

 

 

 

 

 

 

OS

Version

How to Obtain

 

 

 

 

 

 

CentOS

OS version: CentOS 7.6

ffic

CentOS website

 

 

OS architecture: x86

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.

 

 

 

 

 

 

BClinux

OS version: BClinux 7.6

ffic

BClinux website

 

 

OS architecture: x86

 

 

 

 

 

 

 

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

General-purpose

 

-

 

 

 

environment

server

 

 

 

 

 

 

 

 

 

 

 

Development

Atlas 800 inference

 

For details about how to install the

and

server (model 3000)

server, set basic server parameters, and

commissionin

 

 

 

install the OS, see the Atlas 800 AI

g environment

 

 

 

Inference Server User Guide (Model

 

 

 

 

3000). After the OS is installed,

Operating

 

 

 

 

 

 

c

nfi

an IP address for the service

environment

 

 

 

 

 

 

network port. For details, see 5.1

 

 

 

 

 

n g

ng the NIC IP Address.

 

 

 

 

 

 

 

 

Table 2-2 Supported OSs

 

 

 

 

 

 

 

 

 

 

OS

 

Version

 

 

How to Obtain

 

 

 

 

 

 

 

Ubuntu

 

OS version: Ubuntu

 

 

ffic

Ubuntu website

 

 

18.04.1

 

 

 

Download the recommended

 

 

 

 

 

 

 

 

OS architecture: ARM

 

 

version ubuntu-18.04.1-server-

 

 

 

 

 

 

arm64.iso from http://old-

 

 

 

 

 

 

releases.ubuntu.com/releases/

 

 

 

 

 

 

18.04.1/.

 

 

 

 

 

 

CentOS

 

OS version: CentOS 7.6

 

ffic

CentOS website

 

 

OS architecture: ARM

 

 

Download the recommended

 

 

 

 

 

 

version CentOS-7-aarch64-

 

 

 

 

 

 

Everything-1810.iso from https://

 

 

 

 

 

 

archive.kernel.org/centos-vault/

 

 

 

 

 

 

altarch/7.6.1810/isos/aarch64/.

 

 

 

 

 

 

 

 

Issue 01 (2021-03-02)

Copyright © Huawei Technologies Co., Ltd.

3

Atlas Data Center

 

 

CANN Software Installation Guide (Inference)

2 Hardware Requirements

 

 

 

 

 

OS

Version

How to Obtain

 

 

 

 

 

EulerOS

OS version: EulerOS 2.8

ffic EulerOS website

 

 

OS architecture: ARM

 

 

 

 

 

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

 

General-purpose

-

 

 

environment

 

server

 

 

 

 

 

 

 

 

Development

 

Atlas 800 inference

For details about how to install the

and

 

server (model

server, set basic server parameters, and

commissioning

 

3010)

install the OS, see the Atlas 800 AI

environment

 

 

Inference Server User Guide (Model

 

 

 

3010). After the OS is installed,

Operating

 

 

 

 

c nfi

an IP address for the service

environment

 

 

 

 

network port. For details, see 5.1

 

 

 

 

n g

ng the NIC IP Address.

 

 

 

 

 

 

Table 2-3 Supported OSs

 

 

 

 

 

 

 

OS

Version

 

How to Obtain

 

 

 

 

 

Ubuntu

OS version: Ubuntu

 

ffic

Ubuntu website

 

18.04.1

 

Download the recommended

 

 

 

 

 

OS architecture: x86

 

version ubuntu-18.04.1-server-

 

 

 

 

amd64.iso from http://old-

 

 

 

 

releases.ubuntu.com/releases/

 

 

 

 

18.04.1/.

 

 

 

 

 

CentOS

OS version: CentOS 7.6

 

ffic

CentOS website

 

OS architecture: x86

 

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.

 

 

 

 

 

BClinux

OS version: BClinux 7.6

 

ffic

BClinux website

 

OS architecture: x86

 

 

 

 

 

 

 

 

 

Issue 01 (2021-03-02)

Copyright © Huawei Technologies Co., Ltd.

4

Atlas Data Center

 

CANN Software Installation Guide (Inference)

3 Installing the Development Environment

3Installing the Development Environment

3.1Before You Start

3.2Obtaining Software Packages

3.3Preparations for Installation

3.4Pure Development

3.5Development + Commissioning

3.6Performing Post-installation Operations

3.1Before You Start

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

{arch}_{gcc_version}.run). For details, see the following sections:

a.3.2 Obtaining Software Packages

b.3.3 Preparations for Installation

c.3.4 Pure Development

● In addition to converting model fi

developing and compiling applications,

and developing operators, you need to debug applications in the development

environment (for example, debugging image c

fic

n applications in the

development environment). In this case, you need to c

nfi

the Ascend AI

device in the development environment and install the driver and fi mw

of

the Ascend AI device, and development kit (Ascend-cann-

 

 

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

a.3.2 Obtaining Software Packages

b.3.3 Preparations for Installation

c.3.5 Development + Commissioning

Issue 01 (2021-03-02)

Copyright © Huawei Technologies Co., Ltd.

5

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 fi 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

 

fi mw

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

 

Atlas 300I

 

For details, see Table 3-1

 

(model 3000)

 

inference card

 

and Table 3-2.

 

 

 

 

 

(model 3000)

 

 

 

 

 

 

 

 

 

 

 

 

 

Atlas 800 inference server

 

Atlas 300I

 

For details, see Table 3-1

 

(model 3010)

 

inference card

 

and Table 3-3.

 

 

 

 

 

(model 3010)

 

 

 

 

Inference server with

 

 

 

 

 

 

 

 

 

 

 

 

Atlas 300I inference card

 

 

 

 

 

 

 

(model 3010)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Table 3-1 CANN software packages

 

 

 

 

 

 

 

 

 

 

Packa

Package Name

 

Description

 

How to

ge

 

 

 

 

 

 

 

Obtain

Type

 

 

 

 

 

 

 

 

Devel

Ascend-cann-

 

It is used for application

Link

opme

toolkit_{version}_linux-

 

development, operator

 

nt kit

{arch}_{gcc_version}.run

customization, and model

 

 

 

 

 

 

 

conversion. The

 

 

 

 

 

 

 

 

development kit contains

 

 

 

 

 

 

 

the library fi

required

 

 

 

 

 

 

 

for developing

 

 

 

 

 

 

 

 

applications and

 

 

 

 

 

 

 

development auxiliary

 

 

 

 

 

 

 

tools such as the Ascend

 

 

 

 

 

 

 

Tensor Compiler (ATC)

 

 

 

 

 

 

 

for model conversion.

 

 

 

 

 

 

 

 

 

 

 

Issue 01 (2021-03-02)

Copyright © Huawei Technologies Co., Ltd.

6

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

Package Name

Description

How to

 

e Type

 

 

 

 

 

Obtain

 

Driver

A300-3000-npu-

Inference card driver

Link

 

packag

driver_{version}_{os}-

installation package

 

 

e

aarch64.run

NOTE

 

 

 

 

 

 

 

The npu-smi tool package is

 

 

 

 

 

 

 

integrated in the driver

 

 

 

 

 

 

 

package. The npu-smi tool is

 

 

 

 

 

 

 

automatically installed during

 

 

 

 

 

 

 

the driver installation.

 

 

 

 

 

 

 

 

Firmwa

 

300 3000 n

Ascend fi mw

 

 

re

fi mw

{version}.run

installation package

 

 

packag

 

 

 

 

 

 

 

e

 

 

 

 

 

 

 

 

 

 

 

 

 

MCU

● A300-3000-

The MCU is an out-of-band

 

 

packag

 

mcu_{version}.bin

management module of

 

 

e

● A300-3000-

the Atlas 300 AI inference

 

 

 

card to provide functions

 

 

 

 

mcu_{version}.hpm

 

 

 

 

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

 

 

 

 

 

Obtain

 

Driver

 

A300-3010-npu-

Inference card driver

Link

 

package

 

driver_{version}_{os}-

installation package

 

 

 

 

X86_64.run

NOTE

 

 

 

 

 

 

 

The npu-smi tool package is

 

 

 

 

 

 

 

integrated in the driver

 

 

 

 

 

 

 

package. The npu-smi tool is

 

 

 

 

 

 

 

automatically installed during

 

 

 

 

 

 

 

the driver installation.

 

 

 

 

 

 

 

 

Firmware

 

300 3010 n

Ascend fi mw

 

 

package

 

fi mw

{version}.run

installation package

 

 

 

 

 

 

 

 

 

Issue 01 (2021-03-02)

Copyright © Huawei Technologies Co., Ltd.

7

Atlas Data Center

 

 

 

 

CANN Software Installation Guide (Inference)

3 Installing the Development Environment

 

 

 

 

 

 

 

Package

Package Name

Description

How to

 

Type

 

 

 

Obtain

 

MCU

● A300-3010-

The MCU is an out-of-band

 

 

package

mcu_{version}.bin

management module of

 

 

 

● A300-3010-

the Atlas 300 AI inference

 

 

 

card to provide functions

 

 

 

mcu_{version}.hpm

 

 

 

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.

 

 

 

 

 

 

 

NOTE

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

3.3 Preparations for Installation

3.3.1 CentOS (ARM)

Environment Requirements

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

Table 3-4 Dependency information

Parameter

Version

 

 

Python

3.7.5

 

 

cmake

3.5.1+

 

 

protobuf

3.11.3+

 

 

numpy

1.13.3+

 

 

Issue 01 (2021-03-02)

Copyright © Huawei Technologies Co., Ltd.

8

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

 

There is no version requirement. The version to be

 

unzip

 

installed is subject to the source provided by the OS.

 

 

 

 

zlib-devel

 

 

 

bffi v

 

 

 

openssl-devel

 

 

 

sqlite-devel

 

 

 

blas-devel

 

 

 

lapack-devel

 

 

 

openblas-devel

 

 

 

pciutils

 

 

 

net-tools

 

 

 

attrs

 

 

 

psutil

 

 

 

decorator

 

 

 

scipy

 

 

 

sympy

 

 

 

cffi

 

 

 

grpcio

 

 

 

grpcio-tools

 

 

 

requests

 

 

 

 

 

 

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 fi and save the fi

vi ~/.bashrc source ~/.bashrc

Issue 01 (2021-03-02)

Copyright © Huawei Technologies Co., Ltd.

9

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, fi mw

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.

fi mw

 

 

 

installation

 

 

 

package

 

 

 

 

 

 

 

CANN

The user can be root or

 

 

software

non-root. For details, see

 

 

package

the content below the

 

 

 

table.

 

 

 

 

 

 

For installation as the root user:

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

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

HwHiAiUser.

If the created user is not HwHiAiUser, you need to specify the running user (by using the --install-username=user name --install- usergroup=user group parameter) when installing the software package. Perform the following operations to create a user.

For installation as a non-root user:

In this scenario, the installation and running users must be the same.

If a non-root user exists, you do not need to create one.

If you want to use a new non-root user, you need to create the user fi

To create a non-root user, run the following commands as the root user:

1.Create a non-root user.

groupadd usergroup

useradd -g usergroup -d /home/username -m username

2.Set the password of the non-root user.

passwd username

Issue 01 (2021-03-02)

Copyright © Huawei Technologies Co., Ltd.

10

Atlas Data Center

 

CANN Software Installation Guide (Inference)

3 Installing the Development Environment

NOTE

● 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 ff n 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 fi or using the chage command. For details, see 5.5 Setting User Account Validity Period.

(Optional) n g ng 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 fi

chmod u+w /etc/sudoers vi /etc/sudoers

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

username ALL=(ALL:ALL) NOPASSWD:SETENV:/usr/bin/yum, /usr/bin/pip, /bin/tar, /bin/mkdir, /bin/ rm, /bin/sh, /bin/cp, /bin/bash, /usr/bin/make install, /bin/ln -s /usr/local/python3.7.5/bin/

python3 /usr/bin/python3.7, /bin/ln -s /usr/local/python3.7.5/bin/pip3 /usr/bin/pip3.7, /bin/ln -s /usr/ local/python3.7.5/bin/python3 /usr/bin/python3.7.5, /bin/ln -s /usr/local/python3.7.5/bin/pip3 /usr/bin/ pip3.7.5

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

NOTE

Ensure that the last line of the /etc/sudoers fi is #includedir /etc/sudoers.d.

Otherwise, add it manually.

3.Run :wq! to save the fi

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

sudoers fi

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 fi

with an available source or use an

image source. For details about how to c nfi

a network proxy, see 5.2

n g ng a System Network Proxy.

 

Issue 01 (2021-03-02)

Copyright © Huawei Technologies Co., Ltd.

11

Atlas Data Center

 

CANN Software Installation Guide (Inference)

3 Installing the Development Environment

Installing Dependencies

NOTE

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 bffi v

rpm -qa |grep openssl-devel rpm -qa |grep sqlite-devel rpm -qa |grep blas-devel rpm -qa |grep lapack-devel rpm -qa |grep openblas-devel rpm -qa |grep pciutils

rpm -qa |grep net-tools

If information similar to the following is displayed (the version number varies according to the actual OS), the tool has been installed. Go to the next step.

gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39) gcc-c++-4.8.5

GNU Make 4.1 cmake version 3.5.1

unzip-6.0-21.el7.aarch64 zlib-devel-1.2.7-18.el7.aarch64 bffi v 3.0.13-18.el7.aarch64

openssl-devel-1.0.2k-19.el7.aarch64 sqlite-devel-3.7.17-8.el7_7.1.aarch64 blas-devel-3.4.2-8.el7.aarch64 lapack-devel-3.4.2-8.el7.aarch64 openblas-devel-0.3.3-2.el7.aarch64 pciutils-3.5.1-3.el7.aarch64 net-tools-2.0-0.24.20131004git.el7.aarch64

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

sudo yum install -y gcc gcc-c++ make cmake unzip zlib-devel bffi v openssl-devel sqlite-devel blasdevel 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

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 c nfi

n build, and

installation commands:

 

 

 

 

 

cd Python-3.7.5

 

 

 

 

 

 

c nfi

fix

c y

n3 7 5 --enable-shared

 

 

 

make

 

 

 

 

 

 

 

sudo make install

 

 

 

 

 

 

The

x parameter

c fi

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

x

y n3

as an example. After the

 

c nfi

n

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 fi provided by the system and run the following command:

Copy the compiled fi 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 fi 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 fi 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 fi 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

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 cffi

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

During the command execution, if the network connection fails and the message "Could not fin a version that fi the requirement xxx" is displayed, rectify the fault by referring to 6.4 What Do I Do If "Could not n a version that

the requirement xxx" Is Displayed When pip3.7.5 install Is Run?.

If an error is reported during the NumPy installation, rectify the fault by referring to 6.2 pip3.7.5 install numpy Error.

----End

3.3.2 Ubuntu (ARM)

Environment Requirements

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

Table 3-6 Dependency information

Parameter

Version

 

 

Python

3.7.5

 

 

cmake

3.5.1+

 

 

protobuf

3.11.3+

 

 

g++

7.3.0 or later

 

 

gcc

7.3.0 or later

 

 

Issue 01 (2021-03-02)

Copyright © Huawei Technologies Co., Ltd.

14

Atlas Data Center

 

CANN Software Installation Guide (Inference)

3 Installing the Development Environment

 

 

 

 

Parameter

Version

 

 

 

 

make

There is no version requirement. The version to be

 

zlib1g

installed is subject to the source provided by the OS.

 

 

 

zlib1g-dev

 

 

libsqlite3-dev

 

 

openssl

 

 

libssl-dev

 

 

bffi v

 

 

unzip

 

 

pciutils

 

 

net-tools

 

 

libblas-dev

 

 

gfortran

 

 

libblas3

 

 

libopenblas-dev

 

 

attrs

 

 

psutil

 

 

decorator

 

 

numpy

 

 

scipy

 

 

sympy

 

 

cffi

 

 

grpcio

 

 

grpcio-tools

 

 

requests

 

 

 

 

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 fi and save the fi

vi ~/.bashrc source ~/.bashrc

Creating Installation and Running Users

Table 3-7 lists the users for installing and running the driver, fi mw and CANN software.

Issue 01 (2021-03-02)

Copyright © Huawei Technologies Co., Ltd.

15

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.

 

fi mw

 

 

 

installation

 

 

 

package

 

 

 

 

 

 

 

CANN

The user can be root or

 

 

software

non-root. For details, see

 

 

package

the content below the

 

 

 

table.

 

 

 

 

 

For installation as the root user:

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

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

HwHiAiUser.

If the created user is not HwHiAiUser, you need to specify the running user (by using the --install-username=user name --install- usergroup=user group parameter) when installing the software package. Perform the following operations to create a user.

For installation as a non-root user:

In this scenario, the installation and running users must be the same.

If a non-root user exists, you do not need to create one.

If you want to use a new non-root user, you need to create the user fi

To create a non-root user, run the following commands as the root user:

1.Create a non-root user.

groupadd usergroup

useradd -g usergroup -d /home/username -m username

2.Set the password of the non-root user.

passwd username

NOTE

● 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 ff n 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 fi or using the chage command. For details, see 5.5 Setting User Account Validity Period.

Issue 01 (2021-03-02)

Copyright © Huawei Technologies Co., Ltd.

16

Atlas Data Center

 

CANN Software Installation Guide (Inference)

3 Installing the Development Environment

(Optional) n g ng 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 fi

chmod u+w /etc/sudoers vi /etc/sudoers

2. Add the following content below # User privilege n of the fi

username ALL=(ALL:ALL) NOPASSWD:SETENV:/usr/bin/apt-get, /usr/bin/pip, /bin/tar, /bin/

mkdir, /bin/rm, /bin/sh, /bin/cp, /bin/bash, /usr/bin/make install, /bin/ln -s /usr/local/python3.7.5/bin/ python3 /usr/bin/python3.7, /bin/ln -s /usr/local/python3.7.5/bin/pip3 /usr/bin/pip3.7, /bin/ln -s /usr/ local/python3.7.5/bin/python3 /usr/bin/python3.7.5, /bin/ln -s /usr/local/python3.7.5/bin/pip3 /usr/bin/ pip3.7.5, /usr/bin/unzip

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

NOTE

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

3.Run :wq! to save the fi

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

sudoers fi

chmod u-w /etc/sudoers

Checking the Source Validity

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

Run the following command as the root user to check whether the source is valid:

apt-get update

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

the /etc/apt/sources.list fi

with an available source or use an image source. For

details about how to c nfi

a network proxy, see 5.2 n g ng a System

Network Proxy.

 

Installing Dependencies

NOTE

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

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

Step 1 Check whether the Python dependencies and GCC software are installed.

Run the following commands to check whether the dependencies such as GCC, Make, and Python are installed:

gcc --version g++ --version

Issue 01 (2021-03-02)

Copyright © Huawei Technologies Co., Ltd.

17

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 dpkg -l bffi v grep bffi v grep ii dpkg -l unzip| grep unzip| grep ii

dpkg -l pciutils| grep pciutils| grep ii dpkg -l net-tools| grep net-tools| grep ii

dpkg -l libblas-dev| grep libblas-dev| grep ii dpkg -l gfortran| grep gfortran| grep ii dpkg -l libblas3| grep libblas3| grep ii

dpkg -l libopenblas-dev| grep libopenblas-dev| grep ii

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

gcc (Ubuntu 7.3.0-3ubuntu1~18.04) 7.3.0

 

 

 

g++ (Ubuntu 7.3.0-3ubuntu1~18.04) 7.3.0

 

 

 

GNU Make 4.1

 

 

 

 

 

cmake version 3.10.2

 

 

 

 

 

zlib1g:arm64 1:1.2.11.dfsg-0ubuntu2 arm64

compression library - runtime

zlib1g-dev:arm64 1:1.2.11.dfsg-0ubuntu2 arm64

compression library - development

libsqlite3-dev:arm64 3.22.0-1ubuntu0.3 arm64

SQLite 3 development fi

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 fi

bffi

v

m64 3.2.1-8

arm64

Foreign Function Interface library (development fi

unzip

 

6.0-21ubuntu1 amd64

De-archiver for .zip fi

 

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 fi

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 bffi v 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 c nfi

n build, and

installation commands:

 

 

cd Python-3.7.5

 

 

 

 

c nfi

fix

c y n3 7 5 --enable-shared

 

Issue 01 (2021-03-02)

Copyright © Huawei Technologies Co., Ltd.

18

Atlas Data Center

 

 

 

 

CANN Software Installation Guide (Inference)

 

3 Installing the Development Environment

 

 

 

 

 

 

make

 

 

 

 

 

sudo make install

 

 

 

The

x parameter

c fi

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

x

y n3

as an example. After the

c nfi

n 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 fi provided by the system and run the following command:

Copy the compiled fi 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 fi 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 fi 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 fi 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. fi n 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

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==3.11.3 pip3.7.5 install scipy

pip3.7.5 install sympy pip3.7.5 install cffi

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

During the command execution, if the network connection fails and the message "Could not fin a version that fi the requirement xxx" is displayed, rectify the fault by referring to 6.4 What Do I Do If "Could not n a version that

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

Atlas Data Center

 

CANN Software Installation Guide (Inference)

3 Installing the Development Environment

 

 

 

 

Parameter

Version

 

 

 

 

make

There is no version requirement. The version to be

 

unzip

installed is subject to the source provided by the

 

OS.

 

zlib-devel

 

 

 

bffi v

 

 

openssl-devel

 

 

sqlite-devel

 

 

pciutils

 

 

net-tools

 

 

lapack

 

 

lapack-devel

 

 

blas

 

 

blas-devel

 

 

gcc-gfortran

 

 

attrs

 

 

psutil

 

 

decorator

 

 

numpy

 

 

scipy

 

 

sympy

 

 

cffi

 

 

grpcio

 

 

grpcio-tools

 

 

requests

 

 

 

 

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 fi and save the fi

vi ~/.bashrc source ~/.bashrc

Creating Installation and Running Users

Table 3-9 lists the users for installing and running the driver, fi mw and CANN software.

Issue 01 (2021-03-02)

Copyright © Huawei Technologies Co., Ltd.

21

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.

 

fi mw

 

 

 

installation

 

 

 

package

 

 

 

 

 

 

 

CANN

The user can be root or

 

 

software

non-root. For details, see

 

 

package

the content below the

 

 

 

table.

 

 

 

 

 

For installation as the root user:

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

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

HwHiAiUser.

If the created user is not HwHiAiUser, you need to specify the running user (by using the --install-username=user name --install- usergroup=user group parameter) when installing the software package. Perform the following operations to create a user.

For installation as a non-root user:

In this scenario, the installation and running users must be the same.

If a non-root user exists, you do not need to create one.

If you want to use a new non-root user, you need to create the user fi

To create a non-root user, run the following commands as the root user:

1.Create a non-root user.

groupadd usergroup

useradd -g usergroup -d /home/username -m username

2.Set the password of the non-root user.

passwd username

NOTE

● 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 ff n 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 fi or using the chage command. For details, see 5.5 Setting User Account Validity Period.

Issue 01 (2021-03-02)

Copyright © Huawei Technologies Co., Ltd.

22

Atlas Data Center

 

CANN Software Installation Guide (Inference)

3 Installing the Development Environment

(Optional) n g ng 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 fi

chmod u+w /etc/sudoers vi /etc/sudoers

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

username ALL=(ALL:ALL) NOPASSWD:SETENV:/usr/bin/yum, /usr/bin/pip, /bin/tar, /bin/mkdir, /bin/ rm, /bin/sh, /bin/cp, /bin/bash, /usr/bin/make install, /bin/ln -s /usr/local/python3.7.5/bin/

python3 /usr/bin/python3.7, /bin/ln -s /usr/local/python3.7.5/bin/pip3 /usr/bin/pip3.7, /bin/ln -s /usr/ local/python3.7.5/bin/python3 /usr/bin/python3.7.5, /bin/ln -s /usr/local/python3.7.5/bin/pip3 /usr/bin/ pip3.7.5

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

NOTE

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

3.Run :wq! to save the fi

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

sudoers fi

chmod u-w /etc/sudoers

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

NOTE

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 fi with an available source or use an image source. For details about how to

c nfi a network proxy, see 5.2 n g ng a System Network Proxy.

Installing Dependencies

NOTE

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

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 bffi v

 

 

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

 

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 bffi v 3 1 18 3 v2 8 c 64 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 bffi v 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

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

c nfi n build, and installation commands.

cd Python-3.7.5

mkdir /usr/local/python3.7.5

c nfi fix c y n3 7 5 --enable-loadable-sqlite-extensions --enable-shared make && make install

NOTE

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 fi provided by the system. Therefore, you need to back up the libpython3.7m.so.1.0 fi 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 fi 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 fi provided by the system.

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

If the /usr/lib64 directory does not exist in the environment, copy the fi 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 fi as required.

c.If you need to use the yum tool, run the following command to restore

the libpython3.7m.so.1.0.bak fi 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

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 cffi

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

During the command execution, if the network connection fails and the message "Could not fin a version that fi the requirement xxx" is displayed, rectify the fault by referring to 6.4 What Do I Do If "Could not n a version that

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

Version

 

 

Python

3.7.5

 

 

cmake

3.5.1+

 

 

protobuf

3.11.3+

 

 

numpy

1.13.3+

 

 

gcc

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

 

to query the GCC version. If the GCC version is earlier

gcc-c++

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

Loading...
+ 70 hidden pages