-
Notifications
You must be signed in to change notification settings - Fork 69
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
Handling of interruptions #503
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting PR, @JulienDoerner. It seems to be working fine.
I left a few style-related comments.
However, one thing I find a bit problematic is the fact that you are calling a module (module/Output.h) from inside the ModuleList.
Avoiding this type of cross talks and have completely independent module is, for better or for worse, the spirit of CRPropa (although in this case I personally don't see how things could go wrong).
Therefore, my question is: can't this implementation be moved around to be triggered in the observer, like what is done for onDetection
? Maybe there could be an onInterruption
method that does the same thing?
This would avoid interactions between modules and hold for all types of outputs, I suppose.
src/ModuleList.cpp.in
Outdated
if (cand -> isActive()) | ||
interruptAction -> process(cand); | ||
else | ||
KISS_LOG_WARNING << "Try to dump a candidate which is not active anymore! \n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Improve message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to improve the message. It contains the function which is raising the error and the the serial number of the candidate to trace down the reason for this.
I applied your code style comments. About the modules: I would not suggest to put it into the observer (which is stored inside the module list), as it could lead to some confusions if you have different observers in the same simulation. |
Hm... That does seem to make sense. However, I'm personally very reluctant to see modules in the Maybe something like this could be though of.
|
Hi @rafaelab and @JulienDoerner |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HI @JulienDoerner,
I have to say that I am personally not fond of seeing an output type being used in this way, but I have no better solution, and I think this is a very useful feature.
Therefore, I suggest you simply fix the two typos I pointed out, and we merge (I will already approve it).
std::cerr << "############################################################################\n"; | ||
std::cerr << "# Interrupted CRPropa simulation \n"; | ||
std::cerr << "# A total of " << notFinished.size() << " candidates have not been started.\n"; | ||
std::cerr << "# the indicies of the vector haven been written to to output file. \n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: "indices"
if (cand->isActive()) | ||
interruptAction->process(cand); | ||
else | ||
KISS_LOG_WARNING << "ModuleList::dumpCandidate is called with a non active candidate. This should not happen for the interrupt action. Please check candidate with serieal number " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: serial number.
Dear all,
This PR introduces a new handling of interruption of CRPropa simulations. The idea is to store all candidates which are currently propagating in the simulation and write them into an output file. Additionally the information about the number of not yet started candidates will be displayed.
Having this information it is possible to continue the simulation after it was interrupted.
handling
To use the storing at an interruption the user has to provide an output module to the
moduleList
.After the break the candidates which have stored can be reloaded with the
particleCollector
.In case of a simulation with a
Candidate Vector
the output file will also contain the indices of the not started particles.This allows a real tracing that all particles are covered and nothing is lost.
examples in the documentation
To illustrate this new feature two example notebooks (one with a source interface and one with a candidate vector) are added to the documentation.
The example with the source interface needs some manual adaption of the number of not started Candidates.
And both example need a manually triggered Keyboard Interrupt.
Therefore, both notebooks are excluded from the example notebook testing.