Skip to content
Snippets Groups Projects
Commit 97bc1f6b authored by huongdm1896's avatar huongdm1896
Browse files

reduce instances to 6, reduce epoch client_1 to 1, update readme

parent 6ea3a2d4
Branches
No related tags found
No related merge requests found
......@@ -87,7 +87,7 @@ class FederatedClient(fl.client.NumPyClient):
def fit(self, parameters, config):
model.set_weights(parameters)
model.fit(x_train, y_train, epochs=5, batch_size=32, validation_data=(x_val, y_val))
model.fit(x_train, y_train, epochs=1, batch_size=32, validation_data=(x_val, y_val))
return model.get_weights(), len(x_train), {}
def evaluate(self, parameters, config):
......
......@@ -188,16 +188,18 @@ cd Run
```
### Step 2. Configure
Two JSON configuration files (e.g. `config_instances.json` for CPU and `config_instances_1.json` for GPU) to specify experiment details includes one or more instances.
Two JSON configuration files (e.g. `config_instances_CPU.json` for CPU and `config_instances_GPU.json` for GPU) to specify experiment details includes one or more instances.
```bash
cat config_instances.json
cat config_instances_CPU.json
```
<u>For example</u>: `config_instances.json` provides two examples of instance configuration. All fields are configured except "`output_dir`" and "`args`" must be updated with your directories setting.
<u>For example</u>: `config_instances_CPU.json` provides two examples of instance configuration.
- instance "`1`": fedAvg, cifar10, dvfs with min and max CPU freq, 1 round.
- instance "`2`": fedAvg2Clients, cifar10, dvfs with min and max CPU freq, 1 round.
Total test time is about 5 minutes.
### Step 3. Collect IP
Run the following command to collect/generate a node list:
......@@ -207,19 +209,19 @@ uniq $OAR_NODEFILE > nodelist
Automatically populate missing IP addresses in the JSON file:
```bash
python3 collect_ip.py -n nodelist -c config_instances.json
python3 collect_ip.py -n nodelist -c config_instances_CPU.json
```
### Step 4. Run the Campaign or Single Instance
Run single instance with instance `1`, and 2 repetitions:
```bash
python3 measure_instance.py -c config_instances.json -i 1 -x SingleTest -r 2
python3 measure_instance.py -x SingleTest -c config_instances_CPU.json -i 1 -r 2
```
Run a campaign with all instances (`1` and `2`), and 2 repetitions:
```bash
python3 measure_campaign.py -x CampaignTest -c config_instances.json -r 2
python3 measure_campaign.py -x CampaignTest -c config_instances_CPU.json -r 2
```
### Step 5. Output
......@@ -229,10 +231,10 @@ The logs and energy monitoring data will be saved in the directory specified in
Output dir structure:
```plaintext
/Flower_<x>
├── Flower_instance_<instance_name>
Log/Flower_CampaignTest
├── Flower_instance_Flower_instance_fedAvg_cifar10
│ ├── Expetator
| | ├── config_instance*.json
| | ├── config_instance_1.json
│ ├── Expetator_<host_info>_<timestamp>_mojitos: mojitos outputs
│ ├── Expetator_<host_info>_<timestamp>_power: wattmetter outputs
│ ├── Expetator_<host_info>_<timestamp>: measurement log
......@@ -243,7 +245,8 @@ Output dir structure:
│ ├── Flwr_<timestamp>
│ │ ├── Client_<ip>
│ │ ├── Server_<ip>
│── Flower_instance_<instance_name>
│── Flower_instance_Flower_instance_fedAvg2Clients_cifar10
...
```
### Step 6. Clean Up
......
......@@ -329,336 +329,6 @@
"ip": "172.16.66.79"
}
]
},
"7": {
"instance": "fedProx_cifar10",
"output_dir": "./Log",
"dvfs_cpu": {
"dummy": true,
"baseline": false,
"frequencies": null
},
"server": {
"command": "python3",
"args": [
"./Flower_v1/server_1.py",
"-r 1",
"-s fedProx"
],
"ip": "172.16.66.76",
"modules": ["logger"],
"port": 8080
},
"clients": [
{
"name": "client1",
"command": "python3",
"args": [
"./Flower_v1/client_1.py",
"cifar10",
"0",
"3"
],
"ip": "172.16.66.77"
},
{
"name": "client2",
"command": "python3",
"args": [
"./Flower_v1/client_1.py",
"cifar10",
"1",
"3"
],
"ip": "172.16.66.78"
},
{
"name": "client3",
"command": "python3",
"args": [
"./Flower_v1/client_1.py",
"cifar10",
"2",
"3"
],
"ip": "172.16.66.79"
}
]
},
"8": {
"instance": "fedProx_cifar100",
"output_dir": "./Log",
"dvfs_cpu": {
"dummy": true,
"baseline": false,
"frequencies": null
},
"server": {
"command": "python3",
"args": [
"./Flower_v1/server_1.py",
"-r 1",
"-s fedProx"
],
"ip": "172.16.66.76",
"modules": ["logger"],
"port": 8080
},
"clients": [
{
"name": "client1",
"command": "python3",
"args": [
"./Flower_v1/client_1.py",
"cifar100",
"0",
"3"
],
"ip": "172.16.66.77"
},
{
"name": "client2",
"command": "python3",
"args": [
"./Flower_v1/client_1.py",
"cifar100",
"1",
"3"
],
"ip": "172.16.66.78"
},
{
"name": "client3",
"command": "python3",
"args": [
"./Flower_v1/client_1.py",
"cifar100",
"2",
"3"
],
"ip": "172.16.66.79"
}
]
},
"9": {
"instance": "fedProx_mnist",
"output_dir": "./Log",
"dvfs_cpu": {
"dummy": true,
"baseline": false,
"frequencies": null
},
"server": {
"command": "python3",
"args": [
"./Flower_v1/server_1.py",
"-r 1",
"-s fedProx"
],
"ip": "172.16.66.76",
"modules": ["logger"],
"port": 8080
},
"clients": [
{
"name": "client1",
"command": "python3",
"args": [
"./Flower_v1/client_1.py",
"mnist",
"0",
"3"
],
"ip": "172.16.66.77"
},
{
"name": "client2",
"command": "python3",
"args": [
"./Flower_v1/client_1.py",
"mnist",
"1",
"3"
],
"ip": "172.16.66.78"
},
{
"name": "client3",
"command": "python3",
"args": [
"./Flower_v1/client_1.py",
"mnist",
"2",
"3"
],
"ip": "172.16.66.79"
}
]
},
"10": {
"instance": "fedAdam_cifar10",
"output_dir": "./Log",
"dvfs_cpu": {
"dummy": true,
"baseline": false,
"frequencies": null
},
"server": {
"command": "python3",
"args": [
"./Flower_v1/server_1.py",
"-r 1",
"-s fedAdam"
],
"ip": "172.16.66.76",
"modules": ["logger"],
"port": 8080
},
"clients": [
{
"name": "client1",
"command": "python3",
"args": [
"./Flower_v1/client_1.py",
"cifar10",
"0",
"3"
],
"ip": "172.16.66.77"
},
{
"name": "client2",
"command": "python3",
"args": [
"./Flower_v1/client_1.py",
"cifar10",
"1",
"3"
],
"ip": "172.16.66.78"
},
{
"name": "client3",
"command": "python3",
"args": [
"./Flower_v1/client_1.py",
"cifar10",
"2",
"3"
],
"ip": "172.16.66.79"
}
]
},
"11": {
"instance": "fedAdam_cifar100",
"output_dir": "./Log",
"dvfs_cpu": {
"dummy": true,
"baseline": false,
"frequencies": null
},
"server": {
"command": "python3",
"args": [
"./Flower_v1/server_1.py",
"-r 1",
"-s fedAdam"
],
"ip": "172.16.66.76",
"modules": ["logger"],
"port": 8080
},
"clients": [
{
"name": "client1",
"command": "python3",
"args": [
"./Flower_v1/client_1.py",
"cifar100",
"0",
"3"
],
"ip": "172.16.66.77"
},
{
"name": "client2",
"command": "python3",
"args": [
"./Flower_v1/client_1.py",
"cifar100",
"1",
"3"
],
"ip": "172.16.66.78"
},
{
"name": "client3",
"command": "python3",
"args": [
"./Flower_v1/client_1.py",
"cifar100",
"2",
"3"
],
"ip": "172.16.66.79"
}
]
},
"12": {
"instance": "fedAdam_mnist",
"output_dir": "./Log",
"dvfs_cpu": {
"dummy": true,
"baseline": false,
"frequencies": null
},
"server": {
"command": "python3",
"args": [
"./Flower_v1/server_1.py",
"-r 1",
"-s fedAdam"
],
"ip": "172.16.66.76",
"modules": ["logger"],
"port": 8080
},
"clients": [
{
"name": "client1",
"command": "python3",
"args": [
"./Flower_v1/client_1.py",
"mnist",
"0",
"3"
],
"ip": "172.16.66.77"
},
{
"name": "client2",
"command": "python3",
"args": [
"./Flower_v1/client_1.py",
"mnist",
"1",
"3"
],
"ip": "172.16.66.78"
},
{
"name": "client3",
"command": "python3",
"args": [
"./Flower_v1/client_1.py",
"mnist",
"2",
"3"
],
"ip": "172.16.66.79"
}
]
}
}
}
}
\ No newline at end of file
{
"instances": {
"1": {
"instance": "fedAvg_cifar10",
"output_dir": "./Log",
"dvfs_cpu": {
"dummy": true,
"baseline": false,
"frequencies": null
},
"server": {
"command": "python3",
"args": [
"./Flower_v1/server_1.py",
"-r 1",
"-s fedAvg"
],
"ip": "172.16.66.76",
"modules": ["logger"],
"port": 8080
},
"clients": [
{
"name": "client1",
"command": "python3",
"args": [
"./Flower_v1/client_1.py",
"cifar10",
"0",
"3"
],
"ip": "172.16.66.77"
},
{
"name": "client2",
"command": "python3",
"args": [
"./Flower_v1/client_1.py",
"cifar10",
"1",
"3"
],
"ip": "172.16.66.78"
},
{
"name": "client3",
"command": "python3",
"args": [
"./Flower_v1/client_1.py",
"cifar10",
"2",
"3"
],
"ip": "172.16.66.79"
}
]
},
"2": {
"instance": "fedAvg2Clients_cifar10",
"output_dir": "./Log",
"dvfs_cpu": {
"dummy": true,
"baseline": false,
"frequencies": null
},
"server": {
"command": "python3",
"args": [
"./Flower_v1/server_1.py",
"-r 1",
"-s fedAvg2Clients"
],
"ip": "172.16.66.76",
"modules": ["logger"],
"port": 8080
},
"clients": [
{
"name": "client1",
"command": "python3",
"args": [
"./Flower_v1/client_1.py",
"cifar10",
"0",
"3"
],
"ip": "172.16.66.77"
},
{
"name": "client2",
"command": "python3",
"args": [
"./Flower_v1/client_1.py",
"cifar10",
"1",
"3"
],
"ip": "172.16.66.78"
},
{
"name": "client3",
"command": "python3",
"args": [
"./Flower_v1/client_1.py",
"cifar10",
"2",
"3"
],
"ip": "172.16.66.79"
}
]
}
}
}
\ No newline at end of file
File moved
......@@ -22,7 +22,7 @@ def main():
args = parser.parse_args()
# Path to the combined config.json file
config_path = parser.config
config_path = args.config
# Read the config.json file
try:
......
......@@ -5,7 +5,7 @@ import argparse
import json
import time
import expetator.experiment as experiment
from expetator.monitors import Mojitos
from expetator.monitors import Mojitos, kwollect
from expetator.leverages import Dvfs, GpuClock
#import run_flwr as run_flwr
......@@ -99,6 +99,7 @@ if __name__ == "__main__":
flower_log_dir,
[DemoBench()],
leverages= LEVERAGES,
monitors=[Mojitos(sensor_set={'user', 'rxp', 'dram0'})],
monitors=[Mojitos(sensor_set={'user', 'rxp', 'dram0'}),
kwollect.Power(metric=kwollect.get_g5k_target_metric())],
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