Skip to content
This repository was archived by the owner on Sep 30, 2022. It is now read-only.

mpi/c: Add each check for count==0 in nonblocking reduce interface #1254

Merged
merged 1 commit into from
Jul 19, 2016
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
10 changes: 10 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 @@ -93,6 +94,15 @@ 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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit pick: IMB doesn't call any non-blocking collectives.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually it does in the latest version - IMB-NBC

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh! Do we have that in ompi tests?

Sent from my phone. No type good.

On Jul 19, 2016, at 12:05 PM, Josh Hursey <[email protected]mailto:[email protected]> wrote:

In ompi/mpi/c/iallreduce.chttps://github.com//pull/1254#discussion_r71369569:

@@ -93,6 +94,15 @@ 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.
    

Actually it does in the latest version - IMB-NBC

You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHubhttps://github.com//pull/1254/files/1d8870db477abf3dfd89581ef581ef82a3b1df99#r71369569, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AKRgd7PFQFsQiGUEUB_cVgOnyg_8jtM6ks5qXPWegaJpZM4JDeja.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I ompi-tests has the 3.2.4. The latest is 4.1, which contains RMA and NBC benchmarks - might be good to add to that repo, and make an MTT section for it.

* So handle that case.
*/
if (0 == count) {
*request = &ompi_request_empty;
return MPI_SUCCESS;
}

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

OBJ_RETAIN(op);
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;
}

/* Invoke the coll component to perform the back-end operation */
OBJ_RETAIN(op);
err = comm->c_coll.coll_ireduce(sendbuf, recvbuf, count,
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;
}

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

OBJ_RETAIN(op);
Expand Down