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
To follow this Learning Path, you will need to set up an environment to develop
10
-
with SME2 and download the code examples. This learning path assumes two
11
-
different ways of working, and you will need to select the one appropriate for
12
-
your machine:
13
-
- Case #1: Your machine has native SME2 support --- check the [list of devices
14
-
with SME2 support](#devices-with-sme2-support).
15
-
- Case #2: Your machine does not have native SME2 support. This learning path
16
-
supports this use case by enabling you to run code with SME2 instructions in
17
-
an emulator in bare metal mode, i.e., the emulator runs the SME2 code
18
-
*without* an operating system.
9
+
## Choose your SME2 setup: native or emulated
19
10
20
-
## Code examples
11
+
To build or run SME2-accelerated code, first set up your development environment.
12
+
This section walks you through the required tools and two supported setup options:
21
13
22
-
[Download the code examples](https://gitlab.arm.com/learning-code-examples/code-examples/-/archive/main/code-examples-main.tar.gz?path=learning-paths/cross-platform/multiplying-matrices-with-sme2) for this learning path, expand the archive, and change your current directory to:
*[**Native SME2 hardware**](#set-up-a-system-with-native-SME2-support) - build and run directly on a system with SME2 support. For supported devices, see [Devices with SME2 support](#devices-with-sme2-support).
15
+
16
+
*[**Docker-based emulation**](#set-up-a-system-using-sme2-emulation-with-docker) - use a container to emulate SME2 in bare metal mode (without an OS).
17
+
18
+
## Download and explore the code examples
19
+
20
+
To get started, begin by [downloading the code examples](https://gitlab.arm.com/learning-cde-examples/code-examples/-/archive/main/code-examples-main.tar.gz?path=learning-paths/cross-platform/multiplying-matrices-with-sme2).
tar xfz code-examples-main-learning-paths-cross-platform-multiplying-matrices-with-sme2.tar.gz -s /code-examples-main-learning-paths-cross-platform-multiplying-matrices-with-sme2/code-examples/
27
27
cd code-examples/learning-paths/cross-platform/multiplying-matrices-with-sme2
28
28
```
29
29
30
-
The listing of the content of this directory should look like this:
- The code examples that will be used throughout this learning path.
63
-
- A ``Makefile`` that builds the code examples.
64
-
- A shell script called ``run-fvp.sh`` that runs the FVP (used in the emulated
65
-
SME2 case).
66
-
- A directory called ``docker`` that contains materials related to Docker, which
67
-
are:
68
-
- A script called ``assets.source_me`` that provides the FVP and compiler
69
-
toolchain references.
70
-
- A Docker recipe called ``sme2-environment.docker`` to build the container
71
-
that you will use.
72
-
- A shell script called ``build-my-container.sh`` that you can use if you want
73
-
to build the Docker container. This is not essential; ready-made images are
74
-
available for you.
75
-
- A script called ``build-all-containers.sh`` that was used to create the
76
-
image for you to download to provide multi-architecture support for both
77
-
x86_64 and AArch64.
78
-
- A configuration script for VS Code to be able to use the container from the
79
-
IDE called ``.devcontainer/devcontainer.json``.
61
+
Amongst other files, it includes:
62
+
- Code examples.
63
+
- A `Makefile` to build the code.
64
+
-`run-fvp.sh` to run the FVP model.
65
+
- A `docker` directory containing:
66
+
-`assets.source_me` to provide toolchain paths.
67
+
-`build-my-container.sh`, a script that automates building the Docker image from the `sme2-environment.docker` file. It runs the Docker build command with the correct arguments so you don’t have to remember them.
68
+
-`sme2-environment.docker`, a custom Docker file that defines the steps to build the SME2 container image. It installs all the necessary dependencies, including the SME2-compatible compiler and Arm FVP emulator.
69
+
-`build-all-containers.sh`, a script to build multi-architecture images.
70
+
-`.devcontainer/devcontainer.json` for VS Code container support.
80
71
81
72
{{% notice Note %}}
82
-
From this point in the Learning Path, all instructions assume that your current
From this point, all instructions assume that your current directory is
74
+
``code-examples/learning-paths/cross-platform/multiplying-matrices-with-sme2``, so ensure that you are in the correct directory before proceeding.
85
75
{{% /notice %}}
86
76
87
-
## Platforms with native SME2 support
77
+
## Set up a system with native SME2 support
78
+
79
+
To run SME2 code natively, ensure your system includes SME2 hardware and uses a compiler version that supports SME2.
80
+
81
+
For the compiler, you can use [Clang](https://www.llvm.org/) version 18 or later, or [GCC](https://gcc.gnu.org/) version 14 or later. This Learning Path uses ``clang``.
82
+
83
+
{{% notice Note %}}
84
+
At the time of writing, macOS ships with `clang` version 17.0.0, which doesn't support SME2. Use a newer version, such as 20.1.7, available through Homebrew.{{% /notice%}}
88
85
89
-
If your machine has native support for SME2, then you only need to ensure that
90
-
you have a compiler with support for SME2 instructions.
86
+
You can check your compiler version using the command:``clang --version``
91
87
92
-
A recent enough version of the compiler is required because SME2 is a recent
93
-
addition to the Arm instruction set. Compiler versions that are too old will
94
-
have incomplete or no SME2 support, leading to compilation errors or
95
-
non-functional code. You can use [Clang](https://www.llvm.org/) version 18 or
96
-
later, or [GCC](https://gcc.gnu.org/) version 14 or later. This Learning Path
97
-
uses ``clang``.
88
+
### Install Clang
98
89
99
-
At the time of writing, the ``clang`` version shipped with macOS is ``17.0.0``,
100
-
which forces us to use the version from ``homebrew`` (which has version
101
-
``20.1.7``). Ensure the ``clang`` compiler you are using is recent enough with
102
-
``clang --version``:
90
+
Install Clang using the instructions below, selecting either macOS or Linux/Ubuntu, depending on your setup:
103
91
104
92
{{< tabpane code=true >}}
105
93
@@ -113,52 +101,40 @@ which forces us to use the version from ``homebrew`` (which has version
113
101
114
102
{{< /tabpane >}}
115
103
116
-
You are now all set to start hacking with SME2!
104
+
You are now all set to start hacking with SME2.
117
105
118
-
## Platforms with emulated SME2 support
106
+
## Set up a system using SME2 emulation with Docker
119
107
120
-
If your machine does not have SME2 support or if you want to run SME2 with an
121
-
emulator, you will need to install Docker. Docker containers provide
122
-
functionality to execute commands in an isolated environment, where you have all
123
-
the necessary tools you require without cluttering your machine. The containers
124
-
run independently, meaning they do not interfere with other containers on the
125
-
same machine or server.
108
+
If your machine doesn't support SME2, or you want to emulate it, you can use the Docker-based environment that this Learning Path models.
126
109
127
-
This learning path provides a Docker image that has a compiler and [Arm's Fixed
128
-
Virtual Platform (FVP)
110
+
The Docker container includes both a compiler and [Arm's Fixed Virtual Platform (FVP)
for emulating code with SME2 instructions. The Docker image recipe is provided
131
-
(with the code examples) so you can study it and build it yourself. You could
132
-
also decide not to use the Docker image and follow the
133
-
``sme2-environment.docker`` Docker file instructions to install the tools on
134
-
your machine.
112
+
for emulating code that uses SME2 instructions. You can either run the prebuilt container image provided in this Learning Path or build it yourself using the Docker file that is included.
135
113
136
-
### Docker
114
+
If building manually, follow the instructions in the ``sme2-environment.docker`` file to install the required tools on your machine.
115
+
116
+
### Install and verify Docker
137
117
138
118
{{% notice Note %}}
139
-
This Learning Path works without ``docker``, but the compiler and the FVP must
140
-
be available in your search path.
119
+
Docker is optional, but if you don’t use it, you must manually install the compiler and FVP, and ensure they’re in your `PATH`.
141
120
{{% /notice %}}
142
121
143
-
Start by checking that ``docker`` is installed on your machine by typing the
144
-
following command line in a terminal:
122
+
To begin, start by checking that Docker is installed on your machine:
145
123
146
124
```BASH { output_lines="2" }
147
125
docker --version
148
126
Docker version 27.3.1, build ce12230
149
127
```
150
128
151
-
If the above command fails with a message similar to "``docker: command not
152
-
found``" then follow the steps from the [Docker Install
If the above command fails with an error message similar to "``docker: command not found``", then follow the steps from the [Docker Install Guide](https://learn.arm.com/install-guides/docker/) to install Docker.
154
130
155
131
{{% notice Note %}}
156
-
You might need to log in again or restart your machine for the changes to take
132
+
You might need to log out and back in again or restart your machine for the changes to take
157
133
effect.
158
134
{{% /notice %}}
159
135
160
136
Once you have confirmed that Docker is installed on your machine, you can check
- Directly from the command line. For example, when you are working from a
205
-
terminal on your local machine.
206
-
- Within a containerized environment. Configure VS Code to execute all the
207
-
commands inside a Docker container, allowing you to work seamlessly within the
208
-
Docker environment.
180
+
-[Directly from the command line](#run-commands-from-a-terminal-using-docker) - for example, when you are working from a terminal on your local machine.
181
+
182
+
-[Within a containerized environment](#use-an-interactive-docker-shell) - by configuring VS Code to execute all the commands inside a Docker container, allowing you to work seamlessly within the
183
+
Docker environment.
209
184
210
-
### Working with Docker from a terminal
185
+
### Run commands from a terminal using Docker
211
186
212
187
When a command is executed in the Docker container environment, you must prepend
213
188
it with instructions on the command line so that your shell executes it within
@@ -233,64 +208,88 @@ For example, to run ``make``, you need to enter:
233
208
docker run --rm -v "$PWD:/work" -w /work armswdev/sme2-learning-path:sme2-environment-v2 make
234
209
```
235
210
236
-
### Working within the Docker container from the terminal
211
+
### Use an interactive Docker shell
237
212
238
-
The above commands are long and error-prone, so you can instead choose to work
239
-
interactively within the terminal, which would save you from prepending the
240
-
``docker run ...`` magic before each command you want to execute. To work in
241
-
this mode, run Docker without any command (note the ``-it`` command line
242
-
argument to the Docker invocation):
213
+
The standard `docker run` commands can be long and repetitive. To streamline your workflow, you can start an interactive Docker session that allows you to run commands directly - without having to prepend docker run each time.
214
+
215
+
To launch an interactive shell inside the container, use the `-it` flag:
243
216
244
217
```BASH
245
218
docker run --rm -it -v "$PWD:/work" -w /work armswdev/sme2-learning-path:sme2-environment-v2
246
219
```
247
220
248
-
You are now in the Docker container; you can execute all commands directly. For
221
+
You are now in the Docker container, and you can execute all commands directly. For
249
222
example, the ``make`` command can now be simply invoked with:
250
223
251
224
```BASH
252
225
make
253
226
```
254
227
255
-
To exit the container, simply hit CTRL+D. Note that the container is not
256
-
persistent (it was invoked with ``--rm``), so each invocation will use a
257
-
container freshly built from the image. All the files reside outside the
258
-
container, so changes you make to them will be persistent.
228
+
To exit the container, simply hit CTRL+D. Note that the container is not persistent (it was invoked with ``--rm``), so each invocation will use a container freshly built from the image. All the files reside outside the container, so changes you make to them will be persistent.
259
229
260
-
### Working within the Docker container with VSCode
230
+
### Develop with Docker in Visual Studio Code
261
231
262
-
If you are using Visual Studio Code as your IDE, it can use the container as is.
232
+
If you are using Visual Studio Code as your IDE, the container setup is already configured with `devcontainer/devcontainer.json`.
263
233
264
234
Make sure you have the [Microsoft Dev Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension installed.
265
235
266
-
Then select the **Reopen in Container** menu entry as Figure 1 shows.
236
+
Then select the **Reopen in Container** menu entry as shown below.
267
237
268
238
It automatically finds and uses ``.devcontainer/devcontainer.json``:
269
239
270
-

240
+

271
241
272
242
All your commands now run within the container, so there is no need to prepend
273
243
them with a Docker invocation, as VS Code handles all this seamlessly for you.
274
244
275
245
{{% notice Note %}}
276
246
For the rest of this Learning Path, shell commands include the full Docker
277
-
invocation so that users not using VS Code can copy the complete command line.
247
+
invocation so that if you are not using VS Code you can copy the complete command line.
278
248
However, if you are using VS Code, you only need to use the `COMMAND ARGUMENTS`
279
249
part.
280
250
{{% /notice %}}
281
251
282
-
### Devices with SME2 support
252
+
### Devices with native SME2 support
253
+
254
+
These Apple devices support SME2 natively.
255
+
256
+
- iPad
257
+
258
+
- iPad Pro 11"
259
+
260
+
- iPad Pro 13"
261
+
262
+
- iPhone
263
+
264
+
- iPhone 16
265
+
266
+
- iPhone 16 Plus
267
+
268
+
- iPhone 16e
269
+
270
+
- iPhone 16 Pro
271
+
272
+
- iPhone 16 Pro Max
273
+
274
+
- iMac
275
+
276
+
- MacBook Air
277
+
278
+
- MacBook Air 13"
279
+
280
+
- MacBook Air 15"
281
+
282
+
- Mac mini
283
+
284
+
285
+
286
+
- MacBook Pro
287
+
288
+
- MacBook Pro 14"
289
+
290
+
- MacBook Pro 16"
283
291
284
-
By chip:
292
+
- Mac Studio
285
293
286
-
| Manufacturer | Chip | Devices |
287
-
|--------------|--------|---------|
288
-
| Apple | M4 | iPad Pro 11" & 13", iMac, Mac mini, MacBook Air 13" & 15"|
289
-
| Apple | M4 Pro | Mac mini, MacBook Pro 14" & 16" |
290
-
| Apple | M4 Max | MacBook Pro 14" & 16", Mac Studio |
291
294
292
-
By product:
293
295
294
-
| Manufacturer | Product family | Models |
295
-
|--------------|----------------|--------|
296
-
| Apple | iPhone 16 | iPhone 16, iPhone 16 Plus, iPhone 16e, iPhone 16 Pro, iPhone 16 Pro Max |
0 commit comments