aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortradke <tradke@b32723a9-ab3a-4a60-88e2-2e5d99d7c17a>2006-02-13 10:42:04 +0000
committertradke <tradke@b32723a9-ab3a-4a60-88e2-2e5d99d7c17a>2006-02-13 10:42:04 +0000
commitd2d114d819504bccd62e77fe433384d9101a62a8 (patch)
treedb38a5dae02b596717618b968ba490a3c1bbf6ff
parent9b72eeb2ea38567a8bf087cd59f0577b52e239a5 (diff)
When searching for a list of checkpoint files in recovery mode
IO::recover = "{auto|autoprobe}": check for a '.file_<processor>' suffix for chunked output files (and not only for '.file_0' as processor 0's output). This allows for recovery from a chunked checkpoint in auto mode even if not all the chunked checkpoint files are visible to all processors (eg. if the checkpoint directory is local on a compute node on a cluster). git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/IOUtil/trunk@236 b32723a9-ab3a-4a60-88e2-2e5d99d7c17a
-rw-r--r--src/CheckpointRecovery.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/CheckpointRecovery.c b/src/CheckpointRecovery.c
index a92f13d..786c9fc 100644
--- a/src/CheckpointRecovery.c
+++ b/src/CheckpointRecovery.c
@@ -570,7 +570,7 @@ int IOUtil_RecoverParameters (int (*recover_fn) (cGH *GH,
#ifdef HAVE_DIRENT_H
int len, extension_len, recover_file_len;
unsigned int num_files;
- const char *p;
+ const char *p, *q;
DIR *dir;
struct dirent *file;
filelist_t *filelist, *tmp;
@@ -624,17 +624,21 @@ int IOUtil_RecoverParameters (int (*recover_fn) (cGH *GH,
continue;
}
- /* check for a '.file_<processor>' suffix for chunked output
- We only select the chunked output file of processor 0 in that case. */
- if (! strncmp (p, ".file_", 6) && strncmp (p, ".file_0", 7))
+ /* check for a '.file_<processor>' suffix for chunked output */
+ if (! strncmp (p, ".file_", 6))
{
continue;
}
- /* finally check the file type suffix */
- len = strlen (file->d_name);
- if (len < extension_len ||
- strcmp (file->d_name + len - extension_len, fileExtension))
+ /* read past the <processor> number and check the file extension suffix */
+ for (q = p + 6; *q && *q != '.'; q++)
+ {
+ if (! isdigit ((int) *q))
+ {
+ break;
+ }
+ }
+ if (*q != '.' || strcmp (q + 1, fileExtension))
{
continue;
}