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 8 forks source link

Allow taskwait from within tasks #122

Closed computablee closed 10 months ago

computablee commented 10 months ago

Which issue are you addressing?

Closes #49

How have you addressed the issue?

There's been a lot of changes. To use taskwait from within a task, you must specify which tasks to wait on. Taskwait keeps track of whether or not it's being called from parallel space or from task space, and will selectively enact barriers depending on the behavior. If a task is being called from global space, it's treated as a barrier, but if called from within a task, it won't act as a barrier.

If you don't specify the tasks to wait on when calling taskwait from within a task, an exception is thrown. Specifying the tasks to wait on does not affect how tasks are scheduled-- the calling thread begins executing tasks as normal, but returns from taskwait when it detects that the selected tasks have completed instead of waiting when the task queue is empty.

How have you tested your patch?

Two new tests have been added, which checks to make sure that you can wait on tasks from within a task via taskwait, and another test to make sure that improper taskwait usage throws an exception.

codecov[bot] commented 10 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (1eb0423) 99.22% compared to head (4203bdd) 99.25%. Report is 4 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #122 +/- ## ========================================== + Coverage 99.22% 99.25% +0.02% ========================================== Files 12 12 Lines 1291 1341 +50 Branches 137 146 +9 ========================================== + Hits 1281 1331 +50 Misses 5 5 Partials 5 5 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.