Skip to content

Commit

Permalink
don't use MPI_PACKED in DeepCopy packer so we can call MPI_Reduce
Browse files Browse the repository at this point in the history
Signed-off-by: Carl Pearson <[email protected]>
  • Loading branch information
cwpearson committed Jan 29, 2025
1 parent ae69488 commit fec0675
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/KokkosComm/mpi/impl/packer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,19 @@ struct DeepCopy {
Kokkos::View<typename View::non_const_data_type, Kokkos::LayoutLeft, typename View::memory_space>;
using args_type = MpiArgs<non_const_packed_view_type>;

using packed_value_type = typename non_const_packed_view_type::value_type;

template <KokkosExecutionSpace ExecSpace>
static args_type allocate_packed_for(const ExecSpace &space, const std::string &label, const View &src) {
using KCT = KokkosComm::Traits<View>;

if constexpr (KokkosComm::rank<View>() == 1) {
non_const_packed_view_type packed(Kokkos::view_alloc(space, Kokkos::WithoutInitializing, label), src.extent(0));
return args_type(packed, MPI_PACKED,
KokkosComm::span(packed) * sizeof(typename non_const_packed_view_type::value_type));
return args_type(packed, mpi_type<packed_value_type>(), KokkosComm::span(packed));
} else if constexpr (KokkosComm::rank<View>() == 2) {
non_const_packed_view_type packed(Kokkos::view_alloc(space, Kokkos::WithoutInitializing, label), src.extent(0),
src.extent(1));
return args_type(packed, MPI_PACKED,
KokkosComm::span(packed) * sizeof(typename non_const_packed_view_type::value_type));
return args_type(packed, mpi_type<packed_value_type>(), KokkosComm::span(packed));
} else {
static_assert(std::is_void_v<View>, "allocate_packed_for for rank >= 2 views unimplemented");
}
Expand Down

0 comments on commit fec0675

Please sign in to comment.