Skip to content

Commit

Permalink
fix: use system include syntax for all KokkosComm headers (#120)
Browse files Browse the repository at this point in the history
Removes all instances of relative paths in favor of system include-style
syntax: `<KokkosComm/...>
  • Loading branch information
dssgabriel committed Nov 4, 2024
1 parent 8e177a9 commit c54fb9d
Show file tree
Hide file tree
Showing 36 changed files with 132 additions and 174 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ if(KOKKOSCOMM_ENABLE_MPI)
find_package(MPI REQUIRED)
endif()

add_subdirectory(src)
add_subdirectory(src/KokkosComm)
if(KOKKOSCOMM_ENABLE_TESTS)
add_subdirectory(unit_tests)
endif()
Expand Down
3 changes: 1 addition & 2 deletions perf_tests/mpi/test_2dhalo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
//@HEADER

#include "test_utils.hpp"

#include "KokkosComm/KokkosComm.hpp"
#include <KokkosComm/KokkosComm.hpp>

#include <iostream>

Expand Down
3 changes: 1 addition & 2 deletions perf_tests/mpi/test_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@
//
//@HEADER

#include "KokkosComm/mpi/impl/include_mpi.hpp"

#include <Kokkos_Core.hpp>
#include <benchmark/benchmark.h>
#include <mpi.h>

// This reporter does nothing.
// We can use it to disable output from all but the root process
Expand Down
4 changes: 2 additions & 2 deletions perf_tests/mpi/test_osu_latency.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
// (NBCL), The Ohio State University.

#include "test_utils.hpp"
#include "KokkosComm/KokkosComm.hpp"
#include <KokkosComm/KokkosComm.hpp>

template <typename Space, typename View>
void osu_latency_Kokkos_Comm_sendrecv(benchmark::State &, MPI_Comm, KokkosComm::Handle<> &h, const View &v) {
Expand Down Expand Up @@ -149,4 +149,4 @@ BENCHMARK(benchmark_osu_latency_MPI_sendrecv)
->UseManualTime()
->Unit(benchmark::kMicrosecond)
->RangeMultiplier(8)
->Range(1, 1 << 28);
->Range(1, 1 << 28);
3 changes: 1 addition & 2 deletions perf_tests/mpi/test_sendrecv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
//@HEADER

#include "test_utils.hpp"

#include "KokkosComm/KokkosComm.hpp"
#include <KokkosComm/KokkosComm.hpp>

template <KokkosComm::mpi::CommunicationMode Mode, typename Space, typename View>
void send_recv(benchmark::State &, MPI_Comm comm, const Space &space, int rank, const View &v) {
Expand Down
7 changes: 3 additions & 4 deletions perf_tests/mpi/test_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@

#pragma once

#include <chrono>

#include <benchmark/benchmark.h>
#include <mpi.h>

#include "KokkosComm/mpi/impl/include_mpi.hpp"
#include <chrono>

// F is a function that takes (state, MPI_Comm, args...)
template <typename F, typename... Args>
Expand All @@ -36,4 +35,4 @@ void do_iteration(benchmark::State &state, MPI_Comm comm, F &&func, Args... args
double elapsed_seconds = elapsed.count();
MPI_Allreduce(&elapsed_seconds, &max_elapsed_second, 1, MPI_DOUBLE, MPI_MAX, comm);
state.SetIterationTime(max_elapsed_second);
}
}
17 changes: 0 additions & 17 deletions src/CMakeLists.txt

This file was deleted.

8 changes: 3 additions & 5 deletions src/KokkosComm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
#
#@HEADER

set(TARGET_LIBRARY kokkoscomm)

add_library(KokkosComm INTERFACE)
add_library(KokkosComm::KokkosComm ALIAS KokkosComm)

Expand Down Expand Up @@ -79,12 +77,12 @@ if(KOKKOSCOMM_ENABLE_MPI)
FILE_SET kokkoscomm_mpi_impl_headers
TYPE HEADERS
BASE_DIRS ${PROJECT_SOURCE_DIR}/src
FILES mpi/impl/include_mpi.hpp mpi/impl/pack_traits.hpp mpi/impl/packer.hpp mpi/impl/tags.hpp mpi/impl/types.hpp
FILES mpi/impl/src_mpi.hpp mpi/impl/pack_traits.hpp mpi/impl/packer.hpp mpi/impl/tags.hpp mpi/impl/types.hpp
)
endif()

# --- COMPILE FLAGS --- #
include(CheckCXXCompilerFlag)
src(CheckCXXCompilerFlag)

macro(kokkoscomm_check_and_add_compile_options)
set(target ${ARGV0})
Expand All @@ -109,7 +107,7 @@ kokkoscomm_check_and_add_compile_options(KokkosCommFlags -Wpedantic)
kokkoscomm_check_and_add_compile_options(KokkosCommFlags -pedantic)
kokkoscomm_check_and_add_compile_options(KokkosCommFlags -Wcast-align)
kokkoscomm_check_and_add_compile_options(KokkosCommFlags -Wformat=2)
kokkoscomm_check_and_add_compile_options(KokkosCommFlags -Wmissing-include-dirs)
kokkoscomm_check_and_add_compile_options(KokkosCommFlags -Wmissing-src-dirs)
kokkoscomm_check_and_add_compile_options(KokkosCommFlags -Wno-gnu-zero-variadic-macro-arguments)

# Linking
Expand Down
28 changes: 14 additions & 14 deletions src/KokkosComm/KokkosComm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,28 @@

#pragma once

#include "fwd.hpp"
#include <KokkosComm/fwd.hpp>

// transport declarations
// TODO: could probably be moved to a per-transport file to be included
#if defined(KOKKOSCOMM_ENABLE_MPI)
#include "mpi/mpi.hpp"
#include "mpi/send.hpp"
#include "mpi/allgather.hpp"
#include "mpi/alltoall.hpp"
#include "mpi/barrier.hpp"
#include "mpi/handle.hpp"
#include "mpi/irecv.hpp"
#include "mpi/isend.hpp"
#include "mpi/recv.hpp"
#include "mpi/reduce.hpp"
#include <KokkosComm/mpi/mpi.hpp>
#include <KokkosComm/mpi/send.hpp>
#include <KokkosComm/mpi/allgather.hpp>
#include <KokkosComm/mpi/alltoall.hpp>
#include <KokkosComm/mpi/barrier.hpp>
#include <KokkosComm/mpi/handle.hpp>
#include <KokkosComm/mpi/irecv.hpp>
#include <KokkosComm/mpi/isend.hpp>
#include <KokkosComm/mpi/recv.hpp>
#include <KokkosComm/mpi/reduce.hpp>
#else
#error at least one transport must be defined
#endif

#include "concepts.hpp"
#include "point_to_point.hpp"
#include "collective.hpp"
#include <KokkosComm/concepts.hpp>
#include <KokkosComm/point_to_point.hpp>
#include <KokkosComm/collective.hpp>

#include <Kokkos_Core.hpp>

Expand Down
6 changes: 3 additions & 3 deletions src/KokkosComm/collective.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@

#pragma once

#include <utility>
#include <KokkosComm/fwd.hpp>
#include <KokkosComm/concepts.hpp>

#include <Kokkos_Core.hpp>

#include "fwd.hpp"
#include "concepts.hpp"
#include <utility>

namespace KokkosComm {

Expand Down
9 changes: 5 additions & 4 deletions src/KokkosComm/fwd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@

#pragma once

#include <vector>

#include "concepts.hpp"
#include <KokkosComm/concepts.hpp>
#include <KokkosComm/config.hpp>

#include <vector>

namespace KokkosComm {

#if defined(KOKKOSCOMM_ENABLE_MPI)
class Mpi;
using DefaultCommunicationSpace = Mpi;
Expand Down Expand Up @@ -51,4 +52,4 @@ struct Barrier;

} // namespace Impl

} // namespace KokkosComm
} // namespace KokkosComm
6 changes: 3 additions & 3 deletions src/KokkosComm/impl/KokkosComm_contiguous.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

#include <Kokkos_Core.hpp>

#include "concepts.hpp"
#include "traits.hpp"
#include <KokkosComm/concepts.hpp>
#include <KokkosComm/traits.hpp>

namespace KokkosComm::Impl {

Expand Down Expand Up @@ -60,4 +60,4 @@ auto resize_contiguous_for(const Space &space, DstView &out, const SrcView &in)
}
}

} // namespace KokkosComm::Impl
} // namespace KokkosComm::Impl
10 changes: 5 additions & 5 deletions src/KokkosComm/mpi/allgather.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@

#pragma once

#include <Kokkos_Core.hpp>
#include <KokkosComm/traits.hpp>
#include <KokkosComm/mpi/impl/pack_traits.hpp>
#include <KokkosComm/mpi/impl/include_mpi.hpp>
#include <KokkosComm/mpi/impl/types.hpp>

#include "KokkosComm/traits.hpp"
#include "impl/pack_traits.hpp"
#include "impl/include_mpi.hpp"
#include "impl/types.hpp"
#include <Kokkos_Core.hpp>

namespace KokkosComm::mpi {

Expand Down
10 changes: 5 additions & 5 deletions src/KokkosComm/mpi/alltoall.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@

#pragma once

#include <Kokkos_Core.hpp>
#include <KokkosComm/traits.hpp>
#include <KokkosComm/mpi/impl/pack_traits.hpp>
#include <KokkosComm/mpi/impl/include_mpi.hpp>
#include <KokkosComm/mpi/impl/types.hpp>

#include "KokkosComm/traits.hpp"
#include "impl/pack_traits.hpp"
#include "impl/include_mpi.hpp"
#include "impl/types.hpp"
#include <Kokkos_Core.hpp>

namespace KokkosComm::Impl {
template <KokkosExecutionSpace ExecSpace, KokkosView SendView, KokkosView RecvView>
Expand Down
2 changes: 1 addition & 1 deletion src/KokkosComm/mpi/barrier.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#pragma once

#include "KokkosComm/concepts.hpp"
#include <KokkosComm/concepts.hpp>

namespace KokkosComm {

Expand Down
7 changes: 3 additions & 4 deletions src/KokkosComm/mpi/handle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@

#pragma once

#include "KokkosComm/fwd.hpp"

#include "req.hpp"
#include <KokkosComm/fwd.hpp>
#include <KokkosComm/mpi/req.hpp>

namespace KokkosComm {

Expand Down Expand Up @@ -62,4 +61,4 @@ class Handle<ExecSpace, Mpi> {
MPI_Comm comm_;
};

} // namespace KokkosComm
} // namespace KokkosComm
6 changes: 3 additions & 3 deletions src/KokkosComm/mpi/impl/pack_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@

#pragma once

#include "KokkosComm/traits.hpp"
#include "KokkosComm/concepts.hpp"
#include <KokkosComm/traits.hpp>
#include <KokkosComm/concepts.hpp>

#include "packer.hpp"
#include <KokkosComm/mpi/impl/packer.hpp>

namespace KokkosComm {

Expand Down
8 changes: 4 additions & 4 deletions src/KokkosComm/mpi/impl/packer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@

#pragma once

#include "KokkosComm/concepts.hpp"
#include "KokkosComm/traits.hpp"
#include "types.hpp"
#include "include_mpi.hpp"
#include <KokkosComm/concepts.hpp>
#include <KokkosComm/traits.hpp>
#include <KokkosComm/mpi/impl/types.hpp>
#include <KokkosComm/mpi/impl/include_mpi.hpp>

// todo: redo this using KokkosComm_contiguous

Expand Down
2 changes: 1 addition & 1 deletion src/KokkosComm/mpi/impl/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#pragma once

#include "include_mpi.hpp"
#include <KokkosComm/mpi/impl/include_mpi.hpp>

#include <Kokkos_Core.hpp>

Expand Down
6 changes: 3 additions & 3 deletions src/KokkosComm/mpi/irecv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

#pragma once

#include "mpi.hpp"
#include "impl/tags.hpp"
#include <KokkosComm/mpi/mpi.hpp>
#include <KokkosComm/mpi/impl/tags.hpp>

namespace KokkosComm {

Expand Down Expand Up @@ -67,4 +67,4 @@ void irecv(const RecvView &rv, int src, int tag, MPI_Comm comm, MPI_Request &req
}
} // namespace mpi

} // namespace KokkosComm
} // namespace KokkosComm
13 changes: 6 additions & 7 deletions src/KokkosComm/mpi/isend.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@

#pragma once

#include "KokkosComm/traits.hpp"

#include "mpi.hpp"
#include "impl/types.hpp"
#include "impl/tags.hpp"
#include "commmode.hpp"
#include <KokkosComm/traits.hpp>
#include <KokkosComm/mpi/mpi.hpp>
#include <KokkosComm/mpi/impl/types.hpp>
#include <KokkosComm/mpi/impl/tags.hpp>
#include <KokkosComm/mpi/commmode.hpp>

namespace KokkosComm {

Expand Down Expand Up @@ -97,4 +96,4 @@ void isend(const SendView &sv, int dest, int tag, MPI_Comm comm, MPI_Request &re

} // namespace mpi

} // namespace KokkosComm
} // namespace KokkosComm
6 changes: 3 additions & 3 deletions src/KokkosComm/mpi/mpi.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

#include <type_traits>

#include "../concepts.hpp"
#include "impl/include_mpi.hpp"
#include <KokkosComm/concepts.hpp>
#include <KokkosComm/mpi/impl/include_mpi.hpp>

namespace KokkosComm {

Expand All @@ -45,4 +45,4 @@ struct Mpi {
template <>
struct Impl::is_communication_space<KokkosComm::Mpi> : public std::true_type {};

} // namespace KokkosComm
} // namespace KokkosComm
Loading

0 comments on commit c54fb9d

Please sign in to comment.