diff --git a/dune/perftool/common/timer.hh b/dune/perftool/common/timer.hh index dda15b35b82fed69cd7ef3ccf10911385ed97a2f..84f7caf4bde0f875c3019c4df41047bf5fe686d7 100644 --- a/dune/perftool/common/timer.hh +++ b/dune/perftool/common/timer.hh @@ -3,7 +3,7 @@ #include <chrono> -# include <dune/perftool/common/opcounter.hh> +#include <dune/perftool/common/opcounter.hh> #define HP_TIMER_OPCOUNTER oc::OpCounter<double> diff --git a/python/dune/perftool/options.py b/python/dune/perftool/options.py index 16d45c59cb02ffb9aaa4a9f83bc02e364e2e78ab..ee86ec1f532290f5320728a396c1376da8fa305d 100644 --- a/python/dune/perftool/options.py +++ b/python/dune/perftool/options.py @@ -40,6 +40,7 @@ def get_form_compiler_arguments(): parser.add_argument("--constant-transformation-matrix", action="store_true", help="set option if the jacobian of the transformation is constant on a cell") parser.add_argument("--ini-file", type=str, help="An inifile to use. A generated driver will be hard-coded to it, a [formcompiler] section will be used as default values to form compiler arguments (use snake case)") parser.add_argument("--timer", action="store_true", help="measure times") + parser.add_argument("--opcounter", action="store_false", help="Count operations. Should only be used with yaspgrid. Timer should be set.") parser.add_argument("--project-basedir", type=str, help="The base (build) directory of the dune-perftool project") # TODO at some point this help description should be updated parser.add_argument("--sumfact", action="store_true", help="Use sumfactorization") diff --git a/python/dune/perftool/pdelab/driver.py b/python/dune/perftool/pdelab/driver.py index 9b8efbea778fd2b510fa0534c996363dd242f173..7970711412d497dba95bc27a5e1b8db89825ce6b 100644 --- a/python/dune/perftool/pdelab/driver.py +++ b/python/dune/perftool/pdelab/driver.py @@ -1110,6 +1110,10 @@ def dune_solve(): # Necessary includes and defines from dune.perftool.generation import pre_include from dune.perftool.generation import post_include + + # TODO check that we are using YASP? + if get_option('opcounter'): + pre_include("#define ENABLE_COUNTER", filetag="driver") pre_include("#define ENABLE_HP_TIMERS", filetag="driver") include_file("dune/perftool/common/timer.hh", filetag="driver") post_include("HP_DECLARE_TIMER(total);", filetag="driver") @@ -1125,7 +1129,7 @@ def dune_solve(): solve = ["HP_TIMER_START(total);", "{}".format(solve), "HP_TIMER_STOP(total);", - "char* exec = argv[0];" + "char* exec = argv[0];", "DUMP_TIMER(total, {}, true);".format(timestream), ] solve.extend(print_times) diff --git a/python/dune/perftool/pdelab/localoperator.py b/python/dune/perftool/pdelab/localoperator.py index 30454153b1e659531ee388cc9df49767229311e9..b53eefb51a252cf7a51ad004e16d0cd8a49d6fc5 100644 --- a/python/dune/perftool/pdelab/localoperator.py +++ b/python/dune/perftool/pdelab/localoperator.py @@ -575,12 +575,14 @@ class TimerMethod(ClassMember): reset = name_time_dumper_reset() t = name_time_dumper_t() ex = name_time_dumper_exec() + + # TODO: operator counting only works if alpha_volume_kernel exists content = ["template <typename Stream>", "void dump_timers(Stream& {}, char* {}, bool {})".format(os, ex, reset), "{", " double {} = 0.0;".format(t), - "#ifdef ENABLE_COUNTERS", - " auto counter = HP_TIMER_OPCOUNTERS({})", + "#ifdef ENABLE_COUNTER", + " auto counter = HP_TIMER_OPCOUNTERS(alpha_volume_kernel);", " counter.reset();", "#endif", ""] diff --git a/test/poisson/dimension-grid-variations/poisson_2d_dg_quadrilateral.mini b/test/poisson/dimension-grid-variations/poisson_2d_dg_quadrilateral.mini index ca35eccb50884552251748d611cf85fc647c55e3..d7507ae527e99cfd01c77140390eceb9411203f4 100644 --- a/test/poisson/dimension-grid-variations/poisson_2d_dg_quadrilateral.mini +++ b/test/poisson/dimension-grid-variations/poisson_2d_dg_quadrilateral.mini @@ -11,3 +11,4 @@ extension = vtu exact_solution_expression = g compare_dofs = 1e-1 compare_l2errorsquared = 1e-4 +opcounter = 1 \ No newline at end of file