diff --git a/software/runtime/kmp/team.hpp b/software/runtime/kmp/team.hpp index a42197245..185d9af09 100644 --- a/software/runtime/kmp/team.hpp +++ b/software/runtime/kmp/team.hpp @@ -30,6 +30,7 @@ class Team { SignedT stride = 0; bool valid = false; + kmp_uint32 numDone = 0; Mutex mutex; }; @@ -57,10 +58,6 @@ class Team { inline auto getCopyPrivateData() const { return copyPrivateData; } - inline void invalidateSchedule() { - std::get>(this->dynamicSchedule).valid = false; - } - inline void run() { for (kmp_uint32 i = 0; i < numThreads; i++) { runtime::threads[i].setCurrentTeam(this); @@ -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; }