@@ -41,10 +41,9 @@ mca_coll_base_alltoall_intra_basic_inplace(const void *rbuf, int rcount,
4141 struct ompi_communicator_t * comm ,
4242 mca_coll_base_module_t * module )
4343{
44- mca_coll_base_module_t * base_module = (mca_coll_base_module_t * ) module ;
4544 int i , j , size , rank , err = MPI_SUCCESS , line ;
4645 OPAL_PTRDIFF_TYPE ext , gap ;
47- MPI_Request * preq , * reqs ;
46+ ompi_request_t * req ;
4847 char * tmp_buffer ;
4948 size_t max_size ;
5049
@@ -63,8 +62,6 @@ mca_coll_base_alltoall_intra_basic_inplace(const void *rbuf, int rcount,
6362 max_size = opal_datatype_span (& rdtype -> super , rcount , & gap );
6463
6564 /* Initiate all send/recv to/from others. */
66- reqs = coll_base_comm_get_reqs (base_module -> base_data , 2 );
67- if ( NULL == reqs ) { err = OMPI_ERR_OUT_OF_RESOURCE ; line = __LINE__ ; goto error_hndl ; }
6865
6966 /* Allocate a temporary buffer */
7067 tmp_buffer = calloc (max_size , 1 );
@@ -77,8 +74,6 @@ mca_coll_base_alltoall_intra_basic_inplace(const void *rbuf, int rcount,
7774 /* in-place alltoall slow algorithm (but works) */
7875 for (i = 0 ; i < size ; ++ i ) {
7976 for (j = i + 1 ; j < size ; ++ j ) {
80- preq = reqs ;
81-
8277 if (i == rank ) {
8378 /* Copy the data into the temporary buffer */
8479 err = ompi_datatype_copy_content_same_ddt (rdtype , rcount , tmp_buffer ,
@@ -87,12 +82,12 @@ mca_coll_base_alltoall_intra_basic_inplace(const void *rbuf, int rcount,
8782
8883 /* Exchange data with the peer */
8984 err = MCA_PML_CALL (irecv ((char * ) rbuf + max_size * j , rcount , rdtype ,
90- j , MCA_COLL_BASE_TAG_ALLTOALL , comm , preq ++ ));
85+ j , MCA_COLL_BASE_TAG_ALLTOALL , comm , & req ));
9186 if (MPI_SUCCESS != err ) { line = __LINE__ ; goto error_hndl ; }
9287
93- err = MCA_PML_CALL (isend ((char * ) tmp_buffer , rcount , rdtype ,
88+ err = MCA_PML_CALL (send ((char * ) tmp_buffer , rcount , rdtype ,
9489 j , MCA_COLL_BASE_TAG_ALLTOALL , MCA_PML_BASE_SEND_STANDARD ,
95- comm , preq ++ ));
90+ comm ));
9691 if (MPI_SUCCESS != err ) { line = __LINE__ ; goto error_hndl ; }
9792 } else if (j == rank ) {
9893 /* Copy the data into the temporary buffer */
@@ -102,19 +97,19 @@ mca_coll_base_alltoall_intra_basic_inplace(const void *rbuf, int rcount,
10297
10398 /* Exchange data with the peer */
10499 err = MCA_PML_CALL (irecv ((char * ) rbuf + max_size * i , rcount , rdtype ,
105- i , MCA_COLL_BASE_TAG_ALLTOALL , comm , preq ++ ));
100+ i , MCA_COLL_BASE_TAG_ALLTOALL , comm , & req ));
106101 if (MPI_SUCCESS != err ) { line = __LINE__ ; goto error_hndl ; }
107102
108- err = MCA_PML_CALL (isend ((char * ) tmp_buffer , rcount , rdtype ,
103+ err = MCA_PML_CALL (send ((char * ) tmp_buffer , rcount , rdtype ,
109104 i , MCA_COLL_BASE_TAG_ALLTOALL , MCA_PML_BASE_SEND_STANDARD ,
110- comm , preq ++ ));
105+ comm ));
111106 if (MPI_SUCCESS != err ) { line = __LINE__ ; goto error_hndl ; }
112107 } else {
113108 continue ;
114109 }
115110
116111 /* Wait for the requests to complete */
117- err = ompi_request_wait_all ( 2 , reqs , MPI_STATUSES_IGNORE );
112+ err = ompi_request_wait ( & req , MPI_STATUSES_IGNORE );
118113 if (MPI_SUCCESS != err ) { line = __LINE__ ; goto error_hndl ; }
119114 }
120115 }
@@ -127,7 +122,7 @@ mca_coll_base_alltoall_intra_basic_inplace(const void *rbuf, int rcount,
127122 OPAL_OUTPUT ((ompi_coll_base_framework .framework_output ,
128123 "%s:%4d\tError occurred %d, rank %2d" , __FILE__ , line , err ,
129124 rank ));
130- ompi_coll_base_free_reqs ( reqs , 2 );
125+ ( void ) line ; // silence compiler warning
131126 }
132127
133128 /* All done */
@@ -393,8 +388,10 @@ int ompi_coll_base_alltoall_intra_linear_sync(const void *sbuf, int scount,
393388 total_reqs = (((max_outstanding_reqs > (size - 1 )) ||
394389 (max_outstanding_reqs <= 0 )) ?
395390 (size - 1 ) : (max_outstanding_reqs ));
396- reqs = coll_base_comm_get_reqs (module -> base_data , 2 * total_reqs );
397- if (NULL == reqs ) { error = -1 ; line = __LINE__ ; goto error_hndl ; }
391+ if (0 < total_reqs ) {
392+ reqs = coll_base_comm_get_reqs (module -> base_data , 2 * total_reqs );
393+ if (NULL == reqs ) { error = -1 ; line = __LINE__ ; goto error_hndl ; }
394+ }
398395
399396 prcv = (char * ) rbuf ;
400397 psnd = (char * ) sbuf ;
0 commit comments