Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
5ff72aa
Depend on Ubuntu 24.04.2
mariodruiz Mar 12, 2025
3b2d8d7
Set to executable
mariodruiz Mar 12, 2025
d1e1f16
Get kernel headers
mariodruiz Mar 12, 2025
f315d65
Move where headers are installed
mariodruiz Mar 12, 2025
6b644b2
Add -y
mariodruiz Mar 12, 2025
b408242
Update package name
mariodruiz Mar 12, 2025
01ff18c
Remove install code
mariodruiz Mar 12, 2025
d13a8bc
Update install package
mariodruiz Mar 12, 2025
2f818e3
Update code not to install kernel
mariodruiz Mar 12, 2025
6784763
Add tarball name
mariodruiz Mar 12, 2025
93ef621
Fix ENV
mariodruiz Mar 12, 2025
0eb3739
Bring NPU firmware back
mariodruiz Mar 12, 2025
abd8c48
Copy more files
mariodruiz Mar 12, 2025
19e1527
Add more packages
mariodruiz Mar 12, 2025
3f866aa
Trying to fix installation
mariodruiz Mar 12, 2025
1cef0ae
Trying to install xrt on image
mariodruiz Mar 12, 2025
3e1e844
Trying to install base
mariodruiz Mar 12, 2025
e6c3af2
Other way of installing
mariodruiz Mar 12, 2025
61dff55
Install driver
mariodruiz Mar 12, 2025
704e540
More updates
mariodruiz Mar 12, 2025
36f692a
Update instructions
mariodruiz Mar 12, 2025
d61e18c
Try something different
mariodruiz Mar 12, 2025
cce4e10
Update path
mariodruiz Mar 12, 2025
c7e3b25
Upgrade distribution
mariodruiz Mar 12, 2025
caa11d0
Update install
mariodruiz Mar 12, 2025
c414c5a
Build just npu
mariodruiz Mar 12, 2025
cff0e98
Fix installer
mariodruiz Mar 12, 2025
ee63082
Temporary remove
mariodruiz Mar 12, 2025
9e3ec1e
Align with MLIR
mariodruiz Mar 12, 2025
b8c80c5
Remove base
mariodruiz Mar 12, 2025
62f89c7
Bring agreement back
mariodruiz Mar 12, 2025
0a4176f
Remove unused lines
mariodruiz Mar 12, 2025
7ad02b0
Check that secure boot is disabled
mariodruiz Mar 28, 2025
6f42eb5
Align with MLIR-AIE commit
mariodruiz Apr 7, 2025
bd8b23a
Fix remove part
mariodruiz Apr 7, 2025
6dfad47
Revert commit
mariodruiz Apr 7, 2025
441764a
Move to latest xdna-driver
mariodruiz Apr 7, 2025
62a3946
Add ulimit to overcome memory issue
mariodruiz Apr 7, 2025
75c557e
Update commit
mariodruiz Apr 9, 2025
809d92a
Fix extra space
mariodruiz Apr 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions scripts/linux/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (C) 2023-2025 Advanced Micro Devices, Inc. All rights reserved.
# SPDX-License-Identifier: MIT

FROM ubuntu:24.04

ARG BUILD_TEMPDIR
ARG LIC_MAC=00:00:00:00:00:00
ENV LIC_MAC=${LIC_MAC}
ENV LIC_MAC ${LIC_MAC}

ARG USER_ID
ARG GROUP_ID
Expand All @@ -14,7 +14,8 @@ ARG GROUP_NAME
SHELL ["/bin/bash", "-c"]

RUN apt-get update
RUN apt-get install -y sudo adduser perl
RUN apt-get install -y --install-recommends linux-generic-hwe-24.04
RUN apt-get install -y sudo adduser perl ocl-icd-libopencl1

RUN deluser --remove-home $(getent passwd | awk -F: -v uid="$USER_ID" '$3 == uid {print $1}') || echo "Ignoring error, as uid:${USER_ID} does not exist"
RUN groupadd -g ${GROUP_ID} ${GROUP_NAME} || echo "Ignoring error, as ${GROUP_NAME} already exists"
Expand All @@ -39,7 +40,7 @@ ENV LC_ALL en_US.UTF-8
RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC sudo -E apt-get install -y tzdata

RUN git clone https://github.com/amd/xdna-driver.git --recursive
RUN cd xdna-driver/ && git checkout f60608b
RUN cd xdna-driver/ && git checkout 176d6ec7a5b65767d02a4bae477962456ac8c3f4
RUN cd xdna-driver/ && git submodule update --recursive
RUN sudo chmod +x /home/riallto/xdna-driver/xrt/src/runtime_src/tools/scripts/xrtdeps.sh
RUN sudo /home/riallto/xdna-driver/xrt/src/runtime_src/tools/scripts/xrtdeps.sh -docker
Expand All @@ -49,7 +50,8 @@ COPY $BUILD_TEMPDIR/root/debs npu_ubuntu_debs
RUN sudo apt-get install -y dkms udev python3
RUN sudo apt-get install -y python3-pip ocl-icd-opencl-dev uuid-dev libopencv-dev python3-opencv

RUN sudo -E dpkg -i npu_ubuntu_debs/xrt_*-amd64-xrt.deb
RUN sudo -E dpkg -i npu_ubuntu_debs/xrt_*-amd64-base.deb
RUN sudo -E dpkg -i npu_ubuntu_debs/xrt_*-amd64-base-dev.deb
RUN sudo -E dpkg -i npu_ubuntu_debs/xrt_plugin*-amdxdna.deb

RUN git clone https://github.com/AMDResearch/Riallto --depth=1
Expand Down Expand Up @@ -91,7 +93,6 @@ RUN source ~/.bashrc && python3 -m pip install notebook

#Cleanup a bit
RUN rm -rf /home/riallto/*.tar.gz
ENV SHELL=/bin/bash
ENV SHELL /bin/bash

CMD ["/bin/bash", "-l", "-c", "jupyterhub-singleuser", "--allow-root"]

46 changes: 22 additions & 24 deletions scripts/linux/README.md
Original file line number Diff line number Diff line change
@@ -1,55 +1,51 @@
# Riallto Ubuntu 24.04 setup
# Riallto Ubuntu 24.04.2 setup

Currently there is support for bringing up Riallto on Ubuntu 24.04 with docker.
Currently there is support for bringing up Riallto on Ubuntu 24.04.2 with docker.
To use Riallto on Linux requires the use of the [xdna-driver](https://github.com/amd/xdna-driver) which is installed as part of the setup.
This driver requires version 6.10+ of the Linux kernel, these scripts will upgrade a standard Ubuntu 24.04 installation to this kernel version. __Using this kernel version will require disabling secure boot on your device.__
This driver requires version 6.10+ of the Linux kernel, we ask you to first upgrade to Ubuntu 24.04.2 from a Ubuntu 24.04 installation to install a 6.11 kernel. __Using this kernel version will require disabling secure boot on your device.__

## Install steps

On an NPU enabled laptop running Ubuntu 24.04.

1. __Setup Docker.__
1. **Upgrade to Ubuntu 24.04.2**

You can follow the steps [here](https://docs.docker.com/engine/install/ubuntu/).
```sh
sudo apt update
sudo apt install --install-recommends linux-generic-hwe-24.04
sudo reboot
```

2. **Setup Docker**

You can follow the steps [here](https://docs.docker.com/engine/install/ubuntu/).

2. __Add your user to the docker user group and then relogin.__
3. **Add your user to the docker user group and then relogin**

```sh
sudo usermod -aG docker $USER ; exit
```

3. __Obtain a license file for Riallto.__
4. **Obtain a license file for Riallto**

Please follow the [guide here](https://riallto.ai/prerequisites-aie-license.html#prerequisites-aie-license) to get the license.

4. __Disable secure boot from your BIOS settings.__
5. **Disable secure boot from your BIOS settings**

For now we are using an unsigned kernel version requiring that secure boot is disabled before it can be used. To disable secure boot there is a [guide](https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/disabling-secure-boot?view=windows-11) from Microsoft here, but often the steps depend on your hardware manufacturer.

5. __Clone the `Riallto` repository and then navigate to the installation script.__
6. **Clone the `Riallto` repository and then navigate to the installation script**

```sh
git clone https://github.com/AMDResearch/Riallto.git -b v1.1
git clone https://github.com/AMDResearch/Riallto.git -b v1.1.1
cd Riallto/scripts/linux/
```

```{note}
We recommend using the tag v1.1 to get the verified version of Riallto. Install from `main` to get the latest drivers and code, however, this is not thoroughly verified.
```

6. __Upgrade Linux Kernel.__

```sh
./setup_riallto_linux.sh <your license file> <username (optional)>
We recommend using the tag v1.1.1 to get the verified version of Riallto. Install from `main` to get the latest drivers and code, however, this is not thoroughly verified.
```

This command will check the kernel version and if the `xdna-driver` has been installed. If the Linux kernel is not `6.10` or the NPU device drivers are missing, it will build them within a docker and install them on the host machine. This takes about 10 minutes to run and after completing successfully the user will be asked to restart.

7. __Reboot the machine.__

This will finish upgrading the Linux kernel to `6.10`.

8. __Install Riallto by creating its Docker container.__
7. **Install Riallto by creating its Docker container**

```sh
./setup_riallto_linux.sh <your license file> <username (optional)>
Expand Down Expand Up @@ -110,6 +106,8 @@ This means that secure boot has not been disabled from the machine and it cannot

### If the Docker container does not start with `launch_jupyter.sh` or `run_pytest.sh` because of the `/dev/accel/accel0` does not exist

First of all, confirm that secure boot is disabled on the BIOS.

Check `dmesg`

```sh
Expand Down
3 changes: 2 additions & 1 deletion scripts/linux/create_container.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#!/bin/bash
#
# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (C) 2023-2025 Advanced Micro Devices, Inc. All rights reserved.
# SPDX-License-Identifier: MIT

docker run -dit --rm --name riallto_docker \
--cap-add=NET_ADMIN \
-v $(pwd):/workspace \
--device=/dev/accel/accel0:/dev/accel/accel0 \
--ulimit memlock=-1:-1 \
-w /workspace \
riallto:latest \
/bin/bash
Expand Down
3 changes: 2 additions & 1 deletion scripts/linux/launch_jupyter.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (C) 2023-2025 Advanced Micro Devices, Inc. All rights reserved.
# SPDX-License-Identifier: MIT

# Check input args
Expand All @@ -25,6 +25,7 @@ docker container wait riallto_jupyter > /dev/null 2>&1 || true
webcams=$(ls /dev/video*)
cmd="docker run -dit --rm --name riallto_jupyter"
cmd+=" --cap-add=NET_ADMIN --device=/dev/accel/accel0:/dev/accel/accel0"
cmd+=" --ulimit memlock=-1:-1 "
cmd+=" -p 8888:8888 "
cmd+=" -v $ABS_DIR:/notebooks "
for cam in $webcams; do
Expand Down
3 changes: 2 additions & 1 deletion scripts/linux/run_pytest.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (C) 2023-2025 Advanced Micro Devices, Inc. All rights reserved.
# SPDX-License-Identifier: MIT

docker container stop riallto_pytest || true
Expand All @@ -10,6 +10,7 @@ docker run -dit --rm --name riallto_pytest \
--cap-add=NET_ADMIN \
-v $(pwd):/workspace \
--device=/dev/accel/accel0:/dev/accel/accel0 \
--ulimit memlock=-1:-1 \
-w /workspace \
riallto:latest \
/bin/bash
Expand Down
81 changes: 20 additions & 61 deletions scripts/linux/setup_riallto_linux.sh
Original file line number Diff line number Diff line change
@@ -1,30 +1,19 @@
#!/bin/bash

# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (C) 2023-2025 Advanced Micro Devices, Inc. All rights reserved.
# SPDX-License-Identifier: MIT

set -e

KERNEL_VERSION="6.10-rc2"
KERNEL_VERSION_FULL="6.10.0-061000rc2"
BUILD_DATE="202406022333"

DRIVER_TARBALL=ubuntu24.04_npu_drivers.tar.gz
REQUIRED_KERNEL_VERSION="${KERNEL_VERSION_FULL}-generic"
NPU_FIRMWARE="/lib/firmware/amdnpu/1502_00/npu.sbin"
KERNEL_HEADERS="linux-headers-${KERNEL_VERSION_FULL}_${KERNEL_VERSION_FULL}.${BUILD_DATE}_all.deb"
KERNEL_HEADERS_GENERIC="linux-headers-${KERNEL_VERSION_FULL}-generic_${KERNEL_VERSION_FULL}.${BUILD_DATE}_amd64.deb"
KERNEL_MODULES="linux-modules-${KERNEL_VERSION_FULL}-generic_${KERNEL_VERSION_FULL}.${BUILD_DATE}_amd64.deb"
KERNEL_IMAGE="linux-image-unsigned-${KERNEL_VERSION_FULL}-generic_${KERNEL_VERSION_FULL}.${BUILD_DATE}_amd64.deb"

MLIR_FILE="https://www.xilinx.com/bin/public/openDownload?filename=pynqMLIR_AIE_py312_v0.9.tar.gz"
RIALLTO_FILE="https://www.xilinx.com/bin/public/openDownload?filename=Riallto-v1.1.zip"


############# CHECKS ##################################
# Check to ensure key URLs are accessible
URLS=(
"https://kernel.ubuntu.com/mainline/v$KERNEL_VERSION/amd64/"
$MLIR_FILE
$RIALLTO_FILE
"https://github.com/amd/xdna-driver.git"
Expand All @@ -50,10 +39,10 @@ for URL in "${URLS[@]}"; do
fi
done

# Check that we are on Ubuntu24.04
# Check that we are on Ubuntu24.04.2
distro_info=$(lsb_release -d)
if [[ $distro_info != *"Ubuntu 24.04"* ]]; then
echo "Riallto is only currently supported on Ubuntu 24.04"
if [[ $distro_info != *"Ubuntu 24.04.2"* ]]; then
echo "Riallto is only currently supported on Ubuntu 24.04.2"
exit 1
fi

Expand Down Expand Up @@ -93,47 +82,14 @@ echo "Found a License file associated with MAC address $MAC"
######### Kernel and NPU driver check / install ###########
# Check to see if the kernel version and NPU driver is already installed
build_xrt=0
kernel_version=$(uname -r)

if [[ "$kernel_version" == "$REQUIRED_KERNEL_VERSION" ]]; then
echo "Kernel version is okay, is NPU available?"
else
echo "To install Riallto requires upgrading your kernel to ${REQUIRED_KERNEL_VERSION}"
echo "WARNING: This can be quite disruptive to your system configuration."
echo "After upgrading you will have to restart your machine and rerun this script"
while true; do
read -p "Are you happy to continue? [Y/N] " answer
case $answer in
[Yy]* ) echo "You chose yes, attempting to update kernel"; break;;
[Nn]* ) echo "Exiting"; exit 1;;
* ) echo "Please chose Y or N.";;
esac
done

# First check to make sure that secure boot is disabled.
if mokutil --sb-state | grep -q "enabled"; then
echo "Secure boot is currently enabled."
echo "To install Riallto on Linux currently requires a"
echo "non-mainline kernel version ${REQUIRED_KERNEL_VERSION}."
echo "If you would like to continue with the installation "
echo "please disable secure boot in your bios settings and rerun this script."
exit 1
fi

_kbump_dir=$(mktemp -d)

wget -P ${_kbump_dir} https://kernel.ubuntu.com/mainline/v$KERNEL_VERSION/amd64/$KERNEL_HEADERS_GENERIC
wget -P ${_kbump_dir} https://kernel.ubuntu.com/mainline/v$KERNEL_VERSION/amd64/$KERNEL_HEADERS
wget -P ${_kbump_dir} https://kernel.ubuntu.com/mainline/v$KERNEL_VERSION/amd64/$KERNEL_IMAGE
wget -P ${_kbump_dir} https://kernel.ubuntu.com/mainline/v$KERNEL_VERSION/amd64/$KERNEL_MODULES

pushd $_kbump_dir/
sudo dpkg -i $KERNEL_HEADERS
sudo dpkg -i $KERNEL_HEADERS_GENERIC
sudo dpkg -i $KERNEL_MODULES
sudo dpkg -i $KERNEL_IMAGE
popd
echo -e "\033[31mPlease now restart your machine and rerun the script.\033[0m"
# First check to make sure that secure boot is disabled.
if mokutil --sb-state | grep -q "enabled"; then
echo "Secure boot is currently enabled."
echo "To install Riallto on Linux currently requires to compile the XDNA driver."
echo "If you would like to continue with the installation "
echo "please disable secure boot in your BIOS settings and rerun this script."
exit 1
fi

Expand All @@ -145,8 +101,7 @@ else
fi

if [ $build_xrt -eq 1 ]; then
# Building the NPU driver version and installing it

# Building the NPU driver
if [ ! -f "./xdna-driver-builder/${DRIVER_TARBALL}" ]; then
echo "xdna-driver-builder/${DRIVER_TARBALL} is missing, building it from scratch"
pushd xdna-driver-builder
Expand All @@ -158,14 +113,18 @@ if [ $build_xrt -eq 1 ]; then

fi

# Build the NPU drivers (xdna-driver)
# Install the NPU drivers in the host (xdna-driver)
if [ ! -f "${NPU_FIRMWARE}" ]; then
npu_install_tmp_dir=$(mktemp -d)
tar -xzvf "./xdna-driver-builder/${DRIVER_TARBALL}" -C "${npu_install_tmp_dir}"
pushd $npu_install_tmp_dir/root/debs
sudo -E dpkg -i xrt_*-amd64-xrt.deb || true
sudo -E dpkg -i xrt_plugin*-amdxdna.deb || true
packages=$(dpkg -l | awk '/^ii/ && $2 ~ /^xrt/ { print $2 }')
sudo apt remove -y $packages
sudo apt -y --fix-broken install
sudo apt install -y ocl-icd-libopencl1 dkms
sudo -E dpkg -i xrt_*-amd64-base.deb || true
sudo -E dpkg -i xrt_*-amd64-base-dev.deb || true
sudo -E dpkg -i xrt_plugin*-amdxdna.deb || true
popd
fi
#########################################################
Expand All @@ -187,14 +146,14 @@ GROUP_ID=`id -g $USER_NAME`
GROUP_NAME=`id -g -n $USER_NAME`

## Checks to make sure that all the required tarballs and license are in the directory
if [ ! -f "./pynqMLIR-AIE.tar.gz" ]; then
if [ ! -f "./build_tmp/pynqMLIR-AIE.tar.gz" ]; then
echo "Error! pynqMLIR-AIE.tar.gz is missing, downloading from opendownloads..."
wget -O $build_tmp/pynqMLIR-AIE.tar.gz $MLIR_FILE
else
cp pynqMLIR-AIE.tar.gz $build_tmp
fi

if [ ! -f "./xilinx_tools.tar.gz" ]; then
if [ ! -f "./build_tmp/xilinx_tools.tar.gz" ]; then
echo "xilinx_tools.tar.gz is missing, downloading it from opendownloads..."
wget -O $build_tmp/riallto_installer.zip $RIALLTO_FILE
pushd $build_tmp
Expand Down
Loading
Loading