mirror of
https://github.com/sfilippone/amg4psblas.git
synced 2026-10-16 02:49:05 +00:00
Compare commits
29
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
843ea99b17 | ||
|
|
8c00a7cabe | ||
|
|
b4c60ae409 | ||
|
|
dfc261cf34 | ||
|
|
cab98295e2 | ||
|
|
5a83c63810 | ||
|
|
2e43f55455 | ||
|
|
244fcda207 | ||
|
|
ca6fce0765 | ||
|
|
b6f92354d3 | ||
|
|
1b7fe6a9a7 | ||
|
|
14ea4d9c15 | ||
|
|
3ee333baac | ||
|
|
ecb41dfbbf | ||
|
|
33ac3f786b | ||
|
|
474c6a3634 | ||
|
|
5b17e1bbf1 | ||
|
|
c9605d1b29 | ||
|
|
767b606bb2 | ||
|
|
8492c07521 | ||
|
|
17698c2725 | ||
|
|
0f3c3380cb | ||
|
|
15bb4ac101 | ||
|
|
12356f65f6 | ||
|
|
2ef4459b18 | ||
|
|
c2fd0ac66d | ||
|
|
5387e206b1 | ||
|
|
fc34385341 | ||
|
|
5fbdfb1436 |
@@ -3,9 +3,9 @@ include Make.inc
|
|||||||
|
|
||||||
all: objs lib
|
all: objs lib
|
||||||
|
|
||||||
objs: amgp cbnd
|
objs: libdir amgp cbnd
|
||||||
|
|
||||||
lib: libdir objs
|
lib: objs
|
||||||
cd amgprec && $(MAKE) lib
|
cd amgprec && $(MAKE) lib
|
||||||
cd cbind && $(MAKE) lib
|
cd cbind && $(MAKE) lib
|
||||||
|
|
||||||
|
|||||||
@@ -272,7 +272,9 @@ contains
|
|||||||
write(0,*) 'Impossible: mate(k) > nc'
|
write(0,*) 'Impossible: mate(k) > nc'
|
||||||
cycle
|
cycle
|
||||||
else
|
else
|
||||||
|
|
||||||
if (ilaggr(k) == ilaggr_neginit) then
|
if (ilaggr(k) == ilaggr_neginit) then
|
||||||
|
|
||||||
wk = w(k)
|
wk = w(k)
|
||||||
widx = w(idx)
|
widx = w(idx)
|
||||||
wmax = max(abs(wk),abs(widx))
|
wmax = max(abs(wk),abs(widx))
|
||||||
|
|||||||
@@ -42,7 +42,6 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#if !defined(SERIAL_MPI)
|
#if !defined(SERIAL_MPI)
|
||||||
#include <mpi.h>
|
#include <mpi.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "MatchBoxPC.h"
|
#include "MatchBoxPC.h"
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@@ -67,13 +66,13 @@ void dMatchBoxPC(MilanLongInt NLVer, MilanLongInt NLEdge,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#undef TIME_TRACKER
|
#define TIME_TRACKER
|
||||||
#ifdef TIME_TRACKER
|
#ifdef TIME_TRACKER
|
||||||
double tmr = MPI_Wtime();
|
double tmr = MPI_Wtime();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(OPENMP)
|
#define OMP
|
||||||
//fprintf(stderr,"Warning: using buggy OpenMP matching!\n");
|
#ifdef OMP
|
||||||
dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(NLVer, NLEdge,
|
dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(NLVer, NLEdge,
|
||||||
verLocPtr, verLocInd, edgeLocWeight,
|
verLocPtr, verLocInd, edgeLocWeight,
|
||||||
verDistance, Mate,
|
verDistance, Mate,
|
||||||
@@ -92,11 +91,11 @@ void dMatchBoxPC(MilanLongInt NLVer, MilanLongInt NLEdge,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef TIME_TRACKER
|
#ifdef TIME_TRACKER
|
||||||
tmr = MPI_Wtime() - tmr;
|
tmr = MPI_Wtime() - tmr;
|
||||||
fprintf(stderr, "Elaboration time: %f for %ld nodes\n", tmr, NLVer);
|
fprintf(stderr, "Elaboration time: %f for %ld nodes\n", tmr, NLVer);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,27 +113,17 @@ void sMatchBoxPC(MilanLongInt NLVer, MilanLongInt NLEdge,
|
|||||||
fprintf(stderr,"MatchBoxPC: rank %d nlver %ld nledge %ld [ %ld %ld ]\n",
|
fprintf(stderr,"MatchBoxPC: rank %d nlver %ld nledge %ld [ %ld %ld ]\n",
|
||||||
myRank,NLVer, NLEdge,verDistance[0],verDistance[1]);
|
myRank,NLVer, NLEdge,verDistance[0],verDistance[1]);
|
||||||
#endif
|
#endif
|
||||||
#if defined(OPENMP)
|
|
||||||
//fprintf(stderr,"Warning: using buggy OpenMP matching!\n");
|
|
||||||
salgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(NLVer, NLEdge,
|
|
||||||
verLocPtr, verLocInd, edgeLocWeight,
|
|
||||||
verDistance, Mate,
|
|
||||||
myRank, numProcs, C_comm,
|
|
||||||
msgIndSent, msgActualSent, msgPercent,
|
|
||||||
ph0_time, ph1_time, ph2_time,
|
|
||||||
ph1_card, ph2_card );
|
|
||||||
#else
|
|
||||||
salgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateC(NLVer, NLEdge,
|
salgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateC(NLVer, NLEdge,
|
||||||
verLocPtr, verLocInd, edgeLocWeight,
|
verLocPtr, verLocInd, edgeLocWeight,
|
||||||
verDistance, Mate,
|
verDistance, Mate,
|
||||||
myRank, numProcs, C_comm,
|
myRank, numProcs, C_comm,
|
||||||
msgIndSent, msgActualSent, msgPercent,
|
msgIndSent, msgActualSent, msgPercent,
|
||||||
ph0_time, ph1_time, ph2_time,
|
ph0_time, ph1_time, ph2_time,
|
||||||
ph1_card, ph2_card );
|
ph1_card, ph2_card );
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -59,11 +59,7 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#ifdef OPENMP
|
|
||||||
// OpenMP is included and used if and only if the OpenMP version of the matching
|
|
||||||
// is required
|
|
||||||
#include "omp.h"
|
#include "omp.h"
|
||||||
#endif
|
|
||||||
#include "primitiveDataTypeDefinitions.h"
|
#include "primitiveDataTypeDefinitions.h"
|
||||||
#include "dataStrStaticQueue.h"
|
#include "dataStrStaticQueue.h"
|
||||||
|
|
||||||
@@ -82,6 +78,8 @@ const int BundleTag = 9; // Predefined tag
|
|||||||
|
|
||||||
static vector<MilanLongInt> DEFAULT_VECTOR;
|
static vector<MilanLongInt> DEFAULT_VECTOR;
|
||||||
|
|
||||||
|
#if !defined(SERIAL_MPI)
|
||||||
|
|
||||||
// MPI type map
|
// MPI type map
|
||||||
template <typename T>
|
template <typename T>
|
||||||
MPI_Datatype TypeMap();
|
MPI_Datatype TypeMap();
|
||||||
@@ -93,6 +91,7 @@ template <>
|
|||||||
inline MPI_Datatype TypeMap<double>() { return MPI_DOUBLE; }
|
inline MPI_Datatype TypeMap<double>() { return MPI_DOUBLE; }
|
||||||
template <>
|
template <>
|
||||||
inline MPI_Datatype TypeMap<float>() { return MPI_FLOAT; }
|
inline MPI_Datatype TypeMap<float>() { return MPI_FLOAT; }
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C"
|
||||||
@@ -178,416 +177,252 @@ extern "C"
|
|||||||
#define MilanRealMin MINUS_INFINITY
|
#define MilanRealMin MINUS_INFINITY
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* These functions are only used in the experimental OMP implementation, if that
|
// Function of find the owner of a ghost vertex using binary search:
|
||||||
is disabled there is no reason to actually compile or reference them. */
|
MilanInt findOwnerOfGhost(MilanLongInt vtxIndex, MilanLongInt *mVerDistance,
|
||||||
|
MilanInt myRank, MilanInt numProcs);
|
||||||
|
|
||||||
// Function of find the owner of a ghost vertex using binary search:
|
MilanLongInt firstComputeCandidateMate(MilanLongInt adj1,
|
||||||
MilanInt findOwnerOfGhost(MilanLongInt vtxIndex, MilanLongInt *mVerDistance,
|
MilanLongInt adj2,
|
||||||
MilanInt myRank, MilanInt numProcs);
|
MilanLongInt *verLocInd,
|
||||||
|
MilanReal *edgeLocWeight);
|
||||||
MilanLongInt firstComputeCandidateMateD(MilanLongInt adj1,
|
|
||||||
MilanLongInt adj2,
|
|
||||||
MilanLongInt *verLocInd,
|
|
||||||
MilanReal *edgeLocWeight);
|
|
||||||
|
|
||||||
|
void queuesTransfer(vector<MilanLongInt> &U,
|
||||||
void queuesTransfer(vector<MilanLongInt> &U,
|
vector<MilanLongInt> &privateU,
|
||||||
vector<MilanLongInt> &privateU,
|
vector<MilanLongInt> &QLocalVtx,
|
||||||
vector<MilanLongInt> &QLocalVtx,
|
vector<MilanLongInt> &QGhostVtx,
|
||||||
vector<MilanLongInt> &QGhostVtx,
|
vector<MilanLongInt> &QMsgType,
|
||||||
vector<MilanLongInt> &QMsgType,
|
vector<MilanInt> &QOwner,
|
||||||
vector<MilanInt> &QOwner,
|
vector<MilanLongInt> &privateQLocalVtx,
|
||||||
vector<MilanLongInt> &privateQLocalVtx,
|
vector<MilanLongInt> &privateQGhostVtx,
|
||||||
vector<MilanLongInt> &privateQGhostVtx,
|
vector<MilanLongInt> &privateQMsgType,
|
||||||
vector<MilanLongInt> &privateQMsgType,
|
vector<MilanInt> &privateQOwner);
|
||||||
vector<MilanInt> &privateQOwner);
|
|
||||||
|
|
||||||
bool isAlreadyMatched(MilanLongInt node,
|
|
||||||
MilanLongInt StartIndex,
|
|
||||||
MilanLongInt EndIndex,
|
|
||||||
vector<MilanLongInt> &GMate,
|
|
||||||
MilanLongInt *Mate,
|
|
||||||
map<MilanLongInt, MilanLongInt> &Ghost2LocalMap);
|
|
||||||
|
|
||||||
MilanLongInt computeCandidateMateD(MilanLongInt adj1,
|
|
||||||
MilanLongInt adj2,
|
|
||||||
MilanReal *edgeLocWeight,
|
|
||||||
MilanLongInt k,
|
|
||||||
MilanLongInt *verLocInd,
|
|
||||||
MilanLongInt StartIndex,
|
|
||||||
MilanLongInt EndIndex,
|
|
||||||
vector<MilanLongInt> &GMate,
|
|
||||||
MilanLongInt *Mate,
|
|
||||||
map<MilanLongInt, MilanLongInt> &Ghost2LocalMap);
|
|
||||||
|
|
||||||
void initialize(MilanLongInt NLVer, MilanLongInt NLEdge,
|
|
||||||
MilanLongInt StartIndex, MilanLongInt EndIndex,
|
|
||||||
MilanLongInt *numGhostEdgesPtr,
|
|
||||||
MilanLongInt *numGhostVerticesPtr,
|
|
||||||
MilanLongInt *S,
|
|
||||||
MilanLongInt *verLocInd,
|
|
||||||
MilanLongInt *verLocPtr,
|
|
||||||
map<MilanLongInt, MilanLongInt> &Ghost2LocalMap,
|
|
||||||
vector<MilanLongInt> &Counter,
|
|
||||||
vector<MilanLongInt> &verGhostPtr,
|
|
||||||
vector<MilanLongInt> &verGhostInd,
|
|
||||||
vector<MilanLongInt> &tempCounter,
|
|
||||||
vector<MilanLongInt> &GMate,
|
|
||||||
vector<MilanLongInt> &Message,
|
|
||||||
vector<MilanLongInt> &QLocalVtx,
|
|
||||||
vector<MilanLongInt> &QGhostVtx,
|
|
||||||
vector<MilanLongInt> &QMsgType,
|
|
||||||
vector<MilanInt> &QOwner,
|
|
||||||
MilanLongInt *&candidateMate,
|
|
||||||
vector<MilanLongInt> &U,
|
|
||||||
vector<MilanLongInt> &privateU,
|
|
||||||
vector<MilanLongInt> &privateQLocalVtx,
|
|
||||||
vector<MilanLongInt> &privateQGhostVtx,
|
|
||||||
vector<MilanLongInt> &privateQMsgType,
|
|
||||||
vector<MilanInt> &privateQOwner);
|
|
||||||
|
|
||||||
void clean(MilanLongInt NLVer,
|
|
||||||
MilanInt myRank,
|
|
||||||
MilanLongInt MessageIndex,
|
|
||||||
vector<MPI_Request> &SRequest,
|
|
||||||
vector<MPI_Status> &SStatus,
|
|
||||||
MilanInt BufferSize,
|
|
||||||
MilanLongInt *Buffer,
|
|
||||||
MilanLongInt msgActual,
|
|
||||||
MilanLongInt *msgActualSent,
|
|
||||||
MilanLongInt msgInd,
|
|
||||||
MilanLongInt *msgIndSent,
|
|
||||||
MilanLongInt NumMessagesBundled,
|
|
||||||
MilanReal *msgPercent);
|
|
||||||
|
|
||||||
void PARALLEL_COMPUTE_CANDIDATE_MATE_BD(MilanLongInt NLVer,
|
|
||||||
MilanLongInt *verLocPtr,
|
|
||||||
MilanLongInt *verLocInd,
|
|
||||||
MilanInt myRank,
|
|
||||||
MilanReal *edgeLocWeight,
|
|
||||||
MilanLongInt *candidateMate);
|
|
||||||
|
|
||||||
void PARALLEL_PROCESS_EXPOSED_VERTEX_BD(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,
|
|
||||||
vector<MilanLongInt> &U,
|
|
||||||
vector<MilanLongInt> &privateU,
|
|
||||||
vector<MilanLongInt> &QLocalVtx,
|
|
||||||
vector<MilanLongInt> &QGhostVtx,
|
|
||||||
vector<MilanLongInt> &QMsgType,
|
|
||||||
vector<MilanInt> &QOwner,
|
|
||||||
vector<MilanLongInt> &privateQLocalVtx,
|
|
||||||
vector<MilanLongInt> &privateQGhostVtx,
|
|
||||||
vector<MilanLongInt> &privateQMsgType,
|
|
||||||
vector<MilanInt> &privateQOwner);
|
|
||||||
|
|
||||||
void PROCESS_CROSS_EDGE(MilanLongInt *edge,
|
|
||||||
MilanLongInt *SPtr);
|
|
||||||
|
|
||||||
void processMatchedVerticesD(
|
|
||||||
MilanLongInt NLVer,
|
|
||||||
vector<MilanLongInt> &UChunkBeingProcessed,
|
|
||||||
vector<MilanLongInt> &U,
|
|
||||||
vector<MilanLongInt> &privateU,
|
|
||||||
MilanLongInt StartIndex,
|
|
||||||
MilanLongInt EndIndex,
|
|
||||||
MilanLongInt *myCardPtr,
|
|
||||||
MilanLongInt *msgIndPtr,
|
|
||||||
MilanLongInt *NumMessagesBundledPtr,
|
|
||||||
MilanLongInt *SPtr,
|
|
||||||
MilanLongInt *verLocPtr,
|
|
||||||
MilanLongInt *verLocInd,
|
|
||||||
MilanLongInt *verDistance,
|
|
||||||
MilanLongInt *PCounter,
|
|
||||||
vector<MilanLongInt> &Counter,
|
|
||||||
MilanInt myRank,
|
|
||||||
MilanInt numProcs,
|
|
||||||
MilanLongInt *candidateMate,
|
|
||||||
vector<MilanLongInt> &GMate,
|
|
||||||
MilanLongInt *Mate,
|
|
||||||
map<MilanLongInt, MilanLongInt> &Ghost2LocalMap,
|
|
||||||
MilanReal *edgeLocWeight,
|
|
||||||
vector<MilanLongInt> &QLocalVtx,
|
|
||||||
vector<MilanLongInt> &QGhostVtx,
|
|
||||||
vector<MilanLongInt> &QMsgType,
|
|
||||||
vector<MilanInt> &QOwner,
|
|
||||||
vector<MilanLongInt> &privateQLocalVtx,
|
|
||||||
vector<MilanLongInt> &privateQGhostVtx,
|
|
||||||
vector<MilanLongInt> &privateQMsgType,
|
|
||||||
vector<MilanInt> &privateQOwner);
|
|
||||||
|
|
||||||
void processMatchedVerticesAndSendMessagesD(
|
|
||||||
MilanLongInt NLVer,
|
|
||||||
vector<MilanLongInt> &UChunkBeingProcessed,
|
|
||||||
vector<MilanLongInt> &U,
|
|
||||||
vector<MilanLongInt> &privateU,
|
|
||||||
MilanLongInt StartIndex,
|
|
||||||
MilanLongInt EndIndex,
|
|
||||||
MilanLongInt *myCardPtr,
|
|
||||||
MilanLongInt *msgIndPtr,
|
|
||||||
MilanLongInt *NumMessagesBundledPtr,
|
|
||||||
MilanLongInt *SPtr,
|
|
||||||
MilanLongInt *verLocPtr,
|
|
||||||
MilanLongInt *verLocInd,
|
|
||||||
MilanLongInt *verDistance,
|
|
||||||
MilanLongInt *PCounter,
|
|
||||||
vector<MilanLongInt> &Counter,
|
|
||||||
MilanInt myRank,
|
|
||||||
MilanInt numProcs,
|
|
||||||
MilanLongInt *candidateMate,
|
|
||||||
vector<MilanLongInt> &GMate,
|
|
||||||
MilanLongInt *Mate,
|
|
||||||
map<MilanLongInt, MilanLongInt> &Ghost2LocalMap,
|
|
||||||
MilanReal *edgeLocWeight,
|
|
||||||
vector<MilanLongInt> &QLocalVtx,
|
|
||||||
vector<MilanLongInt> &QGhostVtx,
|
|
||||||
vector<MilanLongInt> &QMsgType,
|
|
||||||
vector<MilanInt> &QOwner,
|
|
||||||
vector<MilanLongInt> &privateQLocalVtx,
|
|
||||||
vector<MilanLongInt> &privateQGhostVtx,
|
|
||||||
vector<MilanLongInt> &privateQMsgType,
|
|
||||||
vector<MilanInt> &privateQOwner,
|
|
||||||
MPI_Comm comm,
|
|
||||||
MilanLongInt *msgActual,
|
|
||||||
vector<MilanLongInt> &Message);
|
|
||||||
|
|
||||||
void sendBundledMessages(MilanLongInt *numGhostEdgesPtr,
|
|
||||||
MilanInt *BufferSizePtr,
|
|
||||||
MilanLongInt *Buffer,
|
|
||||||
vector<MilanLongInt> &PCumulative,
|
|
||||||
vector<MilanLongInt> &PMessageBundle,
|
|
||||||
vector<MilanLongInt> &PSizeInfoMessages,
|
|
||||||
MilanLongInt *PCounter,
|
|
||||||
MilanLongInt NumMessagesBundled,
|
|
||||||
MilanLongInt *msgActualPtr,
|
|
||||||
MilanLongInt *MessageIndexPtr,
|
|
||||||
MilanInt numProcs,
|
|
||||||
MilanInt myRank,
|
|
||||||
MPI_Comm comm,
|
|
||||||
vector<MilanLongInt> &QLocalVtx,
|
|
||||||
vector<MilanLongInt> &QGhostVtx,
|
|
||||||
vector<MilanLongInt> &QMsgType,
|
|
||||||
vector<MilanInt> &QOwner,
|
|
||||||
vector<MPI_Request> &SRequest,
|
|
||||||
vector<MPI_Status> &SStatus);
|
|
||||||
|
|
||||||
void processMessagesD(
|
|
||||||
MilanLongInt NLVer,
|
|
||||||
MilanLongInt *Mate,
|
|
||||||
MilanLongInt *candidateMate,
|
|
||||||
map<MilanLongInt, MilanLongInt> &Ghost2LocalMap,
|
|
||||||
vector<MilanLongInt> &GMate,
|
|
||||||
vector<MilanLongInt> &Counter,
|
|
||||||
MilanLongInt StartIndex,
|
|
||||||
MilanLongInt EndIndex,
|
|
||||||
MilanLongInt *myCardPtr,
|
|
||||||
MilanLongInt *msgIndPtr,
|
|
||||||
MilanLongInt *msgActualPtr,
|
|
||||||
MilanReal *edgeLocWeight,
|
|
||||||
MilanLongInt *verDistance,
|
|
||||||
MilanLongInt *verLocPtr,
|
|
||||||
MilanLongInt k,
|
|
||||||
MilanLongInt *verLocInd,
|
|
||||||
MilanInt numProcs,
|
|
||||||
MilanInt myRank,
|
|
||||||
MPI_Comm comm,
|
|
||||||
vector<MilanLongInt> &Message,
|
|
||||||
MilanLongInt numGhostEdges,
|
|
||||||
MilanLongInt u,
|
|
||||||
MilanLongInt v,
|
|
||||||
MilanLongInt *SPtr,
|
|
||||||
vector<MilanLongInt> &U);
|
|
||||||
|
|
||||||
void extractUChunk(
|
|
||||||
vector<MilanLongInt> &UChunkBeingProcessed,
|
|
||||||
vector<MilanLongInt> &U,
|
|
||||||
vector<MilanLongInt> &privateU);
|
|
||||||
|
|
||||||
MilanLongInt firstComputeCandidateMateS(MilanLongInt adj1,
|
bool isAlreadyMatched(MilanLongInt node,
|
||||||
MilanLongInt adj2,
|
MilanLongInt StartIndex,
|
||||||
MilanLongInt *verLocInd,
|
MilanLongInt EndIndex,
|
||||||
MilanFloat *edgeLocWeight);
|
vector<MilanLongInt> &GMate,
|
||||||
|
MilanLongInt *Mate,
|
||||||
|
map<MilanLongInt, MilanLongInt> &Ghost2LocalMap);
|
||||||
|
|
||||||
MilanLongInt computeCandidateMateS(MilanLongInt adj1,
|
MilanLongInt computeCandidateMate(MilanLongInt adj1,
|
||||||
MilanLongInt adj2,
|
MilanLongInt adj2,
|
||||||
MilanFloat *edgeLocWeight,
|
MilanReal *edgeLocWeight,
|
||||||
MilanLongInt k,
|
MilanLongInt k,
|
||||||
MilanLongInt *verLocInd,
|
MilanLongInt *verLocInd,
|
||||||
MilanLongInt StartIndex,
|
MilanLongInt StartIndex,
|
||||||
MilanLongInt EndIndex,
|
MilanLongInt EndIndex,
|
||||||
vector<MilanLongInt> &GMate,
|
vector<MilanLongInt> &GMate,
|
||||||
MilanLongInt *Mate,
|
MilanLongInt *Mate,
|
||||||
map<MilanLongInt, MilanLongInt> &Ghost2LocalMap);
|
map<MilanLongInt, MilanLongInt> &Ghost2LocalMap);
|
||||||
|
|
||||||
void PARALLEL_COMPUTE_CANDIDATE_MATE_BS(MilanLongInt NLVer,
|
|
||||||
MilanLongInt *verLocPtr,
|
|
||||||
MilanLongInt *verLocInd,
|
|
||||||
MilanInt myRank,
|
|
||||||
MilanFloat *edgeLocWeight,
|
|
||||||
MilanLongInt *candidateMate);
|
|
||||||
|
|
||||||
void PARALLEL_PROCESS_EXPOSED_VERTEX_BS(MilanLongInt NLVer,
|
|
||||||
MilanLongInt *candidateMate,
|
|
||||||
MilanLongInt *verLocInd,
|
|
||||||
MilanLongInt *verLocPtr,
|
|
||||||
MilanLongInt StartIndex,
|
|
||||||
MilanLongInt EndIndex,
|
|
||||||
MilanLongInt *Mate,
|
|
||||||
vector<MilanLongInt> &GMate,
|
|
||||||
map<MilanLongInt, MilanLongInt> &Ghost2LocalMap,
|
|
||||||
MilanFloat *edgeLocWeight,
|
|
||||||
MilanLongInt *myCardPtr,
|
|
||||||
MilanLongInt *msgIndPtr,
|
|
||||||
MilanLongInt *NumMessagesBundledPtr,
|
|
||||||
MilanLongInt *SPtr,
|
|
||||||
MilanLongInt *verDistance,
|
|
||||||
MilanLongInt *PCounter,
|
|
||||||
vector<MilanLongInt> &Counter,
|
|
||||||
MilanInt myRank,
|
|
||||||
MilanInt numProcs,
|
|
||||||
vector<MilanLongInt> &U,
|
|
||||||
vector<MilanLongInt> &privateU,
|
|
||||||
vector<MilanLongInt> &QLocalVtx,
|
|
||||||
vector<MilanLongInt> &QGhostVtx,
|
|
||||||
vector<MilanLongInt> &QMsgType,
|
|
||||||
vector<MilanInt> &QOwner,
|
|
||||||
vector<MilanLongInt> &privateQLocalVtx,
|
|
||||||
vector<MilanLongInt> &privateQGhostVtx,
|
|
||||||
vector<MilanLongInt> &privateQMsgType,
|
|
||||||
vector<MilanInt> &privateQOwner);
|
|
||||||
void processMatchedVerticesS(
|
|
||||||
MilanLongInt NLVer,
|
|
||||||
vector<MilanLongInt> &UChunkBeingProcessed,
|
|
||||||
vector<MilanLongInt> &U,
|
|
||||||
vector<MilanLongInt> &privateU,
|
|
||||||
MilanLongInt StartIndex,
|
|
||||||
MilanLongInt EndIndex,
|
|
||||||
MilanLongInt *myCardPtr,
|
|
||||||
MilanLongInt *msgIndPtr,
|
|
||||||
MilanLongInt *NumMessagesBundledPtr,
|
|
||||||
MilanLongInt *SPtr,
|
|
||||||
MilanLongInt *verLocPtr,
|
|
||||||
MilanLongInt *verLocInd,
|
|
||||||
MilanLongInt *verDistance,
|
|
||||||
MilanLongInt *PCounter,
|
|
||||||
vector<MilanLongInt> &Counter,
|
|
||||||
MilanInt myRank,
|
|
||||||
MilanInt numProcs,
|
|
||||||
MilanLongInt *candidateMate,
|
|
||||||
vector<MilanLongInt> &GMate,
|
|
||||||
MilanLongInt *Mate,
|
|
||||||
map<MilanLongInt, MilanLongInt> &Ghost2LocalMap,
|
|
||||||
MilanFloat *edgeLocWeight,
|
|
||||||
vector<MilanLongInt> &QLocalVtx,
|
|
||||||
vector<MilanLongInt> &QGhostVtx,
|
|
||||||
vector<MilanLongInt> &QMsgType,
|
|
||||||
vector<MilanInt> &QOwner,
|
|
||||||
vector<MilanLongInt> &privateQLocalVtx,
|
|
||||||
vector<MilanLongInt> &privateQGhostVtx,
|
|
||||||
vector<MilanLongInt> &privateQMsgType,
|
|
||||||
vector<MilanInt> &privateQOwner);
|
|
||||||
|
|
||||||
void processMatchedVerticesAndSendMessagesS(
|
|
||||||
MilanLongInt NLVer,
|
|
||||||
vector<MilanLongInt> &UChunkBeingProcessed,
|
|
||||||
vector<MilanLongInt> &U,
|
|
||||||
vector<MilanLongInt> &privateU,
|
|
||||||
MilanLongInt StartIndex,
|
|
||||||
MilanLongInt EndIndex,
|
|
||||||
MilanLongInt *myCardPtr,
|
|
||||||
MilanLongInt *msgIndPtr,
|
|
||||||
MilanLongInt *NumMessagesBundledPtr,
|
|
||||||
MilanLongInt *SPtr,
|
|
||||||
MilanLongInt *verLocPtr,
|
|
||||||
MilanLongInt *verLocInd,
|
|
||||||
MilanLongInt *verDistance,
|
|
||||||
MilanLongInt *PCounter,
|
|
||||||
vector<MilanLongInt> &Counter,
|
|
||||||
MilanInt myRank,
|
|
||||||
MilanInt numProcs,
|
|
||||||
MilanLongInt *candidateMate,
|
|
||||||
vector<MilanLongInt> &GMate,
|
|
||||||
MilanLongInt *Mate,
|
|
||||||
map<MilanLongInt, MilanLongInt> &Ghost2LocalMap,
|
|
||||||
MilanFloat *edgeLocWeight,
|
|
||||||
vector<MilanLongInt> &QLocalVtx,
|
|
||||||
vector<MilanLongInt> &QGhostVtx,
|
|
||||||
vector<MilanLongInt> &QMsgType,
|
|
||||||
vector<MilanInt> &QOwner,
|
|
||||||
vector<MilanLongInt> &privateQLocalVtx,
|
|
||||||
vector<MilanLongInt> &privateQGhostVtx,
|
|
||||||
vector<MilanLongInt> &privateQMsgType,
|
|
||||||
vector<MilanInt> &privateQOwner,
|
|
||||||
MPI_Comm comm,
|
|
||||||
MilanLongInt *msgActual,
|
|
||||||
vector<MilanLongInt> &Message);
|
|
||||||
|
|
||||||
void processMessagesS(
|
|
||||||
MilanLongInt NLVer,
|
|
||||||
MilanLongInt *Mate,
|
|
||||||
MilanLongInt *candidateMate,
|
|
||||||
map<MilanLongInt, MilanLongInt> &Ghost2LocalMap,
|
|
||||||
vector<MilanLongInt> &GMate,
|
|
||||||
vector<MilanLongInt> &Counter,
|
|
||||||
MilanLongInt StartIndex,
|
|
||||||
MilanLongInt EndIndex,
|
|
||||||
MilanLongInt *myCardPtr,
|
|
||||||
MilanLongInt *msgIndPtr,
|
|
||||||
MilanLongInt *msgActualPtr,
|
|
||||||
MilanFloat *edgeLocWeight,
|
|
||||||
MilanLongInt *verDistance,
|
|
||||||
MilanLongInt *verLocPtr,
|
|
||||||
MilanLongInt k,
|
|
||||||
MilanLongInt *verLocInd,
|
|
||||||
MilanInt numProcs,
|
|
||||||
MilanInt myRank,
|
|
||||||
MPI_Comm comm,
|
|
||||||
vector<MilanLongInt> &Message,
|
|
||||||
MilanLongInt numGhostEdges,
|
|
||||||
MilanLongInt u,
|
|
||||||
MilanLongInt v,
|
|
||||||
MilanLongInt *SPtr,
|
|
||||||
vector<MilanLongInt> &U);
|
|
||||||
|
|
||||||
|
|
||||||
void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
|
|
||||||
MilanLongInt NLVer, MilanLongInt NLEdge,
|
|
||||||
MilanLongInt *verLocPtr, MilanLongInt *verLocInd, MilanReal *edgeLocWeight,
|
|
||||||
MilanLongInt *verDistance,
|
|
||||||
MilanLongInt *Mate,
|
|
||||||
MilanInt myRank, MilanInt numProcs, MPI_Comm comm,
|
|
||||||
MilanLongInt *msgIndSent, MilanLongInt *msgActualSent, MilanReal *msgPercent,
|
|
||||||
MilanReal *ph0_time, MilanReal *ph1_time, MilanReal *ph2_time,
|
|
||||||
MilanLongInt *ph1_card, MilanLongInt *ph2_card);
|
|
||||||
|
|
||||||
|
void initialize(MilanLongInt NLVer, MilanLongInt NLEdge,
|
||||||
void salgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
|
MilanLongInt StartIndex, MilanLongInt EndIndex,
|
||||||
MilanLongInt NLVer, MilanLongInt NLEdge,
|
MilanLongInt *numGhostEdgesPtr,
|
||||||
MilanLongInt *verLocPtr, MilanLongInt *verLocInd, MilanFloat *edgeLocWeight,
|
MilanLongInt *numGhostVerticesPtr,
|
||||||
MilanLongInt *verDistance,
|
MilanLongInt *S,
|
||||||
MilanLongInt *Mate,
|
MilanLongInt *verLocInd,
|
||||||
MilanInt myRank, MilanInt numProcs, MPI_Comm comm,
|
MilanLongInt *verLocPtr,
|
||||||
MilanLongInt *msgIndSent, MilanLongInt *msgActualSent, MilanReal *msgPercent,
|
map<MilanLongInt, MilanLongInt> &Ghost2LocalMap,
|
||||||
MilanReal *ph0_time, MilanReal *ph1_time, MilanReal *ph2_time,
|
vector<MilanLongInt> &Counter,
|
||||||
MilanLongInt *ph1_card, MilanLongInt *ph2_card);
|
vector<MilanLongInt> &verGhostPtr,
|
||||||
|
vector<MilanLongInt> &verGhostInd,
|
||||||
|
vector<MilanLongInt> &tempCounter,
|
||||||
|
vector<MilanLongInt> &GMate,
|
||||||
|
vector<MilanLongInt> &Message,
|
||||||
|
vector<MilanLongInt> &QLocalVtx,
|
||||||
|
vector<MilanLongInt> &QGhostVtx,
|
||||||
|
vector<MilanLongInt> &QMsgType,
|
||||||
|
vector<MilanInt> &QOwner,
|
||||||
|
MilanLongInt *&candidateMate,
|
||||||
|
vector<MilanLongInt> &U,
|
||||||
|
vector<MilanLongInt> &privateU,
|
||||||
|
vector<MilanLongInt> &privateQLocalVtx,
|
||||||
|
vector<MilanLongInt> &privateQGhostVtx,
|
||||||
|
vector<MilanLongInt> &privateQMsgType,
|
||||||
|
vector<MilanInt> &privateQOwner);
|
||||||
|
|
||||||
|
void clean(MilanLongInt NLVer,
|
||||||
|
MilanInt myRank,
|
||||||
|
MilanLongInt MessageIndex,
|
||||||
|
vector<MPI_Request> &SRequest,
|
||||||
|
vector<MPI_Status> &SStatus,
|
||||||
|
MilanInt BufferSize,
|
||||||
|
MilanLongInt *Buffer,
|
||||||
|
MilanLongInt msgActual,
|
||||||
|
MilanLongInt *msgActualSent,
|
||||||
|
MilanLongInt msgInd,
|
||||||
|
MilanLongInt *msgIndSent,
|
||||||
|
MilanLongInt NumMessagesBundled,
|
||||||
|
MilanReal *msgPercent);
|
||||||
|
|
||||||
|
void PARALLEL_COMPUTE_CANDIDATE_MATE_B(MilanLongInt NLVer,
|
||||||
|
MilanLongInt *verLocPtr,
|
||||||
|
MilanLongInt *verLocInd,
|
||||||
|
MilanInt myRank,
|
||||||
|
MilanReal *edgeLocWeight,
|
||||||
|
MilanLongInt *candidateMate);
|
||||||
|
|
||||||
|
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,
|
||||||
|
vector<MilanLongInt> &U,
|
||||||
|
vector<MilanLongInt> &privateU,
|
||||||
|
vector<MilanLongInt> &QLocalVtx,
|
||||||
|
vector<MilanLongInt> &QGhostVtx,
|
||||||
|
vector<MilanLongInt> &QMsgType,
|
||||||
|
vector<MilanInt> &QOwner,
|
||||||
|
vector<MilanLongInt> &privateQLocalVtx,
|
||||||
|
vector<MilanLongInt> &privateQGhostVtx,
|
||||||
|
vector<MilanLongInt> &privateQMsgType,
|
||||||
|
vector<MilanInt> &privateQOwner);
|
||||||
|
|
||||||
|
void PROCESS_CROSS_EDGE(MilanLongInt *edge,
|
||||||
|
MilanLongInt *SPtr);
|
||||||
|
|
||||||
|
void processMatchedVertices(
|
||||||
|
MilanLongInt NLVer,
|
||||||
|
vector<MilanLongInt> &UChunkBeingProcessed,
|
||||||
|
vector<MilanLongInt> &U,
|
||||||
|
vector<MilanLongInt> &privateU,
|
||||||
|
MilanLongInt StartIndex,
|
||||||
|
MilanLongInt EndIndex,
|
||||||
|
MilanLongInt *myCardPtr,
|
||||||
|
MilanLongInt *msgIndPtr,
|
||||||
|
MilanLongInt *NumMessagesBundledPtr,
|
||||||
|
MilanLongInt *SPtr,
|
||||||
|
MilanLongInt *verLocPtr,
|
||||||
|
MilanLongInt *verLocInd,
|
||||||
|
MilanLongInt *verDistance,
|
||||||
|
MilanLongInt *PCounter,
|
||||||
|
vector<MilanLongInt> &Counter,
|
||||||
|
MilanInt myRank,
|
||||||
|
MilanInt numProcs,
|
||||||
|
MilanLongInt *candidateMate,
|
||||||
|
vector<MilanLongInt> &GMate,
|
||||||
|
MilanLongInt *Mate,
|
||||||
|
map<MilanLongInt, MilanLongInt> &Ghost2LocalMap,
|
||||||
|
MilanReal *edgeLocWeight,
|
||||||
|
vector<MilanLongInt> &QLocalVtx,
|
||||||
|
vector<MilanLongInt> &QGhostVtx,
|
||||||
|
vector<MilanLongInt> &QMsgType,
|
||||||
|
vector<MilanInt> &QOwner,
|
||||||
|
vector<MilanLongInt> &privateQLocalVtx,
|
||||||
|
vector<MilanLongInt> &privateQGhostVtx,
|
||||||
|
vector<MilanLongInt> &privateQMsgType,
|
||||||
|
vector<MilanInt> &privateQOwner);
|
||||||
|
|
||||||
|
void processMatchedVerticesAndSendMessages(
|
||||||
|
MilanLongInt NLVer,
|
||||||
|
vector<MilanLongInt> &UChunkBeingProcessed,
|
||||||
|
vector<MilanLongInt> &U,
|
||||||
|
vector<MilanLongInt> &privateU,
|
||||||
|
MilanLongInt StartIndex,
|
||||||
|
MilanLongInt EndIndex,
|
||||||
|
MilanLongInt *myCardPtr,
|
||||||
|
MilanLongInt *msgIndPtr,
|
||||||
|
MilanLongInt *NumMessagesBundledPtr,
|
||||||
|
MilanLongInt *SPtr,
|
||||||
|
MilanLongInt *verLocPtr,
|
||||||
|
MilanLongInt *verLocInd,
|
||||||
|
MilanLongInt *verDistance,
|
||||||
|
MilanLongInt *PCounter,
|
||||||
|
vector<MilanLongInt> &Counter,
|
||||||
|
MilanInt myRank,
|
||||||
|
MilanInt numProcs,
|
||||||
|
MilanLongInt *candidateMate,
|
||||||
|
vector<MilanLongInt> &GMate,
|
||||||
|
MilanLongInt *Mate,
|
||||||
|
map<MilanLongInt, MilanLongInt> &Ghost2LocalMap,
|
||||||
|
MilanReal *edgeLocWeight,
|
||||||
|
vector<MilanLongInt> &QLocalVtx,
|
||||||
|
vector<MilanLongInt> &QGhostVtx,
|
||||||
|
vector<MilanLongInt> &QMsgType,
|
||||||
|
vector<MilanInt> &QOwner,
|
||||||
|
vector<MilanLongInt> &privateQLocalVtx,
|
||||||
|
vector<MilanLongInt> &privateQGhostVtx,
|
||||||
|
vector<MilanLongInt> &privateQMsgType,
|
||||||
|
vector<MilanInt> &privateQOwner,
|
||||||
|
MPI_Comm comm,
|
||||||
|
MilanLongInt *msgActual,
|
||||||
|
vector<MilanLongInt> &Message);
|
||||||
|
|
||||||
|
void sendBundledMessages(MilanLongInt *numGhostEdgesPtr,
|
||||||
|
MilanInt *BufferSizePtr,
|
||||||
|
MilanLongInt *Buffer,
|
||||||
|
vector<MilanLongInt> &PCumulative,
|
||||||
|
vector<MilanLongInt> &PMessageBundle,
|
||||||
|
vector<MilanLongInt> &PSizeInfoMessages,
|
||||||
|
MilanLongInt *PCounter,
|
||||||
|
MilanLongInt NumMessagesBundled,
|
||||||
|
MilanLongInt *msgActualPtr,
|
||||||
|
MilanLongInt *MessageIndexPtr,
|
||||||
|
MilanInt numProcs,
|
||||||
|
MilanInt myRank,
|
||||||
|
MPI_Comm comm,
|
||||||
|
vector<MilanLongInt> &QLocalVtx,
|
||||||
|
vector<MilanLongInt> &QGhostVtx,
|
||||||
|
vector<MilanLongInt> &QMsgType,
|
||||||
|
vector<MilanInt> &QOwner,
|
||||||
|
vector<MPI_Request> &SRequest,
|
||||||
|
vector<MPI_Status> &SStatus);
|
||||||
|
|
||||||
|
void processMessages(
|
||||||
|
MilanLongInt NLVer,
|
||||||
|
MilanLongInt *Mate,
|
||||||
|
MilanLongInt *candidateMate,
|
||||||
|
map<MilanLongInt, MilanLongInt> &Ghost2LocalMap,
|
||||||
|
vector<MilanLongInt> &GMate,
|
||||||
|
vector<MilanLongInt> &Counter,
|
||||||
|
MilanLongInt StartIndex,
|
||||||
|
MilanLongInt EndIndex,
|
||||||
|
MilanLongInt *myCardPtr,
|
||||||
|
MilanLongInt *msgIndPtr,
|
||||||
|
MilanLongInt *msgActualPtr,
|
||||||
|
MilanReal *edgeLocWeight,
|
||||||
|
MilanLongInt *verDistance,
|
||||||
|
MilanLongInt *verLocPtr,
|
||||||
|
MilanLongInt k,
|
||||||
|
MilanLongInt *verLocInd,
|
||||||
|
MilanInt numProcs,
|
||||||
|
MilanInt myRank,
|
||||||
|
MPI_Comm comm,
|
||||||
|
vector<MilanLongInt> &Message,
|
||||||
|
MilanLongInt numGhostEdges,
|
||||||
|
MilanLongInt u,
|
||||||
|
MilanLongInt v,
|
||||||
|
MilanLongInt *SPtr,
|
||||||
|
vector<MilanLongInt> &U);
|
||||||
|
|
||||||
|
void extractUChunk(
|
||||||
|
vector<MilanLongInt> &UChunkBeingProcessed,
|
||||||
|
vector<MilanLongInt> &U,
|
||||||
|
vector<MilanLongInt> &privateU);
|
||||||
|
|
||||||
|
void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
|
||||||
|
MilanLongInt NLVer, MilanLongInt NLEdge,
|
||||||
|
MilanLongInt *verLocPtr, MilanLongInt *verLocInd, MilanReal *edgeLocWeight,
|
||||||
|
MilanLongInt *verDistance,
|
||||||
|
MilanLongInt *Mate,
|
||||||
|
MilanInt myRank, MilanInt numProcs, MPI_Comm comm,
|
||||||
|
MilanLongInt *msgIndSent, MilanLongInt *msgActualSent, MilanReal *msgPercent,
|
||||||
|
MilanReal *ph0_time, MilanReal *ph1_time, MilanReal *ph2_time,
|
||||||
|
MilanLongInt *ph1_card, MilanLongInt *ph2_card);
|
||||||
|
|
||||||
void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateC(
|
void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateC(
|
||||||
MilanLongInt NLVer, MilanLongInt NLEdge,
|
MilanLongInt NLVer, MilanLongInt NLEdge,
|
||||||
|
|||||||
+10
-10
@@ -1303,16 +1303,16 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateC(
|
|||||||
// SINGLE PRECISION VERSION
|
// SINGLE PRECISION VERSION
|
||||||
|
|
||||||
void salgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateC(
|
void salgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateC(
|
||||||
MilanLongInt NLVer, MilanLongInt NLEdge,
|
MilanLongInt NLVer, MilanLongInt NLEdge,
|
||||||
MilanLongInt* verLocPtr, MilanLongInt* verLocInd,
|
MilanLongInt* verLocPtr, MilanLongInt* verLocInd,
|
||||||
MilanFloat* edgeLocWeight,
|
MilanFloat* edgeLocWeight,
|
||||||
MilanLongInt* verDistance,
|
MilanLongInt* verDistance,
|
||||||
MilanLongInt* Mate,
|
MilanLongInt* Mate,
|
||||||
MilanInt myRank, MilanInt numProcs, MPI_Comm comm,
|
MilanInt myRank, MilanInt numProcs, MPI_Comm comm,
|
||||||
MilanLongInt* msgIndSent, MilanLongInt* msgActualSent,
|
MilanLongInt* msgIndSent, MilanLongInt* msgActualSent,
|
||||||
MilanReal* msgPercent,
|
MilanReal* msgPercent,
|
||||||
MilanReal* ph0_time, MilanReal* ph1_time, MilanReal* ph2_time,
|
MilanReal* ph0_time, MilanReal* ph1_time, MilanReal* ph2_time,
|
||||||
MilanLongInt* ph1_card, MilanLongInt* ph2_card ) {
|
MilanLongInt* ph1_card, MilanLongInt* ph2_card ) {
|
||||||
#if !defined(SERIAL_MPI)
|
#if !defined(SERIAL_MPI)
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
#ifdef PRINT_DEBUG_INFO_
|
||||||
cout<<"\n("<<myRank<<")Within algoEdgeApproxDominatingEdgesLinearSearchMessageBundling()"; fflush(stdout);
|
cout<<"\n("<<myRank<<")Within algoEdgeApproxDominatingEdgesLinearSearchMessageBundling()"; fflush(stdout);
|
||||||
|
|||||||
+18
-507
@@ -1,4 +1,5 @@
|
|||||||
#include "MatchBoxPC.h"
|
#include "MatchBoxPC.h"
|
||||||
|
|
||||||
// ***********************************************************************
|
// ***********************************************************************
|
||||||
//
|
//
|
||||||
// MatchboxP: A C++ library for approximate weighted matching
|
// MatchboxP: A C++ library for approximate weighted matching
|
||||||
@@ -125,10 +126,8 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
|
|||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// The starting vertex owned by the current rank
|
MilanLongInt StartIndex = verDistance[myRank]; // The starting vertex owned by the current rank
|
||||||
MilanLongInt StartIndex = verDistance[myRank];
|
MilanLongInt EndIndex = verDistance[myRank + 1] - 1; // The ending vertex owned by the current rank
|
||||||
// The ending vertex owned by the current rank
|
|
||||||
MilanLongInt EndIndex = verDistance[myRank + 1] - 1;
|
|
||||||
|
|
||||||
MPI_Status computeStatus;
|
MPI_Status computeStatus;
|
||||||
|
|
||||||
@@ -146,8 +145,7 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
|
|||||||
// only one message will be sent in the initialization phase -
|
// only one message will be sent in the initialization phase -
|
||||||
// one of: REQUEST/FAILURE/SUCCESS
|
// one of: REQUEST/FAILURE/SUCCESS
|
||||||
vector<MilanLongInt> QLocalVtx, QGhostVtx, QMsgType;
|
vector<MilanLongInt> QLocalVtx, QGhostVtx, QMsgType;
|
||||||
// Changed by Fabio to be an integer, addresses needs to be integers!
|
vector<MilanInt> QOwner; // Changed by Fabio to be an integer, addresses needs to be integers!
|
||||||
vector<MilanInt> QOwner;
|
|
||||||
|
|
||||||
MilanLongInt *PCounter = new MilanLongInt[numProcs];
|
MilanLongInt *PCounter = new MilanLongInt[numProcs];
|
||||||
for (int i = 0; i < numProcs; i++)
|
for (int i = 0; i < numProcs; i++)
|
||||||
@@ -155,8 +153,7 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
|
|||||||
|
|
||||||
MilanLongInt NumMessagesBundled = 0;
|
MilanLongInt NumMessagesBundled = 0;
|
||||||
// TODO when the last computational section will be refactored this could be eliminated
|
// TODO when the last computational section will be refactored this could be eliminated
|
||||||
// Changed by Fabio to be an integer, addresses needs to be integers!
|
MilanInt ghostOwner = 0; // Changed by Fabio to be an integer, addresses needs to be integers!
|
||||||
MilanInt ghostOwner = 0;
|
|
||||||
MilanLongInt *candidateMate = nullptr;
|
MilanLongInt *candidateMate = nullptr;
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
#ifdef PRINT_DEBUG_INFO_
|
||||||
cout << "\n(" << myRank << ")NV: " << NLVer << " Edges: " << NLEdge;
|
cout << "\n(" << myRank << ")NV: " << NLVer << " Edges: " << NLEdge;
|
||||||
@@ -171,12 +168,9 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
|
|||||||
MilanLongInt myCard = 0;
|
MilanLongInt myCard = 0;
|
||||||
|
|
||||||
// Build the Ghost Vertex Set: Vg
|
// Build the Ghost Vertex Set: Vg
|
||||||
// Map each ghost vertex to a local vertex
|
map<MilanLongInt, MilanLongInt> Ghost2LocalMap; // Map each ghost vertex to a local vertex
|
||||||
map<MilanLongInt, MilanLongInt> Ghost2LocalMap;
|
vector<MilanLongInt> Counter; // Store the edge count for each ghost vertex
|
||||||
// Store the edge count for each ghost vertex
|
MilanLongInt numGhostVertices = 0, numGhostEdges = 0; // Number of Ghost vertices
|
||||||
vector<MilanLongInt> Counter;
|
|
||||||
// Number of Ghost vertices
|
|
||||||
MilanLongInt numGhostVertices = 0, numGhostEdges = 0;
|
|
||||||
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
#ifdef PRINT_DEBUG_INFO_
|
||||||
cout << "\n(" << myRank << ")About to compute Ghost Vertices...";
|
cout << "\n(" << myRank << ")About to compute Ghost Vertices...";
|
||||||
@@ -228,7 +222,7 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
|
|||||||
cout << myRank << " Finished initialization" << endl;
|
cout << myRank << " Finished initialization" << endl;
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
startTime = MPI_Wtime();
|
startTime = MPI_Wtime();
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -243,7 +237,7 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
|
|||||||
* PARALLEL_COMPUTE_CANDIDATE_MATE_B is now totally parallel.
|
* PARALLEL_COMPUTE_CANDIDATE_MATE_B is now totally parallel.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PARALLEL_COMPUTE_CANDIDATE_MATE_BD(NLVer,
|
PARALLEL_COMPUTE_CANDIDATE_MATE_B(NLVer,
|
||||||
verLocPtr,
|
verLocPtr,
|
||||||
verLocInd,
|
verLocInd,
|
||||||
myRank,
|
myRank,
|
||||||
@@ -268,7 +262,7 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
|
|||||||
* TODO: Test when it's actually more efficient to execute this code
|
* TODO: Test when it's actually more efficient to execute this code
|
||||||
* in parallel.
|
* in parallel.
|
||||||
*/
|
*/
|
||||||
PARALLEL_PROCESS_EXPOSED_VERTEX_BD(NLVer,
|
PARALLEL_PROCESS_EXPOSED_VERTEX_B(NLVer,
|
||||||
candidateMate,
|
candidateMate,
|
||||||
verLocInd,
|
verLocInd,
|
||||||
verLocPtr,
|
verLocPtr,
|
||||||
@@ -320,7 +314,7 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
|
|||||||
vector<MilanLongInt> UChunkBeingProcessed;
|
vector<MilanLongInt> UChunkBeingProcessed;
|
||||||
UChunkBeingProcessed.reserve(UCHUNK);
|
UChunkBeingProcessed.reserve(UCHUNK);
|
||||||
|
|
||||||
processMatchedVerticesD(NLVer,
|
processMatchedVertices(NLVer,
|
||||||
UChunkBeingProcessed,
|
UChunkBeingProcessed,
|
||||||
U,
|
U,
|
||||||
privateU,
|
privateU,
|
||||||
@@ -397,7 +391,7 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
|
|||||||
cout << myRank << " Finished sendBundles" << endl;
|
cout << myRank << " Finished sendBundles" << endl;
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
*ph1_card = myCard; // Cardinality at the end of Phase-1
|
*ph1_card = myCard; // Cardinality at the end of Phase-1
|
||||||
startTime = MPI_Wtime();
|
startTime = MPI_Wtime();
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -428,8 +422,8 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
|
|||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
/////////////////////////// PROCESS MATCHED VERTICES //////////////////////////////
|
/////////////////////////// PROCESS MATCHED VERTICES //////////////////////////////
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
processMatchedVerticesAndSendMessagesD(NLVer,
|
processMatchedVerticesAndSendMessages(NLVer,
|
||||||
UChunkBeingProcessed,
|
UChunkBeingProcessed,
|
||||||
U,
|
U,
|
||||||
privateU,
|
privateU,
|
||||||
@@ -462,7 +456,7 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
|
|||||||
comm,
|
comm,
|
||||||
&msgActual,
|
&msgActual,
|
||||||
Message);
|
Message);
|
||||||
|
|
||||||
///////////////////////// END OF PROCESS MATCHED VERTICES /////////////////////////
|
///////////////////////// END OF PROCESS MATCHED VERTICES /////////////////////////
|
||||||
|
|
||||||
//// BREAK IF NO MESSAGES EXPECTED /////////
|
//// BREAK IF NO MESSAGES EXPECTED /////////
|
||||||
@@ -489,8 +483,8 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
|
|||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
/////////////////////////// PROCESS MESSAGES //////////////////////////////////////
|
/////////////////////////// PROCESS MESSAGES //////////////////////////////////////
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
//startTime = MPI_Wtime();
|
|
||||||
processMessagesD(NLVer,
|
processMessages(NLVer,
|
||||||
Mate,
|
Mate,
|
||||||
candidateMate,
|
candidateMate,
|
||||||
Ghost2LocalMap,
|
Ghost2LocalMap,
|
||||||
@@ -555,489 +549,6 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
|
|||||||
*ph2_card = myCard; // Cardinality at the end of Phase-2
|
*ph2_card = myCard; // Cardinality at the end of Phase-2
|
||||||
}
|
}
|
||||||
// End of algoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMate
|
// End of algoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMate
|
||||||
|
|
||||||
void salgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
|
|
||||||
MilanLongInt NLVer, MilanLongInt NLEdge,
|
|
||||||
MilanLongInt *verLocPtr, MilanLongInt *verLocInd,
|
|
||||||
MilanFloat *edgeLocWeight,
|
|
||||||
MilanLongInt *verDistance,
|
|
||||||
MilanLongInt *Mate,
|
|
||||||
MilanInt myRank, MilanInt numProcs, MPI_Comm comm,
|
|
||||||
MilanLongInt *msgIndSent, MilanLongInt *msgActualSent,
|
|
||||||
MilanReal *msgPercent,
|
|
||||||
MilanReal *ph0_time, MilanReal *ph1_time, MilanReal *ph2_time,
|
|
||||||
MilanLongInt *ph1_card, MilanLongInt *ph2_card)
|
|
||||||
{
|
|
||||||
|
|
||||||
/*
|
|
||||||
* verDistance: it's a vector long as the number of processors.
|
|
||||||
* verDistance[i] contains the first node index of the i-th processor
|
|
||||||
* verDistance[i + 1] contains the last node index of the i-th processor
|
|
||||||
* NLVer: number of elements in the LocPtr
|
|
||||||
* NLEdge: number of edges assigned to the current processor
|
|
||||||
*
|
|
||||||
* Contains the portion of matrix assigned to the processor in
|
|
||||||
* Yale notation
|
|
||||||
* verLocInd: contains the positions on row of the matrix
|
|
||||||
* verLocPtr: i-th value is the position of the first element on the i-th row and
|
|
||||||
* i+1-th value is the position of the first element on the i+1-th row
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if !defined(SERIAL_MPI)
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << ")Within algoEdgeApproxDominatingEdgesLinearSearchMessageBundling()";
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << ") verDistance [" ;
|
|
||||||
for (int i = 0; i < numProcs; i++)
|
|
||||||
cout << verDistance[i] << "," << verDistance[i+1];
|
|
||||||
cout << "]\n";
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
#ifdef DEBUG_HANG_
|
|
||||||
if (myRank == 0) {
|
|
||||||
cout << "\n(" << myRank << ") verDistance [" ;
|
|
||||||
for (int i = 0; i < numProcs; i++)
|
|
||||||
cout << verDistance[i] << "," ;
|
|
||||||
cout << verDistance[numProcs]<< "]\n";
|
|
||||||
}
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// The starting vertex owned by the current rank
|
|
||||||
MilanLongInt StartIndex = verDistance[myRank];
|
|
||||||
// The ending vertex owned by the current rank
|
|
||||||
MilanLongInt EndIndex = verDistance[myRank + 1] - 1;
|
|
||||||
|
|
||||||
MPI_Status computeStatus;
|
|
||||||
|
|
||||||
MilanLongInt msgActual = 0, msgInd = 0;
|
|
||||||
MilanFloat heaviestEdgeWt = 0.0f; // Assumes positive weight
|
|
||||||
MilanReal startTime, finishTime;
|
|
||||||
|
|
||||||
startTime = MPI_Wtime();
|
|
||||||
|
|
||||||
// Data structures for sending and receiving messages:
|
|
||||||
vector<MilanLongInt> Message; // [ u, v, message_type ]
|
|
||||||
Message.resize(3, -1);
|
|
||||||
// Data structures for Message Bundling:
|
|
||||||
// Although up to two messages can be sent along any cross edge,
|
|
||||||
// only one message will be sent in the initialization phase -
|
|
||||||
// one of: REQUEST/FAILURE/SUCCESS
|
|
||||||
vector<MilanLongInt> QLocalVtx, QGhostVtx, QMsgType;
|
|
||||||
// Changed by Fabio to be an integer, addresses needs to be integers!
|
|
||||||
vector<MilanInt> QOwner;
|
|
||||||
|
|
||||||
MilanLongInt *PCounter = new MilanLongInt[numProcs];
|
|
||||||
for (int i = 0; i < numProcs; i++)
|
|
||||||
PCounter[i] = 0;
|
|
||||||
|
|
||||||
MilanLongInt NumMessagesBundled = 0;
|
|
||||||
// TODO when the last computational section will be refactored this could be eliminated
|
|
||||||
// Changed by Fabio to be an integer, addresses needs to be integers!
|
|
||||||
MilanInt ghostOwner = 0;
|
|
||||||
MilanLongInt *candidateMate = nullptr;
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << ")NV: " << NLVer << " Edges: " << NLEdge;
|
|
||||||
fflush(stdout);
|
|
||||||
cout << "\n(" << myRank << ")StartIndex: " << StartIndex << " EndIndex: " << EndIndex;
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
// Other Variables:
|
|
||||||
MilanLongInt u = -1, v = -1, w = -1, i = 0;
|
|
||||||
MilanLongInt k = -1, adj1 = -1, adj2 = -1;
|
|
||||||
MilanLongInt k1 = -1, adj11 = -1, adj12 = -1;
|
|
||||||
MilanLongInt myCard = 0;
|
|
||||||
|
|
||||||
// Build the Ghost Vertex Set: Vg
|
|
||||||
// Map each ghost vertex to a local vertex
|
|
||||||
map<MilanLongInt, MilanLongInt> Ghost2LocalMap;
|
|
||||||
// Store the edge count for each ghost vertex
|
|
||||||
vector<MilanLongInt> Counter;
|
|
||||||
// Number of Ghost vertices
|
|
||||||
MilanLongInt numGhostVertices = 0, numGhostEdges = 0;
|
|
||||||
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << ")About to compute Ghost Vertices...";
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
#ifdef DEBUG_HANG_
|
|
||||||
if (myRank == 0)
|
|
||||||
cout << "\n(" << myRank << ")About to compute Ghost Vertices...";
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// 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
|
|
||||||
MilanLongInt S;
|
|
||||||
MilanLongInt privateMyCard = 0;
|
|
||||||
vector<MilanLongInt> PCumulative, PMessageBundle, PSizeInfoMessages;
|
|
||||||
vector<MPI_Request> SRequest; // Requests that are used for each send message
|
|
||||||
vector<MPI_Status> SStatus; // Status of sent messages, used in MPI_Wait
|
|
||||||
MilanLongInt MessageIndex = 0; // Pointer for current message
|
|
||||||
MilanInt BufferSize;
|
|
||||||
MilanLongInt *Buffer;
|
|
||||||
|
|
||||||
vector<MilanLongInt> privateQLocalVtx, privateQGhostVtx, privateQMsgType;
|
|
||||||
vector<MilanInt> privateQOwner;
|
|
||||||
vector<MilanLongInt> U, privateU;
|
|
||||||
|
|
||||||
|
|
||||||
initialize(NLVer, NLEdge, StartIndex,
|
|
||||||
EndIndex, &numGhostEdges,
|
|
||||||
&numGhostVertices, &S,
|
|
||||||
verLocInd, verLocPtr,
|
|
||||||
Ghost2LocalMap, Counter,
|
|
||||||
verGhostPtr, verGhostInd,
|
|
||||||
tempCounter, GMate,
|
|
||||||
Message, QLocalVtx,
|
|
||||||
QGhostVtx, QMsgType, QOwner,
|
|
||||||
candidateMate, U,
|
|
||||||
privateU,
|
|
||||||
privateQLocalVtx,
|
|
||||||
privateQGhostVtx,
|
|
||||||
privateQMsgType,
|
|
||||||
privateQOwner);
|
|
||||||
|
|
||||||
finishTime = MPI_Wtime();
|
|
||||||
*ph0_time = finishTime - startTime; // Time taken for Phase-0: Initialization
|
|
||||||
#ifdef DEBUG_HANG_
|
|
||||||
cout << myRank << " Finished initialization" << endl;
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
startTime = MPI_Wtime();
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
//////////////////////////////////// INITIALIZATION /////////////////////////////////////
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Compute the Initial Matching Set:
|
|
||||||
|
|
||||||
/*
|
|
||||||
* OMP PARALLEL_COMPUTE_CANDIDATE_MATE_B has been splitted from
|
|
||||||
* PARALLEL_PROCESS_EXPOSED_VERTEX_B in order to better parallelize
|
|
||||||
* the two.
|
|
||||||
* PARALLEL_COMPUTE_CANDIDATE_MATE_B is now totally parallel.
|
|
||||||
*/
|
|
||||||
|
|
||||||
PARALLEL_COMPUTE_CANDIDATE_MATE_BS(NLVer,
|
|
||||||
verLocPtr,
|
|
||||||
verLocInd,
|
|
||||||
myRank,
|
|
||||||
edgeLocWeight,
|
|
||||||
candidateMate);
|
|
||||||
|
|
||||||
#ifdef DEBUG_HANG_
|
|
||||||
cout << myRank << " Finished Exposed Vertex" << endl;
|
|
||||||
fflush(stdout);
|
|
||||||
#if 0
|
|
||||||
cout << myRank << " candidateMate after parallelCompute " <<endl;
|
|
||||||
for (int i=0; i<NLVer; i++) {
|
|
||||||
cout << candidateMate[i] << " " ;
|
|
||||||
}
|
|
||||||
cout << endl;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
/*
|
|
||||||
* PARALLEL_PROCESS_EXPOSED_VERTEX_B
|
|
||||||
* TODO: write comment
|
|
||||||
*
|
|
||||||
* TODO: Test when it's actually more efficient to execute this code
|
|
||||||
* in parallel.
|
|
||||||
*/
|
|
||||||
PARALLEL_PROCESS_EXPOSED_VERTEX_BS(NLVer,
|
|
||||||
candidateMate,
|
|
||||||
verLocInd,
|
|
||||||
verLocPtr,
|
|
||||||
StartIndex,
|
|
||||||
EndIndex,
|
|
||||||
Mate,
|
|
||||||
GMate,
|
|
||||||
Ghost2LocalMap,
|
|
||||||
edgeLocWeight,
|
|
||||||
&myCard,
|
|
||||||
&msgInd,
|
|
||||||
&NumMessagesBundled,
|
|
||||||
&S,
|
|
||||||
verDistance,
|
|
||||||
PCounter,
|
|
||||||
Counter,
|
|
||||||
myRank,
|
|
||||||
numProcs,
|
|
||||||
U,
|
|
||||||
privateU,
|
|
||||||
QLocalVtx,
|
|
||||||
QGhostVtx,
|
|
||||||
QMsgType,
|
|
||||||
QOwner,
|
|
||||||
privateQLocalVtx,
|
|
||||||
privateQGhostVtx,
|
|
||||||
privateQMsgType,
|
|
||||||
privateQOwner);
|
|
||||||
|
|
||||||
tempCounter.clear(); // Do not need this any more
|
|
||||||
|
|
||||||
#ifdef DEBUG_HANG_
|
|
||||||
cout << myRank << " Finished Exposed Vertex" << endl;
|
|
||||||
fflush(stdout);
|
|
||||||
#if 0
|
|
||||||
cout << myRank << " Mate after Exposed Vertices " <<endl;
|
|
||||||
for (int i=0; i<NLVer; i++) {
|
|
||||||
cout << Mate[i] << " " ;
|
|
||||||
}
|
|
||||||
cout << endl;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/////////////////////////// PROCESS MATCHED VERTICES //////////////////////////////
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
// TODO what would be the optimal UCHUNK
|
|
||||||
vector<MilanLongInt> UChunkBeingProcessed;
|
|
||||||
UChunkBeingProcessed.reserve(UCHUNK);
|
|
||||||
|
|
||||||
processMatchedVerticesS(NLVer,
|
|
||||||
UChunkBeingProcessed,
|
|
||||||
U,
|
|
||||||
privateU,
|
|
||||||
StartIndex,
|
|
||||||
EndIndex,
|
|
||||||
&myCard,
|
|
||||||
&msgInd,
|
|
||||||
&NumMessagesBundled,
|
|
||||||
&S,
|
|
||||||
verLocPtr,
|
|
||||||
verLocInd,
|
|
||||||
verDistance,
|
|
||||||
PCounter,
|
|
||||||
Counter,
|
|
||||||
myRank,
|
|
||||||
numProcs,
|
|
||||||
candidateMate,
|
|
||||||
GMate,
|
|
||||||
Mate,
|
|
||||||
Ghost2LocalMap,
|
|
||||||
edgeLocWeight,
|
|
||||||
QLocalVtx,
|
|
||||||
QGhostVtx,
|
|
||||||
QMsgType,
|
|
||||||
QOwner,
|
|
||||||
privateQLocalVtx,
|
|
||||||
privateQGhostVtx,
|
|
||||||
privateQMsgType,
|
|
||||||
privateQOwner);
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef DEBUG_HANG_
|
|
||||||
cout << myRank << " Finished Process Vertices" << endl;
|
|
||||||
fflush(stdout);
|
|
||||||
#if 0
|
|
||||||
cout << myRank << " Mate after Matched Vertices " <<endl;
|
|
||||||
for (int i=0; i<NLVer; i++) {
|
|
||||||
cout << Mate[i] << " " ;
|
|
||||||
}
|
|
||||||
cout << endl;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
///////////////////////////// SEND BUNDLED MESSAGES /////////////////////////////////////
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
sendBundledMessages(&numGhostEdges,
|
|
||||||
&BufferSize,
|
|
||||||
Buffer,
|
|
||||||
PCumulative,
|
|
||||||
PMessageBundle,
|
|
||||||
PSizeInfoMessages,
|
|
||||||
PCounter,
|
|
||||||
NumMessagesBundled,
|
|
||||||
&msgActual,
|
|
||||||
&MessageIndex,
|
|
||||||
numProcs,
|
|
||||||
myRank,
|
|
||||||
comm,
|
|
||||||
QLocalVtx,
|
|
||||||
QGhostVtx,
|
|
||||||
QMsgType,
|
|
||||||
QOwner,
|
|
||||||
SRequest,
|
|
||||||
SStatus);
|
|
||||||
|
|
||||||
///////////////////////// END OF SEND BUNDLED MESSAGES //////////////////////////////////
|
|
||||||
|
|
||||||
finishTime = MPI_Wtime();
|
|
||||||
*ph1_time = finishTime - startTime; // Time taken for Phase-1
|
|
||||||
|
|
||||||
#ifdef DEBUG_HANG_
|
|
||||||
cout << myRank << " Finished sendBundles" << endl;
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
*ph1_card = myCard; // Cardinality at the end of Phase-1
|
|
||||||
startTime = MPI_Wtime();
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
//////////////////////////////////////// MAIN LOOP //////////////////////////////////////
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Main While Loop:
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << "=========================************===============================" << endl;
|
|
||||||
fflush(stdout);
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << ")Entering While(true) loop..";
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << "=========================************===============================" << endl;
|
|
||||||
fflush(stdout);
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
while (true) {
|
|
||||||
#ifdef DEBUG_HANG_
|
|
||||||
//if (myRank == 0)
|
|
||||||
cout << "\n(" << myRank << ") Main loop" << endl;
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/////////////////////////// PROCESS MATCHED VERTICES //////////////////////////////
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
processMatchedVerticesAndSendMessagesS(NLVer,
|
|
||||||
UChunkBeingProcessed,
|
|
||||||
U,
|
|
||||||
privateU,
|
|
||||||
StartIndex,
|
|
||||||
EndIndex,
|
|
||||||
&myCard,
|
|
||||||
&msgInd,
|
|
||||||
&NumMessagesBundled,
|
|
||||||
&S,
|
|
||||||
verLocPtr,
|
|
||||||
verLocInd,
|
|
||||||
verDistance,
|
|
||||||
PCounter,
|
|
||||||
Counter,
|
|
||||||
myRank,
|
|
||||||
numProcs,
|
|
||||||
candidateMate,
|
|
||||||
GMate,
|
|
||||||
Mate,
|
|
||||||
Ghost2LocalMap,
|
|
||||||
edgeLocWeight,
|
|
||||||
QLocalVtx,
|
|
||||||
QGhostVtx,
|
|
||||||
QMsgType,
|
|
||||||
QOwner,
|
|
||||||
privateQLocalVtx,
|
|
||||||
privateQGhostVtx,
|
|
||||||
privateQMsgType,
|
|
||||||
privateQOwner,
|
|
||||||
comm,
|
|
||||||
&msgActual,
|
|
||||||
Message);
|
|
||||||
|
|
||||||
///////////////////////// END OF PROCESS MATCHED VERTICES /////////////////////////
|
|
||||||
|
|
||||||
//// BREAK IF NO MESSAGES EXPECTED /////////
|
|
||||||
#ifdef DEBUG_HANG_
|
|
||||||
#if 0
|
|
||||||
cout << myRank << " Mate after ProcessMatchedAndSend phase "<<S <<endl;
|
|
||||||
for (int i=0; i<NLVer; i++) {
|
|
||||||
cout << Mate[i] << " " ;
|
|
||||||
}
|
|
||||||
cout << endl;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << ")Deciding whether to break: S= " << S << endl;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (S == 0) {
|
|
||||||
#ifdef DEBUG_HANG_
|
|
||||||
cout << "\n(" << myRank << ") Breaking out" << endl;
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/////////////////////////// PROCESS MESSAGES //////////////////////////////////////
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
processMessagesS(NLVer,
|
|
||||||
Mate,
|
|
||||||
candidateMate,
|
|
||||||
Ghost2LocalMap,
|
|
||||||
GMate,
|
|
||||||
Counter,
|
|
||||||
StartIndex,
|
|
||||||
EndIndex,
|
|
||||||
&myCard,
|
|
||||||
&msgInd,
|
|
||||||
&msgActual,
|
|
||||||
edgeLocWeight,
|
|
||||||
verDistance,
|
|
||||||
verLocPtr,
|
|
||||||
k,
|
|
||||||
verLocInd,
|
|
||||||
numProcs,
|
|
||||||
myRank,
|
|
||||||
comm,
|
|
||||||
Message,
|
|
||||||
numGhostEdges,
|
|
||||||
u,
|
|
||||||
v,
|
|
||||||
&S,
|
|
||||||
U);
|
|
||||||
|
|
||||||
///////////////////////// END OF PROCESS MESSAGES /////////////////////////////////
|
|
||||||
#ifdef DEBUG_HANG_
|
|
||||||
#if 0
|
|
||||||
cout << myRank << " Mate after ProcessMessages phase "<<S <<endl;
|
|
||||||
for (int i=0; i<NLVer; i++) {
|
|
||||||
cout << Mate[i] << " " ;
|
|
||||||
}
|
|
||||||
cout << endl;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << ")Finished Message processing phase: S= " << S;
|
|
||||||
fflush(stdout);
|
|
||||||
cout << "\n(" << myRank << ")** SENT : ACTUAL= " << msgActual;
|
|
||||||
fflush(stdout);
|
|
||||||
cout << "\n(" << myRank << ")** SENT : INDIVIDUAL= " << msgInd << endl;
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
} // End of while (true)
|
|
||||||
|
|
||||||
clean(NLVer,
|
|
||||||
myRank,
|
|
||||||
MessageIndex,
|
|
||||||
SRequest,
|
|
||||||
SStatus,
|
|
||||||
BufferSize,
|
|
||||||
Buffer,
|
|
||||||
msgActual,
|
|
||||||
msgActualSent,
|
|
||||||
msgInd,
|
|
||||||
msgIndSent,
|
|
||||||
NumMessagesBundled,
|
|
||||||
msgPercent);
|
|
||||||
|
|
||||||
finishTime = MPI_Wtime();
|
|
||||||
*ph2_time = finishTime - startTime; // Time taken for Phase-2
|
|
||||||
*ph2_card = myCard; // Cardinality at the end of Phase-2
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -112,11 +112,11 @@ subroutine amg_daggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,&
|
|||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
! Arguments
|
! Arguments
|
||||||
type(psb_dspmat_type), intent(in) :: a
|
type(psb_dspmat_type), intent(in) :: a
|
||||||
type(psb_desc_type), intent(inout) :: desc_a
|
type(psb_desc_type), intent(inout) :: desc_a
|
||||||
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
|
integer(psb_lpk_), intent(inout) :: ilaggr(:), nlaggr(:)
|
||||||
type(amg_dml_parms), intent(inout) :: parms
|
type(amg_dml_parms), intent(inout) :: parms
|
||||||
type(psb_dspmat_type), intent(inout) :: op_prol,ac,op_restr
|
type(psb_dspmat_type), intent(inout) :: op_prol,ac,op_restr
|
||||||
type(psb_ldspmat_type), intent(inout) :: t_prol
|
type(psb_ldspmat_type), intent(inout) :: t_prol
|
||||||
type(psb_desc_type), intent(inout) :: desc_ac
|
type(psb_desc_type), intent(inout) :: desc_ac
|
||||||
integer(psb_ipk_), intent(out) :: info
|
integer(psb_ipk_), intent(out) :: info
|
||||||
@@ -132,7 +132,7 @@ subroutine amg_daggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,&
|
|||||||
type(psb_d_coo_sparse_mat) :: coo_prol, coo_restr
|
type(psb_d_coo_sparse_mat) :: coo_prol, coo_restr
|
||||||
type(psb_d_csr_sparse_mat) :: acsr1, acsrf, csr_prol, acsr
|
type(psb_d_csr_sparse_mat) :: acsr1, acsrf, csr_prol, acsr
|
||||||
real(psb_dpk_), allocatable :: adiag(:)
|
real(psb_dpk_), allocatable :: adiag(:)
|
||||||
real(psb_dpk_), allocatable :: arwsum(:)
|
real(psb_dpk_), allocatable :: arwsum(:),l1rwsum(:)
|
||||||
integer(psb_ipk_) :: ierr(5)
|
integer(psb_ipk_) :: ierr(5)
|
||||||
logical :: filter_mat
|
logical :: filter_mat
|
||||||
integer(psb_ipk_) :: debug_level, debug_unit, err_act
|
integer(psb_ipk_) :: debug_level, debug_unit, err_act
|
||||||
@@ -141,6 +141,7 @@ subroutine amg_daggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,&
|
|||||||
logical, parameter :: debug_new=.false.
|
logical, parameter :: debug_new=.false.
|
||||||
character(len=80) :: filename
|
character(len=80) :: filename
|
||||||
logical, parameter :: do_timings=.false.
|
logical, parameter :: do_timings=.false.
|
||||||
|
logical, parameter :: do_l1correction=.true.
|
||||||
integer(psb_ipk_), save :: idx_spspmm=-1, idx_phase1=-1, idx_gtrans=-1, idx_phase2=-1, idx_refine=-1
|
integer(psb_ipk_), save :: idx_spspmm=-1, idx_phase1=-1, idx_gtrans=-1, idx_phase2=-1, idx_refine=-1
|
||||||
integer(psb_ipk_), save :: idx_phase3=-1, idx_cdasb=-1, idx_ptap=-1
|
integer(psb_ipk_), save :: idx_phase3=-1, idx_cdasb=-1, idx_ptap=-1
|
||||||
|
|
||||||
@@ -200,6 +201,21 @@ subroutine amg_daggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,&
|
|||||||
if (info == psb_success_) &
|
if (info == psb_success_) &
|
||||||
& call psb_halo(adiag,desc_a,info)
|
& call psb_halo(adiag,desc_a,info)
|
||||||
if (info == psb_success_) call a%cp_to(acsr)
|
if (info == psb_success_) call a%cp_to(acsr)
|
||||||
|
! Get the l1-diagonal of D
|
||||||
|
if (do_l1correction) then
|
||||||
|
allocate(l1rwsum(nrow))
|
||||||
|
call acsr%arwsum(l1rwsum)
|
||||||
|
if (info == psb_success_) &
|
||||||
|
& call psb_realloc(ncol,l1rwsum,info)
|
||||||
|
if (info == psb_success_) &
|
||||||
|
& call psb_halo(l1rwsum,desc_a,info)
|
||||||
|
! \tilde{D}_{i,i} = \sum_{j \ne i} |a_{i,j}|
|
||||||
|
!$OMP parallel do private(i) schedule(static)
|
||||||
|
do i=1,size(adiag)
|
||||||
|
adiag(i) = adiag(i) + l1rwsum(i) - abs(adiag(i))
|
||||||
|
end do
|
||||||
|
!$OMP end parallel do
|
||||||
|
end if
|
||||||
|
|
||||||
if(info /= psb_success_) then
|
if(info /= psb_success_) then
|
||||||
call psb_errpush(psb_err_from_subroutine_,name,a_err='sp_getdiag')
|
call psb_errpush(psb_err_from_subroutine_,name,a_err='sp_getdiag')
|
||||||
@@ -230,7 +246,7 @@ subroutine amg_daggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,&
|
|||||||
|
|
||||||
enddo
|
enddo
|
||||||
if (jd == -1) then
|
if (jd == -1) then
|
||||||
write(0,*) 'Wrong input: we need the diagonal!!!!', i
|
if (.not.do_l1correction) write(0,*) 'Wrong input: we need the diagonal!!!!', i
|
||||||
else
|
else
|
||||||
acsrf%val(jd)=acsrf%val(jd)-tmp
|
acsrf%val(jd)=acsrf%val(jd)-tmp
|
||||||
end if
|
end if
|
||||||
@@ -240,7 +256,6 @@ subroutine amg_daggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,&
|
|||||||
call acsrf%clean_zeros(info)
|
call acsrf%clean_zeros(info)
|
||||||
end if
|
end if
|
||||||
|
|
||||||
|
|
||||||
!$OMP parallel do private(i) schedule(static)
|
!$OMP parallel do private(i) schedule(static)
|
||||||
do i=1,size(adiag)
|
do i=1,size(adiag)
|
||||||
if (adiag(i) /= dzero) then
|
if (adiag(i) /= dzero) then
|
||||||
@@ -249,7 +264,8 @@ subroutine amg_daggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,&
|
|||||||
adiag(i) = done
|
adiag(i) = done
|
||||||
end if
|
end if
|
||||||
end do
|
end do
|
||||||
!$OMP end parallel do
|
!$OMP end parallel do
|
||||||
|
|
||||||
if (parms%aggr_omega_alg == amg_eig_est_) then
|
if (parms%aggr_omega_alg == amg_eig_est_) then
|
||||||
|
|
||||||
if (parms%aggr_eig == amg_max_norm_) then
|
if (parms%aggr_eig == amg_max_norm_) then
|
||||||
@@ -259,7 +275,9 @@ subroutine amg_daggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,&
|
|||||||
call psb_amx(ctxt,anorm)
|
call psb_amx(ctxt,anorm)
|
||||||
omega = 4.d0/(3.d0*anorm)
|
omega = 4.d0/(3.d0*anorm)
|
||||||
parms%aggr_omega_val = omega
|
parms%aggr_omega_val = omega
|
||||||
|
else if (do_l1correction) then
|
||||||
|
! For l1-Jacobi this can be estimated with 1
|
||||||
|
parms%aggr_omega_val = done
|
||||||
else
|
else
|
||||||
info = psb_err_internal_error_
|
info = psb_err_internal_error_
|
||||||
call psb_errpush(info,name,a_err='invalid amg_aggr_eig_')
|
call psb_errpush(info,name,a_err='invalid amg_aggr_eig_')
|
||||||
@@ -323,6 +341,9 @@ subroutine amg_daggrmat_smth_bld(a,desc_a,ilaggr,nlaggr,parms,&
|
|||||||
& write(debug_unit,*) me,' ',trim(name),&
|
& write(debug_unit,*) me,' ',trim(name),&
|
||||||
& 'Done smooth_aggregate '
|
& 'Done smooth_aggregate '
|
||||||
call psb_erractionrestore(err_act)
|
call psb_erractionrestore(err_act)
|
||||||
|
|
||||||
|
if (allocated(l1rwsum)) deallocate(l1rwsum)
|
||||||
|
if (allocated(arwsum)) deallocate(arwsum)
|
||||||
return
|
return
|
||||||
|
|
||||||
9999 continue
|
9999 continue
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
#include "MatchBoxPC.h"
|
#include "MatchBoxPC.h"
|
||||||
|
|
||||||
// TODO comment
|
// TODO comment
|
||||||
|
#if !defined(SERIAL_MPI)
|
||||||
|
|
||||||
void clean(MilanLongInt NLVer,
|
void clean(MilanLongInt NLVer,
|
||||||
MilanInt myRank,
|
MilanInt myRank,
|
||||||
@@ -88,3 +90,4 @@ void clean(MilanLongInt NLVer,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "MatchBoxPC.h"
|
#include "MatchBoxPC.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the research fr the Candidate Mate without controlling if the vertices are already matched.
|
* Execute the research fr the Candidate Mate without controlling if the vertices are already matched.
|
||||||
* Returns the vertices with the highest weight
|
* Returns the vertices with the highest weight
|
||||||
@@ -8,7 +9,9 @@
|
|||||||
* @param edgeLocWeight
|
* @param edgeLocWeight
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
MilanLongInt firstComputeCandidateMateD(MilanLongInt adj1,
|
#if !defined(SERIAL_MPI)
|
||||||
|
|
||||||
|
MilanLongInt firstComputeCandidateMate(MilanLongInt adj1,
|
||||||
MilanLongInt adj2,
|
MilanLongInt adj2,
|
||||||
MilanLongInt *verLocInd,
|
MilanLongInt *verLocInd,
|
||||||
MilanReal *edgeLocWeight)
|
MilanReal *edgeLocWeight)
|
||||||
@@ -41,7 +44,7 @@ MilanLongInt firstComputeCandidateMateD(MilanLongInt adj1,
|
|||||||
* @param Ghost2LocalMap
|
* @param Ghost2LocalMap
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
MilanLongInt computeCandidateMateD(MilanLongInt adj1,
|
MilanLongInt computeCandidateMate(MilanLongInt adj1,
|
||||||
MilanLongInt adj2,
|
MilanLongInt adj2,
|
||||||
MilanReal *edgeLocWeight,
|
MilanReal *edgeLocWeight,
|
||||||
MilanLongInt k,
|
MilanLongInt k,
|
||||||
@@ -59,7 +62,7 @@ MilanLongInt computeCandidateMateD(MilanLongInt adj1,
|
|||||||
for (k = adj1; k < adj2; k++) {
|
for (k = adj1; k < adj2; k++) {
|
||||||
if (isAlreadyMatched(verLocInd[k], StartIndex, EndIndex, GMate, Mate, Ghost2LocalMap))
|
if (isAlreadyMatched(verLocInd[k], StartIndex, EndIndex, GMate, Mate, Ghost2LocalMap))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ((edgeLocWeight[k] > heaviestEdgeWt) ||
|
if ((edgeLocWeight[k] > heaviestEdgeWt) ||
|
||||||
((edgeLocWeight[k] == heaviestEdgeWt) && (w < verLocInd[k]))) {
|
((edgeLocWeight[k] == heaviestEdgeWt) && (w < verLocInd[k]))) {
|
||||||
heaviestEdgeWt = edgeLocWeight[k];
|
heaviestEdgeWt = edgeLocWeight[k];
|
||||||
@@ -67,70 +70,7 @@ MilanLongInt computeCandidateMateD(MilanLongInt adj1,
|
|||||||
}
|
}
|
||||||
} // End of for loop
|
} // End of for loop
|
||||||
// End: PARALLEL_COMPUTE_CANDIDATE_MATE_B(v)
|
// End: PARALLEL_COMPUTE_CANDIDATE_MATE_B(v)
|
||||||
|
|
||||||
return w;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
MilanLongInt firstComputeCandidateMateS(MilanLongInt adj1,
|
|
||||||
MilanLongInt adj2,
|
|
||||||
MilanLongInt *verLocInd,
|
|
||||||
MilanFloat *edgeLocWeight)
|
|
||||||
{
|
|
||||||
MilanInt w = -1;
|
|
||||||
MilanFloat heaviestEdgeWt = 0.0f; // Assign the smallest
|
|
||||||
int finalK;
|
|
||||||
for (int k = adj1; k < adj2; k++) {
|
|
||||||
if ((edgeLocWeight[k] > heaviestEdgeWt) ||
|
|
||||||
((edgeLocWeight[k] == heaviestEdgeWt) && (w < verLocInd[k]))) {
|
|
||||||
heaviestEdgeWt = edgeLocWeight[k];
|
|
||||||
w = verLocInd[k];
|
|
||||||
finalK = k;
|
|
||||||
}
|
|
||||||
} // End of for loop
|
|
||||||
return finalK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* //TODO documentation
|
|
||||||
* @param adj1
|
|
||||||
* @param adj2
|
|
||||||
* @param edgeLocWeight
|
|
||||||
* @param k
|
|
||||||
* @param verLocInd
|
|
||||||
* @param StartIndex
|
|
||||||
* @param EndIndex
|
|
||||||
* @param GMate
|
|
||||||
* @param Mate
|
|
||||||
* @param Ghost2LocalMap
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
MilanLongInt computeCandidateMateS(MilanLongInt adj1,
|
|
||||||
MilanLongInt adj2,
|
|
||||||
MilanFloat *edgeLocWeight,
|
|
||||||
MilanLongInt k,
|
|
||||||
MilanLongInt *verLocInd,
|
|
||||||
MilanLongInt StartIndex,
|
|
||||||
MilanLongInt EndIndex,
|
|
||||||
vector<MilanLongInt> &GMate,
|
|
||||||
MilanLongInt *Mate,
|
|
||||||
map<MilanLongInt, MilanLongInt> &Ghost2LocalMap)
|
|
||||||
{
|
|
||||||
// Start: PARALLEL_COMPUTE_CANDIDATE_MATE_B(v)
|
|
||||||
|
|
||||||
MilanInt w = -1;
|
|
||||||
MilanFloat heaviestEdgeWt = 0.0f; // Assign the smallest Value
|
|
||||||
for (k = adj1; k < adj2; k++) {
|
|
||||||
if (isAlreadyMatched(verLocInd[k], StartIndex, EndIndex, GMate, Mate, Ghost2LocalMap))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if ((edgeLocWeight[k] > heaviestEdgeWt) ||
|
|
||||||
((edgeLocWeight[k] == heaviestEdgeWt) && (w < verLocInd[k]))) {
|
|
||||||
heaviestEdgeWt = edgeLocWeight[k];
|
|
||||||
w = verLocInd[k];
|
|
||||||
}
|
|
||||||
} // End of for loop
|
|
||||||
// End: PARALLEL_COMPUTE_CANDIDATE_MATE_B(v)
|
|
||||||
|
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "MatchBoxPC.h"
|
#include "MatchBoxPC.h"
|
||||||
|
|
||||||
void extractUChunk(
|
void extractUChunk(
|
||||||
vector<MilanLongInt> &UChunkBeingProcessed,
|
vector<MilanLongInt> &UChunkBeingProcessed,
|
||||||
vector<MilanLongInt> &U,
|
vector<MilanLongInt> &U,
|
||||||
@@ -27,4 +28,4 @@ void extractUChunk(
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // End of critical U // End of critical U
|
} // End of critical U // End of critical U
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "MatchBoxPC.h"
|
#include "MatchBoxPC.h"
|
||||||
|
|
||||||
/// Find the owner of a ghost node:
|
/// Find the owner of a ghost node:
|
||||||
MilanInt findOwnerOfGhost(MilanLongInt vtxIndex, MilanLongInt *mVerDistance,
|
MilanInt findOwnerOfGhost(MilanLongInt vtxIndex, MilanLongInt *mVerDistance,
|
||||||
MilanInt myRank, MilanInt numProcs)
|
MilanInt myRank, MilanInt numProcs)
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "MatchBoxPC.h"
|
#include "MatchBoxPC.h"
|
||||||
|
|
||||||
void initialize(MilanLongInt NLVer, MilanLongInt NLEdge,
|
void initialize(MilanLongInt NLVer, MilanLongInt NLEdge,
|
||||||
MilanLongInt StartIndex, MilanLongInt EndIndex,
|
MilanLongInt StartIndex, MilanLongInt EndIndex,
|
||||||
MilanLongInt *numGhostEdges,
|
MilanLongInt *numGhostEdges,
|
||||||
@@ -290,7 +291,7 @@ void initialize(MilanLongInt NLVer, MilanLongInt NLEdge,
|
|||||||
//new (&U) staticQueue(NLVer + (*numGhostVertices));
|
//new (&U) staticQueue(NLVer + (*numGhostVertices));
|
||||||
U.reserve(NLVer + (*numGhostVertices));
|
U.reserve(NLVer + (*numGhostVertices));
|
||||||
|
|
||||||
// Initialize the private vectors
|
// Initialize the private vectors
|
||||||
privateQLocalVtx.reserve(*numGhostVertices);
|
privateQLocalVtx.reserve(*numGhostVertices);
|
||||||
privateQGhostVtx.reserve(*numGhostVertices);
|
privateQGhostVtx.reserve(*numGhostVertices);
|
||||||
privateQMsgType.reserve(*numGhostVertices);
|
privateQMsgType.reserve(*numGhostVertices);
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "MatchBoxPC.h"
|
#include "MatchBoxPC.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* //TODO documentation
|
* //TODO documentation
|
||||||
* @param k
|
* @param k
|
||||||
@@ -31,7 +32,7 @@ bool isAlreadyMatched(MilanLongInt node,
|
|||||||
*/
|
*/
|
||||||
MilanLongInt val;
|
MilanLongInt val;
|
||||||
if ((node < StartIndex) || (node > EndIndex)) // if ghost vertex
|
if ((node < StartIndex) || (node > EndIndex)) // if ghost vertex
|
||||||
{
|
{
|
||||||
#pragma omp atomic read
|
#pragma omp atomic read
|
||||||
val = GMate[Ghost2LocalMap[node]];
|
val = GMate[Ghost2LocalMap[node]];
|
||||||
return val >= 0; // Already matched
|
return val >= 0; // Already matched
|
||||||
@@ -42,4 +43,4 @@ bool isAlreadyMatched(MilanLongInt node,
|
|||||||
val = Mate[node - StartIndex];
|
val = Mate[node - StartIndex];
|
||||||
|
|
||||||
return val >= 0; // Already matched
|
return val >= 0; // Already matched
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
#include "MatchBoxPC.h"
|
#include "MatchBoxPC.h"
|
||||||
void PARALLEL_COMPUTE_CANDIDATE_MATE_BD(MilanLongInt NLVer,
|
#if !defined(SERIAL_MPI)
|
||||||
|
|
||||||
|
void PARALLEL_COMPUTE_CANDIDATE_MATE_B(MilanLongInt NLVer,
|
||||||
MilanLongInt *verLocPtr,
|
MilanLongInt *verLocPtr,
|
||||||
MilanLongInt *verLocInd,
|
MilanLongInt *verLocInd,
|
||||||
MilanInt myRank,
|
MilanInt myRank,
|
||||||
@@ -19,36 +21,9 @@ void PARALLEL_COMPUTE_CANDIDATE_MATE_BD(MilanLongInt NLVer,
|
|||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
#endif
|
#endif
|
||||||
// Start: PARALLEL_COMPUTE_CANDIDATE_MATE_B(v)
|
// Start: PARALLEL_COMPUTE_CANDIDATE_MATE_B(v)
|
||||||
candidateMate[v] = firstComputeCandidateMateD(verLocPtr[v], verLocPtr[v + 1],
|
candidateMate[v] = firstComputeCandidateMate(verLocPtr[v], verLocPtr[v + 1], verLocInd, edgeLocWeight);
|
||||||
verLocInd, edgeLocWeight);
|
|
||||||
// End: PARALLEL_COMPUTE_CANDIDATE_MATE_B(v)
|
// End: PARALLEL_COMPUTE_CANDIDATE_MATE_B(v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PARALLEL_COMPUTE_CANDIDATE_MATE_BS(MilanLongInt NLVer,
|
|
||||||
MilanLongInt *verLocPtr,
|
|
||||||
MilanLongInt *verLocInd,
|
|
||||||
MilanInt myRank,
|
|
||||||
MilanFloat *edgeLocWeight,
|
|
||||||
MilanLongInt *candidateMate)
|
|
||||||
{
|
|
||||||
|
|
||||||
MilanLongInt v = -1;
|
|
||||||
|
|
||||||
#pragma omp parallel private(v) default(shared) num_threads(NUM_THREAD)
|
|
||||||
{
|
|
||||||
|
|
||||||
#pragma omp for schedule(static)
|
|
||||||
for (v = 0; v < NLVer; v++) {
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << ")Processing: " << v + StartIndex << endl;
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
#endif
|
||||||
// Start: PARALLEL_COMPUTE_CANDIDATE_MATE_B(v)
|
|
||||||
candidateMate[v] = firstComputeCandidateMateS(verLocPtr[v], verLocPtr[v + 1],
|
|
||||||
verLocInd, edgeLocWeight);
|
|
||||||
// End: PARALLEL_COMPUTE_CANDIDATE_MATE_B(v)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "MatchBoxPC.h"
|
#include "MatchBoxPC.h"
|
||||||
|
|
||||||
void PROCESS_CROSS_EDGE(MilanLongInt *edge,
|
void PROCESS_CROSS_EDGE(MilanLongInt *edge,
|
||||||
MilanLongInt *S)
|
MilanLongInt *S)
|
||||||
{
|
{
|
||||||
@@ -20,4 +21,4 @@ void PROCESS_CROSS_EDGE(MilanLongInt *edge,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// End: PARALLEL_PROCESS_CROSS_EDGE_B
|
// End: PARALLEL_PROCESS_CROSS_EDGE_B
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
#include "MatchBoxPC.h"
|
#include "MatchBoxPC.h"
|
||||||
void PARALLEL_PROCESS_EXPOSED_VERTEX_BD(MilanLongInt NLVer,
|
#if !defined(SERIAL_MPI)
|
||||||
|
|
||||||
|
void PARALLEL_PROCESS_EXPOSED_VERTEX_B(MilanLongInt NLVer,
|
||||||
MilanLongInt *candidateMate,
|
MilanLongInt *candidateMate,
|
||||||
MilanLongInt *verLocInd,
|
MilanLongInt *verLocInd,
|
||||||
MilanLongInt *verLocPtr,
|
MilanLongInt *verLocPtr,
|
||||||
@@ -28,18 +30,17 @@ void PARALLEL_PROCESS_EXPOSED_VERTEX_BD(MilanLongInt NLVer,
|
|||||||
vector<MilanLongInt> &privateQGhostVtx,
|
vector<MilanLongInt> &privateQGhostVtx,
|
||||||
vector<MilanLongInt> &privateQMsgType,
|
vector<MilanLongInt> &privateQMsgType,
|
||||||
vector<MilanInt> &privateQOwner)
|
vector<MilanInt> &privateQOwner)
|
||||||
{
|
{
|
||||||
|
|
||||||
MilanLongInt v = -1, k = -1, w = -1, adj11 = 0, adj12 = 0, k1 = 0;
|
MilanLongInt v = -1, k = -1, w = -1, adj11 = 0, adj12 = 0, k1 = 0;
|
||||||
MilanInt ghostOwner = 0, option, igw;
|
MilanInt ghostOwner = 0, option, igw;
|
||||||
|
|
||||||
//#pragma omp parallel private(option, k, w, v, k1, adj11, adj12, ghostOwner) \
|
#pragma omp parallel private(option, k, w, v, k1, adj11, adj12, ghostOwner) \
|
||||||
firstprivate(privateU, StartIndex, EndIndex, privateQLocalVtx, \
|
firstprivate(privateU, StartIndex, EndIndex, privateQLocalVtx, privateQGhostVtx, privateQMsgType, privateQOwner) \
|
||||||
privateQGhostVtx, privateQMsgType, privateQOwner) \
|
default(shared) num_threads(NUM_THREAD)
|
||||||
default(shared) num_threads(NUM_THREAD)
|
|
||||||
|
|
||||||
{
|
{
|
||||||
//#pragma omp for reduction(+ \
|
#pragma omp for reduction(+ \
|
||||||
: PCounter[:numProcs], myCard \
|
: PCounter[:numProcs], myCard \
|
||||||
[:1], msgInd \
|
[:1], msgInd \
|
||||||
[:1], NumMessagesBundled \
|
[:1], NumMessagesBundled \
|
||||||
@@ -62,89 +63,102 @@ void PARALLEL_PROCESS_EXPOSED_VERTEX_BD(MilanLongInt NLVer,
|
|||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
#endif
|
#endif
|
||||||
// If found a dominating edge:
|
// If found a dominating edge:
|
||||||
if (w >= 0) {
|
if (w >= 0)
|
||||||
#pragma omp critical(Matching)
|
{
|
||||||
{
|
|
||||||
if (isAlreadyMatched(verLocInd[k], StartIndex, EndIndex, GMate, Mate, Ghost2LocalMap)) {
|
#pragma omp critical(processExposed)
|
||||||
w = computeCandidateMateD(verLocPtr[v], verLocPtr[v + 1], edgeLocWeight, 0,
|
{
|
||||||
verLocInd, StartIndex, EndIndex,
|
if (isAlreadyMatched(verLocInd[k], StartIndex, EndIndex, GMate, Mate, Ghost2LocalMap)) {
|
||||||
GMate, Mate, Ghost2LocalMap);
|
w = computeCandidateMate(verLocPtr[v],
|
||||||
candidateMate[v] = w;
|
verLocPtr[v + 1],
|
||||||
}
|
edgeLocWeight, 0,
|
||||||
}
|
verLocInd,
|
||||||
if (w >= 0) {
|
StartIndex,
|
||||||
(*myCard)++;
|
EndIndex,
|
||||||
if ((w < StartIndex) || (w > EndIndex)) { // w is a ghost vertex
|
GMate,
|
||||||
option = 2;
|
Mate,
|
||||||
if (candidateMate[NLVer + Ghost2LocalMap[w]] == v + StartIndex) {
|
Ghost2LocalMap);
|
||||||
option = 1;
|
candidateMate[v] = w;
|
||||||
Mate[v] = w;
|
}
|
||||||
GMate[Ghost2LocalMap[w]] = v + StartIndex; // w is a Ghost
|
|
||||||
} // End of if CandidateMate[w] = v
|
if (w >= 0) {
|
||||||
} // End of if a Ghost Vertex
|
(*myCard)++;
|
||||||
else { // w is a local vertex
|
if ((w < StartIndex) || (w > EndIndex)) { // w is a ghost vertex
|
||||||
if (candidateMate[w - StartIndex] == (v + StartIndex)) {
|
option = 2;
|
||||||
option = 3;
|
if (candidateMate[NLVer + Ghost2LocalMap[w]] == v + StartIndex) {
|
||||||
Mate[v] = w; // v is local
|
option = 1;
|
||||||
Mate[w - StartIndex] = v + StartIndex; // w is local
|
Mate[v] = w;
|
||||||
|
GMate[Ghost2LocalMap[w]] = v + StartIndex; // w is a Ghost
|
||||||
|
|
||||||
|
} // End of if CandidateMate[w] = v
|
||||||
|
|
||||||
|
} // End of if a Ghost Vertex
|
||||||
|
else { // w is a local vertex
|
||||||
|
|
||||||
|
if (candidateMate[w - StartIndex] == (v + StartIndex)) {
|
||||||
|
option = 3;
|
||||||
|
Mate[v] = w; // v is local
|
||||||
|
Mate[w - StartIndex] = v + StartIndex; // w is local
|
||||||
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
#ifdef PRINT_DEBUG_INFO_
|
||||||
cout << "\n(" << myRank << ")MATCH: (" << v + StartIndex << "," << w << ") ";
|
cout << "\n(" << myRank << ")MATCH: (" << v + StartIndex << "," << w << ") ";
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
#endif
|
#endif
|
||||||
} // End of if ( candidateMate[w-StartIndex] == (v+StartIndex) )
|
|
||||||
} // End of Else
|
} // End of if ( candidateMate[w-StartIndex] == (v+StartIndex) )
|
||||||
} // End of second if
|
} // End of Else
|
||||||
|
|
||||||
|
} // End of second if
|
||||||
|
|
||||||
|
} // End critical processExposed
|
||||||
|
|
||||||
} // End of if(w >=0)
|
} // End of if(w >=0)
|
||||||
else {
|
else {
|
||||||
//#pragma omp critical(adjuse)
|
// This piece of code is executed a really small amount of times
|
||||||
{
|
adj11 = verLocPtr[v];
|
||||||
// This piece of code is executed a really small number of times
|
adj12 = verLocPtr[v + 1];
|
||||||
adj11 = verLocPtr[v];
|
for (k1 = adj11; k1 < adj12; k1++) {
|
||||||
adj12 = verLocPtr[v + 1];
|
w = verLocInd[k1];
|
||||||
for (k1 = adj11; k1 < adj12; k1++) {
|
if ((w < StartIndex) || (w > EndIndex)) { // A ghost
|
||||||
w = verLocInd[k1];
|
|
||||||
if ((w < StartIndex) || (w > EndIndex)) { // A ghost
|
|
||||||
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
#ifdef PRINT_DEBUG_INFO_
|
||||||
cout << "\n(" << myRank << ")Sending a failure message: ";
|
cout << "\n(" << myRank << ")Sending a failure message: ";
|
||||||
cout << "\n(" << myRank << ")Ghost is " << w << " Owner is: " << findOwnerOfGhost(w, verDistance, myRank, numProcs);
|
cout << "\n(" << myRank << ")Ghost is " << w << " Owner is: " << findOwnerOfGhost(w, verDistance, myRank, numProcs);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
#endif
|
#endif
|
||||||
(*msgInd)++;
|
(*msgInd)++;
|
||||||
(*NumMessagesBundled)++;
|
(*NumMessagesBundled)++;
|
||||||
ghostOwner = findOwnerOfGhost(w, verDistance, myRank, numProcs);
|
ghostOwner = findOwnerOfGhost(w, verDistance, myRank, numProcs);
|
||||||
// assert(ghostOwner != -1);
|
// assert(ghostOwner != -1);
|
||||||
// assert(ghostOwner != myRank);
|
// assert(ghostOwner != myRank);
|
||||||
#pragma omp atomic
|
PCounter[ghostOwner]++;
|
||||||
PCounter[ghostOwner]++;
|
|
||||||
|
privateQLocalVtx.push_back(v + StartIndex);
|
||||||
privateQLocalVtx.push_back(v + StartIndex);
|
privateQGhostVtx.push_back(w);
|
||||||
privateQGhostVtx.push_back(w);
|
privateQMsgType.push_back(FAILURE);
|
||||||
privateQMsgType.push_back(FAILURE);
|
privateQOwner.push_back(ghostOwner);
|
||||||
privateQOwner.push_back(ghostOwner);
|
|
||||||
|
} // End of if(GHOST)
|
||||||
} // End of if(GHOST)
|
} // End of for loop
|
||||||
} // End of for loop
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// End: PARALLEL_PROCESS_EXPOSED_VERTEX_B(v)
|
// End: PARALLEL_PROCESS_EXPOSED_VERTEX_B(v)
|
||||||
|
|
||||||
switch (option)
|
switch (option)
|
||||||
{
|
{
|
||||||
case -1:
|
case -1:
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
privateU.push_back(v + StartIndex);
|
privateU.push_back(v + StartIndex);
|
||||||
privateU.push_back(w);
|
privateU.push_back(w);
|
||||||
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
#ifdef PRINT_DEBUG_INFO_
|
||||||
cout << "\n(" << myRank << ")MATCH: (" << v + StartIndex << "," << w << ")";
|
cout << "\n(" << myRank << ")MATCH: (" << v + StartIndex << "," << w << ")";
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Decrement the counter:
|
// Decrement the counter:
|
||||||
PROCESS_CROSS_EDGE(&Counter[Ghost2LocalMap[w]], S);
|
PROCESS_CROSS_EDGE(&Counter[Ghost2LocalMap[w]], S);
|
||||||
case 2:
|
case 2:
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
#ifdef PRINT_DEBUG_INFO_
|
||||||
cout << "\n(" << myRank << ")Sending a request message (291):";
|
cout << "\n(" << myRank << ")Sending a request message (291):";
|
||||||
cout << "\n(" << myRank << ")Local is: " << v + StartIndex << " Ghost is " << w << " Owner is: " << findOwnerOfGhost(w, verDistance, myRank, numProcs) << endl;
|
cout << "\n(" << myRank << ")Local is: " << v + StartIndex << " Ghost is " << w << " Owner is: " << findOwnerOfGhost(w, verDistance, myRank, numProcs) << endl;
|
||||||
@@ -155,214 +169,29 @@ void PARALLEL_PROCESS_EXPOSED_VERTEX_BD(MilanLongInt NLVer,
|
|||||||
ghostOwner = findOwnerOfGhost(w, verDistance, myRank, numProcs);
|
ghostOwner = findOwnerOfGhost(w, verDistance, myRank, numProcs);
|
||||||
// assert(ghostOwner != -1);
|
// assert(ghostOwner != -1);
|
||||||
// assert(ghostOwner != myRank);
|
// assert(ghostOwner != myRank);
|
||||||
#pragma omp atomic
|
|
||||||
PCounter[ghostOwner]++;
|
PCounter[ghostOwner]++;
|
||||||
|
|
||||||
privateQLocalVtx.push_back(v + StartIndex);
|
privateQLocalVtx.push_back(v + StartIndex);
|
||||||
privateQGhostVtx.push_back(w);
|
privateQGhostVtx.push_back(w);
|
||||||
privateQMsgType.push_back(REQUEST);
|
privateQMsgType.push_back(REQUEST);
|
||||||
privateQOwner.push_back(ghostOwner);
|
privateQOwner.push_back(ghostOwner);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
default:
|
default:
|
||||||
privateU.push_back(v + StartIndex);
|
privateU.push_back(v + StartIndex);
|
||||||
privateU.push_back(w);
|
privateU.push_back(w);
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
} // End of for ( v=0; v < NLVer; v++ )
|
|
||||||
|
|
||||||
queuesTransfer(U, privateU, QLocalVtx,
|
|
||||||
QGhostVtx,
|
|
||||||
QMsgType, QOwner, privateQLocalVtx,
|
|
||||||
privateQGhostVtx,
|
|
||||||
privateQMsgType,
|
|
||||||
privateQOwner);
|
|
||||||
|
|
||||||
} // End of parallel region
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PARALLEL_PROCESS_EXPOSED_VERTEX_BS(MilanLongInt NLVer,
|
|
||||||
MilanLongInt *candidateMate,
|
|
||||||
MilanLongInt *verLocInd,
|
|
||||||
MilanLongInt *verLocPtr,
|
|
||||||
MilanLongInt StartIndex,
|
|
||||||
MilanLongInt EndIndex,
|
|
||||||
MilanLongInt *Mate,
|
|
||||||
vector<MilanLongInt> &GMate,
|
|
||||||
map<MilanLongInt, MilanLongInt> &Ghost2LocalMap,
|
|
||||||
MilanFloat *edgeLocWeight,
|
|
||||||
MilanLongInt *myCard,
|
|
||||||
MilanLongInt *msgInd,
|
|
||||||
MilanLongInt *NumMessagesBundled,
|
|
||||||
MilanLongInt *S,
|
|
||||||
MilanLongInt *verDistance,
|
|
||||||
MilanLongInt *PCounter,
|
|
||||||
vector<MilanLongInt> &Counter,
|
|
||||||
MilanInt myRank,
|
|
||||||
MilanInt numProcs,
|
|
||||||
vector<MilanLongInt> &U,
|
|
||||||
vector<MilanLongInt> &privateU,
|
|
||||||
vector<MilanLongInt> &QLocalVtx,
|
|
||||||
vector<MilanLongInt> &QGhostVtx,
|
|
||||||
vector<MilanLongInt> &QMsgType,
|
|
||||||
vector<MilanInt> &QOwner,
|
|
||||||
vector<MilanLongInt> &privateQLocalVtx,
|
|
||||||
vector<MilanLongInt> &privateQGhostVtx,
|
|
||||||
vector<MilanLongInt> &privateQMsgType,
|
|
||||||
vector<MilanInt> &privateQOwner)
|
|
||||||
{
|
|
||||||
|
|
||||||
MilanLongInt v = -1, k = -1, w = -1, adj11 = 0, adj12 = 0, k1 = 0;
|
|
||||||
MilanInt ghostOwner = 0, option, igw;
|
|
||||||
|
|
||||||
//#pragma omp parallel private(option, 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(+ \
|
|
||||||
: PCounter[:numProcs], myCard \
|
|
||||||
[:1], msgInd \
|
|
||||||
[:1], NumMessagesBundled \
|
|
||||||
[:1]) \
|
|
||||||
schedule(static)
|
|
||||||
for (v = 0; v < NLVer; v++) {
|
|
||||||
option = -1;
|
|
||||||
// Start: PARALLEL_PROCESS_EXPOSED_VERTEX_B(v)
|
|
||||||
k = candidateMate[v];
|
|
||||||
candidateMate[v] = verLocInd[k];
|
|
||||||
w = candidateMate[v];
|
|
||||||
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << ")Processing: " << v + StartIndex << endl;
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << ")" << v + StartIndex << " Points to: " << w;
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
// If found a dominating edge:
|
|
||||||
if (w >= 0) {
|
|
||||||
#pragma omp critical(Matching)
|
|
||||||
{
|
|
||||||
if (isAlreadyMatched(verLocInd[k], StartIndex, EndIndex, GMate, Mate, Ghost2LocalMap)) {
|
|
||||||
w = computeCandidateMateS(verLocPtr[v], verLocPtr[v + 1], edgeLocWeight, 0,
|
|
||||||
verLocInd, StartIndex, EndIndex,
|
|
||||||
GMate, Mate, Ghost2LocalMap);
|
|
||||||
candidateMate[v] = w;
|
|
||||||
}
|
|
||||||
if (w >= 0) {
|
|
||||||
(*myCard)++;
|
|
||||||
if ((w < StartIndex) || (w > EndIndex)) { // w is a ghost vertex
|
|
||||||
option = 2;
|
|
||||||
if (candidateMate[NLVer + Ghost2LocalMap[w]] == v + StartIndex) {
|
|
||||||
option = 1;
|
|
||||||
Mate[v] = w;
|
|
||||||
GMate[Ghost2LocalMap[w]] = v + StartIndex; // w is a Ghost
|
|
||||||
} // End of if CandidateMate[w] = v
|
|
||||||
} // End of if a Ghost Vertex
|
|
||||||
else { // w is a local vertex
|
|
||||||
if (candidateMate[w - StartIndex] == (v + StartIndex)) {
|
|
||||||
option = 3;
|
|
||||||
Mate[v] = w; // v is local
|
|
||||||
Mate[w - StartIndex] = v + StartIndex; // w is local
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << ")MATCH: (" << v + StartIndex << "," << w << ") ";
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
} // End of if ( candidateMate[w-StartIndex] == (v+StartIndex) )
|
|
||||||
} // End of Else
|
|
||||||
} // End of second if
|
|
||||||
}
|
|
||||||
|
|
||||||
} // End of if(w >=0)
|
|
||||||
else {
|
|
||||||
//#pragma omp critical(adjuse)
|
|
||||||
{
|
|
||||||
// This piece of code is executed a really small number of times
|
|
||||||
adj11 = verLocPtr[v];
|
|
||||||
adj12 = verLocPtr[v + 1];
|
|
||||||
for (k1 = adj11; k1 < adj12; k1++) {
|
|
||||||
w = verLocInd[k1];
|
|
||||||
if ((w < StartIndex) || (w > EndIndex)) { // A ghost
|
|
||||||
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << ")Sending a failure message: ";
|
|
||||||
cout << "\n(" << myRank << ")Ghost is " << w << " Owner is: " << findOwnerOfGhost(w, verDistance, myRank, numProcs);
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
(*msgInd)++;
|
|
||||||
(*NumMessagesBundled)++;
|
|
||||||
ghostOwner = findOwnerOfGhost(w, verDistance, myRank, numProcs);
|
|
||||||
// assert(ghostOwner != -1);
|
|
||||||
// assert(ghostOwner != myRank);
|
|
||||||
#pragma omp atomic
|
|
||||||
PCounter[ghostOwner]++;
|
|
||||||
|
|
||||||
privateQLocalVtx.push_back(v + StartIndex);
|
|
||||||
privateQGhostVtx.push_back(w);
|
|
||||||
privateQMsgType.push_back(FAILURE);
|
|
||||||
privateQOwner.push_back(ghostOwner);
|
|
||||||
|
|
||||||
} // End of if(GHOST)
|
|
||||||
} // End of for loop
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// End: PARALLEL_PROCESS_EXPOSED_VERTEX_B(v)
|
|
||||||
|
|
||||||
switch (option)
|
|
||||||
{
|
|
||||||
case -1:
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
privateU.push_back(v + StartIndex);
|
|
||||||
privateU.push_back(w);
|
|
||||||
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << ")MATCH: (" << v + StartIndex << "," << w << ")";
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Decrement the counter:
|
|
||||||
PROCESS_CROSS_EDGE(&Counter[Ghost2LocalMap[w]], S);
|
|
||||||
case 2:
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << ")Sending a request message (291):";
|
|
||||||
cout << "\n(" << myRank << ")Local is: " << v + StartIndex << " Ghost is " << w << " Owner is: " << findOwnerOfGhost(w, verDistance, myRank, numProcs) << endl;
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
(*msgInd)++;
|
|
||||||
(*NumMessagesBundled)++;
|
|
||||||
ghostOwner = findOwnerOfGhost(w, verDistance, myRank, numProcs);
|
|
||||||
// assert(ghostOwner != -1);
|
|
||||||
// assert(ghostOwner != myRank);
|
|
||||||
#pragma omp atomic
|
|
||||||
PCounter[ghostOwner]++;
|
|
||||||
|
|
||||||
privateQLocalVtx.push_back(v + StartIndex);
|
|
||||||
privateQGhostVtx.push_back(w);
|
|
||||||
privateQMsgType.push_back(REQUEST);
|
|
||||||
privateQOwner.push_back(ghostOwner);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
default:
|
|
||||||
privateU.push_back(v + StartIndex);
|
|
||||||
privateU.push_back(w);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // End of for ( v=0; v < NLVer; v++ )
|
} // End of for ( v=0; v < NLVer; v++ )
|
||||||
|
|
||||||
queuesTransfer(U, privateU, QLocalVtx,
|
queuesTransfer(U, privateU, QLocalVtx,
|
||||||
QGhostVtx,
|
QGhostVtx,
|
||||||
QMsgType, QOwner, privateQLocalVtx,
|
QMsgType, QOwner, privateQLocalVtx,
|
||||||
privateQGhostVtx,
|
privateQGhostVtx,
|
||||||
privateQMsgType,
|
privateQMsgType,
|
||||||
privateQOwner);
|
privateQOwner);
|
||||||
|
|
||||||
} // End of parallel region
|
} // End of parallel region
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
#include "MatchBoxPC.h"
|
#include "MatchBoxPC.h"
|
||||||
void processMatchedVerticesD(
|
|
||||||
|
#if !defined(SERIAL_MPI)
|
||||||
|
void processMatchedVertices(
|
||||||
MilanLongInt NLVer,
|
MilanLongInt NLVer,
|
||||||
vector<MilanLongInt> &UChunkBeingProcessed,
|
vector<MilanLongInt> &UChunkBeingProcessed,
|
||||||
vector<MilanLongInt> &U,
|
vector<MilanLongInt> &U,
|
||||||
@@ -57,29 +59,29 @@ void processMatchedVerticesD(
|
|||||||
{
|
{
|
||||||
|
|
||||||
while (!U.empty()) {
|
while (!U.empty()) {
|
||||||
|
|
||||||
extractUChunk(UChunkBeingProcessed, U, privateU);
|
extractUChunk(UChunkBeingProcessed, U, privateU);
|
||||||
|
|
||||||
for (MilanLongInt u : UChunkBeingProcessed) {
|
for (MilanLongInt u : UChunkBeingProcessed) {
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
#ifdef PRINT_DEBUG_INFO_
|
||||||
cout << "\n(" << myRank << ")u: " << u;
|
cout << "\n(" << myRank << ")u: " << u;
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
#endif
|
#endif
|
||||||
if ((u >= StartIndex) && (u <= EndIndex)) { // Process Only the Local Vertices
|
if ((u >= StartIndex) && (u <= EndIndex)) { // Process Only the Local Vertices
|
||||||
|
|
||||||
#ifdef COUNT_LOCAL_VERTEX
|
#ifdef COUNT_LOCAL_VERTEX
|
||||||
localVertices++;
|
localVertices++;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Get the Adjacency list for u
|
// Get the Adjacency list for u
|
||||||
adj1 = verLocPtr[u - StartIndex]; // Pointer
|
adj1 = verLocPtr[u - StartIndex]; // Pointer
|
||||||
adj2 = verLocPtr[u - StartIndex + 1];
|
adj2 = verLocPtr[u - StartIndex + 1];
|
||||||
for (k = adj1; k < adj2; k++) {
|
for (k = adj1; k < adj2; k++) {
|
||||||
option = -1;
|
option = -1;
|
||||||
v = verLocInd[k];
|
v = verLocInd[k];
|
||||||
|
|
||||||
if ((v >= StartIndex) && (v <= EndIndex)) { // If Local Vertex:
|
if ((v >= StartIndex) && (v <= EndIndex)) { // If Local Vertex:
|
||||||
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
#ifdef PRINT_DEBUG_INFO_
|
||||||
cout << "\n(" << myRank << ")v: " << v << " c(v)= " << candidateMate[v - StartIndex] << " Mate[v]: " << Mate[v];
|
cout << "\n(" << myRank << ")v: " << v << " c(v)= " << candidateMate[v - StartIndex] << " Mate[v]: " << Mate[v];
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
@@ -90,62 +92,62 @@ void processMatchedVerticesD(
|
|||||||
if (mateVal < 0) {
|
if (mateVal < 0) {
|
||||||
#pragma omp critical
|
#pragma omp critical
|
||||||
{
|
{
|
||||||
#pragma omp atomic read
|
if (candidateMate[v - StartIndex] == u) {
|
||||||
mateVal = Mate[v - StartIndex];
|
|
||||||
// If the current vertex is pointing to a matched vertex and is not matched
|
|
||||||
if (mateVal < 0) {
|
|
||||||
|
|
||||||
if (candidateMate[v - StartIndex] == u) {
|
|
||||||
// Start: PARALLEL_PROCESS_EXPOSED_VERTEX_B(v)
|
// Start: PARALLEL_PROCESS_EXPOSED_VERTEX_B(v)
|
||||||
w = computeCandidateMateD(verLocPtr[v - StartIndex],
|
w = computeCandidateMate(verLocPtr[v - StartIndex],
|
||||||
verLocPtr[v - StartIndex + 1],
|
verLocPtr[v - StartIndex + 1],
|
||||||
edgeLocWeight, 0,
|
edgeLocWeight, 0,
|
||||||
verLocInd, StartIndex, EndIndex,
|
verLocInd,
|
||||||
GMate, Mate, Ghost2LocalMap);
|
StartIndex,
|
||||||
candidateMate[v - StartIndex] = w;
|
EndIndex,
|
||||||
|
GMate,
|
||||||
|
Mate,
|
||||||
|
Ghost2LocalMap);
|
||||||
|
|
||||||
|
candidateMate[v - StartIndex] = w;
|
||||||
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
#ifdef PRINT_DEBUG_INFO_
|
||||||
cout << "\n(" << myRank << ")" << v << " Points to: " << w;
|
cout << "\n(" << myRank << ")" << v << " Points to: " << w;
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
#endif
|
#endif
|
||||||
// If found a dominating edge:
|
// If found a dominating edge:
|
||||||
if (w >= 0) {
|
if (w >= 0) {
|
||||||
if ((w < StartIndex) || (w > EndIndex)) { // A ghost
|
if ((w < StartIndex) || (w > EndIndex)) { // A ghost
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
#ifdef PRINT_DEBUG_INFO_
|
||||||
cout << "\n(" << myRank << ")Sending a request message:";
|
cout << "\n(" << myRank << ")Sending a request message:";
|
||||||
cout << "\n(" << myRank << ")Ghost is " << w << " Owner is: " << findOwnerOfGhost(w, verDistance, myRank, numProcs);
|
cout << "\n(" << myRank << ")Ghost is " << w << " Owner is: " << findOwnerOfGhost(w, verDistance, myRank, numProcs);
|
||||||
#endif
|
#endif
|
||||||
option = 2;
|
option = 2;
|
||||||
|
|
||||||
|
if (candidateMate[NLVer + Ghost2LocalMap[w]] == v) {
|
||||||
|
option = 1;
|
||||||
|
Mate[v - StartIndex] = w; // v is a local vertex
|
||||||
|
GMate[Ghost2LocalMap[w]] = v; // w is a ghost vertex
|
||||||
|
|
||||||
|
} // End of if CandidateMate[w] = v
|
||||||
|
} // End of if a Ghost Vertex
|
||||||
|
else { // w is a local vertex
|
||||||
|
if (candidateMate[w - StartIndex] == v) {
|
||||||
|
option = 3;
|
||||||
|
Mate[v - StartIndex] = w; // v is a local vertex
|
||||||
|
Mate[w - StartIndex] = v; // w is a local vertex
|
||||||
|
|
||||||
if (candidateMate[NLVer + Ghost2LocalMap[w]] == v) {
|
|
||||||
option = 1;
|
|
||||||
Mate[v - StartIndex] = w; // v is a local vertex
|
|
||||||
GMate[Ghost2LocalMap[w]] = v; // w is a ghost vertex
|
|
||||||
|
|
||||||
} // End of if CandidateMate[w] = v
|
|
||||||
} // End of if a Ghost Vertex
|
|
||||||
else { // w is a local vertex
|
|
||||||
if (candidateMate[w - StartIndex] == v) {
|
|
||||||
option = 3;
|
|
||||||
Mate[v - StartIndex] = w; // v is a local vertex
|
|
||||||
Mate[w - StartIndex] = v; // w is a local vertex
|
|
||||||
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
#ifdef PRINT_DEBUG_INFO_
|
||||||
cout << "\n(" << myRank << ")MATCH: (" << v << "," << w << ") ";
|
cout << "\n(" << myRank << ")MATCH: (" << v << "," << w << ") ";
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
#endif
|
#endif
|
||||||
} // End of if(CandidateMate(w) = v
|
} // End of if(CandidateMate(w) = v
|
||||||
} // End of Else
|
} // End of Else
|
||||||
} // End of if(w >=0)
|
} // End of if(w >=0)
|
||||||
else
|
else
|
||||||
option = 4; // End of Else: w == -1
|
option = 4; // End of Else: w == -1
|
||||||
// End: PARALLEL_PROCESS_EXPOSED_VERTEX_B(v)
|
// End: PARALLEL_PROCESS_EXPOSED_VERTEX_B(v)
|
||||||
} // End of If (candidateMate[v-StartIndex] == u
|
} // End of If (candidateMate[v-StartIndex] == u
|
||||||
}
|
|
||||||
} // End of task
|
} // End of task
|
||||||
} // mateval < 0
|
} // mateval < 0
|
||||||
} // End of if ( (v >= StartIndex) && (v <= EndIndex) ) //If Local Vertex:
|
} // End of if ( (v >= StartIndex) && (v <= EndIndex) ) //If Local Vertex:
|
||||||
else { // Neighbor is a ghost vertex
|
else { // Neighbor is a ghost vertex
|
||||||
|
|
||||||
#pragma omp critical
|
#pragma omp critical
|
||||||
{
|
{
|
||||||
if (candidateMate[NLVer + Ghost2LocalMap[v]] == u)
|
if (candidateMate[NLVer + Ghost2LocalMap[v]] == u)
|
||||||
@@ -154,7 +156,7 @@ void processMatchedVerticesD(
|
|||||||
option = 5; // u is local
|
option = 5; // u is local
|
||||||
} // End of critical
|
} // End of critical
|
||||||
} // End of Else //A Ghost Vertex
|
} // End of Else //A Ghost Vertex
|
||||||
|
|
||||||
switch (option)
|
switch (option)
|
||||||
{
|
{
|
||||||
case -1:
|
case -1:
|
||||||
@@ -164,7 +166,7 @@ void processMatchedVerticesD(
|
|||||||
// Found a dominating edge, it is a ghost and candidateMate[NLVer + Ghost2LocalMap[w]] == v
|
// Found a dominating edge, it is a ghost and candidateMate[NLVer + Ghost2LocalMap[w]] == v
|
||||||
privateU.push_back(v);
|
privateU.push_back(v);
|
||||||
privateU.push_back(w);
|
privateU.push_back(w);
|
||||||
|
|
||||||
(*myCard)++;
|
(*myCard)++;
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
#ifdef PRINT_DEBUG_INFO_
|
||||||
cout << "\n(" << myRank << ")MATCH: (" << v << "," << w << ") ";
|
cout << "\n(" << myRank << ")MATCH: (" << v << "," << w << ") ";
|
||||||
@@ -173,16 +175,15 @@ void processMatchedVerticesD(
|
|||||||
// Decrement the counter:
|
// Decrement the counter:
|
||||||
PROCESS_CROSS_EDGE(&Counter[Ghost2LocalMap[w]], SPtr);
|
PROCESS_CROSS_EDGE(&Counter[Ghost2LocalMap[w]], SPtr);
|
||||||
case 2:
|
case 2:
|
||||||
|
|
||||||
// Found a dominating edge, it is a ghost
|
// Found a dominating edge, it is a ghost
|
||||||
ghostOwner = findOwnerOfGhost(w, verDistance, myRank, numProcs);
|
ghostOwner = findOwnerOfGhost(w, verDistance, myRank, numProcs);
|
||||||
// assert(ghostOwner != -1);
|
// assert(ghostOwner != -1);
|
||||||
// assert(ghostOwner != myRank);
|
// assert(ghostOwner != myRank);
|
||||||
#pragma omp atomic
|
|
||||||
PCounter[ghostOwner]++;
|
PCounter[ghostOwner]++;
|
||||||
(*NumMessagesBundled)++;
|
(*NumMessagesBundled)++;
|
||||||
(*msgInd)++;
|
(*msgInd)++;
|
||||||
|
|
||||||
privateQLocalVtx.push_back(v);
|
privateQLocalVtx.push_back(v);
|
||||||
privateQGhostVtx.push_back(w);
|
privateQGhostVtx.push_back(w);
|
||||||
privateQMsgType.push_back(REQUEST);
|
privateQMsgType.push_back(REQUEST);
|
||||||
@@ -191,7 +192,7 @@ void processMatchedVerticesD(
|
|||||||
case 3:
|
case 3:
|
||||||
privateU.push_back(v);
|
privateU.push_back(v);
|
||||||
privateU.push_back(w);
|
privateU.push_back(w);
|
||||||
|
|
||||||
(*myCard)++;
|
(*myCard)++;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
@@ -201,384 +202,95 @@ void processMatchedVerticesD(
|
|||||||
for (k1 = adj11; k1 < adj12; k1++) {
|
for (k1 = adj11; k1 < adj12; k1++) {
|
||||||
w = verLocInd[k1];
|
w = verLocInd[k1];
|
||||||
if ((w < StartIndex) || (w > EndIndex)) { // A ghost
|
if ((w < StartIndex) || (w > EndIndex)) { // A ghost
|
||||||
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << ")Sending a failure message: ";
|
|
||||||
cout << "\n(" << myRank << ")Ghost is " << w << " Owner is: " << findOwnerOfGhost(w, verDistance, myRank, numProcs);
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ghostOwner = findOwnerOfGhost(w, verDistance, myRank, numProcs);
|
|
||||||
// assert(ghostOwner != -1);
|
|
||||||
// assert(ghostOwner != myRank);
|
|
||||||
#pragma omp atomic
|
|
||||||
PCounter[ghostOwner]++;
|
|
||||||
(*NumMessagesBundled)++;
|
|
||||||
(*msgInd)++;
|
|
||||||
|
|
||||||
privateQLocalVtx.push_back(v);
|
|
||||||
privateQGhostVtx.push_back(w);
|
|
||||||
privateQMsgType.push_back(FAILURE);
|
|
||||||
privateQOwner.push_back(ghostOwner);
|
|
||||||
|
|
||||||
} // End of if(GHOST)
|
|
||||||
} // End of for loop
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
default:
|
|
||||||
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << ")Sending a success message: ";
|
|
||||||
cout << "\n(" << myRank << ")Ghost is " << v << " Owner is: " << findOwnerOfGhost(v, verDistance, myRank, numProcs) << "\n";
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ghostOwner = findOwnerOfGhost(v, verDistance, myRank, numProcs);
|
|
||||||
// assert(ghostOwner != -1);
|
|
||||||
// assert(ghostOwner != myRank);
|
|
||||||
|
|
||||||
(*NumMessagesBundled)++;
|
|
||||||
PCounter[ghostOwner]++;
|
|
||||||
(*msgInd)++;
|
|
||||||
|
|
||||||
privateQLocalVtx.push_back(u);
|
|
||||||
privateQGhostVtx.push_back(v);
|
|
||||||
privateQMsgType.push_back(SUCCESS);
|
|
||||||
privateQOwner.push_back(ghostOwner);
|
|
||||||
|
|
||||||
break;
|
|
||||||
} // End of switch
|
|
||||||
} // End of inner for
|
|
||||||
}
|
|
||||||
} // End of outer for
|
|
||||||
|
|
||||||
queuesTransfer(U, privateU, QLocalVtx,
|
|
||||||
QGhostVtx,
|
|
||||||
QMsgType, QOwner, privateQLocalVtx,
|
|
||||||
privateQGhostVtx,
|
|
||||||
privateQMsgType,
|
|
||||||
privateQOwner);
|
|
||||||
|
|
||||||
#pragma omp critical(U)
|
|
||||||
{
|
|
||||||
U.insert(U.end(), privateU.begin(), privateU.end());
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma omp critical(sendMessageTransfer)
|
|
||||||
{
|
|
||||||
QLocalVtx.insert(QLocalVtx.end(), privateQLocalVtx.begin(), privateQLocalVtx.end());
|
|
||||||
QGhostVtx.insert(QGhostVtx.end(), privateQGhostVtx.begin(), privateQGhostVtx.end());
|
|
||||||
QMsgType.insert(QMsgType.end(), privateQMsgType.begin(), privateQMsgType.end());
|
|
||||||
QOwner.insert(QOwner.end(), privateQOwner.begin(), privateQOwner.end());
|
|
||||||
}
|
|
||||||
|
|
||||||
privateU.clear();
|
|
||||||
privateQLocalVtx.clear();
|
|
||||||
privateQGhostVtx.clear();
|
|
||||||
privateQMsgType.clear();
|
|
||||||
privateQOwner.clear();
|
|
||||||
|
|
||||||
} // End of while ( !U.empty() )
|
|
||||||
|
|
||||||
#ifdef COUNT_LOCAL_VERTEX
|
|
||||||
printf("Count local vertexes: %ld for thread %d of processor %d\n",
|
|
||||||
localVertices,
|
|
||||||
omp_get_thread_num(),
|
|
||||||
myRank);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
} // End of parallel region
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void processMatchedVerticesS(
|
|
||||||
MilanLongInt NLVer,
|
|
||||||
vector<MilanLongInt> &UChunkBeingProcessed,
|
|
||||||
vector<MilanLongInt> &U,
|
|
||||||
vector<MilanLongInt> &privateU,
|
|
||||||
MilanLongInt StartIndex,
|
|
||||||
MilanLongInt EndIndex,
|
|
||||||
MilanLongInt *myCard,
|
|
||||||
MilanLongInt *msgInd,
|
|
||||||
MilanLongInt *NumMessagesBundled,
|
|
||||||
MilanLongInt *SPtr,
|
|
||||||
MilanLongInt *verLocPtr,
|
|
||||||
MilanLongInt *verLocInd,
|
|
||||||
MilanLongInt *verDistance,
|
|
||||||
MilanLongInt *PCounter,
|
|
||||||
vector<MilanLongInt> &Counter,
|
|
||||||
MilanInt myRank,
|
|
||||||
MilanInt numProcs,
|
|
||||||
MilanLongInt *candidateMate,
|
|
||||||
vector<MilanLongInt> &GMate,
|
|
||||||
MilanLongInt *Mate,
|
|
||||||
map<MilanLongInt, MilanLongInt> &Ghost2LocalMap,
|
|
||||||
MilanFloat *edgeLocWeight,
|
|
||||||
vector<MilanLongInt> &QLocalVtx,
|
|
||||||
vector<MilanLongInt> &QGhostVtx,
|
|
||||||
vector<MilanLongInt> &QMsgType,
|
|
||||||
vector<MilanInt> &QOwner,
|
|
||||||
vector<MilanLongInt> &privateQLocalVtx,
|
|
||||||
vector<MilanLongInt> &privateQGhostVtx,
|
|
||||||
vector<MilanLongInt> &privateQMsgType,
|
|
||||||
vector<MilanInt> &privateQOwner)
|
|
||||||
{
|
|
||||||
|
|
||||||
MilanLongInt adj1, adj2, adj11, adj12, k, k1, v = -1, w = -1, ghostOwner;
|
|
||||||
int option;
|
|
||||||
MilanLongInt mateVal;
|
|
||||||
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << "=========================************===============================" << endl;
|
|
||||||
fflush(stdout);
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef COUNT_LOCAL_VERTEX
|
|
||||||
MilanLongInt localVertices = 0;
|
|
||||||
#endif
|
|
||||||
//#pragma omp parallel private(k, w, v, k1, adj1, adj2, adj11, adj12, ghostOwner, option) \
|
|
||||||
firstprivate(privateU, StartIndex, EndIndex, privateQLocalVtx, privateQGhostVtx, \
|
|
||||||
privateQMsgType, privateQOwner, UChunkBeingProcessed) \
|
|
||||||
default(shared) num_threads(NUM_THREAD) \
|
|
||||||
reduction(+ \
|
|
||||||
: msgInd[:1], PCounter \
|
|
||||||
[:numProcs], myCard \
|
|
||||||
[:1], NumMessagesBundled \
|
|
||||||
[:1])
|
|
||||||
{
|
|
||||||
|
|
||||||
while (!U.empty()) {
|
|
||||||
|
|
||||||
extractUChunk(UChunkBeingProcessed, U, privateU);
|
|
||||||
|
|
||||||
for (MilanLongInt u : UChunkBeingProcessed) {
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << ")u: " << u;
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
if ((u >= StartIndex) && (u <= EndIndex)) { // Process Only the Local Vertices
|
|
||||||
|
|
||||||
#ifdef COUNT_LOCAL_VERTEX
|
|
||||||
localVertices++;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Get the Adjacency list for u
|
|
||||||
adj1 = verLocPtr[u - StartIndex]; // Pointer
|
|
||||||
adj2 = verLocPtr[u - StartIndex + 1];
|
|
||||||
for (k = adj1; k < adj2; k++) {
|
|
||||||
option = -1;
|
|
||||||
v = verLocInd[k];
|
|
||||||
|
|
||||||
if ((v >= StartIndex) && (v <= EndIndex)) { // If Local Vertex:
|
|
||||||
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << ")v: " << v << " c(v)= " << candidateMate[v - StartIndex] << " Mate[v]: " << Mate[v];
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
#pragma omp atomic read
|
|
||||||
mateVal = Mate[v - StartIndex];
|
|
||||||
// If the current vertex is pointing to a matched vertex and is not matched
|
|
||||||
if (mateVal < 0) {
|
|
||||||
#pragma omp critical
|
|
||||||
{
|
|
||||||
#pragma omp atomic read
|
|
||||||
mateVal = Mate[v - StartIndex];
|
|
||||||
// If the current vertex is pointing to a matched vertex and is not matched
|
|
||||||
if (mateVal < 0) {
|
|
||||||
|
|
||||||
if (candidateMate[v - StartIndex] == u) {
|
|
||||||
// Start: PARALLEL_PROCESS_EXPOSED_VERTEX_B(v)
|
|
||||||
w = computeCandidateMateS(verLocPtr[v - StartIndex],
|
|
||||||
verLocPtr[v - StartIndex + 1],
|
|
||||||
edgeLocWeight, 0,
|
|
||||||
verLocInd, StartIndex, EndIndex,
|
|
||||||
GMate, Mate, Ghost2LocalMap);
|
|
||||||
candidateMate[v - StartIndex] = w;
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << ")" << v << " Points to: " << w;
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
// If found a dominating edge:
|
|
||||||
if (w >= 0) {
|
|
||||||
if ((w < StartIndex) || (w > EndIndex)) { // A ghost
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << ")Sending a request message:";
|
|
||||||
cout << "\n(" << myRank << ")Ghost is " << w << " Owner is: " << findOwnerOfGhost(w, verDistance, myRank, numProcs);
|
|
||||||
#endif
|
|
||||||
option = 2;
|
|
||||||
|
|
||||||
if (candidateMate[NLVer + Ghost2LocalMap[w]] == v) {
|
|
||||||
option = 1;
|
|
||||||
Mate[v - StartIndex] = w; // v is a local vertex
|
|
||||||
GMate[Ghost2LocalMap[w]] = v; // w is a ghost vertex
|
|
||||||
|
|
||||||
} // End of if CandidateMate[w] = v
|
|
||||||
} // End of if a Ghost Vertex
|
|
||||||
else { // w is a local vertex
|
|
||||||
if (candidateMate[w - StartIndex] == v) {
|
|
||||||
option = 3;
|
|
||||||
Mate[v - StartIndex] = w; // v is a local vertex
|
|
||||||
Mate[w - StartIndex] = v; // w is a local vertex
|
|
||||||
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << ")MATCH: (" << v << "," << w << ") ";
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
} // End of if(CandidateMate(w) = v
|
|
||||||
} // End of Else
|
|
||||||
} // End of if(w >=0)
|
|
||||||
else
|
|
||||||
option = 4; // End of Else: w == -1
|
|
||||||
// End: PARALLEL_PROCESS_EXPOSED_VERTEX_B(v)
|
|
||||||
} // End of If (candidateMate[v-StartIndex] == u
|
|
||||||
}
|
|
||||||
} // End of task
|
|
||||||
} // mateval < 0
|
|
||||||
} // End of if ( (v >= StartIndex) && (v <= EndIndex) ) //If Local Vertex:
|
|
||||||
else { // Neighbor is a ghost vertex
|
|
||||||
|
|
||||||
#pragma omp critical
|
|
||||||
{
|
|
||||||
if (candidateMate[NLVer + Ghost2LocalMap[v]] == u)
|
|
||||||
candidateMate[NLVer + Ghost2LocalMap[v]] = -1;
|
|
||||||
if (v != Mate[u - StartIndex])
|
|
||||||
option = 5; // u is local
|
|
||||||
} // End of critical
|
|
||||||
} // End of Else //A Ghost Vertex
|
|
||||||
|
|
||||||
switch (option)
|
|
||||||
{
|
|
||||||
case -1:
|
|
||||||
// No things to do
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
// Found a dominating edge, it is a ghost and candidateMate[NLVer + Ghost2LocalMap[w]] == v
|
|
||||||
privateU.push_back(v);
|
|
||||||
privateU.push_back(w);
|
|
||||||
|
|
||||||
(*myCard)++;
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << ")MATCH: (" << v << "," << w << ") ";
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
// Decrement the counter:
|
|
||||||
PROCESS_CROSS_EDGE(&Counter[Ghost2LocalMap[w]], SPtr);
|
|
||||||
case 2:
|
|
||||||
|
|
||||||
// Found a dominating edge, it is a ghost
|
|
||||||
ghostOwner = findOwnerOfGhost(w, verDistance, myRank, numProcs);
|
|
||||||
// assert(ghostOwner != -1);
|
|
||||||
// assert(ghostOwner != myRank);
|
|
||||||
#pragma omp atomic
|
|
||||||
PCounter[ghostOwner]++;
|
|
||||||
(*NumMessagesBundled)++;
|
|
||||||
(*msgInd)++;
|
|
||||||
|
|
||||||
privateQLocalVtx.push_back(v);
|
|
||||||
privateQGhostVtx.push_back(w);
|
|
||||||
privateQMsgType.push_back(REQUEST);
|
|
||||||
privateQOwner.push_back(ghostOwner);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
privateU.push_back(v);
|
|
||||||
privateU.push_back(w);
|
|
||||||
|
|
||||||
(*myCard)++;
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
// Could not find a dominating vertex
|
|
||||||
adj11 = verLocPtr[v - StartIndex];
|
|
||||||
adj12 = verLocPtr[v - StartIndex + 1];
|
|
||||||
for (k1 = adj11; k1 < adj12; k1++) {
|
|
||||||
w = verLocInd[k1];
|
|
||||||
if ((w < StartIndex) || (w > EndIndex)) { // A ghost
|
|
||||||
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
#ifdef PRINT_DEBUG_INFO_
|
||||||
cout << "\n(" << myRank << ")Sending a failure message: ";
|
cout << "\n(" << myRank << ")Sending a failure message: ";
|
||||||
cout << "\n(" << myRank << ")Ghost is " << w << " Owner is: " << findOwnerOfGhost(w, verDistance, myRank, numProcs);
|
cout << "\n(" << myRank << ")Ghost is " << w << " Owner is: " << findOwnerOfGhost(w, verDistance, myRank, numProcs);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ghostOwner = findOwnerOfGhost(w, verDistance, myRank, numProcs);
|
ghostOwner = findOwnerOfGhost(w, verDistance, myRank, numProcs);
|
||||||
// assert(ghostOwner != -1);
|
// assert(ghostOwner != -1);
|
||||||
// assert(ghostOwner != myRank);
|
// assert(ghostOwner != myRank);
|
||||||
#pragma omp atomic
|
|
||||||
PCounter[ghostOwner]++;
|
PCounter[ghostOwner]++;
|
||||||
(*NumMessagesBundled)++;
|
(*NumMessagesBundled)++;
|
||||||
(*msgInd)++;
|
(*msgInd)++;
|
||||||
|
|
||||||
privateQLocalVtx.push_back(v);
|
privateQLocalVtx.push_back(v);
|
||||||
privateQGhostVtx.push_back(w);
|
privateQGhostVtx.push_back(w);
|
||||||
privateQMsgType.push_back(FAILURE);
|
privateQMsgType.push_back(FAILURE);
|
||||||
privateQOwner.push_back(ghostOwner);
|
privateQOwner.push_back(ghostOwner);
|
||||||
|
|
||||||
} // End of if(GHOST)
|
} // End of if(GHOST)
|
||||||
} // End of for loop
|
} // End of for loop
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
default:
|
default:
|
||||||
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
#ifdef PRINT_DEBUG_INFO_
|
||||||
cout << "\n(" << myRank << ")Sending a success message: ";
|
cout << "\n(" << myRank << ")Sending a success message: ";
|
||||||
cout << "\n(" << myRank << ")Ghost is " << v << " Owner is: " << findOwnerOfGhost(v, verDistance, myRank, numProcs) << "\n";
|
cout << "\n(" << myRank << ")Ghost is " << v << " Owner is: " << findOwnerOfGhost(v, verDistance, myRank, numProcs) << "\n";
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ghostOwner = findOwnerOfGhost(v, verDistance, myRank, numProcs);
|
ghostOwner = findOwnerOfGhost(v, verDistance, myRank, numProcs);
|
||||||
// assert(ghostOwner != -1);
|
// assert(ghostOwner != -1);
|
||||||
// assert(ghostOwner != myRank);
|
// assert(ghostOwner != myRank);
|
||||||
|
|
||||||
(*NumMessagesBundled)++;
|
(*NumMessagesBundled)++;
|
||||||
PCounter[ghostOwner]++;
|
PCounter[ghostOwner]++;
|
||||||
(*msgInd)++;
|
(*msgInd)++;
|
||||||
|
|
||||||
privateQLocalVtx.push_back(u);
|
privateQLocalVtx.push_back(u);
|
||||||
privateQGhostVtx.push_back(v);
|
privateQGhostVtx.push_back(v);
|
||||||
privateQMsgType.push_back(SUCCESS);
|
privateQMsgType.push_back(SUCCESS);
|
||||||
privateQOwner.push_back(ghostOwner);
|
privateQOwner.push_back(ghostOwner);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
} // End of switch
|
} // End of switch
|
||||||
|
|
||||||
} // End of inner for
|
} // End of inner for
|
||||||
}
|
}
|
||||||
} // End of outer for
|
} // End of outer for
|
||||||
|
|
||||||
queuesTransfer(U, privateU, QLocalVtx,
|
queuesTransfer(U, privateU, QLocalVtx,
|
||||||
QGhostVtx,
|
QGhostVtx,
|
||||||
QMsgType, QOwner, privateQLocalVtx,
|
QMsgType, QOwner, privateQLocalVtx,
|
||||||
privateQGhostVtx,
|
privateQGhostVtx,
|
||||||
privateQMsgType,
|
privateQMsgType,
|
||||||
privateQOwner);
|
privateQOwner);
|
||||||
|
|
||||||
#pragma omp critical(U)
|
#pragma omp critical(U)
|
||||||
{
|
{
|
||||||
U.insert(U.end(), privateU.begin(), privateU.end());
|
U.insert(U.end(), privateU.begin(), privateU.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
privateU.clear();
|
||||||
|
|
||||||
#pragma omp critical(sendMessageTransfer)
|
#pragma omp critical(sendMessageTransfer)
|
||||||
{
|
{
|
||||||
|
|
||||||
QLocalVtx.insert(QLocalVtx.end(), privateQLocalVtx.begin(), privateQLocalVtx.end());
|
QLocalVtx.insert(QLocalVtx.end(), privateQLocalVtx.begin(), privateQLocalVtx.end());
|
||||||
QGhostVtx.insert(QGhostVtx.end(), privateQGhostVtx.begin(), privateQGhostVtx.end());
|
QGhostVtx.insert(QGhostVtx.end(), privateQGhostVtx.begin(), privateQGhostVtx.end());
|
||||||
QMsgType.insert(QMsgType.end(), privateQMsgType.begin(), privateQMsgType.end());
|
QMsgType.insert(QMsgType.end(), privateQMsgType.begin(), privateQMsgType.end());
|
||||||
QOwner.insert(QOwner.end(), privateQOwner.begin(), privateQOwner.end());
|
QOwner.insert(QOwner.end(), privateQOwner.begin(), privateQOwner.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
privateU.clear();
|
|
||||||
privateQLocalVtx.clear();
|
privateQLocalVtx.clear();
|
||||||
privateQGhostVtx.clear();
|
privateQGhostVtx.clear();
|
||||||
privateQMsgType.clear();
|
privateQMsgType.clear();
|
||||||
privateQOwner.clear();
|
privateQOwner.clear();
|
||||||
|
|
||||||
} // End of while ( !U.empty() )
|
} // End of while ( !U.empty() )
|
||||||
|
|
||||||
#ifdef COUNT_LOCAL_VERTEX
|
#ifdef COUNT_LOCAL_VERTEX
|
||||||
printf("Count local vertexes: %ld for thread %d of processor %d\n",
|
printf("Count local vertexes: %ld for thread %d of processor %d\n",
|
||||||
localVertices,
|
localVertices,
|
||||||
omp_get_thread_num(),
|
omp_get_thread_num(),
|
||||||
myRank);
|
myRank);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
} // End of parallel region
|
} // End of parallel region
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "MatchBoxPC.h"
|
#include "MatchBoxPC.h"
|
||||||
//#define DEBUG_HANG_
|
//#define DEBUG_HANG_
|
||||||
void processMatchedVerticesAndSendMessagesD(
|
#if !defined(SERIAL_MPI)
|
||||||
|
void processMatchedVerticesAndSendMessages(
|
||||||
MilanLongInt NLVer,
|
MilanLongInt NLVer,
|
||||||
vector<MilanLongInt> &UChunkBeingProcessed,
|
vector<MilanLongInt> &UChunkBeingProcessed,
|
||||||
vector<MilanLongInt> &U,
|
vector<MilanLongInt> &U,
|
||||||
@@ -26,302 +27,6 @@ void processMatchedVerticesAndSendMessagesD(
|
|||||||
vector<MilanLongInt> &QLocalVtx,
|
vector<MilanLongInt> &QLocalVtx,
|
||||||
vector<MilanLongInt> &QGhostVtx,
|
vector<MilanLongInt> &QGhostVtx,
|
||||||
vector<MilanLongInt> &QMsgType,
|
vector<MilanLongInt> &QMsgType,
|
||||||
vector<MilanInt> &QOwner,
|
|
||||||
vector<MilanLongInt> &privateQLocalVtx,
|
|
||||||
vector<MilanLongInt> &privateQGhostVtx,
|
|
||||||
vector<MilanLongInt> &privateQMsgType,
|
|
||||||
vector<MilanInt> &privateQOwner,
|
|
||||||
MPI_Comm comm,
|
|
||||||
MilanLongInt *msgActual,
|
|
||||||
vector<MilanLongInt> &Message)
|
|
||||||
{
|
|
||||||
|
|
||||||
MilanLongInt initialSize = QLocalVtx.size();
|
|
||||||
MilanLongInt adj1, adj2, adj11, adj12, k, k1, v = -1, w = -1, ghostOwner;
|
|
||||||
int option;
|
|
||||||
MilanLongInt mateVal;
|
|
||||||
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << "=========================************===============================" << endl;
|
|
||||||
fflush(stdout);
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef COUNT_LOCAL_VERTEX
|
|
||||||
MilanLongInt localVertices = 0;
|
|
||||||
#endif
|
|
||||||
//#pragma omp parallel private(k, w, v, k1, adj1, adj2, adj11, adj12, ghostOwner, option) \
|
|
||||||
firstprivate(Message, privateU, StartIndex, EndIndex, privateQLocalVtx, \
|
|
||||||
privateQGhostVtx, privateQMsgType, privateQOwner, UChunkBeingProcessed) \
|
|
||||||
default(shared) \
|
|
||||||
num_threads(NUM_THREAD) \
|
|
||||||
reduction(+ \
|
|
||||||
: msgInd[:1], PCounter \
|
|
||||||
[:numProcs], myCard \
|
|
||||||
[:1], NumMessagesBundled \
|
|
||||||
[:1], msgActual \
|
|
||||||
[:1])
|
|
||||||
{
|
|
||||||
|
|
||||||
while (!U.empty()) {
|
|
||||||
|
|
||||||
extractUChunk(UChunkBeingProcessed, U, privateU);
|
|
||||||
|
|
||||||
for (MilanLongInt u : UChunkBeingProcessed) {
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << ")u: " << u;
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
if ((u >= StartIndex) && (u <= EndIndex)) { // Process Only the Local Vertices
|
|
||||||
|
|
||||||
#ifdef COUNT_LOCAL_VERTEX
|
|
||||||
localVertices++;
|
|
||||||
#endif
|
|
||||||
// Get the Adjacency list for u
|
|
||||||
adj1 = verLocPtr[u - StartIndex]; // Pointer
|
|
||||||
adj2 = verLocPtr[u - StartIndex + 1];
|
|
||||||
for (k = adj1; k < adj2; k++) {
|
|
||||||
option = -1;
|
|
||||||
v = verLocInd[k];
|
|
||||||
|
|
||||||
if ((v >= StartIndex) && (v <= EndIndex)) { // If Local Vertex:
|
|
||||||
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << ")v: " << v << " c(v)= " << candidateMate[v - StartIndex] << " Mate[v]: " << Mate[v];
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
#pragma omp atomic read
|
|
||||||
mateVal = Mate[v - StartIndex];
|
|
||||||
// If the current vertex is pointing to a matched vertex and is not matched
|
|
||||||
if (mateVal < 0) {
|
|
||||||
#pragma omp critical
|
|
||||||
{
|
|
||||||
#pragma omp atomic read
|
|
||||||
mateVal = Mate[v - StartIndex];
|
|
||||||
// If the current vertex is pointing to a matched vertex and is not matched
|
|
||||||
if (mateVal < 0) {
|
|
||||||
|
|
||||||
if (candidateMate[v - StartIndex] == u) {
|
|
||||||
// Start: PARALLEL_PROCESS_EXPOSED_VERTEX_B(v)
|
|
||||||
w = computeCandidateMateD(verLocPtr[v - StartIndex],
|
|
||||||
verLocPtr[v - StartIndex + 1],
|
|
||||||
edgeLocWeight, 0,
|
|
||||||
verLocInd, StartIndex, EndIndex,
|
|
||||||
GMate, Mate, Ghost2LocalMap);
|
|
||||||
candidateMate[v - StartIndex] = w;
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << ")" << v << " Points to: " << w;
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
// If found a dominating edge:
|
|
||||||
if (w >= 0) {
|
|
||||||
|
|
||||||
if ((w < StartIndex) || (w > EndIndex)) { // A ghost
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << ")Sending a request message:";
|
|
||||||
cout << "\n(" << myRank << ")Ghost is " << w << " Owner is: " << findOwnerOfGhost(w, verDistance, myRank, numProcs);
|
|
||||||
#endif
|
|
||||||
option = 2;
|
|
||||||
|
|
||||||
if (candidateMate[NLVer + Ghost2LocalMap[w]] == v) {
|
|
||||||
option = 1;
|
|
||||||
Mate[v - StartIndex] = w; // v is a local vertex
|
|
||||||
GMate[Ghost2LocalMap[w]] = v; // w is a ghost vertex
|
|
||||||
|
|
||||||
} // End of if CandidateMate[w] = v
|
|
||||||
} // End of if a Ghost Vertex
|
|
||||||
else { // w is a local vertex
|
|
||||||
if (candidateMate[w - StartIndex] == v) {
|
|
||||||
option = 3;
|
|
||||||
Mate[v - StartIndex] = w; // v is a local vertex
|
|
||||||
Mate[w - StartIndex] = v; // w is a local vertex
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << ")MATCH: (" << v << "," << w << ") ";
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
} // End of if(CandidateMate(w) = v
|
|
||||||
} // End of Else
|
|
||||||
} // End of if(w >=0)
|
|
||||||
else
|
|
||||||
option = 4; // End of Else: w == -1
|
|
||||||
// End: PARALLEL_PROCESS_EXPOSED_VERTEX_B(v)
|
|
||||||
} // End of If (candidateMate[v-StartIndex] == u
|
|
||||||
}
|
|
||||||
} // End of task
|
|
||||||
} // mateval < 0
|
|
||||||
} // End of if ( (v >= StartIndex) && (v <= EndIndex) ) //If Local Vertex:
|
|
||||||
else { // Neighbor is a ghost vertex
|
|
||||||
|
|
||||||
#pragma omp critical
|
|
||||||
{
|
|
||||||
if (candidateMate[NLVer + Ghost2LocalMap[v]] == u)
|
|
||||||
candidateMate[NLVer + Ghost2LocalMap[v]] = -1;
|
|
||||||
if (v != Mate[u - StartIndex])
|
|
||||||
option = 5; // u is local
|
|
||||||
} // End of critical
|
|
||||||
} // End of Else //A Ghost Vertex
|
|
||||||
|
|
||||||
switch (option)
|
|
||||||
{
|
|
||||||
case -1:
|
|
||||||
// No things to do
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
// Found a dominating edge, it is a ghost and candidateMate[NLVer + Ghost2LocalMap[w]] == v
|
|
||||||
privateU.push_back(v);
|
|
||||||
privateU.push_back(w);
|
|
||||||
(*myCard)++;
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << ")MATCH: (" << v << "," << w << ") ";
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
// Decrement the counter:
|
|
||||||
PROCESS_CROSS_EDGE(&Counter[Ghost2LocalMap[w]], SPtr);
|
|
||||||
case 2:
|
|
||||||
|
|
||||||
// Found a dominating edge, it is a ghost
|
|
||||||
ghostOwner = findOwnerOfGhost(w, verDistance, myRank, numProcs);
|
|
||||||
|
|
||||||
// Build the Message Packet:
|
|
||||||
// Message[0] = v; // LOCAL
|
|
||||||
// Message[1] = w; // GHOST
|
|
||||||
// Message[2] = REQUEST; // TYPE
|
|
||||||
// Send a Request (Asynchronous)
|
|
||||||
// MPI_Bsend(&Message[0], 3, TypeMap<MilanLongInt>(), ghostOwner, ComputeTag, comm);
|
|
||||||
|
|
||||||
(*msgActual)++;
|
|
||||||
(*msgInd)++;
|
|
||||||
|
|
||||||
privateQLocalVtx.push_back(v);
|
|
||||||
privateQGhostVtx.push_back(w);
|
|
||||||
privateQMsgType.push_back(REQUEST);
|
|
||||||
privateQOwner.push_back(ghostOwner);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
privateU.push_back(v);
|
|
||||||
privateU.push_back(w);
|
|
||||||
(*myCard)++;
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
// Could not find a dominating vertex
|
|
||||||
adj11 = verLocPtr[v - StartIndex];
|
|
||||||
adj12 = verLocPtr[v - StartIndex + 1];
|
|
||||||
for (k1 = adj11; k1 < adj12; k1++) {
|
|
||||||
w = verLocInd[k1];
|
|
||||||
if ((w < StartIndex) || (w > EndIndex)) { // A ghost
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << ")Sending a failure message: ";
|
|
||||||
cout << "\n(" << myRank << ")Ghost is " << w << " Owner is: " << findOwnerOfGhost(w, verDistance, myRank, numProcs);
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
ghostOwner = findOwnerOfGhost(w, verDistance, myRank, numProcs);
|
|
||||||
// Build the Message Packet:
|
|
||||||
// Message[0] = v; // LOCAL
|
|
||||||
// Message[1] = w; // GHOST
|
|
||||||
// Message[2] = FAILURE; // TYPE
|
|
||||||
// Send a Request (Asynchronous)
|
|
||||||
// MPI_Bsend(&Message[0], 3, TypeMap<MilanLongInt>(), ghostOwner, ComputeTag, comm);
|
|
||||||
|
|
||||||
(*msgActual)++;
|
|
||||||
(*msgInd)++;
|
|
||||||
privateQLocalVtx.push_back(v);
|
|
||||||
privateQGhostVtx.push_back(w);
|
|
||||||
privateQMsgType.push_back(FAILURE);
|
|
||||||
privateQOwner.push_back(ghostOwner);
|
|
||||||
|
|
||||||
} // End of if(GHOST)
|
|
||||||
} // End of for loop
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
default:
|
|
||||||
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << ")Sending a success message: ";
|
|
||||||
cout << "\n(" << myRank << ")Ghost is " << v << " Owner is: " << findOwnerOfGhost(v, verDistance, myRank, numProcs) << "\n";
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ghostOwner = findOwnerOfGhost(v, verDistance, myRank, numProcs);
|
|
||||||
// Build the Message Packet:
|
|
||||||
// Message[0] = u; // LOCAL
|
|
||||||
// Message[1] = v; // GHOST
|
|
||||||
// Message[2] = SUCCESS; // TYPE
|
|
||||||
// Send a Request (Asynchronous)
|
|
||||||
// MPI_Bsend(&Message[0], 3, TypeMap<MilanLongInt>(), ghostOwner, ComputeTag, comm);
|
|
||||||
(*msgActual)++;
|
|
||||||
(*msgInd)++;
|
|
||||||
privateQLocalVtx.push_back(u);
|
|
||||||
privateQGhostVtx.push_back(v);
|
|
||||||
privateQMsgType.push_back(SUCCESS);
|
|
||||||
privateQOwner.push_back(ghostOwner);
|
|
||||||
|
|
||||||
break;
|
|
||||||
} // End of switch
|
|
||||||
} // End of inner for
|
|
||||||
}
|
|
||||||
} // End of outer for
|
|
||||||
|
|
||||||
queuesTransfer(U, privateU, QLocalVtx,
|
|
||||||
QGhostVtx,
|
|
||||||
QMsgType, QOwner, privateQLocalVtx,
|
|
||||||
privateQGhostVtx,
|
|
||||||
privateQMsgType,
|
|
||||||
privateQOwner);
|
|
||||||
|
|
||||||
} // End of while ( !U.empty() )
|
|
||||||
|
|
||||||
#ifdef COUNT_LOCAL_VERTEX
|
|
||||||
printf("Count local vertexes: %ld for thread %d of processor %d\n",
|
|
||||||
localVertices, mp_get_thread_num(), myRank);
|
|
||||||
#endif
|
|
||||||
} // End of parallel region
|
|
||||||
|
|
||||||
// Send the messages
|
|
||||||
#ifdef DEBUG_HANG_
|
|
||||||
cout << myRank<<" Sending: "<<QOwner.size()-initialSize<<" messages" <<endl;
|
|
||||||
#endif
|
|
||||||
for (int i = initialSize; i < QOwner.size(); i++) {
|
|
||||||
Message[0] = QLocalVtx[i];
|
|
||||||
Message[1] = QGhostVtx[i];
|
|
||||||
Message[2] = QMsgType[i];
|
|
||||||
ghostOwner = QOwner[i];
|
|
||||||
//MPI_Bsend(&Message[0], 3, TypeMap<MilanLongInt>(), ghostOwner, ComputeTag, comm);
|
|
||||||
//cout << myRank<<" Sending to "<<ghostOwner<<endl;
|
|
||||||
MPI_Bsend(&Message[0], 3, TypeMap<MilanLongInt>(), ghostOwner, ComputeTag, comm);
|
|
||||||
}
|
|
||||||
#ifdef DEBUG_HANG_
|
|
||||||
cout << myRank<<" Done sending messages"<<endl;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void processMatchedVerticesAndSendMessagesS(
|
|
||||||
MilanLongInt NLVer,
|
|
||||||
vector<MilanLongInt> &UChunkBeingProcessed,
|
|
||||||
vector<MilanLongInt> &U,
|
|
||||||
vector<MilanLongInt> &privateU,
|
|
||||||
MilanLongInt StartIndex,
|
|
||||||
MilanLongInt EndIndex,
|
|
||||||
MilanLongInt *myCard,
|
|
||||||
MilanLongInt *msgInd,
|
|
||||||
MilanLongInt *NumMessagesBundled,
|
|
||||||
MilanLongInt *SPtr,
|
|
||||||
MilanLongInt *verLocPtr,
|
|
||||||
MilanLongInt *verLocInd,
|
|
||||||
MilanLongInt *verDistance,
|
|
||||||
MilanLongInt *PCounter,
|
|
||||||
vector<MilanLongInt> &Counter,
|
|
||||||
MilanInt myRank,
|
|
||||||
MilanInt numProcs,
|
|
||||||
MilanLongInt *candidateMate,
|
|
||||||
vector<MilanLongInt> &GMate,
|
|
||||||
MilanLongInt *Mate,
|
|
||||||
map<MilanLongInt, MilanLongInt> &Ghost2LocalMap,
|
|
||||||
MilanFloat *edgeLocWeight,
|
|
||||||
vector<MilanLongInt> &QLocalVtx,
|
|
||||||
vector<MilanLongInt> &QGhostVtx,
|
|
||||||
vector<MilanLongInt> &QMsgType,
|
|
||||||
vector<MilanInt> &QOwner,
|
vector<MilanInt> &QOwner,
|
||||||
vector<MilanLongInt> &privateQLocalVtx,
|
vector<MilanLongInt> &privateQLocalVtx,
|
||||||
vector<MilanLongInt> &privateQGhostVtx,
|
vector<MilanLongInt> &privateQGhostVtx,
|
||||||
@@ -359,28 +64,29 @@ void processMatchedVerticesAndSendMessagesS(
|
|||||||
{
|
{
|
||||||
|
|
||||||
while (!U.empty()) {
|
while (!U.empty()) {
|
||||||
|
|
||||||
extractUChunk(UChunkBeingProcessed, U, privateU);
|
extractUChunk(UChunkBeingProcessed, U, privateU);
|
||||||
|
|
||||||
for (MilanLongInt u : UChunkBeingProcessed) {
|
for (MilanLongInt u : UChunkBeingProcessed) {
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
#ifdef PRINT_DEBUG_INFO_
|
||||||
cout << "\n(" << myRank << ")u: " << u;
|
cout << "\n(" << myRank << ")u: " << u;
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
#endif
|
#endif
|
||||||
if ((u >= StartIndex) && (u <= EndIndex)) { // Process Only the Local Vertices
|
if ((u >= StartIndex) && (u <= EndIndex)) { // Process Only the Local Vertices
|
||||||
|
|
||||||
#ifdef COUNT_LOCAL_VERTEX
|
#ifdef COUNT_LOCAL_VERTEX
|
||||||
localVertices++;
|
localVertices++;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Get the Adjacency list for u
|
// Get the Adjacency list for u
|
||||||
adj1 = verLocPtr[u - StartIndex]; // Pointer
|
adj1 = verLocPtr[u - StartIndex]; // Pointer
|
||||||
adj2 = verLocPtr[u - StartIndex + 1];
|
adj2 = verLocPtr[u - StartIndex + 1];
|
||||||
for (k = adj1; k < adj2; k++) {
|
for (k = adj1; k < adj2; k++) {
|
||||||
option = -1;
|
option = -1;
|
||||||
v = verLocInd[k];
|
v = verLocInd[k];
|
||||||
|
|
||||||
if ((v >= StartIndex) && (v <= EndIndex)) { // If Local Vertex:
|
if ((v >= StartIndex) && (v <= EndIndex)) { // If Local Vertex:
|
||||||
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
#ifdef PRINT_DEBUG_INFO_
|
||||||
cout << "\n(" << myRank << ")v: " << v << " c(v)= " << candidateMate[v - StartIndex] << " Mate[v]: " << Mate[v];
|
cout << "\n(" << myRank << ")v: " << v << " c(v)= " << candidateMate[v - StartIndex] << " Mate[v]: " << Mate[v];
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
@@ -391,62 +97,63 @@ void processMatchedVerticesAndSendMessagesS(
|
|||||||
if (mateVal < 0) {
|
if (mateVal < 0) {
|
||||||
#pragma omp critical
|
#pragma omp critical
|
||||||
{
|
{
|
||||||
#pragma omp atomic read
|
if (candidateMate[v - StartIndex] == u) {
|
||||||
mateVal = Mate[v - StartIndex];
|
// Start: PARALLEL_PROCESS_EXPOSED_VERTEX_B(v)
|
||||||
// If the current vertex is pointing to a matched vertex and is not matched
|
w = computeCandidateMate(verLocPtr[v - StartIndex],
|
||||||
if (mateVal < 0) {
|
verLocPtr[v - StartIndex + 1],
|
||||||
|
edgeLocWeight, 0,
|
||||||
|
verLocInd,
|
||||||
|
StartIndex,
|
||||||
|
EndIndex,
|
||||||
|
GMate,
|
||||||
|
Mate,
|
||||||
|
Ghost2LocalMap);
|
||||||
|
|
||||||
|
candidateMate[v - StartIndex] = w;
|
||||||
|
|
||||||
if (candidateMate[v - StartIndex] == u) {
|
|
||||||
// Start: PARALLEL_PROCESS_EXPOSED_VERTEX_B(v)
|
|
||||||
w = computeCandidateMateS(verLocPtr[v - StartIndex],
|
|
||||||
verLocPtr[v - StartIndex + 1],
|
|
||||||
edgeLocWeight, 0,
|
|
||||||
verLocInd, StartIndex, EndIndex,
|
|
||||||
GMate, Mate, Ghost2LocalMap);
|
|
||||||
candidateMate[v - StartIndex] = w;
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
#ifdef PRINT_DEBUG_INFO_
|
||||||
cout << "\n(" << myRank << ")" << v << " Points to: " << w;
|
cout << "\n(" << myRank << ")" << v << " Points to: " << w;
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
#endif
|
#endif
|
||||||
// If found a dominating edge:
|
// If found a dominating edge:
|
||||||
if (w >= 0) {
|
if (w >= 0) {
|
||||||
|
|
||||||
|
if ((w < StartIndex) || (w > EndIndex)) { // A ghost
|
||||||
|
#ifdef PRINT_DEBUG_INFO_
|
||||||
|
cout << "\n(" << myRank << ")Sending a request message:";
|
||||||
|
cout << "\n(" << myRank << ")Ghost is " << w << " Owner is: " << findOwnerOfGhost(w, verDistance, myRank, numProcs);
|
||||||
|
#endif
|
||||||
|
option = 2;
|
||||||
|
|
||||||
if ((w < StartIndex) || (w > EndIndex)) { // A ghost
|
if (candidateMate[NLVer + Ghost2LocalMap[w]] == v) {
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
option = 1;
|
||||||
cout << "\n(" << myRank << ")Sending a request message:";
|
Mate[v - StartIndex] = w; // v is a local vertex
|
||||||
cout << "\n(" << myRank << ")Ghost is " << w << " Owner is: " << findOwnerOfGhost(w, verDistance, myRank, numProcs);
|
GMate[Ghost2LocalMap[w]] = v; // w is a ghost vertex
|
||||||
#endif
|
|
||||||
option = 2;
|
} // End of if CandidateMate[w] = v
|
||||||
|
} // End of if a Ghost Vertex
|
||||||
|
else { // w is a local vertex
|
||||||
|
if (candidateMate[w - StartIndex] == v) {
|
||||||
|
option = 3;
|
||||||
|
Mate[v - StartIndex] = w; // v is a local vertex
|
||||||
|
Mate[w - StartIndex] = v; // w is a local vertex
|
||||||
|
|
||||||
if (candidateMate[NLVer + Ghost2LocalMap[w]] == v) {
|
|
||||||
option = 1;
|
|
||||||
Mate[v - StartIndex] = w; // v is a local vertex
|
|
||||||
GMate[Ghost2LocalMap[w]] = v; // w is a ghost vertex
|
|
||||||
|
|
||||||
} // End of if CandidateMate[w] = v
|
|
||||||
} // End of if a Ghost Vertex
|
|
||||||
else { // w is a local vertex
|
|
||||||
if (candidateMate[w - StartIndex] == v) {
|
|
||||||
option = 3;
|
|
||||||
Mate[v - StartIndex] = w; // v is a local vertex
|
|
||||||
Mate[w - StartIndex] = v; // w is a local vertex
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
#ifdef PRINT_DEBUG_INFO_
|
||||||
cout << "\n(" << myRank << ")MATCH: (" << v << "," << w << ") ";
|
cout << "\n(" << myRank << ")MATCH: (" << v << "," << w << ") ";
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
#endif
|
#endif
|
||||||
} // End of if(CandidateMate(w) = v
|
} // End of if(CandidateMate(w) = v
|
||||||
} // End of Else
|
} // End of Else
|
||||||
} // End of if(w >=0)
|
} // End of if(w >=0)
|
||||||
else
|
else
|
||||||
option = 4; // End of Else: w == -1
|
option = 4; // End of Else: w == -1
|
||||||
// End: PARALLEL_PROCESS_EXPOSED_VERTEX_B(v)
|
// End: PARALLEL_PROCESS_EXPOSED_VERTEX_B(v)
|
||||||
} // End of If (candidateMate[v-StartIndex] == u
|
} // End of If (candidateMate[v-StartIndex] == u
|
||||||
}
|
|
||||||
} // End of task
|
} // End of task
|
||||||
} // mateval < 0
|
} // mateval < 0
|
||||||
} // End of if ( (v >= StartIndex) && (v <= EndIndex) ) //If Local Vertex:
|
} // End of if ( (v >= StartIndex) && (v <= EndIndex) ) //If Local Vertex:
|
||||||
else { // Neighbor is a ghost vertex
|
else { // Neighbor is a ghost vertex
|
||||||
|
|
||||||
#pragma omp critical
|
#pragma omp critical
|
||||||
{
|
{
|
||||||
if (candidateMate[NLVer + Ghost2LocalMap[v]] == u)
|
if (candidateMate[NLVer + Ghost2LocalMap[v]] == u)
|
||||||
@@ -455,7 +162,7 @@ void processMatchedVerticesAndSendMessagesS(
|
|||||||
option = 5; // u is local
|
option = 5; // u is local
|
||||||
} // End of critical
|
} // End of critical
|
||||||
} // End of Else //A Ghost Vertex
|
} // End of Else //A Ghost Vertex
|
||||||
|
|
||||||
switch (option)
|
switch (option)
|
||||||
{
|
{
|
||||||
case -1:
|
case -1:
|
||||||
@@ -473,20 +180,20 @@ void processMatchedVerticesAndSendMessagesS(
|
|||||||
// Decrement the counter:
|
// Decrement the counter:
|
||||||
PROCESS_CROSS_EDGE(&Counter[Ghost2LocalMap[w]], SPtr);
|
PROCESS_CROSS_EDGE(&Counter[Ghost2LocalMap[w]], SPtr);
|
||||||
case 2:
|
case 2:
|
||||||
|
|
||||||
// Found a dominating edge, it is a ghost
|
// Found a dominating edge, it is a ghost
|
||||||
ghostOwner = findOwnerOfGhost(w, verDistance, myRank, numProcs);
|
ghostOwner = findOwnerOfGhost(w, verDistance, myRank, numProcs);
|
||||||
|
|
||||||
// Build the Message Packet:
|
// Build the Message Packet:
|
||||||
// Message[0] = v; // LOCAL
|
// Message[0] = v; // LOCAL
|
||||||
// Message[1] = w; // GHOST
|
// Message[1] = w; // GHOST
|
||||||
// Message[2] = REQUEST; // TYPE
|
// Message[2] = REQUEST; // TYPE
|
||||||
// Send a Request (Asynchronous)
|
// Send a Request (Asynchronous)
|
||||||
// MPI_Bsend(&Message[0], 3, TypeMap<MilanLongInt>(), ghostOwner, ComputeTag, comm);
|
// MPI_Bsend(&Message[0], 3, TypeMap<MilanLongInt>(), ghostOwner, ComputeTag, comm);
|
||||||
|
|
||||||
(*msgActual)++;
|
(*msgActual)++;
|
||||||
(*msgInd)++;
|
(*msgInd)++;
|
||||||
|
|
||||||
privateQLocalVtx.push_back(v);
|
privateQLocalVtx.push_back(v);
|
||||||
privateQGhostVtx.push_back(w);
|
privateQGhostVtx.push_back(w);
|
||||||
privateQMsgType.push_back(REQUEST);
|
privateQMsgType.push_back(REQUEST);
|
||||||
@@ -504,82 +211,94 @@ void processMatchedVerticesAndSendMessagesS(
|
|||||||
for (k1 = adj11; k1 < adj12; k1++) {
|
for (k1 = adj11; k1 < adj12; k1++) {
|
||||||
w = verLocInd[k1];
|
w = verLocInd[k1];
|
||||||
if ((w < StartIndex) || (w > EndIndex)) { // A ghost
|
if ((w < StartIndex) || (w > EndIndex)) { // A ghost
|
||||||
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
#ifdef PRINT_DEBUG_INFO_
|
||||||
cout << "\n(" << myRank << ")Sending a failure message: ";
|
cout << "\n(" << myRank << ")Sending a failure message: ";
|
||||||
cout << "\n(" << myRank << ")Ghost is " << w << " Owner is: " << findOwnerOfGhost(w, verDistance, myRank, numProcs);
|
cout << "\n(" << myRank << ")Ghost is " << w << " Owner is: " << findOwnerOfGhost(w, verDistance, myRank, numProcs);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ghostOwner = findOwnerOfGhost(w, verDistance, myRank, numProcs);
|
ghostOwner = findOwnerOfGhost(w, verDistance, myRank, numProcs);
|
||||||
|
|
||||||
// Build the Message Packet:
|
// Build the Message Packet:
|
||||||
// Message[0] = v; // LOCAL
|
// Message[0] = v; // LOCAL
|
||||||
// Message[1] = w; // GHOST
|
// Message[1] = w; // GHOST
|
||||||
// Message[2] = FAILURE; // TYPE
|
// Message[2] = FAILURE; // TYPE
|
||||||
// Send a Request (Asynchronous)
|
// Send a Request (Asynchronous)
|
||||||
// MPI_Bsend(&Message[0], 3, TypeMap<MilanLongInt>(), ghostOwner, ComputeTag, comm);
|
// MPI_Bsend(&Message[0], 3, TypeMap<MilanLongInt>(), ghostOwner, ComputeTag, comm);
|
||||||
|
|
||||||
(*msgActual)++;
|
(*msgActual)++;
|
||||||
(*msgInd)++;
|
(*msgInd)++;
|
||||||
|
|
||||||
privateQLocalVtx.push_back(v);
|
privateQLocalVtx.push_back(v);
|
||||||
privateQGhostVtx.push_back(w);
|
privateQGhostVtx.push_back(w);
|
||||||
privateQMsgType.push_back(FAILURE);
|
privateQMsgType.push_back(FAILURE);
|
||||||
privateQOwner.push_back(ghostOwner);
|
privateQOwner.push_back(ghostOwner);
|
||||||
|
|
||||||
} // End of if(GHOST)
|
} // End of if(GHOST)
|
||||||
} // End of for loop
|
} // End of for loop
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
default:
|
default:
|
||||||
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
#ifdef PRINT_DEBUG_INFO_
|
||||||
cout << "\n(" << myRank << ")Sending a success message: ";
|
cout << "\n(" << myRank << ")Sending a success message: ";
|
||||||
cout << "\n(" << myRank << ")Ghost is " << v << " Owner is: " << findOwnerOfGhost(v, verDistance, myRank, numProcs) << "\n";
|
cout << "\n(" << myRank << ")Ghost is " << v << " Owner is: " << findOwnerOfGhost(v, verDistance, myRank, numProcs) << "\n";
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ghostOwner = findOwnerOfGhost(v, verDistance, myRank, numProcs);
|
ghostOwner = findOwnerOfGhost(v, verDistance, myRank, numProcs);
|
||||||
|
|
||||||
// Build the Message Packet:
|
// Build the Message Packet:
|
||||||
// Message[0] = u; // LOCAL
|
// Message[0] = u; // LOCAL
|
||||||
// Message[1] = v; // GHOST
|
// Message[1] = v; // GHOST
|
||||||
// Message[2] = SUCCESS; // TYPE
|
// Message[2] = SUCCESS; // TYPE
|
||||||
// Send a Request (Asynchronous)
|
// Send a Request (Asynchronous)
|
||||||
// MPI_Bsend(&Message[0], 3, TypeMap<MilanLongInt>(), ghostOwner, ComputeTag, comm);
|
// MPI_Bsend(&Message[0], 3, TypeMap<MilanLongInt>(), ghostOwner, ComputeTag, comm);
|
||||||
|
|
||||||
(*msgActual)++;
|
(*msgActual)++;
|
||||||
(*msgInd)++;
|
(*msgInd)++;
|
||||||
|
|
||||||
privateQLocalVtx.push_back(u);
|
privateQLocalVtx.push_back(u);
|
||||||
privateQGhostVtx.push_back(v);
|
privateQGhostVtx.push_back(v);
|
||||||
privateQMsgType.push_back(SUCCESS);
|
privateQMsgType.push_back(SUCCESS);
|
||||||
privateQOwner.push_back(ghostOwner);
|
privateQOwner.push_back(ghostOwner);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
} // End of switch
|
} // End of switch
|
||||||
} // End of inner for
|
} // End of inner for
|
||||||
}
|
}
|
||||||
} // End of outer for
|
} // End of outer for
|
||||||
|
|
||||||
queuesTransfer(U, privateU, QLocalVtx,
|
queuesTransfer(U, privateU, QLocalVtx,
|
||||||
QGhostVtx,
|
QGhostVtx,
|
||||||
QMsgType, QOwner, privateQLocalVtx,
|
QMsgType, QOwner, privateQLocalVtx,
|
||||||
privateQGhostVtx,
|
privateQGhostVtx,
|
||||||
privateQMsgType,
|
privateQMsgType,
|
||||||
privateQOwner);
|
privateQOwner);
|
||||||
|
|
||||||
} // End of while ( !U.empty() )
|
} // End of while ( !U.empty() )
|
||||||
|
|
||||||
#ifdef COUNT_LOCAL_VERTEX
|
#ifdef COUNT_LOCAL_VERTEX
|
||||||
printf("Count local vertexes: %ld for thread %d of processor %d\n",
|
printf("Count local vertexes: %ld for thread %d of processor %d\n",
|
||||||
localVertices, mp_get_thread_num(), myRank);
|
localVertices,
|
||||||
|
omp_get_thread_num(),
|
||||||
|
myRank);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
} // End of parallel region
|
} // End of parallel region
|
||||||
|
|
||||||
// Send the messages
|
// Send the messages
|
||||||
#ifdef DEBUG_HANG_
|
#ifdef DEBUG_HANG_
|
||||||
cout << myRank<<" Sending: "<<QOwner.size()-initialSize<<" messages" <<endl;
|
cout << myRank<<" Sending: "<<QOwner.size()-initialSize<<" messages" <<endl;
|
||||||
#endif
|
#endif
|
||||||
for (int i = initialSize; i < QOwner.size(); i++) {
|
for (int i = initialSize; i < QOwner.size(); i++) {
|
||||||
|
|
||||||
Message[0] = QLocalVtx[i];
|
Message[0] = QLocalVtx[i];
|
||||||
Message[1] = QGhostVtx[i];
|
Message[1] = QGhostVtx[i];
|
||||||
Message[2] = QMsgType[i];
|
Message[2] = QMsgType[i];
|
||||||
ghostOwner = QOwner[i];
|
ghostOwner = QOwner[i];
|
||||||
|
|
||||||
//MPI_Bsend(&Message[0], 3, TypeMap<MilanLongInt>(), ghostOwner, ComputeTag, comm);
|
//MPI_Bsend(&Message[0], 3, TypeMap<MilanLongInt>(), ghostOwner, ComputeTag, comm);
|
||||||
//cout << myRank<<" Sending to "<<ghostOwner<<endl;
|
//cout << myRank<<" Sending to "<<ghostOwner<<endl;
|
||||||
MPI_Bsend(&Message[0], 3, TypeMap<MilanLongInt>(), ghostOwner, ComputeTag, comm);
|
MPI_Bsend(&Message[0], 3, TypeMap<MilanLongInt>(), ghostOwner, ComputeTag, comm);
|
||||||
@@ -588,3 +307,4 @@ void processMatchedVerticesAndSendMessagesS(
|
|||||||
cout << myRank<<" Done sending messages"<<endl;
|
cout << myRank<<" Done sending messages"<<endl;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
#include "MatchBoxPC.h"
|
#include "MatchBoxPC.h"
|
||||||
//#define DEBUG_HANG_
|
//#define DEBUG_HANG_
|
||||||
|
#if !defined(SERIAL_MPI)
|
||||||
|
|
||||||
void processMessagesD(
|
void processMessages(
|
||||||
MilanLongInt NLVer,
|
MilanLongInt NLVer,
|
||||||
MilanLongInt *Mate,
|
MilanLongInt *Mate,
|
||||||
MilanLongInt *candidateMate,
|
MilanLongInt *candidateMate,
|
||||||
@@ -138,12 +139,12 @@ void processMessagesD(
|
|||||||
if (!ReceiveBuffer.empty())
|
if (!ReceiveBuffer.empty())
|
||||||
ReceiveBuffer.clear(); // Empty it out first
|
ReceiveBuffer.clear(); // Empty it out first
|
||||||
ReceiveBuffer.resize(bundleSize, -1); // Initialize
|
ReceiveBuffer.resize(bundleSize, -1); // Initialize
|
||||||
|
|
||||||
ReceiveBuffer[0] = Message[0]; // u
|
ReceiveBuffer[0] = Message[0]; // u
|
||||||
ReceiveBuffer[1] = Message[1]; // v
|
ReceiveBuffer[1] = Message[1]; // v
|
||||||
ReceiveBuffer[2] = Message[2]; // message_type
|
ReceiveBuffer[2] = Message[2]; // message_type
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_GHOST_
|
#ifdef DEBUG_GHOST_
|
||||||
if ((v < StartIndex) || (v > EndIndex)) {
|
if ((v < StartIndex) || (v > EndIndex)) {
|
||||||
cout << "\n(" << myRank << ") From ReceiveBuffer: This should not happen: u= " << u << " v= " << v << " Type= " << message_type << " StartIndex " << StartIndex << " EndIndex " << EndIndex << endl;
|
cout << "\n(" << myRank << ") From ReceiveBuffer: This should not happen: u= " << u << " v= " << v << " Type= " << message_type << " StartIndex " << StartIndex << " EndIndex " << EndIndex << endl;
|
||||||
@@ -160,7 +161,7 @@ void processMessagesD(
|
|||||||
u = ReceiveBuffer[bundleCounter - 3]; // GHOST
|
u = ReceiveBuffer[bundleCounter - 3]; // GHOST
|
||||||
v = ReceiveBuffer[bundleCounter - 2]; // LOCAL
|
v = ReceiveBuffer[bundleCounter - 2]; // LOCAL
|
||||||
message_type = ReceiveBuffer[bundleCounter - 1]; // TYPE
|
message_type = ReceiveBuffer[bundleCounter - 1]; // TYPE
|
||||||
|
|
||||||
// CASE I: REQUEST
|
// CASE I: REQUEST
|
||||||
if (message_type == REQUEST) {
|
if (message_type == REQUEST) {
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
#ifdef PRINT_DEBUG_INFO_
|
||||||
@@ -188,7 +189,7 @@ void processMessagesD(
|
|||||||
cout << "\n(" << myRank << ")MATCH: (" << v << "," << u << ") " << endl;
|
cout << "\n(" << myRank << ")MATCH: (" << v << "," << u << ") " << endl;
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PROCESS_CROSS_EDGE(&Counter[Ghost2LocalMap[u]], S);
|
PROCESS_CROSS_EDGE(&Counter[Ghost2LocalMap[u]], S);
|
||||||
} // End of if ( candidateMate[v-StartIndex] == u )e
|
} // End of if ( candidateMate[v-StartIndex] == u )e
|
||||||
} // End of if ( Mate[v] == -1 )
|
} // End of if ( Mate[v] == -1 )
|
||||||
@@ -211,9 +212,8 @@ void processMessagesD(
|
|||||||
// Process only if not already matched ( v is local)
|
// Process only if not already matched ( v is local)
|
||||||
if (candidateMate[v - StartIndex] == u) {
|
if (candidateMate[v - StartIndex] == u) {
|
||||||
// Start: PARALLEL_PROCESS_EXPOSED_VERTEX_B(v)
|
// Start: PARALLEL_PROCESS_EXPOSED_VERTEX_B(v)
|
||||||
w = computeCandidateMateD(verLocPtr[v - StartIndex], verLocPtr[v - StartIndex + 1],
|
w = computeCandidateMate(verLocPtr[v - StartIndex], verLocPtr[v - StartIndex + 1], edgeLocWeight, k,
|
||||||
edgeLocWeight, k,verLocInd, StartIndex, EndIndex,
|
verLocInd, StartIndex, EndIndex, GMate, Mate, Ghost2LocalMap);
|
||||||
GMate, Mate, Ghost2LocalMap);
|
|
||||||
candidateMate[v - StartIndex] = w;
|
candidateMate[v - StartIndex] = w;
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
#ifdef PRINT_DEBUG_INFO_
|
||||||
cout << "\n(" << myRank << ")" << v << " Points to: " << w << endl;
|
cout << "\n(" << myRank << ")" << v << " Points to: " << w << endl;
|
||||||
@@ -250,7 +250,7 @@ void processMessagesD(
|
|||||||
cout << "\n(" << myRank << ")MATCH: (" << v << "," << w << ") " << endl;
|
cout << "\n(" << myRank << ")MATCH: (" << v << "," << w << ") " << endl;
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PROCESS_CROSS_EDGE(&Counter[Ghost2LocalMap[w]], S);
|
PROCESS_CROSS_EDGE(&Counter[Ghost2LocalMap[w]], S);
|
||||||
} // End of if CandidateMate[w] = v
|
} // End of if CandidateMate[w] = v
|
||||||
} // End of if a Ghost Vertex
|
} // End of if a Ghost Vertex
|
||||||
@@ -311,321 +311,7 @@ void processMessagesD(
|
|||||||
} // End of else: CASE III
|
} // End of else: CASE III
|
||||||
} // End of else: CASE I
|
} // End of else: CASE I
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void processMessagesS(
|
|
||||||
MilanLongInt NLVer,
|
|
||||||
MilanLongInt *Mate,
|
|
||||||
MilanLongInt *candidateMate,
|
|
||||||
map<MilanLongInt, MilanLongInt> &Ghost2LocalMap,
|
|
||||||
vector<MilanLongInt> &GMate,
|
|
||||||
vector<MilanLongInt> &Counter,
|
|
||||||
MilanLongInt StartIndex,
|
|
||||||
MilanLongInt EndIndex,
|
|
||||||
MilanLongInt *myCard,
|
|
||||||
MilanLongInt *msgInd,
|
|
||||||
MilanLongInt *msgActual,
|
|
||||||
MilanFloat *edgeLocWeight,
|
|
||||||
MilanLongInt *verDistance,
|
|
||||||
MilanLongInt *verLocPtr,
|
|
||||||
MilanLongInt k,
|
|
||||||
MilanLongInt *verLocInd,
|
|
||||||
MilanInt numProcs,
|
|
||||||
MilanInt myRank,
|
|
||||||
MPI_Comm comm,
|
|
||||||
vector<MilanLongInt> &Message,
|
|
||||||
MilanLongInt numGhostEdges,
|
|
||||||
MilanLongInt u,
|
|
||||||
MilanLongInt v,
|
|
||||||
MilanLongInt *S,
|
|
||||||
vector<MilanLongInt> &U)
|
|
||||||
{
|
|
||||||
|
|
||||||
//#define PRINT_DEBUG_INFO_
|
|
||||||
|
|
||||||
MilanInt Sender;
|
|
||||||
MPI_Status computeStatus;
|
|
||||||
MilanLongInt bundleSize, w;
|
|
||||||
MilanLongInt adj11, adj12, k1;
|
|
||||||
MilanLongInt ghostOwner;
|
|
||||||
int error_codeC;
|
|
||||||
error_codeC = MPI_Comm_set_errhandler(MPI_COMM_WORLD, MPI_ERRORS_RETURN);
|
|
||||||
char error_message[MPI_MAX_ERROR_STRING];
|
|
||||||
int message_length;
|
|
||||||
MilanLongInt message_type = 0;
|
|
||||||
|
|
||||||
// Buffer to receive bundled messages
|
|
||||||
// Maximum messages that can be received from any processor is
|
|
||||||
// twice the edge cut: REQUEST; REQUEST+(FAILURE/SUCCESS)
|
|
||||||
vector<MilanLongInt> ReceiveBuffer;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
ReceiveBuffer.reserve(numGhostEdges * 2 * 3); // Three integers per cross edge
|
|
||||||
}
|
|
||||||
catch (length_error)
|
|
||||||
{
|
|
||||||
cout << "Error in function algoDistEdgeApproxDominatingEdgesMessageBundling: \n";
|
|
||||||
cout << "Not enough memory to allocate the internal variables \n";
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout
|
|
||||||
<< "\n(" << myRank << "=========================************===============================" << endl;
|
|
||||||
fflush(stdout);
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << ")About to begin Message processing phase ... *S=" << *S << endl;
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << "=========================************===============================" << endl;
|
|
||||||
fflush(stdout);
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
// BLOCKING RECEIVE:
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << " Waiting for blocking receive..." << endl;
|
|
||||||
fflush(stdout);
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//cout << myRank<<" Receiving ...";
|
|
||||||
error_codeC = MPI_Recv(&Message[0], 3, TypeMap<MilanLongInt>(), MPI_ANY_SOURCE, ComputeTag, comm, &computeStatus);
|
|
||||||
if (error_codeC != MPI_SUCCESS)
|
|
||||||
{
|
|
||||||
MPI_Error_string(error_codeC, error_message, &message_length);
|
|
||||||
cout << "\n*Error in call to MPI_Receive on Slave: " << error_message << "\n";
|
|
||||||
fflush(stdout);
|
|
||||||
}
|
|
||||||
Sender = computeStatus.MPI_SOURCE;
|
|
||||||
//cout << " ...from "<<Sender << endl;
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << ")Received message from Process " << Sender << " Type= " << Message[2] << endl;
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (Message[2] == SIZEINFO) {
|
|
||||||
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << ")Received bundled message from Process " << Sender << " Size= " << Message[0] << endl;
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
bundleSize = Message[0]; //#of integers in the message
|
|
||||||
// Build the Message Buffer:
|
|
||||||
if (!ReceiveBuffer.empty())
|
|
||||||
ReceiveBuffer.clear(); // Empty it out first
|
|
||||||
ReceiveBuffer.resize(bundleSize, -1); // Initialize
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << ")Message Bundle Before: " << endl;
|
|
||||||
for (int i = 0; i < bundleSize; i++)
|
|
||||||
cout << ReceiveBuffer[i] << ",";
|
|
||||||
cout << endl;
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
// Receive the message
|
|
||||||
//cout << myRank<<" Receiving from "<<Sender<<endl;
|
|
||||||
error_codeC = MPI_Recv(&ReceiveBuffer[0], bundleSize, TypeMap<MilanLongInt>(), Sender, BundleTag, comm, &computeStatus);
|
|
||||||
if (error_codeC != MPI_SUCCESS) {
|
|
||||||
MPI_Error_string(error_codeC, error_message, &message_length);
|
|
||||||
cout << "\n*Error in call to MPI_Receive on processor " << myRank << " Error: " << error_message << "\n";
|
|
||||||
fflush(stdout);
|
|
||||||
}
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << ")Message Bundle After: " << endl;
|
|
||||||
for (int i = 0; i < bundleSize; i++)
|
|
||||||
cout << ReceiveBuffer[i] << ",";
|
|
||||||
cout << endl;
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
} else { // Just a single message:
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << ")Received regular message from Process " << Sender << " u= " << Message[0] << " v= " << Message[1] << endl;
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
// Add the current message to Queue:
|
|
||||||
bundleSize = 3; //#of integers in the message
|
|
||||||
// Build the Message Buffer:
|
|
||||||
if (!ReceiveBuffer.empty())
|
|
||||||
ReceiveBuffer.clear(); // Empty it out first
|
|
||||||
ReceiveBuffer.resize(bundleSize, -1); // Initialize
|
|
||||||
|
|
||||||
ReceiveBuffer[0] = Message[0]; // u
|
|
||||||
ReceiveBuffer[1] = Message[1]; // v
|
|
||||||
ReceiveBuffer[2] = Message[2]; // message_type
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef DEBUG_GHOST_
|
|
||||||
if ((v < StartIndex) || (v > EndIndex)) {
|
|
||||||
cout << "\n(" << myRank << ") From ReceiveBuffer: This should not happen: u= " << u << " v= " << v << " Type= " << message_type << " StartIndex " << StartIndex << " EndIndex " << EndIndex << endl;
|
|
||||||
fflush(stdout);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << ")Processing message: u= " << u << " v= " << v << " Type= " << message_type << endl;
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Most of the time bundleSize == 3, thus, it's not worth parallelizing thi loop
|
|
||||||
for (MilanLongInt bundleCounter = 3; bundleCounter < bundleSize + 3; bundleCounter += 3) {
|
|
||||||
u = ReceiveBuffer[bundleCounter - 3]; // GHOST
|
|
||||||
v = ReceiveBuffer[bundleCounter - 2]; // LOCAL
|
|
||||||
message_type = ReceiveBuffer[bundleCounter - 1]; // TYPE
|
|
||||||
|
|
||||||
// CASE I: REQUEST
|
|
||||||
if (message_type == REQUEST) {
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << ")Message type is REQUEST" << endl;
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
#ifdef DEBUG_GHOST_
|
|
||||||
if ((v < 0) || (v < StartIndex) || ((v - StartIndex) > NLVer)) {
|
|
||||||
cout << "\n(" << myRank << ") case 1 Bad address " << v << " " << StartIndex << " " << v - StartIndex << " " << NLVer << endl;
|
|
||||||
fflush(stdout);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (Mate[v - StartIndex] == -1) {
|
|
||||||
// Process only if not already matched (v is local)
|
|
||||||
candidateMate[NLVer + Ghost2LocalMap[u]] = v; // Set CandidateMate for the ghost
|
|
||||||
if (candidateMate[v - StartIndex] == u) {
|
|
||||||
GMate[Ghost2LocalMap[u]] = v; // u is ghost
|
|
||||||
Mate[v - StartIndex] = u; // v is local
|
|
||||||
U.push_back(v);
|
|
||||||
U.push_back(u);
|
|
||||||
(*myCard)++;
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << ")MATCH: (" << v << "," << u << ") " << endl;
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
PROCESS_CROSS_EDGE(&Counter[Ghost2LocalMap[u]], S);
|
|
||||||
} // End of if ( candidateMate[v-StartIndex] == u )e
|
|
||||||
} // End of if ( Mate[v] == -1 )
|
|
||||||
} // End of REQUEST
|
|
||||||
else { // CASE II: SUCCESS
|
|
||||||
if (message_type == SUCCESS) {
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << ")Message type is SUCCESS" << endl;
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
GMate[Ghost2LocalMap[u]] = EndIndex + 1; // Set a Dummy Mate to make sure that we do not (u is a ghost) process it again
|
|
||||||
PROCESS_CROSS_EDGE(&Counter[Ghost2LocalMap[u]], S);
|
|
||||||
#ifdef DEBUG_GHOST_
|
|
||||||
if ((v < 0) || (v < StartIndex) || ((v - StartIndex) > NLVer)) {
|
|
||||||
cout << "\n(" << myRank << ") case 2 Bad address " << v << " " << StartIndex << " " << v - StartIndex << " " << NLVer << endl;
|
|
||||||
fflush(stdout);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (Mate[v - StartIndex] == -1) {
|
|
||||||
// Process only if not already matched ( v is local)
|
|
||||||
if (candidateMate[v - StartIndex] == u) {
|
|
||||||
// Start: PARALLEL_PROCESS_EXPOSED_VERTEX_B(v)
|
|
||||||
w = computeCandidateMateS(verLocPtr[v - StartIndex], verLocPtr[v - StartIndex + 1],
|
|
||||||
edgeLocWeight, k,verLocInd, StartIndex, EndIndex,
|
|
||||||
GMate, Mate, Ghost2LocalMap);
|
|
||||||
candidateMate[v - StartIndex] = w;
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << ")" << v << " Points to: " << w << endl;
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
// If found a dominating edge:
|
|
||||||
if (w >= 0) {
|
|
||||||
if ((w < StartIndex) || (w > EndIndex)) {
|
|
||||||
// w is a ghost
|
|
||||||
// Build the Message Packet:
|
|
||||||
Message[0] = v; // LOCAL
|
|
||||||
Message[1] = w; // GHOST
|
|
||||||
Message[2] = REQUEST; // TYPE
|
|
||||||
// Send a Request (Asynchronous)
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << ")Sending a request message: ";
|
|
||||||
cout << "\n(" << myRank << ")Ghost is " << w << " Owner is: " << findOwnerOfGhost(w, verDistance, myRank, numProcs) << endl;
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
ghostOwner = findOwnerOfGhost(w, verDistance, myRank, numProcs);
|
|
||||||
//assert(ghostOwner != -1);
|
|
||||||
//assert(ghostOwner != myRank);
|
|
||||||
//cout << myRank<<" Sending to "<<ghostOwner<<endl;
|
|
||||||
MPI_Bsend(&Message[0], 3, TypeMap<MilanLongInt>(), ghostOwner, ComputeTag, comm);
|
|
||||||
(*msgInd)++;
|
|
||||||
(*msgActual)++;
|
|
||||||
if (candidateMate[NLVer + Ghost2LocalMap[w]] == v) {
|
|
||||||
Mate[v - StartIndex] = w; // v is local
|
|
||||||
GMate[Ghost2LocalMap[w]] = v; // w is ghost
|
|
||||||
U.push_back(v);
|
|
||||||
U.push_back(w);
|
|
||||||
(*myCard)++;
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << ")MATCH: (" << v << "," << w << ") " << endl;
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
PROCESS_CROSS_EDGE(&Counter[Ghost2LocalMap[w]], S);
|
|
||||||
} // End of if CandidateMate[w] = v
|
|
||||||
} // End of if a Ghost Vertex
|
|
||||||
else { // w is a local vertex
|
|
||||||
if (candidateMate[w - StartIndex] == v) {
|
|
||||||
Mate[v - StartIndex] = w; // v is local
|
|
||||||
Mate[w - StartIndex] = v; // w is local
|
|
||||||
// Q.push_back(u);
|
|
||||||
U.push_back(v);
|
|
||||||
U.push_back(w);
|
|
||||||
(*myCard)++;
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << ")MATCH: (" << v << "," << w << ") " << endl;
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
} // End of if(CandidateMate(w) = v
|
|
||||||
} // End of Else
|
|
||||||
} // End of if(w >=0)
|
|
||||||
else { // No dominant edge found
|
|
||||||
adj11 = verLocPtr[v - StartIndex];
|
|
||||||
adj12 = verLocPtr[v - StartIndex + 1];
|
|
||||||
for (k1 = adj11; k1 < adj12; k1++) {
|
|
||||||
w = verLocInd[k1];
|
|
||||||
if ((w < StartIndex) || (w > EndIndex)) {
|
|
||||||
// A ghost
|
|
||||||
// Build the Message Packet:
|
|
||||||
Message[0] = v; // LOCAL
|
|
||||||
Message[1] = w; // GHOST
|
|
||||||
Message[2] = FAILURE; // TYPE
|
|
||||||
// Send a Request (Asynchronous)
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << ")Sending a failure message: ";
|
|
||||||
cout << "\n(" << myRank << ")Ghost is " << w << " Owner is: " << findOwnerOfGhost(w, verDistance, myRank, numProcs) << endl;
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
ghostOwner = findOwnerOfGhost(w, verDistance, myRank, numProcs);
|
|
||||||
//assert(ghostOwner != -1);
|
|
||||||
//assert(ghostOwner != myRank);
|
|
||||||
//cout << myRank<<" Sending to "<<ghostOwner<<endl;
|
|
||||||
MPI_Bsend(&Message[0], 3, TypeMap<MilanLongInt>(), ghostOwner, ComputeTag, comm);
|
|
||||||
(*msgInd)++;
|
|
||||||
(*msgActual)++;
|
|
||||||
} // End of if(GHOST)
|
|
||||||
} // End of for loop
|
|
||||||
} // End of Else: w == -1
|
|
||||||
// End: PARALLEL_PROCESS_EXPOSED_VERTEX_B(v)
|
|
||||||
} // End of if ( candidateMate[v-StartIndex] == u )
|
|
||||||
} // End of if ( Mate[v] == -1 )
|
|
||||||
} // End of if ( message_type == SUCCESS )
|
|
||||||
else {
|
|
||||||
// CASE III: FAILURE
|
|
||||||
#ifdef PRINT_DEBUG_INFO_
|
|
||||||
cout << "\n(" << myRank << ")Message type is FAILURE" << endl;
|
|
||||||
fflush(stdout);
|
|
||||||
#endif
|
|
||||||
GMate[Ghost2LocalMap[u]] = EndIndex + 1; // Set a Dummy Mate to make sure that we do not (u is a ghost) process this anymore
|
|
||||||
PROCESS_CROSS_EDGE(&Counter[Ghost2LocalMap[u]], S); // Decrease the counter
|
|
||||||
} // End of else: CASE III
|
|
||||||
} // End of else: CASE I
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "MatchBoxPC.h"
|
#include "MatchBoxPC.h"
|
||||||
|
|
||||||
void queuesTransfer(vector<MilanLongInt> &U,
|
void queuesTransfer(vector<MilanLongInt> &U,
|
||||||
vector<MilanLongInt> &privateU,
|
vector<MilanLongInt> &privateU,
|
||||||
vector<MilanLongInt> &QLocalVtx,
|
vector<MilanLongInt> &QLocalVtx,
|
||||||
@@ -14,16 +15,19 @@ void queuesTransfer(vector<MilanLongInt> &U,
|
|||||||
#pragma omp critical(U)
|
#pragma omp critical(U)
|
||||||
{
|
{
|
||||||
U.insert(U.end(), privateU.begin(), privateU.end());
|
U.insert(U.end(), privateU.begin(), privateU.end());
|
||||||
|
}
|
||||||
|
|
||||||
|
privateU.clear();
|
||||||
|
|
||||||
|
#pragma omp critical(sendMessageTransfer)
|
||||||
|
{
|
||||||
|
|
||||||
//#pragma omp critical(sendMessageTransfer)
|
|
||||||
//{
|
|
||||||
QLocalVtx.insert(QLocalVtx.end(), privateQLocalVtx.begin(), privateQLocalVtx.end());
|
QLocalVtx.insert(QLocalVtx.end(), privateQLocalVtx.begin(), privateQLocalVtx.end());
|
||||||
QGhostVtx.insert(QGhostVtx.end(), privateQGhostVtx.begin(), privateQGhostVtx.end());
|
QGhostVtx.insert(QGhostVtx.end(), privateQGhostVtx.begin(), privateQGhostVtx.end());
|
||||||
QMsgType.insert(QMsgType.end(), privateQMsgType.begin(), privateQMsgType.end());
|
QMsgType.insert(QMsgType.end(), privateQMsgType.begin(), privateQMsgType.end());
|
||||||
QOwner.insert(QOwner.end(), privateQOwner.begin(), privateQOwner.end());
|
QOwner.insert(QOwner.end(), privateQOwner.begin(), privateQOwner.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
privateU.clear();
|
|
||||||
privateQLocalVtx.clear();
|
privateQLocalVtx.clear();
|
||||||
privateQGhostVtx.clear();
|
privateQGhostVtx.clear();
|
||||||
privateQMsgType.clear();
|
privateQMsgType.clear();
|
||||||
|
|||||||
@@ -1,23 +1,24 @@
|
|||||||
#include "MatchBoxPC.h"
|
#include "MatchBoxPC.h"
|
||||||
|
#if !defined(SERIAL_MPI)
|
||||||
void sendBundledMessages(MilanLongInt *numGhostEdges,
|
void sendBundledMessages(MilanLongInt *numGhostEdges,
|
||||||
MilanInt *BufferSize,
|
MilanInt *BufferSize,
|
||||||
MilanLongInt *Buffer,
|
MilanLongInt *Buffer,
|
||||||
vector<MilanLongInt> &PCumulative,
|
vector<MilanLongInt> &PCumulative,
|
||||||
vector<MilanLongInt> &PMessageBundle,
|
vector<MilanLongInt> &PMessageBundle,
|
||||||
vector<MilanLongInt> &PSizeInfoMessages,
|
vector<MilanLongInt> &PSizeInfoMessages,
|
||||||
MilanLongInt *PCounter,
|
MilanLongInt *PCounter,
|
||||||
MilanLongInt NumMessagesBundled,
|
MilanLongInt NumMessagesBundled,
|
||||||
MilanLongInt *msgActual,
|
MilanLongInt *msgActual,
|
||||||
MilanLongInt *msgInd,
|
MilanLongInt *msgInd,
|
||||||
MilanInt numProcs,
|
MilanInt numProcs,
|
||||||
MilanInt myRank,
|
MilanInt myRank,
|
||||||
MPI_Comm comm,
|
MPI_Comm comm,
|
||||||
vector<MilanLongInt> &QLocalVtx,
|
vector<MilanLongInt> &QLocalVtx,
|
||||||
vector<MilanLongInt> &QGhostVtx,
|
vector<MilanLongInt> &QGhostVtx,
|
||||||
vector<MilanLongInt> &QMsgType,
|
vector<MilanLongInt> &QMsgType,
|
||||||
vector<MilanInt> &QOwner,
|
vector<MilanInt> &QOwner,
|
||||||
vector<MPI_Request> &SRequest,
|
vector<MPI_Request> &SRequest,
|
||||||
vector<MPI_Status> &SStatus)
|
vector<MPI_Status> &SStatus)
|
||||||
{
|
{
|
||||||
|
|
||||||
MilanLongInt myIndex = 0, numMessagesToSend;
|
MilanLongInt myIndex = 0, numMessagesToSend;
|
||||||
@@ -61,7 +62,7 @@ void sendBundledMessages(MilanLongInt *numGhostEdges,
|
|||||||
for (i = 0; i < numProcs; i++)
|
for (i = 0; i < numProcs; i++)
|
||||||
PCumulative[i + 1] = PCumulative[i] + PCounter[i];
|
PCumulative[i + 1] = PCumulative[i] + PCounter[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma omp task depend(inout \
|
#pragma omp task depend(inout \
|
||||||
: PCounter)
|
: PCounter)
|
||||||
{
|
{
|
||||||
@@ -83,7 +84,7 @@ void sendBundledMessages(MilanLongInt *numGhostEdges,
|
|||||||
PCounter[QOwner[i]]++;
|
PCounter[QOwner[i]]++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send the Bundled Messages: Use ISend
|
// Send the Bundled Messages: Use ISend
|
||||||
#pragma omp task depend(out \
|
#pragma omp task depend(out \
|
||||||
: SRequest, SStatus)
|
: SRequest, SStatus)
|
||||||
@@ -100,7 +101,7 @@ void sendBundledMessages(MilanLongInt *numGhostEdges,
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send the Messages
|
// Send the Messages
|
||||||
#pragma omp task depend(inout \
|
#pragma omp task depend(inout \
|
||||||
: SRequest, PSizeInfoMessages, PCumulative) depend(out \
|
: SRequest, PSizeInfoMessages, PCumulative) depend(out \
|
||||||
@@ -206,3 +207,4 @@ void sendBundledMessages(MilanLongInt *numGhostEdges,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -507,71 +507,6 @@ subroutine amg_c_hierarchy_bld(a,desc_a,prec,info)
|
|||||||
return
|
return
|
||||||
|
|
||||||
contains
|
contains
|
||||||
|
|
||||||
#if ( __GNUC__ == 13 && __GNUC_MINOR__ == 3)
|
|
||||||
! gfortran 13.3.0 generates a strange error here with MOLD
|
|
||||||
! moving to SOURCE but only for this version, since it's heavier
|
|
||||||
subroutine save_smoothers(level,save1, save2,info)
|
|
||||||
type(amg_c_onelev_type), intent(inout) :: level
|
|
||||||
class(amg_c_base_smoother_type), allocatable , intent(inout) :: save1, save2
|
|
||||||
integer(psb_ipk_), intent(out) :: info
|
|
||||||
|
|
||||||
info = 0
|
|
||||||
if (allocated(save1)) then
|
|
||||||
call save1%free(info)
|
|
||||||
if (info == 0) deallocate(save1,stat=info)
|
|
||||||
if (info /= 0) return
|
|
||||||
end if
|
|
||||||
if (allocated(save2)) then
|
|
||||||
call save2%free(info)
|
|
||||||
if (info == 0) deallocate(save2,stat=info)
|
|
||||||
if (info /= 0) return
|
|
||||||
end if
|
|
||||||
allocate(save1, source=level%sm,stat=info)
|
|
||||||
if (info == 0) call level%sm%clone_settings(save1,info)
|
|
||||||
if ((info == 0).and.allocated(level%sm2a)) then
|
|
||||||
allocate(save2, source=level%sm2a,stat=info)
|
|
||||||
if (info == 0) call level%sm2a%clone_settings(save2,info)
|
|
||||||
end if
|
|
||||||
|
|
||||||
return
|
|
||||||
end subroutine save_smoothers
|
|
||||||
|
|
||||||
subroutine restore_smoothers(level,save1, save2,info)
|
|
||||||
type(amg_c_onelev_type), intent(inout), target :: level
|
|
||||||
class(amg_c_base_smoother_type), allocatable, intent(inout) :: save1, save2
|
|
||||||
integer(psb_ipk_), intent(out) :: info
|
|
||||||
|
|
||||||
info = 0
|
|
||||||
|
|
||||||
if (allocated(level%sm)) then
|
|
||||||
if (info == 0) call level%sm%free(info)
|
|
||||||
if (info == 0) deallocate(level%sm,stat=info)
|
|
||||||
end if
|
|
||||||
if (allocated(save1)) then
|
|
||||||
if (info == 0) allocate(level%sm,source=save1,stat=info)
|
|
||||||
if (info == 0) call save1%clone_settings(level%sm,info)
|
|
||||||
end if
|
|
||||||
|
|
||||||
if (info /= 0) return
|
|
||||||
|
|
||||||
if (allocated(level%sm2a)) then
|
|
||||||
if (info == 0) call level%sm2a%free(info)
|
|
||||||
if (info == 0) deallocate(level%sm2a,stat=info)
|
|
||||||
end if
|
|
||||||
if (allocated(save2)) then
|
|
||||||
if (info == 0) allocate(level%sm2a,source=save2,stat=info)
|
|
||||||
if (info == 0) call save2%clone_settings(level%sm2a,info)
|
|
||||||
if (info == 0) level%sm2 => level%sm2a
|
|
||||||
else
|
|
||||||
if (allocated(level%sm)) level%sm2 => level%sm
|
|
||||||
end if
|
|
||||||
|
|
||||||
return
|
|
||||||
end subroutine restore_smoothers
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
subroutine save_smoothers(level,save1, save2,info)
|
subroutine save_smoothers(level,save1, save2,info)
|
||||||
type(amg_c_onelev_type), intent(inout) :: level
|
type(amg_c_onelev_type), intent(inout) :: level
|
||||||
class(amg_c_base_smoother_type), allocatable , intent(inout) :: save1, save2
|
class(amg_c_base_smoother_type), allocatable , intent(inout) :: save1, save2
|
||||||
@@ -630,5 +565,5 @@ contains
|
|||||||
|
|
||||||
return
|
return
|
||||||
end subroutine restore_smoothers
|
end subroutine restore_smoothers
|
||||||
#endif
|
|
||||||
end subroutine amg_c_hierarchy_bld
|
end subroutine amg_c_hierarchy_bld
|
||||||
@@ -507,71 +507,6 @@ subroutine amg_d_hierarchy_bld(a,desc_a,prec,info)
|
|||||||
return
|
return
|
||||||
|
|
||||||
contains
|
contains
|
||||||
|
|
||||||
#if ( __GNUC__ == 13 && __GNUC_MINOR__ == 3)
|
|
||||||
! gfortran 13.3.0 generates a strange error here with MOLD
|
|
||||||
! moving to SOURCE but only for this version, since it's heavier
|
|
||||||
subroutine save_smoothers(level,save1, save2,info)
|
|
||||||
type(amg_d_onelev_type), intent(inout) :: level
|
|
||||||
class(amg_d_base_smoother_type), allocatable , intent(inout) :: save1, save2
|
|
||||||
integer(psb_ipk_), intent(out) :: info
|
|
||||||
|
|
||||||
info = 0
|
|
||||||
if (allocated(save1)) then
|
|
||||||
call save1%free(info)
|
|
||||||
if (info == 0) deallocate(save1,stat=info)
|
|
||||||
if (info /= 0) return
|
|
||||||
end if
|
|
||||||
if (allocated(save2)) then
|
|
||||||
call save2%free(info)
|
|
||||||
if (info == 0) deallocate(save2,stat=info)
|
|
||||||
if (info /= 0) return
|
|
||||||
end if
|
|
||||||
allocate(save1, source=level%sm,stat=info)
|
|
||||||
if (info == 0) call level%sm%clone_settings(save1,info)
|
|
||||||
if ((info == 0).and.allocated(level%sm2a)) then
|
|
||||||
allocate(save2, source=level%sm2a,stat=info)
|
|
||||||
if (info == 0) call level%sm2a%clone_settings(save2,info)
|
|
||||||
end if
|
|
||||||
|
|
||||||
return
|
|
||||||
end subroutine save_smoothers
|
|
||||||
|
|
||||||
subroutine restore_smoothers(level,save1, save2,info)
|
|
||||||
type(amg_d_onelev_type), intent(inout), target :: level
|
|
||||||
class(amg_d_base_smoother_type), allocatable, intent(inout) :: save1, save2
|
|
||||||
integer(psb_ipk_), intent(out) :: info
|
|
||||||
|
|
||||||
info = 0
|
|
||||||
|
|
||||||
if (allocated(level%sm)) then
|
|
||||||
if (info == 0) call level%sm%free(info)
|
|
||||||
if (info == 0) deallocate(level%sm,stat=info)
|
|
||||||
end if
|
|
||||||
if (allocated(save1)) then
|
|
||||||
if (info == 0) allocate(level%sm,source=save1,stat=info)
|
|
||||||
if (info == 0) call save1%clone_settings(level%sm,info)
|
|
||||||
end if
|
|
||||||
|
|
||||||
if (info /= 0) return
|
|
||||||
|
|
||||||
if (allocated(level%sm2a)) then
|
|
||||||
if (info == 0) call level%sm2a%free(info)
|
|
||||||
if (info == 0) deallocate(level%sm2a,stat=info)
|
|
||||||
end if
|
|
||||||
if (allocated(save2)) then
|
|
||||||
if (info == 0) allocate(level%sm2a,source=save2,stat=info)
|
|
||||||
if (info == 0) call save2%clone_settings(level%sm2a,info)
|
|
||||||
if (info == 0) level%sm2 => level%sm2a
|
|
||||||
else
|
|
||||||
if (allocated(level%sm)) level%sm2 => level%sm
|
|
||||||
end if
|
|
||||||
|
|
||||||
return
|
|
||||||
end subroutine restore_smoothers
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
subroutine save_smoothers(level,save1, save2,info)
|
subroutine save_smoothers(level,save1, save2,info)
|
||||||
type(amg_d_onelev_type), intent(inout) :: level
|
type(amg_d_onelev_type), intent(inout) :: level
|
||||||
class(amg_d_base_smoother_type), allocatable , intent(inout) :: save1, save2
|
class(amg_d_base_smoother_type), allocatable , intent(inout) :: save1, save2
|
||||||
@@ -630,5 +565,5 @@ contains
|
|||||||
|
|
||||||
return
|
return
|
||||||
end subroutine restore_smoothers
|
end subroutine restore_smoothers
|
||||||
#endif
|
|
||||||
end subroutine amg_d_hierarchy_bld
|
end subroutine amg_d_hierarchy_bld
|
||||||
@@ -507,71 +507,6 @@ subroutine amg_s_hierarchy_bld(a,desc_a,prec,info)
|
|||||||
return
|
return
|
||||||
|
|
||||||
contains
|
contains
|
||||||
|
|
||||||
#if ( __GNUC__ == 13 && __GNUC_MINOR__ == 3)
|
|
||||||
! gfortran 13.3.0 generates a strange error here with MOLD
|
|
||||||
! moving to SOURCE but only for this version, since it's heavier
|
|
||||||
subroutine save_smoothers(level,save1, save2,info)
|
|
||||||
type(amg_s_onelev_type), intent(inout) :: level
|
|
||||||
class(amg_s_base_smoother_type), allocatable , intent(inout) :: save1, save2
|
|
||||||
integer(psb_ipk_), intent(out) :: info
|
|
||||||
|
|
||||||
info = 0
|
|
||||||
if (allocated(save1)) then
|
|
||||||
call save1%free(info)
|
|
||||||
if (info == 0) deallocate(save1,stat=info)
|
|
||||||
if (info /= 0) return
|
|
||||||
end if
|
|
||||||
if (allocated(save2)) then
|
|
||||||
call save2%free(info)
|
|
||||||
if (info == 0) deallocate(save2,stat=info)
|
|
||||||
if (info /= 0) return
|
|
||||||
end if
|
|
||||||
allocate(save1, source=level%sm,stat=info)
|
|
||||||
if (info == 0) call level%sm%clone_settings(save1,info)
|
|
||||||
if ((info == 0).and.allocated(level%sm2a)) then
|
|
||||||
allocate(save2, source=level%sm2a,stat=info)
|
|
||||||
if (info == 0) call level%sm2a%clone_settings(save2,info)
|
|
||||||
end if
|
|
||||||
|
|
||||||
return
|
|
||||||
end subroutine save_smoothers
|
|
||||||
|
|
||||||
subroutine restore_smoothers(level,save1, save2,info)
|
|
||||||
type(amg_s_onelev_type), intent(inout), target :: level
|
|
||||||
class(amg_s_base_smoother_type), allocatable, intent(inout) :: save1, save2
|
|
||||||
integer(psb_ipk_), intent(out) :: info
|
|
||||||
|
|
||||||
info = 0
|
|
||||||
|
|
||||||
if (allocated(level%sm)) then
|
|
||||||
if (info == 0) call level%sm%free(info)
|
|
||||||
if (info == 0) deallocate(level%sm,stat=info)
|
|
||||||
end if
|
|
||||||
if (allocated(save1)) then
|
|
||||||
if (info == 0) allocate(level%sm,source=save1,stat=info)
|
|
||||||
if (info == 0) call save1%clone_settings(level%sm,info)
|
|
||||||
end if
|
|
||||||
|
|
||||||
if (info /= 0) return
|
|
||||||
|
|
||||||
if (allocated(level%sm2a)) then
|
|
||||||
if (info == 0) call level%sm2a%free(info)
|
|
||||||
if (info == 0) deallocate(level%sm2a,stat=info)
|
|
||||||
end if
|
|
||||||
if (allocated(save2)) then
|
|
||||||
if (info == 0) allocate(level%sm2a,source=save2,stat=info)
|
|
||||||
if (info == 0) call save2%clone_settings(level%sm2a,info)
|
|
||||||
if (info == 0) level%sm2 => level%sm2a
|
|
||||||
else
|
|
||||||
if (allocated(level%sm)) level%sm2 => level%sm
|
|
||||||
end if
|
|
||||||
|
|
||||||
return
|
|
||||||
end subroutine restore_smoothers
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
subroutine save_smoothers(level,save1, save2,info)
|
subroutine save_smoothers(level,save1, save2,info)
|
||||||
type(amg_s_onelev_type), intent(inout) :: level
|
type(amg_s_onelev_type), intent(inout) :: level
|
||||||
class(amg_s_base_smoother_type), allocatable , intent(inout) :: save1, save2
|
class(amg_s_base_smoother_type), allocatable , intent(inout) :: save1, save2
|
||||||
@@ -630,5 +565,5 @@ contains
|
|||||||
|
|
||||||
return
|
return
|
||||||
end subroutine restore_smoothers
|
end subroutine restore_smoothers
|
||||||
#endif
|
|
||||||
end subroutine amg_s_hierarchy_bld
|
end subroutine amg_s_hierarchy_bld
|
||||||
@@ -507,71 +507,6 @@ subroutine amg_z_hierarchy_bld(a,desc_a,prec,info)
|
|||||||
return
|
return
|
||||||
|
|
||||||
contains
|
contains
|
||||||
|
|
||||||
#if ( __GNUC__ == 13 && __GNUC_MINOR__ == 3)
|
|
||||||
! gfortran 13.3.0 generates a strange error here with MOLD
|
|
||||||
! moving to SOURCE but only for this version, since it's heavier
|
|
||||||
subroutine save_smoothers(level,save1, save2,info)
|
|
||||||
type(amg_z_onelev_type), intent(inout) :: level
|
|
||||||
class(amg_z_base_smoother_type), allocatable , intent(inout) :: save1, save2
|
|
||||||
integer(psb_ipk_), intent(out) :: info
|
|
||||||
|
|
||||||
info = 0
|
|
||||||
if (allocated(save1)) then
|
|
||||||
call save1%free(info)
|
|
||||||
if (info == 0) deallocate(save1,stat=info)
|
|
||||||
if (info /= 0) return
|
|
||||||
end if
|
|
||||||
if (allocated(save2)) then
|
|
||||||
call save2%free(info)
|
|
||||||
if (info == 0) deallocate(save2,stat=info)
|
|
||||||
if (info /= 0) return
|
|
||||||
end if
|
|
||||||
allocate(save1, source=level%sm,stat=info)
|
|
||||||
if (info == 0) call level%sm%clone_settings(save1,info)
|
|
||||||
if ((info == 0).and.allocated(level%sm2a)) then
|
|
||||||
allocate(save2, source=level%sm2a,stat=info)
|
|
||||||
if (info == 0) call level%sm2a%clone_settings(save2,info)
|
|
||||||
end if
|
|
||||||
|
|
||||||
return
|
|
||||||
end subroutine save_smoothers
|
|
||||||
|
|
||||||
subroutine restore_smoothers(level,save1, save2,info)
|
|
||||||
type(amg_z_onelev_type), intent(inout), target :: level
|
|
||||||
class(amg_z_base_smoother_type), allocatable, intent(inout) :: save1, save2
|
|
||||||
integer(psb_ipk_), intent(out) :: info
|
|
||||||
|
|
||||||
info = 0
|
|
||||||
|
|
||||||
if (allocated(level%sm)) then
|
|
||||||
if (info == 0) call level%sm%free(info)
|
|
||||||
if (info == 0) deallocate(level%sm,stat=info)
|
|
||||||
end if
|
|
||||||
if (allocated(save1)) then
|
|
||||||
if (info == 0) allocate(level%sm,source=save1,stat=info)
|
|
||||||
if (info == 0) call save1%clone_settings(level%sm,info)
|
|
||||||
end if
|
|
||||||
|
|
||||||
if (info /= 0) return
|
|
||||||
|
|
||||||
if (allocated(level%sm2a)) then
|
|
||||||
if (info == 0) call level%sm2a%free(info)
|
|
||||||
if (info == 0) deallocate(level%sm2a,stat=info)
|
|
||||||
end if
|
|
||||||
if (allocated(save2)) then
|
|
||||||
if (info == 0) allocate(level%sm2a,source=save2,stat=info)
|
|
||||||
if (info == 0) call save2%clone_settings(level%sm2a,info)
|
|
||||||
if (info == 0) level%sm2 => level%sm2a
|
|
||||||
else
|
|
||||||
if (allocated(level%sm)) level%sm2 => level%sm
|
|
||||||
end if
|
|
||||||
|
|
||||||
return
|
|
||||||
end subroutine restore_smoothers
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
subroutine save_smoothers(level,save1, save2,info)
|
subroutine save_smoothers(level,save1, save2,info)
|
||||||
type(amg_z_onelev_type), intent(inout) :: level
|
type(amg_z_onelev_type), intent(inout) :: level
|
||||||
class(amg_z_base_smoother_type), allocatable , intent(inout) :: save1, save2
|
class(amg_z_base_smoother_type), allocatable , intent(inout) :: save1, save2
|
||||||
@@ -630,5 +565,5 @@ contains
|
|||||||
|
|
||||||
return
|
return
|
||||||
end subroutine restore_smoothers
|
end subroutine restore_smoothers
|
||||||
#endif
|
|
||||||
end subroutine amg_z_hierarchy_bld
|
end subroutine amg_z_hierarchy_bld
|
||||||
@@ -42,6 +42,8 @@ subroutine amg_c_base_onelev_csetc(lv,what,val,info,pos,idx)
|
|||||||
use amg_c_base_aggregator_mod
|
use amg_c_base_aggregator_mod
|
||||||
use amg_c_dec_aggregator_mod
|
use amg_c_dec_aggregator_mod
|
||||||
use amg_c_symdec_aggregator_mod
|
use amg_c_symdec_aggregator_mod
|
||||||
|
#if !defined(SERIAL_MPI)
|
||||||
|
#endif
|
||||||
use amg_c_jac_smoother
|
use amg_c_jac_smoother
|
||||||
use amg_c_as_smoother
|
use amg_c_as_smoother
|
||||||
use amg_c_diag_solver
|
use amg_c_diag_solver
|
||||||
@@ -241,6 +243,8 @@ subroutine amg_c_base_onelev_csetc(lv,what,val,info,pos,idx)
|
|||||||
if (info == 0) deallocate(lv%aggr,stat=info)
|
if (info == 0) deallocate(lv%aggr,stat=info)
|
||||||
if (info /= 0) then
|
if (info /= 0) then
|
||||||
info = psb_err_internal_error_
|
info = psb_err_internal_error_
|
||||||
|
call psb_errpush(info,name,a_err='aggregator deallocation?')
|
||||||
|
goto 9999
|
||||||
return
|
return
|
||||||
end if
|
end if
|
||||||
end if
|
end if
|
||||||
@@ -250,8 +254,16 @@ subroutine amg_c_base_onelev_csetc(lv,what,val,info,pos,idx)
|
|||||||
allocate(amg_c_dec_aggregator_type :: lv%aggr, stat=info)
|
allocate(amg_c_dec_aggregator_type :: lv%aggr, stat=info)
|
||||||
case('SYMDEC')
|
case('SYMDEC')
|
||||||
allocate(amg_c_symdec_aggregator_type :: lv%aggr, stat=info)
|
allocate(amg_c_symdec_aggregator_type :: lv%aggr, stat=info)
|
||||||
case default
|
#if !defined(SERIAL_MPI)
|
||||||
|
#endif
|
||||||
|
case default
|
||||||
info = psb_err_internal_error_
|
info = psb_err_internal_error_
|
||||||
|
#if !defined(SERIAL_MPI)
|
||||||
|
call psb_errpush(info,name,a_err='Unsupported PAR_AGGR_ALG')
|
||||||
|
#else
|
||||||
|
call psb_errpush(info,name,a_err='PAR_AGGR_ALG unsupported (SERIAL_MPI on)')
|
||||||
|
#endif
|
||||||
|
goto 9999
|
||||||
end select
|
end select
|
||||||
if (info == psb_success_) call lv%aggr%default()
|
if (info == psb_success_) call lv%aggr%default()
|
||||||
|
|
||||||
|
|||||||
@@ -98,7 +98,8 @@ subroutine amg_c_base_onelev_memory_use(lv,il,nl,ilmin,info,iout,verbosity,prefi
|
|||||||
prefix_ = ""
|
prefix_ = ""
|
||||||
end if
|
end if
|
||||||
|
|
||||||
if ((me == 0).or.(verbosity_>0)) write(iout_,*) trim(prefix_)
|
write(iout_,*) trim(prefix_)
|
||||||
|
|
||||||
|
|
||||||
if (global_) then
|
if (global_) then
|
||||||
allocate(sz(6))
|
allocate(sz(6))
|
||||||
|
|||||||
@@ -42,7 +42,9 @@ subroutine amg_d_base_onelev_csetc(lv,what,val,info,pos,idx)
|
|||||||
use amg_d_base_aggregator_mod
|
use amg_d_base_aggregator_mod
|
||||||
use amg_d_dec_aggregator_mod
|
use amg_d_dec_aggregator_mod
|
||||||
use amg_d_symdec_aggregator_mod
|
use amg_d_symdec_aggregator_mod
|
||||||
|
#if !defined(SERIAL_MPI)
|
||||||
use amg_d_parmatch_aggregator_mod
|
use amg_d_parmatch_aggregator_mod
|
||||||
|
#endif
|
||||||
use amg_d_poly_smoother
|
use amg_d_poly_smoother
|
||||||
use amg_d_jac_smoother
|
use amg_d_jac_smoother
|
||||||
use amg_d_as_smoother
|
use amg_d_as_smoother
|
||||||
@@ -267,6 +269,8 @@ subroutine amg_d_base_onelev_csetc(lv,what,val,info,pos,idx)
|
|||||||
if (info == 0) deallocate(lv%aggr,stat=info)
|
if (info == 0) deallocate(lv%aggr,stat=info)
|
||||||
if (info /= 0) then
|
if (info /= 0) then
|
||||||
info = psb_err_internal_error_
|
info = psb_err_internal_error_
|
||||||
|
call psb_errpush(info,name,a_err='aggregator deallocation?')
|
||||||
|
goto 9999
|
||||||
return
|
return
|
||||||
end if
|
end if
|
||||||
end if
|
end if
|
||||||
@@ -276,10 +280,18 @@ subroutine amg_d_base_onelev_csetc(lv,what,val,info,pos,idx)
|
|||||||
allocate(amg_d_dec_aggregator_type :: lv%aggr, stat=info)
|
allocate(amg_d_dec_aggregator_type :: lv%aggr, stat=info)
|
||||||
case('SYMDEC')
|
case('SYMDEC')
|
||||||
allocate(amg_d_symdec_aggregator_type :: lv%aggr, stat=info)
|
allocate(amg_d_symdec_aggregator_type :: lv%aggr, stat=info)
|
||||||
|
#if !defined(SERIAL_MPI)
|
||||||
case('COUP','COUPLED')
|
case('COUP','COUPLED')
|
||||||
allocate(amg_d_parmatch_aggregator_type :: lv%aggr, stat=info)
|
allocate(amg_d_parmatch_aggregator_type :: lv%aggr, stat=info)
|
||||||
case default
|
#endif
|
||||||
|
case default
|
||||||
info = psb_err_internal_error_
|
info = psb_err_internal_error_
|
||||||
|
#if !defined(SERIAL_MPI)
|
||||||
|
call psb_errpush(info,name,a_err='Unsupported PAR_AGGR_ALG')
|
||||||
|
#else
|
||||||
|
call psb_errpush(info,name,a_err='PAR_AGGR_ALG unsupported (SERIAL_MPI on)')
|
||||||
|
#endif
|
||||||
|
goto 9999
|
||||||
end select
|
end select
|
||||||
if (info == psb_success_) call lv%aggr%default()
|
if (info == psb_success_) call lv%aggr%default()
|
||||||
|
|
||||||
|
|||||||
@@ -98,7 +98,8 @@ subroutine amg_d_base_onelev_memory_use(lv,il,nl,ilmin,info,iout,verbosity,prefi
|
|||||||
prefix_ = ""
|
prefix_ = ""
|
||||||
end if
|
end if
|
||||||
|
|
||||||
if ((me == 0).or.(verbosity_>0)) write(iout_,*) trim(prefix_)
|
write(iout_,*) trim(prefix_)
|
||||||
|
|
||||||
|
|
||||||
if (global_) then
|
if (global_) then
|
||||||
allocate(sz(6))
|
allocate(sz(6))
|
||||||
|
|||||||
@@ -42,7 +42,9 @@ subroutine amg_s_base_onelev_csetc(lv,what,val,info,pos,idx)
|
|||||||
use amg_s_base_aggregator_mod
|
use amg_s_base_aggregator_mod
|
||||||
use amg_s_dec_aggregator_mod
|
use amg_s_dec_aggregator_mod
|
||||||
use amg_s_symdec_aggregator_mod
|
use amg_s_symdec_aggregator_mod
|
||||||
|
#if !defined(SERIAL_MPI)
|
||||||
use amg_s_parmatch_aggregator_mod
|
use amg_s_parmatch_aggregator_mod
|
||||||
|
#endif
|
||||||
use amg_s_poly_smoother
|
use amg_s_poly_smoother
|
||||||
use amg_s_jac_smoother
|
use amg_s_jac_smoother
|
||||||
use amg_s_as_smoother
|
use amg_s_as_smoother
|
||||||
@@ -247,6 +249,8 @@ subroutine amg_s_base_onelev_csetc(lv,what,val,info,pos,idx)
|
|||||||
if (info == 0) deallocate(lv%aggr,stat=info)
|
if (info == 0) deallocate(lv%aggr,stat=info)
|
||||||
if (info /= 0) then
|
if (info /= 0) then
|
||||||
info = psb_err_internal_error_
|
info = psb_err_internal_error_
|
||||||
|
call psb_errpush(info,name,a_err='aggregator deallocation?')
|
||||||
|
goto 9999
|
||||||
return
|
return
|
||||||
end if
|
end if
|
||||||
end if
|
end if
|
||||||
@@ -256,10 +260,18 @@ subroutine amg_s_base_onelev_csetc(lv,what,val,info,pos,idx)
|
|||||||
allocate(amg_s_dec_aggregator_type :: lv%aggr, stat=info)
|
allocate(amg_s_dec_aggregator_type :: lv%aggr, stat=info)
|
||||||
case('SYMDEC')
|
case('SYMDEC')
|
||||||
allocate(amg_s_symdec_aggregator_type :: lv%aggr, stat=info)
|
allocate(amg_s_symdec_aggregator_type :: lv%aggr, stat=info)
|
||||||
|
#if !defined(SERIAL_MPI)
|
||||||
case('COUP','COUPLED')
|
case('COUP','COUPLED')
|
||||||
allocate(amg_s_parmatch_aggregator_type :: lv%aggr, stat=info)
|
allocate(amg_s_parmatch_aggregator_type :: lv%aggr, stat=info)
|
||||||
case default
|
#endif
|
||||||
|
case default
|
||||||
info = psb_err_internal_error_
|
info = psb_err_internal_error_
|
||||||
|
#if !defined(SERIAL_MPI)
|
||||||
|
call psb_errpush(info,name,a_err='Unsupported PAR_AGGR_ALG')
|
||||||
|
#else
|
||||||
|
call psb_errpush(info,name,a_err='PAR_AGGR_ALG unsupported (SERIAL_MPI on)')
|
||||||
|
#endif
|
||||||
|
goto 9999
|
||||||
end select
|
end select
|
||||||
if (info == psb_success_) call lv%aggr%default()
|
if (info == psb_success_) call lv%aggr%default()
|
||||||
|
|
||||||
|
|||||||
@@ -98,7 +98,8 @@ subroutine amg_s_base_onelev_memory_use(lv,il,nl,ilmin,info,iout,verbosity,prefi
|
|||||||
prefix_ = ""
|
prefix_ = ""
|
||||||
end if
|
end if
|
||||||
|
|
||||||
if ((me == 0).or.(verbosity_>0)) write(iout_,*) trim(prefix_)
|
write(iout_,*) trim(prefix_)
|
||||||
|
|
||||||
|
|
||||||
if (global_) then
|
if (global_) then
|
||||||
allocate(sz(6))
|
allocate(sz(6))
|
||||||
|
|||||||
@@ -42,6 +42,8 @@ subroutine amg_z_base_onelev_csetc(lv,what,val,info,pos,idx)
|
|||||||
use amg_z_base_aggregator_mod
|
use amg_z_base_aggregator_mod
|
||||||
use amg_z_dec_aggregator_mod
|
use amg_z_dec_aggregator_mod
|
||||||
use amg_z_symdec_aggregator_mod
|
use amg_z_symdec_aggregator_mod
|
||||||
|
#if !defined(SERIAL_MPI)
|
||||||
|
#endif
|
||||||
use amg_z_jac_smoother
|
use amg_z_jac_smoother
|
||||||
use amg_z_as_smoother
|
use amg_z_as_smoother
|
||||||
use amg_z_diag_solver
|
use amg_z_diag_solver
|
||||||
@@ -261,6 +263,8 @@ subroutine amg_z_base_onelev_csetc(lv,what,val,info,pos,idx)
|
|||||||
if (info == 0) deallocate(lv%aggr,stat=info)
|
if (info == 0) deallocate(lv%aggr,stat=info)
|
||||||
if (info /= 0) then
|
if (info /= 0) then
|
||||||
info = psb_err_internal_error_
|
info = psb_err_internal_error_
|
||||||
|
call psb_errpush(info,name,a_err='aggregator deallocation?')
|
||||||
|
goto 9999
|
||||||
return
|
return
|
||||||
end if
|
end if
|
||||||
end if
|
end if
|
||||||
@@ -270,8 +274,16 @@ subroutine amg_z_base_onelev_csetc(lv,what,val,info,pos,idx)
|
|||||||
allocate(amg_z_dec_aggregator_type :: lv%aggr, stat=info)
|
allocate(amg_z_dec_aggregator_type :: lv%aggr, stat=info)
|
||||||
case('SYMDEC')
|
case('SYMDEC')
|
||||||
allocate(amg_z_symdec_aggregator_type :: lv%aggr, stat=info)
|
allocate(amg_z_symdec_aggregator_type :: lv%aggr, stat=info)
|
||||||
case default
|
#if !defined(SERIAL_MPI)
|
||||||
|
#endif
|
||||||
|
case default
|
||||||
info = psb_err_internal_error_
|
info = psb_err_internal_error_
|
||||||
|
#if !defined(SERIAL_MPI)
|
||||||
|
call psb_errpush(info,name,a_err='Unsupported PAR_AGGR_ALG')
|
||||||
|
#else
|
||||||
|
call psb_errpush(info,name,a_err='PAR_AGGR_ALG unsupported (SERIAL_MPI on)')
|
||||||
|
#endif
|
||||||
|
goto 9999
|
||||||
end select
|
end select
|
||||||
if (info == psb_success_) call lv%aggr%default()
|
if (info == psb_success_) call lv%aggr%default()
|
||||||
|
|
||||||
|
|||||||
@@ -98,7 +98,8 @@ subroutine amg_z_base_onelev_memory_use(lv,il,nl,ilmin,info,iout,verbosity,prefi
|
|||||||
prefix_ = ""
|
prefix_ = ""
|
||||||
end if
|
end if
|
||||||
|
|
||||||
if ((me == 0).or.(verbosity_>0)) write(iout_,*) trim(prefix_)
|
write(iout_,*) trim(prefix_)
|
||||||
|
|
||||||
|
|
||||||
if (global_) then
|
if (global_) then
|
||||||
allocate(sz(6))
|
allocate(sz(6))
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ program amg_d_pde2d
|
|||||||
! AMG cycles for ML
|
! AMG cycles for ML
|
||||||
! general AMG data
|
! general AMG data
|
||||||
character(len=32) :: mlcycle ! AMG cycle type
|
character(len=32) :: mlcycle ! AMG cycle type
|
||||||
integer(psb_ipk_) :: maxlevs ! maximum number of levels in AMG preconditioner
|
integer(psb_ipk_) :: maxlevs ! maximum number of levels in AMG preconditioner
|
||||||
|
|
||||||
! AMG aggregation
|
! AMG aggregation
|
||||||
character(len=32) :: aggr_prol ! aggregation type: SMOOTHED, NONSMOOTHED
|
character(len=32) :: aggr_prol ! aggregation type: SMOOTHED, NONSMOOTHED
|
||||||
@@ -174,15 +174,15 @@ program amg_d_pde2d
|
|||||||
real(psb_dpk_) :: thr2 ! threshold for ILUT factorization
|
real(psb_dpk_) :: thr2 ! threshold for ILUT factorization
|
||||||
|
|
||||||
! coarsest-level solver
|
! coarsest-level solver
|
||||||
character(len=32) :: cmat ! coarsest matrix layout: REPL, DIST
|
character(len=32) :: cmat ! coarsest matrix layout: REPL, DIST
|
||||||
character(len=32) :: csolve ! coarsest-lev solver: BJAC, SLUDIST (distr.
|
character(len=32) :: csolve ! coarsest-lev solver: BJAC, SLUDIST (distr.
|
||||||
! mat.); UMF, MUMPS, SLU, ILU, ILUT, MILU
|
! mat.); UMF, MUMPS, SLU, ILU, ILUT, MILU
|
||||||
! (repl. mat.)
|
! (repl. mat.)
|
||||||
character(len=32) :: csbsolve ! coarsest-lev local subsolver: ILU, ILUT,
|
character(len=32) :: csbsolve ! coarsest-lev local subsolver: ILU, ILUT,
|
||||||
! MILU, UMF, MUMPS, SLU
|
! MILU, UMF, MUMPS, SLU
|
||||||
integer(psb_ipk_) :: cfill ! fill-in for incomplete LU factorization
|
integer(psb_ipk_) :: cfill ! fill-in for incomplete LU factorization
|
||||||
real(psb_dpk_) :: cthres ! threshold for ILUT factorization
|
real(psb_dpk_) :: cthres ! threshold for ILUT factorization
|
||||||
integer(psb_ipk_) :: cjswp ! sweeps for GS or JAC coarsest-lev subsolver
|
integer(psb_ipk_) :: cjswp ! sweeps for GS or JAC coarsest-lev subsolver
|
||||||
|
|
||||||
! Dump data
|
! Dump data
|
||||||
logical :: dump = .false.
|
logical :: dump = .false.
|
||||||
|
|||||||
@@ -126,16 +126,16 @@ program amg_s_pde2d
|
|||||||
! AMG cycles for ML
|
! AMG cycles for ML
|
||||||
! general AMG data
|
! general AMG data
|
||||||
character(len=32) :: mlcycle ! AMG cycle type
|
character(len=32) :: mlcycle ! AMG cycle type
|
||||||
integer(psb_ipk_) :: maxlevs ! maximum number of levels in AMG preconditioner
|
integer(psb_ipk_) :: maxlevs ! maximum number of levels in AMG preconditioner
|
||||||
|
|
||||||
! AMG aggregation
|
! AMG aggregation
|
||||||
character(len=32) :: aggr_prol ! aggregation type: SMOOTHED, NONSMOOTHED
|
character(len=32) :: aggr_prol ! aggregation type: SMOOTHED, NONSMOOTHED
|
||||||
character(len=32) :: par_aggr_alg ! parallel aggregation algorithm: DEC, SYMDEC
|
character(len=32) :: par_aggr_alg ! parallel aggregation algorithm: DEC, SYMDEC
|
||||||
character(len=32) :: aggr_type ! Type of aggregation SOC1, SOC2, MATCHBOXP
|
character(len=32) :: aggr_type ! Type of aggregation SOC1, SOC2, MATCHBOXP
|
||||||
integer(psb_ipk_) :: aggr_size ! Requested size of the aggregates for MATCHBOXP
|
integer(psb_ipk_) :: aggr_size ! Requested size of the aggregates for MATCHBOXP
|
||||||
character(len=32) :: aggr_ord ! ordering for aggregation: NATURAL, DEGREE
|
character(len=32) :: aggr_ord ! ordering for aggregation: NATURAL, DEGREE
|
||||||
character(len=32) :: aggr_filter ! filtering: FILTER, NO_FILTER
|
character(len=32) :: aggr_filter ! filtering: FILTER, NO_FILTER
|
||||||
real(psb_spk_) :: mncrratio ! minimum aggregation ratio
|
real(psb_spk_) :: mncrratio ! minimum aggregation ratio
|
||||||
real(psb_spk_), allocatable :: athresv(:) ! smoothed aggregation threshold vector
|
real(psb_spk_), allocatable :: athresv(:) ! smoothed aggregation threshold vector
|
||||||
integer(psb_ipk_) :: thrvsz ! size of threshold vector
|
integer(psb_ipk_) :: thrvsz ! size of threshold vector
|
||||||
real(psb_spk_) :: athres ! smoothed aggregation threshold
|
real(psb_spk_) :: athres ! smoothed aggregation threshold
|
||||||
@@ -174,15 +174,15 @@ program amg_s_pde2d
|
|||||||
real(psb_spk_) :: thr2 ! threshold for ILUT factorization
|
real(psb_spk_) :: thr2 ! threshold for ILUT factorization
|
||||||
|
|
||||||
! coarsest-level solver
|
! coarsest-level solver
|
||||||
character(len=32) :: cmat ! coarsest matrix layout: REPL, DIST
|
character(len=32) :: cmat ! coarsest matrix layout: REPL, DIST
|
||||||
character(len=32) :: csolve ! coarsest-lev solver: BJAC, SLUDIST (distr.
|
character(len=32) :: csolve ! coarsest-lev solver: BJAC, SLUDIST (distr.
|
||||||
! mat.); UMF, MUMPS, SLU, ILU, ILUT, MILU
|
! mat.); UMF, MUMPS, SLU, ILU, ILUT, MILU
|
||||||
! (repl. mat.)
|
! (repl. mat.)
|
||||||
character(len=32) :: csbsolve ! coarsest-lev local subsolver: ILU, ILUT,
|
character(len=32) :: csbsolve ! coarsest-lev local subsolver: ILU, ILUT,
|
||||||
! MILU, UMF, MUMPS, SLU
|
! MILU, UMF, MUMPS, SLU
|
||||||
integer(psb_ipk_) :: cfill ! fill-in for incomplete LU factorization
|
integer(psb_ipk_) :: cfill ! fill-in for incomplete LU factorization
|
||||||
real(psb_spk_) :: cthres ! threshold for ILUT factorization
|
real(psb_spk_) :: cthres ! threshold for ILUT factorization
|
||||||
integer(psb_ipk_) :: cjswp ! sweeps for GS or JAC coarsest-lev subsolver
|
integer(psb_ipk_) :: cjswp ! sweeps for GS or JAC coarsest-lev subsolver
|
||||||
|
|
||||||
! Dump data
|
! Dump data
|
||||||
logical :: dump = .false.
|
logical :: dump = .false.
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
%%%%%%%%%%% General arguments % Lines starting with % are ignored.
|
%%%%%%%%%%% General arguments % Lines starting with % are ignored.
|
||||||
CSR ! Storage format CSR COO JAD
|
CSR ! Storage format CSR COO JAD
|
||||||
0150 ! IDIM; domain size. Linear system size is IDIM**3
|
0040 ! IDIM; domain size. Linear system size is IDIM**3
|
||||||
CONST ! PDECOEFF: CONST, EXP, BOX, GAUSS Coefficients of the PDE
|
CONST ! PDECOEFF: CONST, EXP, GAUSS Coefficients of the PDE
|
||||||
CG ! Iterative method: BiCGSTAB BiCGSTABL BiCG CG CGS FCG GCR RGMRES
|
CG ! Iterative method: BiCGSTAB BiCGSTABL BiCG CG CGS FCG GCR RGMRES
|
||||||
2 ! ISTOPC
|
2 ! ISTOPC
|
||||||
00500 ! ITMAX
|
00008 ! ITMAX
|
||||||
1 ! ITRACE
|
1 ! ITRACE
|
||||||
30 ! IRST (restart for RGMRES and BiCGSTABL)
|
30 ! IRST (restart for RGMRES and BiCGSTABL)
|
||||||
1.d-6 ! EPS
|
1.d-6 ! EPS
|
||||||
|
|||||||
Reference in New Issue
Block a user