fix and reformatting

omp-walther
StefanoPetrilli 3 years ago
parent 6180f29f39
commit 2cac21b345

@ -446,7 +446,6 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
#pragma omp single #pragma omp single
{ {
for ( v=0; v < NLVer; v++ ) for ( v=0; v < NLVer; v++ )
{ {
//Start: PARALLEL_PROCESS_EXPOSED_VERTEX_B(v) //Start: PARALLEL_PROCESS_EXPOSED_VERTEX_B(v)
@ -461,131 +460,140 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
#ifdef PRINT_DEBUG_INFO_ #ifdef PRINT_DEBUG_INFO_
cout<<"\n("<<myRank<<")"<<v+StartIndex<<" Points to: "<<w; fflush(stdout); cout<<"\n("<<myRank<<")"<<v+StartIndex<<" Points to: "<<w; fflush(stdout);
#endif #endif
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 found a dominating edge: //If found a dominating edge:
if (w >= 0) { if (w >= 0) {
myCard++;
if ((w < StartIndex) || (w > EndIndex)) { //w is a ghost vertex //This piece of code is actually executed under 0.01% of the times
//Build the Message Packet: if (isAlreadyMatched(k, verLocInd, StartIndex, EndIndex, GMate, Mate, Ghost2LocalMap)) {
//Message[0] = v+StartIndex; //LOCAL w = computeCandidateMate(verLocPtr[v],
//Message[1] = w; //GHOST verLocPtr[v + 1],
//Message[2] = REQUEST; //TYPE edgeLocWeight, 0,
//Send a Request (Asynchronous) 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_ #ifdef PRINT_DEBUG_INFO_
cout<<"\n("<<myRank<<")Sending a request message (291):"; cout<<"\n("<<myRank<<")Sending a request message (291):";
cout<<"\n("<<myRank<<")Local is: "<<v+StartIndex<<" Ghost is "<<w<<" Owner is: "<< findOwnerOfGhost(w, verDistance, myRank, numProcs) <<endl; cout<<"\n("<<myRank<<")Local is: "<<v+StartIndex<<" Ghost is "<<w<<" Owner is: "<< findOwnerOfGhost(w, verDistance, myRank, numProcs) <<endl;
fflush(stdout); fflush(stdout);
#endif #endif
/* MPI_Bsend(&Message[0], 3, MPI_INT, inputSubGraph.findOwner(w), /* MPI_Bsend(&Message[0], 3, MPI_INT, inputSubGraph.findOwner(w),
ComputeTag, comm);*/ ComputeTag, comm);*/
msgInd++; msgInd++;
NumMessagesBundled++; NumMessagesBundled++;
ghostOwner = findOwnerOfGhost(w, verDistance, myRank, numProcs); ghostOwner = findOwnerOfGhost(w, verDistance, myRank, numProcs);
PCounter[ghostOwner]++; PCounter[ghostOwner]++;
QLocalVtx.push_back(v + StartIndex); QLocalVtx.push_back(v + StartIndex);
QGhostVtx.push_back(w); QGhostVtx.push_back(w);
QMsgType.push_back(REQUEST); QMsgType.push_back(REQUEST);
//ghostOwner = inputSubGraph.findOwner(w); //ghostOwner = inputSubGraph.findOwner(w);
assert(ghostOwner != -1); assert(ghostOwner != -1);
assert(ghostOwner != myRank); assert(ghostOwner != myRank);
QOwner.push_back(ghostOwner); QOwner.push_back(ghostOwner);
if (candidateMate[NLVer + Ghost2LocalMap[w]] == v + StartIndex) { if (candidateMate[NLVer + Ghost2LocalMap[w]] == v + StartIndex) {
Mate[v] = w; Mate[v] = w;
GMate[Ghost2LocalMap[w]] = v + StartIndex; //w is a Ghost GMate[Ghost2LocalMap[w]] = v + StartIndex; //w is a Ghost
U.push_back(v + StartIndex); U.push_back(v + StartIndex);
U.push_back(w); U.push_back(w);
#ifdef PRINT_DEBUG_INFO_ #ifdef PRINT_DEBUG_INFO_
cout<<"\n("<<myRank<<")MATCH: ("<<v+StartIndex<<","<<w<<")"; fflush(stdout); cout<<"\n("<<myRank<<")MATCH: ("<<v+StartIndex<<","<<w<<")"; fflush(stdout);
#endif #endif
//Decrement the counter: //Decrement the counter:
//Start: PARALLEL_PROCESS_CROSS_EDGE_B(v) //Start: PARALLEL_PROCESS_CROSS_EDGE_B(v)
if (Counter[Ghost2LocalMap[w]] > 0) { if (Counter[Ghost2LocalMap[w]] > 0) {
Counter[Ghost2LocalMap[w]] = Counter[Ghost2LocalMap[w]] - 1; //Decrement Counter[Ghost2LocalMap[w]] = Counter[Ghost2LocalMap[w]] - 1; //Decrement
if (Counter[Ghost2LocalMap[w]] == 0) { if (Counter[Ghost2LocalMap[w]] == 0) {
S--; //Decrement S S--; //Decrement S
#ifdef PRINT_DEBUG_INFO_ #ifdef PRINT_DEBUG_INFO_
cout<<"\n("<<myRank<<")Decrementing S: Ghost vertex "<<w<<" has received all its messages"; cout<<"\n("<<myRank<<")Decrementing S: Ghost vertex "<<w<<" has received all its messages";
fflush(stdout); fflush(stdout);
#endif #endif
} }
} //End of if Counter[w] > 0 } //End of if Counter[w] > 0
//End: PARALLEL_PROCESS_CROSS_EDGE_B(v) //End: PARALLEL_PROCESS_CROSS_EDGE_B(v)
} //End of if CandidateMate[w] = v } //End of if CandidateMate[w] = v
} //End of if a Ghost Vertex } //End of if a Ghost Vertex
else { // w is a local 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[v] = w; //v is local
Mate[w - StartIndex] = v + StartIndex; //w is local Mate[w - StartIndex] = v + StartIndex; //w is local
//Q.push_back(u); //Q.push_back(u);
U.push_back(v + StartIndex); U.push_back(v + StartIndex);
U.push_back(w); U.push_back(w);
#ifdef PRINT_DEBUG_INFO_ #ifdef PRINT_DEBUG_INFO_
cout<<"\n("<<myRank<<")MATCH: ("<<v+StartIndex<<","<<w<<") "; fflush(stdout); cout<<"\n("<<myRank<<")MATCH: ("<<v+StartIndex<<","<<w<<") "; fflush(stdout);
#endif #endif
} //End of if ( candidateMate[w-StartIndex] == (v+StartIndex) ) } //End of if ( candidateMate[w-StartIndex] == (v+StartIndex) )
} //End of Else } //End of Else
continue;
} //End of second if
} //End of if(w >=0) } //End of if(w >=0)
else {
adj11 = verLocPtr[v]; //if (w < 0) { -- if it arrives here this one if is useless, it is certainly -1
adj12 = verLocPtr[v + 1]; adj11 = verLocPtr[v];
for (k1 = adj11; k1 < adj12; k1++) { adj12 = verLocPtr[v + 1];
w = verLocInd[k1]; for (k1 = adj11; k1 < adj12; k1++) {
if ((w < StartIndex) || (w > EndIndex)) { //A ghost w = verLocInd[k1];
//Build the Message Packet: if ((w < StartIndex) || (w > EndIndex)) { //A ghost
//Message[0] = v+StartIndex; //LOCAL //Build the Message Packet:
//Message[1] = w; //GHOST //Message[0] = v+StartIndex; //LOCAL
//Message[2] = FAILURE; //TYPE //Message[1] = w; //GHOST
//Send a Request (Asynchronous) //Message[2] = FAILURE; //TYPE
//Send a Request (Asynchronous)
#ifdef PRINT_DEBUG_INFO_ #ifdef PRINT_DEBUG_INFO_
cout<<"\n("<<myRank<<")Sending a failure message: "; cout<<"\n("<<myRank<<")Sending a failure message: ";
cout<<"\n("<<myRank<<")Ghost is "<<w<<" Owner is: "<<findOwnerOfGhost(w, verDistance, myRank, numProcs); cout<<"\n("<<myRank<<")Ghost is "<<w<<" Owner is: "<<findOwnerOfGhost(w, verDistance, myRank, numProcs);
fflush(stdout); fflush(stdout);
#endif #endif
/* MPI_Bsend(&Message[0], 3, MPI_INT, inputSubGraph.findOwner(w), /* MPI_Bsend(&Message[0], 3, MPI_INT, inputSubGraph.findOwner(w),
ComputeTag, comm); */ ComputeTag, comm); */
NumMessagesBundled++; NumMessagesBundled++;
msgInd++; msgInd++;
ghostOwner = findOwnerOfGhost(w, verDistance, myRank, numProcs); ghostOwner = findOwnerOfGhost(w, verDistance, myRank, numProcs);
PCounter[ghostOwner]++; PCounter[ghostOwner]++;
#pragma omp critical #pragma omp critical
{ {
QLocalVtx.push_back(v + StartIndex); QLocalVtx.push_back(v + StartIndex);
QGhostVtx.push_back(w); QGhostVtx.push_back(w);
QMsgType.push_back(FAILURE); QMsgType.push_back(FAILURE);
//ghostOwner = inputSubGraph.findOwner(w); //ghostOwner = inputSubGraph.findOwner(w);
assert(ghostOwner != -1); assert(ghostOwner != -1);
assert(ghostOwner != myRank); assert(ghostOwner != myRank);
QOwner.push_back(ghostOwner); QOwner.push_back(ghostOwner);
} }
} //End of if(GHOST) } //End of if(GHOST)
} //End of for loop } //End of for loop
} // End of Else: w == -1 //} // End of Else: w == -1
//End: PARALLEL_PROCESS_EXPOSED_VERTEX_B(v) //End: PARALLEL_PROCESS_EXPOSED_VERTEX_B(v)
} //End of for ( v=0; v < NLVer; v++ ) } //End of for ( v=0; v < NLVer; v++ )
} // end of single region } // end of single region
} // end of parallel region } // end of parallel region

@ -1,6 +1,6 @@
%%%%%%%%%%% General arguments % Lines starting with % are ignored. %%%%%%%%%%% General arguments % Lines starting with % are ignored.
CSR ! Storage format CSR COO JAD CSR ! Storage format CSR COO JAD
0123 ! IDIM; domain size. Linear system size is IDIM**3 0080 ! IDIM; domain size. Linear system size is IDIM**3
CONST ! PDECOEFF: CONST, EXP, GAUSS Coefficients of the PDE CONST ! PDECOEFF: CONST, EXP, GAUSS Coefficients of the PDE
BICGSTAB ! Iterative method: BiCGSTAB BiCGSTABL BiCG CG CGS FCG GCR RGMRES BICGSTAB ! Iterative method: BiCGSTAB BiCGSTABL BiCG CG CGS FCG GCR RGMRES
2 ! ISTOPC 2 ! ISTOPC

Loading…
Cancel
Save