Skip to content

Commit

Permalink
[STF] Define ctx.pick_stream() which was missing for the unified cont…
Browse files Browse the repository at this point in the history
…ext (NVIDIA#3326)

* Define ctx.pick_stream() which was missing for the unified context

* clang-format
  • Loading branch information
caugonnet authored Jan 10, 2025
1 parent bdd64ba commit fae0a1b
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions cudax/include/cuda/experimental/stf.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,23 @@ public:
}
}

/**
* @brief Get a CUDA stream from the stream pool associated to the context
*
* This helper is intended to avoid creating CUDA streams manually. Using
* this stream after the context has been finalized is an undefined
* behaviour.
*/
cudaStream_t pick_stream()
{
_CCCL_ASSERT(payload.index() != ::std::variant_npos, "Context is not initialized");
return ::std::visit(
[](auto& self) {
return self.pick_stream();
},
payload);
}

private:
template <typename Fun>
auto visit(Fun&& fun)
Expand Down

0 comments on commit fae0a1b

Please sign in to comment.