diff --git a/Dockerfile b/Dockerfile index 6eca5e18..2405ca3a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,6 +7,7 @@ MAINTAINER Bart Cox # Run build without interactive dialogue ARG DEBIAN_FRONTEND=noninteractive +# Set required environmental variables for the working setup. ENV GLOO_SOCKET_IFNAME=eth0 ENV TP_SOCKET_IFNAME=eth0 @@ -19,7 +20,9 @@ RUN apt-get update \ # Copy the current folder to the working directory ADD setup.py requirements.txt ./ -RUN python3 -m pip install -r requirements.txt + +# Use cache for pip, otherwise we repeatedly pull from repository +RUN --mount=type=cache,target=/root/.cache/pip python3 -m pip install -r requirements.txt ADD configs configs @@ -28,13 +31,5 @@ ADD fltk fltk # Install newest version of library RUN python3 -m setup install - - # Expose the container's port to the host OS EXPOSE 5000 - -# Run command by default for the executing container -# CMD ["python3", "/opt/Generatrix/rpc_parameter_server.py", "--world_size=2", "--rank=0", "--master_addr=192.168.144.2"] - -#CMD python3 /opt/federation-lab/rpc_parameter_server.py --world_size=$WORLD_SIZE --rank=$RANK --master_addr=10.5.0.11 -CMD python3 /opt/federation-lab/federated_learning.py $RANK $WORLD_SIZE 10.5.0.11 \ No newline at end of file diff --git a/README.md b/README.md index cf9a287a..9a429ee6 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,14 @@ Pytorch Distributed ([docs](https://pytorch.org/tutorials/beginner/dist_overview The goal if this project is to launch Federated Learning nodes in truly distribution fashion. This project is tested with Ubuntu 20.04 and python {3.7, 3.8}. + +### Building locally + +To build locally, run the following command in the project root directory. + +```bash +DOCKER_BUILDKIT=1 docker build . --tag fltk +``` ### Global idea Pytorch distributed works based on a world_size and ranks. The ranks should be between 0 and world_size-1. Generally, the federator has rank 0 and the clients have ranks between 1 and world_size-1.