From f5cf546dba903c072406b73a1873fb2ed466ee8e Mon Sep 17 00:00:00 2001 From: rahuel Date: Thu, 17 Jan 2008 10:01:24 +0000 Subject: [PATCH] Asynchronisme MPI --- src/ParaMEDMEM/MPI_Access.cxx | 15 ++++++++++++--- src/ParaMEDMEM/MPI_Access.hxx | 6 +++--- src/ParaMEDMEM/MPI_AccessDEC.cxx | 2 ++ 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/ParaMEDMEM/MPI_Access.cxx b/src/ParaMEDMEM/MPI_Access.cxx index c4cf555fc..50a22e77d 100644 --- a/src/ParaMEDMEM/MPI_Access.cxx +++ b/src/ParaMEDMEM/MPI_Access.cxx @@ -270,6 +270,7 @@ int MPI_Access::RecvRequestIds(int sourcerank, int size, int *ArrayOfRecvRequest int MPI_Access::Send(void* buffer, int count, MPI_Datatype datatype, int target, int &RequestId) { int sts = MPI_SUCCESS ; + RequestId = -1 ; if ( count ) { _MessageIdent aMethodIdent = MethodId( datatype ) ; int MPItag = NewSendTag( datatype, target , aMethodIdent , false , RequestId ) ; @@ -287,6 +288,10 @@ int MPI_Access::Send(void* buffer, int count, MPI_Datatype datatype, int target, int MPI_Access::Recv(void* buffer, int count, MPI_Datatype datatype, int source, int &RequestId, int *OutCount) { int sts = MPI_SUCCESS ; + RequestId = -1 ; + if ( OutCount != NULL ) { + *OutCount = -1 ; + } if ( count ) { _MessageIdent aMethodIdent = MethodId( datatype ) ; int MPItag = NewRecvTag( datatype, source , aMethodIdent , false , RequestId ) ; @@ -311,6 +316,7 @@ int MPI_Access::Recv(void* buffer, int count, MPI_Datatype datatype, int source, int MPI_Access::ISend(void* buffer, int count, MPI_Datatype datatype, int target, int &RequestId) { int sts = MPI_SUCCESS ; + RequestId = -1 ; if ( count ) { _MessageIdent aMethodIdent = MethodId( datatype ) ; int MPItag = NewSendTag( datatype, target , aMethodIdent , true , RequestId ) ; @@ -328,6 +334,7 @@ int MPI_Access::ISend(void* buffer, int count, MPI_Datatype datatype, int target int MPI_Access::IRecv(void* buffer, int count, MPI_Datatype datatype, int source, int &RequestId) { int sts = MPI_SUCCESS ; + RequestId = -1 ; if ( count ) { _MessageIdent aMethodIdent = MethodId( datatype ) ; int MPItag = NewRecvTag( datatype, source , aMethodIdent , true , RequestId ) ; @@ -596,6 +603,7 @@ int MPI_Access::Probe(int FromSource, int &source, int &MPITag, else { source = -1 ; MPITag = -1 ; + datatype = 0 ; outcount = -1 ; } return sts ; @@ -622,6 +630,7 @@ int MPI_Access::IProbe(int FromSource, int &source, int &MPITag, else { source = -1 ; MPITag = -1 ; + datatype = 0 ; outcount = -1 ; } return sts ; @@ -770,12 +779,12 @@ void MPI_Access::Check() const { for ( MapOfRequestStructiterator = _MapOfRequestStruct.begin() ; MapOfRequestStructiterator != _MapOfRequestStruct.end() ; MapOfRequestStructiterator++ ) { - cout << " Check" << _MyRank << " " << i << ". Request" - << MapOfRequestStructiterator->first << "-->" ; if ( MapOfRequestStructiterator->second == NULL ) { - cout << " MapOfRequestStructiterator->second == NULL" << endl ; +// cout << " MapOfRequestStructiterator->second == NULL" << endl ; } else { + cout << " Check" << _MyRank << " " << i << ". Request" + << MapOfRequestStructiterator->first << "-->" ; if ( (MapOfRequestStructiterator->second)->MPIAsynchronous ) { cout << "I" ; } diff --git a/src/ParaMEDMEM/MPI_Access.hxx b/src/ParaMEDMEM/MPI_Access.hxx index e78b7f202..5bb256e54 100644 --- a/src/ParaMEDMEM/MPI_Access.hxx +++ b/src/ParaMEDMEM/MPI_Access.hxx @@ -294,6 +294,9 @@ class MPI_Access { } inline void MPI_Access::DeleteSendRecvRequest( int RequestId ) { + if ( _Trace ) + cout << "MPI_Access::DeleteSendRecvRequest" << _MyRank + << "( " << RequestId << " ) " << endl ; if ( MPIIsRecv( RequestId ) ) { _RecvRequests[ MPITarget( RequestId ) ].remove( RequestId ) ; } @@ -333,9 +336,6 @@ class MPI_Access { struct RequestStruct *aRequestStruct = _MapOfRequestStruct[ RequestId ] ; if ( aRequestStruct ) { aRequestStruct->MPICompleted = completed ; - //if ( completed ) { - // DeleteRequest( RequestId ) ; - //} } } inline void MPI_Access::SetMPIOutCount( int RequestId , int outcount ) { diff --git a/src/ParaMEDMEM/MPI_AccessDEC.cxx b/src/ParaMEDMEM/MPI_AccessDEC.cxx index 09389f49f..83bdf8da6 100644 --- a/src/ParaMEDMEM/MPI_AccessDEC.cxx +++ b/src/ParaMEDMEM/MPI_AccessDEC.cxx @@ -791,6 +791,7 @@ int MPI_AccessDEC::CheckFinalRecv() { else { delete [] (double *) (*_DataMessages)[target][0] ; } + (*_DataMessages)[target][0] = NULL ; } if ( (*_DataMessages)[target][1] != NULL ) { if ( _DataMessagesType == MPI_INT ) { @@ -799,6 +800,7 @@ int MPI_AccessDEC::CheckFinalRecv() { else { delete [] (double *) (*_DataMessages)[target][1] ; } + (*_DataMessages)[target][1] = NULL ; } } } -- 2.39.2