From a71fe82752d79028d98d5585e8ebc108fc6cc58c Mon Sep 17 00:00:00 2001 From: StefanoPetrilli Date: Sun, 17 Jul 2022 12:03:48 -0500 Subject: [PATCH] PROCESS_CROSS_EDGE refactoring --- amgprec/impl/aggregator/MatchBoxPC.h | 3 +-- ...EdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP.cpp | 2 +- amgprec/impl/aggregator/processCrossEdge.cpp | 5 ++--- amgprec/impl/aggregator/processExposedVertex.cpp | 2 +- amgprec/impl/aggregator/processMatchedVertices.cpp | 2 +- amgprec/impl/aggregator/processMessages.cpp | 8 ++++---- 6 files changed, 10 insertions(+), 12 deletions(-) diff --git a/amgprec/impl/aggregator/MatchBoxPC.h b/amgprec/impl/aggregator/MatchBoxPC.h index 1ff2cb56..1e84b7ca 100644 --- a/amgprec/impl/aggregator/MatchBoxPC.h +++ b/amgprec/impl/aggregator/MatchBoxPC.h @@ -287,8 +287,7 @@ extern "C" staticQueue &privateQMsgType, staticQueue &privateQOwner); - void PROCESS_CROSS_EDGE(vector &Counter, - MilanLongInt edge, + void PROCESS_CROSS_EDGE(MilanLongInt *edge, MilanLongInt *SPtr); void processMatchedVertices( diff --git a/amgprec/impl/aggregator/algoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP.cpp b/amgprec/impl/aggregator/algoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP.cpp index 8c02ddcf..ab031f68 100644 --- a/amgprec/impl/aggregator/algoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP.cpp +++ b/amgprec/impl/aggregator/algoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP.cpp @@ -456,7 +456,7 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP( fflush(stdout); #endif - PROCESS_CROSS_EDGE(Counter, Ghost2LocalMap[w], &S); + PROCESS_CROSS_EDGE(&Counter[Ghost2LocalMap[w]], &S); } // End of if CandidateMate[w] = v } // End of if a Ghost Vertex diff --git a/amgprec/impl/aggregator/processCrossEdge.cpp b/amgprec/impl/aggregator/processCrossEdge.cpp index 30efd79d..30af9f20 100644 --- a/amgprec/impl/aggregator/processCrossEdge.cpp +++ b/amgprec/impl/aggregator/processCrossEdge.cpp @@ -1,14 +1,13 @@ #include "MatchBoxPC.h" -void PROCESS_CROSS_EDGE(vector &Counter, - MilanLongInt edge, +void PROCESS_CROSS_EDGE(MilanLongInt *edge, MilanLongInt *SPtr) { // Start: PARALLEL_PROCESS_CROSS_EDGE_B MilanLongInt captureCounter; #pragma omp atomic capture - captureCounter = --Counter[edge]; // Decrement + captureCounter = --(*edge); // Decrement //assert(captureCounter >= 0); diff --git a/amgprec/impl/aggregator/processExposedVertex.cpp b/amgprec/impl/aggregator/processExposedVertex.cpp index 97840b19..a2ea6c8d 100644 --- a/amgprec/impl/aggregator/processExposedVertex.cpp +++ b/amgprec/impl/aggregator/processExposedVertex.cpp @@ -115,7 +115,7 @@ void PARALLEL_PROCESS_EXPOSED_VERTEX_B(MilanLongInt NLVer, //TODO refactor this!! // Decrement the counter: - PROCESS_CROSS_EDGE(Counter, Ghost2LocalMap[w], &S); + PROCESS_CROSS_EDGE(&Counter[Ghost2LocalMap[w]], &S); } // End of if CandidateMate[w] = v } // End of if a Ghost Vertex diff --git a/amgprec/impl/aggregator/processMatchedVertices.cpp b/amgprec/impl/aggregator/processMatchedVertices.cpp index 11d7466d..fe983285 100644 --- a/amgprec/impl/aggregator/processMatchedVertices.cpp +++ b/amgprec/impl/aggregator/processMatchedVertices.cpp @@ -183,7 +183,7 @@ void processMatchedVertices( fflush(stdout); #endif // Decrement the counter: - PROCESS_CROSS_EDGE(Counter, Ghost2LocalMap[w], SPtr); + PROCESS_CROSS_EDGE(&Counter[Ghost2LocalMap[w]], SPtr); case 2: // Found a dominating edge, it is a ghost ghostOwner = findOwnerOfGhost(w, verDistance, myRank, numProcs); diff --git a/amgprec/impl/aggregator/processMessages.cpp b/amgprec/impl/aggregator/processMessages.cpp index 7e5c3915..c812e96d 100644 --- a/amgprec/impl/aggregator/processMessages.cpp +++ b/amgprec/impl/aggregator/processMessages.cpp @@ -194,7 +194,7 @@ void processMessages( fflush(stdout); #endif - PROCESS_CROSS_EDGE(Counter, Ghost2LocalMap[u], S); + PROCESS_CROSS_EDGE(&Counter[Ghost2LocalMap[u]], S); } // End of if ( candidateMate[v-StartIndex] == u )e } // End of if ( Mate[v] == -1 ) } // End of REQUEST @@ -207,7 +207,7 @@ void processMessages( fflush(stdout); #endif GMate[Ghost2LocalMap[u]] = EndIndex + 1; // Set a Dummy Mate to make sure that we do not (u is a ghost) process it again - PROCESS_CROSS_EDGE(Counter, Ghost2LocalMap[u], S); + PROCESS_CROSS_EDGE(&Counter[Ghost2LocalMap[u]], S); #ifdef DEBUG_GHOST_ if ((v < 0) || (v < StartIndex) || ((v - StartIndex) > NLVer)) { @@ -260,7 +260,7 @@ void processMessages( fflush(stdout); #endif - PROCESS_CROSS_EDGE(Counter, Ghost2LocalMap[w], S); + PROCESS_CROSS_EDGE(&Counter[Ghost2LocalMap[w]], S); } // End of if CandidateMate[w] = v } // End of if a Ghost Vertex else @@ -319,7 +319,7 @@ void processMessages( fflush(stdout); #endif GMate[Ghost2LocalMap[u]] = EndIndex + 1; // Set a Dummy Mate to make sure that we do not (u is a ghost) process this anymore - PROCESS_CROSS_EDGE(Counter, Ghost2LocalMap[u], S); // Decrease the counter + PROCESS_CROSS_EDGE(&Counter[Ghost2LocalMap[u]], S); // Decrease the counter } // End of else: CASE III } // End of else: CASE I }