Skip to content

Commit cec2dc4

Browse files
Merge pull request #2110 from madeline-underwood/SME_Jul
SME2_JA to review
2 parents ed5b63c + 951b692 commit cec2dc4

File tree

12 files changed

+416
-495
lines changed

12 files changed

+416
-495
lines changed
Lines changed: 107 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11
---
2-
title: Set up your Environment
2+
title: Set up your SME2 development environment
33
weight: 3
44

55
### FIXED, DO NOT MODIFY
66
layout: learningpathall
77
---
88

9-
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
1910

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:
2113

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:
23-
``code-examples/learning-paths/cross-platform/multiplying-matrices-with-sme2`` :
14+
* [**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).
21+
22+
Now extract the archive, and change directory to:
23+
``code-examples/learning-paths/cross-platform/multiplying-matrices-with-sme2.``
2424

2525
```BASH
2626
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/
2727
cd code-examples/learning-paths/cross-platform/multiplying-matrices-with-sme2
2828
```
2929

30-
The listing of the content of this directory should look like this:
30+
The directory structure should look like this:
3131

3232
```TXT
3333
code-examples/learning-paths/cross-platform/multiplying-matrices-with-sme2/
@@ -58,48 +58,36 @@ code-examples/learning-paths/cross-platform/multiplying-matrices-with-sme2/
5858
└── sme2_check.c
5959
```
6060

61-
It contains:
62-
- 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.
8071

8172
{{% notice Note %}}
82-
From this point in the Learning Path, all instructions assume that your current
83-
directory is
84-
``code-examples/learning-paths/cross-platform/multiplying-matrices-with-sme2``.
73+
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.
8575
{{% /notice %}}
8676

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%}}
8885

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``
9187

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
9889

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:
10391

10492
{{< tabpane code=true >}}
10593

@@ -113,52 +101,40 @@ which forces us to use the version from ``homebrew`` (which has version
113101

114102
{{< /tabpane >}}
115103

116-
You are now all set to start hacking with SME2!
104+
You are now all set to start hacking with SME2.
117105

118-
## Platforms with emulated SME2 support
106+
## Set up a system using SME2 emulation with Docker
119107

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.
126109

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)
129111
model](https://developer.arm.com/Tools%20and%20Software/Fixed%20Virtual%20Platforms)
130-
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.
135113

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
137117

138118
{{% 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`.
141120
{{% /notice %}}
142121

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:
145123

146124
```BASH { output_lines="2" }
147125
docker --version
148126
Docker version 27.3.1, build ce12230
149127
```
150128

151-
If the above command fails with a message similar to "``docker: command not
152-
found``" then follow the steps from the [Docker Install
153-
Guide](https://learn.arm.com/install-guides/docker/).
129+
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.
154130

155131
{{% 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
157133
effect.
158134
{{% /notice %}}
159135

160136
Once you have confirmed that Docker is installed on your machine, you can check
161-
that it is operating normally with the following:
137+
that it is working with the following:
162138

163139
```BASH { output_lines="2-27" }
164140
docker run hello-world
@@ -201,13 +177,12 @@ https://docs.docker.com/get-started/
201177
```
202178

203179
You can use Docker in the following ways:
204-
- 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.
209184

210-
### Working with Docker from a terminal
185+
### Run commands from a terminal using Docker
211186

212187
When a command is executed in the Docker container environment, you must prepend
213188
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:
233208
docker run --rm -v "$PWD:/work" -w /work armswdev/sme2-learning-path:sme2-environment-v2 make
234209
```
235210

236-
### Working within the Docker container from the terminal
211+
### Use an interactive Docker shell
237212

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:
243216

244217
```BASH
245218
docker run --rm -it -v "$PWD:/work" -w /work armswdev/sme2-learning-path:sme2-environment-v2
246219
```
247220

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
249222
example, the ``make`` command can now be simply invoked with:
250223

251224
```BASH
252225
make
253226
```
254227

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.
259229

260-
### Working within the Docker container with VSCode
230+
### Develop with Docker in Visual Studio Code
261231

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`.
263233

264234
Make sure you have the [Microsoft Dev Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension installed.
265235

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.
267237

268238
It automatically finds and uses ``.devcontainer/devcontainer.json``:
269239

270-
![example image alt-text#center](VSCode.png "Figure 1: Setting up the Docker Container.")
240+
![VSCode Docker alt-text#center](VSCode.png "Figure 1: Setting up the Docker container.")
271241

272242
All your commands now run within the container, so there is no need to prepend
273243
them with a Docker invocation, as VS Code handles all this seamlessly for you.
274244

275245
{{% notice Note %}}
276246
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.
278248
However, if you are using VS Code, you only need to use the `COMMAND ARGUMENTS`
279249
part.
280250
{{% /notice %}}
281251

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"
283291

284-
By chip:
292+
- Mac Studio
285293

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 |
291294

292-
By product:
293295

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

Comments
 (0)