Recallbacks#381
Conversation
…imutils interfaces.
Co-authored-by: Thomas H. Gibson <gibsonthomas1120@hotmail.com>
…et_timestep, add order to restart data.
|
Ready for another peak. @majosm and @thomasgibson. |
…r indentation errors, etc.
majosm
left a comment
There was a problem hiding this comment.
Looking good! I left a few minor comments.
Co-authored-by: Matt Smith <mjsmith6@illinois.edu>
… informative, cleaner.
|
I've built-in a health failure to autoignition example, so CI should fail that example. Don't be alarmed :) |
| if step == 5: # quick test | ||
| health_errors = True |
There was a problem hiding this comment.
I assume this was left-over testing that can be removed?
There was a problem hiding this comment.
Yes - just wanting to demonstrate the health error while we have this PR cracked open. I can certainly remove it right away if it is distracting.
| health_errors = my_health_check(dv) | ||
| if comm is not None: | ||
| health_errors = comm.allreduce(health_errors, op=MPI.LOR) |
There was a problem hiding this comment.
Think it's worth adding in a utility function in simutils that does this reduction across ranks? Just to clean this up. I think @majosm has some code somewhere that does this. This is not a functional request, just aesthetics.
There was a problem hiding this comment.
health_errors = allsync(my_health_check(dv), op=MPI.LOR) ?
Oh woops, we'd need to pass in comm too. Hrm...
There was a problem hiding this comment.
I mean, comm is already being used around so is it that bad pass it? I don't see the problem.
There was a problem hiding this comment.
Here is the code snippet @thomasgibson was referring to:
Lines 161 to 166 in e47d3d0
(Don't copy the implementation, it's dumb. Just use MPI.LOR.)
Edit: I'm not sure this adds anything as-is. You might be able to stick the if comm is not None: check in here though.
There was a problem hiding this comment.
Just real quick before I implement..... @thomasgibson and @majosm
How would we feel about this utility:
def allsync(local_value(s), comm, op=MPI.MAX):
if comm is None:
return local_value(s)
return comm.allreduce(local_values, op=op)
global_value(s) = allsync(local_value(s), comm, op=MPIOP)This way the user can use the allsync utility to do syncing operations on arrays of data, or other objects as supported by comm, and control over what operation is performed.
thomasgibson
left a comment
There was a problem hiding this comment.
@MTCam I just left some minor comments, but overall I'm happy with the auto-ignition example. I think once the changes are applied to the other examples, we can finally merge this.
|
I think this is ready for your eyes again @thomasgibson and @majosm. The only changes were the ones we discussed (5306e30), (5bd30d8). |
Continued from PR (#370):
This builds on @thomasgibson callbacks and uses the opportunity to clean up some cumbersome junk in the infrastructure that was gumming up the use of the code in production. Instead of building the callback and health checking facilities on old junky code that we didn't like, we refactored it a bit here, to give the user more flexibility, and responsibility, for the behavior of the simulation application.
checkpoint) to the explicitly named (pre_step_callback)sim_checkpoint,sim_vizualization, for a more direct, much less "fluid-specific" interface