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

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

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