|
|
|
@ -180,17 +180,34 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateC(
|
|
|
|
|
* only when a ghost edge is found and ghost edges are a minority.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
//Define Adjacency Lists for Ghost Vertices:
|
|
|
|
|
//cout<<"Building Ghost data structures ... \n\n";
|
|
|
|
|
vector <MilanLongInt> verGhostPtr, verGhostInd, tempCounter;
|
|
|
|
|
//Mate array for ghost vertices:
|
|
|
|
|
vector <MilanLongInt> GMate; //Proportional to the number of ghost vertices
|
|
|
|
|
|
|
|
|
|
#ifdef TIME_TRACKER
|
|
|
|
|
double Ghost2LocalInitialization = MPI_Wtime();
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#pragma omp parallel for private(insertMe) firstprivate(StartIndex, EndIndex) default(shared)
|
|
|
|
|
//#define OMP
|
|
|
|
|
#ifdef OMP
|
|
|
|
|
#pragma omp parallel private(insertMe, k, adj1, adj2) firstprivate(StartIndex, EndIndex) default(shared) num_threads(4)
|
|
|
|
|
{
|
|
|
|
|
#endif
|
|
|
|
|
//printf("Id %d\n", omp_get_thread_num());
|
|
|
|
|
|
|
|
|
|
#ifdef OMP
|
|
|
|
|
#pragma omp for
|
|
|
|
|
#endif
|
|
|
|
|
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
|
|
|
|
|
#ifdef OMP
|
|
|
|
|
#pragma omp critical
|
|
|
|
|
{
|
|
|
|
|
#endif
|
|
|
|
|
numGhostEdges++;
|
|
|
|
|
storedAlready = Ghost2LocalMap.find(insertMe);
|
|
|
|
|
if (storedAlready != Ghost2LocalMap.end()) { //Has already been added
|
|
|
|
@ -202,10 +219,17 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateC(
|
|
|
|
|
Counter.push_back(1); //Initialize the counter
|
|
|
|
|
numGhostVertices++; //Increment the number of ghost vertices
|
|
|
|
|
} //End of else()
|
|
|
|
|
#ifdef OMP
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
} //End of if ( (insertMe < StartIndex) || (insertMe > EndIndex) )
|
|
|
|
|
} //End of for(ghost vertices)
|
|
|
|
|
|
|
|
|
|
#ifdef OMP
|
|
|
|
|
#pragma omp single
|
|
|
|
|
{
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef TIME_TRACKER
|
|
|
|
|
Ghost2LocalInitialization = MPI_Wtime() - Ghost2LocalInitialization;
|
|
|
|
|
fprintf(stderr, "Ghost2LocalInitialization time: %f\n", Ghost2LocalInitialization);
|
|
|
|
@ -224,11 +248,8 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateC(
|
|
|
|
|
} while ( storedAlready != Ghost2LocalMap.end() );
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
//Build Adjacency Lists for Ghost Vertices:
|
|
|
|
|
//cout<<"Building Ghost data structures ... \n\n";
|
|
|
|
|
vector<MilanLongInt> verGhostPtr, verGhostInd, tempCounter;
|
|
|
|
|
//Mate array for ghost vertices:
|
|
|
|
|
vector<MilanLongInt> GMate; //Proportional to the number of ghost vertices
|
|
|
|
|
|
|
|
|
|
//Initialize adjacency Lists for Ghost Vertices:
|
|
|
|
|
try {
|
|
|
|
|
verGhostPtr.reserve(numGhostVertices + 1); //Pointer Vector
|
|
|
|
|
tempCounter.reserve(numGhostVertices); //Pointer Vector
|
|
|
|
@ -249,17 +270,21 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateC(
|
|
|
|
|
cout<<"\n("<<myRank<<")Ghost Vertex Pointer: "; fflush(stdout);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#define TIME_TRACKER
|
|
|
|
|
#ifdef TIME_TRACKER
|
|
|
|
|
double verGhostPtrInitialization = MPI_Wtime();
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef OMP
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
/*
|
|
|
|
|
* OMP verGhostPtrInitialization
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma omp parallel for default(shared)
|
|
|
|
|
#ifdef OMP
|
|
|
|
|
#pragma omp for nowait
|
|
|
|
|
#endif
|
|
|
|
|
for (i = 0; i < numGhostVertices; i++) { //O(|Ghost Vertices|)
|
|
|
|
|
verGhostPtr[i + 1] = verGhostPtr[i] + Counter[i];
|
|
|
|
|
#ifdef PRINT_DEBUG_INFO_
|
|
|
|
@ -272,9 +297,6 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateC(
|
|
|
|
|
fprintf(stderr, "verGhostPtrInitialization time: %f\n", verGhostPtrInitialization);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#undef TIME_TRACKER
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef PRINT_DEBUG_INFO_
|
|
|
|
|
if ( numGhostVertices > 0 )
|
|
|
|
|
cout<<verGhostPtr[numGhostVertices]<<"\n";
|
|
|
|
@ -299,24 +321,33 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateC(
|
|
|
|
|
#ifdef TIME_TRACKER
|
|
|
|
|
double verGhostIndInitialization = MPI_Wtime();
|
|
|
|
|
#endif
|
|
|
|
|
#pragma omp parallel for private(insertMe, k, adj1, adj2) firstprivate(StartIndex, EndIndex) default(shared)
|
|
|
|
|
#ifdef OMP
|
|
|
|
|
#pragma omp for
|
|
|
|
|
#endif
|
|
|
|
|
for ( v=0; v < NLVer; v++ ) {
|
|
|
|
|
adj1 = verLocPtr[v]; //Vertex Pointer
|
|
|
|
|
adj2 = verLocPtr[v+1];
|
|
|
|
|
for( k = adj1; k < adj2; k++ ) {
|
|
|
|
|
w = verLocInd[k]; //Get the adjacent vertex
|
|
|
|
|
if ( (w < StartIndex) || (w > EndIndex) ) { //Find a ghost
|
|
|
|
|
#ifdef OMP
|
|
|
|
|
#pragma omp critical
|
|
|
|
|
{
|
|
|
|
|
#endif
|
|
|
|
|
insertMe = verGhostPtr[Ghost2LocalMap[w]] + tempCounter[Ghost2LocalMap[w]]; //Where to insert
|
|
|
|
|
verGhostInd[insertMe] = v + StartIndex; //Add the adjacency
|
|
|
|
|
tempCounter[Ghost2LocalMap[w]]++; //Increment the counter
|
|
|
|
|
#ifdef OMP
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
} //End of if((w < StartIndex) || (w > EndIndex))
|
|
|
|
|
} //End of for(k)
|
|
|
|
|
} //End of for (v)
|
|
|
|
|
tempCounter.clear(); //Do not need this any more
|
|
|
|
|
|
|
|
|
|
#ifdef OMP
|
|
|
|
|
} //end of parallel region
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef TIME_TRACKER
|
|
|
|
|
verGhostIndInitialization = MPI_Wtime() - verGhostIndInitialization;
|
|
|
|
|
fprintf(stderr, "verGhostIndInitialization time: %f\n", verGhostIndInitialization);
|
|
|
|
|