Skip to content
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

C++ Client SDK #363

Open
14 tasks
danieljanes opened this issue Jul 24, 2020 · 1 comment
Open
14 tasks

C++ Client SDK #363

danieljanes opened this issue Jul 24, 2020 · 1 comment
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@danieljanes
Copy link
Member

danieljanes commented Jul 24, 2020

Description

C++ is one of the most defining programming languages of our time. It is used in many critical applications and the go-to language for performance-sensitive applications, such as robotics or automotive. Federated Learning can enable entirely new platforms in these domains and we thus want to support C++ by providing a Flower C++ SDK. Flower communicates between the server and the client using gRPC. At the moment, every C++ user needs to build their own integration with the gRPC message protocol to run Flower.

Prep Work / PoC

The C++ SDK needs to serialize model parameters (and other values that get communicated between client and server) in a way that can be de-serialized by Python on the server-side. ProtoBuf makes this easy for most values, but it might be helpful to build a small proof of concept for serializing/deserializing the model parameters. Flower represents model parameters as a list of byte arrays (think: the parameters of each layer in a neural network can be serialized to a single byte array). A PoC would then serialized these parameters in C++ and deserialized them in Python (and vice versa):

  1. Define a simple machine learning model using C++/libtorch
  2. Extract the model parameters from the model in C++
  3. Serialize the extracted model parameters into a byte array / a list of byte arrays
  4. Save the list of byte arrays to disk
  5. Read the list of byte arrays from Python
  6. Deserialize the model parameters from the list of byte arrays
  7. Load a PyTorch model and update it using the deserialized model parameters
  8. Implement the flow in reverse (serialize in Python, deserialize in C++)

Expected Outcome

The full SDK implementation requires the following tasks:

  • Set up C++ tooling in the Flower codebase
    • Run tests on CI
  • Set up ProtoBuf/gRPC compilation for C++
  • Define the user-facing API of the C++ SDK
    • Define abstract class / interface which Flower users can override
    • Define a function to start the client
  • Implement the API
    • Establish a connection to the server
    • Implement handling of protocol messages
  • Test the new SDK
  • Document everything
  • Build a C++ library and publish it
  • Build a code example using the C++ SDK and libtorch (PyTorch C++ API)
  • Write Blog post about the available feature

Required Skills:

  • Strong experience with C++
  • Interest in gRPC
  • Basic understanding of machine learning
  • Optional: Basic libtorch (PyTorch C++ API https://pytorch.org/cppdocs/) understanding
@danieljanes danieljanes added enhancement New feature or request help wanted Extra attention is needed labels Jul 24, 2020
@sisco0
Copy link
Contributor

sisco0 commented Dec 29, 2021

Bumped as this is very relevant and could bring more developers to the project.
Related pull request for this issue is #816.

gRPC C++ Client

We could use our current proto files and https://grpc.github.io/grpc/cpp/classgrpc_1_1_client_reader_writer.html functions for client-server interaction in the proposed C++ client application.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants