aboutsummaryrefslogtreecommitdiff
path: root/src/RecoverGH.c
diff options
context:
space:
mode:
authortradke <tradke@ebee0441-1374-4afa-a3b5-247f3ba15b9a>2001-04-19 22:02:41 +0000
committertradke <tradke@ebee0441-1374-4afa-a3b5-247f3ba15b9a>2001-04-19 22:02:41 +0000
commite0434816ab8354125c24d64e798df31d4698da17 (patch)
tree8f30b9f07ae71ae1ac6cda8b22be0da9d8457fbe /src/RecoverGH.c
parent373c9dd8f0ba051d74402f3df37f925ea6799911 (diff)
Add the Cactus version as an attribute to the global attributes group.
This is also used during recovery to distinguish checkpoint and data files which were created before/after the recent changes to the timelevel naming scheme. This fixes PR IOFlexIO-620. git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOFlexIO/trunk@184 ebee0441-1374-4afa-a3b5-247f3ba15b9a
Diffstat (limited to 'src/RecoverGH.c')
-rw-r--r--src/RecoverGH.c47
1 files changed, 35 insertions, 12 deletions
diff --git a/src/RecoverGH.c b/src/RecoverGH.c
index 13e3c16..096bf8a 100644
--- a/src/RecoverGH.c
+++ b/src/RecoverGH.c
@@ -112,6 +112,7 @@ int IOFlexIO_Recover (cGH *GH, const char *basename, int called_from)
/* to make the compiler happy */
myGH = NULL;
+ result = 0;
/* start the total timer */
if (GH)
@@ -151,17 +152,8 @@ int IOFlexIO_Recover (cGH *GH, const char *basename, int called_from)
return (IOFlexIOi_RecoverParameters (&file));
}
- /* Recover variables */
- if (verbose)
- {
- CCTK_VInfo (CCTK_THORNSTRING, "Recovering %schunked data with ioproc %d, "
- "ioproc_every %d", file.unchunked ? "un" : "", file.ioproc,
- file.ioproc_every);
- }
- result = IOFlexIOi_RecoverVariables (GH, &file);
-
/* Recover GH extensions */
- if (result == 0 && called_from == CP_RECOVER_DATA)
+ if (called_from == CP_RECOVER_DATA)
{
if (verbose)
{
@@ -170,6 +162,18 @@ int IOFlexIO_Recover (cGH *GH, const char *basename, int called_from)
result = IOFlexIOi_RecoverGHextensions (GH, &file);
}
+ if (! result)
+ {
+ /* Recover variables */
+ if (verbose)
+ {
+ CCTK_VInfo (CCTK_THORNSTRING, "Recovering %schunked data with ioproc %d, "
+ "ioproc_every %d", file.unchunked ? "un" : "", file.ioproc,
+ file.ioproc_every);
+ }
+ result = IOFlexIOi_RecoverVariables (GH, &file);
+ }
+
/* Close the file and remove it if requested by the user */
if (CCTK_MyProc (GH) == file.ioproc)
{
@@ -265,7 +269,7 @@ static int IOFlexIOi_OpenFile (cGH *GH,
CCTK_INT4 tmpInt;
#ifdef CCTK_MPI
MPI_Comm comm;
- CCTK_INT4 info[3];
+ CCTK_INT4 info[4];
#endif
@@ -385,6 +389,23 @@ static int IOFlexIOi_OpenFile (cGH *GH,
"and continuing", file->unchunked ? "true" : "false");
}
+ /* Determine whether data was written using the old timelevel naming
+ scheme. New files contain a Cactus version string attribute... */
+ vindex = IOreadAttributeInfo (file->fid, "Cactus version",
+ &nt_stored, &nels_stored);
+ if (vindex >= 0 && nt_stored == FLEXIO_CHAR && nels_stored == 1)
+ {
+ /* for now we don't actually need the Cactus version info */
+ file->has_version = 1;
+ }
+ else
+ {
+ CCTK_WARN (4, "Unable to restore 'Cactus version' attribute. "
+ "Assuming data was written using the the old timelevel "
+ "naming scheme and continuing");
+ file->has_version = 0;
+ }
+
/* If we recover from multiple files the number of
* writing processors must match the number of reading
* processors, and the total number of processors must match.
@@ -432,10 +453,12 @@ static int IOFlexIOi_OpenFile (cGH *GH,
info[0] = file->is_IEEEIO_file;
info[1] = file->unchunked;
info[2] = file->ioproc_every;
- CACTUS_MPI_ERROR (MPI_Bcast (info, 3, PUGH_MPI_INT, 0, comm));
+ info[3] = file->has_version;
+ CACTUS_MPI_ERROR (MPI_Bcast (info, 4, PUGH_MPI_INT, 0, comm));
file->is_IEEEIO_file = info[0];
file->unchunked = info[1];
file->ioproc_every = info[2];
+ file->has_version = info[3];
#endif
if (file->is_IEEEIO_file)