Skip to content

Commit

Permalink
Recent HPX master has changed some namespaces for the executor traits…
Browse files Browse the repository at this point in the history
… specialization
  • Loading branch information
hkaiser committed Nov 27, 2024
1 parent 8a59e6b commit 6944ac9
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 28 deletions.
1 change: 1 addition & 0 deletions src/hpx/kokkos.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#pragma once

#include <hpx/kokkos/config.hpp>
#include <hpx/kokkos/deep_copy.hpp>
#include <hpx/kokkos/detail/version.hpp>
#include <hpx/kokkos/execution_spaces.hpp>
Expand Down
16 changes: 16 additions & 0 deletions src/hpx/kokkos/config.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2019-2020 ETH Zurich
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
///////////////////////////////////////////////////////////////////////////////

#pragma once

#include <hpx/config/version.hpp>

#if HPX_VERSION_FULL >= 0x011100
#define HPXKOKKOS_HPX_EXECUTOR_NS hpx::execution::experimental
#else
#define HPXKOKKOS_HPX_EXECUTOR_NS hpx::parallel::execution
#endif
9 changes: 3 additions & 6 deletions src/hpx/kokkos/executors.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#pragma once

#include <hpx/kokkos/config.hpp>
#include <hpx/kokkos/deep_copy.hpp>
#include <hpx/kokkos/detail/logging.hpp>
#include <hpx/kokkos/kokkos_algorithms.hpp>
Expand Down Expand Up @@ -160,9 +161,7 @@ struct is_kokkos_executor<executor<ExecutionSpace>> : std::true_type {};
} // namespace kokkos
} // namespace hpx

namespace hpx {
namespace parallel {
namespace execution {
namespace HPXKOKKOS_HPX_EXECUTOR_NS {
template <typename ExecutionSpace>
struct is_one_way_executor<hpx::kokkos::executor<ExecutionSpace>>
: std::true_type {};
Expand All @@ -174,6 +173,4 @@ struct is_two_way_executor<hpx::kokkos::executor<ExecutionSpace>>
template <typename ExecutionSpace>
struct is_bulk_two_way_executor<hpx::kokkos::executor<ExecutionSpace>>
: std::true_type {};
} // namespace execution
} // namespace parallel
} // namespace hpx
} // namespace HPXKOKKOS_HPX_EXECUTOR_NS
45 changes: 23 additions & 22 deletions src/hpx/kokkos/policy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#pragma once

#include <hpx/kokkos/config.hpp>
#include <hpx/kokkos/detail/logging.hpp>
#include <hpx/kokkos/executors.hpp>

Expand All @@ -27,7 +28,7 @@ template <typename Executor, typename Parameters> struct kokkos_policy_shim;
struct kokkos_task_policy {
using executor_type = default_executor;
using executor_parameters_type =
hpx::parallel::execution::extract_executor_parameters<
HPXKOKKOS_HPX_EXECUTOR_NS::extract_executor_parameters<
executor_type>::type;
using execution_category = hpx::execution::parallel_execution_tag;

Expand All @@ -42,26 +43,26 @@ struct kokkos_task_policy {
}

template <typename Executor>
typename hpx::parallel::execution::rebind_executor<
typename HPXKOKKOS_HPX_EXECUTOR_NS::rebind_executor<
kokkos_task_policy, Executor, executor_parameters_type>::type
on(Executor &&exec) const {
using executor_type = typename std::decay<Executor>::type;

static_assert(is_kokkos_executor<executor_type>::value,
"hpx::kokkos::is_kokkos_executor<Executor>::value");

using rebound_type = typename hpx::parallel::execution::rebind_executor<
using rebound_type = typename HPXKOKKOS_HPX_EXECUTOR_NS::rebind_executor<
kokkos_task_policy, Executor, executor_parameters_type>::type;
return rebound_type(std::forward<Executor>(exec), parameters());
}

template <typename... Parameters,
typename ParametersType = typename hpx::parallel::execution::
typename ParametersType = typename HPXKOKKOS_HPX_EXECUTOR_NS::
executor_parameters_join<Parameters...>::type>
typename hpx::parallel::execution::rebind_executor<
typename HPXKOKKOS_HPX_EXECUTOR_NS::rebind_executor<
kokkos_task_policy, executor_type, ParametersType>::type
with(Parameters &&...params) const {
using rebound_type = typename hpx::parallel::execution::rebind_executor<
using rebound_type = typename HPXKOKKOS_HPX_EXECUTOR_NS::rebind_executor<
kokkos_task_policy, executor_type, ParametersType>::type;
return rebound_type(executor(), join_executor_parameters(
std::forward<Parameters>(params)...));
Expand Down Expand Up @@ -103,26 +104,26 @@ struct kokkos_task_policy_shim : kokkos_task_policy {
}

template <typename Executor_>
typename hpx::parallel::execution::rebind_executor<
typename HPXKOKKOS_HPX_EXECUTOR_NS::rebind_executor<
kokkos_task_policy_shim, Executor_, executor_parameters_type>::type
on(Executor_ &&exec) const {
using executor_type = typename std::decay<Executor>::type;

static_assert(is_kokkos_executor<executor_type>::value,
"hpx::kokkos::is_kokkos_executor<Executor>::value");

using rebound_type = typename hpx::parallel::execution::rebind_executor<
using rebound_type = typename HPXKOKKOS_HPX_EXECUTOR_NS::rebind_executor<
kokkos_task_policy_shim, Executor_, executor_parameters_type>::type;
return rebound_type(std::forward<Executor_>(exec), params_);
}

template <typename... Parameters_,
typename ParametersType = typename hpx::parallel::execution::
typename ParametersType = typename HPXKOKKOS_HPX_EXECUTOR_NS::
executor_parameters_join<Parameters_...>::type>
typename hpx::parallel::execution::rebind_executor<
typename HPXKOKKOS_HPX_EXECUTOR_NS::rebind_executor<
kokkos_task_policy_shim, executor_type, ParametersType>::type
with(Parameters_ &&...params) const {
using rebound_type = typename hpx::parallel::execution::rebind_executor<
using rebound_type = typename HPXKOKKOS_HPX_EXECUTOR_NS::rebind_executor<
kokkos_task_policy_shim, executor_type, ParametersType>::type;
return rebound_type(
exec_, join_executor_parameters(std::forward<Parameters_>(params)...));
Expand Down Expand Up @@ -163,7 +164,7 @@ struct kokkos_task_policy_shim : kokkos_task_policy {
struct kokkos_policy {
using executor_type = default_executor;
using executor_parameters_type =
hpx::parallel::execution::extract_executor_parameters<
HPXKOKKOS_HPX_EXECUTOR_NS::extract_executor_parameters<
executor_type>::type;
using execution_category = hpx::execution::parallel_execution_tag;

Expand All @@ -178,26 +179,26 @@ struct kokkos_policy {
}

template <typename Executor>
typename hpx::parallel::execution::rebind_executor<
typename HPXKOKKOS_HPX_EXECUTOR_NS::rebind_executor<
kokkos_policy, Executor, executor_parameters_type>::type
on(Executor &&exec) const {
typedef typename std::decay<Executor>::type executor_type;

static_assert(is_kokkos_executor<executor_type>::value,
"hpx::kokkos::is_kokkos_executor<Executor>::value");

using rebound_type = typename hpx::parallel::execution::rebind_executor<
using rebound_type = typename HPXKOKKOS_HPX_EXECUTOR_NS::rebind_executor<
kokkos_policy, Executor, executor_parameters_type>::type;
return rebound_type(std::forward<Executor>(exec), parameters());
}

template <typename... Parameters,
typename ParametersType = typename hpx::parallel::execution::
typename ParametersType = typename HPXKOKKOS_HPX_EXECUTOR_NS::
executor_parameters_join<Parameters...>::type>
typename hpx::parallel::execution::rebind_executor<
typename HPXKOKKOS_HPX_EXECUTOR_NS::rebind_executor<
kokkos_policy, executor_type, ParametersType>::type
with(Parameters &&...params) const {
using rebound_type = typename hpx::parallel::execution::rebind_executor<
using rebound_type = typename HPXKOKKOS_HPX_EXECUTOR_NS::rebind_executor<
kokkos_policy, executor_type, ParametersType>::type;
return rebound_type(executor(), join_executor_parameters(
std::forward<Parameters>(params)...));
Expand Down Expand Up @@ -240,26 +241,26 @@ struct kokkos_policy_shim : kokkos_policy {
}

template <typename Executor_>
typename hpx::parallel::execution::rebind_executor<
typename HPXKOKKOS_HPX_EXECUTOR_NS::rebind_executor<
kokkos_policy_shim, Executor_, executor_parameters_type>::type
on(Executor_ &&exec) const {
using executor_type = typename std::decay<Executor>::type;

static_assert(is_kokkos_executor<executor_type>::value,
"hpx::kokkos::is_kokkos_executor<Executor>::value");

using rebound_type = typename hpx::parallel::execution::rebind_executor<
using rebound_type = typename HPXKOKKOS_HPX_EXECUTOR_NS::rebind_executor<
kokkos_policy_shim, Executor_, executor_parameters_type>::type;
return rebound_type(std::forward<Executor_>(exec), params_);
}

template <typename... Parameters_,
typename ParametersType = typename hpx::parallel::execution::
typename ParametersType = typename HPXKOKKOS_HPX_EXECUTOR_NS::
executor_parameters_join<Parameters_...>::type>
typename hpx::parallel::execution::rebind_executor<
typename HPXKOKKOS_HPX_EXECUTOR_NS::rebind_executor<
kokkos_policy_shim, executor_type, ParametersType>::type
with(Parameters_ &&...params) const {
using rebound_type = typename hpx::parallel::execution::rebind_executor<
using rebound_type = typename HPXKOKKOS_HPX_EXECUTOR_NS::rebind_executor<
kokkos_policy_shim, executor_type, ParametersType>::type;
return rebound_type(
exec_, join_executor_parameters(std::forward<Parameters_>(params)...));
Expand Down

0 comments on commit 6944ac9

Please sign in to comment.