From 532701031e60d68c4b97df952389339c48f855c9 Mon Sep 17 00:00:00 2001 From: StefanoPetrilli Date: Thu, 2 Jun 2022 09:15:31 -0500 Subject: [PATCH] Extendend parallel region after SEND PACKET BUNDLE Nothing parallelizable founded --- ...mEdgesLinearSearchMesgBndlSmallMateCMP.cpp | 176 ++++++++++-------- samples/advanced/pdegen/runs/amg_pde3d.inp | 2 +- 2 files changed, 99 insertions(+), 79 deletions(-) diff --git a/amgprec/impl/aggregator/algoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP.cpp b/amgprec/impl/aggregator/algoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP.cpp index 9f3cbb97..2a541e9f 100644 --- a/amgprec/impl/aggregator/algoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP.cpp +++ b/amgprec/impl/aggregator/algoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP.cpp @@ -213,7 +213,15 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP( MilanLongInt S; MilanLongInt privateMyCard = 0; staticQueue U, privateU, privateQLocalVtx, privateQGhostVtx, privateQMsgType, privateQOwner; - + MilanLongInt myIndex = 0; + vector PCumulative, PMessageBundle, PSizeInfoMessages; + vector SRequest; //Requests that are used for each send message + vector SStatus; //Status of sent messages, used in MPI_Wait + MilanLongInt MessageIndex = 0; //Pointer for current message + MilanInt OneMessageSize = 0; + MilanLongInt numMessagesToSend; + MilanInt BufferSize; + MilanLongInt *Buffer; bool isEmpty; #ifdef TIME_TRACKER double Ghost2LocalInitialization = MPI_Wtime(); @@ -868,7 +876,6 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP( omp_get_thread_num(), myRank); #endif - } // end of parallel region ///////////////////////// END OF PROCESS MATCHED VERTICES ///////////////////////// @@ -878,28 +885,34 @@ void dalgoDistEdgeApproxDomEdgesLinearSearchMesgBndlSmallMateCMP( ///////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////// SEND BUNDLED MESSAGES ///////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////// - //Data structures for Bundled Messages: - vector PCumulative, PMessageBundle, PSizeInfoMessages; - MilanLongInt myIndex=0; - try { - PMessageBundle.reserve(NumMessagesBundled*3); //Three integers per message - PCumulative.reserve(numProcs+1); //Similar to Row Pointer vector in CSR data structure - PSizeInfoMessages.reserve(numProcs*3); //Buffer to hold the Size info message packets - } catch ( length_error ) { - cout<<"Error in function algoDistEdgeApproxDominatingEdgesMessageBundling: \n"; - cout<<"Not enough memory to allocate the internal variables \n"; - exit(1); - } - PMessageBundle.resize(NumMessagesBundled*3, -1);//Initialize - PCumulative.resize(numProcs+1, 0); //Only initialize the counter variable - PSizeInfoMessages.resize(numProcs*3, 0); - - for (MilanInt i=0; i SRequest; //Requests that are used for each send message - vector SStatus; //Status of sent messages, used in MPI_Wait - MilanLongInt MessageIndex=0; //Pointer for current message - try { - SRequest.reserve(numProcs*2); //At most two messages per processor - SStatus.reserve(numProcs*2);//At most two messages per processor - } catch ( length_error ) { - cout<<"Error in function algoDistEdgeApproxDominatingEdgesLinearSearchImmediateSend: \n"; - cout<<"Not enough memory to allocate the internal variables \n"; - exit(1); - } - MPI_Request myReq; //A sample request - SRequest.resize(numProcs*2,myReq); - MPI_Status myStat; //A sample status - SStatus.resize(numProcs*2,myStat); - //Send the Messages - for (MilanInt i=0; i 0 ) { //Send only if it is a nonempty packet - MPI_Isend(&PSizeInfoMessages[i*3+0], 3, TypeMap(), i, ComputeTag, comm, &SRequest[MessageIndex]); - msgActual++; - MessageIndex++; - //Now Send the message with the data packet: -#ifdef PRINT_DEBUG_INFO_ - cout<<"\n("< 0) { //Send only if it is a nonempty packet + MPI_Isend(&PSizeInfoMessages[i * 3 + 0], 3, TypeMap(), i, ComputeTag, comm, + &SRequest[MessageIndex]); + msgActual++; + MessageIndex++; + //Now Send the message with the data packet: +#ifdef PRINT_DEBUG_INFO_ + cout<<"\n("<(), i, BundleTag, comm, &SRequest[MessageIndex]); - MessageIndex++; - } //End of if size > 0 - } - //Free up temporary memory: - PCumulative.clear(); - QLocalVtx.clear(); - QGhostVtx.clear(); - QMsgType.clear(); - QOwner.clear(); + MPI_Isend(&PMessageBundle[PCumulative[i] * 3], PSizeInfoMessages[i * 3 + 0], + TypeMap(), i, BundleTag, comm, &SRequest[MessageIndex]); + MessageIndex++; + } //End of if size > 0 + } + //Free up temporary memory: + PCumulative.clear(); + QLocalVtx.clear(); + QGhostVtx.clear(); + QMsgType.clear(); + QOwner.clear(); + + #ifdef PRINT_DEBUG_INFO_ cout<<"\n("<