Atlas200DK Environment Setup(1.0.9.alpha)-Simplified Version

About This Document

This blog offers guidance on setting up the Atlas 200 DK lab environment. The related image is also provided, which may help you get started quickly.

Atlas 200 DK

The following information is from the official document:

The Atlas 200 DK is a developer board product that uses the Ascend 310 Processor as the core. It provides external ports for developers to quickly and easily access and use the powerful processing capability of the Ascend AI processors. The Atlas 200 DK can be used for pre-research and development in a wide range of fields such as safe cities, drones, robots, and video servers.

Environment Setup

The Atlas 200 DK application involves development and operation. Because the Atlas 200 DK cannot connect to an external keyboard or monitor, you can develop your applications on a PC and run them on an Atlas 200 DK.
The Atlas 200 DK contains the Hi3559 camera module and Atlas 200 AI accelerator module. The PC where MindStudio is located is connected to the Atlas 200 DK through the USB port or network cable.
在这里插入图片描述
As shown in the figure, the environment setup includes setting up the development environment on a PC, and setting up the operating environment on an Atlas 200 DK. Similar to the Raspberry Pi, the Atlas 200 DK uses an SD card to store the system, which facilitates the environment setup.

This blog offers an even simpler method. For the development environment, the Docker image is used. For the operating environment, the IMG image is used. In addition to the toolkit required in the official document, common software packages such as OpenCV are also installed. For details about how to install the software packages, visit the following websites:
Official document: https://support.huaweicloud.com/intl/en-us/Atlas200DK202/
Gitee documents:
https://gitee.com/ascend/samples/tree/master/cplusplus/environment
https://gitee.com/ascend/samples/tree/master/python/environment

Note:
1.0.9.alpha indicates the Firmware and Driver versions of the Atlas 200 DK. The toolkit used for application development belongs to the Compute Architecture for Neural Networks (CANN). The version of CANN community 3.3.0.alpha001 is installed in the image.

Resource Requirement

  1. Atlas 200 DK (USB-Type-C data cable or network cable, SD card of 16 GB or more, and card reader or female-to-female DuPont jumper wire)
  2. PC running a Linux OS (This blog uses the Ubuntu OS. You can use either a physical machine or virtual machine.)
  3. PC running a Windows OS (used only once for setting up the operating environment)

Setting Up the Development Environment

Prepare a PC running a Linux OS. The following uses the Ubuntu OS as an example. For other OSs, replace the commands as required.

Installing Docker

If Docker has been installed, skip this step.

Docker allows you to obtain pre-built images and use them without installing software packages.

Note: By default, the root account is disabled in the Ubuntu desktop system. The following operations are performed using the administrator account. For other systems, you can use the normal user account and grant permissions.

  1. Run the following commands to update the software source, install cURL, and obtain the Docker installation script:
sudo apt-get update
sudo apt-get install curl
curl -fsSL get.docker.com -o get-docker.sh
  1. Run the following command to install Docker:
sh get-docker.sh

You should see information similar to the following.
在这里插入图片描述

  1. After the installation is successful, run the following commands in sequence in the command line to add the normal user to the Docker user group.
sudo groupadd docker
sudo gpasswd -a USER docker
sudo service docker restart
newgrp docker

USER indicates the current user name, for example,** zmstest**. Replace it with the actual user name.

Note:
When the normal user runs the docker commands in a new terminal window, an error indicating permission denied is reported. To fix this error, run the newgrp docker command in the new terminal window.

Obtaining an Image

Method 1: Pulling an Image from Docker Hub

Directly pull an image from Docker Hub. This method is applicable to the scenario with a fast access speed.

  1. Run the following command to pull the image. The time required depends on the network speed. If the access is denied, choose method 2.
docker pull taotaoba/develop-env:cann3.3.a1

在这里插入图片描述

  1. After the image is successfully pulled, run the following command:
docker images

在这里插入图片描述

Method 2: Downloading a Docker Image Package

This method is a back-up.

  1. Download a Docker image package from: Image
  2. After the download is complete, save the package to the Linux OS and run the following command to decompress the package:
tar -zxvf cann3.3.a1.tar.gz

Note:
The decompression takes a long time and must not be interrupted by any operation.

  1. After the decompression is complete, run the following command in the decompressed file directory to load the image:
docker load < cann3.3.a1.tar

Note:
The loading process is also time-consuming.

  1. After the image is successfully loaded, run the following command:
docker images

在这里插入图片描述

Creating a Container

You need to use the image to create a container and perform operations in the container.
Run the following command to create a container. Log in as normal user Ascend and set IMAGE ID.

docker run -it --privileged -v /dev:/dev -v /tmp:/tmp --net=host -e DISPLAY=$DISPLAY  IMAGE ID

Note:
The image contains the root user and normal user Ascend. The passwords of both users are Huawei@123. The root user is used by default.

Run the following commands to switch to user Ascend:

su Ascend
bash

在这里插入图片描述

Setting Up the Operating Environment

You need to write the built IMG image to the SD card. The dd command in Linux is tricky for beginners. Therefore, you are advised to use the Etcher tool in Windows to flash the image to the SD card.

Download Etcher from https://www.balena.io/etcher/.

Download an SD card image from:Image.

Burning an Image to an SD Card

Decompress the image package, start Etcher, select the IMG file and SD card, and click Flash. Wait until the flash operation is successful.
在这里插入图片描述
在这里插入图片描述

Note:
The original image is built based on a 16 GB memory card. Therefore, you need to use an SD card of 16 GB or more.
After the image is burnt to the SD Card, the Windows system may display a dialog box asking you whether to format the SD card. In this case, click Cancel.

Expanding SD Card Partitions

After burning, you need to expand the SD card partitions.

  1. Connect the SD card to Linux.
  2. Run the following commands to install the GParted tool in Linux. Note that GParted is not installed in Docker.
sudo apt-get update
sudo apt-get install gparted
#After the installation is complete, run the following command to start GParted:
gparted
  1. Select your SD card in the upper-right corner.
    在这里插入图片描述
    在这里插入图片描述
  2. The gray area on the right indicates the unallocated disk space. Right-click the adjacent space and click Resize from the shortcut menu, as shown in the following figure.
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
  3. Remove the SD card.

Starting the Atlas 200 DK

  1. Remove the upper case of the Atlas 200 DK to check the LED indicator status. For details, visit https://support.huaweicloud.com/intl/en-us/environment-deployment-Atlas200DK202/atlased_04_0004.html.
  2. Insert the SD card and power on the Atlas 200 DK. The developer board automatically updates the Firmware and the restart indicators. If the indicators blink, the Firmware is being updated.

Keep the Atlas 200 DK powered on during the update.

For details about the LED indicators, visit https://support.huaweicloud.com/intl/en-us/productdesc-Atlas200DK202/atlas200_DK_pdes_19_0025.html.

Connecting the Atlas 200 DK to the Development Environment

For details about connecting the developer board to the development environment, visit https://support.huaweicloud.com/intl/en-us/environment-deployment-Atlas200DK202/atlased_04_0014.html.

Note:
The Docker container shares the network with the host environment. Because the preceding operations are performed on the host OS, once the developer board is connected to the host OS, the Docker container is connected to the developer board.

Hands-on Your First Application

Now you have set up basic environments. Create a project from the Classification(resnet50) sample provided by MindStudio to verify the environments.

Accessing the Container

Run the following command to access the container.

#You can view all containers, both running and stopped.
docker ps -a
#Start a container based on the ID.
docker start CONTAINER ID
#Enter a container that has been started and run the following command for interaction:
docker exec -it CONTAINER ID /bin/bash
#Stop a container based on the ID.
docker stop CONTAINER ID

Launching MindStudio

MindStudio has been installed in Docker.
Switch to the /home/Ascend/program directory.
Switch to user Ascend.
Run the following commands to launch MindStudio:

cd /home/Ascend/program/MindStudio/bin/
./MindStudio.sh

The ADK path has been configured on MindStudio, and a sample project (Sample-ResNet50) has been opened. You can run your first application by referring to
https://support.huaweicloud.com/intl/en-us/ug-mindstudioc76/atlasms_02_0083.html.

Common Docker Operations

#Copy a file between the container and host, and between the host and Docker based on the container ID. For a file folder, you do not need to add -r.
docker cp path1 CONTAINER ID:path2
#Copy a Docker file or file folder to the host.
docker cp CONTAINER ID:path1 path2
#Delete a stopped container based on the ID.
docker rm CONTAINER ID
#Delete an unused image based on the ID.
docker rmi IMAGE ID

Summary

This blog describes the simplified setup of the Atlas 200 DK environments.
To stay in-the-know on AI and related product information, follow:

1. Huawei Ascend Developer Zone: https://forum.huawei.com/enterprise/en/forum-100504.html
2. Huawei Ascend Community: https://www.hiascend.com/en/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值