Adding steerable checkpoint directories

Issue #716 closed
anonymous created an issue

Hello!

With help from Frank and Erik I wrote a quick patch to enable steerable checkpoint directories in IOUtil. Here is what it looks like:

Index: param.ccl

--- param.ccl (revision 285) +++ param.ccl (working copy) @@ -167,7 +167,7 @@ { ".+" :: "A valid filename" } "checkpoint.chkpt" -STRING checkpoint_dir "Output directory for checkpoint files" STEERABLE = RECOVER +STRING checkpoint_dir "Output directory for checkpoint files" STEERABLE = ALWAYS { ".+" :: "A valid directory name" } "."

Index: CheckpointRecovery.c

--- CheckpointRecovery.c (revision 285) +++ CheckpointRecovery.c (working copy) @@ -200,8 +200,8 @@ char filename; const char dir, *basename; char iteration_postfix[32], filenumber_postfix[32]; + int ierr;

- / get the right parameters / dir = basename = NULL; switch (called_from) @@ -209,11 +209,17 @@ case CP_INITIAL_DATA: dir = checkpoint_dir; basename = checkpoint_ID_file; + ierr = CCTK_CreateDirectory(0755, checkpoint_dir); + if(ierr<0) + CCTK_VWarn(0, LINE, FILE, "Checkpoint directory %s could not be created", checkpoint_dir); break;

 case CP_EVOLUTION_DATA:
   dir = checkpoint_dir;
   basename = checkpoint_file;
  • ierr = CCTK_CreateDirectory(0755, checkpoint_dir);
  • if(ierr<0)
  • CCTK_VWarn(0, LINE, FILE, "Checkpoint directory %s could not be created", checkpoint_dir); break;

    case CP_RECOVER_DATA:

I'm not 100% sure that this will work out in all cases, but I thought I'd put this here in case it was useful :)

Keyword:

Comments (2)

  1. Log in to comment