|
Celeritas 0.7.0-dev.354+develop.b4fe4c4
|
PIMPL class for CUDA or HIP stream. More...
#include <Stream.hh>
Classes | |
| struct | Impl |
| PIMPL class. More... | |
Public Types | |
Type aliases | |
| using | StreamT = std::nullptr_t |
| Stream implementation is unavailable. | |
| using | ResourceT = std::nullptr_t |
| Stream implementation is unavailable. | |
| using | HostKernel = void(*)(void *) |
| Stream implementation is unavailable. | |
Public Member Functions | |
| Stream () | |
| Construct by creating a stream with the active device context. | |
| Stream (std::nullptr_t) | |
| Construct a null stream. | |
| Stream (Device const &device) | |
| Construct a stream for the given device. | |
| Stream (Stream const &)=delete | |
| Stream & | operator= (Stream const &)=delete |
| Stream (Stream &&)=default | |
| Stream & | operator= (Stream &&)=default |
| operator bool () const | |
| Whether the stream is valid (not null or moved-from). | |
| StreamT | get () const |
| Get the CUDA stream pointer. | |
| ResourceT & | memory_resource () |
| Get the Thrust async allocation resource. | |
| void * | malloc_async (std::size_t bytes) |
| Allocate memory asynchronously on this stream if possible. | |
| void | free_async (void *ptr) |
| Free memory asynchronously on this stream if possible. | |
| void | sync () const |
| Block host execution until stream operations are all complete. | |
| void | wait (DeviceEvent const &d) |
| Block stream execution until the event completes. | |
| void | launch_host_func (HostKernel func, void *data) |
| Enqueue delayed execution of a host function. | |
PIMPL class for CUDA or HIP stream.
This creates/destroys a stream on construction/destruction and provides accessors to low-level stream-related functionality. This class will typically be accessed only by low-level device implementations or advanced kernels that need to interact with the device stream.
nullptr. No stream is created, but the object is in a valid null state. Operations are no-ops.corecel/sys/detail/AsyncMemoryResource.device.hh . | celeritas::Stream::Stream | ( | ) |
Construct by creating a stream with the active device context.
Construct a stream for the given device.
This delegates to the default constructor, which creates a stream on the active device. The device reference is used to enforce that a valid device has been activated before stream creation.
| void * celeritas::Stream::malloc_async | ( | std::size_t | bytes | ) |
Allocate memory asynchronously on this stream if possible.
HIP 5.1 and lower does not support async allocation.