Skip to content

Commit

Permalink
Try #597:
Browse files Browse the repository at this point in the history
  • Loading branch information
bors[bot] authored Feb 21, 2023
2 parents 7995e31 + 967bcf0 commit 5350202
Show file tree
Hide file tree
Showing 46 changed files with 416 additions and 300 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ setup_arm64_machine: &setup_arm64_machine

docker_default: &docker_default
docker:
- image: pikaorg/pika-ci-base:14
- image: pikaorg/pika-ci-base:15

defaults: &defaults
<<: *working_dir_default
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linux_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
build:
name: github/linux/coverage
runs-on: ubuntu-latest
container: pikaorg/pika-ci-base:14
container: pikaorg/pika-ci-base:15

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linux_debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
build:
name: github/linux/debug/fast
runs-on: ubuntu-latest
container: pikaorg/pika-ci-base:14
container: pikaorg/pika-ci-base:15

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linux_hip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
build:
name: github/linux/hip/fast
runs-on: ubuntu-latest
container: pikaorg/pika-ci-hip:7
container: pikaorg/pika-ci-hip:8
steps:
- uses: actions/checkout@v3
- name: Update apt repositories for ccache
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linux_release_fetchcontent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
build:
name: github/linux/fetchcontent/fast
runs-on: ubuntu-latest
container: pikaorg/pika-ci-base:14
container: pikaorg/pika-ci-base:15

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linux_sanitizers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
build:
name: github/linux/sanitizers/fast
runs-on: ubuntu-latest
container: pikaorg/pika-ci-base:14
container: pikaorg/pika-ci-base:15

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linux_tracy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
build:
name: github/linux/tracy/fast
runs-on: ubuntu-latest
container: pikaorg/pika-ci-base:14
container: pikaorg/pika-ci-base:15

steps:
- name: Check out Tracy
Expand Down
2 changes: 1 addition & 1 deletion .jenkins/cscs-ault/env-hipcc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ hip_version="5.3.3"
hwloc_version="2.6.0"
spack_compiler="gcc@${gcc_version}"
spack_arch="linux-centos8-zen"
stdexec_version="c0fe16f451137b00ceb85d912ec3a288990ce766"
stdexec_version="6510f5bd69cc03b24668f26eda3dd3cca7e81bb2"

# The xnack- architectures are not supported by rocblas@5.3.3
spack_spec="pika@main+rocm+p2300 amdgpu_target='gfx906:xnack-' arch=${spack_arch} %${spack_compiler} malloc=system cxxstd=${cxx_std} ^boost@${boost_version} ^hwloc@${hwloc_version} ^hip@${hip_version} ^whip amdgpu_target='gfx906:xnack-' ^stdexec@${stdexec_version}"
Expand Down
2 changes: 1 addition & 1 deletion .jenkins/cscs/env-clang-13.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ boost_version="1.79.0"
hwloc_version="2.6.0"
spack_compiler="clang@${clang_version}"
spack_arch="cray-cnl7-broadwell"
stdexec_version="c0fe16f451137b00ceb85d912ec3a288990ce766"
stdexec_version="6510f5bd69cc03b24668f26eda3dd3cca7e81bb2"

spack_spec="pika@main arch=${spack_arch} %${spack_compiler} cxxflags=-stdlib=libc++ malloc=system cxxstd=${cxx_std} +p2300 ^boost@${boost_version} ^hwloc@${hwloc_version} ^fmt cxxflags=-stdlib=libc++ ^stdexec@${stdexec_version}"

Expand Down
2 changes: 1 addition & 1 deletion .jenkins/cscs/env-clang-14-cuda.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ hwloc_version="2.7.0"
cuda_version="11.5.0"
spack_compiler="clang@${clang_version}"
spack_arch="cray-cnl7-haswell"
stdexec_version="c0fe16f451137b00ceb85d912ec3a288990ce766"
stdexec_version="6510f5bd69cc03b24668f26eda3dd3cca7e81bb2"

spack_spec="pika@main arch=${spack_arch} %${spack_compiler} +cuda malloc=system cxxstd=${cxx_std} +p2300 ^boost@${boost_version} ^cuda@${cuda_version} +allow-unsupported-compilers ^hwloc@${hwloc_version} ^stdexec@${stdexec_version}"

Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ pika optionally requires:
* `Boost.Context, Thread, and Chrono <https://boost.org>`_ on macOS
* `stdexec <https://github.com/NVIDIA/stdexec>`_ when
``PIKA_WITH_P2300_REFERENCE_IMPLEMENTATION`` is enabled (currently tested with commit
`c0fe16f451137b00ceb85d912ec3a288990ce766
<https://github.com/NVIDIA/stdexec/commit/c0fe16f451137b00ceb85d912ec3a288990ce766>`).
`6510f5bd69cc03b24668f26eda3dd3cca7e81bb2
<https://github.com/NVIDIA/stdexec/commit/6510f5bd69cc03b24668f26eda3dd3cca7e81bb2>`).
The integration is experimental.


Expand Down
21 changes: 16 additions & 5 deletions libs/pika/async_cuda/include/pika/async_cuda/cuda_scheduler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,23 @@ namespace pika::cuda::experimental {
return {s.scheduler, PIKA_FORWARD(Receiver, receiver)};
}

friend cuda_scheduler tag_invoke(
pika::execution::experimental::get_completion_scheduler_t<
pika::execution::experimental::set_value_t>,
cuda_scheduler_sender const& s) noexcept
struct env
{
return s.scheduler;
cuda_scheduler scheduler;

friend cuda_scheduler tag_invoke(
pika::execution::experimental::get_completion_scheduler_t<
pika::execution::experimental::set_value_t>,
env const& e) noexcept
{
return e.scheduler;
}
};

friend env tag_invoke(
pika::execution::experimental::get_env_t, cuda_scheduler_sender const& s)
{
return {s.scheduler};
}
};
} // namespace detail
Expand Down
19 changes: 11 additions & 8 deletions libs/pika/async_cuda/include/pika/async_cuda/then_on_host.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ namespace pika::cuda::experimental {
template <typename Receiver, typename F>
struct then_on_host_receiver_impl<Receiver, F>::then_on_host_receiver_type
{
using is_receiver = void;

PIKA_NO_UNIQUE_ADDRESS std::decay_t<Receiver> receiver;
PIKA_NO_UNIQUE_ADDRESS std::decay_t<F> f;
cuda_scheduler sched;
Expand Down Expand Up @@ -104,7 +106,7 @@ namespace pika::cuda::experimental {
});
}

friend constexpr pika::execution::experimental::detail::empty_env tag_invoke(
friend constexpr pika::execution::experimental::empty_env tag_invoke(
pika::execution::experimental::get_env_t,
then_on_host_receiver_type const&) noexcept
{
Expand All @@ -125,6 +127,8 @@ namespace pika::cuda::experimental {
template <typename Sender, typename F>
struct then_on_host_sender_impl<Sender, F>::then_on_host_sender_type
{
using is_sender = void;

std::decay_t<Sender> sender;
std::decay_t<F> f;
cuda_scheduler sched;
Expand All @@ -151,7 +155,7 @@ namespace pika::cuda::experimental {

using completion_signatures =
pika::execution::experimental::make_completion_signatures<Sender,
pika::execution::experimental::detail::empty_env,
pika::execution::experimental::empty_env,
pika::execution::experimental::completion_signatures<
pika::execution::experimental::set_error_t(std::exception_ptr)>,
invoke_result_helper>;
Expand Down Expand Up @@ -200,12 +204,10 @@ namespace pika::cuda::experimental {
PIKA_FORWARD(Receiver, receiver), s.f, s.sched});
}

friend cuda_scheduler tag_invoke(
pika::execution::experimental::get_completion_scheduler_t<
pika::execution::experimental::set_value_t>,
then_on_host_sender_type const& s) noexcept
friend auto tag_invoke(
pika::execution::experimental::get_env_t, then_on_host_sender_type const& s)
{
return s.sched;
return pika::execution::experimental::get_env(s.sender);
}
};
} // namespace then_on_host_detail
Expand All @@ -227,7 +229,8 @@ namespace pika::cuda::experimental {
friend PIKA_FORCEINLINE auto tag_fallback_invoke(then_on_host_t, Sender&& sender, F&& f)
{
auto completion_sched = pika::execution::experimental::get_completion_scheduler<
pika::execution::experimental::set_value_t>(sender);
pika::execution::experimental::set_value_t>(
pika::execution::experimental::get_env(sender));
static_assert(std::is_same_v<std::decay_t<decltype(completion_sched)>, cuda_scheduler>,
"then_on_host can only be used with senders whose "
"completion scheduler is cuda_scheduler");
Expand Down
23 changes: 13 additions & 10 deletions libs/pika/async_cuda/include/pika/async_cuda/then_with_stream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ namespace pika::cuda::experimental::then_with_stream_detail {
template <typename Sender, typename F>
struct then_with_cuda_stream_sender_impl<Sender, F>::then_with_cuda_stream_sender_type
{
using is_sender = void;

PIKA_NO_UNIQUE_ADDRESS std::decay_t<Sender> sender;
PIKA_NO_UNIQUE_ADDRESS std::decay_t<F> f;
cuda_scheduler sched;
Expand Down Expand Up @@ -165,7 +167,7 @@ namespace pika::cuda::experimental::then_with_stream_detail {

using completion_signatures =
pika::execution::experimental::make_completion_signatures<std::decay_t<Sender>,
pika::execution::experimental::detail::empty_env,
pika::execution::experimental::empty_env,
pika::execution::experimental::completion_signatures<
pika::execution::experimental::set_error_t(std::exception_ptr)>,
invoke_result_helper>;
Expand Down Expand Up @@ -223,6 +225,7 @@ namespace pika::cuda::experimental::then_with_stream_detail {

struct then_with_cuda_stream_receiver
{
using is_receiver = void;
using then_with_cuda_stream_receiver_tag = void;

operation_state& op_state;
Expand Down Expand Up @@ -411,7 +414,7 @@ namespace pika::cuda::experimental::then_with_stream_detail {
});
}

friend constexpr pika::execution::experimental::detail::empty_env tag_invoke(
friend constexpr pika::execution::experimental::empty_env tag_invoke(
pika::execution::experimental::get_env_t,
then_with_cuda_stream_receiver const&) noexcept
{
Expand Down Expand Up @@ -446,7 +449,7 @@ namespace pika::cuda::experimental::then_with_stream_detail {
using ts_type = pika::util::detail::prepend_t<
pika::util::detail::transform_t<
pika::execution::experimental::value_types_of_t<std::decay_t<Sender>,
pika::execution::experimental::detail::empty_env, std::tuple,
pika::execution::experimental::empty_env, std::tuple,
pika::detail::variant>,
value_types_helper>,
pika::detail::monostate>;
Expand Down Expand Up @@ -493,8 +496,8 @@ namespace pika::cuda::experimental::then_with_stream_detail {
pika::util::detail::transform_t<
pika::execution::experimental::value_types_of_t<
then_with_cuda_stream_sender_type,
pika::execution::experimental::detail::empty_env,
pika::util::detail::pack, pika::util::detail::pack>,
pika::execution::experimental::empty_env, pika::util::detail::pack,
pika::util::detail::pack>,
result_types_helper>,
pika::detail::monostate>>>;
#else
Expand Down Expand Up @@ -541,11 +544,10 @@ namespace pika::cuda::experimental::then_with_stream_detail {
PIKA_FORWARD(Receiver, receiver), s.f, s.sched, s.sender);
}

friend cuda_scheduler tag_invoke(pika::execution::experimental::get_completion_scheduler_t<
pika::execution::experimental::set_value_t>,
then_with_cuda_stream_sender_type const& s) noexcept
friend auto tag_invoke(
pika::execution::experimental::get_env_t, then_with_cuda_stream_sender_type const& s)
{
return s.sched;
return pika::execution::experimental::get_env(s.sender);
}
};

Expand All @@ -555,7 +557,8 @@ namespace pika::cuda::experimental::then_with_stream_detail {
auto then_with_cuda_stream(Sender&& sender, F&& f)
{
auto completion_sched = pika::execution::experimental::get_completion_scheduler<
pika::execution::experimental::set_value_t>(sender);
pika::execution::experimental::set_value_t>(
pika::execution::experimental::get_env(sender));
static_assert(std::is_same_v<std::decay_t<decltype(completion_sched)>, cuda_scheduler>,
"then_with_cuda_stream can only be used with senders whose "
"completion scheduler is cuda_scheduler");
Expand Down
8 changes: 4 additions & 4 deletions libs/pika/async_cuda/tests/unit/cuda_scheduler.cu
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ inline constexpr bool is_cuda_scheduler_v =
std::is_same_v<std::decay_t<Scheduler>, cu::cuda_scheduler>;

#define CHECK_CUDA_COMPLETION_SCHEDULER(...) \
static_assert( \
is_cuda_scheduler_v<decltype(ex::get_completion_scheduler<ex::set_value_t>(__VA_ARGS__))>)
static_assert(is_cuda_scheduler_v<decltype(ex::get_completion_scheduler<ex::set_value_t>( \
ex::get_env(__VA_ARGS__)))>)

#define CHECK_NOT_CUDA_COMPLETION_SCHEDULER(...) \
static_assert( \
!is_cuda_scheduler_v<decltype(ex::get_completion_scheduler<ex::set_value_t>(__VA_ARGS__))>)
static_assert(!is_cuda_scheduler_v<decltype(ex::get_completion_scheduler<ex::set_value_t>( \
ex::get_env(__VA_ARGS__)))>)

int pika_main()
{
Expand Down
40 changes: 32 additions & 8 deletions libs/pika/async_cuda/tests/unit/then_with_stream.cu
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,23 @@ struct const_reference_cuda_sender
return operation_state<R>{std::move(s.x), std::forward<R>(r)};
}

friend cu::cuda_scheduler tag_invoke(pika::execution::experimental::get_completion_scheduler_t<
pika::execution::experimental::set_value_t>,
const_reference_cuda_sender const& s) noexcept
struct env
{
return s.sched;
cu::cuda_scheduler sched;

friend cu::cuda_scheduler tag_invoke(
pika::execution::experimental::get_completion_scheduler_t<
pika::execution::experimental::set_value_t>,
env const& e) noexcept
{
return e.sched;
}
};

friend env tag_invoke(
pika::execution::experimental::get_env_t, const_reference_cuda_sender const& s)
{
return {s.sched};
}
};

Expand Down Expand Up @@ -108,11 +120,23 @@ struct const_reference_error_cuda_sender
return {std::forward<R>(r)};
}

friend cu::cuda_scheduler tag_invoke(pika::execution::experimental::get_completion_scheduler_t<
pika::execution::experimental::set_value_t>,
const_reference_error_cuda_sender const& s) noexcept
struct env
{
cu::cuda_scheduler sched;

friend cu::cuda_scheduler tag_invoke(
pika::execution::experimental::get_completion_scheduler_t<
pika::execution::experimental::set_value_t>,
env const& e) noexcept
{
return e.sched;
}
};

friend env tag_invoke(
pika::execution::experimental::get_env_t, const_reference_error_cuda_sender const& s)
{
return s.sched;
return {s.sched};
}
};

Expand Down
Loading

0 comments on commit 5350202

Please sign in to comment.