Add get_checkpoint_id() function to simulator_access#6941
Conversation
There was a problem hiding this comment.
ideally, we would return the current checkpoint id while a checkpoint is being written (I know that this is why you want this function 😄 ). Sadly,
aspect/source/simulator/checkpoint_restart.cc
Line 444 in ba06f0f
currently happens after we call
save:aspect/source/simulator/checkpoint_restart.cc
Line 381 in ba06f0f
But we could update the id before instead. Thoughts?
|
|
||
| /** | ||
| * Return the ID of the last checkpoint. This is not the current checkpoint ID | ||
| * being written, but the last checkpoint that was written. This is useful for |
There was a problem hiding this comment.
Can you please be more specific what this returns if you call this while a checkpoint is being written (inside save inside a plugin)? It might make sense to add a test with a simple plugin that prints this number to the screen.
There was a problem hiding this comment.
Moving the assignment of last_checkpoint_id made it so that when this function is called within an overrided save() the checkpoint that is about be written is returned!
8887998 to
4e6db45
Compare
8b9a9f2 to
94c5a14
Compare
|
|
||
| #include <aspect/simulator.h> | ||
|
|
||
| const unsigned int checkpoint_id = this->get_checkpoint_id(); |
There was a problem hiding this comment.
you have to attach to a signal and print this information during runtime.
There was a problem hiding this comment.
see
aspect/tests/edit_parameters.cc
Line 54 in ba06f0f
There was a problem hiding this comment.
Is this what was missing?
There was a problem hiding this comment.
No. You will need to attach to a signal and print when the signal fires, otherwise you have no SimulatorAccess.
There was a problem hiding this comment.
Ahhh your other comment hadn't loaded for some reason when I asked. I'll take a look at that example
7c85f9f to
c5bca8f
Compare
|
@tjhei I'm not sure why the dealii-master tester is failing to compile, but what I have right now shows that the new function gets the checkpoint_id, but the id that gets printed in the test lags behind the actual checkpoint being written because the |
|
To properly show that it's getting the correct checkpoint_id when this function is meant to be used (in an overridden save() function), I guess I would need to create a new signal? |
You just need any plugin that implements Make sure you add this postprocessor to the list of active ones. |
c5bca8f to
be7a37d
Compare
|
@tjhei Thanks for helping with setting up this test, this should be good now! It shows the current checkpoint id that is being written in the screen output |
be7a37d to
bfc1521
Compare
| get_output_directory () const; | ||
|
|
||
| /** | ||
| * Return the ID of the checkpoint that ASPECT is currently writing. |
There was a problem hiding this comment.
| * Return the ID of the checkpoint that ASPECT is currently writing. | |
| * Return the ID of the checkpoint that ASPECT is currently writing or was last written. |
| @@ -0,0 +1,113 @@ | |||
| ----------------------------------------------------------------------------- | |||
b96c8ca to
7b231a1
Compare
7b231a1 to
ceabf63
Compare
This PR creates a function that enables other ASPECT plugins to access the last checkpoint id created by ASPECT. This is something that is currently useful for my postdoc work, and may also be useful to other groups who are coupling ASPECT to external softwares.