17
17
* Copyright (c) 2014-2017 Research Organization for Information Science
18
18
* and Technology (RIST). All rights reserved.
19
19
* Copyright (c) 2017 IBM Corporation. All rights reserved.
20
+ * Copyright (c) 2021 Amazon.com, Inc. or its affiliates. All Rights
21
+ * reserved.
20
22
* $COPYRIGHT$
21
23
*
22
24
* Additional copyrights may follow
@@ -52,7 +54,8 @@ mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, const int *rcounts
52
54
mca_coll_base_module_t * module )
53
55
{
54
56
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 ;
56
59
char * tmp_buffer ;
57
60
size_t packed_size = 0 , max_size ;
58
61
opal_convertor_t convertor ;
@@ -87,6 +90,8 @@ mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, const int *rcounts
87
90
}
88
91
#endif /* OPAL_ENABLE_HETEROGENEOUS_SUPPORT */
89
92
93
+ ompi_datatype_type_extent (rdtype , & extent );
94
+
90
95
/* Allocate a temporary buffer */
91
96
tmp_buffer = calloc (max_size , 1 );
92
97
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
102
107
ompi_proc_t * right_proc = ompi_comm_peer_lookup (comm , right );
103
108
opal_convertor_clone (right_proc -> super .proc_convertor , & convertor , 0 );
104
109
opal_convertor_prepare_for_send (& convertor , & rdtype -> super , rcounts [right ],
105
- (char * ) rbuf + rdisps [right ]);
110
+ (char * ) rbuf + rdisps [right ] * extent );
106
111
packed_size = max_size ;
107
112
err = opal_convertor_pack (& convertor , & iov , & iov_count , & packed_size );
108
113
if (1 != err ) { goto error_hndl ; }
109
114
110
115
/* 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 ));
113
118
if (MPI_SUCCESS != err ) { goto error_hndl ; }
114
119
}
115
120
116
121
if ( (left != right ) && (0 != rcounts [left ]) ) {
117
122
/* 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 ,
120
125
comm ));
121
126
if (MPI_SUCCESS != err ) { goto error_hndl ; }
122
127
123
128
err = ompi_request_wait (& req , MPI_STATUSES_IGNORE );
124
129
if (MPI_SUCCESS != err ) { goto error_hndl ; }
125
130
126
131
/* 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 ));
129
134
if (MPI_SUCCESS != err ) { goto error_hndl ; }
130
135
}
131
136
132
137
if ( 0 != rcounts [right ] ) { /* nothing to exchange with the peer on the right */
133
138
/* Send data to the right */
134
139
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 ,
136
141
comm ));
137
142
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 ; }
141
143
}
144
+
145
+ err = ompi_request_wait (& req , MPI_STATUSES_IGNORE );
146
+ if (MPI_SUCCESS != err ) { goto error_hndl ; }
142
147
}
143
148
144
149
error_hndl :
0 commit comments