U and privateU are now vectors

omp-walther
StefanoPetrilli 2 years ago
parent a259e8ab53
commit 6414d3aef3

@ -183,8 +183,8 @@ extern "C"
MilanLongInt *verLocInd,
MilanReal *edgeLocWeight);
void queuesTransfer(staticQueue &U,
staticQueue &privateU,
void queuesTransfer(vector<MilanLongInt> &U,
vector<MilanLongInt> &privateU,
vector<MilanLongInt> &QLocalVtx,
vector<MilanLongInt> &QGhostVtx,
vector<MilanLongInt> &QMsgType,
@ -231,8 +231,8 @@ extern "C"
vector<MilanLongInt> &QMsgType,
vector<MilanInt> &QOwner,
MilanLongInt *&candidateMate,
staticQueue &U,
staticQueue &privateU,
vector<MilanLongInt> &U,
vector<MilanLongInt> &privateU,
vector<MilanLongInt> &privateQLocalVtx,
vector<MilanLongInt> &privateQGhostVtx,
vector<MilanLongInt> &privateQMsgType,
@ -278,8 +278,8 @@ extern "C"
vector<MilanLongInt> &Counter,
MilanInt myRank,
MilanInt numProcs,
staticQueue &U,
staticQueue &privateU,
vector<MilanLongInt> &U,
vector<MilanLongInt> &privateU,
vector<MilanLongInt> &QLocalVtx,
vector<MilanLongInt> &QGhostVtx,
vector<MilanLongInt> &QMsgType,
@ -295,8 +295,8 @@ extern "C"
void processMatchedVertices(
MilanLongInt NLVer,
vector<MilanLongInt> &UChunkBeingProcessed,
staticQueue &U,
staticQueue &privateU,
vector<MilanLongInt> &U,
vector<MilanLongInt> &privateU,
MilanLongInt StartIndex,
MilanLongInt EndIndex,
MilanLongInt *myCardPtr,
@ -327,8 +327,8 @@ extern "C"
void processMatchedVerticesAndSendMessages(
MilanLongInt NLVer,
vector<MilanLongInt> &UChunkBeingProcessed,
staticQueue &U,
staticQueue &privateU,
vector<MilanLongInt> &U,
vector<MilanLongInt> &privateU,
MilanLongInt StartIndex,
MilanLongInt EndIndex,
MilanLongInt *myCardPtr,
@ -404,12 +404,12 @@ extern "C"
MilanLongInt u,
MilanLongInt v,
MilanLongInt *SPtr,
staticQueue &U);
vector<MilanLongInt> &U);
void extractUChunk(
vector<MilanLongInt> &UChunkBeingProcessed,
staticQueue &U,
staticQueue &privateU);
vector<MilanLongInt> &U,
vector<MilanLongInt> &privateU);
void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
MilanLongInt NLVer, MilanLongInt NLEdge,

@ -182,7 +182,6 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
vector<MilanLongInt> GMate; // Proportional to the number of ghost vertices
MilanLongInt S;
MilanLongInt privateMyCard = 0;
staticQueue U, privateU;
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
@ -192,6 +191,7 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
vector<MilanLongInt> privateQLocalVtx, privateQGhostVtx, privateQMsgType;
vector<MilanInt> privateQOwner;
vector<MilanLongInt> U, privateU;
initialize(NLVer, NLEdge, StartIndex,
EndIndex, &numGhostEdges,
@ -240,7 +240,6 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
* TODO: Test when it's actually more efficient to execute this code
* in parallel.
*/
PARALLEL_PROCESS_EXPOSED_VERTEX_B(NLVer,
candidateMate,
verLocInd,

@ -2,8 +2,8 @@
void extractUChunk(
vector<MilanLongInt> &UChunkBeingProcessed,
staticQueue &U,
staticQueue &privateU)
vector<MilanLongInt> &U,
vector<MilanLongInt> &privateU)
{
UChunkBeingProcessed.clear();
@ -13,7 +13,8 @@ void extractUChunk(
if (U.empty() && !privateU.empty()) // If U is empty but there are nodes in private U
{
while (!privateU.empty())
UChunkBeingProcessed.push_back(privateU.pop_back());
UChunkBeingProcessed.push_back(privateU.back());
privateU.pop_back();
}
else
{
@ -21,9 +22,10 @@ void extractUChunk(
{ // Pop the new nodes
if (U.empty())
break;
UChunkBeingProcessed.push_back(U.pop_back());
UChunkBeingProcessed.push_back(U.back());
U.pop_back();
}
}
} // End of critical U
} // End of critical U // End of critical U
}

@ -19,8 +19,8 @@ void initialize(MilanLongInt NLVer, MilanLongInt NLEdge,
vector<MilanLongInt> &QMsgType,
vector<MilanInt> &QOwner,
MilanLongInt *&candidateMate,
staticQueue &U,
staticQueue &privateU,
vector<MilanLongInt> &U,
vector<MilanLongInt> &privateU,
vector<MilanLongInt> &privateQLocalVtx,
vector<MilanLongInt> &privateQGhostVtx,
vector<MilanLongInt> &privateQMsgType,
@ -288,18 +288,15 @@ void initialize(MilanLongInt NLVer, MilanLongInt NLEdge,
* of a staticQueue I had to destroy the previous object and instantiate
* a new one of the correct size.
*/
new (&U) staticQueue(NLVer + (*numGhostVertices));
// TODO how can I decide a more meaningfull size?
MilanLongInt size = (*numGhostVertices);
// Initialize the privte data structure
new (&privateU) staticQueue(NLVer + (*numGhostVertices)); // TODO how can I put a meaningfull size?
//new (&U) staticQueue(NLVer + (*numGhostVertices));
U.reserve(NLVer + (*numGhostVertices));
// Initialize the private vectors
privateQLocalVtx.reserve(*numGhostVertices);
privateQGhostVtx.reserve(*numGhostVertices);
privateQMsgType.reserve(*numGhostVertices);
privateQOwner.reserve(*numGhostVertices);
privateU.reserve(*numGhostVertices);
} // end of task
} // End of single region

@ -19,8 +19,8 @@ void PARALLEL_PROCESS_EXPOSED_VERTEX_B(MilanLongInt NLVer,
vector<MilanLongInt> &Counter,
MilanInt myRank,
MilanInt numProcs,
staticQueue &U,
staticQueue &privateU,
vector<MilanLongInt> &U,
vector<MilanLongInt> &privateU,
vector<MilanLongInt> &QLocalVtx,
vector<MilanLongInt> &QGhostVtx,
vector<MilanLongInt> &QMsgType,

@ -3,8 +3,8 @@
void processMatchedVertices(
MilanLongInt NLVer,
vector<MilanLongInt> &UChunkBeingProcessed,
staticQueue &U,
staticQueue &privateU,
vector<MilanLongInt> &U,
vector<MilanLongInt> &privateU,
MilanLongInt StartIndex,
MilanLongInt EndIndex,
MilanLongInt *myCard,
@ -275,6 +275,27 @@ void processMatchedVertices(
privateQMsgType,
privateQOwner);
#pragma omp critical(U)
{
U.insert(U.end(), privateU.begin(), privateU.end());
}
privateU.clear();
#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());
}
privateQLocalVtx.clear();
privateQGhostVtx.clear();
privateQMsgType.clear();
privateQOwner.clear();
} // End of while ( !U.empty() )
#ifdef COUNT_LOCAL_VERTEX

@ -3,8 +3,8 @@
void processMatchedVerticesAndSendMessages(
MilanLongInt NLVer,
vector<MilanLongInt> &UChunkBeingProcessed,
staticQueue &U,
staticQueue &privateU,
vector<MilanLongInt> &U,
vector<MilanLongInt> &privateU,
MilanLongInt StartIndex,
MilanLongInt EndIndex,
MilanLongInt *myCard,

@ -25,7 +25,7 @@ void processMessages(
MilanLongInt u,
MilanLongInt v,
MilanLongInt *S,
staticQueue &U)
vector<MilanLongInt> &U)
{
//#define PRINT_DEBUG_INFO_

@ -1,7 +1,7 @@
#include "MatchBoxPC.h"
void queuesTransfer(staticQueue &U,
staticQueue &privateU,
void queuesTransfer(vector<MilanLongInt> &U,
vector<MilanLongInt> &privateU,
vector<MilanLongInt> &QLocalVtx,
vector<MilanLongInt> &QGhostVtx,
vector<MilanLongInt> &QMsgType,
@ -14,10 +14,11 @@ void queuesTransfer(staticQueue &U,
#pragma omp critical(U)
{
while (!privateU.empty())
U.push_back(privateU.pop_back());
U.insert(U.end(), privateU.begin(), privateU.end());
}
privateU.clear();
#pragma omp critical(sendMessageTransfer)
{

Loading…
Cancel
Save