Skip to content

Commit e0e05d8

Browse files
authored
Merge pull request #2252 from ggouaillardet/topic/v2.x/coll_base_scatter_gather_binomial
v2.x: fix coll_base_{gather,scatter}_binomial (plus misc coverity fixes)
2 parents eba780d + 9288d4a commit e0e05d8

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

ompi/mca/coll/base/coll_base_allgather.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ int ompi_coll_base_allgather_intra_bruck(const void *sbuf, int scount,
170170
char *free_buf = NULL, *shift_buf = NULL;
171171
ptrdiff_t span, gap;
172172

173-
span = opal_datatype_span(&rdtype->super, (size - rank) * rcount, &gap);
173+
span = opal_datatype_span(&rdtype->super, (int64_t)(size - rank) * rcount, &gap);
174174

175175
free_buf = (char*)calloc(span, sizeof(char));
176176
if (NULL == free_buf) {

ompi/mca/coll/base/coll_base_alltoall.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ int ompi_coll_base_alltoall_intra_bruck(const void *sbuf, int scount,
222222
err = ompi_datatype_type_extent (rdtype, &rext);
223223
if (err != MPI_SUCCESS) { line = __LINE__; goto err_hndl; }
224224

225-
span = opal_datatype_span(&sdtype->super, size * scount, &gap);
225+
span = opal_datatype_span(&sdtype->super, (int64_t)size * scount, &gap);
226226

227227
displs = (int *) malloc(size * sizeof(int));
228228
if (displs == NULL) { line = __LINE__; err = -1; goto err_hndl; }

ompi/mca/coll/base/coll_base_gather.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* All rights reserved.
1313
* Copyright (c) 2013 Los Alamos National Security, LLC. All Rights
1414
* reserved.
15-
* Copyright (c) 2015 Research Organization for Information Science
15+
* Copyright (c) 2015-2016 Research Organization for Information Science
1616
* and Technology (RIST). All rights reserved.
1717
* $COPYRIGHT$
1818
*
@@ -65,13 +65,13 @@ ompi_coll_base_gather_intra_binomial(const void *sbuf, int scount,
6565
bmtree = data->cached_in_order_bmtree;
6666

6767
ompi_datatype_type_extent(sdtype, &sextent);
68-
ompi_datatype_type_extent(rdtype, &rextent);
69-
ssize = opal_datatype_span(&sdtype->super, scount * size, &sgap);
70-
rsize = opal_datatype_span(&rdtype->super, rcount * size, &rgap);
68+
ssize = opal_datatype_span(&sdtype->super, (int64_t)scount * size, &sgap);
7169

7270
vrank = (rank - root + size) % size;
7371

7472
if (rank == root) {
73+
ompi_datatype_type_extent(rdtype, &rextent);
74+
rsize = opal_datatype_span(&rdtype->super, (int64_t)rcount * size, &rgap);
7575
if (0 == root){
7676
/* root on 0, just use the recv buffer */
7777
ptmp = (char *) rbuf;

ompi/mca/coll/base/coll_base_scatter.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* All rights reserved.
1313
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
1414
* reserved.
15-
* Copyright (c) 2015 Research Organization for Information Science
15+
* Copyright (c) 2015-2016 Research Organization for Information Science
1616
* and Technology (RIST). All rights reserved.
1717
* $COPYRIGHT$
1818
*
@@ -62,16 +62,16 @@ ompi_coll_base_scatter_intra_binomial( const void *sbuf, int scount,
6262
COLL_BASE_UPDATE_IN_ORDER_BMTREE( comm, base_module, root );
6363
bmtree = data->cached_in_order_bmtree;
6464

65-
ompi_datatype_type_extent(sdtype, &sextent);
6665
ompi_datatype_type_extent(rdtype, &rextent);
6766

68-
ssize = opal_datatype_span(&sdtype->super, scount * size, &sgap);
69-
rsize = opal_datatype_span(&rdtype->super, rcount * size, &rgap);
67+
rsize = opal_datatype_span(&rdtype->super, (int64_t)rcount * size, &rgap);
7068

7169
vrank = (rank - root + size) % size;
7270
ptmp = (char *) rbuf; /* by default suppose leaf nodes, just use rbuf */
7371

7472
if (rank == root) {
73+
ompi_datatype_type_extent(sdtype, &sextent);
74+
ssize = opal_datatype_span(&sdtype->super, (int64_t)scount * size, &sgap);
7575
if (0 == root) {
7676
/* root on 0, just use the send buffer */
7777
ptmp = (char *) sbuf;

0 commit comments

Comments
 (0)