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