From d727abb6fea771534ee196bbc7136f37c1bc01c0 Mon Sep 17 00:00:00 2001
From: Pierre <pierre.esterie@inria.fr>
Date: Tue, 27 Apr 2021 14:55:09 +0000
Subject: [PATCH] Fix OMP

---
 include/Core/FFmmAlgorithmThreadProc.hpp                | 4 ++--
 include/Core/FFmmAlgorithmThreadProcPeriodic.hpp        | 6 +++---
 include/Core/FFmmAlgorithmThreadProcTsm.hpp             | 4 ++--
 include/GroupTree/Core/FGroupTaskStarpuMpiAlgorithm.hpp | 4 ++--
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/include/Core/FFmmAlgorithmThreadProc.hpp b/include/Core/FFmmAlgorithmThreadProc.hpp
index d1d4199f1..77715a100 100644
--- a/include/Core/FFmmAlgorithmThreadProc.hpp
+++ b/include/Core/FFmmAlgorithmThreadProc.hpp
@@ -977,7 +977,7 @@ protected:
                     {
                         const int chunckSize = userChunkSize;
                         for(int idxCell = 0 ; idxCell < numberOfCells ; idxCell += chunckSize){
-#pragma omp task default(none) shared(numberOfCells,idxLevel) firstprivate(idxCell) //+ shared(chunckSize)
+#pragma omp task default(none) shared(numberOfCells,idxLevel) firstprivate(idxCell) shared(chunckSize, separationCriteria)
                             {
                                 KernelClass * const myThreadkernels = kernels[omp_get_thread_num()];
                                 const CellClass* neighbors[342] {};
@@ -1698,7 +1698,7 @@ protected:
 
                         for(int idxLeafs = previous ; idxLeafs < endAtThisShape ; idxLeafs += chunckSize){
                             const int nbLeavesInTask = FMath::Min(endAtThisShape-idxLeafs, chunckSize);
-#pragma omp task default(none) firstprivate(nbLeavesInTask,idxLeafs) //+shared(leafsDataArray)
+#pragma omp task default(none) firstprivate(nbLeavesInTask,idxLeafs, l2pEnabled, p2pEnabled) shared(leafsDataArray)
                             {
                                 KernelClass* myThreadkernels = (kernels[omp_get_thread_num()]);
                                 // There is a maximum of 26 neighbors
diff --git a/include/Core/FFmmAlgorithmThreadProcPeriodic.hpp b/include/Core/FFmmAlgorithmThreadProcPeriodic.hpp
index c0545adec..2d9bb5772 100644
--- a/include/Core/FFmmAlgorithmThreadProcPeriodic.hpp
+++ b/include/Core/FFmmAlgorithmThreadProcPeriodic.hpp
@@ -1055,7 +1055,7 @@ protected:
             {
               const int chunckSize = userChunkSize;
               for(int idxCell = 0 ; idxCell < numberOfCells ; idxCell += chunckSize){
-#pragma omp task default(none) shared(numberOfCells,idxLevel) firstprivate(idxCell) //+ shared(chunckSize)
+#pragma omp task default(none) shared(numberOfCells,idxLevel) firstprivate(idxCell) shared(chunckSize) firstprivate(separationCriteria)
 		  {
 		    KernelClass * const myThreadkernels = kernels[omp_get_thread_num()];
 		    const CellClass* neighbors[342];
@@ -1104,7 +1104,7 @@ protected:
 #pragma omp taskwait
 
 	    for(int idxThread = 0 ; idxThread < omp_get_num_threads() ; ++idxThread){
-#pragma omp task  default(none) firstprivate(idxThread,idxLevel)
+#pragma omp task  default(none) firstprivate(idxThread,idxLevel,fakeLevel)
 		{
 		  kernels[idxThread]->finishedLevelM2L(fakeLevel);
 		}
@@ -1826,7 +1826,7 @@ protected:
 
             for(int idxLeafs = previous ; idxLeafs < endAtThisShape ; idxLeafs += chunckSize){
                 const int nbLeavesInTask = FMath::Min(endAtThisShape-idxLeafs, chunckSize);
-#pragma omp task default(none) firstprivate(nbLeavesInTask,idxLeafs)
+#pragma omp task default(none) firstprivate(nbLeavesInTask,idxLeafs,l2pEnabled, p2pEnabled, LeafIndex, boxWidth) shared(leafsDataArray)
 		{
 		  KernelClass* myThreadkernels = (kernels[omp_get_thread_num()]);
 
diff --git a/include/Core/FFmmAlgorithmThreadProcTsm.hpp b/include/Core/FFmmAlgorithmThreadProcTsm.hpp
index 546d026d2..d17907a96 100644
--- a/include/Core/FFmmAlgorithmThreadProcTsm.hpp
+++ b/include/Core/FFmmAlgorithmThreadProcTsm.hpp
@@ -1016,7 +1016,7 @@ protected:
                     {
                         const int chunckSize = userChunkSize;
                         for(int idxCell = 0 ; idxCell < numberOfCells ; idxCell += chunckSize){
-#pragma omp task default(none) shared(numberOfCells,idxLevel) firstprivate(idxCell) //+ shared(chunckSize)
+#pragma omp task default(none) shared(numberOfCells,idxLevel) firstprivate(idxCell) shared(chunckSize, separationCriteria)
                             {
                                 KernelClass * const myThreadkernels = kernels[omp_get_thread_num()];
                                 const CellClass* neighbors[342];
@@ -1785,7 +1785,7 @@ protected:
 
                         for(int idxLeafs = previous ; idxLeafs < endAtThisShape ; idxLeafs += chunckSize){
                             const int nbLeavesInTask = FMath::Min(endAtThisShape-idxLeafs, chunckSize);
-#pragma omp task default(none) firstprivate(nbLeavesInTask,idxLeafs) //+shared(leafsDataArray)
+#pragma omp task default(none) firstprivate(nbLeavesInTask,idxLeafs, l2pEnabled, p2pEnabled) shared(leafsDataArray)
                             {
                                 KernelClass* myThreadkernels = (kernels[omp_get_thread_num()]);
                                 // There is a maximum of 26 neighbors
diff --git a/include/GroupTree/Core/FGroupTaskStarpuMpiAlgorithm.hpp b/include/GroupTree/Core/FGroupTaskStarpuMpiAlgorithm.hpp
index 344224b8d..6542bc9a3 100644
--- a/include/GroupTree/Core/FGroupTaskStarpuMpiAlgorithm.hpp
+++ b/include/GroupTree/Core/FGroupTaskStarpuMpiAlgorithm.hpp
@@ -997,7 +997,7 @@ protected:
 
                 std::vector<BlockInteractions<CellContainerClass>>* externalInteractions = &externalInteractionsAllLevelMpi[idxLevel][idxGroup];
 
-#pragma omp task default(none) firstprivate(idxGroup, currentCells, idxLevel, externalInteractions)
+#pragma omp task default(none) firstprivate(idxGroup, currentCells, idxLevel, externalInteractions, myFirstIndex, myLastIndex)
                 {
                     std::vector<OutOfBlockInteraction> outsideInteractions;
 
@@ -1100,7 +1100,7 @@ protected:
 
                 std::vector<BlockInteractions<ParticleGroupClass>>* externalInteractions = &externalInteractionsLeafLevelMpi[idxGroup];
 
-#pragma omp task default(none) firstprivate(idxGroup, containers, externalInteractions)
+#pragma omp task default(none) firstprivate(idxGroup, containers, externalInteractions, myFirstIndex, myLastIndex)
                 { // Can be a task(inout:iterCells)
                     std::vector<OutOfBlockInteraction> outsideInteractions;
 
-- 
GitLab