Skip to content
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

Group NCDatasets.sync calls #2828

Merged
merged 1 commit into from
Mar 25, 2024
Merged

Group NCDatasets.sync calls #2828

merged 1 commit into from
Mar 25, 2024

Conversation

charleskawczynski
Copy link
Member

@charleskawczynski charleskawczynski commented Mar 22, 2024

In light of #2827, this PR hoists the NCDatasets.sync to a separate callback so that we can (eventually) and use Threads.@spawn to leverage threads (if we have them).

I've also named/annotated compute_callback and output_callback, so that they show up in the NVTX reports.

@Sbozzolo
Copy link
Member

Sbozzolo commented Mar 22, 2024

I think we should also avoid calling sync for every diagnostic. Instead, let's flush the output once per diagnostic cycle.

As in #2623

@charleskawczynski charleskawczynski changed the title Do NCDatasets.sync asynch if we have threads Do NCDatasets.sync async if we have threads Mar 22, 2024
@charleskawczynski charleskawczynski force-pushed the ck/async_sync branch 4 times, most recently from 9e9521d to 4c87928 Compare March 22, 2024 16:42
@charleskawczynski
Copy link
Member Author

I think we should also avoid calling sync for every diagnostic. Instead, let's flush the output once per diagnostic cycle.

As in #2623

Yeah, I agree, but first I'd like to see how this performs, since it's functionally equivalent. Updating it to be called every diagnostics lcd cycle is a much simpler change than this is turning out to be.

@Sbozzolo
Copy link
Member

I think we should also avoid calling sync for every diagnostic. Instead, let's flush the output once per diagnostic cycle.
As in #2623

Yeah, I agree, but first I'd like to see how this performs, since it's functionally equivalent. Updating it to be called every diagnostics lcd cycle is a much simpler change than this is turning out to be.

Do you mean functionally equivalent to main?

@charleskawczynski
Copy link
Member Author

Do you mean functionally equivalent to main?

Yeah. It's technically different in terms of order of compute / io, but it should at least be calling sync the same number of times.

@charleskawczynski charleskawczynski force-pushed the ck/async_sync branch 4 times, most recently from 95b2a8b to 269bfab Compare March 22, 2024 23:53
@charleskawczynski charleskawczynski changed the title Do NCDatasets.sync async if we have threads Group NCDatasets.sync calls Mar 22, 2024
@Sbozzolo Sbozzolo disabled auto-merge March 23, 2024 01:03
writer = diag.output_writer
if writer isa NetCDFWriter && sync_needed(step, diag)
output_path = outpath_name(output_dir, diag)
# TODO: find out why Threads.@spawn segfaults in multithreaded IO test
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(It should not be a problem at the moment because sync does not contain an MPI call.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I thought that only the root process does this, but it's a good point.

@charleskawczynski charleskawczynski force-pushed the ck/async_sync branch 3 times, most recently from 7d71b4e to 5ea2d97 Compare March 25, 2024 11:36
@charleskawczynski charleskawczynski added this pull request to the merge queue Mar 25, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 25, 2024
@charleskawczynski charleskawczynski merged commit 5f918cd into main Mar 25, 2024
11 checks passed
@charleskawczynski charleskawczynski deleted the ck/async_sync branch March 25, 2024 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants