Merge remote-tracking branch 'origin/PolySmooth' into l1aggregation

l1aggregation
Cirdans-Home 7 months ago
commit 5b17e1bbf1

@ -75,7 +75,7 @@ CDEFINES=$(AMGCDEFINES)
AMGFDEFINES=@AMGFDEFINES@ $(PSBFDEFINES) AMGFDEFINES=@AMGFDEFINES@ $(PSBFDEFINES)
FDEFINES=$(AMGFDEFINES) FDEFINES=$(AMGFDEFINES)
CXXDEFINES=@AMGCXXDEFINES@ CXXDEFINES=@AMGCXXDEFINES@ $(PSBCXXDEFINES)
@COMPILERULES@ @COMPILERULES@

@ -73,8 +73,8 @@ void dMatchBoxPC(MilanLongInt NLVer, MilanLongInt NLEdge,
#endif #endif
// Rimosso per tornare al vecchio matching #define OMP // Rimosso per tornare al vecchio matching #define OMP
#ifdef OMP #ifdef OPENMP
fprintf(stderr,"Warning: using buggy OpenMP matching!\n"); //fprintf(stderr,"Warning: using buggy OpenMP matching!\n");
dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(NLVer, NLEdge, dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(NLVer, NLEdge,
verLocPtr, verLocInd, edgeLocWeight, verLocPtr, verLocInd, edgeLocWeight,
verDistance, Mate, verDistance, Mate,

@ -59,7 +59,7 @@
#include <assert.h> #include <assert.h>
#include <map> #include <map>
#include <vector> #include <vector>
#ifdef OMP #ifdef OPENMP
// OpenMP is included and used if and only if the OpenMP version of the matching // OpenMP is included and used if and only if the OpenMP version of the matching
// is required // is required
#include "omp.h" #include "omp.h"
@ -178,7 +178,7 @@ extern "C"
#define MilanRealMin MINUS_INFINITY #define MilanRealMin MINUS_INFINITY
#endif #endif
#ifdef OMP #ifdef OPENMP
/* These functions are only used in the experimental OMP implementation, if that /* These functions are only used in the experimental OMP implementation, if that
is disabled there is no reason to actually compile or reference them. */ is disabled there is no reason to actually compile or reference them. */
@ -431,7 +431,7 @@ is disabled there is no reason to actually compile or reference them. */
#endif #endif
#ifndef OMP #ifndef OPENMP
//Function of find the owner of a ghost vertex using binary search: //Function of find the owner of a ghost vertex using binary search:
inline MilanInt findOwnerOfGhost(MilanLongInt vtxIndex, MilanLongInt *mVerDistance, inline MilanInt findOwnerOfGhost(MilanLongInt vtxIndex, MilanLongInt *mVerDistance,
MilanInt myRank, MilanInt numProcs); MilanInt myRank, MilanInt numProcs);

@ -1,5 +1,5 @@
#include "MatchBoxPC.h" #include "MatchBoxPC.h"
#ifdef OMP #ifdef OPENMP
// *********************************************************************** // ***********************************************************************
// //
// MatchboxP: A C++ library for approximate weighted matching // MatchboxP: A C++ library for approximate weighted matching
@ -126,8 +126,10 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
fflush(stdout); fflush(stdout);
#endif #endif
MilanLongInt StartIndex = verDistance[myRank]; // The starting vertex owned by the current rank // The starting vertex owned by the current rank
MilanLongInt EndIndex = verDistance[myRank + 1] - 1; // The ending 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; MPI_Status computeStatus;
@ -145,7 +147,8 @@ 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;
vector<MilanInt> QOwner; // Changed by Fabio to be an integer, addresses needs to be integers! // 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++)
@ -153,7 +156,8 @@ 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
MilanInt ghostOwner = 0; // Changed by Fabio to be an integer, addresses needs to be integers! // 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;
@ -168,9 +172,12 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
MilanLongInt myCard = 0; MilanLongInt myCard = 0;
// Build the Ghost Vertex Set: Vg // Build the Ghost Vertex Set: Vg
map<MilanLongInt, MilanLongInt> Ghost2LocalMap; // Map each ghost vertex to a local vertex // Map each ghost vertex to a local vertex
vector<MilanLongInt> Counter; // Store the edge count for each ghost vertex map<MilanLongInt, MilanLongInt> Ghost2LocalMap;
MilanLongInt numGhostVertices = 0, numGhostEdges = 0; // Number of Ghost vertices // Store the edge count for each ghost vertex
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...";

@ -275,7 +275,8 @@ subroutine amg_c_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
disjoint = all(ilaggr(icol(1:ip)) == -(nr+1)).or.(ip==0) disjoint = all(ilaggr(icol(1:ip)) == -(nr+1)).or.(ip==0)
if (disjoint) then if (disjoint) then
locnaggr(kk) = locnaggr(kk) + 1 locnaggr(kk) = locnaggr(kk) + 1
itmp = (bnds(kk)-1+locnaggr(kk))*nths+kk itmp = (bnds(kk)-1+locnaggr(kk)) !be careful about overflow
itmp = itmp*nths+kk
if (itmp < (bnds(kk)-1+locnaggr(kk))) then if (itmp < (bnds(kk)-1+locnaggr(kk))) then
!$omp atomic update !$omp atomic update
info = max(12345678,info) info = max(12345678,info)

@ -309,7 +309,8 @@ subroutine amg_c_soc2_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
! !
if (disjoint) then if (disjoint) then
locnaggr(kk) = locnaggr(kk) + 1 locnaggr(kk) = locnaggr(kk) + 1
itmp = (bnds(kk)-1+locnaggr(kk))*nths+kk itmp = (bnds(kk)-1+locnaggr(kk)) !be careful about overflow
itmp = itmp*nths+kk
if (itmp < (bnds(kk)-1+locnaggr(kk))) then if (itmp < (bnds(kk)-1+locnaggr(kk))) then
!$omp atomic update !$omp atomic update
info = max(12345678,info) info = max(12345678,info)

@ -275,7 +275,8 @@ subroutine amg_d_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
disjoint = all(ilaggr(icol(1:ip)) == -(nr+1)).or.(ip==0) disjoint = all(ilaggr(icol(1:ip)) == -(nr+1)).or.(ip==0)
if (disjoint) then if (disjoint) then
locnaggr(kk) = locnaggr(kk) + 1 locnaggr(kk) = locnaggr(kk) + 1
itmp = (bnds(kk)-1_psb_lpk_+locnaggr(kk))*nths+kk itmp = (bnds(kk)-1+locnaggr(kk)) !be careful about overflow
itmp = itmp*nths+kk
if (itmp < (bnds(kk)-1+locnaggr(kk))) then if (itmp < (bnds(kk)-1+locnaggr(kk))) then
!$omp atomic update !$omp atomic update
info = max(12345678,info) info = max(12345678,info)

@ -309,8 +309,9 @@ subroutine amg_d_soc2_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
! !
if (disjoint) then if (disjoint) then
locnaggr(kk) = locnaggr(kk) + 1 locnaggr(kk) = locnaggr(kk) + 1
itmp = (bnds(kk)-1+locnaggr(kk))*nths+kk itmp = (bnds(kk)-1+locnaggr(kk)) !be careful about overflow
if (itmp < (bnds(kk)-1_psb_lpk_+locnaggr(kk))) then itmp = itmp*nths+kk
if (itmp < (bnds(kk)-1+locnaggr(kk))) then
!$omp atomic update !$omp atomic update
info = max(12345678,info) info = max(12345678,info)
!$omp end atomic !$omp end atomic

@ -275,7 +275,8 @@ subroutine amg_s_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
disjoint = all(ilaggr(icol(1:ip)) == -(nr+1)).or.(ip==0) disjoint = all(ilaggr(icol(1:ip)) == -(nr+1)).or.(ip==0)
if (disjoint) then if (disjoint) then
locnaggr(kk) = locnaggr(kk) + 1 locnaggr(kk) = locnaggr(kk) + 1
itmp = (bnds(kk)-1+locnaggr(kk))*nths+kk itmp = (bnds(kk)-1+locnaggr(kk)) !be careful about overflow
itmp = itmp*nths+kk
if (itmp < (bnds(kk)-1+locnaggr(kk))) then if (itmp < (bnds(kk)-1+locnaggr(kk))) then
!$omp atomic update !$omp atomic update
info = max(12345678,info) info = max(12345678,info)

@ -309,7 +309,8 @@ subroutine amg_s_soc2_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
! !
if (disjoint) then if (disjoint) then
locnaggr(kk) = locnaggr(kk) + 1 locnaggr(kk) = locnaggr(kk) + 1
itmp = (bnds(kk)-1+locnaggr(kk))*nths+kk itmp = (bnds(kk)-1+locnaggr(kk)) !be careful about overflow
itmp = itmp*nths+kk
if (itmp < (bnds(kk)-1+locnaggr(kk))) then if (itmp < (bnds(kk)-1+locnaggr(kk))) then
!$omp atomic update !$omp atomic update
info = max(12345678,info) info = max(12345678,info)

@ -275,7 +275,8 @@ subroutine amg_z_soc1_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
disjoint = all(ilaggr(icol(1:ip)) == -(nr+1)).or.(ip==0) disjoint = all(ilaggr(icol(1:ip)) == -(nr+1)).or.(ip==0)
if (disjoint) then if (disjoint) then
locnaggr(kk) = locnaggr(kk) + 1 locnaggr(kk) = locnaggr(kk) + 1
itmp = (bnds(kk)-1+locnaggr(kk))*nths+kk itmp = (bnds(kk)-1+locnaggr(kk)) !be careful about overflow
itmp = itmp*nths+kk
if (itmp < (bnds(kk)-1+locnaggr(kk))) then if (itmp < (bnds(kk)-1+locnaggr(kk))) then
!$omp atomic update !$omp atomic update
info = max(12345678,info) info = max(12345678,info)

@ -309,7 +309,8 @@ subroutine amg_z_soc2_map_bld(iorder,theta,clean_zeros,a,desc_a,nlaggr,ilaggr,in
! !
if (disjoint) then if (disjoint) then
locnaggr(kk) = locnaggr(kk) + 1 locnaggr(kk) = locnaggr(kk) + 1
itmp = (bnds(kk)-1+locnaggr(kk))*nths+kk itmp = (bnds(kk)-1+locnaggr(kk)) !be careful about overflow
itmp = itmp*nths+kk
if (itmp < (bnds(kk)-1+locnaggr(kk))) then if (itmp < (bnds(kk)-1+locnaggr(kk))) then
!$omp atomic update !$omp atomic update
info = max(12345678,info) info = max(12345678,info)

@ -1,5 +1,5 @@
#include "MatchBoxPC.h" #include "MatchBoxPC.h"
#ifdef OMP #ifdef OPENMP
// TODO comment // TODO comment
void clean(MilanLongInt NLVer, void clean(MilanLongInt NLVer,

@ -1,5 +1,5 @@
#include "MatchBoxPC.h" #include "MatchBoxPC.h"
#ifdef OMP #ifdef OPENMP
/** /**
* 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

@ -1,5 +1,5 @@
#include "MatchBoxPC.h" #include "MatchBoxPC.h"
#ifdef OMP #ifdef OPENMP
void extractUChunk( void extractUChunk(
vector<MilanLongInt> &UChunkBeingProcessed, vector<MilanLongInt> &UChunkBeingProcessed,
vector<MilanLongInt> &U, vector<MilanLongInt> &U,

@ -1,5 +1,5 @@
#include "MatchBoxPC.h" #include "MatchBoxPC.h"
#ifdef OMP #ifdef OPENMP
/// 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,5 +1,5 @@
#include "MatchBoxPC.h" #include "MatchBoxPC.h"
#ifdef OMP #ifdef OPENMP
void initialize(MilanLongInt NLVer, MilanLongInt NLEdge, void initialize(MilanLongInt NLVer, MilanLongInt NLEdge,
MilanLongInt StartIndex, MilanLongInt EndIndex, MilanLongInt StartIndex, MilanLongInt EndIndex,
MilanLongInt *numGhostEdges, MilanLongInt *numGhostEdges,

@ -1,5 +1,5 @@
#include "MatchBoxPC.h" #include "MatchBoxPC.h"
#ifdef OMP #ifdef OPENMP
/** /**
* //TODO documentation * //TODO documentation
* @param k * @param k

@ -1,5 +1,5 @@
#include "MatchBoxPC.h" #include "MatchBoxPC.h"
#ifdef OMP #ifdef OPENMP
void PARALLEL_COMPUTE_CANDIDATE_MATE_B(MilanLongInt NLVer, void PARALLEL_COMPUTE_CANDIDATE_MATE_B(MilanLongInt NLVer,
MilanLongInt *verLocPtr, MilanLongInt *verLocPtr,
MilanLongInt *verLocInd, MilanLongInt *verLocInd,

@ -1,5 +1,5 @@
#include "MatchBoxPC.h" #include "MatchBoxPC.h"
#ifdef OMP #ifdef OPENMP
void PROCESS_CROSS_EDGE(MilanLongInt *edge, void PROCESS_CROSS_EDGE(MilanLongInt *edge,
MilanLongInt *S) MilanLongInt *S)
{ {

@ -1,5 +1,5 @@
#include "MatchBoxPC.h" #include "MatchBoxPC.h"
#ifdef OMP #ifdef OPENMP
void PARALLEL_PROCESS_EXPOSED_VERTEX_B(MilanLongInt NLVer, void PARALLEL_PROCESS_EXPOSED_VERTEX_B(MilanLongInt NLVer,
MilanLongInt *candidateMate, MilanLongInt *candidateMate,
MilanLongInt *verLocInd, MilanLongInt *verLocInd,
@ -113,32 +113,35 @@ void PARALLEL_PROCESS_EXPOSED_VERTEX_B(MilanLongInt NLVer,
} // End of if(w >=0) } // End of if(w >=0)
else { else {
// This piece of code is executed a really small amount of times #pragma omp critical(adjuse)
adj11 = verLocPtr[v]; {
adj12 = verLocPtr[v + 1]; // This piece of code is executed a really small number of times
for (k1 = adj11; k1 < adj12; k1++) { adj11 = verLocPtr[v];
w = verLocInd[k1]; adj12 = verLocPtr[v + 1];
if ((w < StartIndex) || (w > EndIndex)) { // A ghost 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
(*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);
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)

@ -1,5 +1,5 @@
#include "MatchBoxPC.h" #include "MatchBoxPC.h"
#ifdef OMP #ifdef OPENMP
void processMatchedVertices( void processMatchedVertices(
MilanLongInt NLVer, MilanLongInt NLVer,
vector<MilanLongInt> &UChunkBeingProcessed, vector<MilanLongInt> &UChunkBeingProcessed,

@ -1,5 +1,5 @@
#include "MatchBoxPC.h" #include "MatchBoxPC.h"
#ifdef OMP #ifdef OPENMP
//#define DEBUG_HANG_ //#define DEBUG_HANG_
void processMatchedVerticesAndSendMessages( void processMatchedVerticesAndSendMessages(
MilanLongInt NLVer, MilanLongInt NLVer,

@ -1,5 +1,5 @@
#include "MatchBoxPC.h" #include "MatchBoxPC.h"
#ifdef OMP #ifdef OPENMP
//#define DEBUG_HANG_ //#define DEBUG_HANG_
void processMessages( void processMessages(

@ -1,5 +1,5 @@
#include "MatchBoxPC.h" #include "MatchBoxPC.h"
#ifdef OMP #ifdef OPENMP
void queuesTransfer(vector<MilanLongInt> &U, void queuesTransfer(vector<MilanLongInt> &U,
vector<MilanLongInt> &privateU, vector<MilanLongInt> &privateU,
vector<MilanLongInt> &QLocalVtx, vector<MilanLongInt> &QLocalVtx,
@ -17,8 +17,6 @@ void queuesTransfer(vector<MilanLongInt> &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)
{ {
@ -28,6 +26,7 @@ void queuesTransfer(vector<MilanLongInt> &U,
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,5 +1,5 @@
#include "MatchBoxPC.h" #include "MatchBoxPC.h"
#ifdef OMP #ifdef OPENMP
void sendBundledMessages(MilanLongInt *numGhostEdges, void sendBundledMessages(MilanLongInt *numGhostEdges,
MilanInt *BufferSize, MilanInt *BufferSize,
MilanLongInt *Buffer, MilanLongInt *Buffer,

Loading…
Cancel
Save