Skip to content

v2.x: fix coll_base_{gather,scatter}_binomial (plus misc coverity fixes) #2252

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ompi/mca/coll/base/coll_base_allgather.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ int ompi_coll_base_allgather_intra_bruck(const void *sbuf, int scount,
char *free_buf = NULL, *shift_buf = NULL;
ptrdiff_t span, gap;

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

free_buf = (char*)calloc(span, sizeof(char));
if (NULL == free_buf) {
Expand Down
2 changes: 1 addition & 1 deletion ompi/mca/coll/base/coll_base_alltoall.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ int ompi_coll_base_alltoall_intra_bruck(const void *sbuf, int scount,
err = ompi_datatype_type_extent (rdtype, &rext);
if (err != MPI_SUCCESS) { line = __LINE__; goto err_hndl; }

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

displs = (int *) malloc(size * sizeof(int));
if (displs == NULL) { line = __LINE__; err = -1; goto err_hndl; }
Expand Down
8 changes: 4 additions & 4 deletions ompi/mca/coll/base/coll_base_gather.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* All rights reserved.
* Copyright (c) 2013 Los Alamos National Security, LLC. All Rights
* reserved.
* Copyright (c) 2015 Research Organization for Information Science
* Copyright (c) 2015-2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
Expand Down Expand Up @@ -65,13 +65,13 @@ ompi_coll_base_gather_intra_binomial(const void *sbuf, int scount,
bmtree = data->cached_in_order_bmtree;

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

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

if (rank == root) {
ompi_datatype_type_extent(rdtype, &rextent);
rsize = opal_datatype_span(&rdtype->super, (int64_t)rcount * size, &rgap);
if (0 == root){
/* root on 0, just use the recv buffer */
ptmp = (char *) rbuf;
Expand Down
8 changes: 4 additions & 4 deletions ompi/mca/coll/base/coll_base_scatter.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* All rights reserved.
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2015 Research Organization for Information Science
* Copyright (c) 2015-2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
Expand Down Expand Up @@ -62,16 +62,16 @@ ompi_coll_base_scatter_intra_binomial( const void *sbuf, int scount,
COLL_BASE_UPDATE_IN_ORDER_BMTREE( comm, base_module, root );
bmtree = data->cached_in_order_bmtree;

ompi_datatype_type_extent(sdtype, &sextent);
ompi_datatype_type_extent(rdtype, &rextent);

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

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

if (rank == root) {
ompi_datatype_type_extent(sdtype, &sextent);
ssize = opal_datatype_span(&sdtype->super, (int64_t)scount * size, &sgap);
if (0 == root) {
/* root on 0, just use the send buffer */
ptmp = (char *) sbuf;
Expand Down