Skip to content

Commit

Permalink
Add statistics on nested input shape
Browse files Browse the repository at this point in the history
  • Loading branch information
SSoelvsten committed Feb 5, 2024
1 parent eb74bb7 commit 21b2b75
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 5 deletions.
12 changes: 12 additions & 0 deletions src/adiar/internal/algorithms/nested_sweeping.h
Original file line number Diff line number Diff line change
Expand Up @@ -1691,6 +1691,18 @@ namespace adiar::internal

outer_writer.detach();

#ifdef ADIAR_STATS
nested_sweeping::stats.inner_down.inputs.acc_size += outer_file->size();
nested_sweeping::stats.inner_down.inputs.max_size = std::max<uintwide>(nested_sweeping::stats.inner_down.inputs.max_size,
outer_file->size());
nested_sweeping::stats.inner_down.inputs.acc_width += outer_file->width;
nested_sweeping::stats.inner_down.inputs.max_width = std::max<uintwide>(nested_sweeping::stats.inner_down.inputs.max_width,
outer_file->width);
nested_sweeping::stats.inner_down.inputs.acc_levels += outer_file->levels();
nested_sweeping::stats.inner_down.inputs.max_levels = std::max<uintwide>(nested_sweeping::stats.inner_down.inputs.max_levels,
outer_file->levels());
#endif

// TODO (optimisation): is_last_inner && !non_gc_request
// Use a simpler (and hence faster?) algorithm for a GC-only sweep.

Expand Down
43 changes: 39 additions & 4 deletions src/adiar/statistics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -783,22 +783,57 @@ namespace adiar
o << indent << bold_on << "inner down sweep" << bold_off << endl;
indent_level++;

o << indent << bold_on << "inputs" << bold_off << endl;

indent_level++;

o << indent << "size" << endl;

indent_level++;
o << indent << label << "accumulated"
<< internal::nested_sweeping::stats.inner_down.inputs.acc_size << endl;
o << indent << label << "maximum"
<< internal::nested_sweeping::stats.inner_down.inputs.max_size << endl;
indent_level--;

o << indent << "width" << endl;

indent_level++;
o << indent << label << "accumulated"
<< internal::nested_sweeping::stats.inner_down.inputs.acc_width << endl;
o << indent << label << "maximum"
<< internal::nested_sweeping::stats.inner_down.inputs.max_width << endl;
indent_level--;

o << indent << "levels" << endl;

indent_level++;
o << indent << label << "accumulated"
<< internal::nested_sweeping::stats.inner_down.inputs.acc_levels << endl;
o << indent << label << "maximum"
<< internal::nested_sweeping::stats.inner_down.inputs.max_levels << endl;
indent_level--;

indent_level--;

o << indent << endl;

const uintwide total_arcs = internal::nested_sweeping::stats.inner_up.outer_arcs
+ internal::nested_sweeping::stats.inner_up.inner_arcs;
+ internal::nested_sweeping::stats.inner_up.inner_arcs;

o << indent << bold_on << label << "arc types" << bold_off
o << indent << bold_on << label << "output origin (arcs)" << bold_off
<< total_arcs
<< endl;

indent_level++;

o << indent << label << "outer"
o << indent << label << "outer sweep"
<< internal::nested_sweeping::stats.inner_up.outer_arcs
<< " = " << internal::percent_frac(internal::nested_sweeping::stats.inner_up.outer_arcs,
total_arcs) << percent
<< endl;

o << indent << label << "inner"
o << indent << label << "inner sweep"
<< internal::nested_sweeping::stats.inner_up.inner_arcs
<< " = " << internal::percent_frac(internal::nested_sweeping::stats.inner_up.inner_arcs,
total_arcs) << percent
Expand Down
37 changes: 36 additions & 1 deletion src/adiar/statistics.h
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,42 @@ namespace adiar
////////////////////////////////////////////////////////////////////////
struct inner_down_t
{
// TODO: before/after
struct inputs_t
{
//////////////////////////////////////////////////////////////////////
/// \brief Accumulated size of all diagrams handed over to nested
/// sweeps.
//////////////////////////////////////////////////////////////////////
uintwide acc_size = 0;

//////////////////////////////////////////////////////////////////////
/// \brief Size of the largest diagram handed over to a nested sweep.
//////////////////////////////////////////////////////////////////////
uintwide max_size = 0;

//////////////////////////////////////////////////////////////////////
/// \brief Accumulated width of all diagrams handed over to nested
/// sweeps.
//////////////////////////////////////////////////////////////////////
uintwide acc_width = 0;

//////////////////////////////////////////////////////////////////////
/// \brief Largest width of any diagram handed over to a nested sweep.
//////////////////////////////////////////////////////////////////////
uintwide max_width = 0;

//////////////////////////////////////////////////////////////////////
/// \brief Accumulated number of levels of all diagrams handed over
/// to nested sweeps.
//////////////////////////////////////////////////////////////////////
uintwide acc_levels = 0;

//////////////////////////////////////////////////////////////////////
/// \brief The largest number of levels handed over to a nested sweep,
/// i.e. the depth of the "deepest" diagram.
//////////////////////////////////////////////////////////////////////
uintwide max_levels = 0;
} inputs;

struct requests_t
{
Expand Down

0 comments on commit 21b2b75

Please sign in to comment.