Skip to content

Commit 0a19337

Browse files
committed
coll/base: return MPI_ERR_UNSUPPORTED_OPERATION when coll_base_*_two_procs algo is used on a communicator that has no two tasks
Thanks Dave Love for the report
1 parent 1911d74 commit 0a19337

File tree

4 files changed

+21
-4
lines changed

4 files changed

+21
-4
lines changed

ompi/mca/coll/base/coll_base_allgather.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Copyright (c) 2009 University of Houston. All rights reserved.
1313
* Copyright (c) 2013 Los Alamos National Security, LLC. All Rights
1414
* reserved.
15-
* Copyright (c) 2014-2015 Research Organization for Information Science
15+
* Copyright (c) 2014-2016 Research Organization for Information Science
1616
* and Technology (RIST). All rights reserved.
1717
* $COPYRIGHT$
1818
*
@@ -623,6 +623,10 @@ int ompi_coll_base_allgather_intra_two_procs(const void *sbuf, int scount,
623623
OPAL_OUTPUT((ompi_coll_base_framework.framework_output,
624624
"ompi_coll_base_allgather_intra_two_procs rank %d", rank));
625625

626+
if (2 != ompi_comm_size(comm)) {
627+
return MPI_ERR_UNSUPPORTED_OPERATION;
628+
}
629+
626630
err = ompi_datatype_get_extent (sdtype, &lb, &sext);
627631
if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; }
628632

ompi/mca/coll/base/coll_base_allgatherv.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* Copyright (c) 2009 University of Houston. All rights reserved.
1414
* Copyright (c) 2013 Los Alamos National Security, LLC. All Rights
1515
* reserved.
16-
* Copyright (c) 2015 Research Organization for Information Science
16+
* Copyright (c) 2015-2016 Research Organization for Information Science
1717
* and Technology (RIST). All rights reserved.
1818
* $COPYRIGHT$
1919
*
@@ -526,6 +526,10 @@ int ompi_coll_base_allgatherv_intra_two_procs(const void *sbuf, int scount,
526526
OPAL_OUTPUT((ompi_coll_base_framework.framework_output,
527527
"ompi_coll_base_allgatherv_intra_two_procs rank %d", rank));
528528

529+
if (2 != ompi_comm_size(comm)) {
530+
return MPI_ERR_UNSUPPORTED_OPERATION;
531+
}
532+
529533
err = ompi_datatype_get_extent (sdtype, &lb, &sext);
530534
if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; }
531535

ompi/mca/coll/base/coll_base_alltoall.c

Lines changed: 5 additions & 1 deletion
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) 2014-2015 Research Organization for Information Science
15+
* Copyright (c) 2014-2016 Research Organization for Information Science
1616
* and Technology (RIST). All rights reserved.
1717
* $COPYRIGHT$
1818
*
@@ -500,6 +500,10 @@ int ompi_coll_base_alltoall_intra_two_procs(const void *sbuf, int scount,
500500
OPAL_OUTPUT((ompi_coll_base_framework.framework_output,
501501
"ompi_coll_base_alltoall_intra_two_procs rank %d", rank));
502502

503+
if (2 != ompi_comm_size(comm)) {
504+
return MPI_ERR_UNSUPPORTED_OPERATION;
505+
}
506+
503507
err = ompi_datatype_get_extent (sdtype, &lb, &sext);
504508
if (err != MPI_SUCCESS) { line = __LINE__; goto err_hndl; }
505509

ompi/mca/coll/base/coll_base_barrier.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
1414
* Copyright (c) 2013 Los Alamos National Security, LLC. All Rights
1515
* reserved.
16-
* Copyright (c) 2015 Research Organization for Information Science
16+
* Copyright (c) 2015-2016 Research Organization for Information Science
1717
* and Technology (RIST). All rights reserved.
1818
* $COPYRIGHT$
1919
*
@@ -303,6 +303,11 @@ int ompi_coll_base_barrier_intra_two_procs(struct ompi_communicator_t *comm,
303303
remote = ompi_comm_rank(comm);
304304
OPAL_OUTPUT((ompi_coll_base_framework.framework_output,
305305
"ompi_coll_base_barrier_intra_two_procs rank %d", remote));
306+
307+
if (2 != ompi_comm_size(comm)) {
308+
return MPI_ERR_UNSUPPORTED_OPERATION;
309+
}
310+
306311
remote = (remote + 1) & 0x1;
307312

308313
err = ompi_coll_base_sendrecv_zero(remote, MCA_COLL_BASE_TAG_BARRIER,

0 commit comments

Comments
 (0)