From 2a0ed3443e48d58ce929271e34c6d5578aa85750 Mon Sep 17 00:00:00 2001 From: Gabriel Dos Santos Date: Wed, 19 Jun 2024 14:32:43 +0200 Subject: [PATCH 1/3] feat: expose `KokkosComm::barrier` in the main header --- src/KokkosComm.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/KokkosComm.hpp b/src/KokkosComm.hpp index 342a2dcb..c67fc24e 100644 --- a/src/KokkosComm.hpp +++ b/src/KokkosComm.hpp @@ -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 namespace KokkosComm { + using Impl::alltoall; +using Impl::barrier; using Impl::irecv; using Impl::isend; using Impl::recv; using Impl::send; -} // namespace KokkosComm \ No newline at end of file +} // namespace KokkosComm From 33f86873717668eac35577ee791b18b395c715df Mon Sep 17 00:00:00 2001 From: Gabriel Dos Santos Date: Wed, 19 Jun 2024 14:34:29 +0200 Subject: [PATCH 2/3] fix: remove unused headers and inline non-templated overload Missing `inline` keyword on non-templated version of `barrier` made multiple definitions of `barrier` in user code. --- src/impl/KokkosComm_barrier.hpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/impl/KokkosComm_barrier.hpp b/src/impl/KokkosComm_barrier.hpp index 20ccdc6e..44580086 100644 --- a/src/impl/KokkosComm_barrier.hpp +++ b/src/impl/KokkosComm_barrier.hpp @@ -18,16 +18,14 @@ #include -#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(); @@ -39,4 +37,5 @@ void barrier(const ExecSpace &space, MPI_Comm comm) { space.fence("KokkosComm::Impl::barrier"); barrier(comm); } + } // namespace KokkosComm::Impl From 3f909751a0d9d03e1d351283d1067ac9fc598661 Mon Sep 17 00:00:00 2001 From: Gabriel Dos Santos Date: Wed, 19 Jun 2024 14:34:56 +0200 Subject: [PATCH 3/3] test: use non-`Impl` API in the test --- unit_tests/test_barrier.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/unit_tests/test_barrier.cpp b/unit_tests/test_barrier.cpp index 843a2a92..c9aa95ca 100644 --- a/unit_tests/test_barrier.cpp +++ b/unit_tests/test_barrier.cpp @@ -16,14 +16,15 @@ #include -#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