From 107c470356e76dff780c5cf197a376d5667097b8 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Wed, 15 May 2019 15:31:20 +0200 Subject: CSV file generation for benches (only binary_search for now) --- test/monniaux/benches.list | 2 -- test/monniaux/binary_search/make.proto | 1 + test/monniaux/build_benches.sh | 9 +++++++++ test/monniaux/generate_makefiles.sh | 1 + test/monniaux/genmake.py | 24 ++++++++++++++++++++++-- test/monniaux/run_benches.sh | 23 +++++++++++++++++++++++ test/monniaux/run_makefiles.sh | 9 --------- 7 files changed, 56 insertions(+), 13 deletions(-) delete mode 100644 test/monniaux/benches.list create mode 100755 test/monniaux/build_benches.sh create mode 100755 test/monniaux/run_benches.sh delete mode 100755 test/monniaux/run_makefiles.sh (limited to 'test') 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/build_benches.sh b/test/monniaux/build_benches.sh new file mode 100755 index 00000000..02123665 --- /dev/null +++ b/test/monniaux/build_benches.sh @@ -0,0 +1,9 @@ + +source benches.sh + +rm -f commands.txt +for bench in $benches; do + echo "(cd $bench && make -j5 $1)" >> commands.txt +done + +cat commands.txt | xargs -n1 -I{} -P4 bash -c '{}' 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" diff --git a/test/monniaux/run_makefiles.sh b/test/monniaux/run_makefiles.sh deleted file mode 100755 index 02123665..00000000 --- a/test/monniaux/run_makefiles.sh +++ /dev/null @@ -1,9 +0,0 @@ - -source benches.sh - -rm -f commands.txt -for bench in $benches; do - echo "(cd $bench && make -j5 $1)" >> commands.txt -done - -cat commands.txt | xargs -n1 -I{} -P4 bash -c '{}' -- cgit