aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorCyril SIX <cyril.six@kalray.eu>2019-05-15 15:31:20 +0200
committerCyril SIX <cyril.six@kalray.eu>2019-05-15 15:32:11 +0200
commit107c470356e76dff780c5cf197a376d5667097b8 (patch)
treeab902ee89df7815a838932d5819f1f35559b2e93 /test
parenteac500b866318661b509eb96eb3e12183f73895c (diff)
downloadcompcert-kvx-107c470356e76dff780c5cf197a376d5667097b8.tar.gz
compcert-kvx-107c470356e76dff780c5cf197a376d5667097b8.zip
CSV file generation for benches (only binary_search for now)
Diffstat (limited to 'test')
-rw-r--r--test/monniaux/benches.list2
-rw-r--r--test/monniaux/binary_search/make.proto1
-rwxr-xr-xtest/monniaux/build_benches.sh (renamed from test/monniaux/run_makefiles.sh)0
-rwxr-xr-xtest/monniaux/generate_makefiles.sh1
-rwxr-xr-xtest/monniaux/genmake.py24
-rwxr-xr-xtest/monniaux/run_benches.sh23
6 files changed, 47 insertions, 4 deletions
diff --git a/test/monniaux/benches.list b/test/monniaux/benches.list
deleted file mode 100644
index ff62dd4e..00000000
--- a/test/monniaux/benches.list
+++ /dev/null
@@ -1,2 +0,0 @@
- binary_search bitslicedaes bitslicedtea complex float_mat glibc_qsort heapsort idea number_theoretic_transform quicksort sha2 taclebenchlift taclebenchpowerwindow ternary too_slow
-
diff --git a/test/monniaux/binary_search/make.proto b/test/monniaux/binary_search/make.proto
index 69f04092..c5c39a6b 100644
--- a/test/monniaux/binary_search/make.proto
+++ b/test/monniaux/binary_search/make.proto
@@ -1 +1,2 @@
target: binary_search
+measures: ["random fill", "search1"]
diff --git a/test/monniaux/run_makefiles.sh b/test/monniaux/build_benches.sh
index 02123665..02123665 100755
--- a/test/monniaux/run_makefiles.sh
+++ b/test/monniaux/build_benches.sh
diff --git a/test/monniaux/generate_makefiles.sh b/test/monniaux/generate_makefiles.sh
index 14a6bd92..1c05538f 100755
--- a/test/monniaux/generate_makefiles.sh
+++ b/test/monniaux/generate_makefiles.sh
@@ -5,3 +5,4 @@ source benches.sh
for bench in $benches; do
./genmake.py $bench/make.proto > $bench/Makefile
done
+
diff --git a/test/monniaux/genmake.py b/test/monniaux/genmake.py
index c0fe0d05..80ef53e3 100755
--- a/test/monniaux/genmake.py
+++ b/test/monniaux/genmake.py
@@ -42,6 +42,7 @@ basename = settings["target"]
objdeps = settings["objdeps"] if "objdeps" in settings else []
intro = settings["intro"] if "intro" in settings else ""
sources = settings["sources"] if "sources" in settings else None
+measures = settings["measures"] if "measures" in settings else []
if sources:
intro += "\nsrc=" + sources
@@ -77,6 +78,22 @@ def print_rule(env, optim):
print(" {compiler} {flags} $+ -o $@"
.format(compiler = env.compiler.full, flags = optim.full))
+def make_env_list(envs):
+ return ",".join([(env.compiler.short + ((" " + optim.short) if optim.short != "" else "") + " " + env.target)
+ for env in environments
+ for optim in env.optimizations])
+
+def print_measure_rule(environments, measures):
+ print("measures.csv: $(PRODUCTS_OUT)")
+ print(' echo ", {}" > $@'.format(make_env_list(environments)))
+ for measure in measures:
+ print(' echo "{name} {measure}"'.format(name=basename, measure=measure), 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="")
+ print('>> $@')
+
products = []
for env in environments:
for optim in env.optimizations:
@@ -93,7 +110,7 @@ PRODUCTS_OUT=$(addsuffix .out,$(PRODUCTS))
all: $(PRODUCTS)
.PHONY:
-exec: $(PRODUCTS_OUT)
+exec: measures.csv
""".format(intro=intro, prod=" ".join(products)))
@@ -101,8 +118,11 @@ for env in environments:
for optim in env.optimizations:
print_rule(env, optim)
+print_measure_rule(environments, measures)
+
+
print("""
.PHONY:
clean:
- rm -f *.o *.s *.k1c
+ rm -f *.o *.s *.k1c *.csv
""")
diff --git a/test/monniaux/run_benches.sh b/test/monniaux/run_benches.sh
new file mode 100755
index 00000000..9537f63a
--- /dev/null
+++ b/test/monniaux/run_benches.sh
@@ -0,0 +1,23 @@
+
+source benches.sh
+
+rm -f commands.txt
+for bench in $benches; do
+ echo "(cd $bench && make -j5 exec)" >> commands.txt
+done
+
+cat commands.txt | xargs -n1 -I{} -P4 bash -c '{}'
+
+##
+# Gather all the CSV files
+##
+
+benches_csv=""
+for bench in $benches; do
+ if [ -f $bench/measures.csv ]; then
+ benches_csv="$benches_csv $bench/measures.csv"
+ fi
+done
+
+nawk 'FNR==1 && NR!=1{next;}{print}' $benches_csv > measures.csv
+echo "measures.csv done"