aboutsummaryrefslogtreecommitdiffstats
path: root/test/monniaux
diff options
context:
space:
mode:
authorDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2019-05-20 13:55:22 +0200
committerDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2019-05-20 13:55:22 +0200
commitad6ff26beeb42b0e34a95939baa6d41b369e5d56 (patch)
tree17523284ca77e80c511020f82855e8ca574388d0 /test/monniaux
parent49fb3d48812d18d3f5c2fdd8d85be8116e59c684 (diff)
parent9f58c4419596fbab69c8fe25c3d51e66acb613d0 (diff)
downloadcompcert-kvx-ad6ff26beeb42b0e34a95939baa6d41b369e5d56.tar.gz
compcert-kvx-ad6ff26beeb42b0e34a95939baa6d41b369e5d56.zip
Merge remote-tracking branch 'origin/mppa-work' into mppa-fast-div
Diffstat (limited to 'test/monniaux')
-rw-r--r--test/monniaux/binary_search/make.proto2
-rw-r--r--test/monniaux/bitsliced-aes/make.proto2
-rw-r--r--test/monniaux/bitsliced-tea/make.proto2
-rw-r--r--test/monniaux/complex/make.proto2
-rw-r--r--test/monniaux/float_mat/float_mat_run.c16
-rw-r--r--test/monniaux/float_mat/make.proto1
-rwxr-xr-xtest/monniaux/gengraphs.py89
-rwxr-xr-xtest/monniaux/genmake.py18
-rw-r--r--test/monniaux/glibc_qsort/glibc_qsort_run.c2
-rw-r--r--test/monniaux/glibc_qsort/make.proto1
-rw-r--r--test/monniaux/heapsort/heapsort_run.c2
-rw-r--r--test/monniaux/heapsort/make.proto1
-rw-r--r--test/monniaux/idea/make.proto1
-rw-r--r--test/monniaux/number_theoretic_transform/make.proto1
-rw-r--r--test/monniaux/quicksort/make.proto1
-rw-r--r--test/monniaux/quicksort/quicksort_run.c2
-rwxr-xr-xtest/monniaux/run_benches.sh3
-rw-r--r--test/monniaux/sha-2/make.proto1
-rw-r--r--test/monniaux/sha-2/sha-256_run.c2
-rw-r--r--test/monniaux/tacle-bench-lift/make.proto1
-rw-r--r--test/monniaux/tacle-bench-powerwindow/make.proto1
-rw-r--r--test/monniaux/ternary/make.proto1
-rw-r--r--test/monniaux/ternary/ternary.c2
-rw-r--r--test/monniaux/too_slow/make.proto2
24 files changed, 133 insertions, 23 deletions
diff --git a/test/monniaux/binary_search/make.proto b/test/monniaux/binary_search/make.proto
index c5c39a6b..337751bb 100644
--- a/test/monniaux/binary_search/make.proto
+++ b/test/monniaux/binary_search/make.proto
@@ -1,2 +1,2 @@
target: binary_search
-measures: ["random fill", "search1"]
+measures: ["random fill", search1]
diff --git a/test/monniaux/bitsliced-aes/make.proto b/test/monniaux/bitsliced-aes/make.proto
index 5fb11e5f..8a9a1bff 100644
--- a/test/monniaux/bitsliced-aes/make.proto
+++ b/test/monniaux/bitsliced-aes/make.proto
@@ -1,4 +1,4 @@
sources: "$(wildcard *.c) tests/tests.c"
target: test
-measures: ["cycles"]
+measures: [cycles]
name: bitsliced-aes
diff --git a/test/monniaux/bitsliced-tea/make.proto b/test/monniaux/bitsliced-tea/make.proto
index 09113280..6cdc0814 100644
--- a/test/monniaux/bitsliced-tea/make.proto
+++ b/test/monniaux/bitsliced-tea/make.proto
@@ -1,4 +1,4 @@
objdeps: [{name: bstea_run, compiler: gcc}]
target: bstea
name: bitsliced-tea
-measures: ["cycles"]
+measures: [cycles]
diff --git a/test/monniaux/complex/make.proto b/test/monniaux/complex/make.proto
index b959c611..8870f311 100644
--- a/test/monniaux/complex/make.proto
+++ b/test/monniaux/complex/make.proto
@@ -1,2 +1,2 @@
target: complex_mat
-measures: ["c1_time"]
+measures: [[c1_time, c1]]
diff --git a/test/monniaux/float_mat/float_mat_run.c b/test/monniaux/float_mat/float_mat_run.c
index 5d34bb70..329648c2 100644
--- a/test/monniaux/float_mat/float_mat_run.c
+++ b/test/monniaux/float_mat/float_mat_run.c
@@ -93,14 +93,14 @@ int main() {
"c1==c6: %s\n"
"c1==c7: %s\n"
"c1==c8: %s\n"
- "c1_time = %" PRIu64 "\n"
- "c2_time = %" PRIu64 "\n"
- "c3_time = %" PRIu64 "\n"
- "c4_time = %" PRIu64 "\n"
- "c5_time = %" PRIu64 "\n"
- "c6_time = %" PRIu64 "\n"
- "c7_time = %" PRIu64 "\n"
- "c8_time = %" PRIu64 "\n",
+ "c1_time : %" PRIu64 "\n"
+ "c2_time : %" PRIu64 "\n"
+ "c3_time : %" PRIu64 "\n"
+ "c4_time : %" PRIu64 "\n"
+ "c5_time : %" PRIu64 "\n"
+ "c6_time : %" PRIu64 "\n"
+ "c7_time : %" PRIu64 "\n"
+ "c8_time : %" PRIu64 "\n",
REAL_mat_equal(m, n, c1, p, c2, p)?"true":"false",
REAL_mat_equal(m, n, c1, p, c3, p)?"true":"false",
diff --git a/test/monniaux/float_mat/make.proto b/test/monniaux/float_mat/make.proto
index 3628afbb..ebdd8930 100644
--- a/test/monniaux/float_mat/make.proto
+++ b/test/monniaux/float_mat/make.proto
@@ -1,2 +1,3 @@
objdeps: [{name: float_mat_run, compiler: gcc}]
target: float_mat
+measures: [[c2_time, c2]]
diff --git a/test/monniaux/gengraphs.py b/test/monniaux/gengraphs.py
new file mode 100755
index 00000000..2455c285
--- /dev/null
+++ b/test/monniaux/gengraphs.py
@@ -0,0 +1,89 @@
+#!/usr/bin/python3.6
+
+import numpy as np
+import matplotlib.pyplot as plt
+import pandas as pd
+import sys
+
+##
+# Reading data
+##
+
+if len(sys.argv) != 2:
+ raise Exception("Only 1 argument should be given to this script: the make.proto file")
+csv_file = sys.argv[1]
+
+with open(csv_file, "r") as f:
+ df = pd.read_csv(csv_file)
+
+benches = df["benches"]
+print(benches[0])
+
+host_measures_cols = [col for col in df if "host" in col]
+k1c_measures_cols = [col for col in df if "k1c" in col]
+
+colors = ["forestgreen", "darkorange", "cornflowerblue", "darkorchid", "darksalmon", "dodgerblue", "navy", "gray", "springgreen", "crimson"]
+
+##
+# Generating PDF
+##
+
+def extract_envs(keys):
+ envs = []
+ for key in keys:
+ words = key.split()[:-1]
+ envs.append(" ".join(words))
+ return envs
+
+
+def subdivide_interv(inf, sup, n):
+ return [inf + k*(sup-inf)/n for k in range(n)]
+
+
+def generate_file(f, cols):
+ ind = np.arange(len(df[cols[0]]))
+
+ width = 0.35 # the width of the bars
+
+ envs = extract_envs(cols)
+ start_inds = subdivide_interv(ind, ind+width, len(envs))
+
+ fig, ax = plt.subplots()
+ rects = []
+ for i, env in enumerate(envs):
+ for col in cols:
+ if env in col:
+ break
+ rects.append(ax.bar(start_inds[i], df[col], width, color=colors[i], label=env))
+
+ # Add some text for labels, title and custom x-axis tick labels, etc.
+ ax.set_ylabel('Cycles')
+ ax.set_title('TITLE')
+ ax.set_xticks(ind)
+ ax.set_xticklabels(benches)
+ ax.legend()
+
+ def autolabel(rects, xpos='center'):
+ """
+ Attach a text label above each bar in *rects*, displaying its height.
+
+ *xpos* indicates which side to place the text w.r.t. the center of
+ the bar. It can be one of the following {'center', 'right', 'left'}.
+ """
+
+ xpos = xpos.lower() # normalize the case of the parameter
+ ha = {'center': 'center', 'right': 'left', 'left': 'right'}
+ offset = {'center': 0.5, 'right': 0.57, 'left': 0.43} # x_txt = x + w*off
+
+ for rect in rects:
+ height = rect.get_height()
+ ax.text(rect.get_x() + rect.get_width()*offset[xpos], 1.01*height,
+ '{}'.format(height), ha=ha[xpos], va='bottom')
+
+ for rect in rects:
+ autolabel(rect)
+
+ plt.savefig(f)
+
+generate_file("measures-host.pdf", host_measures_cols)
+#generate_file("measures-k1c.pdf", k1c_measures_cols)
diff --git a/test/monniaux/genmake.py b/test/monniaux/genmake.py
index ddbdf839..ad460b14 100755
--- a/test/monniaux/genmake.py
+++ b/test/monniaux/genmake.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python3.4
+#!/usr/bin/python3.6
""" Custom Makefile generator
@@ -26,7 +26,7 @@ gcc_k1c = Env(compiler = Compiler("gcc", "$(K1C_CC)"), optimizations = [Optim(""
ccomp_x86 = Env(compiler = Compiler("ccomp", "$(CCOMP)"), optimizations = [Optim("", "$(CCOMPFLAGS)")], target = "host")
ccomp_k1c = Env(compiler = Compiler("ccomp", "$(K1C_CCOMP)"), optimizations = [Optim("", "$(K1C_CCOMPFLAGS)")], target = "k1c")
-environments = [gcc_x86, gcc_k1c, ccomp_x86, ccomp_k1c]
+environments = [gcc_x86, ccomp_x86, gcc_k1c, ccomp_k1c]
##
# Argument parsing
@@ -36,7 +36,7 @@ if len(sys.argv) != 2:
yaml_file = sys.argv[1]
with open(yaml_file, "r") as f:
- settings = yaml.load(f.read())
+ settings = yaml.load(f.read(), Loader=yaml.FullLoader)
basename = settings["target"]
objdeps = settings["objdeps"] if "objdeps" in settings else []
@@ -86,13 +86,19 @@ def make_env_list(envs):
def print_measure_rule(environments, measures):
print("measures.csv: $(PRODUCTS_OUT)")
- print(' echo ", {}" > $@'.format(make_env_list(environments)))
+ print(' echo "benches, {}" > $@'.format(make_env_list(environments)))
for measure in measures:
- print(' echo "{name} {measure}"'.format(name=basename if not name else name, measure=measure if len(measures) > 1 else ""), end="")
+ display_measure_name = (len(measures) > 1)
+ if isinstance(measure, list):
+ measure_name, measure_short = measure
+ display_measure_name = True
+ else:
+ measure_name = measure_short = measure
+ print(' echo "{name} {measure}"'.format(name=basename if not name else name, measure=measure_short if display_measure_name else ""), end="")
for env in environments:
for optim in env.optimizations:
print(", $$(grep '{measure}' {outfile} | cut -d':' -f2)".format(
- measure=measure, outfile=make_product(env, optim) + ".out"), end="")
+ measure=measure_name, outfile=make_product(env, optim) + ".out"), end="")
print('>> $@')
products = []
diff --git a/test/monniaux/glibc_qsort/glibc_qsort_run.c b/test/monniaux/glibc_qsort/glibc_qsort_run.c
index 92bfba4e..7fcb8130 100644
--- a/test/monniaux/glibc_qsort/glibc_qsort_run.c
+++ b/test/monniaux/glibc_qsort/glibc_qsort_run.c
@@ -41,7 +41,7 @@ int main (void) {
quicksort(vec, len, sizeof(data), data_compare, NULL);
quicksort_time = get_cycle() - quicksort_time;
printf("sorted=%s\n"
- "quicksort_time=%" PRIu64 "\n",
+ "quicksort_time:%" PRIu64 "\n",
data_vec_is_sorted(vec, len)?"true":"false",
quicksort_time);
free(vec);
diff --git a/test/monniaux/glibc_qsort/make.proto b/test/monniaux/glibc_qsort/make.proto
index d89f9ea4..763e77f5 100644
--- a/test/monniaux/glibc_qsort/make.proto
+++ b/test/monniaux/glibc_qsort/make.proto
@@ -1,2 +1,3 @@
objdeps: [{name: glibc_qsort_run, compiler: gcc}]
target: glibc_qsort
+measures: [quicksort_time]
diff --git a/test/monniaux/heapsort/heapsort_run.c b/test/monniaux/heapsort/heapsort_run.c
index 76378067..053822a3 100644
--- a/test/monniaux/heapsort/heapsort_run.c
+++ b/test/monniaux/heapsort/heapsort_run.c
@@ -13,7 +13,7 @@ int main (void) {
heapsort(vec, len);
heapsort_time = get_cycle() - heapsort_time;
printf("sorted=%s\n"
- "heapsort_time=%" PRIu64 "\n",
+ "heapsort_time:%" PRIu64 "\n",
data_vec_is_sorted(vec, len)?"true":"false",
heapsort_time);
free(vec);
diff --git a/test/monniaux/heapsort/make.proto b/test/monniaux/heapsort/make.proto
index edbf0efd..0b5972d6 100644
--- a/test/monniaux/heapsort/make.proto
+++ b/test/monniaux/heapsort/make.proto
@@ -1,2 +1,3 @@
objdeps: [{name: heapsort_run, compiler: gcc}]
target: heapsort
+measures: [heapsort_time]
diff --git a/test/monniaux/idea/make.proto b/test/monniaux/idea/make.proto
index b633a3be..0e147514 100644
--- a/test/monniaux/idea/make.proto
+++ b/test/monniaux/idea/make.proto
@@ -1 +1,2 @@
target: idea
+measures: [cycles]
diff --git a/test/monniaux/number_theoretic_transform/make.proto b/test/monniaux/number_theoretic_transform/make.proto
index 2d3c7144..e1844226 100644
--- a/test/monniaux/number_theoretic_transform/make.proto
+++ b/test/monniaux/number_theoretic_transform/make.proto
@@ -1 +1,2 @@
target: ntt
+measures: [cycles]
diff --git a/test/monniaux/quicksort/make.proto b/test/monniaux/quicksort/make.proto
index 4af771e5..fe2f906b 100644
--- a/test/monniaux/quicksort/make.proto
+++ b/test/monniaux/quicksort/make.proto
@@ -1,2 +1,3 @@
objdeps: [{name: quicksort_run, compiler: gcc}]
target: quicksort
+measures: [quicksort_time]
diff --git a/test/monniaux/quicksort/quicksort_run.c b/test/monniaux/quicksort/quicksort_run.c
index f9e1b871..88747d17 100644
--- a/test/monniaux/quicksort/quicksort_run.c
+++ b/test/monniaux/quicksort/quicksort_run.c
@@ -13,7 +13,7 @@ int main (void) {
quicksort(vec, len);
quicksort_time = get_cycle() - quicksort_time;
printf("sorted=%s\n"
- "quicksort_time=%" PRIu64 "\n",
+ "quicksort_time:%" PRIu64 "\n",
data_vec_is_sorted(vec, len)?"true":"false",
quicksort_time);
free(vec);
diff --git a/test/monniaux/run_benches.sh b/test/monniaux/run_benches.sh
index 4db4b5a2..479d09eb 100755
--- a/test/monniaux/run_benches.sh
+++ b/test/monniaux/run_benches.sh
@@ -21,3 +21,6 @@ done
nawk 'FNR==1 && NR!=1{next;}{print}' $benches_csv > measures.csv
echo "measures.csv done"
+
+./gengraphs.py measures.csv
+echo "Graphs done"
diff --git a/test/monniaux/sha-2/make.proto b/test/monniaux/sha-2/make.proto
index e96fee7d..f776565e 100644
--- a/test/monniaux/sha-2/make.proto
+++ b/test/monniaux/sha-2/make.proto
@@ -1,2 +1,3 @@
objdeps: [{name: sha-256_run, compiler: gcc}]
target: sha-256
+measures: ["total cycles"]
diff --git a/test/monniaux/sha-2/sha-256_run.c b/test/monniaux/sha-2/sha-256_run.c
index c3865991..05a69d6b 100644
--- a/test/monniaux/sha-2/sha-256_run.c
+++ b/test/monniaux/sha-2/sha-256_run.c
@@ -280,6 +280,6 @@ int main(void)
}
}
destruct_binary_messages();
- printf("total cycles = %" PRIu64 "\n", cycle_total);
+ printf("total cycles : %" PRIu64 "\n", cycle_total);
return 0;
}
diff --git a/test/monniaux/tacle-bench-lift/make.proto b/test/monniaux/tacle-bench-lift/make.proto
index 58dd5c39..c4849bab 100644
--- a/test/monniaux/tacle-bench-lift/make.proto
+++ b/test/monniaux/tacle-bench-lift/make.proto
@@ -1,3 +1,4 @@
intro: "ALL_CFLAGS = -include kill_pragma.h"
objdeps: [{name: liftlibcontrol, compiler: both}, {name: liftlibio, compiler: both}]
target: lift
+measures: [cycles]
diff --git a/test/monniaux/tacle-bench-powerwindow/make.proto b/test/monniaux/tacle-bench-powerwindow/make.proto
index 3d1ad1e5..21e07941 100644
--- a/test/monniaux/tacle-bench-powerwindow/make.proto
+++ b/test/monniaux/tacle-bench-powerwindow/make.proto
@@ -5,3 +5,4 @@ objdeps: [{name: powerwindow_const_params, compiler: both}, {name: powerwindow_c
{name: powerwindow_PW_Control_PSG_BackL, compiler: both}, {name: powerwindow_PW_Control_PSG_BackR, compiler: both},
{name: powerwindow_PW_Control_PSG_Front, compiler: both}]
target: powerwindow
+measures: [cycles]
diff --git a/test/monniaux/ternary/make.proto b/test/monniaux/ternary/make.proto
index c5219f1c..1568ed07 100644
--- a/test/monniaux/ternary/make.proto
+++ b/test/monniaux/ternary/make.proto
@@ -1 +1,2 @@
target: ternary
+measures: [cycles]
diff --git a/test/monniaux/ternary/ternary.c b/test/monniaux/ternary/ternary.c
index ed7de156..e8813a5c 100644
--- a/test/monniaux/ternary/ternary.c
+++ b/test/monniaux/ternary/ternary.c
@@ -19,6 +19,6 @@ int main() {
clock_start();
data result = silly_computation();
clock_stop();
- printf("result=%" PRIu32 "\ncycles=%" PRIu64 "\n", result, get_total_clock());
+ printf("result=%" PRIu32 "\ncycles:%" PRIu64 "\n", result, get_total_clock());
return 0;
}
diff --git a/test/monniaux/too_slow/make.proto b/test/monniaux/too_slow/make.proto
index a7b0b37d..852971fc 100644
--- a/test/monniaux/too_slow/make.proto
+++ b/test/monniaux/too_slow/make.proto
@@ -1 +1,3 @@
target: memset_from_bitsliced-aes
+measures: [cycles]
+name: memset-aes