@@ -46,43 +46,35 @@ ompi_coll_base_sendrecv_zero( int dest, int stag,
4646 MPI_Comm comm )
4747
4848{
49- int err , rc , line = 0 ;
50- ompi_request_t * req ;
49+ int rc , line = 0 ;
50+ ompi_request_t * req = MPI_REQUEST_NULL ;
5151 ompi_status_public_t status ;
5252
5353 /* post new irecv */
54- err = MCA_PML_CALL (irecv ( NULL , 0 , MPI_BYTE , source , rtag ,
55- comm , & req ));
56- if ( err != MPI_SUCCESS ) { line = __LINE__ ; goto error_handler ; }
54+ rc = MCA_PML_CALL (irecv ( NULL , 0 , MPI_BYTE , source , rtag ,
55+ comm , & req ));
56+ if ( MPI_SUCCESS != rc ) { line = __LINE__ ; goto error_handler ; }
5757
5858 /* send data to children */
5959 rc = MCA_PML_CALL (send ( NULL , 0 , MPI_BYTE , dest , stag ,
6060 MCA_PML_BASE_SEND_STANDARD , comm ));
61- if (rc != MPI_SUCCESS ) { line = __LINE__ ; err = rc ; goto error_handler ; }
62-
63- err = ompi_request_wait ( & req , & status );
64- if ( MPI_ERR_IN_STATUS == err ) { line = __LINE__ ;
65- /* As we use wait_all we will get MPI_ERR_IN_STATUS which is not an error
66- * code that we can propagate up the stack. Instead, look for the real
67- * error code from the MPI_ERROR in the status.
68- */
69- err = status .MPI_ERROR ;
70- OPAL_OUTPUT ((ompi_coll_base_framework .framework_output , "%s:%d: Error %d occurred in the receive"
71- " stage of ompi_coll_base_sendrecv_zero\n" ,
72- __FILE__ , line , err ));
73- return err ;
74- }
75- if (err != MPI_SUCCESS ) { line = __LINE__ ; goto error_handler ; }
61+ if ( MPI_SUCCESS != rc ) { line = __LINE__ ; goto error_handler ; }
62+
63+ rc = ompi_request_wait ( & req , & status );
64+ if ( MPI_SUCCESS != rc ) { line = __LINE__ ; goto error_handler ; }
7665
7766 return (MPI_SUCCESS );
7867
7968 error_handler :
80- /* Error discovered during the posting of the irecv or isend,
81- * and no status is available.
82- */
69+ if ( MPI_REQUEST_NULL != req ) { /* cancel and complete the receive request */
70+ (void )ompi_request_cancel (req );
71+ (void )ompi_request_wait (& req , & status );
72+ }
73+
8374 OPAL_OUTPUT ((ompi_coll_base_framework .framework_output , "%s:%d: Error %d occurred\n" ,
84- __FILE__ , line , err ));
85- return err ;
75+ __FILE__ , line , rc ));
76+ (void )line ; // silence compiler warning
77+ return rc ;
8678}
8779
8880/*
0 commit comments