Skip to content
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

resolve bug with KokkosComm::irecv, add to unit testing #90

Merged
merged 6 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
34 changes: 6 additions & 28 deletions src/KokkosComm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,31 +29,9 @@
#include <Kokkos_Core.hpp>

namespace KokkosComm {

template <CommMode SendMode = CommMode::Default, KokkosExecutionSpace ExecSpace, KokkosView SendView>
Req isend(const ExecSpace &space, const SendView &sv, int dest, int tag, MPI_Comm comm) {
return Impl::isend<SendMode>(space, sv, dest, tag, comm);
}

template <KokkosView RecvView>
void irecv(RecvView &rv, int src, int tag, MPI_Comm comm, MPI_Request req) {
return Impl::irecv(rv, src, tag, comm, req);
}

template <CommMode SendMode = CommMode::Default, KokkosExecutionSpace ExecSpace, KokkosView SendView>
void send(const ExecSpace &space, const SendView &sv, int dest, int tag, MPI_Comm comm) {
return Impl::send<SendMode>(space, sv, dest, tag, comm);
}

template <KokkosExecutionSpace ExecSpace, KokkosView RecvView>
void recv(const ExecSpace &space, RecvView &rv, int src, int tag, MPI_Comm comm) {
return Impl::recv(space, rv, src, tag, comm);
}

template <KokkosExecutionSpace ExecSpace, KokkosView SendView, KokkosView RecvView>
void alltoall(const ExecSpace &space, const SendView &sv, const size_t sendCount, const RecvView &rv,
const size_t recvCount, MPI_Comm comm) {
return Impl::alltoall(space, sv, sendCount, rv, recvCount, comm);
}

} // namespace KokkosComm
using Impl::isend;
using Impl::irecv;
using Impl::send;
using Impl::recv;
using Impl::alltoall;
} // namespace KokkosComm
4 changes: 2 additions & 2 deletions unit_tests/test_isendirecv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void test_1d(const View1D &a) {
} else if (1 == rank) {
int src = 0;
MPI_Request req;
KokkosComm::Impl::irecv(a, src, 0, MPI_COMM_WORLD, req);
KokkosComm::irecv(a, src, 0, MPI_COMM_WORLD, req);
Copy link
Collaborator

Choose a reason for hiding this comment

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

There is still a difference between isend and irecv: isend returns a request, irecv has an output parameter. Is that on purpose?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@cwpearson I just saw this, what is your opinion?

Copy link
Collaborator

Choose a reason for hiding this comment

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

We should probably have Irecv produce an output as well. I will accept this for now and open an issue against myself to implement it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

#92

MPI_Wait(&req, MPI_STATUS_IGNORE);
int errs;
Kokkos::parallel_reduce(
Expand Down Expand Up @@ -87,7 +87,7 @@ void test_2d(const View2D &a) {
} else if (1 == rank) {
int src = 0;
MPI_Request req;
KokkosComm::Impl::irecv(a, src, 0, MPI_COMM_WORLD, req);
KokkosComm::irecv(a, src, 0, MPI_COMM_WORLD, req);
MPI_Wait(&req, MPI_STATUS_IGNORE);
int errs;
Kokkos::parallel_reduce(
Expand Down
Loading