diff options
author | Erik Schnetter <schnetter@cct.lsu.edu> | 2008-09-05 23:16:34 -0400 |
---|---|---|
committer | Erik Schnetter <schnetter@cct.lsu.edu> | 2008-09-05 23:16:34 -0400 |
commit | 7b06d80baf85df1d0201cfeddb6d61834210ea3b (patch) | |
tree | 4b500fd3346d6d53dfaf395cd4c8af8edafce21a /Carpet/Carpet | |
parent | 32d63702907a0e455db632578c2b7dd8fd9841b6 (diff) |
Carpet: Overload OutputGH, and add timers
Diffstat (limited to 'Carpet/Carpet')
-rw-r--r-- | Carpet/Carpet/src/CarpetStartup.cc | 2 | ||||
-rw-r--r-- | Carpet/Carpet/src/Evolve.cc | 3 | ||||
-rw-r--r-- | Carpet/Carpet/src/Initialise.cc | 1 | ||||
-rw-r--r-- | Carpet/Carpet/src/OutputGH.cc | 65 | ||||
-rw-r--r-- | Carpet/Carpet/src/carpet.hh | 2 | ||||
-rw-r--r-- | Carpet/Carpet/src/make.code.defn | 1 |
6 files changed, 72 insertions, 2 deletions
diff --git a/Carpet/Carpet/src/CarpetStartup.cc b/Carpet/Carpet/src/CarpetStartup.cc index 8e49cd444..822c03845 100644 --- a/Carpet/Carpet/src/CarpetStartup.cc +++ b/Carpet/Carpet/src/CarpetStartup.cc @@ -36,6 +36,8 @@ namespace Carpet { CCTK_OverloadEvolve (Evolve); CCTK_OverloadShutdown (Shutdown); + CCTK_OverloadOutputGH (OutputGH); + CCTK_OverloadSyncGroupsByDirI (SyncGroupsByDirI); CCTK_OverloadEnableGroupStorage (EnableGroupStorage); CCTK_OverloadDisableGroupStorage (DisableGroupStorage); diff --git a/Carpet/Carpet/src/Evolve.cc b/Carpet/Carpet/src/Evolve.cc index f6ea07eab..b19f12da9 100644 --- a/Carpet/Carpet/src/Evolve.cc +++ b/Carpet/Carpet/src/Evolve.cc @@ -211,6 +211,8 @@ namespace Carpet { static Timer timer ("Evolve::AdvanceTime"); timer.start(); + Checkpoint ("AdvanceTime"); + ++ cctkGH->cctk_iteration; if (not adaptive_stepsize) { @@ -631,7 +633,6 @@ namespace Carpet { static Timer timer (timername.c_str()); timer.start(); - Checkpoint ("OutputGH"); CCTK_OutputGH (cctkGH); timer.stop(); } diff --git a/Carpet/Carpet/src/Initialise.cc b/Carpet/Carpet/src/Initialise.cc index b990e5ccc..836be8635 100644 --- a/Carpet/Carpet/src/Initialise.cc +++ b/Carpet/Carpet/src/Initialise.cc @@ -1335,7 +1335,6 @@ namespace Carpet { static Timer timer (timername.c_str()); timer.start(); - Checkpoint ("OutputGH"); CCTK_OutputGH (cctkGH); timer.stop(); } diff --git a/Carpet/Carpet/src/OutputGH.cc b/Carpet/Carpet/src/OutputGH.cc new file mode 100644 index 000000000..11b611754 --- /dev/null +++ b/Carpet/Carpet/src/OutputGH.cc @@ -0,0 +1,65 @@ +#include <cassert> +#include <cstdio> +#include <cstdlib> +#include <sstream> + +#include "cctk.h" +#include "cctk_Parameters.h" + +#include "dist.hh" + +#include "carpet.hh" +#include "Timers.hh" + + + +namespace Carpet { + + using namespace std; + + + + int OutputGH (cGH const * const cctkGH) + { + DECLARE_CCTK_PARAMETERS; + + static Timer timer ("OutputGH"); + timer.start(); + + Checkpoint ("OutputGH"); + + int const num_methods = CCTK_NumIOMethods(); + if (num_methods == 0) { + return -1; + } + + static vector<Timer *> timers; + timers.resize (num_methods, NULL); + + int num_vars = 0; + for (int handle = 0; handle < num_methods; ++ handle) { + + IOMethod const * const method = CCTK_IOMethod (handle); + assert (method); + + if (not timers.at(handle)) { + ostringstream buf; + buf << "OutputGH" + << "::" << method->implementation + << "::" << method->name + << " [" << handle << "]"; + timers.at(handle) = new Timer (buf.str().c_str()); + } + + timers.at(handle)->start(); + num_vars += method->OutputGH (cctkGH); + timers.at(handle)->stop(); + + } // for handle + + timer.stop(); + + return num_vars; + } + +} // namespace Carpet diff --git a/Carpet/Carpet/src/carpet.hh b/Carpet/Carpet/src/carpet.hh index 9e53cfe5c..f1fa0867e 100644 --- a/Carpet/Carpet/src/carpet.hh +++ b/Carpet/Carpet/src/carpet.hh @@ -31,6 +31,8 @@ namespace Carpet { int Initialise (tFleshConfig* config); int Evolve (tFleshConfig* config); int Shutdown (tFleshConfig* config); + int OutputGH (const cGH* cgh); + int CallFunction (void* function, cFunctionData* attribute, void* data); // Other functions diff --git a/Carpet/Carpet/src/make.code.defn b/Carpet/Carpet/src/make.code.defn index 08caa1eff..db03ff6d7 100644 --- a/Carpet/Carpet/src/make.code.defn +++ b/Carpet/Carpet/src/make.code.defn @@ -13,6 +13,7 @@ SRCS = AllGatherString.cc \ Initialise.cc \ Limits.cc \ MultiModel.cc \ + OutputGH.cc \ Poison.cc \ Recompose.cc \ Requirements.cc \ |