@@ -42,7 +42,7 @@ mca_coll_base_alltoall_intra_basic_inplace(const void *rbuf, int rcount,
4242 mca_coll_base_module_t * module )
4343{
4444 mca_coll_base_module_t * base_module = (mca_coll_base_module_t * ) module ;
45- int i , j , size , rank , err = MPI_SUCCESS ;
45+ int i , j , size , rank , err = MPI_SUCCESS , line ;
4646 MPI_Request * preq ;
4747 char * tmp_buffer ;
4848 size_t max_size ;
@@ -80,48 +80,54 @@ mca_coll_base_alltoall_intra_basic_inplace(const void *rbuf, int rcount,
8080 /* Copy the data into the temporary buffer */
8181 err = ompi_datatype_copy_content_same_ddt (rdtype , rcount , tmp_buffer ,
8282 (char * ) rbuf + j * max_size );
83- if (MPI_SUCCESS != err ) { goto error_hndl ; }
83+ if (MPI_SUCCESS != err ) { line = __LINE__ ; goto error_hndl ; }
8484
8585 /* Exchange data with the peer */
8686 err = MCA_PML_CALL (irecv ((char * ) rbuf + max_size * j , rcount , rdtype ,
8787 j , MCA_COLL_BASE_TAG_ALLTOALL , comm , preq ++ ));
88- if (MPI_SUCCESS != err ) { goto error_hndl ; }
88+ if (MPI_SUCCESS != err ) { line = __LINE__ ; goto error_hndl ; }
8989
9090 err = MCA_PML_CALL (isend ((char * ) tmp_buffer , rcount , rdtype ,
9191 j , MCA_COLL_BASE_TAG_ALLTOALL , MCA_PML_BASE_SEND_STANDARD ,
9292 comm , preq ++ ));
93- if (MPI_SUCCESS != err ) { goto error_hndl ; }
93+ if (MPI_SUCCESS != err ) { line = __LINE__ ; goto error_hndl ; }
9494 } else if (j == rank ) {
9595 /* Copy the data into the temporary buffer */
9696 err = ompi_datatype_copy_content_same_ddt (rdtype , rcount , tmp_buffer ,
9797 (char * ) rbuf + i * max_size );
98- if (MPI_SUCCESS != err ) { goto error_hndl ; }
98+ if (MPI_SUCCESS != err ) { line = __LINE__ ; goto error_hndl ; }
9999
100100 /* Exchange data with the peer */
101101 err = MCA_PML_CALL (irecv ((char * ) rbuf + max_size * i , rcount , rdtype ,
102102 i , MCA_COLL_BASE_TAG_ALLTOALL , comm , preq ++ ));
103- if (MPI_SUCCESS != err ) { goto error_hndl ; }
103+ if (MPI_SUCCESS != err ) { line = __LINE__ ; goto error_hndl ; }
104104
105105 err = MCA_PML_CALL (isend ((char * ) tmp_buffer , rcount , rdtype ,
106106 i , MCA_COLL_BASE_TAG_ALLTOALL , MCA_PML_BASE_SEND_STANDARD ,
107107 comm , preq ++ ));
108- if (MPI_SUCCESS != err ) { goto error_hndl ; }
108+ if (MPI_SUCCESS != err ) { line = __LINE__ ; goto error_hndl ; }
109109 } else {
110110 continue ;
111111 }
112112
113113 /* Wait for the requests to complete */
114114 err = ompi_request_wait_all (2 , base_module -> base_data -> mcct_reqs , MPI_STATUSES_IGNORE );
115- if (MPI_SUCCESS != err ) { goto error_hndl ; }
115+ if (MPI_SUCCESS != err ) { line = __LINE__ ; goto error_hndl ; }
116116 }
117117 }
118118
119119 error_hndl :
120120 /* Free the temporary buffer */
121121 free (tmp_buffer );
122122
123- /* All done */
123+ if ( MPI_SUCCESS != err ) {
124+ OPAL_OUTPUT ((ompi_coll_base_framework .framework_output ,
125+ "%s:%4d\tError occurred %d, rank %2d" , __FILE__ , line , err ,
126+ rank ));
127+ ompi_coll_base_free_reqs (base_module -> base_data -> mcct_reqs , 2 );
128+ }
124129
130+ /* All done */
125131 return err ;
126132}
127133
@@ -385,8 +391,7 @@ int ompi_coll_base_alltoall_intra_linear_sync(const void *sbuf, int scount,
385391 total_reqs = (((max_outstanding_reqs > (size - 1 )) ||
386392 (max_outstanding_reqs <= 0 )) ?
387393 (size - 1 ) : (max_outstanding_reqs ));
388- reqs = (ompi_request_t * * ) malloc ( 2 * total_reqs *
389- sizeof (ompi_request_t * ));
394+ reqs = coll_base_comm_get_reqs (module -> base_data , 2 * total_reqs );
390395 if (NULL == reqs ) { error = -1 ; line = __LINE__ ; goto error_hndl ; }
391396
392397 prcv = (char * ) rbuf ;
@@ -458,17 +463,14 @@ int ompi_coll_base_alltoall_intra_linear_sync(const void *sbuf, int scount,
458463 }
459464 }
460465
461- /* Free the reqs */
462- free (reqs );
463-
464466 /* All done */
465467 return MPI_SUCCESS ;
466468
467469 error_hndl :
468470 OPAL_OUTPUT ((ompi_coll_base_framework .framework_output ,
469471 "%s:%4d\tError occurred %d, rank %2d" , __FILE__ , line , error ,
470472 rank ));
471- if ( NULL != reqs ) free ( reqs );
473+ ompi_coll_base_free_reqs ( reqs , 2 * total_reqs );
472474 return error ;
473475}
474476
@@ -554,7 +556,7 @@ int ompi_coll_base_alltoall_intra_basic_linear(const void *sbuf, int scount,
554556 struct ompi_communicator_t * comm ,
555557 mca_coll_base_module_t * module )
556558{
557- int i , rank , size , err , nreqs ;
559+ int i , rank , size , err , nreqs , line ;
558560 char * psnd , * prcv ;
559561 MPI_Aint lb , sndinc , rcvinc ;
560562 ompi_request_t * * req , * * sreq , * * rreq ;
@@ -616,10 +618,7 @@ int ompi_coll_base_alltoall_intra_basic_linear(const void *sbuf, int scount,
616618 err = MCA_PML_CALL (irecv_init
617619 (prcv + (ptrdiff_t )i * rcvinc , rcount , rdtype , i ,
618620 MCA_COLL_BASE_TAG_ALLTOALL , comm , rreq ));
619- if (MPI_SUCCESS != err ) {
620- ompi_coll_base_free_reqs (req , nreqs );
621- return err ;
622- }
621+ if (MPI_SUCCESS != err ) { line = __LINE__ ; goto err_hndl ; }
623622 }
624623
625624 /* Now post all sends in reverse order
@@ -633,10 +632,7 @@ int ompi_coll_base_alltoall_intra_basic_linear(const void *sbuf, int scount,
633632 (psnd + (ptrdiff_t )i * sndinc , scount , sdtype , i ,
634633 MCA_COLL_BASE_TAG_ALLTOALL ,
635634 MCA_PML_BASE_SEND_STANDARD , comm , sreq ));
636- if (MPI_SUCCESS != err ) {
637- ompi_coll_base_free_reqs (req , nreqs );
638- return err ;
639- }
635+ if (MPI_SUCCESS != err ) { line = __LINE__ ; goto err_hndl ; }
640636 }
641637
642638 /* Start your engines. This will never return an error. */
@@ -652,8 +648,13 @@ int ompi_coll_base_alltoall_intra_basic_linear(const void *sbuf, int scount,
652648
653649 err = ompi_request_wait_all (nreqs , req , MPI_STATUSES_IGNORE );
654650
655- /* Free the reqs */
656- ompi_coll_base_free_reqs (req , nreqs );
651+ err_hndl :
652+ if ( MPI_SUCCESS != err ) {
653+ OPAL_OUTPUT ( (ompi_coll_base_framework .framework_output ,"%s:%4d\tError occurred %d, rank %2d" ,
654+ __FILE__ , line , err , rank ) );
655+ /* Free the reqs */
656+ ompi_coll_base_free_reqs (req , nreqs );
657+ }
657658
658659 /* All done */
659660 return err ;
0 commit comments