|
|
|
@ -8,7 +8,7 @@
|
|
|
|
|
#include "dataStrStaticQueue.h"
|
|
|
|
|
#include "omp.h"
|
|
|
|
|
|
|
|
|
|
#define NUM_THREAD 12
|
|
|
|
|
#define NUM_THREAD 4
|
|
|
|
|
|
|
|
|
|
inline void initialize(MilanLongInt NLVer, MilanLongInt NLEdge,
|
|
|
|
|
MilanLongInt StartIndex, MilanLongInt EndIndex,
|
|
|
|
@ -50,7 +50,6 @@ inline void initialize(MilanLongInt NLVer, MilanLongInt NLEdge,
|
|
|
|
|
|
|
|
|
|
#pragma omp single
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// Initialize the locks
|
|
|
|
|
#pragma omp taskloop num_tasks(NUM_THREAD)
|
|
|
|
|
for (i = 0; i < NLVer; i++)
|
|
|
|
@ -71,9 +70,13 @@ inline void initialize(MilanLongInt NLVer, MilanLongInt NLEdge,
|
|
|
|
|
* only when a ghost edge is found and ghost edges are a minority,
|
|
|
|
|
* circa 3.5% during the tests.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma omp task depend(out \
|
|
|
|
|
: numGhostEdges, Counter, Ghost2LocalMap, insertMe, storedAlready, numGhostVertices)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
#pragma omp taskloop num_tasks(NUM_THREAD) reduction(+ \
|
|
|
|
|
: numGhostEdges) depend(out \
|
|
|
|
|
: numGhostEdges, Counter, Ghost2LocalMap)
|
|
|
|
|
: numGhostEdges)
|
|
|
|
|
for (i = 0; i < NLEdge; i++)
|
|
|
|
|
{ // O(m) - Each edge stored twice
|
|
|
|
|
insertMe = verLocInd[i];
|
|
|
|
@ -96,7 +99,9 @@ inline void initialize(MilanLongInt NLVer, MilanLongInt NLEdge,
|
|
|
|
|
}
|
|
|
|
|
} // End of if ( (insertMe < StartIndex) || (insertMe > EndIndex) )
|
|
|
|
|
} // End of for(ghost vertices)
|
|
|
|
|
} // end of task depend
|
|
|
|
|
|
|
|
|
|
// numGhostEdges = atomicNumGhostEdges;
|
|
|
|
|
#ifdef TIME_TRACKER
|
|
|
|
|
Ghost2LocalInitialization = MPI_Wtime() - Ghost2LocalInitialization;
|
|
|
|
|
fprintf(stderr, "Ghost2LocalInitialization time: %f\n", Ghost2LocalInitialization);
|
|
|
|
@ -121,7 +126,7 @@ inline void initialize(MilanLongInt NLVer, MilanLongInt NLEdge,
|
|
|
|
|
|
|
|
|
|
#pragma omp task depend(out \
|
|
|
|
|
: verGhostPtr, tempCounter, verGhostInd, GMate) depend(in \
|
|
|
|
|
: numGhostVertices)
|
|
|
|
|
: numGhostVertices, numGhostEdges)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// Initialize adjacency Lists for Ghost Vertices:
|
|
|
|
@ -151,7 +156,7 @@ inline void initialize(MilanLongInt NLVer, MilanLongInt NLEdge,
|
|
|
|
|
|
|
|
|
|
} // End of task
|
|
|
|
|
|
|
|
|
|
#pragma omp task depent(out \
|
|
|
|
|
#pragma omp task depend(out \
|
|
|
|
|
: verGhostPtr) depend(in \
|
|
|
|
|
: Counter, numGhostVertices)
|
|
|
|
|
{
|
|
|
|
@ -198,9 +203,11 @@ inline void initialize(MilanLongInt NLVer, MilanLongInt NLEdge,
|
|
|
|
|
* are a minority hence the critical region is executed
|
|
|
|
|
* few times, circa 3.5% of the times in the tests.
|
|
|
|
|
*/
|
|
|
|
|
#pragma omp taskloop num_tasks(NUM_THREAD) depend(in \
|
|
|
|
|
: insertMe, Ghost2LocalMap, tempCounter) depend(out \
|
|
|
|
|
#pragma omp task depend(in \
|
|
|
|
|
: insertMe, Ghost2LocalMap, tempCounter, verGhostPtr) depend(out \
|
|
|
|
|
: verGhostInd)
|
|
|
|
|
{
|
|
|
|
|
#pragma omp taskloop num_tasks(NUM_THREAD)
|
|
|
|
|
for (v = 0; v < NLVer; v++)
|
|
|
|
|
{
|
|
|
|
|
adj1 = verLocPtr[v]; // Vertex Pointer
|
|
|
|
@ -219,8 +226,7 @@ inline void initialize(MilanLongInt NLVer, MilanLongInt NLEdge,
|
|
|
|
|
} // End of if((w < StartIndex) || (w > EndIndex))
|
|
|
|
|
} // End of for(k)
|
|
|
|
|
} // End of for (v)
|
|
|
|
|
|
|
|
|
|
} // End of parallel region
|
|
|
|
|
} // end of tasklopp
|
|
|
|
|
|
|
|
|
|
#ifdef TIME_TRACKER
|
|
|
|
|
verGhostIndInitialization = MPI_Wtime() - verGhostIndInitialization;
|
|
|
|
@ -252,7 +258,7 @@ inline void initialize(MilanLongInt NLVer, MilanLongInt NLEdge,
|
|
|
|
|
cout << "Not enough memory to allocate the internal variables \n";
|
|
|
|
|
exit(1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} // end of task
|
|
|
|
|
|
|
|
|
|
#ifdef PRINT_DEBUG_INFO_
|
|
|
|
|
cout << "\n(" << myRank << ")Allocating CandidateMate.. ";
|
|
|
|
@ -270,6 +276,7 @@ inline void initialize(MilanLongInt NLVer, MilanLongInt NLEdge,
|
|
|
|
|
fflush(stdout);
|
|
|
|
|
fflush(stdout);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG_HANG_
|
|
|
|
|
if (myRank == 0)
|
|
|
|
|
cout << "\n(" << myRank << ") Setup Time :" << *ph0_time << endl;
|
|
|
|
@ -281,8 +288,7 @@ inline void initialize(MilanLongInt NLVer, MilanLongInt NLEdge,
|
|
|
|
|
: candidateMate, S, U, privateU, privateQLocalVtx, privateQGhostVtx, privateQMsgType, privateQOwner)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//The values calculated in this function are sent back to the calling function
|
|
|
|
|
// The values calculated in this function are sent back to the calling function
|
|
|
|
|
*numGhostEdgesPtr = numGhostEdges;
|
|
|
|
|
*numGhostVerticesPtr = numGhostVertices;
|
|
|
|
|
|
|
|
|
@ -315,6 +321,8 @@ inline void initialize(MilanLongInt NLVer, MilanLongInt NLEdge,
|
|
|
|
|
new (&privateQGhostVtx) staticQueue(size);
|
|
|
|
|
new (&privateQMsgType) staticQueue(size);
|
|
|
|
|
new (&privateQOwner) staticQueue(size);
|
|
|
|
|
}
|
|
|
|
|
} // End of single
|
|
|
|
|
} // end of task
|
|
|
|
|
|
|
|
|
|
} // End of single region
|
|
|
|
|
} // End of parallel region
|
|
|
|
|
}
|
|
|
|
|