diff --git a/Dockerfile b/Dockerfile index 2405ca3a..df0a0ffb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,15 +19,15 @@ RUN apt-get update \ && apt-get install -y vim curl python3 python3-pip net-tools iproute2 # Copy the current folder to the working directory -ADD setup.py requirements.txt ./ +ADD setup.py default_models 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 -# Install all required packages for the generator ADD fltk fltk + # Install newest version of library RUN python3 -m setup install diff --git a/charts/Chart.yaml b/charts/Chart.yaml new file mode 100644 index 00000000..1384f9b5 --- /dev/null +++ b/charts/Chart.yaml @@ -0,0 +1,9 @@ +name: ../docker-compose-gcloud +description: A generated Helm Chart for ../docker-compose-gcloud from Skippbox Kompose +version: 0.0.1 +apiVersion: v1 +appVersion: 1.16.0 +keywords: + - ../docker-compose-gcloud +sources: +home: diff --git a/charts/README.md b/charts/README.md new file mode 100644 index 00000000..d3885b63 --- /dev/null +++ b/charts/README.md @@ -0,0 +1 @@ +This chart was created by Kompose diff --git a/charts/templates/client-slow.yaml b/charts/templates/client-slow.yaml new file mode 100644 index 00000000..820f3051 --- /dev/null +++ b/charts/templates/client-slow.yaml @@ -0,0 +1,50 @@ +{{ $worldsize := (.Values.fltk.worldsize | int) }} +{{ $workercpu := (.Values.worker.cpu | int) }} +{{ $workermemory := (.Values.worker.memory | int) }} + +{{- range untilStep 1 (add1 $worldsize | int) 1 }} +{{ $rank := ( . | int)}} +apiVersion: v1 +kind: Pod +metadata: + annotations: + kompose.cmd: kompose convert -c -f ../docker-compose-gcloud.yml + kompose.version: 1.22.0 (HEAD) + creationTimestamp: null + labels: + io.kompose.service: client-slow-{{ . }} + name: client-slow-{{ . }} +spec: + containers: + - args: + - python3 + - -m + - fltk + - single + - configs/local_experiment.yaml + - --rank={{ . }} + env: + - name: GLOO_SOCKET_IFNAME + value: eth0 + - name: MASTER_PORT + value: "5000" + - name: PYTHONUNBUFFERED + value: "1" + - name: RANK + value: {{ $rank }} + - name: TP_SOCKET_IFNAME + value: eth0 + - name: WORLD_SIZE + value: {{ $worldsize }} + image: gcr.io/cs4290-dml/fltk:latest + name: client-slow + resources: + limits: + cpu: {{ $workercpu }} + # 1 GiB ? + memory: {{ $workermemory }} + restartPolicy: Never +status: {} +# Helm requires seperation. +--- +{{- end }} diff --git a/charts/templates/fl-server-claim-persistentvolumeclaim.yaml b/charts/templates/fl-server-claim-persistentvolumeclaim.yaml new file mode 100644 index 00000000..ca546ada --- /dev/null +++ b/charts/templates/fl-server-claim-persistentvolumeclaim.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + creationTimestamp: null + labels: + io.kompose.service: fl-server-claim + name: fl-server-claim +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 10Gi +status: {} diff --git a/charts/templates/fl-server-pod.yaml b/charts/templates/fl-server-pod.yaml new file mode 100644 index 00000000..a1f015a9 --- /dev/null +++ b/charts/templates/fl-server-pod.yaml @@ -0,0 +1,39 @@ +apiVersion: v1 +kind: Pod +metadata: + annotations: + kompose.cmd: kompose convert -c -f ../docker-compose-gcloud.yml + kompose.version: 1.22.0 (HEAD) + creationTimestamp: null + labels: + io.kompose.service: fl-server + name: fl-server +spec: + containers: + - env: + - name: GLOO_SOCKET_IFNAME + value: eth0 + - name: MASTER_PORT + value: "5000" + - name: PYTHONUNBUFFERED + value: "1" + - name: RANK + value: "0" + - name: TP_SOCKET_IFNAME + value: eth0 + - name: WORLD_SIZE + value: {{ (.Values.fltk.worldsize | int) }} + image: gcr.io/cs4290-dml/fltk:latest + name: federation-lab-server + ports: + - containerPort: 5000 + resources: {} + volumeMounts: + - mountPath: /opt/federation-lab/output + name: fl-server-claim + restartPolicy: Never + volumes: + - name: fl-server-claim + persistentVolumeClaim: + claimName: fl-server-claim +status: {} diff --git a/charts/templates/fl-server-service.yaml b/charts/templates/fl-server-service.yaml new file mode 100644 index 00000000..466585d3 --- /dev/null +++ b/charts/templates/fl-server-service.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Service +metadata: + annotations: + kompose.cmd: kompose convert -c -f ../docker-compose-gcloud.yml + kompose.version: 1.22.0 (HEAD) + creationTimestamp: null + labels: + io.kompose.service: fl-server + name: fl-server +spec: + ports: + - name: "5000" + port: 5000 + targetPort: 5000 + selector: + io.kompose.service: fl-server +status: + loadBalancer: {} diff --git a/charts/values.yaml b/charts/values.yaml new file mode 100644 index 00000000..4d3c4341 --- /dev/null +++ b/charts/values.yaml @@ -0,0 +1,6 @@ +fltk: + worldsize: 20 + +worker: + cpu: 500m + memory: 1073742000 diff --git a/docker-compose-adapted.yml b/docker-compose-adapted.yml deleted file mode 100644 index 3327d873..00000000 --- a/docker-compose-adapted.yml +++ /dev/null @@ -1,75 +0,0 @@ -version: '3.3' -services: - fl_server: - container_name: federation-lab-server - restart: 'no' - build: . - volumes: - - ./configs:/opt/federation-lab/configs - - ./output:/opt/federation-lab/output - - ./default_models:/opt/federation-lab/default_models - command: python3 -m fltk single configs/local_experiment.yaml --rank=0 - environment: - - PYTHONUNBUFFERED=1 - - RANK=0 - - WORLD_SIZE=2 - - GLOO_SOCKET_IFNAME=eth0 - - TP_SOCKET_IFNAME=eth0 - ports: - - 5000:5000 - networks: - local_network_dev: - ipv4_address: 10.5.0.2 - client_slow_1: - restart: 'no' - build: . - command: python3 -m fltk single configs/local_experiment.yaml --rank=1 - volumes: - - ./configs:/opt/federation-lab/configs -# - ./docker_data:/opt/federation-lab/data - - ./default_models:/opt/federation-lab/default_models -# - ./data_loaders:/opt/federation-lab/data_loaders - environment: - - PYTHONUNBUFFERED=1 - - RANK=1 - - WORLD_SIZE=2 - - GLOO_SOCKET_IFNAME=eth0 - - TP_SOCKET_IFNAME=eth0 - depends_on: - - fl_server - deploy: - resources: - limits: - cpus: '0.5' - memory: 1024M - - client_slow_2: - restart: 'no' - build: . - command: python3 -m fltk single configs/local_experiment.yaml --rank=2 - volumes: - - ./configs:/opt/federation-lab/configs - # - ./docker_data:/opt/federation-lab/data - - ./default_models:/opt/federation-lab/default_models - # - ./data_loaders:/opt/federation-lab/data_loaders - environment: - - PYTHONUNBUFFERED=1 - - RANK=1 - - WORLD_SIZE=2 - - GLOO_SOCKET_IFNAME=eth0 - - TP_SOCKET_IFNAME=eth0 - depends_on: - - fl_server - deploy: - resources: - limits: - cpus: '0.5' - memory: 1024M -networks: - local_network_dev: - driver: bridge - ipam: - config: - - subnet: 10.5.0.0/16 - - diff --git a/docker-compose-gcloud.yml b/docker-compose-gcloud.yml new file mode 100644 index 00000000..aae07512 --- /dev/null +++ b/docker-compose-gcloud.yml @@ -0,0 +1,56 @@ +version: '3.3' +services: + fl_server: + container_name: federation-lab-server + restart: 'no' + image: gcr.io/cs4290-dml/fltk:latest + volumes: + - /opt/federation-lab/output +# command: python3 -m fltk single configs/local_experiment.yaml --rank=0 + environment: + - MASTER_PORT=5000 + - PYTHONUNBUFFERED=1 + - RANK=0 + - WORLD_SIZE=2 + - GLOO_SOCKET_IFNAME=eth0 + - TP_SOCKET_IFNAME=eth0 + ports: + - 5000:5000 + + client_slow_1: + restart: 'no' + image: gcr.io/cs4290-dml/fltk:latest + command: python3 -m fltk single configs/local_experiment.yaml --rank=1 + environment: + - MASTER_PORT=5000 + - PYTHONUNBUFFERED=1 + - RANK=1 + - WORLD_SIZE=2 + - GLOO_SOCKET_IFNAME=eth0 + - TP_SOCKET_IFNAME=eth0 + depends_on: + - fl_server + deploy: + resources: + limits: + cpus: '0.5' + memory: 1024M + + client_slow_2: + restart: 'no' + image: gcr.io/cs4290-dml/fltk:latest + command: python3 -m fltk single configs/local_experiment.yaml --rank=2 + environment: + - MASTER_PORT=5000 + - PYTHONUNBUFFERED=1 + - RANK=2 + - WORLD_SIZE=2 + - GLOO_SOCKET_IFNAME=eth0 + - TP_SOCKET_IFNAME=eth0 + depends_on: + - fl_server + deploy: + resources: + limits: + cpus: '0.5' + memory: 1024M