aboutsummaryrefslogtreecommitdiff
path: root/src/RecoverGH.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/RecoverGH.c')
-rw-r--r--src/RecoverGH.c130
1 files changed, 84 insertions, 46 deletions
diff --git a/src/RecoverGH.c b/src/RecoverGH.c
index a8fd02b..8472167 100644
--- a/src/RecoverGH.c
+++ b/src/RecoverGH.c
@@ -81,9 +81,7 @@ int IOFlexIO_RecoverGH (cGH *GH, const char *basename, int called_from)
char msg [512];
pGH *pughGH;
ioGH *ioUtilGH;
-#if 0
- cTimer total_time, dataset_time, param_time;
-#endif
+ flexioGH *myGH;
#ifdef MPI
CCTK_INT info [3];
#endif
@@ -95,22 +93,18 @@ int IOFlexIO_RecoverGH (cGH *GH, const char *basename, int called_from)
file_ioproc_every = 0;
file_unchunked = 0;
- /* Get the handles for PUGH and IOUtil extensions */
+ /* Get the handles for PUGH, IOUtil, and IOFlexIO extensions */
pughGH = (pGH *) GH->extensions [CCTK_GHExtensionHandle ("PUGH")];
ioUtilGH = (ioGH *) GH->extensions [CCTK_GHExtensionHandle ("IO")];
+ myGH = (flexioGH *) GH->extensions [CCTK_GHExtensionHandle ("IOFlexIO")];
/* identify myself */
nprocs = CCTK_nProcs (GH);
myproc = CCTK_MyProc (GH);
-#if 0
- /* initialize timers */
- CactusResetTimer (&total_time);
- CactusResetTimer (&dataset_time);
- CactusResetTimer (&param_time);
-
- CactusStartTimer (&total_time);
-#endif
+ /* start the total timer */
+ if (print_timing_info)
+ CCTK_TimerStartI (myGH->recoverTotalTimer);
/* Examine base file to find whether recovering from
* one (recombined) file or from multiple files
@@ -266,14 +260,20 @@ int IOFlexIO_RecoverGH (cGH *GH, const char *basename, int called_from)
printf ("Recovering %schunked data with ioproc %d, ioproc_every %d.\n",
file_unchunked ? "un" : "", file_ioproc, file_ioproc_every);
-#if 0
- CactusStartTimer (&dataset_time);
-#endif
+ /* start timer for restoring variables */
+ if (print_timing_info) {
+ CCTK_TimerResetI (myGH->recoverVarsTimer);
+ CCTK_TimerStartI (myGH->recoverVarsTimer);
+ }
+
+ /* restore all variables from checkpoint file */
IOFlexIO_RestoreIEEEIOfile (GH, ifp, file_ioproc, file_ioproc_every,
file_unchunked);
-#if 0
- CactusStopTimer (&dataset_time);
-#endif
+
+ /* stop variable timer */
+ if (print_timing_info)
+ CCTK_TimerStopI (myGH->recoverVarsTimer);
+
/* Close the file. */
if (myproc == file_ioproc) {
if (verbose)
@@ -282,10 +282,8 @@ int IOFlexIO_RecoverGH (cGH *GH, const char *basename, int called_from)
}
if (called_from == CP_RECOVER_DATA) {
+
/* Must read in parameters and scalars on all processors. */
-#if 0
- CactusStartTimer (&param_time);
-#endif
for (proc = file_ioproc;
proc < file_ioproc+file_ioproc_every && proc < nprocs;
proc++) {
@@ -293,6 +291,12 @@ int IOFlexIO_RecoverGH (cGH *GH, const char *basename, int called_from)
/* Only have the file open by one proc at any time. */
if (proc == myproc) {
+ /* start timer for restoring parameters */
+ if (print_timing_info) {
+ CCTK_TimerResetI (myGH->recoverParamsTimer);
+ CCTK_TimerStartI (myGH->recoverParamsTimer);
+ }
+
/* Open file, make sure the file is valid */
ifp = IEEEopen (fname, "r");
if (! IOisValid (ifp)) {
@@ -304,16 +308,8 @@ int IOFlexIO_RecoverGH (cGH *GH, const char *basename, int called_from)
/* Restore the parameters. */
if (verbose)
printf ("Recovering parameters on processor %d.\n", myproc);
-/*** FIXME ***/
-#if 0
- IO_IEEEIOparamRestore (ifp, myproc);
+ IOFlexIO_restoreParams (ifp, myproc);
- /* Restore the structure variables. */
- if (verbose)
- printf ("Recovering GH variables.\n");
- IO_IEEEIOStructRestore (GH, ifp);
-#endif
-
/* Restore global variables */
/* Get the main loop index. */
@@ -362,30 +358,72 @@ int IOFlexIO_RecoverGH (cGH *GH, const char *basename, int called_from)
if (verbose)
printf ("Closing '%s' after recovery.\n", fname);
IOclose (ifp);
+
+ /* stop timer for restoring parameters */
+ if (print_timing_info)
+ CCTK_TimerStopI (myGH->recoverParamsTimer);
+
}
/* Synchronise all processors */
CCTK_Barrier (GH);
}
-#if 0
- CactusStopTimer (&param_time);
-#endif
}
- /* print timing output */
- if (verbose && called_from == CP_RECOVER_DATA && myproc == 0) {
-#if 0
- printf (
- "----------------------------------------------------------------\n");
-/*** FIXME: choose right component of basic[] ***/
- printf ("Time to restore data: %10.3f sec\n",
- dataset_time.total.basic [0]);
- printf ("Time to restore parameters: %10.3f sec\n",
- param_time.total.basic [0]);
- printf ("Time to recover from checkpoint: %10.3f sec\n",
- total_time.total.basic [0]);
-#endif
+ /* stop total recovery timer and print timing info */
+ if (print_timing_info && called_from == CP_RECOVER_DATA) {
+ t_TimerInfo *info;
+
+ CCTK_TimerStopI (myGH->recoverTotalTimer);
+
+ printf ("%s timing information for recovery:\n", CCTK_THORNSTRING);
+
+ info = CCTK_TimerCreateInfo ();
+ if (info) {
+
+ if (myGH->recoverVarsTimer >= 0) {
+ CCTK_TimerGetI (myGH->recoverVarsTimer, info);
+{
+/*** FIXME: select right timers and value types !!! ***/
+
+#include <assert.h>
+assert (info->n_vals >= 2);
+assert (info->vals [0].type == val_double && info->vals [1].type == val_double);
+}
+ printf ("Time to recover datasets: %5.1f sec (GetTimeOfDay), "
+ "%5.1f sec (GetrUsage)\n",
+ info->vals [0].val.d, info->vals [1].val.d);
+ }
+
+ if (myGH->recoverParamsTimer >= 0) {
+ CCTK_TimerGetI (myGH->recoverParamsTimer, info);
+ printf ("Time to recover parameters: %5.1f sec (GetTimeOfDay), "
+ "%5.1f sec (GetrUsage)\n",
+ info->vals [0].val.d, info->vals [1].val.d);
+ }
+
+ if (myGH->recoverTotalTimer >= 0) {
+ CCTK_TimerGetI (myGH->recoverTotalTimer, info);
+ printf ("Total time to recover: %5.1f sec (GetTimeOfDay), "
+ "%5.1f sec (GetrUsage)\n",
+ info->vals [0].val.d, info->vals [1].val.d);
+ }
+
+ CCTK_TimerDestroyInfo (info);
+ } else
+ CCTK_WARN (1, "Couldn't create timer info structure ! No timing output "
+ "available.");
+
+ printf ("----------------------------------------------------------------"
+ "---------\n");
}
return (0);
}
+
+int IOFlexIO_restoreParams (IOFile ifp, int myproc)
+{
+ CCTK_INFO ("Called IOFlexIO_restoreParams()\n");
+
+ return (0);
+}