diff options
author | Erik Schnetter <schnetter@cct.lsu.edu> | 2010-09-14 15:52:47 -0500 |
---|---|---|
committer | Barry Wardell <barry.wardell@gmail.com> | 2011-12-14 18:25:22 +0000 |
commit | 90a9fb3f728b1236bb13c11a25cb769a985c2a21 (patch) | |
tree | 927b4dd7704cf34cc27961c7ece11309fc2c8702 | |
parent | 2907e498f41bd84e512d4f35ff9552498e71375c (diff) |
Carpet: Execute postrestrict bin finest-to-coarsest
Execute the postrestrict and postrestrictinitial bins from finest to
coarsest level, so that the restriction to level L+1 is complete
(including boundary conditions, synchronisation etc.) before level L
is restricted.
-rw-r--r-- | Carpet/Carpet/src/Evolve.cc | 38 | ||||
-rw-r--r-- | Carpet/Carpet/src/Initialise.cc | 21 |
2 files changed, 54 insertions, 5 deletions
diff --git a/Carpet/Carpet/src/Evolve.cc b/Carpet/Carpet/src/Evolve.cc index 38efe537f..1747df301 100644 --- a/Carpet/Carpet/src/Evolve.cc +++ b/Carpet/Carpet/src/Evolve.cc @@ -426,11 +426,18 @@ namespace Carpet { void CallRestrict (cGH * const cctkGH) { - static Timer timer ("Evolve::CallRestrict"); + char const * const where = "Evolve::CallRestrict"; + static Timer timer (where); timer.start(); for (int ml=mglevels-1; ml>=0; --ml) { - for (int rl=reflevels-1; rl>=0; --rl) { + + bool have_done_global_mode = false; + bool have_done_early_global_mode = false; + bool have_done_late_global_mode = false; + bool have_done_anything = false; + + for (int rl=reflevels-2; rl>=0; --rl) { int const do_every = ipow(mgfact, ml) * (maxtimereflevelfact / timereffacts.AT(rl)); if (cctkGH->cctk_iteration % do_every == 0) { @@ -438,17 +445,40 @@ namespace Carpet { ENTER_LEVEL_MODE (cctkGH, rl) { BeginTimingLevel (cctkGH); + do_early_global_mode = reflevel==reflevels-2; + do_late_global_mode = not have_done_late_global_mode; + do_early_meta_mode = do_early_global_mode and mglevel==mglevels-1; + do_late_meta_mode = do_late_global_mode and mglevel==0; + do_global_mode = do_late_global_mode; + do_meta_mode = do_global_mode and do_late_meta_mode; + assert (not (have_done_global_mode and do_global_mode)); + assert (not (have_done_early_global_mode and + do_early_global_mode)); + assert (not (have_done_late_global_mode and + do_late_global_mode)); + have_done_global_mode |= do_global_mode; + have_done_early_global_mode |= do_early_global_mode; + have_done_late_global_mode |= do_late_global_mode; + have_done_anything = true; + Waypoint ("Evolution/Restrict at iteration %d time %g", cctkGH->cctk_iteration, (double)cctkGH->cctk_time); Restrict (cctkGH); + ScheduleTraverse (where, "CCTK_POSTRESTRICT", cctkGH); + EndTimingLevel (cctkGH); } LEAVE_LEVEL_MODE; } LEAVE_GLOBAL_MODE; } // if do_every } // for rl - } // for ml + + if (have_done_anything) assert (have_done_global_mode); + if (have_done_anything) assert (have_done_early_global_mode); + if (have_done_anything) assert (have_done_late_global_mode); + + } // for ml timer.stop(); } @@ -510,9 +540,11 @@ namespace Carpet { (do_meta_mode ? " (meta)" : ""), (do_taper ? " (tapering)" : "")); +#if 0 if (reflevel < reflevels-1) { ScheduleTraverse (where, "CCTK_POSTRESTRICT", cctkGH); } +#endif // Poststep ScheduleTraverse (where, "CCTK_POSTSTEP", cctkGH); diff --git a/Carpet/Carpet/src/Initialise.cc b/Carpet/Carpet/src/Initialise.cc index 785f3cfdc..557c81230 100644 --- a/Carpet/Carpet/src/Initialise.cc +++ b/Carpet/Carpet/src/Initialise.cc @@ -409,20 +409,35 @@ namespace Carpet { void CallRestrict (cGH * const cctkGH) { - for (int rl=reflevels-1; rl>=0; --rl) { + char const * const where = "Initialise::CallRestrict"; + static Timer timer (where); + timer.start(); + + for (int rl=reflevels-2; rl>=0; --rl) { BEGIN_MGLEVEL_LOOP(cctkGH) { ENTER_LEVEL_MODE (cctkGH, rl) { BeginTimingLevel (cctkGH); - + + do_early_global_mode = reflevel==reflevels-2; + do_late_global_mode = reflevel==0; + do_early_meta_mode = do_early_global_mode and mglevel==mglevels-1; + do_late_meta_mode = do_late_global_mode and mglevel==0; + do_global_mode = do_late_global_mode; // on last iteration, finest grid + do_meta_mode = do_late_meta_mode; // on last iteration, finest grid + Waypoint ("Initialisation/Restrict at iteration %d time %g", cctkGH->cctk_iteration, (double)cctkGH->cctk_time); Restrict (cctkGH); + ScheduleTraverse (where, "CCTK_POSTRESTRICTINITIAL", cctkGH); + EndTimingLevel (cctkGH); } LEAVE_LEVEL_MODE; } END_MGLEVEL_LOOP; } // for rl + + timer.stop(); } @@ -451,9 +466,11 @@ namespace Carpet { (do_global_mode ? " (global)" : ""), (do_meta_mode ? " (meta)" : "")); +#if 0 if (reflevel < reflevels-1) { ScheduleTraverse (where, "CCTK_POSTRESTRICTINITIAL", cctkGH); } +#endif ScheduleTraverse (where, "CCTK_POSTPOSTINITIAL", cctkGH); ScheduleTraverse (where, "CCTK_POSTSTEP", cctkGH); |