From 002239f5b6a20ad18e9278499b410f383eaf8367 Mon Sep 17 00:00:00 2001 From: StefanoPetrilli Date: Sun, 22 May 2022 17:35:08 -0500 Subject: [PATCH] False sharing fix --- ...DomEdgesLinearSearchMesgBndlSmallMateCMP.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/amgprec/impl/aggregator/algoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP.cpp b/amgprec/impl/aggregator/algoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP.cpp index e83c37b8..e598a21f 100644 --- a/amgprec/impl/aggregator/algoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP.cpp +++ b/amgprec/impl/aggregator/algoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP.cpp @@ -293,8 +293,11 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP( /* * OMP verGhostPtrInitialization * + * schedule(static) assign to each thread an huge chunk + * it is used in this case to reduce the overhead of chunk assignment + * and to reduce false sharing */ -#pragma omp for nowait +#pragma omp for nowait schedule(static) for (i = 0; i < numGhostVertices; i++) { //O(|Ghost Vertices|) verGhostPtr[i + 1] = verGhostPtr[i] + Counter[i]; #ifdef PRINT_DEBUG_INFO_ @@ -332,7 +335,7 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP( double verGhostIndInitialization = MPI_Wtime(); #endif -#pragma omp for nowait +#pragma omp for nowait schedule(static) for (v = 0; v < NLVer; v++) { adj1 = verLocPtr[v]; //Vertex Pointer adj2 = verLocPtr[v + 1]; @@ -433,7 +436,7 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP( * In particular PARALLEL_COMPUTE_CANDIDATE_MATE_B is now totally parallel. */ -#pragma omp for +#pragma omp for schedule(static) for ( v=0; v < NLVer; v++ ) { #ifdef PRINT_DEBUG_INFO_ cout<<"\n("<