Skip to content

Commit

Permalink
move device_id processing to scheduler
Browse files Browse the repository at this point in the history
  • Loading branch information
ishaansingh22 committed Jun 27, 2024
1 parent ade4564 commit 9cd6cb0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
11 changes: 1 addition & 10 deletions src/configs/sys_config.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,14 @@
# System Configuration

system_config = {
"num_users": 4,
"experiment_path": "./experiments/",
"dset": "cifar10",
"dump_dir": "./expt_dump/",
"dpath": "/data/unagi0/anakewat/imgs/",
"seed": 2,
"device_ids": {
"iid_dispfl": {"node_0": [2], "node_1": [3], "node_2": [4], "node_3": [5], "node_4": [2]},
"iid_defkt": {"node_0": [4], "node_1": [4], "node_2": [4], "node_3": [4]},
"non_iid": {"node_0": [0], "node_1": [1], "node_2": [2], "node_3": [3]}
},
"device_ids": {}
"dataset_splits": {
"iid": {"samples_per_user": 500},
"non_iid": {"samples_per_user": 32}
}
}


def get_device_ids(algo):
return system_config["device_ids"].get(algo, {})
5 changes: 2 additions & 3 deletions src/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
from algos.fl_data_repr import FedDataRepClient, FedDataRepServer
from algos.fl_val import FedValClient, FedValServer
from utils.log_utils import copy_source_code, check_and_create_path
from utils.config_utils import load_config, process_config
from configs.sys_config import get_device_ids
from utils.config_utils import load_config, process_config, get_device_ids
import os

# should be used as: algo_map[algo_name][rank>0](config)
Expand Down Expand Up @@ -78,7 +77,7 @@ def merge_configs(self):
"dpath": self.sys_config["dataset_path"] + "cifar10",
"num_users": self.sys_config["num_users"],
"samples_per_user": self.sys_config["dataset_splits"]["iid"]["samples_per_user"],
"device_ids": get_device_ids("iid_dispfl")
"device_ids": get_device_ids(num_clients=fedcentral_client, num_client_per_gpu=6, available_gpus=[0, 1,2, 3, 4, 5, 6, 7])
})

def initialize(self, copy_souce_code=True) -> None:
Expand Down

0 comments on commit 9cd6cb0

Please sign in to comment.