diff options
author | Cyril SIX <cyril.six@kalray.eu> | 2019-07-11 11:54:32 +0200 |
---|---|---|
committer | Cyril SIX <cyril.six@kalray.eu> | 2019-07-11 11:54:32 +0200 |
commit | 862235699034fdde439a336fa919a1b0a45fa900 (patch) | |
tree | b7b0fd68fdd4703e00c54145278638d18ccaabac /test | |
parent | 258946400bd2617074455787ee10c5bd5a9f27bd (diff) | |
download | compcert-kvx-862235699034fdde439a336fa919a1b0a45fa900.tar.gz compcert-kvx-862235699034fdde439a336fa919a1b0a45fa900.zip |
Removing the gencompile and gengraphs scripts (now in These6)
Diffstat (limited to 'test')
-rwxr-xr-x | test/monniaux/gencompile.py | 47 | ||||
-rwxr-xr-x | test/monniaux/gengraphs.py | 100 |
2 files changed, 0 insertions, 147 deletions
diff --git a/test/monniaux/gencompile.py b/test/monniaux/gencompile.py deleted file mode 100755 index 89a49f8e..00000000 --- a/test/monniaux/gencompile.py +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/python3.5 - -import numpy as np # type: ignore -import matplotlib.pyplot as plt # type: ignore -import sys -from typing import * - -## -# Reading data -## - -if len(sys.argv) != 4: - raise Exception("Three arguments are expected: the verifier times, the oracle times, and the output PDF") -_, verifier_file, oracle_file, output_file = sys.argv - -def get_coords(filename: str) -> List[Tuple[int, float]]: - coords = [] - with open(filename, "r") as f: - for line in f: - nb_inst_s, time_s = line.split(":") - coords.append((int(nb_inst_s), float(time_s))) - return coords - -verifier_coords = get_coords(verifier_file) -oracle_coords = get_coords(oracle_file) - -## -# Generating PDF -## - -fig, ax = plt.subplots() - -def do_plot(coords: List[Tuple[int, float]], style: str, label: str, color: str): - x = [coord[0] for coord in coords] - y = [coord[1] for coord in coords] - plt.plot(x, y, style, label=label, color=color) - -plt.xscale("log") -plt.yscale("log") -do_plot(verifier_coords, "+", "Verifier", "gray") -do_plot(oracle_coords, "+", "Oracle", "black") - -ax.set_ylabel("Time x1000 (s)") -ax.set_xlabel("Size of basic blocks") -ax.legend() - -plt.savefig(output_file) diff --git a/test/monniaux/gengraphs.py b/test/monniaux/gengraphs.py deleted file mode 100755 index b1412e68..00000000 --- a/test/monniaux/gengraphs.py +++ /dev/null @@ -1,100 +0,0 @@ -#!/usr/bin/python3.5 - -import numpy as np # type: ignore -import matplotlib.pyplot as plt # type: ignore -import pandas as pd # type: ignore -import sys -from typing import * - -## -# Reading data -## - -if len(sys.argv) != 3: - raise Exception("Arguments for this script: the csv file, the base name of the output PDF file") -_, csv_file, output_basename = sys.argv - -with open(csv_file, "r") as f: - df = pd.read_csv(csv_file) - -benches = df["benches"] - -host_measures_cols = [col for col in df if "host" in col] -k1c_measures_cols = [col for col in df if "k1c" in col] - -## -# Generating PDF -## - -def extract_compiler(env: str) -> str: - words = env.split()[:-1] - return " ".join(words) - -def extract_compilers(envs: List[str]) -> List[str]: - compilers = [] - for env in envs: - compiler = extract_compiler(env) - if compiler not in compilers: - compilers.append(compiler) - return compilers - -def subdivide_interv(inf: Any, sup: float, n: int) -> List[float]: - return [inf + k*(sup-inf)/n for k in range(n)] - - -# df associates the environment string (e.g. "gcc host") to the cycles -# envs is the list of environments to compare -# The returned value will be a dictionnary associating the compiler (e.g. "gcc") to his relative comparison on the best result -def make_relative_heights(data: Dict[str, List[float]], envs: List[str]) -> Dict[str, List[float]]: - #n_benches: int = len(data["benches"]) - #cols: Dict[str, List[float]] = {extract_compiler(env):data[env] for env in envs} - n_benches = len(data["benches"]) - cols = {extract_compiler(env):data[env] for env in envs} - - #ret: Dict[str, List[float]] = {} - ret = {} - for compiler in cols: - ret[compiler] = [] - - for i in range(n_benches): - #maximum: float = max([cols[compiler][i] for compiler in cols]) - maximum = max([cols[compiler][i] for compiler in cols]) - for compiler in cols: - ret[compiler].append(cols[compiler][i] / float(maximum)) - - return ret - - -def generate_file(f: str, cols: List[str]) -> None: - ind = np.arange(len(df[cols[0]])) - compilers = extract_compilers(cols) - mingrey = .7 - greyscale = [i * mingrey / (len(compilers) - 1) for i in range(len(compilers))] - colors = [(gi, gi, gi) for gi in greyscale] - - width = (ind[1] - ind[0]) / (len(compilers) + 2) - - start_inds = subdivide_interv(ind, ind+len(compilers)*width, len(compilers)) - inverse_cycles = {key:[1./x if isinstance(x, int) else x for x in list(df[key])] for key in df.columns} - #heights: Dict[str, List[float]] = make_relative_heights(inverse_cycles, cols) - heights = make_relative_heights(inverse_cycles, cols) - - fig, ax = plt.subplots() - rects = [] - for i, compiler in enumerate(compilers): - rects.append(ax.bar(start_inds[i], heights[compiler], width, color=colors[i], label=compiler)) - - # Add some text for labels, title and custom x-axis tick labels, etc. - ax.set_ylabel('1/cycles (%)') - ax.set_yticklabels(['{:,.0%}'.format(x) for x in ax.get_yticks()]) - ax.set_xticks(ind) - ax.set_xticklabels(benches) - ax.legend(loc="lower left") - - plt.setp(ax.get_xticklabels(), rotation=30, horizontalalignment='right') - plt.xticks(size=5) - - plt.savefig(f) - -generate_file(output_basename + ".host.pdf", host_measures_cols) -generate_file(output_basename + ".k1c.pdf", k1c_measures_cols) |