@@ -44,14 +44,13 @@ mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, const int *rcounts
44
44
{
45
45
int i , j , size , rank , err = MPI_SUCCESS ;
46
46
char * allocated_buffer , * tmp_buffer ;
47
- size_t max_size , rdtype_size ;
47
+ size_t max_size ;
48
48
ptrdiff_t ext , gap = 0 ;
49
49
50
50
/* Initialize. */
51
51
52
52
size = ompi_comm_size (comm );
53
53
rank = ompi_comm_rank (comm );
54
- ompi_datatype_type_size (rdtype , & rdtype_size );
55
54
56
55
/* If only one process, we're done. */
57
56
if (1 == size ) {
@@ -68,6 +67,10 @@ mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, const int *rcounts
68
67
}
69
68
/* The gap will always be the same as we are working on the same datatype */
70
69
70
+ if (OPAL_UNLIKELY (0 == max_size )) {
71
+ return MPI_SUCCESS ;
72
+ }
73
+
71
74
/* Allocate a temporary buffer */
72
75
allocated_buffer = calloc (max_size , 1 );
73
76
if (NULL == allocated_buffer ) {
@@ -79,7 +82,7 @@ mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, const int *rcounts
79
82
/* in-place alltoallv slow algorithm (but works) */
80
83
for (i = 0 ; i < size ; ++ i ) {
81
84
for (j = i + 1 ; j < size ; ++ j ) {
82
- if (i == rank && 0 != rcounts [j ] && 0 != rdtype_size ) {
85
+ if (i == rank && 0 != rcounts [j ]) {
83
86
/* Copy the data into the temporary buffer */
84
87
err = ompi_datatype_copy_content_same_ddt (rdtype , rcounts [j ],
85
88
tmp_buffer , (char * ) rbuf + rdisps [j ] * ext );
@@ -92,7 +95,7 @@ mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, const int *rcounts
92
95
j , MCA_COLL_BASE_TAG_ALLTOALLV ,
93
96
comm , MPI_STATUS_IGNORE );
94
97
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 ]) {
96
99
/* Copy the data into the temporary buffer */
97
100
err = ompi_datatype_copy_content_same_ddt (rdtype , rcounts [i ],
98
101
tmp_buffer , (char * ) rbuf + rdisps [i ] * ext );
0 commit comments