Skip to content

BP5: Rerouting improvements#4983

Merged
eisenhauer merged 3 commits into
ornladios:masterfrom
scottwittenburg:rerouting-improvements
May 22, 2026
Merged

BP5: Rerouting improvements#4983
eisenhauer merged 3 commits into
ornladios:masterfrom
scottwittenburg:rerouting-improvements

Conversation

@scottwittenburg

@scottwittenburg scottwittenburg commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

This PR includes one correctness fix, and several small, potential performance improvements to the rerouting aggregator (#4647).

This PR should not be merged while it contains the final WIP commit that forces rerouting (whenever possible) in CI.

Correctness fix

Previously the buffer pool for non-blocking sends was a fixed size (set at 100), and it had no guards against re-using (and thus, obliterating) a buffer while a previous ISend using the buffer may still have been incomplete. This commit introduces a role-appropriate pool size, and also adds logic that forces the next ISend to wait if all buffers in the pool are actively being used by a prior ISend.

Performance improvements

To reduce the likelihood of the background messaging thread spinning and consuming CPU while nothing is happening, this PR introduces a conditional yield within the background thread loop. If no work is done during an iteration of the loop (message receipt and response, rerouting pair identified and messaged, etc...) then yield() is called at the end of the loop.

MPI send-to-self can sometimes be slow, and it was used by each subcoordinator to signal itself to write at the beginning of the workflow. This PR replaces the self-send with direct signalling of the main thread to begin writing.

Previously, once the loop finished, the thread exited immediately, possibly causing buffers associated with incomplete ISend to be destroyed. Now that we're collecting the request object from each ISend (stored in the buffer pool), this PR iterates the pool one final time to wait for any incomplete ISend to complete.

@scottwittenburg scottwittenburg force-pushed the rerouting-improvements branch 2 times, most recently from 08bf207 to 5d994e1 Compare April 3, 2026 00:49
@scottwittenburg scottwittenburg force-pushed the rerouting-improvements branch from 5d994e1 to 9a8d2ae Compare May 5, 2026 17:55
@scottwittenburg scottwittenburg marked this pull request as ready for review May 5, 2026 18:47
@scottwittenburg

Copy link
Copy Markdown
Contributor Author

@eisenhauer I have left a WIP commit on here for testing in CI, but I will remove that commit in preparation to merge, once you are comfortable with the changes.

@scottwittenburg scottwittenburg requested a review from eisenhauer May 5, 2026 18:50
Comment thread source/adios2/helper/adiosComm.cpp Outdated
@scottwittenburg scottwittenburg force-pushed the rerouting-improvements branch from 9a8d2ae to 7b8ba22 Compare May 20, 2026 21:08
The MPI version of ISend already returned a Comm::Req object that
wrapped however many actual requests resulted from the send (there
could be multiple if it was batched).

This commit exposes MPI_Test as Test, which returns true if MPI_Test
returns true for all the encapsulated request objects.
@scottwittenburg scottwittenburg force-pushed the rerouting-improvements branch from 7b8ba22 to 9a536ca Compare May 20, 2026 21:11
Previously the buffer pool for non-blocking sends was a fixed size
(set at 100), and had it no guards against re-using (and thus,
obliterating) a buffer while a previous ISend using the buffer may
still have been incomplete. This commit introduces a role-appropriate
pool size, and also adds logic that forces the next ISend to wait if
all buffers in the pool are actively being used by a prior ISend.

To reduce the likelihood of the background messaging thread spinning
and consuming CPU while nothing is happening, this commit introduces
a conditional yield within the background thread loop. If no work is
done during an iteration of the loop (message receipt and response,
rerouting pair identified and messaged, etc...) then yield() is
called at the end of the loop.

MPI send-to-self can sometimes be slow, and it was used by each
subcoordinator to signal itself to write at the beginning of the
workflow. This commit replaces the self-send with direct signalling
of the main thread to begin writing.

Previously, once the loop finished, the thread exited immediately,
possibly causing buffers associated with incomplete ISends to be
destroyed. Now that we're collecting the request object from each
ISend (stored in the buffer pool), this commit iterates the pool
one final time to wait for any incomplete ISend to complete.
@scottwittenburg scottwittenburg force-pushed the rerouting-improvements branch from 9a536ca to bb41ea9 Compare May 20, 2026 21:49
@eisenhauer

Copy link
Copy Markdown
Member

OK, I think this looks good now. I think you can remove the bit that forces rerouting and lets get this merged!

@scottwittenburg scottwittenburg force-pushed the rerouting-improvements branch from bb41ea9 to 140091b Compare May 21, 2026 15:01
@scottwittenburg

Copy link
Copy Markdown
Contributor Author

@eisenhauer I think this is ready for approval/merge whenever you're ready.

@eisenhauer eisenhauer merged commit 7f9baae into ornladios:master May 22, 2026
48 checks passed
@scottwittenburg

Copy link
Copy Markdown
Contributor Author

Thank you for your help getting this merged @eisenhauer!

@scottwittenburg scottwittenburg deleted the rerouting-improvements branch May 22, 2026 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants