Ok, got it- thanks!

-Phil

From: Iwasaki, Shintaro <siwasaki@anl.gov>
Sent: Thursday, August 13, 2020 3:33 PM
To: Carns, Philip H. <carns@mcs.anl.gov>; discuss@lists.argobots.org <discuss@lists.argobots.org>
Subject: Re: ABT_thread_yield_to() semantics when crossing pools
 
Hi Phil,

Sorry, it was very confusing. Let's say the current thread (Tc) and the target thread (Tt).
Tc is running on the current ES. Tt must be sleeping in a pool.

- The target thread (Tt) is removed from Tt's pool. If failed (e.g., Tt is being executed by another ES), it causes undefined behavior (NO ERROR CHECK).
- The current thread (Tc) suspends and is pushed to Tc's pool.
- After suspending Tc, the current ES/scheduler executes Tt.
At any rate, does the target thread run on the ES that was previously executing the thread that called yield_to()?
Yes.

Thanks,
Shintaro

From: Carns, Philip H. <carns@mcs.anl.gov>
Sent: Thursday, August 13, 2020 2:10 PM
To: Iwasaki, Shintaro <siwasaki@anl.gov>; discuss@lists.argobots.org <discuss@lists.argobots.org>
Subject: Re: ABT_thread_yield_to() semantics when crossing pools
 
Can you define what the yielded thread (Ty) and current thread (Tc) are?

Naively I would think that the current thread is the one invoking ABT_thread_yield_to(), but that also means that it is the yielded thread as well 🙂

At any rate, does the target thread run on the ES that was previously executing the thread that called yield_to()?

thanks,
-Phil

From: Iwasaki, Shintaro <siwasaki@anl.gov>
Sent: Wednesday, August 12, 2020 11:31 AM
To: discuss@lists.argobots.org <discuss@lists.argobots.org>
Cc: Carns, Philip H. <carns@mcs.anl.gov>
Subject: Re: ABT_thread_yield_to() semantics when crossing pools
 
Hi Phil,

This is not explicitly mentioned, but ABT_thread_yield_to() works as follows:
- The yielded thread (Ty) is removed from Ty's pool. If failed (e.g., Ty is being executed by another ES), it causes an undefined behavior (NO ERROR CHECK).
- The current thread (Tc) suspends and is pushed to Tc's pool.

So unless the target thread is "ready" in the pool (i.e., not running, not completed), there is no problem.
It should work even if Ty and Tc are in separate or customized pools.

(This "NO ERROR CHECK" part cannot be easily fixed because of the current ABT_pool_remove() specification.
If you want to use this feature with an error check, please tell us (or create a GitHub issue) so that we can fix it.)

Thanks,
Shintaro Iwasaki


From: Carns, Philip H. via discuss <discuss@lists.argobots.org>
Sent: Wednesday, August 12, 2020 9:56 AM
To: discuss@lists.argobots.org <discuss@lists.argobots.org>
Cc: Carns, Philip H. <carns@mcs.anl.gov>
Subject: [argobots-discuss] ABT_thread_yield_to() semantics when crossing pools
 
Hi,

I was just curious: what happens if you create a thread on a separate pool (with it's own execution streams) and then call ABT_thread_yield_to()?

Nothing?  Error?  Or maybe it pulls the ULT back to the local execution stream?

thanks!
-Phil