2424
2525namespace KokkosComm ::mpi {
2626
27- template <CommunicationMode SendMode, KokkosView SendView >
28- void send (const SendMode &, const SendView &sv, int dest, int tag, MPI_Comm comm) {
27+ template <KokkosView SendView, CommunicationMode SendMode >
28+ void send (const SendView &sv, int dest, int tag, MPI_Comm comm, SendMode ) {
2929 Kokkos::Tools::pushRegion (" KokkosComm::Impl::send" );
3030 using KCT = typename KokkosComm::Traits<SendView>;
3131
3232 auto mpi_send_fn = [](void *mpi_view, int mpi_count, MPI_Datatype mpi_datatype, int mpi_dest, int mpi_tag,
3333 MPI_Comm mpi_comm) {
34- if constexpr (std::is_same_v<SendMode, StandardCommMode >) {
34+ if constexpr (std::is_same_v<SendMode, CommModeStandard >) {
3535 MPI_Send (mpi_view, mpi_count, mpi_datatype, mpi_dest, mpi_tag, mpi_comm);
36- } else if constexpr (std::is_same_v<SendMode, ReadyCommMode >) {
36+ } else if constexpr (std::is_same_v<SendMode, CommModeReady >) {
3737 MPI_Rsend (mpi_view, mpi_count, mpi_datatype, mpi_dest, mpi_tag, mpi_comm);
38- } else if constexpr (std::is_same_v<SendMode, SynchronousCommMode >) {
38+ } else if constexpr (std::is_same_v<SendMode, CommModeSynchronous >) {
3939 MPI_Ssend (mpi_view, mpi_count, mpi_datatype, mpi_dest, mpi_tag, mpi_comm);
40+ } else {
41+ static_assert (std::is_void_v<SendMode>, " unexpected communication mode" );
4042 }
4143 };
4244
@@ -50,25 +52,22 @@ void send(const SendMode &, const SendView &sv, int dest, int tag, MPI_Comm comm
5052 Kokkos::Tools::popRegion ();
5153}
5254
53- template <KokkosView SendView>
54- void send (const SendView &sv, int dest, int tag, MPI_Comm comm) {
55- send (KokkosComm::DefaultCommMode (), sv, dest, tag, comm);
56- }
57-
58- template <CommunicationMode SendMode, KokkosExecutionSpace ExecSpace, KokkosView SendView>
59- void send (const SendMode &, const ExecSpace &space, const SendView &sv, int dest, int tag, MPI_Comm comm) {
55+ template <KokkosExecutionSpace ExecSpace, KokkosView SendView, CommunicationMode SendMode>
56+ void send (const ExecSpace &space, const SendView &sv, int dest, int tag, MPI_Comm comm, SendMode) {
6057 Kokkos::Tools::pushRegion (" KokkosComm::Impl::send" );
6158
6259 using Packer = typename KokkosComm::PackTraits<SendView>::packer_type;
6360
6461 auto mpi_send_fn = [](void *mpi_view, int mpi_count, MPI_Datatype mpi_datatype, int mpi_dest, int mpi_tag,
6562 MPI_Comm mpi_comm) {
66- if constexpr (std::is_same_v<SendMode, StandardCommMode >) {
63+ if constexpr (std::is_same_v<SendMode, CommModeStandard >) {
6764 MPI_Send (mpi_view, mpi_count, mpi_datatype, mpi_dest, mpi_tag, mpi_comm);
68- } else if constexpr (std::is_same_v<SendMode, ReadyCommMode >) {
65+ } else if constexpr (std::is_same_v<SendMode, CommModeReady >) {
6966 MPI_Rsend (mpi_view, mpi_count, mpi_datatype, mpi_dest, mpi_tag, mpi_comm);
70- } else if constexpr (std::is_same_v<SendMode, SynchronousCommMode >) {
67+ } else if constexpr (std::is_same_v<SendMode, CommModeSynchronous >) {
7168 MPI_Ssend (mpi_view, mpi_count, mpi_datatype, mpi_dest, mpi_tag, mpi_comm);
69+ } else {
70+ static_assert (std::is_void_v<SendMode>, " unexpected communication mode" );
7271 }
7372 };
7473
@@ -84,4 +83,9 @@ void send(const SendMode &, const ExecSpace &space, const SendView &sv, int dest
8483 Kokkos::Tools::popRegion ();
8584}
8685
86+ template <KokkosExecutionSpace ExecSpace, KokkosView SendView>
87+ void send (const ExecSpace &space, const SendView &sv, int dest, int tag, MPI_Comm comm) {
88+ send (space, sv, dest, tag, comm, DefaultCommMode{});
89+ }
90+
8791} // namespace KokkosComm::mpi
0 commit comments