mirror of
https://github.com/sfilippone/amg4psblas.git
synced 2026-10-06 14:44:55 +00:00
Refactoring, eliminated useless passed variables
This commit is contained in:
@@ -73,6 +73,9 @@ const MilanLongInt SUCCESS = 2;
|
||||
const MilanLongInt FAILURE = 3;
|
||||
const MilanLongInt SIZEINFO = 4;
|
||||
|
||||
const int ComputeTag = 7; // Predefined tag
|
||||
const int BundleTag = 9; // Predefined tag
|
||||
|
||||
// MPI type map
|
||||
template <typename T>
|
||||
MPI_Datatype TypeMap();
|
||||
@@ -335,8 +338,6 @@ extern "C"
|
||||
MilanLongInt *MessageIndexPtr,
|
||||
MilanInt numProcs,
|
||||
MilanInt myRank,
|
||||
int ComputeTag,
|
||||
int BundleTag,
|
||||
MPI_Comm comm,
|
||||
vector<MilanLongInt> &QLocalVtx,
|
||||
vector<MilanLongInt> &QGhostVtx,
|
||||
@@ -362,19 +363,13 @@ extern "C"
|
||||
MilanLongInt *verLocPtr,
|
||||
MilanLongInt k,
|
||||
MilanLongInt *verLocInd,
|
||||
int error_codeC,
|
||||
MilanInt numProcs,
|
||||
MilanInt myRank,
|
||||
int ComputeTag,
|
||||
int BundleTag,
|
||||
MPI_Comm comm,
|
||||
vector<MilanLongInt> &Message,
|
||||
char *error_message,
|
||||
int message_length,
|
||||
vector<MilanLongInt> &ReceiveBuffer,
|
||||
MilanLongInt numGhostEdges,
|
||||
MilanLongInt u,
|
||||
MilanLongInt v,
|
||||
MilanLongInt message_type,
|
||||
MilanLongInt *SPtr,
|
||||
staticQueue &U);
|
||||
|
||||
|
||||
+5
-36
@@ -125,26 +125,16 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
|
||||
MilanLongInt EndIndex = verDistance[myRank + 1] - 1; // The ending vertex owned by the current rank
|
||||
|
||||
MPI_Status computeStatus;
|
||||
const int ComputeTag = 7; // Predefined tag
|
||||
const int BundleTag = 9; // Predefined tag //TODO refactor this
|
||||
|
||||
//TODO refactor this
|
||||
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 NLVer=0, NLEdge=0, StartIndex=0, EndIndex=0;
|
||||
MilanLongInt msgActual = 0, msgInd = 0;
|
||||
MilanReal heaviestEdgeWt = 0.0f; // Assumes positive weight
|
||||
MilanReal startTime, finishTime;
|
||||
// MilanReal Precision = MPI_Wtick(); //Get the precision of the MPI Timer
|
||||
|
||||
startTime = MPI_Wtime();
|
||||
|
||||
// Data structures for sending and receiving messages:
|
||||
vector<MilanLongInt> Message; // [ u, v, message_type ]
|
||||
Message.resize(3, -1);
|
||||
MilanLongInt message_type = 0; //TODO refactor this, it could be constants
|
||||
// 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 -
|
||||
@@ -204,7 +194,6 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
|
||||
MilanLongInt *Buffer;
|
||||
|
||||
// Declare the locks
|
||||
// TODO destroy the locks
|
||||
omp_lock_t MateLock[NLVer];
|
||||
|
||||
initialize(NLVer, NLEdge, StartIndex,
|
||||
@@ -341,8 +330,8 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
|
||||
&MessageIndex,
|
||||
numProcs,
|
||||
myRank,
|
||||
ComputeTag,
|
||||
BundleTag,
|
||||
//ComputeTag,
|
||||
//BundleTag,
|
||||
comm,
|
||||
QLocalVtx,
|
||||
QGhostVtx,
|
||||
@@ -376,21 +365,7 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
|
||||
fflush(stdout);
|
||||
fflush(stdout);
|
||||
#endif
|
||||
// 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;
|
||||
MilanLongInt bundleSize = 0, bundleCounter = 0;
|
||||
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);
|
||||
}
|
||||
|
||||
while (true)
|
||||
{
|
||||
#ifdef DEBUG_HANG_
|
||||
@@ -615,19 +590,13 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
|
||||
verLocPtr,
|
||||
k,
|
||||
verLocInd,
|
||||
error_codeC,
|
||||
numProcs,
|
||||
myRank,
|
||||
ComputeTag,
|
||||
BundleTag,
|
||||
comm,
|
||||
Message,
|
||||
error_message,
|
||||
message_length,
|
||||
ReceiveBuffer,
|
||||
numGhostEdges,
|
||||
u,
|
||||
v,
|
||||
message_type,
|
||||
&S,
|
||||
U);
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#include "MatchBoxPC.h"
|
||||
|
||||
//TODO there are many useless parameter passed to this function
|
||||
|
||||
void processMessages(
|
||||
MilanLongInt NLVer,
|
||||
MilanLongInt *Mate,
|
||||
@@ -19,19 +17,13 @@ void processMessages(
|
||||
MilanLongInt *verLocPtr,
|
||||
MilanLongInt k,
|
||||
MilanLongInt *verLocInd,
|
||||
int error_codeC,
|
||||
MilanInt numProcs,
|
||||
MilanInt myRank,
|
||||
int ComputeTag,
|
||||
int BundleTag,
|
||||
MPI_Comm comm,
|
||||
vector<MilanLongInt> &Message,
|
||||
char *error_message,
|
||||
int message_length,
|
||||
vector<MilanLongInt> &ReceiveBuffer,
|
||||
MilanLongInt numGhostEdges,
|
||||
MilanLongInt u,
|
||||
MilanLongInt v,
|
||||
MilanLongInt message_type,
|
||||
MilanLongInt *SPtr,
|
||||
staticQueue &U)
|
||||
{
|
||||
@@ -42,6 +34,25 @@ void processMessages(
|
||||
MilanLongInt S = *SPtr; // TODO refactor this
|
||||
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
|
||||
|
||||
@@ -12,8 +12,6 @@ void sendBundledMessages(MilanLongInt *numGhostEdgesPtr,
|
||||
MilanLongInt *MessageIndexPtr,
|
||||
MilanInt numProcs,
|
||||
MilanInt myRank,
|
||||
int ComputeTag,
|
||||
int BundleTag,
|
||||
MPI_Comm comm,
|
||||
vector<MilanLongInt> &QLocalVtx,
|
||||
vector<MilanLongInt> &QGhostVtx,
|
||||
@@ -24,7 +22,6 @@ void sendBundledMessages(MilanLongInt *numGhostEdgesPtr,
|
||||
{
|
||||
|
||||
MilanLongInt myIndex = 0, msgActual = *msgActualPtr, MessageIndex = *MessageIndexPtr, numGhostEdges = *numGhostEdgesPtr, numMessagesToSend;
|
||||
const MilanLongInt SIZEINFO = 4;
|
||||
MilanInt i = 0, OneMessageSize = 0, BufferSize = *BufferSizePtr;
|
||||
|
||||
#ifdef DEBUG_HANG_
|
||||
|
||||
Reference in New Issue
Block a user