19 #include <rmm/detail/error.hpp>
21 #include <cuda_runtime_api.h>
57 [[nodiscard]] constexpr cudaStream_t
value() const noexcept {
return stream_; }
62 constexpr
operator cudaStream_t() const noexcept {
return value(); }
72 [[nodiscard]] inline
bool is_default() const noexcept;
81 void synchronize()
const { RMM_CUDA_TRY(cudaStreamSynchronize(stream_)); }
90 RMM_ASSERT_CUDA_SUCCESS(cudaStreamSynchronize(stream_));
94 cudaStream_t stream_{};
100 static constexpr cuda_stream_view cuda_stream_default{};
106 static const cuda_stream_view cuda_stream_legacy{
113 static const cuda_stream_view cuda_stream_per_thread{
119 #ifdef CUDA_API_PER_THREAD_DEFAULT_STREAM
120 return value() == cuda_stream_per_thread ||
value() ==
nullptr;
122 return value() == cuda_stream_per_thread;
131 #ifdef CUDA_API_PER_THREAD_DEFAULT_STREAM
132 return value() == cuda_stream_legacy;
134 return value() == cuda_stream_legacy ||
value() ==
nullptr;
157 inline bool operator!=(cuda_stream_view lhs, cuda_stream_view rhs) {
return not(lhs == rhs); }
166 inline std::ostream& operator<<(std::ostream& os, cuda_stream_view stream)
168 os << stream.value();