Is there an implementation of a ibarrier in either sync or async Rust?
Are you running MPI? If so, there are Rust bindings for
MPI_Ibarrier. Tokio has a
Barrier type, but it blocks the task till all other tasks have reached the barrier. Since Tokio is an asynchronous runtime I'd say
Barrier is something between
MPI_Barrier in the sense that it does not block the whole process or a thread but only a lightweight task, allowing tokio to process other tasks in the meantime.
Thanks. A hypothetical
ibarrier in tokio would allow the existing async function to make progress though which would be significantly easier to reason about with the borrow checker
How do you intend to wait for the non-blocking barrier in async Rust without calling
.await at some point? In a busy loop? In general it is considered good practice not to have tasks that are busy for longer periods. To quote from an excellent article about async programming in Rust:
Async code should never spend a long time without reaching an
I want something like
let ibarrier = Ibarrier::new(n);
// in async task:
// do some stuff
ibarrier.wait().await; // completes once n tasks have called `.ibarrier.signal()
If it isn't implemented I can implement it, I just want to know if it is already out there. The "some stuff" might itself call
await, and I would be okay with
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.