You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/learning-paths/embedded-and-microcontrollers/mlek/_index.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,22 +3,22 @@ title: Build and run the Arm Machine Learning Evaluation Kit examples
3
3
4
4
minutes_to_complete: 30
5
5
6
-
who_is_this_for: This is an introductory topic for embedded software developers interested in learning about machine learning.
6
+
who_is_this_for: This is an introductory topic for embedded software developers interested in machine learning applications.
7
7
8
8
learning_objectives:
9
9
- Build examples from Machine Learning Evaluation Kit (MLEK)
10
-
- Run the examples on Corstone-320 FVP or Virtual Hardware
10
+
- Run the examples on Arm Ecosystem FVP
11
11
12
12
prerequisites:
13
13
- Some familiarity with embedded programming
14
-
- Either a Linux machine running Ubuntu, or an AWS account to use [Arm Virtual Hardware](https://www.arm.com/products/development-tools/simulation/virtual-hardware)
14
+
- A Linux host machine running Ubuntu
15
15
16
16
author_primary: Ronan Synnott
17
17
18
18
### RS: Learning Path hidden until AWS instance updated
Copy file name to clipboardExpand all lines: content/learning-paths/embedded-and-microcontrollers/mlek/build.md
+14-61Lines changed: 14 additions & 61 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,11 +13,7 @@ You can use the MLEK source code to build sample applications and run them on th
13
13
14
14
## Before you begin
15
15
16
-
You can use your own Ubuntu Linux host machine or use [Arm Virtual Hardware (AVH)](https://www.arm.com/products/development-tools/simulation/virtual-hardware) for this Learning Path.
17
-
18
-
The Ubuntu version should be 20.04 or 22.04. These instructions have been tested on the `x86_64` architecture. You will need a way to interact visually with your machine to run the FVP, because it opens graphical windows for input and output from the software applications.
19
-
20
-
If you want to use Arm Virtual Hardware the [Arm Virtual Hardware install guide](/install-guides/avh#corstone) provides setup instructions.
16
+
It is recommended to use an Ubuntu Linux host machine. The Ubuntu version should be 20.04 or 22.04. These instructions have been tested on the `x86_64` architecture.
21
17
22
18
## Build the example application
23
19
@@ -52,9 +48,6 @@ You can review the installation guides for further details.
52
48
53
49
{{% /notice %}}
54
50
55
-
56
-
Both compilers are pre-installed in Arm Virtual Hardware.
57
-
58
51
### Clone the repository
59
52
60
53
Clone the ML Evaluation Kit repository, and navigate into the new directory:
@@ -69,76 +62,36 @@ git submodule update --init
69
62
70
63
The default build is Ethos-U55 and Corstone-300. The default build for Ethos-U85 is Corstone-320. Use the `npu-config-name` flag to set Ethos-U85.
71
64
72
-
The default compiler is `gcc`, but `armclang` can also be used. Number after `ethos-u85-*` is number of MACs, 128-2048 (2^n).
65
+
The default compiler is `gcc`, but `armclang` can also be used. Number after `ethos-u85-*` is the number of MACs, 128-2048 (2^n).
66
+
67
+
Use `--make-jobs` to specify `make -j` value.
73
68
74
69
You can select either compiler to build applications. You can also try them both and compare the results.
75
70
76
-
- Build with Arm GNU Toolchain (`gcc`)
71
+
- Build with Arm GNU Toolchain (`gcc`):
77
72
78
73
```
79
-
./build_default.py --npu-config-name ethos-u85-256 --toolchain gnu
74
+
./build_default.py --npu-config-name ethos-u85-256 --toolchain gnu --make-jobs 8
80
75
```
81
76
82
-
- Build with Arm Compiler for Embedded (`armclang`)
77
+
- Build with Arm Compiler for Embedded (`armclang`):
83
78
84
79
```console
85
-
./build_default.py --npu-config-name ethos-u85-256 --toolchain arm
86
-
```
87
-
88
-
The build will take a few minutes.
89
-
90
-
When the build is complete, you will find the examples (`.axf` files) in the `cmake-build-*/bin` directory. The `cmake-build` directory names are specific to the compiler used and Ethos-U85 configuration. Verify that the files have been created by observing the output of the `ls` command
91
-
92
-
```bash
93
-
ls cmake-build-mps4-sse-320-ethos-u85-256-gnu/bin/
80
+
./build_default.py --npu-config-name ethos-u85-256 --toolchain arm --make-jobs 8
94
81
```
95
82
96
-
The next step is to install the FVP and run it with these example audio clips.
97
-
98
-
99
-
## Corstone-320 FVP {#fvp}
100
-
101
-
This section describes installation of the Corstone-320 to run on your local machine. If you are using Arm Virtual Hardware, that comes with the Corstone-300 FVP pre-installed, and you can move on to the next section. You can review Arm's full FVP offer and general installation steps in the [Fast Model and Fixed Virtual Platform](/install-guides/fm_fvp) install guides.
83
+
{{% notice Tip %}}
84
+
Use `./build_default.py --help` for additional information.
102
85
103
-
{{% notice Note %}}
104
-
The rest of the steps for the Corstone-320 need to be run in a new terminal window.
105
86
{{% /notice %}}
106
87
107
-
Open a **new terminal window** and download the Corstone-320 archive.
The FVP requires an additional dependency, `libpython3.9.so.1.0`, which can be installed using a script. Note that this will tinkle with the python installation for the current terminal window, so make sure to open a new one for the next step.
Verify that the FVP was successfully installed by comparing your output from below command.
90
+
When the build is complete, you will find the examples (`.axf` files) in the `cmake-build-*/bin` directory. The `cmake-build` directory names are specific to the compiler used and Ethos-U85 configuration. Verify that the files have been created by observing the output of the `ls`command
129
91
130
92
```bash
131
-
FVP_Corstone_SSE-320
132
-
```
133
-
134
-
```output
135
-
telnetterminal0: Listening for serial connection on port 5000
136
-
telnetterminal1: Listening for serial connection on port 5001
137
-
telnetterminal2: Listening for serial connection on port 5002
138
-
telnetterminal5: Listening for serial connection on port 5003
139
-
93
+
ls cmake-build-mps4-sse-320-ethos-u85-256-gnu/bin/
140
94
```
141
95
142
-
143
-
Now you are ready to test the application with the FVP.
96
+
The next step is to install the FVP and run the built example applications.
This section describes installation of the [Corstone-320 FVP](https://developer.arm.com/Tools%20and%20Software/Fixed%20Virtual%20Platforms/IoT%20FVPs) to run on your local machine. Similar instructions would apply for other platforms.
13
+
14
+
Arm provides a selection of free to use Fixed Virtual Platforms (FVPs) that can be downloaded from the [Arm Developer](https://developer.arm.com/Tools%20and%20Software/Fixed%20Virtual%20Platforms#Downloads) website.
15
+
16
+
You can review Arm's full FVP offering and general installation steps in the [Fast Model and Fixed Virtual Platform](/install-guides/fm_fvp) install guide.
17
+
18
+
{{% notice Note %}}
19
+
It is recommended to perform these steps in a new terminal window.
Use the menu to control the application. For the key word spotting application enter 1 to classify the next audio clip.
57
+
If adding configuration options becomes cumbersome, it can be easier to specify them in a configuration file (remove the `-C` option) and then use that on the command line (`-f`).
58
58
59
-

59
+
#### config.txt
60
+
```
61
+
mps4_board.subsystem.ethosu.num_macs=256
62
+
mps4_board.visualisation.disable-visualisation=1
63
+
vis_hdlcd.disable_visualisation=1
64
+
```
60
65
61
-
The results of the classification will appear in the visualization window of the FVP.
66
+
The command line becomes:
67
+
```console
68
+
FVP_Corstone_SSE-320 -f config.txt -a ethos-u-kws.axf
69
+
```
62
70
63
-
The display shows a 98% chance of the audio clips sound was down.
71
+
The application executes and identifies words spoken within audio files.
64
72
65
-

73
+
Repeat with any of the other built applications.
66
74
67
-
End the simulation by pressing Control-C in the terminal where to started the FVP.
75
+
Full instructions are provided in the evaluation kit [documentation](https://review.mlplatform.org/plugins/gitiles/ml/ethos-u/ml-embedded-evaluation-kit/+/HEAD/docs/quick_start.md).
68
76
69
-
You now have the ML Evaluation Kit examples running. Experiment with the different examples provided.
70
77
71
-
## Addendum: Setting model parameters
78
+
## Addendum: Speed up FVP execution
72
79
73
-
You can specify additional parameters to configure certain aspects of the simulated Corstone-300.
80
+
By default, the examples are built with Ethos-U timing enabled. This provides benchmarking information, but the result is that the FVP executes relatively slowly.
74
81
75
-
### List parameters
82
+
The build system has a macro `-DETHOS_U_NPU_TIMING_ADAPTER_ENABLED` defined to control this.
76
83
77
-
List the available parameters by running the FVP executable with the `--list-params` option, for example:
84
+
Modify the command `build_default.py` passes to `cmake` to include this setting (`OFF`). Search for `cmake_command` and modify as follows:
Do not use fast execution mode whilst benchmarking performance.
100
-
{{% /notice %}}
101
98
102
-
To set multiple parameters it may be easier to list them in a text file (without `-C`) and use `-f` to specify the file.
99
+
Rebuild the applications as before, for example:
100
+
```
101
+
./build_default.py --npu-config-name ethos-u85-256 --toolchain gnu --make-jobs 8
102
+
```
103
103
104
-
For example, use a text editor to create a file named `options.txt` with the contents:
104
+
Add additional configuration option (`mps4_board.subsystem.ethosu.extra_args`) to the FVP command line:
105
105
106
-
```console
106
+
#### config.txt
107
+
```
108
+
mps4_board.subsystem.ethosu.num_macs=256
107
109
mps4_board.visualisation.disable-visualisation=1
110
+
vis_hdlcd.disable_visualisation=1
108
111
mps4_board.subsystem.ethosu.extra_args="--fast"
109
112
```
110
113
111
-
Run the FVP with the `-f` option and the `options.txt` file:
114
+
Run the application again, and notice how much faster execution completes.
112
115
113
116
```console
114
-
FVP_Corstone_SSE-320 -a cmake-build-mps4-sse-320-ethos-u85-256-gnu/bin/ethos-u-kws.axf -f options.txt
117
+
FVP_Corstone_SSE-320 -f config.txt -a ethos-u-kws.axf
115
118
```
116
119
117
-
Full instructions are provided in the evaluation kit [documentation](https://review.mlplatform.org/plugins/gitiles/ml/ethos-u/ml-embedded-evaluation-kit/+/HEAD/docs/quick_start.md).
120
+
{{% notice Note %}}
121
+
Do not use fast execution mode whilst benchmarking performance.
122
+
{{% /notice %}}
118
123
119
-
You have now run an example application on an Arm Fixed Virtual Platform.
0 commit comments