Skip to content

Commit

Permalink
update random walk
Browse files Browse the repository at this point in the history
  • Loading branch information
AditiR-42 committed Nov 8, 2023
1 parent aef2a49 commit 6924d38
Showing 1 changed file with 11 additions and 32 deletions.
43 changes: 11 additions & 32 deletions sims/AstraSim/trainRandomWalkerAstraSim.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,31 +34,17 @@
FLAGS = flags.FLAGS


# parses the network file
# def parse_network(network_file):
# with open(network_file) as f:
# network = json.load(f)
# return network
# network: parses the network file
def parse_network(network_file, action_dict):
with open(network_file) as f:
network = json.load(f)


# systems: parse from file into json into generate_random_actions
"""
system_file content:
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
"""
for key in network.keys():
action_dict['network'][key] = network[key]
return network


# systems: parse from file into json into generate_random_actions
def parse_system(system_file, action_dict):
# parse system_file (above is the content) into dict
action_dict['system'] = {}
Expand All @@ -70,9 +56,6 @@ def parse_system(system_file, action_dict):
action_dict['system'][key] = value


# def parse_workload(workload_file):


# parses knobs that we want to experiment with
def parse_knobs(knobs_spec):
SYSTEM_KNOBS = {}
Expand Down Expand Up @@ -156,7 +139,7 @@ def main(_):
workloads_folder = os.path.join(astrasim_archgym, "themis/inputs/workload")

# DEFINE NETWORK AND SYSTEM AND WORKLOAD
network_file = "4d_ring_fc_ring_switch.json"
network_file = os.path.join(networks_folder, "4d_ring_fc_ring_switch.json")
system_file = os.path.join(
systems_folder, "4d_ring_fc_ring_switch_baseline.txt")
workload_file = "all_reduce/allreduce_0.65.txt"
Expand Down Expand Up @@ -188,10 +171,6 @@ def main(_):
os.makedirs(traject_dir)
env = wrap_in_envlogger(env, traject_dir)

# get the dimension of the network
# the dimension is now defined in the template
dimension = random.randint(2, 3)

start = time.time()

step_results = {}
Expand All @@ -200,11 +179,11 @@ def main(_):
action_dict = {}

# if path exists, use path, else parse the sub-dict
action_dict['network'] = {"path": network_file}
action_dict['workload'] = {"path": workload_file}

# TODO: parse system
# TODO: parse system and network
parse_system(system_file, action_dict)
parse_network(network_file, action_dict)

# TODO: parse knobs (all variables to change in action_dict)
system_knob, network_knob = parse_knobs(knobs_spec)
Expand Down

0 comments on commit 6924d38

Please sign in to comment.