@@ -25,16 +25,19 @@ auto ialltoall(const ExecSpace& space, const SView sv, RView rv, int count, MPI_
2525 static_assert (std::is_same_v<ST, RT>, " KokkosComm::mpi::ialltoall: View value types must be identical" );
2626 Kokkos::Tools::pushRegion (" KokkosComm::mpi::ialltoall" );
2727
28- fail_if (!is_contiguous (sv) || !is_contiguous (rv),
29- " KokkosComm::mpi::ialltoall: unimplemented for non-contiguous views" );
28+ fail_if (
29+ !is_contiguous (sv) || !is_contiguous (rv), " KokkosComm::mpi::ialltoall: unimplemented for non-contiguous views"
30+ );
3031
3132 // Sync: Work in space may have been used to produce view data.
3233 space.fence (" fence before non-blocking all-gather" );
3334
3435 Request<MpiSpace> req;
3536 // All ranks send/recv same count
36- MPI_Ialltoall (data_handle (sv), count, datatype<MpiSpace, ST>(), data_handle (rv), count, datatype<MpiSpace, RT>(),
37- comm, req.request_ptr ());
37+ MPI_Ialltoall (
38+ data_handle (sv), count, datatype<MpiSpace, ST>(), data_handle (rv), count, datatype<MpiSpace, RT>(), comm,
39+ req.request_ptr ()
40+ );
3841 req.extend_view_lifetime (sv);
3942 req.extend_view_lifetime (rv);
4043
@@ -43,8 +46,14 @@ auto ialltoall(const ExecSpace& space, const SView sv, RView rv, int count, MPI_
4346}
4447
4548template <KokkosExecutionSpace ExecSpace, KokkosView SendView, KokkosView RecvView>
46- void alltoall (const ExecSpace& space, const SendView& sv, const size_t sendCount, const RecvView& rv,
47- const size_t recvCount, MPI_Comm comm) {
49+ void alltoall (
50+ const ExecSpace& space,
51+ const SendView& sv,
52+ const size_t sendCount,
53+ const RecvView& rv,
54+ const size_t recvCount,
55+ MPI_Comm comm
56+ ) {
4857 Kokkos::Tools::pushRegion (" KokkosComm::mpi::alltoall" );
4958
5059 using SendScalar = typename SendView::value_type;
@@ -53,8 +62,10 @@ void alltoall(const ExecSpace& space, const SendView& sv, const size_t sendCount
5362 // Make sure views are ready
5463 space.fence (" KokkosComm::mpi::alltoall" );
5564
56- KokkosComm::mpi::fail_if (!KokkosComm::is_contiguous (sv) || !KokkosComm::is_contiguous (rv),
57- " alltoall for non-contiguous views not implemented" );
65+ KokkosComm::mpi::fail_if (
66+ !KokkosComm::is_contiguous (sv) || !KokkosComm::is_contiguous (rv),
67+ " alltoall for non-contiguous views not implemented"
68+ );
5869
5970 int size;
6071 MPI_Comm_size (comm, &size);
@@ -72,8 +83,10 @@ void alltoall(const ExecSpace& space, const SendView& sv, const size_t sendCount
7283 KokkosComm::mpi::fail_if (true , ss.str ().data ());
7384 }
7485
75- MPI_Alltoall (KokkosComm::data_handle (sv), sendCount, datatype<MpiSpace, SendScalar>(), KokkosComm::data_handle (rv),
76- recvCount, datatype<MpiSpace, RecvScalar>(), comm);
86+ MPI_Alltoall (
87+ KokkosComm::data_handle (sv), sendCount, datatype<MpiSpace, SendScalar>(), KokkosComm::data_handle (rv), recvCount,
88+ datatype<MpiSpace, RecvScalar>(), comm
89+ );
7790
7891 Kokkos::Tools::popRegion ();
7992}
@@ -100,8 +113,10 @@ void alltoall(const ExecSpace& space, const RecvView& rv, const size_t recvCount
100113 KokkosComm::mpi::fail_if (true , ss.str ().data ());
101114 }
102115
103- MPI_Alltoall (MPI_IN_PLACE, 0 /* ignored*/ , MPI_BYTE /* ignored*/ , KokkosComm::data_handle (rv), recvCount,
104- datatype<MpiSpace, RecvScalar>(), comm);
116+ MPI_Alltoall (
117+ MPI_IN_PLACE, 0 /* ignored*/ , MPI_BYTE /* ignored*/ , KokkosComm::data_handle (rv), recvCount,
118+ datatype<MpiSpace, RecvScalar>(), comm
119+ );
105120
106121 Kokkos::Tools::popRegion ();
107122}
@@ -111,8 +126,9 @@ namespace Experimental::Impl {
111126
112127template <KokkosView SendView, KokkosView RecvView, KokkosExecutionSpace ExecSpace>
113128struct AllToAll <SendView, RecvView, ExecSpace, MpiSpace> {
114- static auto execute (Handle<ExecSpace, MpiSpace>& h, const SendView sv, RecvView rv, int count) -> Request<MpiSpace> {
115- return mpi::ialltoall (h.space (), sv, rv, count, h.mpi_comm ());
129+ static auto execute (Communicator<MpiSpace, ExecSpace>& h, const SendView sv, RecvView rv, int count)
130+ -> Request<MpiSpace> {
131+ return mpi::ialltoall (h.exec (), sv, rv, count, h.comm ());
116132 }
117133};
118134
0 commit comments