geodynamics / aspect

A parallel, extensible finite element code to simulate convection in both 2D and 3D models.
https://aspect.geodynamics.org/
Other
223 stars 235 forks source link

Add postprocessor to append timing summary to the statistics file #1566

Open hlokavarapu opened 7 years ago

hlokavarapu commented 7 years ago

Write a postprocessor that will append the timing summary of a given run to the statistics file. This will be convenient in terms of running a data processing program that directly computes on top of the statistics file, as opposed to writing an external script to pull out the timing information from the screen-output (&/ log.txt).

After talking to Rene, he suggested adding an extra function to deal.II class TimerOutput that returns a const reference of the private data structure,

/**
   * A list of all the sections and their information.
   */
  std::map<std::string, Section> sections;

Given this reference, then a postprocessor can be added to Aspect that then appends every key as a column to statistics and one of the values of the struct Section

  /**
   * A structure that groups all information that we collect about each of the
   * sections.
   */
  struct Section
  {
    Timer  timer;
    double total_cpu_time;
    double total_wall_time;
    unsigned int n_calls;
  };

@bangerth , is this a reasonable method of setting up this functionality? Will this be resourceful for the community?

bangerth commented 7 years ago

That is one possibility. Another would be a function

std::map<std::string,double> get_summary_data (const Kind kind) const;

that for Kind in {total_cpu_time,total_wall_time,n_calls} returns the requested map. I think we already have an enum like Kind in that class.

This has the advantage that it doesn't export the internal data structures, and would probably be good enough for the purpose you have here.

class4kayaker commented 7 years ago

Pull request for Deal.II providing suggested function generated at dealii/dealii#4369.

hlokavarapu commented 7 years ago

That's awesome, thanks @class4kayaker .