14
14
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
15
15
* reserved.
16
16
* Copyright (c) 2013 FUJITSU LIMITED. All rights reserved.
17
- * Copyright (c) 2014-2016 Research Organization for Information Science
18
- * and Technology (RIST). All rights reserved.
17
+ * Copyright (c) 2014-2021 Research Organization for Information Science
18
+ * and Technology (RIST). All rights reserved.
19
19
* Copyright (c) 2014 Cisco Systems, Inc. All rights reserved.
20
20
* Copyright (c) 2017 IBM Corporation. All rights reserved.
21
21
* $COPYRIGHT$
@@ -44,7 +44,7 @@ mca_coll_basic_alltoallw_intra_inplace(const void *rbuf, const int *rcounts, con
44
44
{
45
45
int i , j , size , rank , err = MPI_SUCCESS , max_size ;
46
46
ompi_request_t * req ;
47
- char * tmp_buffer , * save_buffer = NULL ;
47
+ char * save_buffer = NULL ;
48
48
ptrdiff_t ext , gap = 0 ;
49
49
50
50
/* Initialize. */
@@ -65,11 +65,10 @@ mca_coll_basic_alltoallw_intra_inplace(const void *rbuf, const int *rcounts, con
65
65
}
66
66
67
67
/* Allocate a temporary buffer */
68
- tmp_buffer = save_buffer = calloc (max_size , 1 );
69
- if (NULL == tmp_buffer ) {
68
+ save_buffer = calloc (max_size , 1 );
69
+ if (NULL == save_buffer ) {
70
70
return OMPI_ERR_OUT_OF_RESOURCE ;
71
71
}
72
- tmp_buffer -= gap ;
73
72
74
73
/* in-place alltoallw slow algorithm (but works) */
75
74
for (i = 0 ; i < size ; ++ i ) {
@@ -83,6 +82,10 @@ mca_coll_basic_alltoallw_intra_inplace(const void *rbuf, const int *rcounts, con
83
82
84
83
/* Initiate all send/recv to/from others. */
85
84
if (i == rank && msg_size_j != 0 ) {
85
+ char * tmp_buffer ;
86
+ /* Shift the temporary buffer according to the current datatype */
87
+ (void )opal_datatype_span (& rdtypes [j ]-> super , rcounts [j ], & gap );
88
+ tmp_buffer = save_buffer - gap ;
86
89
/* Copy the data into the temporary buffer */
87
90
err = ompi_datatype_copy_content_same_ddt (rdtypes [j ], rcounts [j ],
88
91
tmp_buffer , (char * ) rbuf + rdisps [j ]);
@@ -98,6 +101,10 @@ mca_coll_basic_alltoallw_intra_inplace(const void *rbuf, const int *rcounts, con
98
101
comm ));
99
102
if (MPI_SUCCESS != err ) { goto error_hndl ; }
100
103
} else if (j == rank && msg_size_i != 0 ) {
104
+ char * tmp_buffer ;
105
+ /* Shift the temporary buffer according to the current datatype */
106
+ (void )opal_datatype_span (& rdtypes [i ]-> super , rcounts [i ], & gap );
107
+ tmp_buffer = save_buffer - gap ;
101
108
/* Copy the data into the temporary buffer */
102
109
err = ompi_datatype_copy_content_same_ddt (rdtypes [i ], rcounts [i ],
103
110
tmp_buffer , (char * ) rbuf + rdisps [i ]);
0 commit comments