|
|
|
@ -1,45 +1,43 @@
|
|
|
|
|
#include "MatchBoxPC.h"
|
|
|
|
|
|
|
|
|
|
void PARALLEL_PROCESS_EXPOSED_VERTEX_B(MilanLongInt NLVer,
|
|
|
|
|
MilanLongInt *candidateMate,
|
|
|
|
|
MilanLongInt *verLocInd,
|
|
|
|
|
MilanLongInt *verLocPtr,
|
|
|
|
|
MilanLongInt StartIndex,
|
|
|
|
|
MilanLongInt EndIndex,
|
|
|
|
|
MilanLongInt *Mate,
|
|
|
|
|
vector<MilanLongInt> &GMate,
|
|
|
|
|
map<MilanLongInt, MilanLongInt> &Ghost2LocalMap,
|
|
|
|
|
MilanReal *edgeLocWeight,
|
|
|
|
|
MilanLongInt *myCardPtr,
|
|
|
|
|
MilanLongInt *msgIndPtr,
|
|
|
|
|
MilanLongInt *NumMessagesBundledPtr,
|
|
|
|
|
MilanLongInt *SPtr,
|
|
|
|
|
MilanLongInt *verDistance,
|
|
|
|
|
MilanLongInt *PCounter,
|
|
|
|
|
vector<MilanLongInt> &Counter,
|
|
|
|
|
MilanInt myRank,
|
|
|
|
|
MilanInt numProcs,
|
|
|
|
|
staticQueue &U,
|
|
|
|
|
staticQueue &privateU,
|
|
|
|
|
vector<MilanLongInt> &QLocalVtx,
|
|
|
|
|
vector<MilanLongInt> &QGhostVtx,
|
|
|
|
|
vector<MilanLongInt> &QMsgType,
|
|
|
|
|
vector<MilanInt> &QOwner,
|
|
|
|
|
staticQueue &privateQLocalVtx,
|
|
|
|
|
staticQueue &privateQGhostVtx,
|
|
|
|
|
staticQueue &privateQMsgType,
|
|
|
|
|
staticQueue &privateQOwner)
|
|
|
|
|
MilanLongInt *candidateMate,
|
|
|
|
|
MilanLongInt *verLocInd,
|
|
|
|
|
MilanLongInt *verLocPtr,
|
|
|
|
|
MilanLongInt StartIndex,
|
|
|
|
|
MilanLongInt EndIndex,
|
|
|
|
|
MilanLongInt *Mate,
|
|
|
|
|
vector<MilanLongInt> &GMate,
|
|
|
|
|
map<MilanLongInt, MilanLongInt> &Ghost2LocalMap,
|
|
|
|
|
MilanReal *edgeLocWeight,
|
|
|
|
|
MilanLongInt *myCard,
|
|
|
|
|
MilanLongInt *msgInd,
|
|
|
|
|
MilanLongInt *NumMessagesBundled,
|
|
|
|
|
MilanLongInt *S,
|
|
|
|
|
MilanLongInt *verDistance,
|
|
|
|
|
MilanLongInt *PCounter,
|
|
|
|
|
vector<MilanLongInt> &Counter,
|
|
|
|
|
MilanInt myRank,
|
|
|
|
|
MilanInt numProcs,
|
|
|
|
|
staticQueue &U,
|
|
|
|
|
staticQueue &privateU,
|
|
|
|
|
vector<MilanLongInt> &QLocalVtx,
|
|
|
|
|
vector<MilanLongInt> &QGhostVtx,
|
|
|
|
|
vector<MilanLongInt> &QMsgType,
|
|
|
|
|
vector<MilanInt> &QOwner,
|
|
|
|
|
staticQueue &privateQLocalVtx,
|
|
|
|
|
staticQueue &privateQGhostVtx,
|
|
|
|
|
staticQueue &privateQMsgType,
|
|
|
|
|
staticQueue &privateQOwner)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
MilanLongInt v = -1, k = -1, w = -1, adj11 = 0, adj12 = 0, k1 = 0, S = *SPtr;
|
|
|
|
|
MilanLongInt myCard = 0, msgInd = 0;
|
|
|
|
|
MilanLongInt NumMessagesBundled = 0;
|
|
|
|
|
MilanLongInt v = -1, k = -1, w = -1, adj11 = 0, adj12 = 0, k1 = 0;
|
|
|
|
|
MilanInt ghostOwner = 0;
|
|
|
|
|
|
|
|
|
|
#pragma omp parallel private(k, w, v, k1, adj11, adj12, ghostOwner) firstprivate(privateU, StartIndex, EndIndex, privateQLocalVtx, privateQGhostVtx, privateQMsgType, privateQOwner) default(shared) num_threads(NUM_THREAD)
|
|
|
|
|
{
|
|
|
|
|
#pragma omp for reduction(+ \
|
|
|
|
|
: msgInd, NumMessagesBundled, myCard, PCounter[:numProcs]) schedule(static)
|
|
|
|
|
: PCounter[:numProcs]) schedule(static)
|
|
|
|
|
for (v = 0; v < NLVer; v++)
|
|
|
|
|
{
|
|
|
|
|
// Start: PARALLEL_PROCESS_EXPOSED_VERTEX_B(v)
|
|
|
|
@ -76,8 +74,8 @@ void PARALLEL_PROCESS_EXPOSED_VERTEX_B(MilanLongInt NLVer,
|
|
|
|
|
|
|
|
|
|
if (w >= 0)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
myCard++;
|
|
|
|
|
#pragma omp atomic
|
|
|
|
|
(*myCard)++;
|
|
|
|
|
if ((w < StartIndex) || (w > EndIndex))
|
|
|
|
|
{ // w is a ghost vertex
|
|
|
|
|
#ifdef PRINT_DEBUG_INFO_
|
|
|
|
@ -85,9 +83,10 @@ void PARALLEL_PROCESS_EXPOSED_VERTEX_B(MilanLongInt NLVer,
|
|
|
|
|
cout << "\n(" << myRank << ")Local is: " << v + StartIndex << " Ghost is " << w << " Owner is: " << findOwnerOfGhost(w, verDistance, myRank, numProcs) << endl;
|
|
|
|
|
fflush(stdout);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
msgInd++;
|
|
|
|
|
NumMessagesBundled++;
|
|
|
|
|
#pragma omp atomic
|
|
|
|
|
(*msgInd)++;
|
|
|
|
|
#pragma omp atomic
|
|
|
|
|
(*NumMessagesBundled)++;
|
|
|
|
|
ghostOwner = findOwnerOfGhost(w, verDistance, myRank, numProcs);
|
|
|
|
|
assert(ghostOwner != -1);
|
|
|
|
|
assert(ghostOwner != myRank);
|
|
|
|
@ -97,7 +96,6 @@ void PARALLEL_PROCESS_EXPOSED_VERTEX_B(MilanLongInt NLVer,
|
|
|
|
|
privateQGhostVtx.push_back(w);
|
|
|
|
|
privateQMsgType.push_back(REQUEST);
|
|
|
|
|
privateQOwner.push_back(ghostOwner);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (candidateMate[NLVer + Ghost2LocalMap[w]] == v + StartIndex)
|
|
|
|
|
{
|
|
|
|
@ -113,9 +111,9 @@ void PARALLEL_PROCESS_EXPOSED_VERTEX_B(MilanLongInt NLVer,
|
|
|
|
|
fflush(stdout);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
//TODO refactor this!!
|
|
|
|
|
// Decrement the counter:
|
|
|
|
|
PROCESS_CROSS_EDGE(&Counter[Ghost2LocalMap[w]], &S);
|
|
|
|
|
// TODO refactor this!!
|
|
|
|
|
// Decrement the counter:
|
|
|
|
|
PROCESS_CROSS_EDGE(&Counter[Ghost2LocalMap[w]], S);
|
|
|
|
|
} // End of if CandidateMate[w] = v
|
|
|
|
|
|
|
|
|
|
} // End of if a Ghost Vertex
|
|
|
|
@ -159,9 +157,10 @@ void PARALLEL_PROCESS_EXPOSED_VERTEX_B(MilanLongInt NLVer,
|
|
|
|
|
cout << "\n(" << myRank << ")Ghost is " << w << " Owner is: " << findOwnerOfGhost(w, verDistance, myRank, numProcs);
|
|
|
|
|
fflush(stdout);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
msgInd++;
|
|
|
|
|
NumMessagesBundled++;
|
|
|
|
|
#pragma omp atomic
|
|
|
|
|
(*msgInd)++;
|
|
|
|
|
#pragma omp atomic
|
|
|
|
|
(*NumMessagesBundled)++;
|
|
|
|
|
ghostOwner = findOwnerOfGhost(w, verDistance, myRank, numProcs);
|
|
|
|
|
assert(ghostOwner != -1);
|
|
|
|
|
assert(ghostOwner != myRank);
|
|
|
|
@ -184,14 +183,5 @@ void PARALLEL_PROCESS_EXPOSED_VERTEX_B(MilanLongInt NLVer,
|
|
|
|
|
privateQMsgType,
|
|
|
|
|
privateQOwner);
|
|
|
|
|
|
|
|
|
|
//TODO move this outside of the parallel region!!
|
|
|
|
|
#pragma omp master
|
|
|
|
|
{
|
|
|
|
|
*myCardPtr = myCard;
|
|
|
|
|
*msgIndPtr = msgInd;
|
|
|
|
|
*NumMessagesBundledPtr = NumMessagesBundled;
|
|
|
|
|
*SPtr = S;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // End of parallel region
|
|
|
|
|
}
|