-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
querying 'kind' of ABT_sched #31
Comments
Would If this is not sufficient, then can you attach a minimal piece of code that reproduces this problem (something of the size of the basic examples at https://github.com/pmodels/argobots/tree/master/test/basic would do)? |
Hi @halimamer, we actually need to replace both the pool and scheduler for the main xstream. Can we do that with the ABT_pool_add_sched() function, or will that just replace the scheduler and keep the original pool in place? For our use case they need to go in tandem because our scheduler sleeps when idle, and then is awoken by the pool when a new work unit is inserted, so they are kind of hooked together. |
@carns , the custom scheduler can pull from whichever pool you want, including the main scheduler's default pool. What you should know is that if the custom scheduler manages the same pool as the one it got push into, then that pool would be managed by that scheduler until the scheduler goes out of scope and the main scheduler would now be the one that manages it. |
For some background, in one of our projects, we have defined our own custom ABT scheduler (abt-snoozer) that we want to enable on all xstreams that call a specific initialization function in our API. This init routine can be called multiple times for a given xstream.
We ran into a problem, though, whenever we try to set a scheduler on an xstream that already has scheduled work units (e.g., on an xstream that has already called our init routine once and has work to perform). Looking over the ABT code, this appears to be expected behavior currently (TODO in
src/stream.c
@ line 783). Anytime an xstream calls our init routine multiple times, they will hit this error inABT_xstream_set_main_sched()
. We can work around this particular problem by callingABT_sched_get_size()
before setting the main scheduler to ensure there are no scheduled work units yet.However, the issue we currently face is that we want to be able to guarantee whether or not our custom scheduler has been enabled for the xstream calling our init routine. This is trivial if the xstream's scheduler doesn't already have scheduled work units -- just attempt to set the scheduler and fail out if any errors occur. If a scheduler has already been set and has work units, though, we can't tell the user whether it is our own custom scheduler, some basic scheduler in ABT, or something else. It would be pretty helpful if ABT exposed some sort of method for determining the scheduler type for a given xstream.
Looking at the
ABTI_sched
type, there is a param called 'kind' that appears to store a unique ID (in the form of a pointer to the underlying scheduler definition type) that we could use to compare with the abt-snoozer scheduler definition type pointer in our code. Is this something that could be exposed to users somehow? Alternatively, would it be easier to allowABT_xstream_set_main_sched()
to change schedulers that already have work units (my guess is that is much harder)? Or do you see any other potential workarounds for this type of problem?The text was updated successfully, but these errors were encountered: