Skip to content

Commit

Permalink
gcp close to ready, frontend csv knob convert
Browse files Browse the repository at this point in the history
  • Loading branch information
AditiR-42 committed Nov 16, 2023
1 parent 95e04d5 commit e0686ea
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 55 deletions.
28 changes: 0 additions & 28 deletions sims/AstraSim/frontend/Astra-Sim Parameters - INPUT FORMAT (1).csv

This file was deleted.

28 changes: 28 additions & 0 deletions sims/AstraSim/frontend/Astra-Sim Parameters - INPUT FORMAT (3).csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Network,,
Parameter,Range,SamePerDimension
num-npus,"{8, 16, 32, 64, 128, 256, 512, 1024}",N/A
num-dims,"(1, 4, 1)",N/A
topology,"{""Ring"", ""Switch"", ""FullyConnected""}",TRUE
npus_count,"(1, num-npus, 1)",FALSE
bandwidth,"{5, 12.5, 25, 50, 100, 200}",FALSE
latency,{1},TRUE
,,
System,,
Parameter,Range,SamePerDimension
scheduling-policy,"{""FIFO"", ""LIFO""}",N/A
endpoint-delay,"(1, 1000, 1)",N/A
active-chunks-per-dimension,"(1, 32, 1)",N/A
preferred-dataset-splits,"(1, 1024, 1)",N/A
all-reduce-implementation,"{""ring"", ""direct"", ""oneRing"", ""oneDirect"", ""hierarchicalRing"", ""doubleBinaryTree""}",FALSE
all-gather-implementation,"{""ring"", ""direct"", ""oneRing"", ""oneDirect"", ""hierarchicalRing"", ""doubleBinaryTree""}",FALSE
reduce-scatter-implementation,"{""ring"", ""direct"", ""oneRing"", ""oneDirect"", ""hierarchicalRing"", ""doubleBinaryTree""}",FALSE
all-to-all-implementation,"{""ring"", ""direct"", ""oneRing"", ""oneDirect"", ""hierarchicalRing"", ""doubleBinaryTree""}",FALSE
collective-optimization,"{""localBWAware"", ""baseline""}",N/A
intra-dimension-scheduling,"{""FIFO"", ""SCF""}",N/A
inter-dimension-scheduling,"{""baseline"", ""themis""}",N/A
,,
Workload,,
Parameter,Range,SamePerDimension
parallel-strategy,"{""dp"", ""fdsp"", ""mpdp""}",N/A
data-parallel-degree,"{1, 2, 4, 8, 16, 32, 64, 128, 256, 512}",N/A
model-parallel-degree,"{1, 2, 4, 8, 16, 32, 64, 128, 256, 512}",N/A
2 changes: 2 additions & 0 deletions sims/AstraSim/frontend/parameter_knobs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SYSTEM_KNOBS = {'scheduling-policy': ({'FIFO', 'LIFO'}, 'N/A'), 'endpoint-delay': ((1, 1000, 1), 'N/A'), 'active-chunks-per-dimension': ((1, 32, 1), 'N/A'), 'preferred-dataset-splits': ((1, 1024, 1), 'N/A'), 'all-reduce-implementation': ({'doubleBinaryTree', 'direct', 'oneRing', 'oneDirect', 'hierarchicalRing', 'ring'}, 'FALSE'), 'all-gather-implementation': ({'doubleBinaryTree', 'direct', 'oneRing', 'oneDirect', 'hierarchicalRing', 'ring'}, 'FALSE'), 'reduce-scatter-implementation': ({'doubleBinaryTree', 'direct', 'oneRing', 'oneDirect', 'hierarchicalRing', 'ring'}, 'FALSE'), 'all-to-all-implementation': ({'doubleBinaryTree', 'direct', 'oneRing', 'oneDirect', 'hierarchicalRing', 'ring'}, 'FALSE'), 'collective-optimization': ({'localBWAware', 'baseline'}, 'N/A'), 'intra-dimension-scheduling': ({'FIFO', 'SCF'}, 'N/A'), 'inter-dimension-scheduling': ({'themis', 'baseline'}, 'N/A')}
NETWORK_KNOBS = {'num-npus': ({32, 256, 64, 128, 512, 1024, 8, 16}, 'N/A'), 'num-dims': ((1, 4, 1), 'N/A'), 'topology': ({'Ring', 'Switch', 'FullyConnected'}, 'TRUE'), 'npus_count': ((1, 'num-npus', 1), 'FALSE'), 'bandwidth': ({50, 100, 5, 200, 25, 12.5}, 'FALSE'), 'latency': ({1}, 'TRUE')}
77 changes: 55 additions & 22 deletions sims/AstraSim/frontend/parameter_specs.csv
Original file line number Diff line number Diff line change
@@ -1,22 +1,55 @@
Network,,,,
Parameter,Range,SamePerDimension,,
num-npus,"[8, 16, 32, 64, 128, 256, 512, 1024]",N/A,,
num-dims,"(1, 4, 1)",N/A,,"(min, max, step)"
topology,"[{""Ring"", ""Switch"", ""FullyConnected""}]",TRUE,,"[ring, ring, ring]"
npus_count,"[(1, num-npus, 1)]",FALSE,,
bandwidth,"[5, 12.5, 25, 50, 100, 200]",FALSE,,"[5, 25, 50]"
latency,[{1}],TRUE,,
,,,,
System,,,,
Parameter,Range,SamePerDimension,,
scheduling-policy,"{""FIFO"", ""LIFO""}",N/A,,
endpoint-delay,"(1, 1000, 1)",N/A,,
active-chunks-per-dimension,"(1, 32, 1)",N/A,,
preferred-dataset-splits,"(1, 1024, 1)",N/A,,
all-reduce-implementation,"[{""ring"", ""direct"", ""oneRing"", ""oneDirect"", ""hierarchicalRing"", ""doubleBinaryTree""}]",FALSE,,
all-gather-implementation,"[{""ring"", ""direct"", ""oneRing"", ""oneDirect"", ""hierarchicalRing"", ""doubleBinaryTree""}]",FALSE,,
reduce-scatter-implementation,"[{""ring"", ""direct"", ""oneRing"", ""oneDirect"", ""hierarchicalRing"", ""doubleBinaryTree""}]",FALSE,,
all-to-all-implementation,"[{""ring"", ""direct"", ""oneRing"", ""oneDirect"", ""hierarchicalRing"", ""doubleBinaryTree""}]",FALSE,,
collective-optimization,"{""localBWAware"", ""baseline""}",N/A,,
intra-dimension-scheduling,"{""FIFO"", ""SCF""}",N/A,,
inter-dimension-scheduling,"{""baseline"", ""themis""}",N/A,,
Network,,
Parameter,Range,SamePerDimension
num-npus,"{8, 16, 32, 64, 128, 256, 512, 1024}",N/A
num-dims,"(1, 4, 1)",N/A
topology,"{""Ring"", ""Switch"", ""FullyConnected""}",TRUE
npus_count,"(1, ""num-npus"", 1)",FALSE
bandwidth,"{5, 12.5, 25, 50, 100, 200}",FALSE
latency,{1},TRUE
,,
System,,
Parameter,Range,SamePerDimension
scheduling-policy,"{""FIFO"", ""LIFO""}",N/A
endpoint-delay,"(1, 1000, 1)",N/A
active-chunks-per-dimension,"(1, 32, 1)",N/A
preferred-dataset-splits,"(1, 1024, 1)",N/A
all-reduce-implementation,"{""ring"", ""direct"", ""oneRing"", ""oneDirect"", ""hierarchicalRing"", ""doubleBinaryTree""}",FALSE
all-gather-implementation,"{""ring"", ""direct"", ""oneRing"", ""oneDirect"", ""hierarchicalRing"", ""doubleBinaryTree""}",FALSE
reduce-scatter-implementation,"{""ring"", ""direct"", ""oneRing"", ""oneDirect"", ""hierarchicalRing"", ""doubleBinaryTree""}",FALSE
all-to-all-implementation,"{""ring"", ""direct"", ""oneRing"", ""oneDirect"", ""hierarchicalRing"", ""doubleBinaryTree""}",FALSE
collective-optimization,"{""localBWAware"", ""baseline""}",N/A
intra-dimension-scheduling,"{""FIFO"", ""SCF""}",N/A
inter-dimension-scheduling,"{""baseline"", ""themis""}",N/A
,,
Workload,,
Parameter,Range,SamePerDimension
parallel-strategy,"{""dp"", ""fdsp"", ""mpdp""}",N/A
data-parallel-degree,"{1, 2, 4, 8, 16, 32, 64, 128, 256, 512}",N/A
model-parallel-degree,"{1, 2, 4, 8, 16, 32, 64, 128, 256, 512}",N/ANetwork,,
Parameter,Range,SamePerDimension
num-npus,"{8, 16, 32, 64, 128, 256, 512, 1024}",N/A
num-dims,"(1, 4, 1)",N/A
topology,"{""Ring"", ""Switch"", ""FullyConnected""}",TRUE
npus_count,"(1, ""num-npus"", 1)",FALSE
bandwidth,"{5, 12.5, 25, 50, 100, 200}",FALSE
latency,{1},TRUE
,,
System,,
Parameter,Range,SamePerDimension
scheduling-policy,"{""FIFO"", ""LIFO""}",N/A
endpoint-delay,"(1, 1000, 1)",N/A
active-chunks-per-dimension,"(1, 32, 1)",N/A
preferred-dataset-splits,"(1, 1024, 1)",N/A
all-reduce-implementation,"{""ring"", ""direct"", ""oneRing"", ""oneDirect"", ""hierarchicalRing"", ""doubleBinaryTree""}",FALSE
all-gather-implementation,"{""ring"", ""direct"", ""oneRing"", ""oneDirect"", ""hierarchicalRing"", ""doubleBinaryTree""}",FALSE
reduce-scatter-implementation,"{""ring"", ""direct"", ""oneRing"", ""oneDirect"", ""hierarchicalRing"", ""doubleBinaryTree""}",FALSE
all-to-all-implementation,"{""ring"", ""direct"", ""oneRing"", ""oneDirect"", ""hierarchicalRing"", ""doubleBinaryTree""}",FALSE
collective-optimization,"{""localBWAware"", ""baseline""}",N/A
intra-dimension-scheduling,"{""FIFO"", ""SCF""}",N/A
inter-dimension-scheduling,"{""baseline"", ""themis""}",N/A
,,
Workload,,
Parameter,Range,SamePerDimension
parallel-strategy,"{""dp"", ""fdsp"", ""mpdp""}",N/A
data-parallel-degree,"{1, 2, 4, 8, 16, 32, 64, 128, 256, 512}",N/A
model-parallel-degree,"{1, 2, 4, 8, 16, 32, 64, 128, 256, 512}",N/A
21 changes: 16 additions & 5 deletions sims/AstraSim/frontend/parse_parameter_specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,28 @@ def parse_csv_to_knobs(input_csv):
csvreader = csv.reader(csvfile)

for row in csvreader:
if row and row[0] == 'System':
if not row[0] or row[0] == 'Parameter':
continue
elif row and row[0] == 'System':
current_knob_dict = system_knobs
elif row and row[0] == 'Network':
current_knob_dict = network_knobs
elif row and row[0] == 'Workload':
current_knob_dict = workload_knobs
elif row[0] == 'Parameter':
next(csvreader)

elif current_knob_dict is not None:
print(row)
parameter = row[0]
# row[1] is a set or a tuple. Tuple is a range, and set is a set of possible values
range = row[1]
samePerDimension = row[2]
print("cols: ")
print(parameter, eval(range), samePerDimension)
current_knob_dict[parameter] = (eval(range), samePerDimension)

return system_knobs, network_knobs

# Example usage

input_csv_file = 'parameter_specs.csv'

settings_file_path = os.path.realpath(__file__)
Expand All @@ -38,9 +42,16 @@ def parse_csv_to_knobs(input_csv):

parameter_specs = os.path.join(proj_root_path, input_csv_file)


SYSTEM_KNOBS, NETWORK_KNOBS = parse_csv_to_knobs(parameter_specs)

# write system_knobs and network_knobs to a separate python file, as dicts
with open('parameter_knobs.py', 'w') as knobs_file:
knobs_file.write("SYSTEM_KNOBS = ")
knobs_file.write(str(SYSTEM_KNOBS))
knobs_file.write("\n")
knobs_file.write("NETWORK_KNOBS = ")
knobs_file.write(str(NETWORK_KNOBS))

print("SYSTEM_KNOBS:")
print(SYSTEM_KNOBS)
print("\nNETWORK_KNOBS:")
Expand Down

0 comments on commit e0686ea

Please sign in to comment.