@@ -44,14 +44,13 @@ mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, const int *rcounts
4444{
4545 int i , j , size , rank , err = MPI_SUCCESS ;
4646 char * allocated_buffer , * tmp_buffer ;
47- size_t max_size , rdtype_size ;
47+ size_t max_size ;
4848 ptrdiff_t ext , gap = 0 ;
4949
5050 /* Initialize. */
5151
5252 size = ompi_comm_size (comm );
5353 rank = ompi_comm_rank (comm );
54- ompi_datatype_type_size (rdtype , & rdtype_size );
5554
5655 /* If only one process, we're done. */
5756 if (1 == size ) {
@@ -68,6 +67,10 @@ mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, const int *rcounts
6867 }
6968 /* The gap will always be the same as we are working on the same datatype */
7069
70+ if (OPAL_UNLIKELY (0 == max_size )) {
71+ return MPI_SUCCESS ;
72+ }
73+
7174 /* Allocate a temporary buffer */
7275 allocated_buffer = calloc (max_size , 1 );
7376 if (NULL == allocated_buffer ) {
@@ -79,7 +82,7 @@ mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, const int *rcounts
7982 /* in-place alltoallv slow algorithm (but works) */
8083 for (i = 0 ; i < size ; ++ i ) {
8184 for (j = i + 1 ; j < size ; ++ j ) {
82- if (i == rank && 0 != rcounts [j ] && 0 != rdtype_size ) {
85+ if (i == rank && 0 != rcounts [j ]) {
8386 /* Copy the data into the temporary buffer */
8487 err = ompi_datatype_copy_content_same_ddt (rdtype , rcounts [j ],
8588 tmp_buffer , (char * ) rbuf + rdisps [j ] * ext );
@@ -92,7 +95,7 @@ mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, const int *rcounts
9295 j , MCA_COLL_BASE_TAG_ALLTOALLV ,
9396 comm , MPI_STATUS_IGNORE );
9497 if (MPI_SUCCESS != err ) { goto error_hndl ; }
95- } else if (j == rank && 0 != rcounts [i ] && 0 != rdtype_size ) {
98+ } else if (j == rank && 0 != rcounts [i ]) {
9699 /* Copy the data into the temporary buffer */
97100 err = ompi_datatype_copy_content_same_ddt (rdtype , rcounts [i ],
98101 tmp_buffer , (char * ) rbuf + rdisps [i ] * ext );
0 commit comments