PARALLEL_PROCESS_EXPOSED_VERTEX_B is actually not parallelizable. Atleast not as I was doing.

omp-walther
StefanoPetrilli 4 years ago
parent baffff3d93
commit 919e2a2918

@ -424,22 +424,15 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
//Compute the Initial Matching Set: //Compute the Initial Matching Set:
S = numGhostVertices; //Initialize S with number of Ghost Vertices S = numGhostVertices; //Initialize S with number of Ghost Vertices
} // end of single region
/* /*
* OMP PARALLEL_COMPUTE_CANDIDATE_MATE_B * OMP PARALLEL_COMPUTE_CANDIDATE_MATE_B
* The next portion of code has been splitted * It is actually not possible to parallelize this cycle
* to make it 100% parallelized * as it is.
*
* TODO: I think it diminish the cache update, does it?
*
* TODO: would it make any sense to parallelize also the
* inner for?
* *
* TODO: we have a false sharing on candidateMate * TODO think how it could be parallelizable
*/ */
#pragma omp for
for ( v=0; v < NLVer; v++ ) { for ( v=0; v < NLVer; v++ ) {
#ifdef PRINT_DEBUG_INFO_ #ifdef PRINT_DEBUG_INFO_
cout<<"\n("<<myRank<<")Processing: "<<v+StartIndex<<endl; fflush(stdout); cout<<"\n("<<myRank<<")Processing: "<<v+StartIndex<<endl; fflush(stdout);
@ -468,30 +461,12 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
candidateMate[v] = w; candidateMate[v] = w;
//End: PARALLEL_COMPUTE_CANDIDATE_MATE_B(v) //End: PARALLEL_COMPUTE_CANDIDATE_MATE_B(v)
}
/*
TODO this cycle has a lot of margin of improvement!!!!
This current version introduce some errors.
1 - ollback to the previous verison and check if it is
100% stable
2 - if the previous verison was stable all right, if not
that's a big deal
3 - reimplement step by step to check from where the instability
comes from
*/
#pragma omp for reduction(+: msgInd, NumMessagesBundled, myCard, PCounter[:numProcs])
for ( v=0; v < NLVer; v++ ) {
//Start: PARALLEL_PROCESS_EXPOSED_VERTEX_B(v) //Start: PARALLEL_PROCESS_EXPOSED_VERTEX_B(v)
#ifdef PRINT_DEBUG_INFO_ #ifdef PRINT_DEBUG_INFO_
cout<<"\n("<<myRank<<")Processing: "<<v+StartIndex<<endl; fflush(stdout); cout<<"\n("<<myRank<<")Processing: "<<v+StartIndex<<endl; fflush(stdout);
#endif #endif
w = candidateMate[v];
#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
@ -514,9 +489,8 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
msgInd++; msgInd++;
NumMessagesBundled++; NumMessagesBundled++;
ghostOwner = findOwnerOfGhost(w, verDistance, myRank, numProcs); ghostOwner = findOwnerOfGhost(w, verDistance, myRank, numProcs);
PCounter[ghostOwner]++; //TODO maybe reduction? PCounter[ghostOwner]++;
#pragma omp critical
{
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);
@ -550,13 +524,11 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
} //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 critical region
} //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)) {
#pragma omp critical
{
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);
@ -566,7 +538,7 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
#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
} //End of if(w >=0) } //End of if(w >=0)
@ -607,12 +579,12 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
} //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 critical
} //End of for ( v=0; v < NLVer; v++ ) } //End of for ( v=0; v < NLVer; v++ )
} // end of single region
} // end of parallel region } // end of parallel region
tempCounter.clear(); //Do not need this any more tempCounter.clear(); //Do not need this any more
//} // end of parallel region
#ifdef PRINT_DEBUG_INFO_ #ifdef PRINT_DEBUG_INFO_

Loading…
Cancel
Save