Skip to content
Snippets Groups Projects
Commit 7d728af6 authored by huongdm1896's avatar huongdm1896
Browse files

add GPU

parent 93694e7b
Branches
No related tags found
No related merge requests found
...@@ -8,7 +8,7 @@ This project provides tools to measure the energy consumption of Flower-based fe ...@@ -8,7 +8,7 @@ This project provides tools to measure the energy consumption of Flower-based fe
- [Installation](#installation) - [Installation](#installation)
- [Usage](#usage) - [Usage](#usage)
- [FL framework](#fl-framework) - [FL framework](#fl-framework)
- [Configure instances](#configure-instance) - [Configure instances for CPU](#configure-instance-for-cpu)
- [Run exp](#run-exp) - [Run exp](#run-exp)
- [Quickstart](#quickstart) - [Quickstart](#quickstart)
- [Step 1. Reserve the Hosts in G5K](#step-1-reserve-the-hosts-in-g5k) - [Step 1. Reserve the Hosts in G5K](#step-1-reserve-the-hosts-in-g5k)
...@@ -51,13 +51,13 @@ cd Run ...@@ -51,13 +51,13 @@ cd Run
### FL framework ### FL framework
FL scripts (includes server and client scripts) can be updated, example in dir `Flower_v1`. FL scripts (includes server and client scripts) can be updated, example in dir `Flower_v1`.
### Configure instance ### Configure instance for CPU
Configure instances of experiment in a json format, structure is shown below. Configure instances of experiment in a json format, structure is shown below.
- **instances** includes **"1"**, **"2"** ,... are identifies of each instance. - **instances** includes **"1"**, **"2"** ,... are identifies of each instance.
- **instance**: name of instance. - **instance**: name of instance.
- **output_dir**: location stores the output files (experiment log and energy monitoring output). - **output_dir**: location stores the output files (experiment log and energy monitoring output).
- **dvfs**: choose only one in 3 settings, detects all available CPU frequencies and go through all of them. - **dvfs_cpu**: choose only one in 3 settings.
- `dummy`: for testing in min and max CPU freq (`false` or `true`). - `dummy`: for testing in min and max CPU freq (`false` or `true`).
- `baseline`: for testing in max CPU freq (`false` or `true`). - `baseline`: for testing in max CPU freq (`false` or `true`).
- `frequencies`: Limits to the provided list of frequencies (`null` or `int list []`). - `frequencies`: Limits to the provided list of frequencies (`null` or `int list []`).
...@@ -80,7 +80,7 @@ Configure instances of experiment in a json format, structure is shown below. ...@@ -80,7 +80,7 @@ Configure instances of experiment in a json format, structure is shown below.
"1": { "1": {
"instance": "", "instance": "",
"output_dir": "", "output_dir": "",
"dvfs": { "dvfs_cpu": {
"dummy": true, "dummy": true,
"baseline": false, "baseline": false,
"frequencies": null "frequencies": null
...@@ -112,6 +112,25 @@ Configure instances of experiment in a json format, structure is shown below. ...@@ -112,6 +112,25 @@ Configure instances of experiment in a json format, structure is shown below.
} }
``` ```
### Configure instance for GPU
- The configuration is as same CPU, except **dvfs** role. In GPU config, the role is **dvfs_gpu**.
Choose only one in 3 settings (steps - zoomfrom - zoomto use for one setting).
- `dummy`: for testing in min and max GPU freq (`false` or `true`).
- `baseline`: for testing in max GPU freq (`false` or `true`).
- `steps`: steps to jump in range/window of frequencies (int).
- `zoomfrom`: freq start
- `zoomto`: freq stop
```json
"dvfs_gpu": {
"dummy": true,
"baseline": false,
"steps": 2,
"zoomfrom": 0,
"zoomto": 0
},
```
### Run exp ### Run exp
2 options of experiment: run single instance or all instances (a campaign). 2 options of experiment: run single instance or all instances (a campaign).
...@@ -137,17 +156,25 @@ Configure instances of experiment in a json format, structure is shown below. ...@@ -137,17 +156,25 @@ Configure instances of experiment in a json format, structure is shown below.
### Step 1. Reserve the Hosts in G5K ### Step 1. Reserve the Hosts in G5K
Reserve the required number of hosts (*See the [document of G5K](https://www.grid5000.fr/w/Getting_Started#Reserving_resources_with_OAR:_the_basics) for more details*) Reserve the required number of hosts (*See the [document of G5K](https://www.grid5000.fr/w/Getting_Started#Reserving_resources_with_OAR:_the_basics) for more details*)
<u>For example</u>: Reserve 4 hosts (1 server + 3 clients) for 2 hours: <u>For example</u>:
Reserve 4 hosts (CPU) (1 server + 3 clients) for 2 hours:
```bash ```bash
oarsub -I -l host=4,walltime=2 oarsub -I -l host=4,walltime=2
``` ```
Reserve 4 hosts (GPU) (1 server + 3 clients) for 2 hours:
```bash
oarsub -p "gpu_count>0" -l host=4,walltime=2 -t exotic -I #lyon
oarsub -p "gpu_count>0" -l host=4,walltime=2 -I #lille
```
Make sure your are in`eflwr/Run/`: Make sure your are in`eflwr/Run/`:
```bash ```bash
cd Run cd Run
``` ```
### Step 2. Configure ### Step 2. Configure
Create the JSON configuration file (e.g. `config_instances.json`) to specify experiment details includes one or more instances. Create the JSON configuration file (e.g. `config_instances.json` for CPU and `config_instances_1.json` for GPU) to specify experiment details includes one or more instances.
```bash ```bash
vim config_instances.json vim config_instances.json
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
"1": { "1": {
"instance": "fedAvg_cifar10", "instance": "fedAvg_cifar10",
"output_dir": "/home/mdo/Framework/eflwr/Log", "output_dir": "/home/mdo/Framework/eflwr/Log",
"dvfs": { "dvfs_cpu": {
"dummy": true, "dummy": true,
"baseline": false, "baseline": false,
"frequencies": null "frequencies": null
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
"2": { "2": {
"instance": "fedAvg2Clients_cifar10", "instance": "fedAvg2Clients_cifar10",
"output_dir": "/home/mdo/Framework/eflwr/Log", "output_dir": "/home/mdo/Framework/eflwr/Log",
"dvfs": { "dvfs_cpu": {
"dummy": true, "dummy": true,
"baseline": false, "baseline": false,
"frequencies": null "frequencies": null
......
{
"instances": {
"1": {
"instance": "fedAvg_cifar10",
"output_dir": "/home/mdo/Framework/eflwr/Log",
"dvfs_gpu": {
"dummy": true,
"baseline": false,
"steps": 2,
"zoomfrom": 0,
"zoomto": 0
},
"server": {
"command": "python3",
"args": [
"/home/mdo/Framework/eflwr/Flower_v1/server_1.py",
"-r 1",
"-s fedAvg"
],
"ip": "172.16.66.76",
"port": 8080
},
"clients": [
{
"name": "client1",
"command": "python3",
"args": [
"/home/mdo/Framework/eflwr/Flower_v1/client_1.py",
"cifar10",
"1",
"3"
],
"ip": "172.16.66.77"
},
{
"name": "client2",
"command": "python3",
"args": [
"/home/mdo/Framework/eflwr/Flower_v1/client_1.py",
"cifar10",
"2",
"3"
],
"ip": "172.16.66.78"
},
{
"name": "client3",
"command": "python3",
"args": [
"/home/mdo/Framework/eflwr/Flower_v1/client_1.py",
"cifar10",
"3",
"3"
],
"ip": "172.16.66.79"
}
]
},
"2": {
"instance": "fedAvg2Clients_cifar10",
"output_dir": "/home/mdo/Framework/eflwr/Log",
"dvfs_gpu": {
"dummy": true,
"baseline": false,
"steps": 2,
"zoomfrom": 0,
"zoomto": 0
},
"server": {
"command": "python3",
"args": [
"/home/mdo/Framework/eflwr/Flower_v1/server_1.py",
"-r 1",
"-s fedAvg2Clients"
],
"ip": "172.16.66.76",
"port": 8080
},
"clients": [
{
"name": "client1",
"command": "python3",
"args": [
"/home/mdo/Framework/eflwr/Flower_v1/client_1.py",
"cifar10",
"1",
"3"
],
"ip": "172.16.66.77"
},
{
"name": "client2",
"command": "python3",
"args": [
"/home/mdo/Framework/eflwr/Flower_v1/client_1.py",
"cifar10",
"2",
"3"
],
"ip": "172.16.66.78"
},
{
"name": "client3",
"command": "python3",
"args": [
"/home/mdo/Framework/eflwr/Flower_v1/client_1.py",
"cifar10",
"3",
"3"
],
"ip": "172.16.66.79"
}
]
}
}
}
...@@ -6,7 +6,7 @@ import json ...@@ -6,7 +6,7 @@ import json
import time import time
import expetator.experiment as experiment import expetator.experiment as experiment
from expetator.monitors import Mojitos from expetator.monitors import Mojitos
from expetator.leverages import Dvfs from expetator.leverages import Dvfs, GpuClock
#import run_flwr as run_flwr #import run_flwr as run_flwr
# Set up argument parser # Set up argument parser
...@@ -37,13 +37,27 @@ if instance_key not in config_data["instances"]: ...@@ -37,13 +37,27 @@ if instance_key not in config_data["instances"]:
# Load config instance # Load config instance
config = config_data["instances"][instance_key] config = config_data["instances"][instance_key]
# Extract DVFS from config # extract DVFS infor (cpu and gpu)
dvfs_config = config.get("dvfs", {}) if "dvfs_cpu" in config:
dvfs = Dvfs( dvfs_config = config["dvfs_cpu"]
dummy=dvfs_config.get("dummy", False), dvfs = Dvfs(
baseline=dvfs_config.get("baseline", False), dummy=dvfs_config.get("dummy", False),
frequencies=dvfs_config.get("frequencies", None) baseline=dvfs_config.get("baseline", False),
) frequencies=dvfs_config.get("frequencies", None)
)
LEVERAGES = [dvfs]
elif "dvfs_gpu" in config:
dvfs_config = config["dvfs_gpu"]
dvfs = GpuClock(
dummy=dvfs_config.get("dummy", False),
baseline=dvfs_config.get("baseline", False),
steps=dvfs_config.get("steps", 2),
zoomfrom=dvfs_config.get("zoomfrom", 0),
zoomto=dvfs_config.get("zoomto", 0)
)
LEVERAGES = [dvfs]
else:
LEVERAGES = []
# Log directory # Log directory
log_dir = config["output_dir"] log_dir = config["output_dir"]
...@@ -78,7 +92,7 @@ if __name__ == "__main__": ...@@ -78,7 +92,7 @@ if __name__ == "__main__":
experiment.run_experiment( experiment.run_experiment(
flower_log_dir, flower_log_dir,
[DemoBench()], [DemoBench()],
leverages=[dvfs], leverages= LEVERAGES,
monitors=[Mojitos(sensor_set={'user', 'rxp', 'dram0'})], monitors=[Mojitos(sensor_set={'user', 'rxp', 'dram0'})],
times=args.repeat times=args.repeat
) )
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment