From e0686eabc400a6fc47e0ce1f3db14432bbe9ce1b Mon Sep 17 00:00:00 2001 From: jared-ni Date: Thu, 16 Nov 2023 16:42:42 -0500 Subject: [PATCH] gcp close to ready, frontend csv knob convert --- ...stra-Sim Parameters - INPUT FORMAT (1).csv | 28 ------- ...stra-Sim Parameters - INPUT FORMAT (3).csv | 28 +++++++ sims/AstraSim/frontend/parameter_knobs.py | 2 + sims/AstraSim/frontend/parameter_specs.csv | 77 +++++++++++++------ .../frontend/parse_parameter_specs.py | 21 +++-- 5 files changed, 101 insertions(+), 55 deletions(-) delete mode 100644 sims/AstraSim/frontend/Astra-Sim Parameters - INPUT FORMAT (1).csv create mode 100644 sims/AstraSim/frontend/Astra-Sim Parameters - INPUT FORMAT (3).csv create mode 100644 sims/AstraSim/frontend/parameter_knobs.py diff --git a/sims/AstraSim/frontend/Astra-Sim Parameters - INPUT FORMAT (1).csv b/sims/AstraSim/frontend/Astra-Sim Parameters - INPUT FORMAT (1).csv deleted file mode 100644 index bcb7a9a8..00000000 --- a/sims/AstraSim/frontend/Astra-Sim Parameters - INPUT FORMAT (1).csv +++ /dev/null @@ -1,28 +0,0 @@ -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 \ No newline at end of file diff --git a/sims/AstraSim/frontend/Astra-Sim Parameters - INPUT FORMAT (3).csv b/sims/AstraSim/frontend/Astra-Sim Parameters - INPUT FORMAT (3).csv new file mode 100644 index 00000000..7640e176 --- /dev/null +++ b/sims/AstraSim/frontend/Astra-Sim Parameters - INPUT FORMAT (3).csv @@ -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 \ No newline at end of file diff --git a/sims/AstraSim/frontend/parameter_knobs.py b/sims/AstraSim/frontend/parameter_knobs.py new file mode 100644 index 00000000..daaf6aca --- /dev/null +++ b/sims/AstraSim/frontend/parameter_knobs.py @@ -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')} \ No newline at end of file diff --git a/sims/AstraSim/frontend/parameter_specs.csv b/sims/AstraSim/frontend/parameter_specs.csv index 7c16d18a..ef25cb39 100644 --- a/sims/AstraSim/frontend/parameter_specs.csv +++ b/sims/AstraSim/frontend/parameter_specs.csv @@ -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,, \ No newline at end of file +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 \ No newline at end of file diff --git a/sims/AstraSim/frontend/parse_parameter_specs.py b/sims/AstraSim/frontend/parse_parameter_specs.py index c88fdb75..a1576d33 100644 --- a/sims/AstraSim/frontend/parse_parameter_specs.py +++ b/sims/AstraSim/frontend/parse_parameter_specs.py @@ -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__) @@ -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:")