Celeritas 0.6.0-rc.2.10+develop.de0a3a05
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
celeritas::Stream Class Reference

PIMPL class for CUDA or HIP stream. More...

#include <Stream.hh>

Classes

struct  Impl
 

Public Types

Type aliases
using MissingDeviceRuntime = void
 
using ResourceT = detail::AsyncMemoryResource
 

Public Member Functions

 Stream ()
 Construct by creating a stream.
 
 CELER_DEFAULT_MOVE_DELETE_COPY (Stream)
 
MissingDeviceRuntime get () const
 Get the CUDA stream pointer.
 
ResourceT & memory_resource ()
 Get the Thrust async allocation resource.
 
void sync () const
 Synchronize this stream.
 
voidmalloc_async (std::size_t bytes) const
 Allocate memory asynchronously on this stream if possible.
 
void free_async (void *ptr) const
 Free memory asynchronously on this stream if possible.
 

Detailed Description

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.

Warning
This class interface changes based on available headers. Because the CUDA/HIP stream type are only defined when those paths are included and available (which isn't true for all Celeritas code) we hide the stream unless DeviceRuntimeApi has been included or the file is being compiled by a CUDA/HIP compiler. Worse, our stream class has to manage a Thrust memory resource, and in newer versions of rocthrust, its headers cannot be included at all by a non-HIP compiler. Because this class forward declares the memory resource, downstream uses must include corecel/sys/detail/AsyncMemoryResource.device.hh .

Member Function Documentation

◆ malloc_async()

void * celeritas::Stream::malloc_async ( std::size_t  bytes) const
inline

Allocate memory asynchronously on this stream if possible.

HIP 5.1 and lower does not support async allocation.


The documentation for this class was generated from the following files: