java-romp / jromp

Java Runtime implementation of OpenMP.
https://java-romp.github.io/jromp/
MIT License
5 stars 0 forks source link

Section variables should be copied only once #42

Closed scastd closed 2 months ago

scastd commented 2 months ago

Describe the bug

The sections' tests are not working correctly because the variables are copied for each section. When the construct ends, the end method is called for each copy, and the first value is restored to the variables, so the tests fail.

Proposed solution:

Make a private method that receives three parameters:

Like this, the copy of the variables could be passed once for all the sections, even if there are more threads than the thread limit (execution of the recurrent part of the method).

Library version(s) affected

1.0.0

Steps to reproduce

The issue is easily represented in this test:

https://github.com/java-romp/jromp/blob/9ab3318abe1136b81061d4add6ab3816004528a4/src/test/java/jromp/parallel/SectionTests.java#L17-L40

Additional context, environment

No response

Logs

No response