Skip to content

Commit

Permalink
Invalidate schedule only when all threads are done
Browse files Browse the repository at this point in the history
  • Loading branch information
sant0s12 committed May 26, 2024
1 parent c1ed55e commit 84619e0
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions software/runtime/kmp/team.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class Team {
SignedT stride = 0;

bool valid = false;
kmp_uint32 numDone = 0;

Mutex mutex;
};
Expand Down Expand Up @@ -57,10 +58,6 @@ class Team {

inline auto getCopyPrivateData() const { return copyPrivateData; }

inline void invalidateSchedule() {
std::get<DynamicSchedule<kmp_int32>>(this->dynamicSchedule).valid = false;
}

inline void run() {
for (kmp_uint32 i = 0; i < numThreads; i++) {
runtime::threads[i].setCurrentTeam(this);
Expand Down Expand Up @@ -199,6 +196,11 @@ class Team {

if (dynamicSchedule.lowerNext > dynamicSchedule.upper) {
DEBUG_PRINT("Dynamic loop done\n");
if (++dynamicSchedule.numDone == numThreads) {
dynamicSchedule.valid = false;
dynamicSchedule.numDone = 0;
}

return false;
}

Expand Down

0 comments on commit 84619e0

Please sign in to comment.