There are some basic tools and packages you will need on your machine:
venv
moduleFor example, on Debian:
sudo apt install -y git gcc python3 python3-dev python3-venv
⚠️ The project maintainers internally test with Clang only, so support for GCC-based builds is provided only on a best-effort basis and may at times be broken.
If using GCC then we recommend using a recent version (e.g., at least as recent as what Debian stable uses, preferably newer than that).
If using Clang then please see Building with Clang for further Clang-specific instructions.
Bazelisk is used to fetch the correct Bazel binaries necessary to build and run Federated Compute code.
Please read https://github.com/bazelbuild/bazelisk#installation.
Setting up a virtual Python environment will ensure that Python dependencies don't conflict or overwrite your existing Python installation. If you have multiple installed versions of Python, replace python3
in the following instructions with the desired version (e.g., python3.X
).
python3 -m venv venv source venv/bin/activate pip install --upgrade pip
Note: To exit the virtual environment, run deactivate
.
git clone https://github.com/google/federated-compute.git cd federated-compute pip install -r requirements.txt
⚠️ Many Federated Compute targets depend on TensorFlow, which can take several hours to build for the first time. Consider running builds in
screen
ortmux
if you're worried about your terminal closing during this time.While not required, Bazel's remote build execution and remote caching features can speed up builds.
bazelisk test //fcp/demo:federated_program_test
Use --config=clang
to build with clang and libc++. On Debian, this requires installing several additional packages:
sudo apt install -y clang lld libc++-dev libc++abi-dev`