Skip to content
This repository was archived by the owner on Sep 30, 2022. It is now read-only.

Commit be40b63

Browse files
committed
coll/base: fix memory allocation in mca_coll_base_alltoall_intra_basic_inplace
(back-ported from commit open-mpi/ompi@0f23037)
1 parent a0f9358 commit be40b63

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ompi/mca/coll/basic/coll_basic_alltoall.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ mca_coll_basic_alltoall_intra_inplace(void *rbuf, int rcount,
4343
MPI_Request *preq;
4444
char *tmp_buffer;
4545
size_t max_size;
46-
ptrdiff_t ext;
46+
ptrdiff_t ext, true_lb, true_ext;
4747

4848
/* Initialize. */
4949

@@ -57,13 +57,15 @@ mca_coll_basic_alltoall_intra_inplace(void *rbuf, int rcount,
5757

5858
/* Find the largest receive amount */
5959
ompi_datatype_type_extent (rdtype, &ext);
60-
max_size = ext * rcount;
60+
ompi_datatype_get_true_extent ( rdtype, &true_lb, &true_ext);
61+
max_size = true_ext + ext * (rcount-1);
6162

6263
/* Allocate a temporary buffer */
6364
tmp_buffer = calloc (max_size, 1);
6465
if (NULL == tmp_buffer) {
6566
return OMPI_ERR_OUT_OF_RESOURCE;
6667
}
68+
max_size = ext * rcount;
6769

6870
/* in-place alltoall slow algorithm (but works) */
6971
for (i = 0 ; i < size ; ++i) {

0 commit comments

Comments
 (0)