From cb660e044d9203f3eee0e3e47edadef4f2a2061f Mon Sep 17 00:00:00 2001 From: StefanoPetrilli Date: Sun, 17 Jul 2022 11:27:17 -0500 Subject: [PATCH] Remoe MateLock --- amgprec/impl/aggregator/MatchBoxPC.h | 7 ++----- ...eApproxDomEdgesLinearSearchMesgBndlSmallMateCMP.cpp | 10 ++-------- amgprec/impl/aggregator/clean.cpp | 7 +------ amgprec/impl/aggregator/initialize.cpp | 5 ----- amgprec/impl/aggregator/processCrossEdge.cpp | 2 ++ amgprec/impl/aggregator/processMatchedVertices.cpp | 3 +-- 6 files changed, 8 insertions(+), 26 deletions(-) diff --git a/amgprec/impl/aggregator/MatchBoxPC.h b/amgprec/impl/aggregator/MatchBoxPC.h index fba63883..1ff2cb56 100644 --- a/amgprec/impl/aggregator/MatchBoxPC.h +++ b/amgprec/impl/aggregator/MatchBoxPC.h @@ -217,7 +217,6 @@ extern "C" MilanLongInt *S, MilanLongInt *verLocInd, MilanLongInt *verLocPtr, - omp_lock_t *MateLock, map &Ghost2LocalMap, vector &Counter, vector &verGhostPtr, @@ -249,8 +248,7 @@ extern "C" MilanLongInt msgInd, MilanLongInt *msgIndSent, MilanLongInt NumMessagesBundled, - MilanReal *msgPercent, - omp_lock_t *MateLock); + MilanReal *msgPercent); void PARALLEL_COMPUTE_CANDIDATE_MATE_B(MilanLongInt NLVer, MilanLongInt *verLocPtr, @@ -322,8 +320,7 @@ extern "C" staticQueue &privateQLocalVtx, staticQueue &privateQGhostVtx, staticQueue &privateQMsgType, - staticQueue &privateQOwner, - omp_lock_t *MateLock); + staticQueue &privateQOwner); void sendBundledMessages(MilanLongInt *numGhostEdgesPtr, MilanInt *BufferSizePtr, diff --git a/amgprec/impl/aggregator/algoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP.cpp b/amgprec/impl/aggregator/algoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP.cpp index 950e844b..8c02ddcf 100644 --- a/amgprec/impl/aggregator/algoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP.cpp +++ b/amgprec/impl/aggregator/algoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP.cpp @@ -190,14 +190,10 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP( MilanInt BufferSize; MilanLongInt *Buffer; - // Declare the locks - omp_lock_t MateLock[NLVer]; - initialize(NLVer, NLEdge, StartIndex, EndIndex, &numGhostEdges, &numGhostVertices, &S, verLocInd, verLocPtr, - MateLock, Ghost2LocalMap, Counter, verGhostPtr, verGhostInd, tempCounter, GMate, @@ -307,8 +303,7 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP( privateQLocalVtx, privateQGhostVtx, privateQMsgType, - privateQOwner, - MateLock); + privateQOwner); ///////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////// SEND BUNDLED MESSAGES ///////////////////////////////////// @@ -616,8 +611,7 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP( msgInd, msgIndSent, NumMessagesBundled, - msgPercent, - MateLock); + msgPercent); finishTime = MPI_Wtime(); *ph2_time = finishTime - startTime; // Time taken for Phase-2 diff --git a/amgprec/impl/aggregator/clean.cpp b/amgprec/impl/aggregator/clean.cpp index d91076c9..29fa351d 100644 --- a/amgprec/impl/aggregator/clean.cpp +++ b/amgprec/impl/aggregator/clean.cpp @@ -16,8 +16,7 @@ void clean(MilanLongInt NLVer, MilanLongInt msgInd, MilanLongInt *msgIndSent, MilanLongInt NumMessagesBundled, - MilanReal *msgPercent, - omp_lock_t *MateLock) + MilanReal *msgPercent) { // Cleanup Phase @@ -83,10 +82,6 @@ void clean(MilanLongInt NLVer, *msgPercent = 0; } } - // Destroy the locks -#pragma omp taskloop num_tasks(NUM_THREAD) - for (int i = 0; i < NLVer; i++) - omp_destroy_lock(&MateLock[i]); #ifdef DEBUG_HANG_ if (myRank == 0) diff --git a/amgprec/impl/aggregator/initialize.cpp b/amgprec/impl/aggregator/initialize.cpp index 979cdcf5..8325e455 100644 --- a/amgprec/impl/aggregator/initialize.cpp +++ b/amgprec/impl/aggregator/initialize.cpp @@ -7,7 +7,6 @@ void initialize(MilanLongInt NLVer, MilanLongInt NLEdge, MilanLongInt *S, MilanLongInt *verLocInd, MilanLongInt *verLocPtr, - omp_lock_t *MateLock, map &Ghost2LocalMap, vector &Counter, vector &verGhostPtr, @@ -40,10 +39,6 @@ void initialize(MilanLongInt NLVer, MilanLongInt NLEdge, #pragma omp single { - // Initialize the locks -#pragma omp taskloop num_tasks(NUM_THREAD) - for (i = 0; i < NLVer; i++) - omp_init_lock(&MateLock[i]); #ifdef TIME_TRACKER double Ghost2LocalInitialization = MPI_Wtime(); diff --git a/amgprec/impl/aggregator/processCrossEdge.cpp b/amgprec/impl/aggregator/processCrossEdge.cpp index 45b3918e..30efd79d 100644 --- a/amgprec/impl/aggregator/processCrossEdge.cpp +++ b/amgprec/impl/aggregator/processCrossEdge.cpp @@ -10,6 +10,8 @@ void PROCESS_CROSS_EDGE(vector &Counter, #pragma omp atomic capture captureCounter = --Counter[edge]; // Decrement + //assert(captureCounter >= 0); + if (captureCounter == 0) #pragma omp atomic (*SPtr)--; // Decrement S diff --git a/amgprec/impl/aggregator/processMatchedVertices.cpp b/amgprec/impl/aggregator/processMatchedVertices.cpp index 87ea7a4f..11d7466d 100644 --- a/amgprec/impl/aggregator/processMatchedVertices.cpp +++ b/amgprec/impl/aggregator/processMatchedVertices.cpp @@ -31,8 +31,7 @@ void processMatchedVertices( staticQueue &privateQLocalVtx, staticQueue &privateQGhostVtx, staticQueue &privateQMsgType, - staticQueue &privateQOwner, - omp_lock_t *MateLock) + staticQueue &privateQOwner) { MilanLongInt adj1, adj2, adj11, adj12, k, k1, v = -1, w = -1, ghostOwner;