diff --git a/.wordlist.txt b/.wordlist.txt index a47baa66bf..0db9d5b849 100644 --- a/.wordlist.txt +++ b/.wordlist.txt @@ -3215,4 +3215,34 @@ pyplot scheduler's torchvision uOps -unsqueeze \ No newline at end of file +unsqueeze + +ACR +Abena +Adoptium +Amanfo +Arlo +Fitbit +Milvus +Amanfo +OCTLA +OpenAg +Sysbox +TCK +TOSA +Temurin +Zhang +Zilliz +arrhythmias +ggerganov +milvus +msbuild +nestybox +pte +replug +sam +sysbox +tinyml +tvOS +watchOS +zilliz \ No newline at end of file diff --git a/assets/contributors.csv b/assets/contributors.csv index 8c0bc22e11..ddf7d58fbe 100644 --- a/assets/contributors.csv +++ b/assets/contributors.csv @@ -1,6 +1,6 @@ author,company,github,linkedin,twitter,website Jason Andrews,Arm,jasonrandrews,jason-andrews-7b05a8,, -Pareena Verma,Arm,pareenaverma,,, +Pareena Verma,Arm,pareenaverma,pareena-verma-7853607,, Ronan Synnott,Arm,,ronansynnott,, Florent Lebeau,Arm,,,, Brenda Strech,Remote.It,bstrech,bstrech,@remote_it,www.remote.it @@ -39,4 +39,5 @@ Gayathri Narayana Yegna Narayanan,Arm,,,, Alexandros Lamprineas,Arm,,,, Annie Tallund,Arm,annietllnd,annietallund,, Cyril Rohr,RunsOn,crohr,cyrilrohr,, -Rin Dobrescu,Arm,,,, \ No newline at end of file +Rin Dobrescu,Arm,,,, +Przemyslaw Wirkus,Arm,PrzemekWirkus,przemyslaw-wirkus-78b73352,, diff --git a/content/install-guides/_images/idle.png b/content/install-guides/_images/idle.png deleted file mode 100644 index dc255d1d2e..0000000000 Binary files a/content/install-guides/_images/idle.png and /dev/null differ diff --git a/content/install-guides/_images/multipass-gui.png b/content/install-guides/_images/multipass-gui.png new file mode 100644 index 0000000000..3c35a6db06 Binary files /dev/null and b/content/install-guides/_images/multipass-gui.png differ diff --git a/content/install-guides/_images/multipass-tray.png b/content/install-guides/_images/multipass-tray.png deleted file mode 100644 index ffda5db9f4..0000000000 Binary files a/content/install-guides/_images/multipass-tray.png and /dev/null differ diff --git a/content/install-guides/_images/py1-woa.png b/content/install-guides/_images/py1-woa.png index 832e35676b..c6a87a7bfa 100644 Binary files a/content/install-guides/_images/py1-woa.png and b/content/install-guides/_images/py1-woa.png differ diff --git a/content/install-guides/_images/py2-woa.png b/content/install-guides/_images/py2-woa.png index 6b6b42619e..563a3061cd 100644 Binary files a/content/install-guides/_images/py2-woa.png and b/content/install-guides/_images/py2-woa.png differ diff --git a/content/install-guides/_images/py3-woa.png b/content/install-guides/_images/py3-woa.png index 867fe5f49f..ff22af0fb3 100644 Binary files a/content/install-guides/_images/py3-woa.png and b/content/install-guides/_images/py3-woa.png differ diff --git a/content/install-guides/aws-copilot.md b/content/install-guides/aws-copilot.md index 3a4b076cbe..0345bf04ef 100644 --- a/content/install-guides/aws-copilot.md +++ b/content/install-guides/aws-copilot.md @@ -73,13 +73,60 @@ To install Copilot on macOS: curl -Lo copilot https://github.com/aws/copilot-cli/releases/latest/download/copilot-darwin && chmod +x copilot && sudo mv copilot /usr/local/bin/copilot && copilot --help ``` +The help message is printed: + +```output +👩‍✈️ Launch and manage containerized applications on AWS. + +Commands + Getting Started 🌱 + init Create a new ECS or App Runner application. + docs Open the copilot docs. + + Develop ✨ + app Commands for applications. + Applications are a collection of services and environments. + env Commands for environments. + Environments are deployment stages shared between services. + svc Commands for services. + Services are long-running ECS or App Runner services. + job Commands for jobs. + Jobs are tasks that are triggered by events. + task Commands for tasks. + One-off Amazon ECS tasks that terminate once their work is done. + run Run the workload locally. + + Release 🚀 + pipeline Commands for pipelines. + Continuous delivery pipelines to release services. + deploy Deploy one or more Copilot jobs or services. + + Extend 🧸 + storage Commands for working with storage and databases. + secret Commands for secrets. + Secrets are sensitive information that you need in your application. + + Settings ⚙️ + version Print the version number. + completion Output shell completion code. + +Flags + -h, --help help for copilot + -v, --version version for copilot + +Examples + Displays the help menu for the "init" command. + `$ copilot init --help` +``` + Verify Copilot CLI is installed by running: ```console copilot --version ``` -The version should be printed: + +The installed version is displayed: ```output -copilot version: v1.33.0 +copilot version: v1.34.0 ``` \ No newline at end of file diff --git a/content/install-guides/hyper-v.md b/content/install-guides/hyper-v.md index c4556c2eb6..61f94da653 100644 --- a/content/install-guides/hyper-v.md +++ b/content/install-guides/hyper-v.md @@ -78,7 +78,7 @@ A dialog should appear: ## How do I enable Hyper-V from the command line? -1. Open a Command Prompt or Windows PowerShell +1. Open a Command Prompt or Windows PowerShell (as Administrator) 2. Run the `DISM` command below to enable Hyper-V: diff --git a/content/install-guides/java.md b/content/install-guides/java.md index d989227bbb..22b4d19252 100644 --- a/content/install-guides/java.md +++ b/content/install-guides/java.md @@ -22,25 +22,25 @@ layout: installtoolsall Java is a high-level, object-oriented programming language first released by Sun Microsystems in 1995. -It is designed to have as few implementation dependencies as possible, making it a versatile and widely-used language. +Its aim is to have as few implementation dependencies as possible, making it a versatile and widely-used language. ## Is Java available for Arm Linux? Yes, there are numerous ways to install Java on Arm Linux distributions. -Below are some of the common methods to install Java. This includes both the Java runtime environment (JRE), which is used to run Java applications and the Java development kit (JDK) which is used to create Java applications. +Below are some of the common methods that you can use to install Java. This includes both the Java runtime environment (JRE), which is used to run Java applications, and the Java Development Kit (JDK), which is used to create Java applications. Pick the one that works best for you. {{% notice Note %}} -The Java Technology Compatibility Kit (TCK) is a test suite that verifies whether a Java implementation conforms to the Java SE Platform Specification. It's a crucial tool for ensuring that Java applications can run consistently across different platforms and implementations. +The Java Technology Compatibility Kit (TCK) is a test suite that you can use to verify whether a Java implementation conforms to the Java SE Platform Specification. It is a crucial tool for ensuring that Java applications can run consistently across different platforms and implementations. Check the [OCTLA Signatories List](https://openjdk.org/groups/conformance/JckAccess/jck-access.html) to see who has been granted access to the TCK. {{% /notice %}} ## Can I install Java using the Linux package manager? -For distributions using `apt` - including Debian and Ubuntu: +For distributions using `apt`, including Debian and Ubuntu, you can install Java using this code: ```console sudo apt update @@ -48,13 +48,13 @@ sudo apt install default-jre -y sudo apt install default-jdk -y ``` -For distributions using `dnf` - including Fedora and Red Hat: +For distributions using `dnf`, including Fedora and Red Hat, you can install Java using this code: ```console sudo dnf install java-latest-openjdk ``` -For distributions using `pacman` - including Arch and Manjaro: +For distributions using `pacman`, including Arch and Manjaro, you can install Java using this code: ```console sudo pacman -S jdk-openjdk @@ -63,7 +63,7 @@ sudo pacman -S jre-openjdk ## Can I install Java using Snap? -For Linux distributions with `snap` you can install Java using: +For Linux distributions using `snap`, you can install Java using this code: ```console sudo snap install openjdk @@ -81,7 +81,7 @@ echo "deb [signed-by=/usr/share/keyrings/corretto-keyring.gpg] https://apt.corre sudo apt-get update; sudo apt-get install -y java-21-amazon-corretto-jdk ``` -More installation options for Corretto are available in the [Amazon Corretto 21 Guide for Linux](https://docs.aws.amazon.com/corretto/latest/corretto-21-ug/linux-info.html) +You can find out more about the installation options for Corretto in the [Amazon Corretto 21 Guide for Linux](https://docs.aws.amazon.com/corretto/latest/corretto-21-ug/linux-info.html). ## How do I install the Microsoft Build of OpenJDK? @@ -124,7 +124,7 @@ For more information about the available versions and supported platforms refer ## How do I install Eclipse Temurin from the Adoptium Working Group? -The Adoptium Working Group promotes and supports high-quality, TCK certified runtimes and associated technology for use across the Java ecosystem. +The Adoptium Working Group promotes and supports high-quality, TCK-certified runtimes and associated technology for use across the Java ecosystem. Eclipse Temurin is the name of the OpenJDK distribution from Adoptium. @@ -175,7 +175,7 @@ Yes, you can change the default version. For systems with `apt` use: sudo update-alternatives --config java ``` -You will be given the option to select a new version. The options are depend on the software currently installed on your computer. +You will be given the option to select a new version. The options are dependent on the software currently installed on your computer. ```output There are 3 choices for the alternative java (providing /usr/bin/java). @@ -190,11 +190,11 @@ There are 3 choices for the alternative java (providing /usr/bin/java). Press to keep the current choice[*], or type selection number: ``` -For this case, if you select option 1, Java 17 becomes the default. +In this example, if you select option 1, Java 17 becomes the default. ## How do I print the Java version? -Print the version of the Java runtime: +Print the version of the Java runtime, by running: ```console java -version @@ -222,13 +222,13 @@ javac 21.0.4 ## Which version of Java should I use for Arm Linux systems? -For performance and security, it’s important to ensure that your version of Java is at least 11.0.12. Earlier versions lack significant performance improvements. Java performance has steadily increased over time and newer versions will provide better performance. +For performance and security, it’s important to ensure that your version of Java is at least 11.0.12. Earlier versions lack significant performance improvements. Java performance has steadily increased over time and newer versions provide improved performance. ## Which flags are available for tuning the JVM? -The Java virtual machine (JVM) includes a number of flags which are available to tune performance and aid in debugging. Some of the flags are general purpose and some are Arm architecture specific. +The Java Virtual Machine (JVM) includes a number of flags which are available to tune performance and aid in debugging. Some of the flags are general-purpose and some are Arm architecture-specific. -To print the final values of the flags after the JVM has been initialized run: +To print the final values of the flags after the JVM has been initialized, run: ```console java -XX:+PrintFlagsFinal -version @@ -236,13 +236,13 @@ java -XX:+PrintFlagsFinal -version ## Are there other tools commonly used in Java projects? -There are a number of Java related tools you may want to install. +There are a number of Java-related tools you might like to install. ### Apache Maven Apache Maven is a powerful build automation tool primarily used for Java projects. -It simplifies the build process by providing a uniform build system, dependency management, and project management capabilities. +It simplifies the build process by providing a uniform build system, with dependency and project management capabilities. You can install it from the `apt` package manager: @@ -299,11 +299,11 @@ The output is similar to: Welcome to Gradle 8.10! Here are the highlights of this release: - - Support for Java 23 - - Faster configuration cache - - Better configuration cache reports + - Support for Java 23. + - Faster configuration cache. + - Improved configuration cache reports. -For more details see https://docs.gradle.org/8.10/release-notes.html +For further information, see https://docs.gradle.org/8.10/release-notes.html. ------------------------------------------------------------ @@ -387,4 +387,4 @@ INFO: Created user preferences directory. Copyright (c) 1999-2024 The Apache Software Foundation ``` -You are ready to use Java on your Arm Linux system. \ No newline at end of file +You are ready to use Java on your Arm Linux system. diff --git a/content/install-guides/multipass.md b/content/install-guides/multipass.md index a1a5d433f3..b336cf38a4 100644 --- a/content/install-guides/multipass.md +++ b/content/install-guides/multipass.md @@ -49,7 +49,7 @@ Multipass uses the terms virtual machine and instance synonymously. Download Multipass for macOS. ```console -wget https://github.com/canonical/multipass/releases/download/v1.13.1/multipass-1.13.1+mac-Darwin.pkg +wget https://github.com/canonical/multipass/releases/download/v1.14.1-rc1/multipass-1.14.1-rc1+mac.14+gf2381bfe9.mac-Darwin.pkg ``` ### Install @@ -57,12 +57,12 @@ wget https://github.com/canonical/multipass/releases/download/v1.13.1/multipass- Install the download using the package command. ```console -sudo installer -pkg multipass-1.13.1+mac-Darwin.pkg -target / +sudo installer -pkg multipass-1.14.1-rc1+mac.14+gf2381bfe9.mac-Darwin.pkg -target / ``` -The getting started instructions below use the command line interface. Multipass installs a tray icon for those who want to access basic features from the user interface. +The getting started instructions below use the command line interface. If you prefer to use the graphical interface start it from the macOS Launchpad, the initial screen is shown below. You can use the UI to create, start, and stop virtual machines. -![Connect #center](/install-guides/_images/multipass-tray.png) +![Connect #center](/install-guides/_images/multipass-gui.png) Multipass is now installed. Proceed to [Get Started with Multipass](#getstarted). @@ -168,10 +168,10 @@ The output from `find` will be similar to the below. ```output Image Aliases Version Description -20.04 focal 20240626 Ubuntu 20.04 LTS -22.04 jammy 20240701 Ubuntu 22.04 LTS -23.10 mantic 20240701 Ubuntu 23.10 -24.04 noble,lts 20240702 Ubuntu 24.04 LTS +20.04 focal 20240821 Ubuntu 20.04 LTS +22.04 jammy 20241002 Ubuntu 22.04 LTS +24.04 noble,lts 20241004 Ubuntu 24.04 LTS +daily:24.10 oracular,devel 20241009 Ubuntu 24.10 Blueprint Aliases Version Description anbox-cloud-appliance latest Anbox Cloud Appliance @@ -223,45 +223,7 @@ The `uname` output will look similar to: Linux m1u 6.8.0-36-generic #36-Ubuntu SMP PREEMPT_DYNAMIC Mon Jun 10 13:20:23 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux ``` -### Run an application - -It's helpful to demonstrate a few other common commands by downloading and installing an application. To demonstrate file copy, the download is done from macOS and the file is copied into the instance. - -Download and install [OpenVSCode Server](/install-guides/openvscode-server/). - -On the macOS host computer use `wget` for the download. - -```console -wget https://github.com/gitpod-io/openvscode-server/releases/download/openvscode-server-v1.90.0/openvscode-server-v1.90.0-linux-arm64.tar.gz -``` - -To copy a file to the instance - -```console -multipass transfer openvscode-server-v1.90.0-linux-arm64.tar.gz m1u:/home/ubuntu -``` - -Now switch to the instance and extract the download and run the application. - -If you don't already have an open shell run. - -```console -multipass shell m1u -``` - -Extract the download. - -```console -tar xvfz openvscode-server-v1.90.0-linux-arm64.tar.gz -``` - -Run the application. - -```console -./openvscode-server-v1.90.0-linux-arm64/bin/openvscode-server --host=0.0.0.0 --without-connection-token -``` - -Connect to OpenVSCode Server using a browser. From the macOS host computer use the `info` command to get the IP address of the instance. +### Print information The `info` command prints information about the instance, including the IP address. @@ -269,15 +231,22 @@ The `info` command prints information about the instance, including the IP addre multipass info m1u ``` -Copy the IP address from the info output and paste it into a browser with port 3000. +The output is similar to: -Modify the IP address to use your information, for example: ```output -http://192.168.64.39:3000 +Name: m1u +State: Running +Snapshots: 0 +IPv4: 192.168.73.29 +Release: Ubuntu 24.04.1 LTS +Image hash: e380b683b0c4 (Ubuntu 24.04 LTS) +CPU(s): 4 +Load: 0.00 0.03 0.01 +Disk usage: 2.0GiB out of 15.4GiB +Memory usage: 355.3MiB out of 3.8GiB +Mounts: -- ``` -You now have a running VS Code Server in your Multipass instance with Ubuntu 22.04 running on Arm. - ### Mount a host directory To access a large number of files on the host machine without copying or transferring them into the instance use the `mount` command. This command makes a host directory visible in the instance and all files can be accessed. Modifications made from inside the instance will directly change the files on the host. diff --git a/content/install-guides/py-woa.md b/content/install-guides/py-woa.md index dddd5fd5c8..7502154418 100644 --- a/content/install-guides/py-woa.md +++ b/content/install-guides/py-woa.md @@ -27,82 +27,91 @@ multitool_install_part: false # Set to true if a sub-page of a multi-page arti layout: installtoolsall # DO NOT MODIFY. Always true for tool install articles --- -Python has native support for [Windows on Arm](https://learn.microsoft.com/en-us/windows/arm/overview). Starting with version 3.11, an official installer is available. The latest version at time of writing is 3.12.0. +Python has native support for [Windows on Arm](https://learn.microsoft.com/en-us/windows/arm/overview). Starting with version 3.11, an official installer is available. The latest version is 3.13.0. -A number of developer ready Windows on Arm [devices](/learning-paths/laptops-and-desktops/intro/find-hardware/) are available. +A number of developer-ready Windows on Arm [devices](/learning-paths/laptops-and-desktops/intro/find-hardware/) are available. -Windows on Arm instances are available with Microsoft Azure. For more information, see [Deploy a Windows on Arm virtual machine on Microsoft Azure](/learning-paths/cross-platform/woa_azure/). +Windows on Arm instances are available with Microsoft Azure. For further information, see [Deploy a Windows on Arm virtual machine on Microsoft Azure](/learning-paths/cross-platform/woa_azure/). -## Download and install +## How do I download and install Python for Windows on Arm? -The installer can be downloaded from the [Python website](https://www.python.org/downloads/windows/). Locate the `ARM64` installer. +To download and install Python for Windows on Arm, there is more than one option: -You can also download from a PowerShell terminal. +* You can download the installer from the [Python website](https://www.python.org/downloads/windows/). Locate the `ARM64` installer. + +* You can download from a PowerShell terminal, by running the following: ```command -curl https://www.python.org/ftp/python/3.12.0/python-3.12.0-arm64.exe -O python-3.12.0-arm64.exe +curl https://www.python.org/ftp/python/3.13.0/python-3.13.0-arm64.exe --output python-3.13.0-arm64.exe ``` -Once downloaded, run the installer `exe` file on a Windows on Arm machine. +Once you have downloaded Python, run the installer `exe` file on a Windows on Arm machine. The installer will start. -Check `Add python.exe to PATH` if you want to easily invoke python from any directory. +Tick the checkbox **Add python.exe to PATH** to enable you to easily invoke Python from any directory. ![Install #center](/install-guides/_images/py1-woa.png) -`Setup was successful` is displayed when complete. +**Setup was successful** is displayed when complete. ![Complete #center](/install-guides/_images/py2-woa.png) -## Invoke python +## How do I start Python on Windows? + +To start Python on Windows, at a Windows Command prompt or a PowerShell prompt, use `python` or `py` to start the interpreter: -At a Windows Command prompt or a PowerShell prompt use `python` or `py` to start the interpreter. ```cmd py ``` + +The interpreter starts with an output similar to: + ```output -Python 3.12.0 (tags/v3.12.0:0fb18b0, Oct 2 2023, 13:15:47) [MSC v.1935 64 bit (ARM64)] on win32 +Python 3.13.0 (tags/v3.13.0:60403a5, Oct 7 2024, 10:17:29) [MSC v.1941 64 bit (ARM64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> ``` -Enter `exit()` to leave interpreter. + +Enter `exit()` to leave the interpreter: + ```python exit() ``` -## Test an example +## How can I run a Python example? -To confirm python is working, save the code below into a file `uname.py`. +To run a Python example, and confirm that Python is working, use a text editor to save the code below to a file named `uname.py`. -#### uname.py ```python import platform print("Python version", platform.python_version()) print("Machine is", platform.uname().system, platform.uname().release, platform.uname().machine) ``` -Run the code. +Run the code: + ```console py uname.py ``` -Running on a Windows on Arm machine produces the output similar to: + +Running on a Windows on Arm machine produces an output similar to: + ```output -Python version 3.12.0 +Python version 3.13.0 Machine is Windows 11 ARM64 ``` -## Installing packages +## How do I install Python packages? -Python `pip` can be used to install packages. +To install Python packages, you can use Python `pip`. For example, to install [Flask](https://palletsprojects.com/p/flask/): ```console pip install Flask ``` -Save the code below as `hello.py`: +Use a text editor to save the code below as `hello.py`: -#### hello.py ```python import platform from flask import Flask @@ -131,7 +140,7 @@ WARNING: This is a development server. Do not use it in a production deployment. * Running on http://10.8.0.10:5000 Press CTRL+C to quit ``` -Open a browser to the URL printed by the application. In this example: +Using the URL that the application prints, open a browser. Here is an example: ```url http://127.0.0.1:5000 ``` @@ -139,29 +148,28 @@ The output is displayed in the browser window. ![Complete #center](/install-guides/_images/flask-woa.png) -The accesses are reported in the command prompt: +The accesses are reported in the command window: + ```output 127.0.0.1 - - [] "GET / HTTP/1.1" 200 - 127.0.0.1 - - [] "GET /favicon.ico HTTP/1.1" 404 - 10.8.0.10 - - [] "GET / HTTP/1.1" 200 - 10.8.0.10 - - [] "GET /favicon.ico HTTP/1.1" 404 - ``` -Use `Ctrl+C` to kill the application. -## Using IDLE +Use **Ctrl + C** to stop the application. -Python `IDLE` is included in the installation. IDLE is a simple IDE for python development. You can locate it in your start menu. +## Is Python IDLE available? -![IDLE #center](/install-guides/_images/idle.png) +Python `IDLE` is included in the installation. IDLE is a simple IDE for Python development. You can locate it in the start menu. You can create and run Python applications in this environment. -For example, use `File` > `Open...` (`Ctrl+O`) to open the above `uname.py`. +For example, use **File**, then **Open...** (or **Ctrl + O**) to open the above `uname.py`. -Then select `Run` > `Run module` (`F5`) to execute. +Then select **Run** and **Run module** (or **F5**) to execute. ![IDLE uname #center](/install-guides/_images/py3-woa.png) - You are now ready to use Python on your Windows on Arm device. diff --git a/content/install-guides/swift.md b/content/install-guides/swift.md new file mode 100644 index 0000000000..3606e7ce82 --- /dev/null +++ b/content/install-guides/swift.md @@ -0,0 +1,143 @@ +--- + +title: Swift +author_primary: Jason Andrews + +minutes_to_complete: 10 +additional_search_terms: +- swift + +layout: installtoolsall +multi_install: false +multitool_install_part: false +official_docs: https://www.swift.org/documentation/ +test_images: +- ubuntu:latest +test_maintenance: true +tool_install: true +weight: 1 +--- + +[Swift](https://swift.org/) is an open-source programming language developed by Apple. It was initially created for use with Apple's iOS, macOS, watchOS, and tvOS operating systems, but has since gained popularity as a general-purpose language suitable for a wide range of Linux and Windows applications. Swift is known for its safety, speed, and expressiveness, making it ideal for both beginners and experienced programmers. + +## What do I need to install Swift? + +Swift is available for macOS, Windows, and Linux, including Arm Linux distributions. + +This guide provides a quick solution to install Swift on Ubuntu for Arm. + +Confirm you are using an Arm machine by running: + +```bash +uname -m +``` + +The output should be: + +```output +aarch64 +``` + +If you see a different result, you are not using an Arm computer running 64-bit Linux. + +### What software packages are needed? + +Before you install Swift on Ubuntu 24.04, install the following packages: + +```bash +sudo apt update +sudo apt-get -y install \ + binutils \ + git \ + gnupg2 \ + libc6-dev \ + libcurl4-openssl-dev \ + libedit2 \ + libgcc-13-dev \ + libncurses-dev \ + libpython3-dev \ + libsqlite3-0 \ + libstdc++-13-dev \ + libxml2-dev \ + libz3-dev \ + pkg-config \ + tzdata \ + unzip \ + zlib1g-dev +``` + +## How do I download and install Swift? + +This guide uses Swift version 6.0.1 on Ubuntu 24.04. + +You can get more information about other versions and platforms from [Download Swift](https://www.swift.org/download/). + +Download Swift for Arm Linux: + +```bash +wget https://download.swift.org/swift-6.0.1-release/ubuntu2404-aarch64/swift-6.0.1-RELEASE/swift-6.0.1-RELEASE-ubuntu24.04-aarch64.tar.gz +``` + +Extract the archive: + +```bash +sudo tar -xf swift-6.0.1-RELEASE-ubuntu24.04-aarch64.tar.gz -C /usr/local +``` + +Add the `bin/` directory to your search path: + +```bash +echo 'export PATH="$PATH:/usr/local/swift-6.0.1-RELEASE-ubuntu24.04-aarch64/usr/bin"' >> ~/.bashrc +source ~/.bashrc +``` + +## How can I confirm Swift is working? + +You can print the version with: + +```bash +swift --version +``` + +The expected output is: + +```output +Swift version 6.0.1 (swift-6.0.1-RELEASE) +Target: aarch64-unknown-linux-gnu +``` + +You can also create and run a simple example program. + +Use a text editor to create a new file named `hello.swift` and add the following code: + +```swift +print("Hello from Swift on Arm Linux!") +``` + +Compile and run the program: + +```bash +swift hello.swift +``` + +The output will be: + +```output +Hello from Swift on Arm Linux! +``` + +You can also compile and run the program using: + +```bash +swiftc hello.swift -o hello +./hello +``` + +The output will be the same: + +```output +Hello from Swift on Arm Linux! +``` + +You are ready to use the Swift programming language on your Arm Linux computer. + diff --git a/content/install-guides/sysbox.md b/content/install-guides/sysbox.md index 90fced825e..a135f2121b 100644 --- a/content/install-guides/sysbox.md +++ b/content/install-guides/sysbox.md @@ -39,7 +39,7 @@ In summary, Sysbox is a powerful container runtime that provides many of the ben Sysbox runs on Linux and supports Arm. -Sysbox has limited suppot for older versions of Linux, but recent Linux versions are easily compatible. +Sysbox has limited support for older versions of Linux, but recent Linux versions are easily compatible. If you are unsure about your Linux distribution and Linux kernel version, you can check [Sysbox Distro Compatibility](https://github.com/nestybox/sysbox/blob/master/docs/distro-compat.md) diff --git a/content/install-guides/vs-woa.md b/content/install-guides/vs-woa.md index e89829142a..072742abce 100644 --- a/content/install-guides/vs-woa.md +++ b/content/install-guides/vs-woa.md @@ -62,7 +62,7 @@ Two results are displayed: The LLVM compiler and MSBuild support for LLVM. Selec {{% notice Note%}} Different versions of Visual Studio include different LLVM toolchain versions. -For example, Visual Studio 2022 Version `17.5.3` installs `LLVM 15.0.1`. +For example, Visual Studio 2022 Version `17.11.5` installs `LLVM 17.0.3`. {{% /notice %}} LLVM supports `clang-cl`, a compatibility layer for Microsoft Visual C++ (MSVC). This means that most developers can use `clang-cl` to compile their C/C++ applications on Visual Studio/MSBuild on the Windows on Arm device, without needing to change the command line. This allows you to easily modify legacy projects that use MSVC to use native compilation. diff --git a/content/learning-paths/cross-platform/cca_rme/_index.md b/content/learning-paths/cross-platform/cca_rme/_index.md index d24ac0bf39..4df1ce50d2 100644 --- a/content/learning-paths/cross-platform/cca_rme/_index.md +++ b/content/learning-paths/cross-platform/cca_rme/_index.md @@ -32,6 +32,8 @@ tools_software_languages: - Coding - Trusted Firmware - Arm Development Studio + - RME + - CCA ### Cross-platform metadata only shared_path: true diff --git a/content/learning-paths/cross-platform/pytorch-digit-classification-arch-training/inference.md b/content/learning-paths/cross-platform/pytorch-digit-classification-arch-training/inference.md index c421f037b1..1e4e85ef73 100644 --- a/content/learning-paths/cross-platform/pytorch-digit-classification-arch-training/inference.md +++ b/content/learning-paths/cross-platform/pytorch-digit-classification-arch-training/inference.md @@ -16,7 +16,7 @@ The inference process involves using a trained model to make predictions on new, This process allows the model to generalize its learned knowledge to make accurate predictions on new data. -# Runing inference in PyTorch +# Running inference in PyTorch You can inference in PyTorch using the previously saved model. To display results, you can use matplotlib. diff --git a/content/learning-paths/cross-platform/pytorch-digit-classification-training/inference.md b/content/learning-paths/cross-platform/pytorch-digit-classification-training/inference.md index 5a2224f7a8..9a0bb597b4 100644 --- a/content/learning-paths/cross-platform/pytorch-digit-classification-training/inference.md +++ b/content/learning-paths/cross-platform/pytorch-digit-classification-training/inference.md @@ -16,7 +16,7 @@ The inference process involves using a trained model to make predictions on new, This process allows the model to generalize its learned knowledge to make accurate predictions on new data. -# Runing inference in PyTorch +# Running inference in PyTorch You can inference in PyTorch using the previously saved model. To display results you can use matplotlib. diff --git a/content/learning-paths/laptops-and-desktops/_index.md b/content/learning-paths/laptops-and-desktops/_index.md index a273613d43..8672a12ccd 100644 --- a/content/learning-paths/laptops-and-desktops/_index.md +++ b/content/learning-paths/laptops-and-desktops/_index.md @@ -11,29 +11,31 @@ operatingsystems_filter: - Android: 2 - Baremetal: 1 - ChromeOS: 1 -- Linux: 24 -- macOS: 4 -- Windows: 32 +- Linux: 27 +- macOS: 7 +- Windows: 35 subjects_filter: - CI-CD: 3 - Containers and Virtualization: 5 - Migration to Arm: 25 -- Performance and Architecture: 17 +- Performance and Architecture: 18 subtitle: Create and migrate apps for power efficient performance title: Laptops and Desktops tools_software_languages_filter: - .NET: 12 - Alacritty: 1 -- Android Studio: 1 +- Android Studio: 2 - Arm Development Studio: 2 - Arm64EC: 1 +- assembly: 1 - C: 2 - C#: 5 - C++: 2 - C/C++: 4 +- CCA: 1 - Clang: 8 - CMake: 2 -- Coding: 16 +- Coding: 18 - CSS: 1 - Docker: 4 - GCC: 8 @@ -48,6 +50,7 @@ tools_software_languages_filter: - Kubernetes: 1 - Linux: 1 - LLVM: 1 +- llvm-mca: 1 - MTE: 1 - Neon: 1 - Neovim: 1 @@ -56,6 +59,7 @@ tools_software_languages_filter: - Python: 2 - Qt: 2 - Remote.It: 1 +- RME: 1 - Rust: 1 - SVE: 1 - SVE2: 1 diff --git a/content/learning-paths/laptops-and-desktops/hyper-v/hyper-v.md b/content/learning-paths/laptops-and-desktops/hyper-v/hyper-v.md index 6b0ee044ca..343953e98d 100644 --- a/content/learning-paths/laptops-and-desktops/hyper-v/hyper-v.md +++ b/content/learning-paths/laptops-and-desktops/hyper-v/hyper-v.md @@ -24,12 +24,12 @@ You can find information about other Linux distributions following the Ubuntu in ## Download an Ubuntu disk image -Download the [Ubuntu 22.04 ISO file](https://cdimage.ubuntu.com/jammy/daily-live/current/jammy-desktop-arm64.iso) for Arm. +Download the [Ubuntu 24.04 ISO file](https://cdimage.ubuntu.com/noble/daily-live/current/noble-desktop-arm64.iso) for Arm. Alternatively, you can download the `.iso` file from the Command Prompt or Windows PowerShell by running: ```console -curl https://cdimage.ubuntu.com/jammy/daily-live/current/jammy-desktop-arm64.iso -O jammy-desktop-arm64.iso +curl https://cdimage.ubuntu.com/noble/daily-live/current/noble-desktop-arm64.iso --output noble-desktop-arm64.iso ``` ## Install Ubuntu using Hyper-V diff --git a/content/learning-paths/microcontrollers/_index.md b/content/learning-paths/microcontrollers/_index.md index d3da844979..f139834ead 100644 --- a/content/learning-paths/microcontrollers/_index.md +++ b/content/learning-paths/microcontrollers/_index.md @@ -8,14 +8,14 @@ key_ip: maintopic: true operatingsystems_filter: - Baremetal: 25 -- Linux: 3 +- Linux: 4 - macOS: 2 - RTOS: 10 - Windows: 2 subjects_filter: - CI-CD: 3 - Libraries: 3 -- ML: 6 +- ML: 7 - Performance and Architecture: 11 - RTOS Fundamentals: 4 - Security: 2 @@ -25,21 +25,27 @@ title: Microcontrollers tools_software_languages_filter: - Arduino: 1 - Arm Compiler for Embedded: 5 +- Arm Compute Library: 1 - Arm Development Studio: 4 -- Arm Virtual Hardware: 11 +- Arm Virtual Hardware: 12 - CMSIS: 5 - CMSIS-Toolbox: 3 - Coding: 22 -- Fixed Virtual Platform: 8 +- Edge Impulse: 1 +- ExecuTorch: 1 +- Fixed Virtual Platform: 9 - FVP: 1 -- GCC: 4 +- GCC: 5 - GitHub: 2 - IP Explorer: 2 - Keil: 7 - Keil MDK: 3 - MDK: 2 - MPS3: 1 +- Node.js: 1 - Paddle: 1 +- Python: 1 +- PyTorch: 1 - Raspberry Pi: 1 - RTX: 2 - STM32: 2 diff --git a/content/learning-paths/microcontrollers/introduction-to-tinyml-on-arm/Connect.png b/content/learning-paths/microcontrollers/introduction-to-tinyml-on-arm/Connect.png new file mode 100644 index 0000000000..6af713b403 Binary files /dev/null and b/content/learning-paths/microcontrollers/introduction-to-tinyml-on-arm/Connect.png differ diff --git a/content/learning-paths/microcontrollers/introduction-to-tinyml-on-arm/Overview-1.md b/content/learning-paths/microcontrollers/introduction-to-tinyml-on-arm/Overview-1.md new file mode 100644 index 0000000000..683e2ae6ca --- /dev/null +++ b/content/learning-paths/microcontrollers/introduction-to-tinyml-on-arm/Overview-1.md @@ -0,0 +1,47 @@ +--- +title: Introduction to TinyML +weight: 2 + +### FIXED, DO NOT MODIFY +layout: learningpathall +--- + +TinyML represents a significant shift in machine learning deployment. + +Unlike traditional machine learning, which typically depends on cloud-based servers or high-powered hardware, TinyML is tailored to function on devices with limited resources, constrained memory, low power, and less processing capabilities. + +TinyML has gained popularity because it enables AI applications to operate in real-time, directly on the device, with minimal latency, enhanced privacy, and the ability to work offline. + +This shift opens up new possibilities for creating smarter and more efficient embedded systems. + +## Module Overview + +This Learning Path is about TinyML, applying machine learning to devices with limited resources like microcontrollers. It serves as a starting point for learning how cutting-edge AI technologies may be put on even the smallest of devices, making Edge AI more accessible and efficient. + +You will learn how to setup on your host machine and target device to facilitate compilation and ensure smooth integration across all devices. + +## Examples of Arm-based devices and applications + +There are many devices you can use for TinyML projects. Some of them are listed below. + +### Raspberry Pi 4 and 5 + +Raspberry Pi single-board computers are excellent for prototyping TinyML projects. They are commonly used for prototyping machine learning projects at the edge, such as in object detection and voice recognition for home automation. + +### NXP i.MX RT microcontrollers + +NXP i.MX RT microcontrollers are low-power microcontrollers that can handle complex TinyML tasks while maintaining energy efficiency, making them ideal for applications like wearable healthcare devices and environmental sensors. + +### STM32 microcontrollers + +STM32 microcontrollers are used in industrial IoT applications for predictive maintenance. These microcontrollers are energy-efficient and capable of running TinyML models for real-time anomaly detection in factory machinery. + +### Arduino Nano 33 BLE Sense + +The Arduino Nano, equipped with a suite of sensors, supports TinyML and is ideal for small-scale IoT applications, such as detecting environmental changes and movement patterns. + +### Edge Impulse + +In addition to hardware, there are software platforms that can help you build TinyML applications. + +Edge Impulse platform offers a suite of tools for developers to build and deploy TinyML applications on Arm-based devices. It supports devices like Raspberry Pi, Arduino, and STMicroelectronics boards. \ No newline at end of file diff --git a/content/learning-paths/microcontrollers/introduction-to-tinyml-on-arm/Overview.png b/content/learning-paths/microcontrollers/introduction-to-tinyml-on-arm/Overview.png new file mode 100644 index 0000000000..cbcd944107 Binary files /dev/null and b/content/learning-paths/microcontrollers/introduction-to-tinyml-on-arm/Overview.png differ diff --git a/content/learning-paths/microcontrollers/introduction-to-tinyml-on-arm/_index.md b/content/learning-paths/microcontrollers/introduction-to-tinyml-on-arm/_index.md new file mode 100644 index 0000000000..26c3af0531 --- /dev/null +++ b/content/learning-paths/microcontrollers/introduction-to-tinyml-on-arm/_index.md @@ -0,0 +1,55 @@ +--- +title: Introduction to TinyML on Arm using PyTorch and ExecuTorch + +draft: true +cascade: + draft: true + +minutes_to_complete: 40 + +who_is_this_for: This is an introductory topic for developers, engineers, and data scientists who are new to TinyML and interested in exploring its potential for edge AI. You will learn how to get started using PyTorch and ExecuTorch for TinyML. + +learning_objectives: + - Identify TinyML and how it's different from the AI you might be used to. + - Understand the benefits of deploying AI models on Arm-based edge devices. + - Select Arm-based devices for TinyML. + - Identify real-world use cases demonstrating the impact of TinyML. + - Install and configure a TinyML development environment. + - Set up a cross-compilation environment on your host machine. + - Perform best practices for ensuring optimal performance on constrained edge devices. + + +prerequisites: + - Basic knowledge of machine learning concepts. + - Understanding of IoT and embedded systems. + - A Linux host machine or VM running Ubuntu 22.04 or higher. + +author_primary: Dominica Abena O. Amanfo + +### Tags +skilllevels: Introductory +subjects: ML +armips: + - Cortex-A + - Cortex-M + +operatingsystems: + - Linux + +tools_software_languages: + - Arm Virtual Hardware + - Fixed Virtual Platform + - Python + - PyTorch + - ExecuTorch + - Arm Compute Library + - GCC + - Edge Impulse + - Node.js + +### FIXED, DO NOT MODIFY +# ================================================================================ +weight: 1 # _index.md always has weight of 1 to order correctly +layout: "learningpathall" # All files under learning paths have this same wrapper +learning_path_main_page: "yes" # This should be surfaced when looking for related content. Only set for _index.md of learning path content. +--- diff --git a/content/learning-paths/microcontrollers/introduction-to-tinyml-on-arm/_next-steps.md b/content/learning-paths/microcontrollers/introduction-to-tinyml-on-arm/_next-steps.md new file mode 100644 index 0000000000..3be5790119 --- /dev/null +++ b/content/learning-paths/microcontrollers/introduction-to-tinyml-on-arm/_next-steps.md @@ -0,0 +1,21 @@ +--- +next_step_guidance: Research which lightweight ML models can be used for TinyML, and what device is best for a specific project. + +recommended_path: /learning-paths/microcontrollers/intro/ + + +further_reading: + - resource: + title: TinyML Brings AI to Smallest Arm Devices + link: https://newsroom.arm.com/blog/tinyml + type: blog + + + +# ================================================================================ +# FIXED, DO NOT MODIFY +# ================================================================================ +weight: 21 # set to always be larger than the content in this path, and one more than 'review' +title: "Next Steps" # Always the same +layout: "learningpathall" # All files under learning paths have this same wrapper +--- diff --git a/content/learning-paths/microcontrollers/introduction-to-tinyml-on-arm/_review.md b/content/learning-paths/microcontrollers/introduction-to-tinyml-on-arm/_review.md new file mode 100644 index 0000000000..a86edfaac5 --- /dev/null +++ b/content/learning-paths/microcontrollers/introduction-to-tinyml-on-arm/_review.md @@ -0,0 +1,47 @@ +--- +review: + - questions: + question: > + 1. What is TinyML? + answers: + - "Machine learning models designed to run on large, cloud-based servers." + - "Machine learning models designed to run on resource-constrained devices like microcontrollers and edge devices." + - A cloud service for deep learning model deployment. + - A special type of machine learning for virtual reality applications + correct_answer: 2 + explanation: > + TinyML is specifically designed to operate on devices with limited computational resources. + + - questions: + question: > + 2. Which of the following is NOT a benefit of deploying TinyML on Arm devices? + answers: + - "Enhanced data privacy" + - "Low latency" + - High power consumption + - Cost-effectiveness + correct_answer: 3 + explanation: > + High power consumption is not a benefit, one of the key advantages of TinyML on Arm devices is their ability to perform tasks with very low power usage. + + - questions: + question: > + 3. Which of the following is an example of TinyML in healthcare? + answers: + - Smart sensors for soil moisture monitoring. + - Wearable devices monitoring vital signs and detecting heart arrhythmias. + - Predictive maintenance for factory machines. + - Object detection for smart home cameras. + correct_answer: 2 + explanation: > + Wearable devices that monitor vital signs and detect heart arrhythmias show TinyML's ability to perform complex analyses in real-time on resource-constrained device. + + + +# ================================================================================ +# FIXED, DO NOT MODIFY +# ================================================================================ +title: "Review" # Always the same title +weight: 20 # Set to always be larger than the content in this path +layout: "learningpathall" # All files under learning paths have this same wrapper +--- diff --git a/content/learning-paths/microcontrollers/introduction-to-tinyml-on-arm/benefits-3.md b/content/learning-paths/microcontrollers/introduction-to-tinyml-on-arm/benefits-3.md new file mode 100644 index 0000000000..066a090030 --- /dev/null +++ b/content/learning-paths/microcontrollers/introduction-to-tinyml-on-arm/benefits-3.md @@ -0,0 +1,58 @@ +--- +title: Benefits and application of TinyML for Edge Computing +weight: 3 + +### FIXED, DO NOT MODIFY +layout: learningpathall +--- + +## Benefits and applications + +The advantages of TinyML match up well with the Arm architecture, which is widely used in IoT, mobile devices, and edge AI deployments. + +Here are some key benefits of TinyML on Arm: + +- Power Efficiency: TinyML models are designed to be extremely power-efficient, making them ideal for battery-operated devices like sensors, wearables, and drones. + +- Low Latency: Because the AI processing happens on-device, there's no need to send data to the cloud, reducing latency and enabling real-time decision-making. + +- Data Privacy: With on-device computation, sensitive data remains local, providing enhanced privacy and security. This is particularly crucial in healthcare and personal devices. + +- Cost-Effective: Arm devices, which are cost-effective and scalable, can now handle sophisticated machine learning tasks, reducing the need for expensive hardware or cloud services. + +- Scalability: With billions of Arm devices in the market, TinyML is well-suited for scaling across industries, enabling widespread adoption of AI at the edge. + +TinyML is being deployed across multiple industries, enhancing everyday experiences and enabling groundbreaking solutions. + +Here are a few examples of TinyML applications: + +### Healthcare - Wearable Heart Rate Monitors + +- Arm-based microcontrollers like those in Fitbit devices run TinyML models to monitor vital signs such as heart rate, detect arrhythmias, and provide real-time feedback. + +- **Example**: Fitbit Charge 5 smart band uses the Arm 32-bit Cortex-M4 processor. + +### Agriculture - Smart Irrigation Systems + +- Arm-powered microcontrollers in smart sensors help monitor soil moisture and control water usage. TinyML models process environmental data locally to optimize water distribution. + +- **Example**: OpenAg uses Arm Cortex-M processors to run machine learning models on edge devices, optimizing irrigation based on real-time data. + +### Home Automation - Smart Cameras + +- Arm-based processors in smart cameras can detect objects and people, triggering alerts or actions without needing to send data to the cloud, saving bandwidth and improving privacy. + +- **Example**: Arlo smart cameras, powered by Arm Cortex processors, perform object detection at the edge, enhancing performance and energy efficiency. + +### Industrial IoT - Predictive Maintenance in Factories + +- Arm-powered industrial sensors analyze vibration patterns in machinery, running TinyML models to predict when maintenance is needed and prevent breakdowns. + +- **Example**: Siemens utilizes Arm Cortex-A processors in industrial sensors for real-time data analysis, detecting faults before they cause significant downtime. They rely on Arm-based processors for their Industrial Edge computing solutions. + +### Wildlife Conservation - Smart Camera Traps + +- Arm-based smart camera traps can identify animal movements or detect poachers using TinyML models. These energy-efficient devices can operate in remote areas without relying on external power sources. + +- **Example**: Conservation X Labs uses Arm Cortex-M microcontrollers to power camera traps, helping monitor endangered species in the wild. + diff --git a/content/learning-paths/microcontrollers/introduction-to-tinyml-on-arm/build-model-8.md b/content/learning-paths/microcontrollers/introduction-to-tinyml-on-arm/build-model-8.md new file mode 100644 index 0000000000..80080ef9e8 --- /dev/null +++ b/content/learning-paths/microcontrollers/introduction-to-tinyml-on-arm/build-model-8.md @@ -0,0 +1,113 @@ +--- +# User change +title: "Build a Simple PyTorch Model" + +weight: 7 # 1 is first, 2 is second, etc. + +# Do not modify these elements +layout: "learningpathall" +--- + +With our Environment ready, you can create a simple program to test the setup. + +This example defines a small feedforward neural network for a classification task. The model consists of 2 linear layers with ReLU activation in between. + +Use a text editor to create a file named `simple_nn.py` with the following code: + +```python +import torch +from torch.export import export +from executorch.exir import to_edge + +# Define a simple Feedforward Neural Network +class SimpleNN(torch.nn.Module): + def __init__(self, input_size, hidden_size, output_size): + super(SimpleNN, self).__init__() + self.fc1 = torch.nn.Linear(input_size, hidden_size) + self.relu = torch.nn.ReLU() + self.fc2 = torch.nn.Linear(hidden_size, output_size) + + def forward(self, x): + out = self.fc1(x) + out = self.relu(out) + out = self.fc2(out) + return out + +# Create the model instance +input_size = 10 # example input features size +hidden_size = 5 # hidden layer size +output_size = 2 # number of output classes + +model = SimpleNN(input_size, hidden_size, output_size) + +# Example input tensor (batch size 1, input size 10) +x = torch.randn(1, input_size) + +# torch.export: Defines the program with the ATen operator set for SimpleNN. +aten_dialect = export(model, (x,)) + +# to_edge: Make optimizations for edge devices. This ensures the model runs efficiently on constrained hardware. +edge_program = to_edge(aten_dialect) + +# to_executorch: Convert the graph to an ExecuTorch program +executorch_program = edge_program.to_executorch() + +# Save the compiled .pte program +with open("simple_nn.pte", "wb") as file: + file.write(executorch_program.buffer) + +print("Model successfully exported to simple_nn.pte") +``` + +Run the model from the Linux command line: + +```console +python3 simple_nn.py +``` + +The output is: + +```output +Model successfully exported to simple_nn.pte +``` + +The model is saved as a .pte file, which is the format used by ExecuTorch for deploying models to the edge. + +Run the ExecuTorch version, first build the executable: + +```console +# Clean and configure the build system +(rm -rf cmake-out && mkdir cmake-out && cd cmake-out && cmake ..) + +# Build the executor_runner target +cmake --build cmake-out --target executor_runner -j$(nproc) +``` + +You see the build output and it ends with: + +```output +[100%] Linking CXX executable executor_runner +[100%] Built target executor_runner +``` + +When the build is complete, run the executor_runner with the model as an argument: + +```console +./cmake-out/executor_runner --model_path simple_nn.pte +``` + +Since the model is a simple feedforward model, you see a tensor of shape [1, 2] + +```output +I 00:00:00.006598 executorch:executor_runner.cpp:73] Model file simple_nn.pte is loaded. +I 00:00:00.006628 executorch:executor_runner.cpp:82] Using method forward +I 00:00:00.006635 executorch:executor_runner.cpp:129] Setting up planned buffer 0, size 320. +I 00:00:00.007225 executorch:executor_runner.cpp:152] Method loaded. +I 00:00:00.007237 executorch:executor_runner.cpp:162] Inputs prepared. +I 00:00:00.012885 executorch:executor_runner.cpp:171] Model executed successfully. +I 00:00:00.012896 executorch:executor_runner.cpp:175] 1 outputs: +Output 0: tensor(sizes=[1, 2], [-0.105369, -0.178723]) +``` + +When the model execution completes successfully, you’ll see confirmation messages similar to those above, indicating successful loading, inference, and output tensor shapes. + diff --git a/content/learning-paths/microcontrollers/introduction-to-tinyml-on-arm/env-setup-5.md b/content/learning-paths/microcontrollers/introduction-to-tinyml-on-arm/env-setup-5.md new file mode 100644 index 0000000000..bf130cd3da --- /dev/null +++ b/content/learning-paths/microcontrollers/introduction-to-tinyml-on-arm/env-setup-5.md @@ -0,0 +1,128 @@ +--- +# User change +title: "Environment Setup on Host Machine" + +weight: 4 # 1 is first, 2 is second, etc. + +# Do not modify these elements +layout: "learningpathall" +--- +## Before you begin + +You will use a Linux computer to run PyTorch and ExecuTorch to prepare a TinyML model to run on edge devices. + +The instructions are for Ubuntu 22.04 or newer. + +You also need the [Grove Vision AI Module](https://wiki.seeedstudio.com/Grove-Vision-AI-Module/). If you don't have the board you can use the Corstone-300 Fixed Virtual Platform (FVP) instead. + +{{% notice Note %}} +Note that the Corstone-300 FVP is not available for the Arm architecture so your host machine needs to x86_64. +{{% /notice %}} + +The instructions have been tested on: +- Arm-based cloud instances running Ubuntu 22.04. +- Desktop computer with Ubuntu 24.04. +- Windows Subsystem for Linux (WSL). + +The host machine is where you will perform most of your development work, especially compiling code for the target Arm devices. + +## Install Python + +Python 3 is included in Ubuntu, but some additional packages are needed. + +```console +sudo apt update +sudo apt install python-is-python3 gcc g++ make -y +``` + +## Install PyTorch + +Create a Python virtual environment using Miniconda. + +For Arm Linux: + +```console +curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-aarch64.sh +sh ./Miniconda3-latest-Linux-aarch64.sh -b +eval "$($HOME/miniconda3/bin/conda shell.bash hook)" +conda --version +``` + +For x86_64 Linux: + +```console +curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh +sh ./Miniconda3-latest-Linux-x86_64.sh -b +eval "$($HOME/miniconda3/bin/conda shell.bash hook)" +conda --version +``` + +Activate the Python virtual environment: + +```bash +conda create -yn executorch python=3.10.0 +conda activate executorch +``` + +The prompt of your terminal now has (executorch) as a prefix to indicate the virtual environment is active. + + +## Install Executorch + +From within the Python virtual environment, run the commands below to download the ExecuTorch repository and install the required packages: + +``` bash +# Clone the ExecuTorch repo from GitHub +git clone --branch v0.3.0 https://github.com/pytorch/executorch.git +cd executorch + +# Update and pull submodules +git submodule sync +git submodule update --init + +# Install ExecuTorch pip package and its dependencies, as well as +# development tools like CMake. +./install_requirements.sh +``` + +## Install Edge Impulse CLI + +1. Create an [Edge Impulse Account](https://studio.edgeimpulse.com/signup) and sign in. + +2. Install the Edge Impulse CLI tools in your terminal + +The Edge Impulse CLI tools require Node.js. + +```console +sudo apt install nodejs npm -y +``` + +Confirm `node` is available by running: + +```console +node -v +``` + +Your version is printed, for example: + +```output +v18.19.1 +``` + +Install the Edge Impulse CLI using NPM: + +```console +npm install -g edge-impulse-cli +``` + +3. Install Screen to use with edge devices + +```console +sudo apt install screen -y +``` + +## Next Steps + +If you don't have the Grove AI vision board and want to use the Corstone-300 FVP proceed to [Environment Setup Corstone-300 FVP](/learning-paths/microcontrollers/introduction-to-tinyml-on-arm/env-setup-6-fvp/) + +If you have the Grove board proceed o to [Setup on Grove - Vision AI Module V2](/learning-paths/microcontrollers/introduction-to-tinyml-on-arm/setup-7-grove/) \ No newline at end of file diff --git a/content/learning-paths/microcontrollers/introduction-to-tinyml-on-arm/env-setup-6-FVP.md b/content/learning-paths/microcontrollers/introduction-to-tinyml-on-arm/env-setup-6-FVP.md new file mode 100644 index 0000000000..278320fc74 --- /dev/null +++ b/content/learning-paths/microcontrollers/introduction-to-tinyml-on-arm/env-setup-6-FVP.md @@ -0,0 +1,17 @@ +--- +# User change +title: "Set up the Corstone-300 FVP" + +weight: 5 # 1 is first, 2 is second, etc. + +# Do not modify these elements +layout: "learningpathall" +--- + +### Corstone-300 FVP Setup for ExecuTorch + +To install and set up the Corstone-300 FVP on your machine, refer to [Building and Running ExecuTorch with ARM Ethos-U Backend](https://pytorch.org/executorch/stable/executorch-arm-delegate-tutorial.html). Follow this tutorial till the **"Install the TOSA reference model"** Section. It should be the last thing you do from this tutorial. + + +## Next Steps +1. Go to [Build a Simple PyTorch Model](/learning-paths/microcontrollers/introduction-to-tinyml-on-arm/build-model-8/) to test your environment setup. diff --git a/content/learning-paths/microcontrollers/introduction-to-tinyml-on-arm/setup-7-Grove.md b/content/learning-paths/microcontrollers/introduction-to-tinyml-on-arm/setup-7-Grove.md new file mode 100644 index 0000000000..73890438c3 --- /dev/null +++ b/content/learning-paths/microcontrollers/introduction-to-tinyml-on-arm/setup-7-Grove.md @@ -0,0 +1,57 @@ +--- +# User change +title: "Set up the Grove Vision AI Module V2" + +weight: 6 # 1 is first, 2 is second, etc. + +# Do not modify these elements +layout: "learningpathall" +--- +## Before you begin +Only follow this part of the tutorial if you have the board. Due to its constrained environment, we'll focus on lightweight, optimized tools and models (which will be introduced in the next learning path). + + +### Compilers + +The examples can be built with [Arm Compiler for Embedded](https://developer.arm.com/Tools%20and%20Software/Arm%20Compiler%20for%20Embedded) or [Arm GNU Toolchain](https://developer.arm.com/Tools%20and%20Software/GNU%20Toolchain). + + +Use the install guides to install the compilers on your **host machine**: +- [Arm Compiler for Embedded](/install-guides/armclang/) +- [Arm GNU Toolchain](/install-guides/gcc/arm-gnu) + + +## Board Setup + +![Hardware Overview #center](Overview.png) + +Hardware overview : [Image credits](https://wiki.seeedstudio.com/grove_vision_ai_v2/). + +1. Download and extract the latest Edge Impulse firmware +Grove Vision V2 [Edge impulse Firmware](https://cdn.edgeimpulse.com/firmware/seeed-grove-vision-ai-module-v2.zip). + + +2. Connect the Grove - Vision AI Module V2 to your computer using the USB-C cable. + +![Board connection](Connect.png) + + +3. In the extracted Edge Impulse firmware, locate and run the installation scripts to flash your device. + +```console +./flash_linux.sh +``` + +4. Configure Edge Impulse for the board +in your terminal, run: + +```console +edge-impulse-daemon +``` +Follow the prompts to log in. + +5. If successful, you should see your Grove - Vision AI Module V2 under 'Devices' in Edge Impulse. + + +## Next Steps +1. Go to [Build a Simple PyTorch Model](/learning-paths/microcontrollers/introduction-to-tinyml-on-arm/build-model-8/) to test your environment setup. diff --git a/content/learning-paths/microcontrollers/introduction-to-tinyml-on-arm/troubleshooting-6.md b/content/learning-paths/microcontrollers/introduction-to-tinyml-on-arm/troubleshooting-6.md new file mode 100644 index 0000000000..1b8bd9d4d7 --- /dev/null +++ b/content/learning-paths/microcontrollers/introduction-to-tinyml-on-arm/troubleshooting-6.md @@ -0,0 +1,18 @@ +--- +title: Troubleshooting and Best Practices +weight: 8 + +### FIXED, DO NOT MODIFY +layout: learningpathall +--- +## Troubleshooting +- If you encounter permission issues, try running the commands with sudo. +- Ensure your Grove - Vision AI Module V2 is properly connected and recognized by your computer. +- If Edge Impulse CLI fails to detect your device, try unplugging, hold the **Boot button** and replug the USB cable. Release the button once you replug. + +## Best Practices +- Always cross-compile your code on the host machine to ensure compatibility with the target Arm device. +- Utilize model quantization techniques to optimize performance on constrained devices like the Grove - Vision AI Module V2. +- Regularly update your development environment and tools to benefit from the latest improvements in TinyML and edge AI technologies + +You've now set up your environment for TinyML development, and tested a PyTorch and ExecuTorch Neural Network. \ No newline at end of file diff --git a/content/learning-paths/servers-and-cloud-computing/_index.md b/content/learning-paths/servers-and-cloud-computing/_index.md index 46c16d3af0..66334d9eed 100644 --- a/content/learning-paths/servers-and-cloud-computing/_index.md +++ b/content/learning-paths/servers-and-cloud-computing/_index.md @@ -9,9 +9,9 @@ maintopic: true operatingsystems_filter: - Android: 2 - Baremetal: 1 -- Linux: 100 -- macOS: 6 -- Windows: 9 +- Linux: 105 +- macOS: 9 +- Windows: 12 pinned_modules: - module: name: Recommended getting started learning paths @@ -20,19 +20,20 @@ pinned_modules: - migration subjects_filter: - CI-CD: 3 -- Containers and Virtualization: 24 +- Containers and Virtualization: 25 - Databases: 15 - Libraries: 6 -- ML: 10 -- Performance and Architecture: 35 +- ML: 13 +- Performance and Architecture: 36 - Storage: 1 - Web: 10 subtitle: Optimize cloud native apps on Arm for performance and cost title: Servers and Cloud Computing tools_software_languages_filter: +- .NET: 1 - .NET SDK: 1 - 5G: 1 -- Android Studio: 1 +- Android Studio: 2 - Ansible: 2 - Arm Development Studio: 4 - armclang: 1 @@ -40,6 +41,7 @@ tools_software_languages_filter: - ArmRAL: 1 - ASP.NET Core: 2 - Assembly: 4 +- assembly: 1 - AWS CodeBuild: 1 - AWS EC2: 1 - AWS Elastic Container Service (ECS): 1 @@ -52,16 +54,16 @@ tools_software_languages_filter: - C++: 3 - C/C++: 2 - Capstone: 1 -- CCA: 2 +- CCA: 3 - Clair: 1 - Clang: 9 - ClickBench: 1 - ClickHouse: 1 - CloudFormation: 1 - CMake: 1 -- Coding: 17 +- Coding: 19 - Django: 1 -- Docker: 14 +- Docker: 15 - Envoy: 2 - Flink: 1 - Fortran: 1 @@ -69,7 +71,7 @@ tools_software_languages_filter: - GCC: 17 - gdb: 1 - Geekbench: 1 -- GenAI: 3 +- GenAI: 4 - GitHub: 2 - GitLab: 1 - Glibc: 1 @@ -84,11 +86,12 @@ tools_software_languages_filter: - JAX: 1 - Kafka: 1 - Keras: 1 -- Kubernetes: 8 +- Kubernetes: 9 - Lambda: 1 - libbpf: 1 - Linaro Forge: 1 - LLM: 2 +- llvm-mca: 1 - LSE: 1 - MariaDB: 1 - Memcached: 2 @@ -103,11 +106,12 @@ tools_software_languages_filter: - PAPI: 1 - perf: 3 - PostgreSQL: 4 -- Python: 9 +- Python: 10 - PyTorch: 4 +- RAG: 1 - Redis: 3 - Remote.It: 2 -- RME: 2 +- RME: 3 - Rust: 1 - snappy: 1 - Snort: 1 @@ -133,6 +137,6 @@ weight: 1 cloud_service_providers_filter: - AWS: 13 - Google Cloud: 8 -- Microsoft Azure: 7 +- Microsoft Azure: 8 - Oracle: 2 --- diff --git a/content/learning-paths/servers-and-cloud-computing/glibc-with-lse/build_glibc_with_lse.md b/content/learning-paths/servers-and-cloud-computing/glibc-with-lse/build_glibc_with_lse.md index 5e2b530499..ebce45ccdc 100644 --- a/content/learning-paths/servers-and-cloud-computing/glibc-with-lse/build_glibc_with_lse.md +++ b/content/learning-paths/servers-and-cloud-computing/glibc-with-lse/build_glibc_with_lse.md @@ -16,6 +16,17 @@ LSE introduces additional atomic instructions and operations, such as Load-Acqui When glibc is compiled with LSE support, it can take advantage of these enhanced atomic operations provided by the LSE extension. This can potentially improve the performance of multi-threaded applications that heavily rely on atomic operations and synchronization primitives. +{{% notice Note %}} +Your version of the GNU C Library may already have support for LSE. Before you build a new version check if LSE is already included by running: + +```console +objdump -d /lib/aarch64-linux-gnu/libc.so.6 | grep -i 'cas\|casp\|swp\|ldadd\|stadd\|ldclr\|stclr\|ldeor\|steor\|ldset\|stset\|ldsmax\|stsmax\|ldsmin\|stsmin\|ldumax\|stumin' | wc -l +``` + +If a non-zero number is printed your GNU C Library already has LSE. + +{{% /notice %}} + ## Before you begin Launch an [Arm based instance](/learning-paths/servers-and-cloud-computing/csp/) running Ubuntu version 20.04. diff --git a/content/learning-paths/servers-and-cloud-computing/milvus-rag/_index.md b/content/learning-paths/servers-and-cloud-computing/milvus-rag/_index.md new file mode 100644 index 0000000000..0bef6ba40f --- /dev/null +++ b/content/learning-paths/servers-and-cloud-computing/milvus-rag/_index.md @@ -0,0 +1,41 @@ +--- +title: Build a Retrieval-Augmented Generation (RAG) application using Zilliz Cloud on Arm servers + +draft: true +cascade: + draft: true + +minutes_to_complete: 20 + +who_is_this_for: This is an introductory topic for software developers who want to create a RAG application on Arm servers. + +learning_objectives: + - Create a simple RAG application using Zilliz Cloud + - Launch a LLM service on Arm servers + +prerequisites: + - Basic understanding of a RAG pipeline. + - An AWS Graviton3 c7g.2xlarge instance, or any [Arm based instance](/learning-paths/servers-and-cloud-computing/csp) from a cloud service provider or an on-premise Arm server. + - A [Zilliz account](https://zilliz.com/cloud), which you can sign up for with a free trial. + +author_primary: Chen Zhang + +### Tags +skilllevels: Introductory +subjects: ML +armips: + - Cortex-A +tools_software_languages: + - Python + - GenAI + - RAG +operatingsystems: + - Linux + + +### FIXED, DO NOT MODIFY +# ================================================================================ +weight: 1 # _index.md always has weight of 1 to order correctly +layout: "learningpathall" # All files under learning paths have this same wrapper +learning_path_main_page: "yes" # This should be surfaced when looking for related content. Only set for _index.md of learning path content. +--- diff --git a/content/learning-paths/servers-and-cloud-computing/milvus-rag/_next-steps.md b/content/learning-paths/servers-and-cloud-computing/milvus-rag/_next-steps.md new file mode 100644 index 0000000000..a4dd214ed6 --- /dev/null +++ b/content/learning-paths/servers-and-cloud-computing/milvus-rag/_next-steps.md @@ -0,0 +1,27 @@ +--- +next_step_guidance: Thank you for completing the RAG with Zilliz Cloud Learning Path. You might be interested in learning how to run the Llama 3.1 8B model with KleidiAI optimizations on Arm servers. + +recommended_path: /learning-paths/servers-and-cloud-computing/llama-cpu/ + +further_reading: + - resource: + title: Zilliz Documentation + link: https://zilliz.com/cloud + type: documentation + - resource: + title: Milvus Documentation + link: https://milvus.io/ + type: documentation + - resource: + title: llama.cpp repository + link: https://github.com/ggerganov/llama.cpp + type: website + + +# ================================================================================ +# FIXED, DO NOT MODIFY +# ================================================================================ +weight: 21 # set to always be larger than the content in this path, and one more than 'review' +title: "Next Steps" # Always the same +layout: "learningpathall" # All files under learning paths have this same wrapper +--- diff --git a/content/learning-paths/servers-and-cloud-computing/milvus-rag/_review.md b/content/learning-paths/servers-and-cloud-computing/milvus-rag/_review.md new file mode 100644 index 0000000000..7722e4c24c --- /dev/null +++ b/content/learning-paths/servers-and-cloud-computing/milvus-rag/_review.md @@ -0,0 +1,41 @@ +--- +review: + - questions: + question: > + Can Milvus run on Arm? + answers: + - "Yes" + - "No" + correct_answer: 1 + explanation: > + Milvus can run on Arm-based systems. Milvus supports deployment on Arm-based machines, whether it's through Zilliz Cloud, Docker, or Kubernetes. + + - questions: + question: > + Can Llama3.1 model run on Arm? + answers: + - "Yes" + - "No" + correct_answer: 1 + explanation: > + The Llama-3.1-8B model from Meta can be used on Arm-based servers with llama.cpp. + + - questions: + question: > + Which of the following is true about about Zilliz Cloud? + answers: + - "It is a fully-managed version of Milvus vector database" + - "It is a self-hosted version of Milvus vector database" + correct_answer: 1 + explanation: > + Zilliz Cloud is a fully-managed version of Milvus. + + + +# ================================================================================ +# FIXED, DO NOT MODIFY +# ================================================================================ +title: "Review" # Always the same title +weight: 20 # Set to always be larger than the content in this path +layout: "learningpathall" # All files under learning paths have this same wrapper +--- diff --git a/content/learning-paths/servers-and-cloud-computing/milvus-rag/create_cluster.png b/content/learning-paths/servers-and-cloud-computing/milvus-rag/create_cluster.png new file mode 100644 index 0000000000..8d1f207bcb Binary files /dev/null and b/content/learning-paths/servers-and-cloud-computing/milvus-rag/create_cluster.png differ diff --git a/content/learning-paths/servers-and-cloud-computing/milvus-rag/launch_llm_service.md b/content/learning-paths/servers-and-cloud-computing/milvus-rag/launch_llm_service.md new file mode 100644 index 0000000000..583d1fba35 --- /dev/null +++ b/content/learning-paths/servers-and-cloud-computing/milvus-rag/launch_llm_service.md @@ -0,0 +1,101 @@ +--- +title: Launch LLM Server +weight: 4 + +### FIXED, DO NOT MODIFY +layout: learningpathall +--- + +In this section, you will build and run the `llama.cpp` server program using an OpenAI-compatible API on your running AWS Arm-based server instance. + +### Llama 3.1 model & llama.cpp + +The [Llama-3.1-8B model](https://huggingface.co/cognitivecomputations/dolphin-2.9.4-llama3.1-8b-gguf) from Meta belongs to the Llama 3.1 model family and is free to use for research and commercial purposes. Before you use the model, visit the Llama [website](https://llama.meta.com/llama-downloads/) and fill in the form to request access. + +[llama.cpp](https://github.com/ggerganov/llama.cpp) is an open source C/C++ project that enables efficient LLM inference on a variety of hardware - both locally, and in the cloud. You can conveniently host a Llama 3.1 model using `llama.cpp`. + + +### Download and build llama.cpp + +Run the following commands to install make, cmake, gcc, g++, and other essential tools required for building llama.cpp from source: + +```bash +sudo apt install make cmake -y +sudo apt install gcc g++ -y +sudo apt install build-essential -y +``` + +You are now ready to start building `llama.cpp`. + +Clone the source repository for llama.cpp: + +```bash +git clone https://github.com/ggerganov/llama.cpp +``` + +By default, `llama.cpp` builds for CPU only on Linux and Windows. You don't need to provide any extra switches to build it for the Arm CPU that you run it on. + +Run `make` to build it: + +```bash +cd llama.cpp +make GGML_NO_LLAMAFILE=1 -j$(nproc) +``` + +Check that `llama.cpp` has built correctly by running the help command: + +```bash +./llama-cli -h +``` + +If `llama.cpp` has been built correctly, you will see the help option displayed. The output snippet looks like this: + +```output +example usage: + + text generation: ./llama-cli -m your_model.gguf -p "I believe the meaning of life is" -n 128 + + chat (conversation): ./llama-cli -m your_model.gguf -p "You are a helpful assistant" -cnv +``` + + +You can now download the model using the huggingface cli: + +```bash +huggingface-cli download cognitivecomputations/dolphin-2.9.4-llama3.1-8b-gguf dolphin-2.9.4-llama3.1-8b-Q4_0.gguf --local-dir . --local-dir-use-symlinks False +``` +The GGUF model format, introduced by the llama.cpp team, uses compression and quantization to reduce weight precision to 4-bit integers, significantly decreasing computational and memory demands and making Arm CPUs effective for LLM inference. + + +### Re-quantize the model weights + +To re-quantize the model, run: + +```bash +./llama-quantize --allow-requantize dolphin-2.9.4-llama3.1-8b-Q4_0.gguf dolphin-2.9.4-llama3.1-8b-Q4_0_8_8.gguf Q4_0_8_8 +``` + +This will output a new file, `dolphin-2.9.4-llama3.1-8b-Q4_0_8_8.gguf`, which contains reconfigured weights that allow `llama-cli` to use SVE 256 and MATMUL_INT8 support. + +This requantization is optimal specifically for Graviton3. For Graviton2, the optimal requantization should be performed in the `Q4_0_4_4` format, and for Graviton4, the `Q4_0_4_8` format is the most suitable for requantization. + +### Start the LLM Server +You can utilize the `llama.cpp` server program and send requests via an OpenAI-compatible API. This allows you to develop applications that interact with the LLM multiple times without having to repeatedly start and stop it. Additionally, you can access the server from another machine where the LLM is hosted over the network. + +Start the server from the command line, and it listens on port 8080: + +```bash +./llama-server -m dolphin-2.9.4-llama3.1-8b-Q4_0_8_8.gguf -n 2048 -t 64 -c 65536 --port 8080 +``` + +The output from this command should look like: + +```output +'main: server is listening on 127.0.0.1:8080 - starting the main loop +``` + +You can also adjust the parameters of the launched LLM to adapt it to your server hardware to obtain ideal performance. For more parameter information, see the `llama-server --help` command. + +You have started the LLM service on your AWS Graviton instance with an Arm-based CPU. In the next section, you will directly interact with the service using the OpenAI SDK. + + diff --git a/content/learning-paths/servers-and-cloud-computing/milvus-rag/offline_data_loading.md b/content/learning-paths/servers-and-cloud-computing/milvus-rag/offline_data_loading.md new file mode 100644 index 0000000000..d69bd1ffad --- /dev/null +++ b/content/learning-paths/servers-and-cloud-computing/milvus-rag/offline_data_loading.md @@ -0,0 +1,128 @@ +--- +title: Offline Data Loading +weight: 3 + +### FIXED, DO NOT MODIFY +layout: learningpathall +--- + +In this section, you will learn how to setup a cluster on Zilliz Cloud. You will then learn how to load your private knowledge database into the cluster. + +### Create a dedicated cluster + +You will need to [register](https://docs.zilliz.com/docs/register-with-zilliz-cloud) for a free account on Zilliz Cloud. + +After you register, [create a cluster](https://docs.zilliz.com/docs/create-cluster) on Zilliz Cloud. In this Learning Path, you will create a dedicated cluster deployed in AWS using Arm-based machines to store and retreive the vector data as shown: + +![cluster](create_cluster.png) + +When you select the `Create Cluster` Button, you should see the cluster running in your Default Project. + +![running](running_cluster.png) + +{{% notice Note %}} +You can use self-hosted Milvus as an alternative to Zilliz Cloud. This option is more complicated to set up. We can also deploy [Milvus Standalone](https://milvus.io/docs/install_standalone-docker-compose.md) and [Kubernetes](https://milvus.io/docs/install_cluster-milvusoperator.md) on Arm-based machines. For more information about Milvus installation, please refer to the [installation documentation](https://milvus.io/docs/install-overview.md). +{{% /notice %}} + +### Create the Collection + +With the dedicated cluster running in Zilliz Cloud, you are now ready to create a collection in your cluster. + +Within your activated python `venv`, start by creating a file named `zilliz-llm-rag.py` and copy the contents below into it: + +```python +from pymilvus import MilvusClient + +milvus_client = MilvusClient( + uri="", token="" +) + +``` +Replace and with the `URI` and `Token` for your running cluster. Refer to [Public Endpoint and Api key](https://docs.zilliz.com/docs/on-zilliz-cloud-console#free-cluster-details) in Zilliz Cloud for more details. + +Now, append the following code to `zilliz-llm-rag.py` and save the contents: + +```python +collection_name = "my_rag_collection" +embedding_dim = "384" + +if milvus_client.has_collection(collection_name): + milvus_client.drop_collection(collection_name) + +milvus_client.create_collection( + collection_name=collection_name, + dimension=embedding_dim, + metric_type="IP", # Inner product distance + consistency_level="Strong", # Strong consistency level +) +``` +This code checks if a collection already exists and drops it if it does. You then, create a new collection with the specified parameters. + +If you don't specify any field information, Milvus will automatically create a default `id` field for primary key, and a `vector` field to store the vector data. A reserved JSON field is used to store non-schema-defined fields and their values. +You will use inner product distance as the default metric type. For more information about distance types, you can refer to [Similarity Metrics page](https://milvus.io/docs/metric.md?tab=floating) + +You can now prepare the data to use in this collection. + +### Prepare the data + +In this example, you will use the FAQ pages from the [Milvus Documentation 2.4.x](https://github.com/milvus-io/milvus-docs/releases/download/v2.4.6-preview/milvus_docs_2.4.x_en.zip) as the private knowledge that is loaded in your RAG dataset/collection. + +Download the zip file and extract documents to the folder `milvus_docs`. + +```shell +wget https://github.com/milvus-io/milvus-docs/releases/download/v2.4.6-preview/milvus_docs_2.4.x_en.zip +unzip -q milvus_docs_2.4.x_en.zip -d milvus_docs +``` + +You will load all the markdown files from the folder `milvus_docs/en/faq` into your data collection. For each document, use "# " to separate the content in the file, which can roughly separate the content of each main part of the markdown file. + +Open `zilliz-llm-rag.py` and append the following code to it: + +```python +from glob import glob + +text_lines = [] + +for file_path in glob("milvus_docs/en/faq/*.md", recursive=True): + with open(file_path, "r") as file: + file_text = file.read() + + text_lines += file_text.split("# ") +``` + +### Insert data +You will now prepare a simple but efficient embedding model [all-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2) that can convert the loaded text into embedding vectors. + +You will iterate through the text lines, create embeddings, and then insert the data into Milvus. + +Append and save the code shown below into `zilliz-llm-rag.py`: + +```python +from langchain_huggingface import HuggingFaceEmbeddings + +embedding_model = HuggingFaceEmbeddings(model_name="all-MiniLM-L6-v2") + +from tqdm import tqdm + +data = [] + +text_embeddings = embedding_model.embed_documents(text_lines) + +for i, (line, embedding) in enumerate( + tqdm(zip(text_lines, text_embeddings), desc="Creating embeddings") +): + data.append({"id": i, "vector": embedding, "text": line}) + +milvus_client.insert(collection_name=collection_name, data=data) +``` +Run the python script, to check that you have successfully created the embeddings on the data you loaded into the RAG collection: + +```bash +python3 python3 zilliz-llm-rag.py +``` + +The output should look like: +``` +Creating embeddings: 72it [00:00, 700672.59it/s] +``` + diff --git a/content/learning-paths/servers-and-cloud-computing/milvus-rag/online_rag.md b/content/learning-paths/servers-and-cloud-computing/milvus-rag/online_rag.md new file mode 100644 index 0000000000..ced3778b20 --- /dev/null +++ b/content/learning-paths/servers-and-cloud-computing/milvus-rag/online_rag.md @@ -0,0 +1,130 @@ +--- +title: Online RAG +weight: 5 + +### FIXED, DO NOT MODIFY +layout: learningpathall +--- + +In this section, you will build the online RAG part of your application. + +### Prepare the embedding model + +In your python script, generate a test embedding and print its dimension and first few elements. + +For the LLM, you will use the OpenAI SDK to request the Llama service launched before. You don't need to use any API key because it is running locally on your machine. + +Append the code below to `zilliz-llm-rag.py`: + +```python +test_embedding = embedding_model.embed_query("This is a test") +embedding_dim = len(test_embedding) +print(embedding_dim) +print(test_embedding[:10]) +``` +Run the script. The output should look like: + +```output +384 +[0.03061249852180481, 0.013831384479999542, -0.02084377221763134, 0.016327863559126854, -0.010231520049273968, -0.0479842908680439, -0.017313342541456223, 0.03728749603033066, 0.04588735103607178, 0.034405000507831573] +``` + +### Retrieve data for a query + +You will specify a frequent question about Milvus and then search for the question in the collection and retrieve the semantic top-3 matches. + +Append the code shown below to `zilliz-llm-rag.py`: + +```python +question = "How is data stored in milvus?" + +search_res = milvus_client.search( + collection_name=collection_name, + data=[ + embedding_model.embed_query(question) + ], # Use the `emb_text` function to convert the question to an embedding vector + limit=3, # Return top 3 results + search_params={"metric_type": "IP", "params": {}}, # Inner product distance + output_fields=["text"], # Return the text field +) + +import json + +retrieved_lines_with_distances = [ + (res["entity"]["text"], res["distance"]) for res in search_res[0] +] +print(json.dumps(retrieved_lines_with_distances, indent=4)) +``` +Run the script again and the output with the top 3 matches will look like: + +```output +[ + [ + " Where does Milvus store data?\n\nMilvus deals with two types of data, inserted data and metadata. \n\nInserted data, including vector data, scalar data, and collection-specific schema, are stored in persistent storage as incremental log. Milvus supports multiple object storage backends, including [MinIO](https://min.io/), [AWS S3](https://aws.amazon.com/s3/?nc1=h_ls), [Google Cloud Storage](https://cloud.google.com/storage?hl=en#object-storage-for-companies-of-all-sizes) (GCS), [Azure Blob Storage](https://azure.microsoft.com/en-us/products/storage/blobs), [Alibaba Cloud OSS](https://www.alibabacloud.com/product/object-storage-service), and [Tencent Cloud Object Storage](https://www.tencentcloud.com/products/cos) (COS).\n\nMetadata are generated within Milvus. Each Milvus module has its own metadata that are stored in etcd.\n\n###", + 0.6488019824028015 + ], + [ + "How does Milvus flush data?\n\nMilvus returns success when inserted data are loaded to the message queue. However, the data are not yet flushed to the disk. Then Milvus' data node writes the data in the message queue to persistent storage as incremental logs. If `flush()` is called, the data node is forced to write all data in the message queue to persistent storage immediately.\n\n###", + 0.5974207520484924 + ], + [ + "What is the maximum dataset size Milvus can handle?\n\n \nTheoretically, the maximum dataset size Milvus can handle is determined by the hardware it is run on, specifically system memory and storage:\n\n- Milvus loads all specified collections and partitions into memory before running queries. Therefore, memory size determines the maximum amount of data Milvus can query.\n- When new entities and and collection-related schema (currently only MinIO is supported for data persistence) are added to Milvus, system storage determines the maximum allowable size of inserted data.\n\n###", + 0.5833579301834106 + ] +] +``` +### Use LLM to get a RAG response + +You are now ready to use the LLM and obtain a RAG response. + +For the LLM, you will use the OpenAI SDK to request the Llama service you launched in the previous section. You don't need to use any API key because it is running locally on your machine. + +You will then convert the retrieved documents into a string format. Define system and user prompts for the Language Model. This prompt is assembled with the retrieved documents from Milvus. Finally use the LLM to generate a response based on the prompts. + +Append the code below into `zilliz-llm-rag.py`: + +```python +from openai import OpenAI + +llm_client = OpenAI(base_url="http://localhost:8080/v1", api_key="no-key") + +context = "\n".join( + [line_with_distance[0] for line_with_distance in retrieved_lines_with_distances] +) + +SYSTEM_PROMPT = """ +Human: You are an AI assistant. You are able to find answers to the questions from the contextual passage snippets provided. +""" +USER_PROMPT = f""" +Use the following pieces of information enclosed in tags to provide an answer to the question enclosed in tags. + +{context} + + +{question} + +""" + +response = llm_client.chat.completions.create( + model="not-used", + messages=[ + {"role": "system", "content": SYSTEM_PROMPT}, + {"role": "user", "content": USER_PROMPT}, + ], +) +print(response.choices[0].message.content) + +``` + +{{% notice Note %}} +Make sure your llama.cpp server from the previous section is running before you proceed +{{% /notice %}} + +Run the script one final time with these changes using `python3 zilliz-llm-rag.py`. The output should look like: + +```output +Milvus stores data in two types: inserted data and metadata. Inserted data, including vector data, scalar data, and collection-specific schema, are stored in persistent storage as incremental log. Milvus supports multiple object storage backends such as MinIO, AWS S3, Google Cloud Storage (GCS), Azure Blob Storage, Alibaba Cloud OSS, and Tencent Cloud Object Storage (COS). Metadata are generated within Milvus and each Milvus module has its own metadata that are stored in etcd. +``` +Congratulations! You have successfully built a RAG application using a LLM and Zilliz Cloud all on your Arm-based infrastructure. + + diff --git a/content/learning-paths/servers-and-cloud-computing/milvus-rag/prerequisite.md b/content/learning-paths/servers-and-cloud-computing/milvus-rag/prerequisite.md new file mode 100644 index 0000000000..9d336b341d --- /dev/null +++ b/content/learning-paths/servers-and-cloud-computing/milvus-rag/prerequisite.md @@ -0,0 +1,38 @@ +--- +title: Install dependencies +weight: 2 + +### FIXED, DO NOT MODIFY +layout: learningpathall +--- + +## Overview + +In this Learning Path, you will learn how to build a Retrieval-Augmented Generation (RAG) application on Arm-based servers. RAG applications often use vector databases to efficiently store and retrieve high-dimensional vector representations of text data. Vector databases are optimized for similarity search and can handle large volumes of vector data, making them ideal for the retrieval component of RAG systems. In this example, you will utilize [Zilliz Cloud](https://zilliz.com/cloud), the fully-managed Milvus vector database as your vector storage. Zilliz Cloud is available on major cloud such as AWS, GCP and Azure. In this demo you will use Zilliz Cloud deployed on AWS with Arm based servers. For the LLM, you will use the `Llama-3.1-8B` model running on an AWS Arm-based server using `llama.cpp`. + + +## Install dependencies +This Learning Path has been tested on an AWS Graviton3 `c7g.2xlarge` instance running Ubuntu 22.04 LTS system. +You need at least four cores and 8GB of RAM to run this example. Configure disk storage up to at least 32 GB. + +After you launch the instance, connect to it and run the following commands to prepare the environment. + +Install python: + +```bash +sudo apt update +sudo apt install python-is-python3 python3-pip python3-venv -y +``` + +Create and activate a virtual environment: + +```bash +python -m venv venv +source venv/bin/activate +``` + +Install the required python dependencies: + +```shell +pip install --upgrade pymilvus openai requests langchain-huggingface huggingface_hub tqdm +``` diff --git a/content/learning-paths/servers-and-cloud-computing/milvus-rag/running_cluster.png b/content/learning-paths/servers-and-cloud-computing/milvus-rag/running_cluster.png new file mode 100644 index 0000000000..6153ee6c62 Binary files /dev/null and b/content/learning-paths/servers-and-cloud-computing/milvus-rag/running_cluster.png differ diff --git a/content/learning-paths/servers-and-cloud-computing/refinfra-quick-start/build-2.md b/content/learning-paths/servers-and-cloud-computing/refinfra-quick-start/build-2.md index 39385bf5bf..e3917bd5e3 100644 --- a/content/learning-paths/servers-and-cloud-computing/refinfra-quick-start/build-2.md +++ b/content/learning-paths/servers-and-cloud-computing/refinfra-quick-start/build-2.md @@ -12,7 +12,7 @@ Test that the firmware implementation builds and boots on a FVP. The firmware st Launch the container: ```bash -./container-scrits/container.sh -v /home/ubuntu/rd-infra/ run +./container-scripts/container.sh -v /home/ubuntu/rd-infra/ run ``` Perform a build inside the container: diff --git a/content/learning-paths/servers-and-cloud-computing/supervisord/_next-steps.md b/content/learning-paths/servers-and-cloud-computing/supervisord/_next-steps.md index 207e369b87..dc5a575c34 100644 --- a/content/learning-paths/servers-and-cloud-computing/supervisord/_next-steps.md +++ b/content/learning-paths/servers-and-cloud-computing/supervisord/_next-steps.md @@ -4,10 +4,10 @@ # ================================================================================ next_step_guidance: > - You may also be interested in Kubernetes on Arm. + You may also be interested in Sysbox to run multiple services in a container. # 1-3 sentence recommendation outlining how the reader can generally keep learning about these topics, and a specific explanation of why the next step is being recommended. -recommended_path: "/learning-paths/servers-and-cloud-computing/eks-multi-arch/" +recommended_path: "/install-guides/sysbox/" # Link to the next learning path being recommended. diff --git a/content/learning-paths/servers-and-cloud-computing/supervisord/example.md b/content/learning-paths/servers-and-cloud-computing/supervisord/example.md index e1b0408b4b..5c2c20f574 100644 --- a/content/learning-paths/servers-and-cloud-computing/supervisord/example.md +++ b/content/learning-paths/servers-and-cloud-computing/supervisord/example.md @@ -19,7 +19,7 @@ Here are the changes: Use a text editor to replace your `Dockerfile` with the new file below: ```console -FROM ubuntu:22.04 +FROM ubuntu:24.04 RUN apt-get update && apt-get install -y curl iproute2 sudo openssh-server sudo vim apache2 supervisor procps uuid-runtime diff --git a/content/learning-paths/servers-and-cloud-computing/supervisord/intro.md b/content/learning-paths/servers-and-cloud-computing/supervisord/intro.md index b788ebfdeb..cd77dd7c38 100644 --- a/content/learning-paths/servers-and-cloud-computing/supervisord/intro.md +++ b/content/learning-paths/servers-and-cloud-computing/supervisord/intro.md @@ -38,12 +38,12 @@ You will also use Remote.It for container access. For more background informatio ## An example project -You can use an Apache web server running on Ubuntu 22.04 as an example application. It serves a simple `index.html` file which is visible in a browser. +You can use an Apache web server running on Ubuntu 24.04 as an example application. It serves a simple `index.html` file which is visible in a browser. To begin, use a text editor to copy the code below into a file named `Dockerfile`: ```console -FROM ubuntu:22.04 +FROM ubuntu:24.04 RUN apt-get update RUN apt-get install -y apache2 diff --git a/content/learning-paths/smartphones-and-mobile/_index.md b/content/learning-paths/smartphones-and-mobile/_index.md index 87d106c7c2..7432cb5a98 100644 --- a/content/learning-paths/smartphones-and-mobile/_index.md +++ b/content/learning-paths/smartphones-and-mobile/_index.md @@ -11,14 +11,14 @@ key_ip: maintopic: true operatingsystems_filter: - Android: 21 -- Linux: 16 -- macOS: 6 -- Windows: 5 +- Linux: 19 +- macOS: 9 +- Windows: 8 subjects_filter: - Gaming: 6 - Graphics: 3 -- ML: 5 -- Performance and Architecture: 22 +- ML: 7 +- Performance and Architecture: 23 subtitle: Optimize Android apps and build faster games using cutting-edge Arm tech title: Smartphones and Mobile tools_software_languages_filter: @@ -27,17 +27,19 @@ tools_software_languages_filter: - Android: 2 - Android NDK: 1 - Android SDK: 1 -- Android Studio: 6 +- Android Studio: 7 - Arm Development Studio: 1 - Arm Mobile Studio: 1 - Arm Performance Studio: 2 +- assembly: 1 - Bazel: 1 - C#: 3 - C++: 3 - C/C++: 1 +- CCA: 1 - Clang: 8 - CMake: 1 -- Coding: 15 +- Coding: 17 - Fixed Virtual Platform: 1 - Frame Advisor: 1 - GCC: 9 @@ -45,6 +47,7 @@ tools_software_languages_filter: - GoogleTest: 1 - Java: 3 - Kotlin: 2 +- llvm-mca: 1 - MediaPipe: 1 - Memory Bug Report: 1 - Memory Tagging Extension: 1 @@ -53,6 +56,7 @@ tools_software_languages_filter: - NEON: 1 - Python: 1 - QEMU: 1 +- RME: 1 - Rust: 1 - SDDiskTool: 1 - SVE2: 1