[argobots-discuss] How to yield a running Xstream?
Shintaro Iwasaki
shintaro.iwasaki.work at gmail.com
Mon Feb 7 10:45:13 CST 2022
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 <
discuss at lists.argobots.org> 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
> discuss at lists.argobots.org
> https://lists.argobots.org/mailman/listinfo/discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.argobots.org/pipermail/discuss/attachments/20220207/a1f983fd/attachment.html>
More information about the discuss
mailing list