Browse Source

All set for the experiments

Román Cárdenas 3 years ago
parent
commit
0bbaae6da6
2 changed files with 22 additions and 7 deletions
  1. 16 0
      annsim2023.py
  2. 6 7
      devstone_comparative.py

+ 16 - 0
annsim2023.py

@@ -0,0 +1,16 @@
+import subprocess
+
+
+if __name__ == '__main__':
+    a = "adevs,xdevs-c,xdevs-cpp,xdevs-rs,xdevs-java-sequential"
+    models = [['LI', 'HI', 'HO'], ['HOmod']]
+    sizes = [list(range(20, 401, 20)), list(range(10, 101, 10))]
+    p = []
+    for i, models in enumerate(models):
+        p.extend([f'{m}-{w}-{d}-0-0' for m in models for w in sizes[i] for d in sizes[i]])
+    p = ','.join(p)
+    n = 30
+    o = "annsim2023.csv"
+
+    cmd = f"python3 devstone_comparative.py -a {a} -p {p} -n {n} -o {o}"
+    subprocess.run(cmd.split())

+ 6 - 7
devstone_comparative.py

@@ -68,7 +68,7 @@ def parse_args():
     parser.add_argument('-a', '--include_engines', help='Add specific engines to perform the comparative')
     parser.add_argument('-r', '--exclude_engines', help='Exclude specific engines from the comparative')
     parser.add_argument('-o', '--out-file', help='Output file path')
-    parser.add_argument('-p', '--params', help='Specify params in a condensed form: d1-w1-ic1-ec1, d2-w2-ic2-ec2...')
+    parser.add_argument('-p', '--params', help='Specify params in a condensed form: w1-d1-ic1-ec1, w2-d2-ic2-ec2...')
 
     args = parser.parse_args()
 
@@ -77,14 +77,13 @@ def parse_args():
     else:
         args.model_types = list(DEFAULT_MODEL_TYPES)
 
-    params = []
     if args.params:
         params = [x.strip().split("-") for x in args.params.split(",")]
         # args.params = [x.strip().split("-") for x in args.params.split(",")]
     elif args.depth and args.width:
         int_cycles = args.int_cycles or 0
         ext_cycles = args.ext_cycles or 0
-        params = [(args.depth, args.width, int_cycles, ext_cycles)]
+        params = [(args.width, args.depth, int_cycles, ext_cycles)]
         # args.params = ((args.depth, args.width, int_cycles, ext_cycles),)
     else:
         params = list(DEFAULT_PARAMS)
@@ -177,7 +176,7 @@ def execute_cmd(cmd, regex, csv_writer):
 
     # Write results into output file
     row = (
-    engine, i_exec, model_type, depth, width, int_cycles, ext_cycles, model_time, engine_time, sim_time, total_time)
+    engine, i_exec, model_type, width, depth, int_cycles, ext_cycles, model_time, engine_time, sim_time, total_time)
     csv_writer.writerow(row)
 
 
@@ -191,13 +190,13 @@ if __name__ == "__main__":
 
     with open(args.out_file, "w") as csv_file:
         csv_writer = csv.writer(csv_file, delimiter=';')
-        csv_writer.writerow(("engine", "iter", "model", "depth", "width", "int_delay", "ext_delay", "model_time", "runner_time", "sim_time", "total_time"))
+        csv_writer.writerow(("engine", "iter", "model", "width", "depth", "int_delay", "ext_delay", "model_time", "runner_time", "sim_time", "total_time"))
 
         for engine, engine_cmd in args.commands.items():
             engine_regex = args.regex[engine]
             for params in args.params:
-                model_type, depth, width, int_cycles, ext_cycles = params
-                engine_cmd_f = engine_cmd.format(model_type=model_type, depth=depth, width=width,
+                model_type, width, depth, int_cycles, ext_cycles = params
+                engine_cmd_f = engine_cmd.format(model_type=model_type, width=width, depth=depth,
                                                  int_cycles=int_cycles, ext_cycles=ext_cycles)
                 if not engine_cmd_f:
                     continue