-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature restart #336
Merged
scottaiton
merged 80 commits into
ForestClaw:develop-3d
from
scottaiton:feature_restart
Jun 20, 2024
Merged
Feature restart #336
scottaiton
merged 80 commits into
ForestClaw:develop-3d
from
scottaiton:feature_restart
Jun 20, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds restart functionality to ForestClaw.
Options
There are four new fclaw options:
checkpoint
True if checkpoints should be writtenrestart
True if restarting from a checkpoint filerestart_file
The checkpoint file to restart frompartition_file
The partition file to use. This is optional.When writing the checkpoint and partition files will be named in the format
fort_frame_####.checkpoint
andfort_frame_####.partition
. I chose file extensions that are dimension independent mainly because of MAGIC and GEMINI. Since they both have dimension as a user options, I think this will ultimately help avoid confusion.Changes needed in user applications
To enable the use of this feature, two changes need to be made to user applications.
In
run_program
,needs to change to
Also, the glob constructor needs to change from
to
Implementation Details
Dimension Independent fclaw_file interface
This adds a dimension independent file interface with
fclaw_file.h
. This ended up being fairly lightweight, with just if statements branching out into the 2d and 3d code, and some helper functions to handle return values.Options
For options checking on restart, the user has to start with the correct options. Upon reading the restart file, the options are then compared to a set of options in the checkpoint file.
To implement this, I scrapped my first idea of having to write routines to pack/unpack options data in a buffer and instead rely on the ini file produced by the
sc_options
structure. An ini file is written tofclaw_options.ini.checkpoint
and then the contents of that file is then saved to the checkpoint file. On restart, that ini file is extracted from the checkpoint file and then is used to compare with the options being run with.Changes to fclaw_global
An attributes feature has been added to
fclaw_global
. Attributes can be packed into the checkpoint file. When adding an attribute, there is an argument where a packing vtable can be specified. If no vtable is specified, then that attribute is not packed into the checkpoint file.Changes to fclaw_run
Some modifications were needed to get fclaw_run to be compatible with restarting.
First of all, some variables need to be saved. A new
fclaw_context
class has been added. These contexts get stored as attributes in glob that get packed into the restart file. Seefclaw_context.h
andfclaw_run.c
for documentation and usage examples.Secondly,
fclaw_output_checkpoint(glob, iframe);
needs to be called. Currently a checkpoint written whenever visualization data is written. We may want to change this in the future, but this works for now.Patch vtable
In order to virtualize the writing of patch data into the checkpoint file, the following functions were added to the patch table:
Currently only q is written to the checkpoint, but these should allow for this to be extended in the future.