How to yield a running Xstream?
Hi All, I have a scenario where two *Xstreams*, *xstream-0* and *xstream-1*, are bound to *core-0* and *core-1*. And, I have an *ABT_thread*, which is a long-running thread executing on *xstream-0*. I want to know if we could do the following with Argobots APIs 1. Is it possible to yield the execution of *xstream-0*, which is executing the long-running *ABT_thread*? 2. If the above is true, is it also possible to transfer the partial execution of that *ABT_thread* to *xstream-1*? Best, Raghav
Hi Raghav, Thanks for your great questions! 1. Is it possible to yield the execution of xstream-0, which is executing the long-running ABT_thread? I might misunderstand "yield" here, but - An execution stream is running on Pthread, so if the OS thinks that thread should yield (=context switch), xstream-0 will automatically yield to another Pthread/process based on the OS scheduling policy. - Argobots ULTs (=ABT_thread) do not automatically yield, so if you want to run another ULT on xstream-0 before completing the long-running ABT_thread, you need to explicitly call an Argobots scheduling function (e.g., "ABT_self_yield()"). A ULT yields if needed when you use synchronization functions (e.g., ABT_mutex_lock() against a mutex that has already been locked by another ULT). 2. If the above is true, is it also possible to transfer the partial execution of that ABT_thread to xstream-1? Yes, it is possible. There are many ways to achieve this, but examples are as follows. * Random work stealing: For example, ULT-0 on xstream-0 yields before finishing its execution and is pushed to a random work-stealing pool. Later, an idle xstream-1 might pop ULT-0 from that pool and run it (thought xstream-0 might pop that ULT-0). If ULT-0 is popped by xstream-1, the remaining execution will be performed on xstream-1. * More deterministic migration-like scheduling. For example, we can change an associated pool of ULT-0 on xstream-0 (e.g., by using "ABT_set_associated_pool()") to a pool that is exclusively popped by xstream-1 (precisely speaking, a scheduler of xstream-1) before calling "ABT_self_yield()". ULT-0 pushed to that pool will be popped by only xstream-1 unlike the random work stealing case, so it should be executed by xstream-1 later. Thanks, Shintaro On Sun, Feb 6, 2022 at 11:46 PM Raghav Gupta via discuss < [email protected]> wrote:
Hi All,
I have a scenario where two *Xstreams*, *xstream-0* and *xstream-1*, are bound to *core-0* and *core-1*. And, I have an *ABT_thread*, which is a long-running thread executing on *xstream-0*.
I want to know if we could do the following with Argobots APIs
1. Is it possible to yield the execution of *xstream-0*, which is executing the long-running *ABT_thread*? 2. If the above is true, is it also possible to transfer the partial execution of that *ABT_thread* to *xstream-1*?
Best,
Raghav _______________________________________________ discuss mailing list [email protected] https://lists.argobots.org/mailman/listinfo/discuss
participants (2)
-
Raghav Gupta -
Shintaro Iwasaki