Skip to content

DotMP Release v1.5.0

Compare
Choose a tag to compare
@computablee computablee released this 25 Oct 22:56
· 298 commits to main since this release

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:

  1. The project has a new logo, thanks to @exrol.
  2. Lots of documentation issues have been fixed, including a lack of NuGet documentation.
  3. There have been mountains of bug fixes throughout the project.
  4. More rigorous error checking throughout the project.
  5. More rigorous testing on our end.
  6. Some internal optimizations, refactoring, tidying up, and removing dead code.

Full Changelog

New Contributors

Full Changelog: v1.4.1...v1.5.0