queueTransfer optimization in processMatchedVertices

omp-walther
StefanoPetrilli 2 years ago
parent 9d1a416f99
commit e328f3969c

@ -65,8 +65,8 @@
using namespace std; using namespace std;
#define NUM_THREAD 4 const int NUM_THREAD = 2;
#define UCHUNK 5 const int UCHUNK = 50;
const MilanLongInt REQUEST = 1; const MilanLongInt REQUEST = 1;
const MilanLongInt SUCCESS = 2; const MilanLongInt SUCCESS = 2;

@ -199,10 +199,11 @@ void processMatchedVertices(
Message[1] = w; // GHOST Message[1] = w; // GHOST
Message[2] = REQUEST; // TYPE Message[2] = REQUEST; // TYPE
// Send a Request (Asynchronous) // Send a Request (Asynchronous)
//#pragma omp master
// { printf("Send case 2: (%ld, %ld, %ld)\n", Message[0], Message[1], Message[2]);
fflush(stdout);
MPI_Bsend(&Message[0], 3, TypeMap<MilanLongInt>(), ghostOwner, ComputeTag, comm); MPI_Bsend(&Message[0], 3, TypeMap<MilanLongInt>(), ghostOwner, ComputeTag, comm);
// }
#pragma omp atomic #pragma omp atomic
(*msgActual)++; (*msgActual)++;
} }
@ -254,10 +255,10 @@ void processMatchedVertices(
Message[1] = w; // GHOST Message[1] = w; // GHOST
Message[2] = FAILURE; // TYPE Message[2] = FAILURE; // TYPE
// Send a Request (Asynchronous) // Send a Request (Asynchronous)
//#pragma omp master
// { printf("Send case 4: (%ld, %ld, %ld)\n", Message[0], Message[1], Message[2]);
fflush(stdout);
MPI_Bsend(&Message[0], 3, TypeMap<MilanLongInt>(), ghostOwner, ComputeTag, comm); MPI_Bsend(&Message[0], 3, TypeMap<MilanLongInt>(), ghostOwner, ComputeTag, comm);
// }
#pragma omp atomic #pragma omp atomic
(*msgActual)++; (*msgActual)++;
} }
@ -300,10 +301,9 @@ void processMatchedVertices(
Message[2] = SUCCESS; // TYPE Message[2] = SUCCESS; // TYPE
// Send a Request (Asynchronous) // Send a Request (Asynchronous)
//#pragma omp master // printf("Send case 5: (%ld, %ld, %ld)\n", Message[0], Message[1], Message[2]);
// { fflush(stdout);
MPI_Bsend(&Message[0], 3, TypeMap<MilanLongInt>(), ghostOwner, ComputeTag, comm); MPI_Bsend(&Message[0], 3, TypeMap<MilanLongInt>(), ghostOwner, ComputeTag, comm);
// }
#pragma omp atomic #pragma omp atomic
(*msgActual)++; (*msgActual)++;
} }
@ -327,39 +327,17 @@ void processMatchedVertices(
} // End of switch } // End of switch
} // End of inner for } // End of inner for
// TODO privateU.size() < UCHUNK could be commented but it generate errors, why?
if (privateU.size() > UCHUNK || U.empty())
{
#pragma omp critical(U)
{
while (!privateU.empty())
U.push_back(privateU.pop_back());
}
#ifndef error
#pragma omp critical(privateMsg)
{
while (!privateQLocalVtx.empty())
{
QLocalVtx.push_back(privateQLocalVtx.pop_back());
QGhostVtx.push_back(privateQGhostVtx.pop_back());
QMsgType.push_back(privateQMsgType.pop_back());
QOwner.push_back(privateQOwner.pop_back());
}
}
#endif
} // End of private.size()
} }
} // End of outer for } // End of outer for
} // End of while ( !U.empty() )
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() )
#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",

@ -28,6 +28,8 @@ void processMessages(
staticQueue &U) staticQueue &U)
{ {
//#define PRINT_DEBUG_INFO_
MilanInt Sender; MilanInt Sender;
MPI_Status computeStatus; MPI_Status computeStatus;
MilanLongInt bundleSize, w; MilanLongInt bundleSize, w;
@ -92,6 +94,8 @@ void processMessages(
if (Message[2] == SIZEINFO) if (Message[2] == SIZEINFO)
{ {
//printf("Inizio sizeinfo\n");
fflush(stdout);
#ifdef PRINT_DEBUG_INFO_ #ifdef PRINT_DEBUG_INFO_
cout << "\n(" << myRank << ")Received bundled message from Process " << Sender << " Size= " << Message[0] << endl; cout << "\n(" << myRank << ")Received bundled message from Process " << Sender << " Size= " << Message[0] << endl;
@ -124,6 +128,9 @@ void processMessages(
cout << endl; cout << endl;
fflush(stdout); fflush(stdout);
#endif #endif
//printf("Fine sizeinfo\n");
fflush(stdout);
} }
else else
{ // Just a single message: { // Just a single message:

Loading…
Cancel
Save