Celeritas 0.7.0-3+develop.835656ac1
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
celeritas::AsyncResultRef< T > Struct Template Reference

Reference to pinned host memory written asynchronously by a stream. More...

#include <AsyncResultRef.hh>

Public Member Functions

 AsyncResultRef ()=default
 Construct with a null reference.
 
 AsyncResultRef (std::vector< T, PinnedAllocator< T > > &vec)
 Construct from the first element of a pinned host vector.
 
 operator bool () const
 Whether the reference is assigned.
 

Public Attributes

ObserverPtr< T, MemSpace::host > ptr
 Host destination of the asynchronous write.
 

Detailed Description

template<class T>
struct celeritas::AsyncResultRef< T >

Reference to pinned host memory written asynchronously by a stream.

This marks a host destination for an asynchronous device-to-host copy. The referenced value must be in pinned host memory, which must remain valid until the stream has completed the write. The value must not be read until the stream is synchronized (directly or through an event recorded after the enqueued write).

std::vector<size_type, PinnedAllocator<size_type>> count(1);
enqueue_count(state, AsyncResultRef{count});
stream.sync();
use(count.front());
constexpr Count< T > count()
Count upward from zero.
Definition Range.hh:217
Reference to pinned host memory written asynchronously by a stream.
Definition AsyncResultRef.hh:38

Constructor & Destructor Documentation

◆ AsyncResultRef()

template<class T >
celeritas::AsyncResultRef< T >::AsyncResultRef ( std::vector< T, PinnedAllocator< T > > &  vec)
inlineexplicit

Construct from the first element of a pinned host vector.

The vector must not be resized while the asynchronous write is pending.


The documentation for this struct was generated from the following file: