diff options
author | Cedric Nugteren <web@cedricnugteren.nl> | 2018-04-10 21:18:11 +0200 |
---|---|---|
committer | Cedric Nugteren <web@cedricnugteren.nl> | 2018-04-10 21:18:11 +0200 |
commit | 3fbbb811375928305c5943d8bd7fa65e4a6a628f (patch) | |
tree | 313ecf6beba336c27246da7f6b58255efc655318 /scripts | |
parent | 77ba11f686a27ef6e3f3c9472b91299051ce71e5 (diff) |
Fixed a bug in the compression part of the database script
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/database/database/clblast.py | 2 | ||||
-rw-r--r-- | scripts/database/database/io.py | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/scripts/database/database/clblast.py b/scripts/database/database/clblast.py index f535f1ba..86444f68 100644 --- a/scripts/database/database/clblast.py +++ b/scripts/database/database/clblast.py @@ -185,7 +185,7 @@ def print_cpp_database(database, output_dir): for example_data in precision_database: for example_result in example_data["results"]: parameter_names.extend([str(k) for k in example_result["parameters"].keys()]) - parameter_names = sorted(set(parameter_names)) + parameter_names = sorted(list(set(parameter_names))) parameter_names_as_string = ", ".join(['"%s"' % p for p in parameter_names]) f.write(", {" + parameter_names_as_string + "}, {\n") diff --git a/scripts/database/database/io.py b/scripts/database/database/io.py index 29d47591..b66f18b1 100644 --- a/scripts/database/database/io.py +++ b/scripts/database/database/io.py @@ -45,14 +45,14 @@ def compress_database(database): new_section = {} for field in section: if field == "results": - parameter_names = [result["parameters"].keys() for result in section["results"]] + parameter_names = [sorted(result["parameters"].keys()) for result in section["results"]] assert len(list(set([" ".join(p) for p in parameter_names]))) == 1 - new_section["parameter_names"] = parameter_names[0] # they are all be the same - new_results = [[",".join([str(v) for v in result["parameters"].values()]), + new_section["parameter_names"] = parameter_names[0] # they are all the same + new_results = [[",".join([str(result["parameters"][p]) for p in new_section["parameter_names"]]), result["time"]] for result in section["results"]] new_section[field] = new_results - else: + elif field != "parameter_names": new_section[field] = section[field] new_sections.append(new_section) return {"sections": new_sections} |