Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REVIEW] Execution policy class #816

Merged
merged 4 commits into from
Aug 13, 2021
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions include/rmm/exec_policy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@

namespace rmm {

using thrust_exec_policy_t =
thrust::detail::execute_with_allocator<rmm::mr::thrust_allocator<char>,
thrust::cuda_cub::execute_on_stream_base>;

/**
* @brief Returns a Thrust CUDA execution policy that uses RMM for temporary memory allocation on
* the specified stream.
Expand All @@ -38,4 +42,13 @@ inline auto exec_policy(cuda_stream_view stream = cuda_stream_defaul
return thrust::cuda::par(rmm::mr::thrust_allocator<char>(stream, mr)).on(stream.value());
}

struct exec_policy_t {
viclafargue marked this conversation as resolved.
Show resolved Hide resolved
explicit exec_policy_t(cuda_stream_view stream) : stream_(stream) {}

operator thrust_exec_policy_t() { return exec_policy(stream_); }
viclafargue marked this conversation as resolved.
Show resolved Hide resolved

private:
cuda_stream_view stream_;
};

} // namespace rmm