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