-
Notifications
You must be signed in to change notification settings - Fork 52
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
Providing an ABT_eventual_wait_any #167
Comments
Thanks for your suggestion! In general, adding
Maybe only I would like to confirm two points: 1. Functionality
ABT_eventual eventuals[1000];
[Create threads and they will set eventuals[i] eventually];
for (int i = 0; i < 1000; i++ ) {
size_t index;
ABT_eventual_wait_any(1000, eventuals, &index, NULL);
[Do something];
eventuals[index] = ABT_EVENTUAL_NULL; // <- This is needed!
} Does it fit your use case? 2. PerformanceWe can do almost similar by repeating Anyway this performance optimization requires some efforts compared to adding a mere utility function. Is your use case of |
Regarding the other functions, they can all be implemented pretty easily with the existing ones. For example The problem with Regarding your two points:
|
Thank you for your comment! Conceptually functions I listed do something similar, but implementations are different. For example, only a single thread can join a thread only once in the case of I would like to ask more details how In my understanding, your current code does the following:
I guess you want to use I think |
Actually as I read the code I realize it's a bit different than that: The progress ULT is on a loop that does the following:
So actually if we use only 1 ES, we will always be in the case where total number of ULT > 1 and we will always have a timeout of 0, because there is always 1 caller of network operations + 1 progress loop in the pool. So the real issue with |
I would like to make my concern more concrete. The basic design of
The algorithm above can surely avoid yield in a busy loop but can be costly in a certain execution path (or need a very error-prone lock/wait-free type of algorithm). Specifically, the problem is incurred because As far as I see, your usage is more limited (e.g., only one ULT calls |
Thanks, that sounds indeed complicated. My request for |
It would be useful to have an
ABT_eventual_wait_any
function that takes an array of eventuals and blocks until one has been set (kind of the ABT equivalent of MPI_Waitany).A possible prototype:
where count is the number of eventuals in the array, and when returning this function sets
index
to the index of the eventual that completed.The text was updated successfully, but these errors were encountered: