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

Worksharing-For Optimizations #94

Closed computablee closed 1 year ago

computablee commented 1 year ago

Which issue are you addressing?

Closes #14 and #46. Makes progress towards #16. Fixes an erroneous Ordered_works test. Fixed an issue with chunk size inference on static scheduling.

How have you addressed the issue?

I have implemented a lock-free dynamic scheduler which drastically outperforms the prior scheduler when the chunk size is set to be very small. Additionally, I have applied AggressiveInlining attributes around the core scheduler code, making small improvements to performance here and there. These inlining attributes improve performance of all 3 primary schedulers, as well as some of the code for calculating collapse indices. A lock-free guided scheduler was not implemented after testing, because the amount of lock contentions was decided to be minuscule compared to dynamic, and a lock free scheduler was not likely to make much of a difference, if at all.

How have you tested your patch?

The HeatTransfer benchmark was used on my personal system with an i5-8400T CPU. Proper benchmarking protocols were used, and the results were analyzed constantly throughout optimization. For the non-optimization stuff, unit tests were altered and tested. All unit tests currently pass.

codecov[bot] commented 1 year ago

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (72f6815) 99.54% compared to head (6509181) 99.44%. Report is 2 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #94 +/- ## ========================================== - Coverage 99.54% 99.44% -0.10% ========================================== Files 12 12 Lines 1092 1080 -12 Branches 101 103 +2 ========================================== - Hits 1087 1074 -13 - Partials 5 6 +1 ``` | [Files](https://app.codecov.io/gh/computablee/DotMP/pull/94?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Phillip+Allen+Lane) | Coverage Δ | | |---|---|---| | [DotMP/ForkedRegion.cs](https://app.codecov.io/gh/computablee/DotMP/pull/94?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Phillip+Allen+Lane#diff-RG90TVAvRm9ya2VkUmVnaW9uLmNz) | `100.00% <ø> (ø)` | | | [DotMP/Init.cs](https://app.codecov.io/gh/computablee/DotMP/pull/94?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Phillip+Allen+Lane#diff-RG90TVAvSW5pdC5jcw==) | `100.00% <100.00%> (ø)` | | | [DotMP/Iter.cs](https://app.codecov.io/gh/computablee/DotMP/pull/94?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Phillip+Allen+Lane#diff-RG90TVAvSXRlci5jcw==) | `100.00% <100.00%> (ø)` | | | [DotMP/Wrappers.cs](https://app.codecov.io/gh/computablee/DotMP/pull/94?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Phillip+Allen+Lane#diff-RG90TVAvV3JhcHBlcnMuY3M=) | `100.00% <100.00%> (ø)` | | | [DotMP/Parallel.cs](https://app.codecov.io/gh/computablee/DotMP/pull/94?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Phillip+Allen+Lane#diff-RG90TVAvUGFyYWxsZWwuY3M=) | `98.72% <66.66%> (-0.22%)` | :arrow_down: |

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