1# Instructions for getting the Federated Compute Platform code up and running on your own machine. 2 3## Download and install build dependencies 4 5### Basic tools 6 7There are some basic tools and packages you will need on your machine: 8 9* Git 10* A C++ compiler (e.g., Clang or GCC, but see note about GCC below) 11* Python 3.9 or greater, including the `venv` module 12 13For example, on Debian: 14 15``` 16sudo apt install -y git gcc python3 python3-dev python3-venv 17``` 18 19> ⚠️ The project maintainers internally test with Clang only, so support for 20> GCC-based builds is provided only on a best-effort basis and may at times be 21> broken. 22> 23> If using GCC then we recommend using a recent version (e.g., at least as 24> recent as what Debian stable uses, preferably newer than that). 25> 26> If using Clang then please see [Building with Clang](#building-with-clang) for 27> further Clang-specific instructions. 28 29### Install Bazelisk 30 31Bazelisk is used to fetch the correct Bazel binaries necessary to build and run 32Federated Compute code. 33 34Please read https://github.com/bazelbuild/bazelisk#installation. 35 36## Set up your Python environment 37 38Setting up a virtual Python environment will ensure that Python dependencies 39don't conflict or overwrite your existing Python installation. If you have 40multiple installed versions of Python, replace `python3` in the following 41instructions with the desired version (e.g., `python3.X`). 42 43``` 44python3 -m venv venv 45source venv/bin/activate 46pip install --upgrade pip 47``` 48 49Note: To exit the virtual environment, run `deactivate`. 50 51## Clone the Federated Compute repository and install Python requirements 52 53``` 54git clone https://github.com/google/federated-compute.git 55cd federated-compute 56pip install -r requirements.txt 57``` 58 59## Build and run the federated program test! 60 61> ⚠️ Many Federated Compute targets depend on TensorFlow, which can take several 62> hours to build for the first time. Consider running builds in `screen` or 63> `tmux` if you're worried about your terminal closing during this time. 64> 65> While not required, Bazel's 66> [remote build execution](https://bazel.build/remote/rbe) and 67> [remote caching](https://bazel.build/remote/caching) features can speed up 68> builds. 69 70``` 71bazelisk test //fcp/demo:federated_program_test 72``` 73 74### Building with Clang 75 76Use `--config=clang` to build with clang and libc++. On Debian, this requires 77installing several additional packages: 78 79``` 80sudo apt install -y clang lld libc++-dev libc++abi-dev` 81``` 82