Skip to content

scaleoutsystems/power-consumption-tutorial

Repository files navigation

Power consumption prediction for data centers (TensorFlow/Keras and PyTorch)

Power Consumption Example.

This is an example of a neural network regression model in a federated setting. Time series data from two data centers in Sweden and Finland are used to predict the relationship between CPU and Network usage and power consumption. The tutorial is based on the following article that has more background information on the use-case:

The model in this example is a simplified version of the model used in the article, aimed at reducing the compute requirements on the client side. A typical laptop or workstation should be capable of handling multiple clients. A partition of the dataset needed for this example is publically accessible.

wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=1r_dlOEZAnCLhRjY1qFwlRAkeB4PvhgAU' -O power.npz

To access the complete dataset, please get in touch with Scaleout staff. The following figure illustrates the overall concept of the example.

Overview figure highlighting input parameters and expected output.

In case you have any questions, feel free to contact us.

Prerequisites, when running clients in Docker containers

Creating the compute package and seed model

Install fedn:

.. code-block::

pip install fedn

Clone this repository, then locate into this directory:

.. code-block::

https://github.com/scaleoutsystems/power-consumption-tutorial.git cd power-consumption-tutorial/Power-consumption-pytorch

Create the compute package:

.. code-block::

fedn package create --path client

This should create a file 'package.tgz' in the project folder.

Next, generate a seed model (the first model in a global model trail):

.. code-block::

fedn run build --path client

This will create a seed model called 'seed.npz' in the root of the project. This step will take a few minutes, depending on hardware and internet connection (builds a virtualenv).

Download the dataset:

For Linux and MacOS

   mkdir power-consumption-tutorial/Power-consumption-pytorch/data
   wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=1r_dlOEZAnCLhRjY1qFwlRAkeB4PvhgAU' -O power.npz

For Windows users, download the dataset using your preferred browser or tool by following the link below.

https://docs.google.com/uc?export=download&id=1r_dlOEZAnCLhRjY1qFwlRAkeB4PvhgAU

Using FEDn Studio

Follow the guide here to set up your FEDn Studio project and learn how to connect clients (using token authentication): Studio guide <https://fedn.readthedocs.io/en/stable/studio.html>__. On the step "Upload Files", upload 'package.tgz' and 'seed.npz' created above.