Skip to content

Run Flower clients on a multi-node Ray cluster (FLTEST_RAY_ADDRESS) - #29

Merged
maligulzar merged 2 commits into
SEED-VT:mainfrom
chalianwar:multi-node-ray
Oct 29, 2026
Merged

maligulzar merged 2 commits into
SEED-VT:mainfrom
chalianwar:multi-node-ray

Conversation

@chalianwar

Copy link
Copy Markdown

What

Setting FLTEST_RAY_ADDRESS=<head-ip>:6379 makes the Flower backend join an existing Ray cluster instead of starting a private single-machine Ray, so a run's simulated clients spread over every node. With the variable unset, nothing changes.

Why two changes were needed

  • Joining the cluster. Ray refuses num_cpus/num_gpus when it connects to an existing cluster, so the backend passes only the address (ray_backend_config in fltest/frameworks/flower/adapter.py).
  • Data shards. Prepared shards were memory-mapped from the local Hugging Face cache, and a memory-mapped table pickles as a file path. Clients scheduled on other nodes failed with FileNotFoundError on a cache file that exists only on the driver, and the run stalled with every client actor idle. On a cluster the shards are now kept in memory (keep_in_memory in fltest/data/datasets.py, image and text paths), under a separate cache key, so cluster and single-machine runs never share cached shards.

Tests and docs

  • tests/test_multinode_ray.py: 5 tests for both decisions. They need no network and no cluster. The full suite gives 123 passed and 1 skipped; the skip is the NVFlare contract test, which needs the optional extra.
  • docs/multi-node.md: how to start a Ray cluster and point FLTest at it, and when it pays off. Also adds a mkdocs nav entry, a README pointer and a CHANGELOG entry under Unreleased.

Verified on SPHERE

On an 8-node, 128-vCPU Ray cluster on the SPHERE testbed, examples/configs/defense_robust.yaml reproduces the single-machine result: accuracy 0.8965 and ASR 0.0270, against 0.8945 and 0.0346 on one machine. A 120-client non-IID CIFAR-10 run (baseline, backdoor, median, trimmed mean) is in progress on the same cluster.

🤖 Generated with Claude Code

Ali Anwar and others added 2 commits October 28, 2026 15:25
Setting FLTEST_RAY_ADDRESS makes the Flower backend join an existing Ray cluster instead
of starting a private single-machine Ray, so the simulated clients spread over every node.
Without the variable nothing changes.

Two things had to change. Ray refuses num_cpus/num_gpus when it connects to an existing
cluster, so the backend passes only the address. And prepared shards were memory-mapped
from the local Hugging Face cache; a memory-mapped table pickles as a file path, so clients
scheduled on other nodes failed with FileNotFoundError and the run stalled with every
client actor idle. On a cluster the shards are now kept in memory (separate cache key).

Adds tests/test_multinode_ray.py and docs/multi-node.md. Verified on an 8-node,
128-vCPU Ray cluster on SPHERE: defense_robust.yaml reproduces the single-machine result
(accuracy 0.8965, ASR 0.0270 vs 0.8945, 0.0346).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Flower pickles the client app with every message to a client, and the
app held every client's loader. On a cluster the shards travel by value,
so each message carried the whole federation's data: about 800 MB with
120 CIFAR-10 clients, which filled the head node's disk while spilling
Ray objects. Each client's loader now goes into the object store once,
and the client app holds only the references.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chalianwar

Copy link
Copy Markdown
Author

There is bug in memory fix. Please dont merge yet.

@chalianwar

Copy link
Copy Markdown
Author

Update (c15cfb9): a third change was needed at scale. Flower pickles the client app with every message, and the app held every client’s loader, so on a cluster each message carried the whole federation’s data (~800 MB with 120 CIFAR-10 clients), which filled the head node’s disk. Each client’s loader now goes into the Ray object store once and the app holds only references. Verified on the same 8-node SPHERE cluster; 120-client results to follow.

@maligulzar
maligulzar merged commit 4d59dc3 into SEED-VT:main Oct 29, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants