Skip to content
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

ParallelUnbalancedWork for efficient unbalanced parallel loops #7787

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

benaadams
Copy link
Member

Changes

  • Added the ParallelUnbalancedWork class to efficiently execute parallel loops, handling unbalanced workloads.
  • Implemented static For methods to support parallel execution with and without thread-local data, including initialization and finalization functions.
  • Utilized thread pooling and a shared counter SharedCounter to distribute iterations among threads dynamically.
  • Aimed to optimize performance in scenarios where the workload per iteration is uneven, ensuring better resource utilization and reduced execution time; rather than the main thread .Waiting for background threads to complete
  • Less allocations than Parallel.For

Types of changes

What types of changes does your code introduce?

  • Optimization

Testing

Requires testing

  • No

- Introduced the `ParallelUnbalancedWork` class to efficiently execute parallel loops over a range of integers, handling unbalanced workloads.
- Added static `For` methods to support parallel execution with and without thread-local data, including initialization and finalization functions.
- Utilized thread pooling and a shared counter (`SharedCounter`) to distribute iterations among threads dynamically.
- Implemented internal classes (`BaseData`, `Data`, and `InitProcessor<TLocal>`) to manage shared state and thread synchronization.
- Aimed to optimize performance in scenarios where the workload per iteration is uneven, ensuring better resource utilization and reduced execution time.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant