nest-simulator icon indicating copy to clipboard operation
nest-simulator copied to clipboard

Refactor handling of timers to achieve simpler code in place of use and increase coverage

Open heplesser opened this issue 1 year ago • 1 comments

Currently, timers in NEST are typically started/stopped with code like this:

  if ( tid == 0 )
  {
    sw_communicate_prepare_.start();
  }

or

#ifdef TIMER_DETAILED
  if ( tid == 0 )
  {
    sw_gather_target_data_.start();
  }
#endif

This creates a lot of visual clutter and is not as expressive as it could be in terms of OpenMP. I suggest the following:

  1. All if ( tid == 0 ) should be replaced by #pragma omp master, which should have the same effect and does not introduce barriers.
  2. We should try to move both this pragma and the #ifdef TIMER_DETAILED into the start()/stop() methods. These should be inline, so that this should not cause any overhead. It will require creating a Stopwatch subclass for DetailedStopwatch, which is inactive unless the detailed timers option is set.
  3. #3097 adds coverage for secondary event time. We should also add detailed timers for MUSIC, WFR, and Structural Plasticity (in two places) so that we have all parts of the update loop covered.

This work will required careful benchmarking to ensure that 1 & 2 do not cause longer runtimes.

heplesser avatar Feb 08 '24 13:02 heplesser

Issue automatically marked stale!

github-actions[bot] avatar Apr 09 '24 08:04 github-actions[bot]