[argobots-discuss] Attribution of ULT ids
Iwasaki, Shintaro
siwasaki at anl.gov
Sun Jun 20 20:58:53 CDT 2021
Hi, Matthieu
Thank you for your question.
> Is the ABT_unit_id associated to threads and tasks a number that necessarily increases as new threads/tasks are created?
No. Even in the current implementation, a ULT ID is determined when it is inquired about (e.g., `by ABT_thread_get_id()`), not when a ULT is created. This "inquiry" timing depends on configuration options. In the future, this ID can be replaced by a "pointer". I do not recommend you rely on the ID to know when ULTs/tasks are created.
> I would like to implement a custom pool that prioritizes running older ULTs over newer ones when possible.
I do not know how strictly you want to control scheduling, but the following might be easy to implement and beneficial.
sched_run():
while (1) {
/* Check old_thread_pool first. */
if (unit = ABT_pool_pop(old_thread_pool)) {
/* If "unit" yields, it is pushed to old_thread_pool.
* If you want, you can push it to very_old_thread_pool. */
ABT_xstream_run_unit(unit, old_thread_pool);
continue;
}
/* Check new_thread_pool if old_thread_pool is empty */
if (unit = ABT_pool_pop(new_thread_pool))
/* If "unit" yields, it is pushed to old_thread_pool.
* Note that Argobots 1.1+ does not need ABT_unit_set_associated_pool()
* https://github.com/pmodels/argobots/pull/317 */
ABT_xstream_run_unit(unit, old_thread_pool);
}
}
The scheduling can cause a deadlock. Please check the solution in the discussion below.
Related discussion: https://lists.argobots.org/pipermail/discuss/2020-August/000085.html
Thanks,
Shintaro
________________________________
From: Dorier, Matthieu via discuss <discuss at lists.argobots.org>
Sent: Sunday, June 20, 2021 10:15 AM
To: discuss at lists.argobots.org <discuss at lists.argobots.org>
Cc: Dorier, Matthieu <mdorier at anl.gov>
Subject: [argobots-discuss] Attribution of ULT ids
Hi,
Is the ABT_unit_id associated to threads and tasks a number that necessarily increases as new threads/tasks are created?
I’m asking because I would like to implement a custom pool that prioritizes running older ULTs over newer ones when possible, and one way of knowing which of multiple ULTs is older could be to look at the ABT_unit_id and prioritize ULTs with the smallest id.
Thanks,
Matthieu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.argobots.org/pipermail/discuss/attachments/20210621/0a4341bc/attachment.html>
More information about the discuss
mailing list