-
Notifications
You must be signed in to change notification settings - Fork 536
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
parTraverseN
fairness
#4262
Comments
Hmmm ... I think the implementation detail that this is referring to, is that all tasks are submitted to the runtime at once, and then they race for the semaphore to get their turn to execute.
In an idealized runtime, such as the test runtime, this means there is no ordering/priority between the tasks.
Can you replicate these results on the test runtime? |
This does make sense honestly. We traverse the list in order and start fibers as we get to them. So it's actually not unbiased scheduling even on an idealized runtime. Amusingly, the test runtime will actually be fair because it runs in epochs with randomized sequencing within an epoch, so it's actually perfectly fair assuming infinitely fast compute. |
Okay, I've tried with This is the test runtime for example:
This is a 12-thread WSTP on a 6-core CPU (with hyperthreading):
|
The documentation of
parTraverseN
explicitly mentions fairness:But, based on some testing, later tasks in
ta
have a very very small chance of overtaking earlier ones. I suspect this is very task- and processor dependent, but (based on the wording) it seems to me that whoever wrote the docs felt that this is an important feature ofparTraverseN
, so it might be worth looking into...The text was updated successfully, but these errors were encountered: