|
|
|
@ -204,23 +204,25 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
|
|
|
|
|
vector <MilanLongInt> verGhostPtr, verGhostInd, tempCounter;
|
|
|
|
|
//Mate array for ghost vertices:
|
|
|
|
|
vector <MilanLongInt> GMate; //Proportional to the number of ghost vertices
|
|
|
|
|
|
|
|
|
|
MilanLongInt S;
|
|
|
|
|
staticQueue U;
|
|
|
|
|
#ifdef TIME_TRACKER
|
|
|
|
|
double Ghost2LocalInitialization = MPI_Wtime();
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#pragma omp parallel private(insertMe, k, adj1, adj2) firstprivate(StartIndex, EndIndex) default(shared) num_threads(4)
|
|
|
|
|
#pragma omp parallel private(insertMe, k, adj1, adj2, heaviestEdgeWt) firstprivate(StartIndex, EndIndex) default(shared) num_threads(4)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
#pragma omp for
|
|
|
|
|
// TODO comments about the fking reduction
|
|
|
|
|
|
|
|
|
|
#pragma omp for reduction(+ : numGhostEdges)
|
|
|
|
|
for (i = 0; i < NLEdge; i++) { //O(m) - Each edge stored twice
|
|
|
|
|
insertMe = verLocInd[i];
|
|
|
|
|
//cout<<"InsertMe on Process "<<myRank<<" is: "<<insertMe<<endl;
|
|
|
|
|
if ((insertMe < StartIndex) || (insertMe > EndIndex)) { //Find a ghost
|
|
|
|
|
numGhostEdges++;
|
|
|
|
|
#pragma omp critical
|
|
|
|
|
{
|
|
|
|
|
numGhostEdges++;
|
|
|
|
|
storedAlready = Ghost2LocalMap.find(insertMe);
|
|
|
|
|
if (storedAlready != Ghost2LocalMap.end()) { //Has already been added
|
|
|
|
|
//cout<<"Process "<<myRank<<" found: "<<storedAlready->first<<" - "<<storedAlready->second<<endl;
|
|
|
|
@ -237,7 +239,7 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
|
|
|
|
|
|
|
|
|
|
#pragma omp single
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
//numGhostEdges = atomicNumGhostEdges;
|
|
|
|
|
#ifdef TIME_TRACKER
|
|
|
|
|
Ghost2LocalInitialization = MPI_Wtime() - Ghost2LocalInitialization;
|
|
|
|
|
fprintf(stderr, "Ghost2LocalInitialization time: %f\n", Ghost2LocalInitialization);
|
|
|
|
@ -324,7 +326,10 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
|
|
|
|
|
#ifdef TIME_TRACKER
|
|
|
|
|
double verGhostIndInitialization = MPI_Wtime();
|
|
|
|
|
#endif
|
|
|
|
|
#pragma omp for
|
|
|
|
|
|
|
|
|
|
//TODO why the nowait here fails?
|
|
|
|
|
|
|
|
|
|
#pragma omp for nowait
|
|
|
|
|
for (v = 0; v < NLVer; v++) {
|
|
|
|
|
adj1 = verLocPtr[v]; //Vertex Pointer
|
|
|
|
|
adj2 = verLocPtr[v + 1];
|
|
|
|
@ -340,7 +345,6 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
|
|
|
|
|
} //End of if((w < StartIndex) || (w > EndIndex))
|
|
|
|
|
} //End of for(k)
|
|
|
|
|
} //End of for (v)
|
|
|
|
|
tempCounter.clear(); //Do not need this any more
|
|
|
|
|
|
|
|
|
|
#pragma omp single
|
|
|
|
|
{
|
|
|
|
@ -389,8 +393,17 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
|
|
|
|
|
//Initialize the Vectors:
|
|
|
|
|
candidateMate.resize(NLVer + numGhostVertices, -1);
|
|
|
|
|
|
|
|
|
|
//The Queue Data Structure for the Dominating Set:
|
|
|
|
|
staticQueue U(NLVer+numGhostVertices); //Max size is the number of vertices
|
|
|
|
|
/*
|
|
|
|
|
* Create the Queue Data Structure for the Dominating Set
|
|
|
|
|
*
|
|
|
|
|
* I had to declare the staticuQueue U before the parallel region
|
|
|
|
|
* to have it in the correct scope. Since we can't chane the dimension
|
|
|
|
|
* of a staticQueue I had to destroy the previous object and instantiate
|
|
|
|
|
* a new one of the correct size.
|
|
|
|
|
*/
|
|
|
|
|
U.~staticQueue();
|
|
|
|
|
new(&U) staticQueue(NLVer + numGhostVertices);
|
|
|
|
|
|
|
|
|
|
#ifdef PRINT_DEBUG_INFO_
|
|
|
|
|
cout<<"\n("<<myRank<<"=========================************==============================="<<endl; fflush(stdout);
|
|
|
|
|
fflush(stdout);
|
|
|
|
@ -410,7 +423,12 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
|
|
|
|
|
//////////////////////////////////// INITIALIZATION /////////////////////////////////////
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//Compute the Initial Matching Set:
|
|
|
|
|
MilanLongInt S = numGhostVertices; //Initialize S with number of Ghost Vertices
|
|
|
|
|
|
|
|
|
|
S = numGhostVertices; //Initialize S with number of Ghost Vertices
|
|
|
|
|
} // end of single region
|
|
|
|
|
|
|
|
|
|
} // end of parallel region
|
|
|
|
|
//#pragma omp for
|
|
|
|
|
for ( v=0; v < NLVer; v++ ) {
|
|
|
|
|
#ifdef PRINT_DEBUG_INFO_
|
|
|
|
|
cout<<"\n("<<myRank<<")Processing: "<<v+StartIndex<<endl; fflush(stdout);
|
|
|
|
@ -437,7 +455,21 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
|
|
|
|
|
}
|
|
|
|
|
} //End of for loop
|
|
|
|
|
candidateMate[v] = w;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
for ( v=0; v < NLVer; v++ ) {
|
|
|
|
|
#ifdef PRINT_DEBUG_INFO_
|
|
|
|
|
cout<<"\n("<<myRank<<")Processing: "<<v+StartIndex<<endl; fflush(stdout);
|
|
|
|
|
#endif
|
|
|
|
|
//Start: PARALLEL_PROCESS_EXPOSED_VERTEX_B(v)
|
|
|
|
|
//Start: PARALLEL_COMPUTE_CANDIDATE_MATE_B(v)
|
|
|
|
|
adj1 = verLocPtr[v];
|
|
|
|
|
adj2 = verLocPtr[v + 1];
|
|
|
|
|
w = candidateMate[v];
|
|
|
|
|
*/
|
|
|
|
|
//#pragma omp critical
|
|
|
|
|
// {
|
|
|
|
|
//End: PARALLEL_COMPUTE_CANDIDATE_MATE_B(v)
|
|
|
|
|
#ifdef PRINT_DEBUG_INFO_
|
|
|
|
|
cout<<"\n("<<myRank<<")"<<v+StartIndex<<" Points to: "<<w; fflush(stdout);
|
|
|
|
@ -461,7 +493,9 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
|
|
|
|
|
QGhostVtx.push_back(w);
|
|
|
|
|
QMsgType.push_back(REQUEST);
|
|
|
|
|
//ghostOwner = inputSubGraph.findOwner(w);
|
|
|
|
|
ghostOwner = findOwnerOfGhost(w, verDistance, myRank, numProcs); assert(ghostOwner != -1); assert(ghostOwner != myRank);
|
|
|
|
|
ghostOwner = findOwnerOfGhost(w, verDistance, myRank, numProcs);
|
|
|
|
|
assert(ghostOwner != -1);
|
|
|
|
|
assert(ghostOwner != myRank);
|
|
|
|
|
QOwner.push_back(ghostOwner);
|
|
|
|
|
PCounter[ghostOwner]++;
|
|
|
|
|
NumMessagesBundled++;
|
|
|
|
@ -527,7 +561,9 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
|
|
|
|
|
QGhostVtx.push_back(w);
|
|
|
|
|
QMsgType.push_back(FAILURE);
|
|
|
|
|
//ghostOwner = inputSubGraph.findOwner(w);
|
|
|
|
|
ghostOwner = findOwnerOfGhost(w, verDistance, myRank, numProcs); assert(ghostOwner != -1); assert(ghostOwner != myRank);
|
|
|
|
|
ghostOwner = findOwnerOfGhost(w, verDistance, myRank, numProcs);
|
|
|
|
|
assert(ghostOwner != -1);
|
|
|
|
|
assert(ghostOwner != myRank);
|
|
|
|
|
QOwner.push_back(ghostOwner);
|
|
|
|
|
PCounter[ghostOwner]++;
|
|
|
|
|
NumMessagesBundled++;
|
|
|
|
@ -536,8 +572,13 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
|
|
|
|
|
} //End of for loop
|
|
|
|
|
} // End of Else: w == -1
|
|
|
|
|
//End: PARALLEL_PROCESS_EXPOSED_VERTEX_B(v)
|
|
|
|
|
//} // end of critical
|
|
|
|
|
} //End of for ( v=0; v < NLVer; v++ )
|
|
|
|
|
|
|
|
|
|
tempCounter.clear(); //Do not need this any more
|
|
|
|
|
//} // end of parallel region
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef PRINT_DEBUG_INFO_
|
|
|
|
|
cout<<"\n("<<myRank<<"=========================************==============================="<<endl; fflush(stdout);
|
|
|
|
|
fflush(stdout);
|
|
|
|
@ -1407,10 +1448,6 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
|
|
|
|
|
*msgPercent = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} //end single
|
|
|
|
|
|
|
|
|
|
} //end of parallel region
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG_HANG_
|
|
|
|
|
if (myRank == 0) cout<<"\n("<<myRank<<") Done" <<endl; fflush(stdout);
|
|
|
|
|
#endif
|
|
|
|
|