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.
Sometimes, NetCDF files need syncing (force-writing to disk). This seems to be particularly the case for GPU runs.
This PR adds an option to provide the
NetCDFWriter
with a schedule to callNCDatasets.sync
based on arbitrary conditions.The default behavior depends on the context: on CPUs, we let
NetCDF
manage its buffered writes, on GPUs, we callsync
at the every time steps for those datasets that need to be synced (ie, those that were written since the last sync).In general, we keep track of what files have been recently touched (adding them to a list internal to the
writer
) and wheneversync
is called,NCDatasets.sync
is called on those files. This ensures that only files that needs to be synced are synced and that callingsync
twice in a row results in a no-op for the secondsync
.Closes #33