computablee / DotMP

A collection of powerful abstractions for parallel programming in .NET with an OpenMP-like API.
https://computablee.github.io/DotMP/
GNU Lesser General Public License v2.1
29 stars 7 forks source link

[PERFORMANCE] Optimize tasking API #131

Open computablee opened 11 months ago

computablee commented 11 months ago

Identify the function(s) which are causing performance issues.

The tasking API as it stands has some performance bottlenecks. A good look should be taken to see what kind of performance we can squeeze out of it.

Provide example code.

An example which puts lots of stress on the tasking system, showing its shortcomings:

DotMP.Parallel.ParallelMaster(() =>
{
    var tl1 = DotMP.Parallel.Taskloop(0, 1_000_000, grainsize: 1, action: i => { });
    var tl2 = DotMP.Parallel.Taskloop(0, 1_000_000, grainsize: 1, deps: tl1, action: i => { });
});

This not only takes a massive amount of memory, but also is excruciatingly slow as task dependency resolution is not very optimized right now.