From 2cac21b345bfdc2e0eb1e2116bc7e8212f602ba7 Mon Sep 17 00:00:00 2001 From: StefanoPetrilli Date: Sat, 21 May 2022 11:46:40 -0500 Subject: [PATCH] fix and reformatting --- ...mEdgesLinearSearchMesgBndlSmallMateCMP.cpp | 208 +++++++++--------- samples/advanced/pdegen/runs/amg_pde3d.inp | 2 +- 2 files changed, 109 insertions(+), 101 deletions(-) diff --git a/amgprec/impl/aggregator/algoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP.cpp b/amgprec/impl/aggregator/algoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP.cpp index 1b7014f5..9349e9a2 100644 --- a/amgprec/impl/aggregator/algoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP.cpp +++ b/amgprec/impl/aggregator/algoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP.cpp @@ -446,7 +446,6 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP( #pragma omp single { - for ( v=0; v < NLVer; v++ ) { //Start: PARALLEL_PROCESS_EXPOSED_VERTEX_B(v) @@ -461,131 +460,140 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP( #ifdef PRINT_DEBUG_INFO_ cout<<"\n("<= 0) { - myCard++; - if ((w < StartIndex) || (w > EndIndex)) { //w is a ghost vertex - //Build the Message Packet: - //Message[0] = v+StartIndex; //LOCAL - //Message[1] = w; //GHOST - //Message[2] = REQUEST; //TYPE - //Send a Request (Asynchronous) + + //This piece of code is actually executed under 0.01% of the times + if (isAlreadyMatched(k, verLocInd, StartIndex, EndIndex, GMate, Mate, Ghost2LocalMap)) { + w = computeCandidateMate(verLocPtr[v], + verLocPtr[v + 1], + edgeLocWeight, 0, + verLocInd, + StartIndex, + EndIndex, + GMate, + Mate, + Ghost2LocalMap); + candidateMate[v] = w; + } + + if (w >= 0) { + + myCard++; + if ((w < StartIndex) || (w > EndIndex)) { //w is a ghost vertex + //Build the Message Packet: + //Message[0] = v+StartIndex; //LOCAL + //Message[1] = w; //GHOST + //Message[2] = REQUEST; //TYPE + //Send a Request (Asynchronous) #ifdef PRINT_DEBUG_INFO_ - cout<<"\n("< 0) { + //Decrement the counter: + //Start: PARALLEL_PROCESS_CROSS_EDGE_B(v) + if (Counter[Ghost2LocalMap[w]] > 0) { - Counter[Ghost2LocalMap[w]] = Counter[Ghost2LocalMap[w]] - 1; //Decrement - if (Counter[Ghost2LocalMap[w]] == 0) { - S--; //Decrement S + Counter[Ghost2LocalMap[w]] = Counter[Ghost2LocalMap[w]] - 1; //Decrement + if (Counter[Ghost2LocalMap[w]] == 0) { + S--; //Decrement S #ifdef PRINT_DEBUG_INFO_ - cout<<"\n("< 0 - //End: PARALLEL_PROCESS_CROSS_EDGE_B(v) - } //End of if CandidateMate[w] = v - } //End of if a Ghost Vertex - else { // w is a local vertex + } + } //End of if Counter[w] > 0 + //End: PARALLEL_PROCESS_CROSS_EDGE_B(v) + } //End of if CandidateMate[w] = v + } //End of if a Ghost Vertex + else { // w is a local vertex - if (candidateMate[w - StartIndex] == (v + StartIndex)) { + if (candidateMate[w - StartIndex] == (v + StartIndex)) { - Mate[v] = w; //v is local - Mate[w - StartIndex] = v + StartIndex; //w is local - //Q.push_back(u); - U.push_back(v + StartIndex); - U.push_back(w); + Mate[v] = w; //v is local + Mate[w - StartIndex] = v + StartIndex; //w is local + //Q.push_back(u); + U.push_back(v + StartIndex); + U.push_back(w); #ifdef PRINT_DEBUG_INFO_ - cout<<"\n("<=0) - else { - adj11 = verLocPtr[v]; - adj12 = verLocPtr[v + 1]; - for (k1 = adj11; k1 < adj12; k1++) { - w = verLocInd[k1]; - if ((w < StartIndex) || (w > EndIndex)) { //A ghost - //Build the Message Packet: - //Message[0] = v+StartIndex; //LOCAL - //Message[1] = w; //GHOST - //Message[2] = FAILURE; //TYPE - //Send a Request (Asynchronous) + + //if (w < 0) { -- if it arrives here this one if is useless, it is certainly -1 + adj11 = verLocPtr[v]; + adj12 = verLocPtr[v + 1]; + for (k1 = adj11; k1 < adj12; k1++) { + w = verLocInd[k1]; + if ((w < StartIndex) || (w > EndIndex)) { //A ghost + //Build the Message Packet: + //Message[0] = v+StartIndex; //LOCAL + //Message[1] = w; //GHOST + //Message[2] = FAILURE; //TYPE + //Send a Request (Asynchronous) #ifdef PRINT_DEBUG_INFO_ - cout<<"\n("<