DotMP Release v1.5.0
This is major release v1.5.0. There are lots of changes here:
Collapsed worksharing-for loops
Several new functions have been added to the Parallel
class, including ForCollapse
, ForReductionCollapse
, ParallelForCollapse
, and ParallelForReductionCollapse
. Each of these has the ability to run n-dimensional collapsed for loops. Collapsed for loops work if you have a situation similar to the following:
for (int i = 0; i < M; i++)
{
for (int j = 0; j < N; j++)
{
doWork(i, j);
}
}
Previously, the only official way to parallelize this loop would have been to parallelize only the outermost loop, leaving the innermost one in serial:
DotMP.Parallel.ParallelFor(0, M, i =>
{
for (int j = 0; j < N; j++)
{
doWork(i, j);
}
});
For many use cases this is a sufficient amount of parallelism, but if the outermost loop has few iterations, it may be beneficial to parallelize across both loops, effectively multiplying the amount of iterations that the scheduler has to work with. This means that larger chunk sizes can be used while maintaining efficient load balancing. The new way to do this is as follows:
DotMP.Parallel.ParallelForCollapse((0, M), (0, N), (i, j) =>
{
doWork(i, j);
});
This allows the DotMP loop schedulers to have M*N
iterations to work with, increasing flexibility while scheduling.
There are overloads allowing this tuple syntax for 2D, 3D, and 4D collapsed for loops. For 5D or higher, you instead pass an array of tuples representing each dimension's start and end indices, and the action takes an array of integers as indices.
New locking API
The locking API has been updated to be more object-oriented. Previously, the following format was used to create, lock, and unlock a lock:
DotMP.Lock l = new DotMP.Lock();
DotMP.Lock.Set(l);
DotMP.Lock.Unset(l);
The new API instead calls methods on the lock object:
DotMP.Lock l = new DotMP.Lock();
l.Set();
l.Unset();
Other changes
There's lots of other changes. A basic summary is here:
- The project has a new logo, thanks to @exrol.
- Lots of documentation issues have been fixed, including a lack of NuGet documentation.
- There have been mountains of bug fixes throughout the project.
- More rigorous error checking throughout the project.
- More rigorous testing on our end.
- Some internal optimizations, refactoring, tidying up, and removing dead code.
Full Changelog
- Chore: Remove dead code by @blouflashdb in #53
- feat: add logo by @exrol in #54
- Update bug-fixes branch by @computablee in #55
- Fix documentation issues by @computablee in #56
- Fix DotMP.Parallel.Single by @blouflashdb in #57
- Merge bug fixes into main by @computablee in #60
- Updated Lock API (Issue #43) by @HarryHeres in #61
- Update README.md with fixed information by @computablee in #62
- Fixed potential rare exception in taskwait by @computablee in #63
- Added full test suite for atomics by @computablee in #65
- Add information for all-contributors by @computablee in #66
- [testing] PR to get all-contributors working by @computablee in #67
- [tributors] contributors/update-2023-10-05 by @github-actions in #68
- Fix linting issues with contributors.yml by @computablee in #69
- actions: bump vsoch/pull-request-action from 1.0.21 to 1.0.24 by @dependabot in #70
- actions: bump actions/checkout from 3 to 4 by @dependabot in #71
- nuget: bump Microsoft.NET.Test.Sdk from 17.3.2 to 17.7.2 in /DotMP-Tests by @dependabot in #72
- nuget: bump xunit.analyzers from 1.0.0 to 1.3.0 in /DotMP-Tests by @dependabot in #73
- nuget: bump xunit.runner.visualstudio from 2.4.5 to 2.5.1 in /DotMP-Tests by @dependabot in #74
- nuget: bump FluentAssertions from 6.7.0 to 6.12.0 in /DotMP-Tests by @dependabot in #75
- nuget: bump xunit.core from 2.4.2 to 2.5.1 in /DotMP-Tests by @dependabot in #76
- nuget: bump FluentAssertions.Analyzers from 0.17.2 to 0.25.0 in /DotMP-Tests by @dependabot in #79
- Refactoring, tidying up codebase by @computablee in #81
- Add more tests for reductions and bug fix by @computablee in #82
- Add test for
Parallel.MasterTaskloop
by @computablee in #83 - Dependabot groups and a PR template by @Skenvy in #84
- [tributors] contributors/update-2023-10-09 by @github-actions in #85
- Features by @computablee in #86
- Bug fixes, better test coverage by @computablee in #88
- Better testing, exception handling, documentation, remove dead code by @computablee in #89
- Fix issues with README by @computablee in #90
- Remove dead code by @computablee in #91
- nuget: bump the xunit group in /DotMP-Tests with 5 updates by @dependabot in #93
- Worksharing-For Optimizations by @computablee in #94
- nuget: bump the xunit group in /DotMP-Tests with 3 updates by @dependabot in #97
- Validate DotMP input parameters by @computablee in #98
New Contributors
- @blouflashdb made their first contribution in #53
- @exrol made their first contribution in #54
- @HarryHeres made their first contribution in #61
- @Skenvy made their first contribution in #84
Full Changelog: v1.4.1...v1.5.0