-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat(framework:cc): Update C++ SDK for Flower 1.27.0 inflatable objects protocol #6913
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
uncleDecart
wants to merge
2
commits into
flwrlabs:main
Choose a base branch
from
uncleDecart:cpp-update
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| FROM ubuntu:22.04 | ||
|
|
||
| ARG DEBIAN_FRONTEND=noninteractive | ||
|
|
||
| # Install system dependencies | ||
| RUN apt-get update && apt-get install -y \ | ||
| build-essential \ | ||
| cmake \ | ||
| git \ | ||
| curl \ | ||
| wget \ | ||
| autoconf \ | ||
| libtool \ | ||
| pkg-config \ | ||
| python3 \ | ||
| python-is-python3 \ | ||
| python3-pip \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # Install Flower and Python dependencies for the server | ||
| RUN pip3 install --no-cache-dir \ | ||
| flwr \ | ||
| numpy \ | ||
| hatchling | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| # Copy proto definitions and C++ SDK source | ||
| COPY framework/proto /app/framework/proto | ||
| COPY framework/cc /app/framework/cc | ||
|
|
||
| # Copy the quickstart-cpp example | ||
| COPY examples/quickstart-cpp /app/examples/quickstart-cpp | ||
|
|
||
| # Build the C++ client (this fetches gRPC ~v1.43.2 and generates protos) | ||
| WORKDIR /app/examples/quickstart-cpp | ||
| RUN cmake -S . -B build -DUSE_LOCAL_FLWR=ON \ | ||
| -DCMAKE_BUILD_TYPE=Release \ | ||
| -DFETCHCONTENT_QUIET=OFF \ | ||
| && cmake --build build -j$(nproc) | ||
|
|
||
| WORKDIR /app/examples/quickstart-cpp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| """Placeholder ClientApp for C++ quickstart. | ||
|
|
||
| The actual clients are C++ SuperNodes that connect via gRPC. | ||
| This file satisfies the Flower app configuration requirement. | ||
| """ | ||
| import flwr as fl | ||
|
|
||
|
|
||
| def client_fn(context) -> fl.client.Client: | ||
| """Placeholder client factory for the C++ quickstart. | ||
|
|
||
| The actual clients for this example are implemented in C++ and connect to | ||
| the server via gRPC. This Python client placeholder exists only to satisfy | ||
| the Flower app configuration requirements and must not be started. | ||
| """ | ||
| raise RuntimeError( | ||
| "This Python ClientApp is a placeholder for the C++ quickstart. " | ||
| "Use the C++ SuperNode clients instead of starting this client." | ||
| ) | ||
|
|
||
|
|
||
| app = fl.client.ClientApp(client_fn=client_fn) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| services: | ||
| # Builds the C++ client binary and Python server dependencies | ||
| cpp-build: | ||
| build: | ||
| context: ../.. | ||
| dockerfile: examples/quickstart-cpp/Dockerfile | ||
| image: flower-quickstart-cpp | ||
|
|
||
| # Flower SuperLink (manages FL lifecycle, runs ServerApp as subprocess) | ||
| superlink: | ||
| image: flower-quickstart-cpp | ||
| depends_on: | ||
| cpp-build: | ||
| condition: service_completed_successfully | ||
| command: flower-superlink --insecure | ||
| ports: | ||
| - "9091:9091" | ||
| - "9092:9092" | ||
| - "9093:9093" | ||
| working_dir: /app/examples/quickstart-cpp | ||
| networks: | ||
| - flwr-network | ||
|
|
||
| # C++ SuperNode client 0 | ||
| client-0: | ||
| image: flower-quickstart-cpp | ||
| depends_on: | ||
| superlink: | ||
| condition: service_started | ||
| command: > | ||
| bash -c "sleep 4 && ./build/flower-supernode 0 superlink:9092" | ||
| working_dir: /app/examples/quickstart-cpp | ||
| networks: | ||
| - flwr-network | ||
|
|
||
| # C++ SuperNode client 1 | ||
| client-1: | ||
| image: flower-quickstart-cpp | ||
| depends_on: | ||
| superlink: | ||
| condition: service_started | ||
| command: > | ||
| bash -c "sleep 8 && ./build/flower-supernode 1 superlink:9092" | ||
| working_dir: /app/examples/quickstart-cpp | ||
| networks: | ||
| - flwr-network | ||
|
|
||
| # Submit the ServerApp run to the SuperLink | ||
| runner: | ||
| image: flower-quickstart-cpp | ||
| depends_on: | ||
| superlink: | ||
| condition: service_started | ||
| client-0: | ||
| condition: service_started | ||
| client-1: | ||
| condition: service_started | ||
| command: | ||
| - bash | ||
| - -c | ||
| - | | ||
| mkdir -p /root/.flwr | ||
| cat > /root/.flwr/config.toml << 'EOF' | ||
| [superlink.local-deployment] | ||
| address = "superlink:9093" | ||
| insecure = true | ||
| EOF | ||
| sleep 12 && flwr run . local-deployment | ||
| working_dir: /app/examples/quickstart-cpp | ||
| networks: | ||
| - flwr-network | ||
|
|
||
| networks: | ||
| flwr-network: | ||
| driver: bridge |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| [build-system] | ||
| requires = ["hatchling"] | ||
| build-backend = "hatchling.build" | ||
|
|
||
| [project] | ||
| name = "quickstart-cpp" | ||
| version = "1.0.0" | ||
| description = "Quickstart C++ with Flower" | ||
| license = "Apache-2.0" | ||
| requires-python = ">=3.9" | ||
| dependencies = [ | ||
| "flwr>=1.27.0", | ||
| "numpy>=1.26.0", | ||
| ] | ||
|
|
||
| [tool.hatch.build.targets.wheel] | ||
| packages = ["."] | ||
|
|
||
| [tool.flwr.app] | ||
| publisher = "flwrlabs" | ||
|
|
||
| [tool.flwr.app.components] | ||
| serverapp = "server:app" | ||
| clientapp = "client:app" | ||
|
|
||
| [tool.flwr.app.config] | ||
| num-server-rounds = 3 | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.