Repository navigation
Scope collective ID pool per query - #24547
Jesse-Bakker wants to merge 4 commits into
Conversation
afdf8e9 to
fe1d521
Compare
|
/ok to test fe1d521 |
wence-
left a comment
There was a problem hiding this comment.
Please run pre-commit to fix the minor CI style errors.
Also a question about the safety of using the same communicator with two concurrent queries.
| # Each query reserves its collective IDs from its own pool, so that the | ||
| # IDs agree across ranks even if this process concurrently takes part in | ||
| # other queries (possibly on other communicators). | ||
| with collective_id_scope(): | ||
| return _evaluate_on_rank( | ||
| ctx, | ||
| comm, | ||
| py_executor, | ||
| ir, | ||
| config_options, | ||
| quent_query_worker_state=quent_query_worker_state, | ||
| query_id=query_id, | ||
| ) |
There was a problem hiding this comment.
question: What would happen if you ran two queries on the same communicator concurrently with this setup? Because each query generates its own id scope, I think that you would get overlapping ids, and message passing could get mixed up.
Should we key the id scope by the communicator?
There was a problem hiding this comment.
Running concurrent queries on the same communicator would probably fail miserably, whereas before this change, it would probably work as long as the queries are started in the same order on all ranks. Keying the scope by communicator would work for that, but again, only if the queries are started in the same order on all ranks. It should be possible for a caller to sequence that using a queue and a barrier though.
There was a problem hiding this comment.
Hmm, no, it also depends on release timing and each rank can time that slightly differently, so that can still race and cause mismatched collective ids I think.
The pool of vacant collective IDs was process-global. The global pool's state depends on every query the process has run or is running. So, a process that first runs a query as part of one cluster and then as part of another can allocate different collective IDs. I see two possible solutions: - Return the collective IDs to the global pool in reverse order. This will make sequential queries work (assuming they always return all their IDs properly through the context manager) - Scope the collective IDs per query through a ContextVar, making their ID pools independent I went for the latter approach, as it seems more robust.
fe1d521 to
45b76fc
Compare
|
/ok to test 45b76fc |
|
/ok to test 94dc15c |
Description
The pool of vacant collective IDs was process-global. The global pool's
state depends on every query the process has run or is running. So, a
process that first runs a query as part of one cluster and then as part
of another can allocate different collective IDs.
I see two possible solutions:
will make sequential queries work (assuming they always return all their
IDs properly through the context manager)
ID pools independent
I went for the latter approach, as it seems more robust.
Checklist