DotMP Release v1.6.0
DotMP v1.6.0 doesn't incorporate a ton of new features (though there are some!). Rather, it aims to provide a wide plethora of well-needed performance improvements across the board.
Licensing Changes
The project license has been changed from MIT to LGPL 2.1.
Changes to the Scheduler API
The schedule
parameter in Parallel.For
and its derivatives now take implementations of the IScheduler
interface instead of a DotMP.Schedule
enum. The changes are fully source-compatible with previous versions, but breaks API and ABI compatibility. There are not only performance benefits to doing this, but in addition, the code is simpler, more modular, more maintainable, more readable, has less duplication, and is expansible by the user.
The IScheduler
interface is public-facing and permits users to implement their own custom schedulers. Details are outlined in the new wiki!
We also introduce a new work-stealing scheduler. The work-stealing scheduler can be accessed via DotMP.Schedule.WorkStealing
, and has been seamlessly integrated into the rest of DotMP. Details are also outlined in the new wiki.
Performance Improvements
There have been minor performance improvements across the board with parallel-for loops. However, collapsed for loops see substantial performance improvements, over 3x in some of my benchmarks. Static scheduling sees a performance bump as well from better avoidance of false sharing issues.
GetThreadNum
has also been optimized, though this is already such a lightweight function that it's hardly noticeable.
Tasking Improvements
Previously, it was possible to spawn tasks from within other tasks, but it was not possible for a task to wait on its child tasks to complete. Now, there is a new implementation of taskwait
which permits you to specify which tasks to wait on, and this version does not act as a barrier if called from within a task. If the default taskwait without arguments is called from within a task, a deadlock is detected and an exception is thrown.
Bug Fixes
Prior to this release, if an exception was thrown from inside a parallel region, it could not be caught from outside the region. Now, exceptions thrown inside parallel regions are properly caught and re-thrown in serial space, allowing for try/catch blocks to be thrown around a parallel region and catch exceptions that happen in parallel space.
Atomics
We have now implemented atomic subtraction for unsigned integer types. Two new methods were added to the Atomic
static class: uint Sub(ref uint, uint)
, and ulong Sub(ref ulong, ulong)
.
Reorganizing
There has been some internal reorganizing. DotMP exceptions have been moved to the DotMP.Exceptions
namespace, and the actual scheduler implementations have been moved to the DotMP.Schedulers
namespace.
What's Changed
- Full rewrite of core scheduler, support custom schedulers by @computablee in #101
- Implement proper exception handling from threads by @computablee in #103
- nuget: bump the fluent group in /DotMP-Tests with 1 update by @dependabot in #102
- Major refactoring by @computablee in #104
- nuget: bump the bench group in /benchmarks/HeatTransfer with 2 updates by @dependabot in #106
- nuget: bump the xunit group in /DotMP-Tests with 3 updates by @dependabot in #105
- Significant performance improvements, new scheduler by @computablee in #107
- Better benchmark, more lenient testing for GitHub Actions by @computablee in #109
- Improve
GetThreadNum
performance by @computablee in #111 - nuget: bump Microsoft.NET.Test.Sdk from 17.7.2 to 17.8.0 in /DotMP-Tests by @dependabot in #112
- nuget: bump the xunit group in /DotMP-Tests with 1 update by @dependabot in #113
- Implement optimized index calculations for collapse(4) and higher by @computablee in #114
- nuget: bump the xunit group in /DotMP-Tests with 5 updates by @dependabot in #116
- Implement atomic subtraction for unsigned integers by @computablee in #118
- Add error checking to ForCollapse by @computablee in #120
- Create symbols for nuget by @computablee in #121
- Optimize #118 by @computablee in #123
- Allow taskwait from within tasks by @computablee in #122
- Add checks for overflow in schedulers by @computablee in #124
Full Changelog: v1.5.0...v1.6.0