Skip to content
Snippets Groups Projects
Huong DO MAI's avatar
Huong DO MAI authored
f9bcfb8d
History

Measure Energy of Flower FL in G5K

Getting Started

These instructions will let you know how to run it.

An example of Flower (using tensorflow) is stored in Flower_v1. The test example will be use this source.

Prerequisites

This framework requires Python 3.9.2 or higher. Check your Python package version:

python3 --version

Other dependencies are stored in requirements.txt. Run:

pip install -r requirements.txt

This requirements.txt includes tensorflow to run the provided example Flwr.

Installing

Download code:

git clone https://gitlab.irit.fr/sepia-pub/delight/eflwr.git

Go to Run directory:

cd eflwr/Run

Running the tests

Step 1. Configure

Configure the information of each exp in config_instance*.json, you can add more config_instance*.json with * is a number. Use your editor instead of vim (nano etc).

vim config_instance1.json
"instance": the name of your exp, anything you want, I suggest to input the specific name of your testing.

"output_dir": where you want to store your log (your exp log and energy mornitoring log)

"server": 
    "command": which cmd sever use, my case is python3.
    "args": includes file to run and arguments
    "ip": address of server, this one will be automatic input when you run the code, just leave it blank
    "port": default 8080m dont change it.

"clients":
    "name": numbering/name your client, should be client1.2.3...
    "command": which cmd client use, my case is python3
    "args": includes file to run and arguments
    "ip": address of client, this one will be automatic input when you run the code, just leave it blank.

Note that if you create x clients in json config then you have to researve x+1 hosts in g5k (1 for server and x for x clients).

Step 2. Reserve the hosts in g5k:

Run below cmd:

oarsub -I -l host=<number_of_hosts>,walltime=<number_of_during>

For example: 1 sever and 3 clients need 4 hosts.

oarsub -I -l host=4,walltime=2

Step 3. Collect IP

Run below cmd:

uniq $OAR_NODEFILE > nodelist

Then automatically fill out missing IP addresses in json:

python3 collect_ip.py

Step 4. Run the campaign or instance:

Now you can run the monitoring campaign by run_measure.py. Note that, this function will scan all the json file in the Run directory with the name "config_instance*.json".

python3 run_measure.py -x <your_str> -r <number_of_repetation>

For example:

python3 run_measure.py -x IamPretty -r 2

<your_str>: whatever_you_want to recorgnize your testing.
<number_of_repetation>: number of repeatation of your exp

In case you only need to run 1 instance, you can use measure.py instead:

python3 measure.py -c <config_instance*.json> -x <your_str> -r <number_of_repetation>

For example:

python3 measure.py -c config_instance1.json -x IamPretty -r 2

Step 6. Output

Check the output in the directory where you set in json file. The output structure:

/Flower_Test1
├── Flower_instance_fedAvg_cifar10
│   ├── Expetator
│   ├── Expetator_gros-26.nancy.grid5000.fr_1732808824
│   ├── Expetator_gros-26.nancy.grid5000.fr_1732808824_mojitos
│   │   ├── gros-26.nancy.grid5000.fr_flower_1732808838
│   │   ├── gros-38.nancy.grid5000.fr_flower_1732808838
│   │   ├── gros-4.nancy.grid5000.fr_flower_1732808838
│   │   └── gros-65.nancy.grid5000.fr_flower_1732808838
│   ├── Expetator_gros-26.nancy.grid5000.fr_1732808824_power
│   │   └── gros-26.nancy.grid5000.fr_flower_1732808838
│   ├── Flwr_20241128_164718
│   │   ├── Client_172.16.66.38
│   │   ├── Client_172.16.66.4
│   │   ├── Client_172.16.66.65
│   │   ├── flower_log_summary.txt
│   │   └── Server_172.16.66.26

Step 7. Kill job in g5k after finish

Exit the host:

exit

Check the job id:

oarstat -u

Kill the job:

oardel <job_id>