omp task in clean.cpp, lock destroy

omp-walther
StefanoPetrilli 2 years ago
parent 36bd3a51a2
commit c7e8193514

@ -234,7 +234,8 @@ extern "C"
staticQueue &privateQMsgType,
staticQueue &privateQOwner);
void clean(MilanInt myRank,
void clean(MilanLongInt NLVer,
MilanInt myRank,
MilanLongInt MessageIndex,
vector<MPI_Request> &SRequest,
vector<MPI_Status> &SStatus,
@ -245,7 +246,8 @@ extern "C"
MilanLongInt msgInd,
MilanLongInt *msgIndSent,
MilanLongInt NumMessagesBundled,
MilanReal *msgPercent);
MilanReal *msgPercent,
omp_lock_t *MateLock);
void PARALLEL_COMPUTE_CANDIDATE_MATE_B(MilanLongInt NLVer,
MilanLongInt *verLocPtr,

@ -789,7 +789,8 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
#endif
} // End of while (true)
clean(myRank,
clean(NLVer,
myRank,
MessageIndex,
SRequest,
SStatus,
@ -800,7 +801,8 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP(
msgInd,
msgIndSent,
NumMessagesBundled,
msgPercent);
msgPercent,
MateLock);
finishTime = MPI_Wtime();
*ph2_time = finishTime - startTime; // Time taken for Phase-2

@ -4,7 +4,8 @@
// TODO use task
// TODO destroy the locks
void clean(MilanInt myRank,
void clean(MilanLongInt NLVer,
MilanInt myRank,
MilanLongInt MessageIndex,
vector<MPI_Request> &SRequest,
vector<MPI_Status> &SStatus,
@ -15,10 +16,18 @@ void clean(MilanInt myRank,
MilanLongInt msgInd,
MilanLongInt *msgIndSent,
MilanLongInt NumMessagesBundled,
MilanReal *msgPercent)
MilanReal *msgPercent,
omp_lock_t *MateLock)
{
// Cleanup Phase
#pragma omp parallel
{
#pragma omp master
{
#pragma omp task
{
#ifdef PRINT_DEBUG_INFO_
cout << "\n(" << myRank << ") Waitall= " << endl;
fflush(stdout);
@ -37,6 +46,7 @@ void clean(MilanInt myRank,
MPI_Buffer_detach(&Buffer, &BufferSize); // Detach the Buffer
free(Buffer); // Free the memory that was allocated
}
}
#ifdef PRINT_DEBUG_INFO_
cout << "\n(" << myRank << ")End of function to compute matching: " << endl;
@ -60,6 +70,8 @@ void clean(MilanInt myRank,
fflush(stdout);
#endif
#pragma omp task
{
*msgActualSent = msgActual;
*msgIndSent = msgInd;
if (msgInd > 0)
@ -70,6 +82,11 @@ void clean(MilanInt myRank,
{
*msgPercent = 0;
}
}
// Destroy the locks
#pragma omp taskloop num_tasks(NUM_THREAD)
for (int i = 0; i < NLVer; i++)
omp_destroy_lock(&MateLock[i]);
#ifdef DEBUG_HANG_
if (myRank == 0)
@ -77,3 +94,5 @@ void clean(MilanInt myRank,
fflush(stdout);
#endif
}
}
}
Loading…
Cancel
Save