[argobots-discuss] Attribution of ULT ids
Dorier, Matthieu
mdorier at anl.gov
Tue Jun 22 05:15:47 CDT 2021
Hi Shintaro,
Thanks for your response. I already have an implementation similar to what you propose, I was just wondering if there was a way to implement it using those unit ids. Apparently not.
Thanks!
Matthieu
From: "Iwasaki, Shintaro" <siwasaki at anl.gov>
Date: Monday, 21 June 2021 at 02:58
To: "discuss at lists.argobots.org" <discuss at lists.argobots.org>
Cc: "Dorier, Matthieu" <mdorier at anl.gov>
Subject: Re: Attribution of ULT ids
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/20210622/a826adfa/attachment.html>
More information about the discuss
mailing list