Skip to content

Commit e78fcc4

Browse files
committed
coll/base: fix ompi_coll_base_{gather,scatter}_intra_binomial
receive type is only relevant for root with gather, send type is only relevant for root with scatter, so do not access these types on a non root task
1 parent cb76d93 commit e78fcc4

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

ompi/mca/coll/base/coll_base_gather.c

Lines changed: 3 additions & 3 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);
6968
ssize = opal_datatype_span(&sdtype->super, (int64_t)scount * size, &sgap);
70-
rsize = opal_datatype_span(&rdtype->super, (int64_t)rcount * size, &rgap);
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: 3 additions & 3 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, (int64_t)scount * size, &sgap);
6967
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)