|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r81380 - sandbox/variadic_templates/sandbox/slim/test
From: cppljevans_at_[hidden]
Date: 2012-11-17 00:31:11
Author: cppljevans
Date: 2012-11-17 00:31:06 EST (Sat, 17 Nov 2012)
New Revision: 81380
URL: http://svn.boost.org/trac/boost/changeset/81380
Log:
Simplified Makefile.
Used benchmark_prefix_name.py for common value
used by both Makefile and *_run.py.
Added:
sandbox/variadic_templates/sandbox/slim/test/benchmark_prefix_name.py (contents, props changed)
Text files modified:
sandbox/variadic_templates/sandbox/slim/test/Makefile | 174 ++++++---------------------------------
sandbox/variadic_templates/sandbox/slim/test/tuple_benchmark_run.py | 24 ++++-
2 files changed, 48 insertions(+), 150 deletions(-)
Modified: sandbox/variadic_templates/sandbox/slim/test/Makefile
==============================================================================
--- sandbox/variadic_templates/sandbox/slim/test/Makefile (original)
+++ sandbox/variadic_templates/sandbox/slim/test/Makefile 2012-11-17 00:31:06 EST (Sat, 17 Nov 2012)
@@ -1,145 +1,29 @@
-include tuple_benchmark.imk
-MAIN=tuple.benchmark.$(BENCHMARK)
-#MAIN=test
-#MAIN=tuple_constexpr.test
-MEASURE=time
-THISFILE=Makefile
-
-HOW=gcc4_8_20120624
-#HOW=gcc4_8v
-HOW=gcc4_8_20121028
-#HOW=clangxx_rel
-DIR.root := $(shell dirup_dir_file.pl $(PWD) root.imk)
-include $(DIR.root)/root.imk
-#include compiler_macros.imk
-
-HOWS=gcc4_8n clangxx
-
-SLIM_DIR=../slim/include
-#INCS:= -I$(SLIM_DIR) $(INCS)
-
-BFLAGS=-DTUPLE_SIZE=4 -DLAST_LESS=2 -DTUPLE_IMPL=vertical -DTUPLE_CHUNK=4
-BFNAME:=$(shell ./flags2filename.pl -S $(BFLAGS))
-PROF_BASE=$(MAIN).$(HOW).$(BFNAME)
-COMPILER.clangxx_ins-rt=$(PATH.llvm.top)/llvm/projects/compiler-rt
-
-.PHONY: bfname
-bfname:
- ./flags2filename.pl $(BFLAGS)
-
-.PHONY: compiler_help
-compiler_help:
- #$(COMPILER.$(HOW)) --help-hidden
- $(COMPILER.$(HOW)) --help|grep -e ' -time\| -print-stat'
-
-compiler.hashes3.out: $(MAIN).cpp
- $(COMPILE.$(HOW)) -S -### $(BFLAGS) $(MAIN).cpp 2> $@
-
-compiler.hashes3.cmd: compiler.hashes3.out
- #1) get just the compiler command line (tail -1 compiler.hashes3.out).
- #2) strip the double quote marks from the command line (s/\"//g).
- #3) send result to target (>$@)
- perl -e 'my $$args=join(" ",@ARGV);$$args=~s/\"//g;print $$args' `tail -1 compiler.hashes3`>$@
-
-gmon.out: compiler.hashes3.cmd
- @echo $<"="
- @cat $<
- @echo ""
- $(SHELL) compiler.hashes3.cmd
-
-gprof.out: gmon.out
- gprof $(COMPILER.$(HOW)) > gprof.out
-
-.PHONY: mv_gmon_gprof
-mv_gmon_gprof: gprof.out
- mv gmon.out $(PROF_BASE).gmon.out
- mv gprof.out $(PROF_BASE).gprof.out
-
-$(PROF_BASE).gprof.out: mv_gmon_gprof
-
-.PHONY: gprof_main
-gprof_main:$(PROF_BASE).gprof.out
-
-.PHONY: gprof2dot
-gprof2dot:
- gprof2dot.py $(PROF_BASE).gprof.out|dot -Tgif -o $(PROF_BASE).gprof.gif
-
-.PHONY: gdb.commands
-gdb.commands:
- @echo "#gdb commands:" > $@
- @echo cd $(PWD) >> $@
- @echo file $(COMPILER.clangxx_dbg) >> $@
- @echo set args $(COMPILER.clangxx_dbg.libcxx) -c $(COMPILE.clangxx.flags.all) -c $(MAIN).cpp >> $@
-
-.PHONY: compiler_help_driver
-compiler_help_driver: compiler_help compiler_driver
-
-.PHONY: main.o
-main.o : $(MAIN).cpp
- $(COMPILE.$(HOW)) -c -MMD -std=c++11 $(BFLAGS) $(INCS) $<
-
-.PHONY: tuple.benchmark.report
-tuple.benchmark.report: $(MAIN).$(HOW).$(MEASURE)
- echo "DATE:" `date` >$@
- $(PYTHON) time-report_tbl.py $(HOW) < $< >> $@
-
-.PHONY: tuple.benchmark.measure
-tuple.benchmark.measure: $(MAIN).$(HOW).$(MEASURE).txt
-
-TIME_FORMAT="user:%U\nsystem:%S\nelapsed:%e"
-TUPLE_MAX_SIZE=4
-TUPLE_MIN_SIZE=4
-TUPLE_DEL_SIZE=4
-TUPLE_SIZES=$(TUPLE_MAX_SIZE)
-TUPLE_IMPLS=\
- tuple_impl_horizontal.hpp\
- tuple_impl_vertical.hpp\
- #
-
-.PHONY: $(MAIN).$(HOW).$(MEASURE).txt
-$(MAIN).$(HOW).$(MEASURE).txt: $(MAIN).cpp
- -rm $@
- echo -n "COMPILER:" >>$@ ; \
- echo $(HOW) >>$@ ; \
- for VALU_AT in -DVALU_AT ; do \
- echo "VALU_AT:"$$VALU_AT >>$@ ; \
- for TUPLE_IMPL in $(TUPLE_IMPLS) ; do \
- echo "TUPLE_IMPL:"$$TUPLE_IMPL >>$@ ; \
- for TUPLE_SIZE in $(TUPLE_SIZES) ; do \
- echo "TUPLE_SIZE:"$$TUPLE_SIZE >>$@ ; \
- for LAST_LESS in `python ./first_to_last_ints.py $(TUPLE_MIN_SIZE) $(TUPLE_DEL_SIZE) $$TUPLE_SIZE ` ; do \
- echo "LAST_LESS:"$$LAST_LESS >>$@ ; \
- $(MEASURE) --format $(TIME_FORMAT) $(COMPILE.$(HOW)) \
- $(INCS) \
- -DTUPLE_IMPL=$$TUPLE_IMPL \
- -DTUPLE_SIZE=$$TUPLE_SIZE \
- -DLAST_LESS=$$LAST_LESS \
- $$VALU_AT \
- $(MAIN).cpp 2>>$@ ; \
- done \
- done \
- done \
- done \
- #
-
-.PHONY: tuple.benchmark.$(MEASURE)
-tuple.benchmark.$(MEASURE):
- for COMPILE_HOW in $(HOWS) ; do \
- make -W$(MAIN).cpp HOW=$$COMPILE_HOW $(MAIN).$$COMPILE_HOW.$(MEASURE).txt ; \
- done
-
-.PHONY: nest_loop
-nest_loop:
- for TUPLE_SIZE in $(TUPLE_SIZES) ; do \
- echo "TUPLE_SIZE:"$$TUPLE_SIZE ; \
- for LAST_LESS in `python ./first_to_last_ints.py $(TUPLE_MIN_SIZE) 2 $$TUPLE_SIZE ` ; do \
- echo " LAST_LESS:"$$LAST_LESS ; \
- done \
- done \
- #
-
-.PHONY: echo
-echo:
- @echo "SHELL="$(SHELL)
-
-
+BENCHMARK.which=mini
+BENCHMARK.which=tree_builder
+TIMEFMT=%Y-%m-%d_%T_%N
+#TIMESTAMP.value=_
+TIMESTAMP.value?=$(shell date +$(TIMEFMT))
+GUAGE=guage_time
+BENCHMARK.prefix=$(shell python benchmark_prefix_name.py)
+MAIN=$(BENCHMARK.prefix).$(BENCHMARK.which)
+MEASURED=$(MAIN).$(GUAGE)@$(TIMESTAMP.value)
+PYTHON=python
+
+.PHONY: brun
+brun:#produces $(MEASURED).txt from $(MAIN).cpp
+ $(PYTHON) tuple_benchmark_run.py $(BENCHMARK.which) $(TIMESTAMP.value)
+
+.PHONY: domain
+domain:
+ $(PYTHON) tuple_benchmark_domain.py
+
+parse:#produces domain_range.pkl from $(MEASURED).txt
+ $(PYTHON) tuple_benchmark_parserange.py $(MEASURED).txt
+
+.PHONY: plot
+plot: domain_range.pkl#produces filtered output from domain_range.pkl
+ $(PYTHON) tuple_benchmark_plot.py domain_range.pkl
+
+.PHONY: show
+show:#shows selected macro values.
+ echo $(BENCHMARK.prefix)
Added: sandbox/variadic_templates/sandbox/slim/test/benchmark_prefix_name.py
==============================================================================
--- (empty file)
+++ sandbox/variadic_templates/sandbox/slim/test/benchmark_prefix_name.py 2012-11-17 00:31:06 EST (Sat, 17 Nov 2012)
@@ -0,0 +1,11 @@
+"""
+Print to stdout a prefix of the name of the c++ source code
+benchmark.
+"""
+from __future__ import print_function
+
+def name():
+ return "tuple.benchmark"
+
+if __name__ == '__main__':
+ print(name())
Modified: sandbox/variadic_templates/sandbox/slim/test/tuple_benchmark_run.py
==============================================================================
--- sandbox/variadic_templates/sandbox/slim/test/tuple_benchmark_run.py (original)
+++ sandbox/variadic_templates/sandbox/slim/test/tuple_benchmark_run.py 2012-11-17 00:31:06 EST (Sat, 17 Nov 2012)
@@ -11,15 +11,31 @@
from tuple_benchmark_domain import *
import compiler_guage
+import benchmark_prefix_name
def main(argv):
+ """
+ Inputs:
+ argv[1] is optional benchmark_suffix to the benchmark main program name.
+ argv[2] is optional run name, used in forming output file name.
+ Outputs:
+ output file(name depends on argv, see below) contains performance
+ measurements of the compilation of benchmakr main program.
+ """
result = None
+ default_suffix="mini"
+ default_run="_"
#print("argv=",argv)
if len(argv)>1:
benchmark_suffix=argv[1]
+ if len(argv)>2:
+ benchmark_run=argv[2]
+ else:
+ benchmark_run=default_run
else:
- benchmark_suffix="mini"
- benchmark_presuffix="tuple.benchmark."+benchmark_suffix
+ benchmark_suffix=default_suffix
+ benchmark_run=default_run
+ benchmark_presuffix=benchmark_prefix_name.name()+"."+benchmark_suffix
benchmark_basename=benchmark_presuffix+".cpp"
#print("benchmark_basename=",benchmark_basename)
boost_root="/home/evansl/prog_dev/boost-svn/ro/boost_1_49_0"
@@ -67,9 +83,7 @@
)
guage=compiler_guage.guage_time()
measure_key=guage.__class__.__name__
- dtfmt=datetime.now().isoformat('_')
- dtfmt="_"
- measure_out=open(benchmark_presuffix+"."+measure_key+"@"+dtfmt+".txt",mode='w')
+ measure_out=open(benchmark_presuffix+"."+measure_key+"@"+benchmark_run+".txt",mode='w')
print(TAG_TUPLE.compilers+"[",file=measure_out)
for compiler_name in COMPILER_MAP.keys():
(compiler_exe,compiler_flags)=COMPILER_MAP[compiler_name]
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk