-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
[Support] Add parallel_for_dynamic
with dynamic schedules
#9056
[Support] Add parallel_for_dynamic
with dynamic schedules
#9056
Conversation
parallel_for_dynamic
with dynamic schedules
try { | ||
worker(0); | ||
} catch (const std::exception& e) { | ||
for (auto&& thread : threads) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be a C++ noob question: may I ask why using the auto&&
r-value reference for thread
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I don't think there is much difference here :-) https://stackoverflow.com/questions/13130708/what-is-the-advantage-of-using-forwarding-references-in-range-based-for-loops
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, thanks for the pointer! :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks @junrushao1994 for adding dynamic scheduling support!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nitpick, otherwise LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks @junrushao1994
This PR introduces an API
parallel_for_dynamic
which is analogous to OpenMP's dynamic scheduling below:CC: @jcf94 @zxybazh @comaniac