From 1ab9e28d9df7e4981a93e3b56b9168d01e7dc980 Mon Sep 17 00:00:00 2001 From: Tom Tseng Date: Fri, 10 Dec 2021 19:57:54 +0000 Subject: [PATCH] SCAN/IndexBased: Fix summarize_results.py by using absolute path --- .../experiments/summarize_results.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/benchmarks/SCAN/IndexBased/experiments/summarize_results.py b/benchmarks/SCAN/IndexBased/experiments/summarize_results.py index f21c981cc..fed983b38 100644 --- a/benchmarks/SCAN/IndexBased/experiments/summarize_results.py +++ b/benchmarks/SCAN/IndexBased/experiments/summarize_results.py @@ -11,15 +11,14 @@ import itertools import os -input_directory = os.path.expanduser("~/scan-experiment-results") -output_directory = input_directory + "/summary" -if not os.path.exists(output_directory): - os.makedirs(output_directory) - +INPUT_DIRECTORY = os.path.expanduser("~/scan-experiment-results") +OUTPUT_DIRECTORY = INPUT_DIRECTORY + "/summary" +if not os.path.exists(OUTPUT_DIRECTORY): + os.makedirs(OUTPUT_DIRECTORY) def get_all_data(): all_data = [] - for filename in os.listdir(input_directory): + for filename in os.listdir(INPUT_DIRECTORY): if not filename.endswith(".txt"): continue split_filename = filename[:-4].split("-") @@ -27,6 +26,7 @@ def get_all_data(): print("ignoring file " + filename) continue + path = INPUT_DIRECTORY + "/" + filename graph = split_filename[0] is_mkl = len(split_filename) >= 3 and split_filename[2] == "mkl" is_serial = split_filename[-1] == "serial" @@ -37,7 +37,7 @@ def get_all_data(): if is_serial: algorithm += "_1-thread" - with open(filename, newline="") as csvfile: + with open(path, newline="") as csvfile: truncated_file = itertools.dropwhile( lambda line: not line.startswith("BEGIN GBBS EXPERIMENTS OUTPUT"), csvfile, @@ -49,7 +49,7 @@ def get_all_data(): row["algorithm"] = algorithm all_data.append(dict(row)) elif split_filename[1] == "pp": - with open(filename, newline="") as csvfile: + with open(path, newline="") as csvfile: reader = csv.DictReader(csvfile) for row in reader: row["graph"] = graph @@ -77,7 +77,7 @@ def get_all_data(): def write_summary(filename, rows): - with open(output_directory + "/" + filename, "w", newline="") as csvfile: + with open(OUTPUT_DIRECTORY + "/" + filename, "w", newline="") as csvfile: writer = csv.DictWriter(csvfile, fieldnames=FIELD_NAMES) writer.writeheader() for row in rows: