Skip to content

Commit

Permalink
Merge pull request #98 from dssgabriel/expose-barriers
Browse files Browse the repository at this point in the history
Expose `KokkosComm::barrier`
  • Loading branch information
cwpearson authored Jun 19, 2024
2 parents ceefa75 + 3f90975 commit b562f9d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
5 changes: 4 additions & 1 deletion src/KokkosComm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,19 @@
#include "KokkosComm_recv.hpp"
#include "KokkosComm_send.hpp"
#include "KokkosComm_alltoall.hpp"
#include "KokkosComm_barrier.hpp"
#include "KokkosComm_concepts.hpp"
#include "KokkosComm_comm_mode.hpp"

#include <Kokkos_Core.hpp>

namespace KokkosComm {

using Impl::alltoall;
using Impl::barrier;
using Impl::irecv;
using Impl::isend;
using Impl::recv;
using Impl::send;

} // namespace KokkosComm
} // namespace KokkosComm
7 changes: 3 additions & 4 deletions src/impl/KokkosComm_barrier.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,14 @@

#include <Kokkos_Core.hpp>

#include "KokkosComm_pack_traits.hpp"
#include "KokkosComm_traits.hpp"
#include "KokkosComm_concepts.hpp"

// impl
#include "KokkosComm_include_mpi.hpp"
#include "KokkosComm_types.hpp"

namespace KokkosComm::Impl {

void barrier(MPI_Comm comm) {
inline void barrier(MPI_Comm comm) {
Kokkos::Tools::pushRegion("KokkosComm::Impl::barrier");
MPI_Barrier(comm);
Kokkos::Tools::popRegion();
Expand All @@ -39,4 +37,5 @@ void barrier(const ExecSpace &space, MPI_Comm comm) {
space.fence("KokkosComm::Impl::barrier");
barrier(comm);
}

} // namespace KokkosComm::Impl
7 changes: 4 additions & 3 deletions unit_tests/test_barrier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@

#include <gtest/gtest.h>

#include "KokkosComm_barrier.hpp"
#include "KokkosComm.hpp"

namespace {

TEST(Barrier, 0) {
int rank, size;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &size);

KokkosComm::Impl::barrier(Kokkos::DefaultExecutionSpace(), MPI_COMM_WORLD);
KokkosComm::barrier(Kokkos::DefaultExecutionSpace(), MPI_COMM_WORLD);
}

} // namespace

0 comments on commit b562f9d

Please sign in to comment.