Lines Matching +full:build +full:- +full:docker +full:- +full:cpu +full:- +full:aarch64
1 # Arm NN Build Tool
2 …Build Tool_** provides a collection of **parameterized bash scripts** accompanied by a **Dockerfil…
3 …places/supersedes the majority of the existing Arm NN build guides as a user-friendly way to build…
4 …rm NN from scratch is the ability to **exactly choose which components to build, targeted for your…
5 The Arm NN Build Tool is tested on **x86_64 (Intel) and aarch64 (Arm) build hosts** for the **Ubunt…
6 Other host platforms such as Windows and Mac **should** work (with Docker installed), but have not …
7 …orts **targeting Linux devices (from Ubuntu 18.04 onwards) on x86_64 and aarch64** architectures.<…
8 …the Arm NN Build Tool through the use of Docker. However, the scripts may be [executed directly on…
10 …Docker installed** and want to quickly build the Arm NN Dockerfile with some default build argumen…
13 * [System Requirements](#system-requirements)
14 * [Install Docker](#install-docker)
15 * [Ubuntu / Linux](#ubuntu--linux)
16 * [Windows and Mac](#windows-and-mac)
17 * [Docker Build Arguments Reference](#docker-build-arguments-reference)
20 * [Docker Build Steps](#docker-build-steps)
21 * [Build Arm NN Without Docker](#build-arm-nn-without-docker)
22 * [Advanced Usage](#advanced-usage)
23 … Arm NN and ACL repository versions during build](#use-custom-arm-nn-and-acl-repository-versions-d…
24 * [Additional Docker Build Arguments](#additional-docker-build-arguments)
25 * [Inspect the contents of the Docker Image](#inspect-the-contents-of-the-docker-image)
26 * [Bind Mounts](#bind-mounts)
29 The Arm NN Build Tool consists of an official Arm NN **Dockerfile** with associated **scripts** for…
30 1. **```install-packages.sh```:** builds CMake from source and installs system-wide **apt packages**
31 2. **```setup-armnn.sh```:** downloads and builds Arm NN **dependencies** (e.g. Flatbuffers, TF Lit…
32 3. **```build-armnn.sh```:** builds Arm NN and ACL
33 4. **```common.sh```:** common variables and functions used by ```setup-armnn.sh``` and ```build-ar…
34 …``validation.sh```:** validation of common command-line arguments to ```setup-armnn.sh``` and ```b…
35 6. **```docker-copy-to-host```:** helpful script to copy contents of a Docker Image to the host mac…
37 …ocument which outlines the instructions for building a **Docker Image**. Running ```docker build```
38 on the Arm NN Dockerfile will result in a Docker Image that contains:
40 2. Installed system-wide packages required by Arm NN
42 4. The build for Arm NN and its dependencies
44 All scripts except ```docker-copy-to-host.sh``` are used during the ```docker build``` process.
46 The ```docker-copy-to-host.sh``` script creates a temporary [**Docker Container**](https://www.dock…
47 Docker Image. A Docker Container is a **runtime** version of a Docker Image. It can be interacted w…
48 terminal, like a lightweight virtual machine (VM). The ```docker-copy-to-host.sh``` script is desig…
49 machine after ```docker build``` to copy the Arm NN build to the host.
51 …the operation of the Arm NN **Dockerfile** and the contents of the resulting **Docker Image** after
52 running ```docker build```. During ```docker build```, the provided **```SETUP_ARGS```** determine …
53 dependencies to download and build. The **```BUILD_ARGS```** Docker argument determines which compo…
55 The resulting Docker Image contains the Arm NN build (along with everything required to build it) i…
56 …**```source```** which contains the source code of Arm NN and its dependencies, and **```build```**
57 which contains the Arm NN build and the builds of each dependency of Arm NN.
59 …ome directory is a compressed archive of the Arm NN build which is located at ```/home/arm-user/bu…
61 Docker Image during the ```docker build``` process.
69 **Benefits of using Docker:**
70 1. Run one ```docker build``` command instead of executing multiple scripts, saving developer time
71 2. Can easily manage multiple different build configurations at once, each in their own Docker Image
72 3. System packages are installed in the Docker Image only, isolated from the host machine
73 4. Build in the exact environment the Arm NN Team used during testing, ensuring consistency in buil…
74 5. Allows Arm NN to be built on a wide range of hosts, as long as they support Docker
76 **Disadvantages of using Docker:**
77 1. Requires the developer to install Docker on their host machine
78 2. Requires the developer to get familiar with Docker (this guide should help)
80 base OS in the Docker Image. This is due to the fact that Docker Containers share the Linux Kernel …
86 …de will not provide the system requirements for installing Docker - please refer to the Docker doc…
88 The built Docker Image has disk requirements of **less than 6GB**, depending on the Arm NN componen…
89 the build included a cross compile (i.e. building aarch64 on x86_64). Repeated builds may cause the…
90 beyond 6GB. The ```docker images``` command shows the disk usage of each Docker Image. To view tota…
91 Docker Images and Docker Containers, use the command ```docker system df```.
93 This Dockerfile was built on a **Ubuntu 18.04 host machine with Docker version 20.10.14**. We recom…
94 with at least Ubuntu 18.04 and a similar Docker version, if possible. Other Linux distros such as *…
95 long as the Docker version is similar to **20.10.14**.
97 The build outputs from this Dockerfile have been tested on an **Odroid N2+ target device with Ubunt…
100 …ew the system packages that are installed during ```docker build```, please refer to the ```instal…
104 ## Install Docker
106 Whilst other platforms have not been tested, Docker should be able to build the Arm NN Dockerfile o…
107 On **Linux**, we recommend using **Docker Engine** which is used through the command-line interface…
108 For **Windows and Mac** users, **Docker Desktop** is available which allows the use of the CLI plus…
109 This guide will **only** provide steps on using Docker through the use of the CLI and not Docker De…
112 For Ubuntu users, we recommend installing **Docker Engine** with the following steps from the Docke…
113 1. [Uninstall any old versions of Docker](https://docs.docker.com/engine/install/ubuntu/#uninstall-…
114 2. [Install using the repository](https://docs.docker.com/engine/install/ubuntu/#install-using-the-…
115 …Docker Unix Group](https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-no…
117 …lling Docker Engine on other Linux distributions can be found by clicking on your distro under the…
120 …ockerfile on Windows or Mac. However, it's likely that it will work if your system supports Docker.
121 For **Windows**, use the Docker Desktop download link on [this page](https://docs.docker.com/deskto…
122 …r **Mac** users, please use the Docker Desktop download link on [this page](https://docs.docker.co…
123 **Note:** we unfortunately cannot provide support for the installation of Docker and/or the use of …
127 ## Docker Build Arguments Reference
128 The following describes the ```docker build``` arguments that can be used to customize the Arm NN b…
129 Docker build arguments such as ```SETUP_ARGS``` and ```BUILD_ARGS``` are provided in the ```docker …
132 These arguments are eventually passed to ```setup-armnn.sh``` which downloads and builds Arm NN dep…
133 For ease of use (but longer initial docker build), use ```--all``` to have all Arm NN dependencies …
134 …docker builds with the same ```SETUP_ARGS``` will skip the setup process (using [caching](https://…
138 |-------------------|:-----------------------------------------------------------------------------…
139 | --tflite-delegate | **flag:** setup dependencies for the Arm NN TF Lite Delegate …
140 | --tflite-parser | **flag:** setup dependencies for the Arm NN TF Lite Parser …
141 | --onnx-parser | **flag:** setup dependencies for the Arm NN ONNX parser …
142 | --all | **flag:** setup dependencies for all Arm NN components listed above …
143 | --target-arch= | **mandatory option:** specify a target architecture ```aarch64, x86_64``` …
145 **At least one component** (e.g. ```--tflite-delegate```) must be provided **or** else provide ```-…
148 Setup for aarch64 with all Arm NN dependencies:<br>
149 ```SETUP_ARGS="--target-arch=aarch64 --all"```
151 Setup for aarch64 with TF Lite Delegate and TF Lite Parser dependencies only:<br>
152 ```SETUP_ARGS="--target-arch=aarch64 --tflite-delegate --tflite-parser"```
157 … following arguments are given to ```build-armnn.sh``` and define which components of Arm NN to in…
161 …---------------------|:---------------------------------------------------------------------------…
162 | --tflite-delegate | **flag:** build the Arm NN TF Lite Delegate component …
163 | --tflite-parser | **flag:** build the Arm NN TF Lite Parser component …
164 | --onnx-parser | **flag:** build the Arm NN ONNX parser component …
165 | --all | **flag:** build all Arm NN components listed above …
166 | --target-arch= | **mandatory option:** specify a target architecture ```aarch64, x86_64``` …
167 | --neon-backend | **flag:** build Arm NN with the NEON backend (CPU acceleration from ACL) …
168 | --cl-backend | **flag:** build Arm NN with the OpenCL backend (GPU acceleration from ACL) …
169 | --ref-backend | **flag:** build Arm NN with the reference backend<br/>**Should be used for …
170 | --debug | **flag:** build Arm NN (and ACL) with debug turned on (optional: defaults t…
171 | --armnn-cmake-args= | **option:** provide additional comma-separated CMake arguments string for b…
172 …--acl-scons-params= | **option**: provide additional comma-separated scons parameters string for b…
175 …onent** (i.e. ```--tflite-delegate```, ```--tflite-parser```, ```--onnx-parser```) must be provide…
176 … must also have been given in ```SETUP_ARGS``` previously**, or else Arm NN will fail to build.<br>
177 **At least one backend** (i.e. ```--neon-backend```, ```--cl-backend```, ```--ref-backend```) must …
180 Build for aarch64 with all Arm NN components, NEON enabled and OpenCL enabled:<br>
181 ```BUILD_ARGS="--target-arch=aarch64 --all --neon-backend --cl-backend"```
183 Build for aarch64 with TF Lite Delegate, OpenCL enabled and additional ACL scons params:<br>
184 ```BUILD_ARGS="--target-arch=aarch64 --tflite-delegate --cl-backend --acl-scons-params='compress_ke…
186 Setup for aarch64 with all Arm NN dependencies, OpenCL enabled and additional Arm NN cmake args:<br>
187 ```BUILD_ARGS="--target-arch=aarch64 --all --cl-backend --armnn-cmake-args='-DBUILD_SAMPLE_APP=1,-D…
191 SETUP_ARGS="--target-arch=aarch64 --all"
192 BUILD_ARGS="--target-arch=aarch64 --tflite-delegate --neon-backend --cl-backend"
197 SETUP_ARGS="--target-arch=aarch64 --tflite-delegate"
198 BUILD_ARGS="--target-arch=aarch64 --all --neon-backend --cl-backend"
201 The example above is invalid since it tries to build all Arm NN components after **only** building …
205 ## Docker Build Steps
207 First clone the Arm NN repo to obtain the build-tool. This automatically downloads the latest relea…
209 git clone https://github.com/ARM-software/armnn.git armnn
213 Enter into the Arm NN build-tool directory where the Dockerfile and associated scripts are located.
215 cd armnn/build-tool
219 …docker build```, which downloads and builds Arm NN and its dependencies. This process is isolated …
220 …ckerfile arguments are provided using ```--build-arg```, the relative path to the Dockerfile is gi…
221 Provide a descriptive name for the Image with ```--tag``` in the form of ```image_name:tag``` (exam…
223 …_args)** builds all Arm NN components with NEON and OpenCL accelerated backends for aarch64 target.
227 docker build \
228 --build-arg SETUP_ARGS="--target-arch=aarch64 --all" \
229 --build-arg BUILD_ARGS="--target-arch=aarch64 --all --neon-backend --cl-backend" \
230 --tag armnn:aarch64 \
231 --file docker/Dockerfile .
236 …l of its dependencies are now built within a Docker Image. Built Docker images can be listed with …
238 docker images
241 armnn aarch64 cc623174fd98 7 seconds ago 5.02GB
246 …ball archive of the Arm NN build is located inside the Docker home directory (```/home/arm-user/``…
247 If the ```--debug``` build flag is provided in the ```BUILD_ARGS``` above, the tarball will be name…
248 The ```docker-copy-to-host.sh``` script will copy a file from the Docker Image (in arm-user's home …
249 The script copies the tarball into a new directory on the host in ```build-tool/docker_output```. I…
250 … is a relative path from the home directory created inside the Docker Image (```/home/arm-user/```…
252 ./scripts/docker-copy-to-host.sh armnn:aarch64 armnn_aarch64_build.tar.gz
258 If the ```--target-arch``` chosen in the arguments above matches the host machine, the build can be…
263 # If --debug is enabled, the extracted build directory will be called <target_arch>_build_debug
264 tar -xzf armnn_aarch64_build.tar.gz
279 …Docker builds may result in an accumulation of unwanted, dangling images. **To remove dangling ima…
283 ## Build Arm NN without Docker
284 For ease of use, we recommend that the official Arm NN Dockerfile is used to build Arm NN.
285 If you'd like to build locally on a Ubuntu host machine without Docker, execute the build-tool scri…
286 This involves running ```install-packages.sh``` followed by ```setup-armnn.sh``` and ```build-armnn…
287 The arguments for ```setup-armnn.sh``` and ```build-armnn.sh``` are very much the same as ```SETUP_…
288 Please use ```--help``` for more specific information.
291 cd build-tool/scripts
293 sudo ./install-packages.sh
295 ./setup-armnn.sh --target-arch=aarch64 --all
296 ./build-armnn.sh --target-arch=aarch64 --all --neon-backend --cl-backend
298 ./setup-armnn.sh --help
299 ./build-armnn.sh --help
306 ### Use custom Arm NN and ACL repository versions during build
307 By default, the docker build process (specifically, during ```build-armnn.sh```) will download the …
308 If you'd like to use different versions during the build, check them out in the ```build-tool``` di…
309 …n providing custom repositories, the following ```docker build``` argument must be provided ```--b…
310 This will trigger Docker to copy the custom repos into the Docker Image during build. The ACL repo …
311 supplying the ```--neon-backend``` or ```--cl-backend``` BUILD_ARGS options.
313 …he Arm NN version used for build-tool (Dockerfile and scripts) is not the same version of Arm NN t…
314 This means that separate versions of Arm NN can be used for the build-tool and for building Arm NN …
315 If you repeat the ```docker build``` process multiple times (e.g. with different ```BUILD_ARGS```),…
317 cd build-tool
319 git clone https://github.com/ARM-software/armnn.git armnn
325 # custom ACL repo only required when supplying --neon-backend or --cl-backend BUILD_ARGS options
326 git clone https://github.com/ARM-software/ComputeLibrary.git acl
332 # Example docker build with BUILD_TYPE=dev, ran inside the build-tool directory
333 docker build \
334 --build-arg BUILD_TYPE=dev \
335 --build-arg SETUP_ARGS="--target-arch=aarch64 --all" \
336 --build-arg BUILD_ARGS="--target-arch=aarch64 --all --neon-backend --cl-backend" \
337 --tag armnn:aarch64 \
338 --file docker/Dockerfile .
343 ### Additional Docker Build Arguments
346 The default base Image used during ```docker build``` is ```ubuntu:18.04```. Building Arm NN with t…
347 …t Ubuntu base Image, provide ```UBUNTU_VERSION``` during ```docker build``` e.g. ```--build-arg UB…
351 …repositories as explained [above](#Use-custom-Arm-NN-and-ACL-repository-versions-during-build), pr…
354 …re additional ```SETUP_ARGS``` and ```BUILD_ARGS``` that can be provided to the ```docker build```.
357 …-------------------------|:-----------------------------------------------------------------------…
358 …--num-threads= | **option:** specify number of threads/cores to build Arm NN and its depe…
359 | -x | **flag:** enable shell tracing during setup-armnn.sh and build-armnn.sh…
362 By default, the Docker Image creates a user called ```arm-user``` with user/group ID of 1000. This …
363 …c user and group ID to be associated with the build, provide ```--build-arg USER_ID=XXXX``` and ``…
367 ### Inspect the contents of the Docker Image
368 To inspect the full contents of the Docker Image, the Image must be run as a **Docker Container**.
371 The following shows how to run a container with an interactive terminal based on a specified Docker…
372 …s ```4da7c575a95a```. An ```ls``` command shows the contents of the ```/home/arm-user``` directory.
374 docker run --interactive --tty armnn:aarch64
376 arm-user@4da7c575a95a:~$ ls
377 armnn_aarch64_build.tar.gz build build-armnn.sh common.sh setup-armnn.sh source validation.sh
380 The ```build``` directory contains the built Arm NN dependencies and the Arm NN build itself.<br>
381 The ```armnn_aarch64_build.tar.gz``` tarball is an archive of the build located at ```build/armnn/a…
382 …cripts (e.g. ```build-armnn.sh```) in this directory can be run as you wish, changes will persist …
383 To exit the docker container, run ```CTRL-D```. A list of Docker containers can be obtained with th…
385 # --all shows both running and non-running containers
386 docker ps --all
389 4da7c575a95a armnn:aarch64 "bash" 7 minutes ago Exited (0) 7 seconds ago peda…
395 docker start 4da7c575a95a # restart container in background
396 docker attach 4da7c575a95a # re-attach to terminal
398 # After exiting with CTRL-D
399 docker stop 4da7c575a95a
401 To save space over time, stopped Docker containers can be deleted with the following command:<br>
402 ```docker container prune```.
407 **Bind Mounts** may be used to mount directories from the host machine to inside a Docker container…
408 frequently changing the contents of the Arm NN or ACL source repositories (in ```/home/arm-user/sou…
409 build-armnn.sh inside the container. Note that bind mounts are a feature that apply to runtime vers…
410 images i.e. Docker Containers (```docker run```, not ```docker build```).
411 Please refer to the [Docker documentation for more information about bind mounts](https://docs.dock…