Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ These dockerfiles will also be pushed and actively maintained in their original
| VLA | [`OpenVLA`](packages/vla/openvla), [`SmolVLA`](packages/vla/smolvla), [`GR00T-N1.5`](packages/vla/gr00t), [`openpi`](packages/vla/openpi), [`CogACT`](packages/vla/cogact) |
| Graphics | [`O3DE`](packages/graphics/o3de) |
| Robotics | [`ROS 2`](packages/ros/ros), [`Gazebo`](packages/ros/gazebo), [`LeRobot`](packages/robotics/lerobot), [`ACT`](packages/robotics/act), [`RAI`](packages/robotics/rai) |
| Federated Learning | [`Flower`](packages/federated/flower) |
| Simulation | [`Genesis`](packages/robotics/genesis) |
| Vision | [`OpenCV`](packages/vision/opencv), [`SAM`](packages/vision/sam), [`MobileSAM`](packages/vision/mobilesam), [`ncnn`](packages/vision/ncnn), [`DINOv3`](packages/vision/dinov3), [`SAM3`](packages/vision/sam3), [`Ultralytics`](packages/vision/ultralytics) |
| Ryzen AI NPU | [`XDNA`](packages/npu/xdna), [`IRON`](packages/npu/iron), [`NPUEval`](packages/npu/npueval), [`Ryzen AI CVML`](packages/npu/ryzenai_cvml) |
Expand Down
17 changes: 17 additions & 0 deletions packages/federated/flower/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright(C) 2025 Advanced Micro Devices, Inc. All rights reserved.
# SPDX-License-Identifier: MIT

ARG BASE_IMAGE
FROM ${BASE_IMAGE}

WORKDIR /ryzers

RUN pip install -U "flwr[simulation]"

RUN flwr new @flwrlabs/quickstart-pytorch
RUN cd quickstart-pytorch && sed -i '/torch=/d;/torchvision=/d' pyproject.toml && pip install -e .


COPY test.sh .
RUN chmod +x test.sh
CMD ./test.sh
46 changes: 46 additions & 0 deletions packages/federated/flower/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Flower
Flower is a framework for federated learning. This Ryzer demonstrates how to use Flower on AMD GPUs. This example is based on the Flower example found [here](https://flower.ai/docs/framework/docker/tutorial-quickstart-docker.html).

## Install Flower
Execute `pip install flower` to install Flower.

In `Ryzers/packages/federated/superexec/` create a getting started project:
```
flwr new @flwrlabs/quickstart-pytorch
```

Edit the `pyproject.toml` to comment out the dependencies on torch and torchvision (lines 13-14), as these packages are installed in the Ryzer already.

## Build the containers
Unlike other Ryzers, Flower requires several containers to be built. From the Ryzers directory, run;

```
ryzers build superexec --name superexec
ryzers build superlink --name superlink
ryzers build supernode --name supernode
```

## Create the network
Flower communicates between the containers using the docker network. Create a dedicated docker network for it to use:
```
docker network create --driver bridge flwr-network
```

## Run the example
Run `Ryzers/packages/federated/superexec/flower.sh`. This will launch a superlink to coordinate the federation, supernodes (clients), and superexecs for scheduling applications per client.

Find your local config file:
`flwr config list`

Edit the config file to tell it about your superlink:
```
[superlink.local-deployment]
address = "127.0.0.1:9093"
insecure = true
```

Launch the quickstart application with 2 clients:

`flwr run . local-deployment --stream`

The example will use the GPU between 2 clients.
2 changes: 2 additions & 0 deletions packages/federated/flower/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Copyright(C) 2025 Advanced Micro Devices, Inc. All rights reserved.
# SPDX-License-Identifier: MIT
17 changes: 17 additions & 0 deletions packages/federated/flower/superexec/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright(C) 2025 Advanced Micro Devices, Inc. All rights reserved.
# SPDX-License-Identifier: MIT

ARG BASE_IMAGE
FROM ${BASE_IMAGE}

ENV HSA_OVERRIDE_GFX_VERSION=11.0.0

WORKDIR /ryzers

RUN python -m pip install flwr

COPY quickstart-pytorch/pyproject.toml .
RUN sed -i 's/.*flwr\[simulation\].*//' pyproject.toml \
&& python -m pip install -U --no-cache-dir .

ENTRYPOINT ["flower-superexec"]
13 changes: 13 additions & 0 deletions packages/federated/flower/superexec/flower.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

docker run --rm -p 9091:9091 -p 9092:9092 -p 9093:9093 --shm-size 16G --cap-add=SYS_PTRACE --network=flwr-network --ipc=host --device=/dev/kfd --device=/dev/dri --security-opt seccomp=unconfined --group-add video --group-add render -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --device /dev/video0 --device /dev/video1 --name superlink --detach superlink --insecure --isolation process

docker run --rm -p 9095:9095 --name supernode-2 --detach --shm-size 16G --cap-add=SYS_PTRACE --network=flwr-network --ipc=host --device=/dev/kfd --device=/dev/dri --security-opt seccomp=unconfined --group-add video --group-add render -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --device /dev/video0 --device /dev/video1 supernode --insecure --superlink superlink:9092 --node-config "partition-id=0 num-partitions=2" --clientappio-api-address 0.0.0.0:9095 --isolation process

docker run --rm -p 9094:9094 --name supernode-1 --detach --shm-size 16G --cap-add=SYS_PTRACE --network=flwr-network --ipc=host --device=/dev/kfd --device=/dev/dri --security-opt seccomp=unconfined --group-add video --group-add render -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --device /dev/video0 --device /dev/video1 supernode --insecure --superlink superlink:9092 --node-config "partition-id=0 num-partitions=2" --clientappio-api-address 0.0.0.0:9094 --isolation process

docker run --rm --name superexec-serverapp --detach --shm-size 16G --cap-add=SYS_PTRACE --network=flwr-network --ipc=host --device=/dev/kfd --device=/dev/dri --security-opt seccomp=unconfined --group-add video --group-add render -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --device /dev/video0 --device /dev/video1 superexec --insecure --plugin-type serverapp --appio-api-address superlink:9091

docker run --rm --name superexec-clientapp-1 --shm-size 16G --cap-add=SYS_PTRACE --network=flwr-network --ipc=host --device=/dev/kfd --device=/dev/dri --security-opt seccomp=unconfined --group-add video --group-add render -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --device /dev/video0 --device /dev/video1 --detach superexec --insecure --plugin-type clientapp --appio-api-address supernode-1:9094

docker run --rm --name superexec-clientapp-2 --shm-size 16G --cap-add=SYS_PTRACE --network=flwr-network --ipc=host --device=/dev/kfd --device=/dev/dri --security-opt seccomp=unconfined --group-add video --group-add render -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --device /dev/video0 --device /dev/video1 --detach superexec --insecure --plugin-type clientapp --appio-api-address supernode-2:9095
15 changes: 15 additions & 0 deletions packages/federated/flower/superlink/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright(C) 2025 Advanced Micro Devices, Inc. All rights reserved.
# SPDX-License-Identifier: MIT

ARG BASE_IMAGE
FROM ${BASE_IMAGE}

WORKDIR /ryzers


ENV HSA_OVERRIDE_GFX_VERSION=11.0.0


RUN python -m pip install flwr

ENTRYPOINT ["flower-superlink"]
13 changes: 13 additions & 0 deletions packages/federated/flower/supernode/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright(C) 2025 Advanced Micro Devices, Inc. All rights reserved.
# SPDX-License-Identifier: MIT

ARG BASE_IMAGE
FROM ${BASE_IMAGE}

WORKDIR /ryzers

ENV HSA_OVERRIDE_GFX_VERSION=11.0.0

RUN python -m pip install flwr

ENTRYPOINT ["flower-supernode"]
6 changes: 6 additions & 0 deletions packages/federated/flower/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

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

python -c "import flwr;print('flwr version:', flwr.__version__)"
6 changes: 3 additions & 3 deletions ryzers/packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ def _find_allpackages(self, current_path=None, current_depth=0, max_depth=4):
if self._is_directory_readable(entry_path):
if os.path.exists(os.path.join(entry_path, "Dockerfile")):
dockerfile_path_map[entry] = entry_path
else:
dockerfile_path_map.update(self._find_allpackages(entry_path, current_depth + 1, max_depth))
#else:
dockerfile_path_map.update(self._find_allpackages(entry_path, current_depth + 1, max_depth))
return dockerfile_path_map

def get_packages_filelist(self, filename, optional=False):
Expand Down Expand Up @@ -94,4 +94,4 @@ def get_initial_image(self):
def _is_directory_readable(self, path):
return (os.path.exists(path) and
os.path.isdir(path) and
os.access(path, os.R_OK))
os.access(path, os.R_OK))