1717 * Copyright (c) 2014-2017 Research Organization for Information Science
1818 * and Technology (RIST). All rights reserved.
1919 * Copyright (c) 2017 IBM Corporation. All rights reserved.
20+ * Copyright (c) 2021 Amazon.com, Inc. or its affiliates. All Rights
21+ * reserved.
2022 * $COPYRIGHT$
2123 *
2224 * Additional copyrights may follow
@@ -52,7 +54,8 @@ mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, const int *rcounts
5254 mca_coll_base_module_t * module )
5355{
5456 int i , size , rank , left , right , err = MPI_SUCCESS , line ;
55- ompi_request_t * req ;
57+ ptrdiff_t extent ;
58+ ompi_request_t * req = MPI_REQUEST_NULL ;
5659 char * tmp_buffer ;
5760 size_t packed_size = 0 , max_size ;
5861 opal_convertor_t convertor ;
@@ -87,6 +90,8 @@ mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, const int *rcounts
8790 }
8891#endif /* OPAL_ENABLE_HETEROGENEOUS_SUPPORT */
8992
93+ ompi_datatype_type_extent (rdtype , & extent );
94+
9095 /* Allocate a temporary buffer */
9196 tmp_buffer = calloc (max_size , 1 );
9297 if ( NULL == tmp_buffer ) { err = OMPI_ERR_OUT_OF_RESOURCE ; line = __LINE__ ; goto error_hndl ; }
@@ -102,43 +107,43 @@ mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, const int *rcounts
102107 ompi_proc_t * right_proc = ompi_comm_peer_lookup (comm , right );
103108 opal_convertor_clone (right_proc -> super .proc_convertor , & convertor , 0 );
104109 opal_convertor_prepare_for_send (& convertor , & rdtype -> super , rcounts [right ],
105- (char * ) rbuf + rdisps [right ]);
110+ (char * ) rbuf + rdisps [right ] * extent );
106111 packed_size = max_size ;
107112 err = opal_convertor_pack (& convertor , & iov , & iov_count , & packed_size );
108113 if (1 != err ) { goto error_hndl ; }
109114
110115 /* Receive data from the right */
111- err = MCA_PML_CALL (irecv ((char * ) rbuf + rdisps [right ], rcounts [right ], rdtype ,
112- right , MCA_COLL_BASE_TAG_ALLTOALLW , comm , & req ));
116+ err = MCA_PML_CALL (irecv ((char * ) rbuf + rdisps [right ] * extent , rcounts [right ], rdtype ,
117+ right , MCA_COLL_BASE_TAG_ALLTOALLV , comm , & req ));
113118 if (MPI_SUCCESS != err ) { goto error_hndl ; }
114119 }
115120
116121 if ( (left != right ) && (0 != rcounts [left ]) ) {
117122 /* Send data to the left */
118- err = MCA_PML_CALL (send ((char * ) rbuf + rdisps [left ], rcounts [left ], rdtype ,
119- left , MCA_COLL_BASE_TAG_ALLTOALLW , MCA_PML_BASE_SEND_STANDARD ,
123+ err = MCA_PML_CALL (send ((char * ) rbuf + rdisps [left ] * extent , rcounts [left ], rdtype ,
124+ left , MCA_COLL_BASE_TAG_ALLTOALLV , MCA_PML_BASE_SEND_STANDARD ,
120125 comm ));
121126 if (MPI_SUCCESS != err ) { goto error_hndl ; }
122127
123128 err = ompi_request_wait (& req , MPI_STATUSES_IGNORE );
124129 if (MPI_SUCCESS != err ) { goto error_hndl ; }
125130
126131 /* Receive data from the left */
127- err = MCA_PML_CALL (irecv ((char * ) rbuf + rdisps [left ], rcounts [left ], rdtype ,
128- left , MCA_COLL_BASE_TAG_ALLTOALLW , comm , & req ));
132+ err = MCA_PML_CALL (irecv ((char * ) rbuf + rdisps [left ] * extent , rcounts [left ], rdtype ,
133+ left , MCA_COLL_BASE_TAG_ALLTOALLV , comm , & req ));
129134 if (MPI_SUCCESS != err ) { goto error_hndl ; }
130135 }
131136
132137 if ( 0 != rcounts [right ] ) { /* nothing to exchange with the peer on the right */
133138 /* Send data to the right */
134139 err = MCA_PML_CALL (send ((char * ) tmp_buffer , packed_size , MPI_PACKED ,
135- right , MCA_COLL_BASE_TAG_ALLTOALLW , MCA_PML_BASE_SEND_STANDARD ,
140+ right , MCA_COLL_BASE_TAG_ALLTOALLV , MCA_PML_BASE_SEND_STANDARD ,
136141 comm ));
137142 if (MPI_SUCCESS != err ) { goto error_hndl ; }
138-
139- err = ompi_request_wait (& req , MPI_STATUSES_IGNORE );
140- if (MPI_SUCCESS != err ) { goto error_hndl ; }
141143 }
144+
145+ err = ompi_request_wait (& req , MPI_STATUSES_IGNORE );
146+ if (MPI_SUCCESS != err ) { goto error_hndl ; }
142147 }
143148
144149 error_hndl :
0 commit comments