Skip to content

Commit

Permalink
automate random walker
Browse files Browse the repository at this point in the history
  • Loading branch information
AditiR-42 committed Nov 16, 2023
1 parent 56528b0 commit fade749
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 45 deletions.
5 changes: 2 additions & 3 deletions aco/DeepSwarm/deepswarm/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from arch_gym.envs.AstraSimWrapper import make_astraSim_env
from arch_gym.envs.SniperEnv import SniperEnv
from arch_gym.envs.DRAMEnv import DRAMEnv
from arch_gym.envs.AstraSimEnv import AstraSimEnv
from arch_gym.envs.envHelpers import helpers
import json
import envlogger
Expand Down Expand Up @@ -344,7 +345,7 @@ class DummyAstraSim():
"""Dummy placeholder for DRAMSys to do POC"""

def __init__(self, path, exp_name, traject_dir, log_dir, reward_formulation, use_envlogger):
self.env = SniperEnv()
self.env = AstraSimEnv()
self.helper = helpers()
self.fitness_hist = {}

Expand Down Expand Up @@ -409,8 +410,6 @@ def __init__(self, path, exp_name, traject_dir, log_dir, reward_formulation, use
"hbm-scale": [node.hbmScale1, node.hbmScale2, node.hbmScale3]
}

# ADD 5 DIMENSIONS + account for dimension variable

for node in path:
system_knob, network_knob = self.parse_knobs(self.knobs_spec)
dicts = [(system_knob, 'system'), (network_knob, 'network')]
Expand Down
14 changes: 0 additions & 14 deletions bo/AstraSimEstimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,20 +187,6 @@ def get_params(self, deep=False):
}

def set_params(self, **params):
"""
scheduling-policy: LIFO
endpoint-delay: 1
active-chunks-per-dimension: 1
preferred-dataset-splits: 64
boost-mode: 1
all-reduce-implementation: direct_ring_halvingDoubling
all-gather-implementation: direct_ring_halvingDoubling
reduce-scatter-implementation: direct_ring_halvingDoubling
all-to-all-implementation: direct_direct_direct
collective-optimization: localBWAware
intra-dimension-scheduling: FIFO
inter-dimension-scheduling: baseline
"""
_params = params
self.action_dict["scheduling_policy"] = _params["scheduling_policy"]
self.action_dict["collective_optimization"] = _params["collective_optimization"]
Expand Down
1 change: 0 additions & 1 deletion settings/default_astrasim.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Nodes:
ArchParamsNode:
attributes:
# network attributes
topologyName: ["Hierarchical"]
topologiesPerDim1: ["Ring", "FullyConnected", "Switch"]
topologiesPerDim2: ["Ring", "FullyConnected", "Switch"]
topologiesPerDim3: ["Ring", "FullyConnected", "Switch"]
Expand Down
35 changes: 8 additions & 27 deletions sims/AstraSim/trainRandomWalkerAstraSim.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,6 @@
'Which reward formulation to use?')
FLAGS = flags.FLAGS

# define which parameters are affected by dimension count
DIMENSION_PARAMS = {
# network parameters
"topology-name": [False], "topologies-per-dim": [True, "diff"],
"dimension-type": [True, "same"], "dimensions-count": [False],
"units-count": [True, "diff"], "links-count": [True, "diff"],
"link-latency": [True, "same"], "link-bandwidth": [True, "diff"],
"nic-latency": [True, "same"], "router-latency": [True, "same"],
"hbm-latency": [True, "same"], "hbm-bandwidth": [True, "same"],
"hbm-scale": [True, "same"],
# system parameters
"scheduling-policy": [False], "endpoint-delay": [False],
"active-chunks-per-dimension": [False], "preferred-dataset-splits": [False],
"boost-mode": [False], "all-reduce-implementation": [True, "diff"],
"all-gather-implementation": [True, "diff"], "reduce-scatter-implementation": [True, "diff"],
"all-to-all-implementation": [True, "diff"], "collective-optimization": [False],
"intra-dimension-scheduling": [False], "inter-dimension-scheduling": [False]
}

# network: parses the network file
def parse_network(network_file, action_dict):
action_dict['network'] = {}
Expand Down Expand Up @@ -96,24 +77,24 @@ def parse_knobs(knobs_spec):
def generate_random_actions(dimension, action_dict, system_knob, network_knob):
dicts = [(system_knob, 'system'), (network_knob, 'network')]
for dict_type, dict_name in dicts:
knobs = dict_type.keys()
knobs.remove("num-dims")
for knob in dict_type.keys():
if isinstance(dict_type[knob], set):
if DIMENSION_PARAMS[knob][0]:
if DIMENSION_PARAMS[knob][1] == "diff":
if isinstance(dict_type[knob][0], set):
if dict_type[knob][1] == "FALSE":
action_dict[dict_name][knob] = [random.choice(
list(dict_type[knob])) for _ in range(dimension)]
else:
elif dict_type[knob][1] == "TRUE":
choice = random.choice(list(dict_type[knob]))
action_dict[dict_name][knob] = [choice for _ in range(dimension)]
else:
action_dict[dict_name][knob] = random.choice(
list(dict_type[knob]))
else:
if DIMENSION_PARAMS[knob][0]:
if DIMENSION_PARAMS[knob][1] == "diff":
if dict_type[knob][1] == "FALSE":
action_dict[dict_name][knob] = [random.randint(
dict_type[knob][1], dict_type[knob][2])]
else:
elif dict_type[knob][1] == "TRUE":
choice = random.randint(dict_type[knob][1], dict_type[knob][2])
action_dict[dict_name][knob] = [choice for _ in range(dimension)]
else:
Expand Down Expand Up @@ -228,7 +209,7 @@ def main(_):
for step in range(FLAGS.num_steps):
# pass into generate_random_actions(dimension, knobs)
action_dict = generate_random_actions(
action_dict['network']['dimensions-count'], action_dict, system_knob, network_knob)
action_dict['network']['num-dims'], action_dict, system_knob, network_knob)

# with open("general_workload.txt", 'w') as file:
# file.write(action["workload"]["value"])
Expand Down

0 comments on commit fade749

Please sign in to comment.