Skip to content
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
11 changes: 11 additions & 0 deletions ompi/mpi/c/iallreduce.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* reserved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2016 IBM Corporation. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -94,6 +95,16 @@ int MPI_Iallreduce(const void *sendbuf, void *recvbuf, int count,
OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME);
}


/* MPI standard says that reductions have to have a count of at least 1,
* but some benchmarks (e.g., IMB) calls this function with a count of 0.
* So handle that case.
*/
if (0 == count) {
*request = &ompi_request_empty;
return MPI_SUCCESS;
}

OPAL_CR_ENTER_LIBRARY();

/* Invoke the coll component to perform the back-end operation */
Expand Down
10 changes: 10 additions & 0 deletions ompi/mpi/c/ireduce.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* reserved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2016 IBM Corporation. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -120,6 +121,15 @@ int MPI_Ireduce(const void *sendbuf, void *recvbuf, int count,
}
}

/* MPI standard says that reductions have to have a count of at least 1,
* but some benchmarks (e.g., IMB) calls this function with a count of 0.
* So handle that case.
*/
if (0 == count) {
*request = &ompi_request_empty;
return MPI_SUCCESS;
}

OPAL_CR_ENTER_LIBRARY();

/* Invoke the coll component to perform the back-end operation */
Expand Down
18 changes: 17 additions & 1 deletion ompi/mpi/c/ireduce_scatter.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* reserved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2016 IBM Corporation. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -45,7 +46,7 @@ static const char FUNC_NAME[] = "MPI_Ireduce_scatter";
int MPI_Ireduce_scatter(const void *sendbuf, void *recvbuf, const int recvcounts[],
MPI_Datatype datatype, MPI_Op op, MPI_Comm comm, MPI_Request *request)
{
int i, err, size;
int i, err, size, count;

MEMCHECKER(
int rank;
Expand Down Expand Up @@ -110,6 +111,21 @@ int MPI_Ireduce_scatter(const void *sendbuf, void *recvbuf, const int recvcounts
}
}

/* MPI standard says that reductions have to have a count of at least 1,
* but some benchmarks (e.g., IMB) calls this function with a count of 0.
* So handle that case.
*/
size = ompi_comm_size(comm);
for (count = i = 0; i < size; ++i) {
if (0 == recvcounts[i]) {
++count;
}
}
if (size == count) {
*request = &ompi_request_empty;
return MPI_SUCCESS;
}

OPAL_CR_ENTER_LIBRARY();

/* Invoke the coll component to perform the back-end operation */
Expand Down