Skip to content

Commit

Permalink
Merge pull request #25 from STEllAR-GROUP/hpx_namespace
Browse files Browse the repository at this point in the history
Recent HPX master has changed some namespaces for the executor traits specialization
  • Loading branch information
msimberg authored Dec 13, 2024
2 parents 9b9beb0 + b7cd272 commit 1c8f994
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
strategy:
matrix:
hpx_version: ["1.8.1", "v1.9.0", "v1.10.0"]
kokkos_version: ["3.6.00", "4.0.00"]
kokkos_version: ["3.6.00", "4.0.00", "4.5.00"]
include:
- hpx_version: "v1.10.0"
kokkos_version: "3.6.00"
Expand Down
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
6 changes: 3 additions & 3 deletions src/hpx/kokkos/make_instance.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ inline Kokkos::Cuda make_independent_execution_space_instance<Kokkos::Cuda>() {
kernel_error, "hpx::kokkos::detail::initialize_instances",
std::string("cudaStreamCreate failed: ") + cudaGetErrorString(error));
}
return {s};
return Kokkos::Cuda{s};
}
#endif

Expand All @@ -46,7 +46,7 @@ make_independent_execution_space_instance<Kokkos::Experimental::HIP>() {
kernel_error, "hpx::kokkos::detail::initialize_instances",
std::string("cudaStreamCreate failed: ") + cudaGetErrorString(error));
}
return {s};
return Kokkos::Experimental::HIP{s};
}
#endif

Expand All @@ -70,7 +70,7 @@ make_independent_execution_space_instance<Kokkos::Experimental::SYCL>() {
template <>
inline Kokkos::Experimental::HPX
make_independent_execution_space_instance<Kokkos::Experimental::HPX>() {
return {Kokkos::Experimental::HPX::instance_mode::independent};
return Kokkos::Experimental::HPX(Kokkos::Experimental::HPX::instance_mode::independent);
}
#endif
} // namespace detail
Expand Down
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 1c8f994

Please sign in to comment.