Software Installation

Development Environment Deployment

Development Machine Preparation

In the previous section, we introduced the necessary preparations before using Docker containers. To help you quickly use the toolchain, we provide a Docker image containing the complete development environment, which greatly simplifies the deployment process of the development environment. The following will provide a detailed explanation of how to deploy the Docker container.

Hint

If you have downloaded the offline image, you need to use the following command to load the image locally first.

docker load -i docker_openexplorer_xxx.tar.gz

You can start the Docker container corresponding to the current OE version by running the following script directly from the first level of the OE package(the script will automatically pull the image from the official Docker hub if there is no local image):

bash run_docker.sh data/

Where data is the path to the evaluation dataset folder. Please create the path before running the command, otherwise loading problems may occur.

If you want to use the CPU version of the Docker image, you need to add the cpu parameter:

bash run_docker.sh data/ cpu

The download links for the relevant publicly available evaluation datasets that the OE package samples rely on can be accessed by referring to the introduction in section Dataset Download.

If you want to start the Docker container manually, you can refer to the following command, where {version} is the OE version number you are currently using.

Note

For your convenience, we provide CPU Docker and GPU Docker for you to choose on demand.

CPU Docker
GPU Docker
# CPU Docker
docker pull openexplorer/ai_toolchain_ubuntu_22_j6_cpu:{version}
# Start CPU Docker image manually
docker run -it --rm \
  --network host \ # Adjust network mode to host
  -v {OE package path}:/open_explorer \ # Mount OE package
  -v ./dataset:/data/horizon_j6/data \ # Mount dataset
  openexplorer/ai_toolchain_ubuntu_22_j6_cpu:{version}
Attention
  1. Since the environment variables PATH and LD_LIBRARY_PATH are configured during the build process of the OE Docker image, not using the recommended way (e.g., docker attach) to enter the container may result in the environment variables not being loaded correctly, which may lead to the use of abnormalities in tools such as Cmake, GCC, CUDA, and so on.

  2. If you want the Docker container to exit without removing it, use the command line docker run -it to start it manually, without the --rm option.

  3. If you want the Docker container to run background after startup, add the -d option after the command line docker run -it, the container ID will be returned after the container is started, and then you can enter the container again with the command docker exec -it {container ID} /bin/bash.

Local Manual Installation

In the previous section, we introduced the two quantization schemes and the environment dependencies and related instructions for Horizon's open-source efficient model training. This section will introduce you to the method of local manual installation of the environment. We recommend that after completing floating-point model training, you prioritize the simple and easy-to-use PTQ quantization scheme, and only switch to the QAT quantization scheme when accuracy issues cannot be resolved.

To manually install the environment locally, simply run the script below to complete the environment installation in one click.

cd package/host
bash install.sh 

The installation script will automatically check the environment. If there are missing dependencies or configurations, it will interrupt the installation process and give suggestions to fix it, as shown below:

Run the script again after adding the dependencies as suggested.

Note
  • If you need to generate a board-side executeable program, use the cross-compilation tool aarch64-none-linux-gnu-gcc and aarch64-none-linux-gnu-g++. Its version is Arm GNU Toolchain 12.2.Rel1.

  • If you need to generate an X86 simulation environment executable program, use the X86 gcc, if the script suggests that gcc/g++ versions are incorrect, you need to recreate the gcc and g++ soft links as gcc-12.2.0 and g++-12.2.0 after the required versions are installed.

  • If you need to generate an QNX environment executable program, use the aarch64-unknown-nto-qnx8.0.0-gcc and aarch64-unknown-nto-qnx8.0.0-g++, and please note that due to license reasons, the QNX cross-compiler is not delivered with the OE package. If you need to obtain the QNX cross-compiler, please contact Horizon.

  • For host-side (x86) dependent libraries (isl, gmp, mpc, mpfr, etc.), if you use lib/x86_64-linux-gnu, please specify them by LD_LIBRARY_PATH in the compiled project if the compilation reports errors.

  • If there is a glibc library version conflict problem during compilation, for example: the error of undefined symbols for xxx@GLIBC_xxx, please specify the path to aarch64-none-linux-gnu/lib of the toolchain by using -rpath-link in the compiled project, and at the same time add -lxxx to the compiled project, for example: -lpthread.

    In addition, you should pay special attention to the variable SRCS (boxed below) that records the source file. It is better to put it in front of the ${LIBS} link library, otherwise it may also report undefined symbols.

    gcc_SRCS

  • The installation script will automatically check the environment. If there are missing dependencies or configurations, it will interrupt the installation process and you can run the script again after adding the dependencies as suggested.

  • After the installation script is completed successfully, it will add path and other information to the ~/.bashrc system environment variable(The environment variable LD_LIBRARY_PATH is often used and it is recommended that you check that the environment variable is as expected), run source ~/.bashrc to make the current terminal configuration take effect.

Runtime Environment Deployment

In the previous section, we introduced the necessary preparations for the dev board before inference execution. Next, we will explain the board-side tools required for model inference execution and their installation methods.

Board Side Tool Installation

Supplementary Tools

Some of the supplementary tools of the toolchain are not included in the system image, but can be copied to the dev board by running the installation script in the OE package in the host environment, as follows:

cd package/board
# Linux environment
bash install_linux.sh ${board_ip}
# QNX environment
bash install_qnx.sh ${board_ip}
Note

Where ${board_ip} is the IP address you set for the dev board. Make sure that you can successfully access this IP on the development PC.

After the supplementary files are successfully installed, please restart the dev board and execute hrt_model_exec --help on the dev board to verify if the installation is successful.

DEB Deployment Package

To simplify the board-side deployment process, the UCP provides a DEB deployment package. After the package is installed, you can directly call the relevant tools through the command line to automatically install the required binaries and related dependencies, quickly set up and run UCP-related applications, greatly improving the convenience and efficiency of system configuration.

For detailed information about the DEB deployment package, please refer to the Overview - DEB Deployment Package in the UCP section.

Warning

Since the J6B platform runs the QNX operating system, the DEB packaging tool is not currently supported.