YAKL
|
Class to handle scalars that exist before kernels, are written to by kernels, and read after the kernel terminates. More...
#include <YAKL_ScalarLiveOut.h>
Public Member Functions | |
YAKL_INLINE | ScalarLiveOut () |
Default constructor allocates room on the device for one scalar of type T More... | |
YAKL_INLINE | ScalarLiveOut (ScalarLiveOut &&rhs) |
Copies and moves are shallow, not deep copy. More... | |
YAKL_INLINE | ScalarLiveOut (ScalarLiveOut const &rhs) |
Copies and moves are shallow, not deep copy. More... | |
ScalarLiveOut (T val, Stream stream=Stream()) | |
[ASYNCHRONOUS] This constructor allocates room on the device for one scalar of type T and initializes it on device with the provided value. More... | |
YAKL_INLINE | ~ScalarLiveOut () |
Deallocates the scalar value on the device. More... | |
YAKL_INLINE T | get () const |
Returns a modifiable reference to the underlying data on the device. More... | |
T | hostRead (Stream stream=Stream()) const |
Returns a host copy of the data. This is blocking. More... | |
void | hostWrite (T val, Stream stream=Stream()) |
[ASYNCHRONOUS] Writes a value to the device-resident underlying data More... | |
YAKL_INLINE T & | operator() () const |
Returns a modifiable reference to the underlying data on the device. More... | |
YAKL_INLINE ScalarLiveOut & | operator= (ScalarLiveOut &&rhs) |
Copies and moves are shallow, not deep copy. More... | |
YAKL_INLINE ScalarLiveOut & | operator= (ScalarLiveOut const &rhs) |
Copies and moves are shallow, not deep copy. More... | |
template<class TLOC , typename std::enable_if< std::is_arithmetic< TLOC >::value, int >::type = 0> | |
YAKL_INLINE T & | operator= (TLOC rhs) const |
Assign a value to the ScalarLiveOut object on the device. More... | |
Class to handle scalars that exist before kernels, are written to by kernels, and read after the kernel terminates.
Handles the case where a scalar value is written to in a kernel and must be read on the host after the kernel completes. Passing a value to the constructor will initialize the device pointer with that data from the host. Using the = operator will assign to the value inside a kernel. This is the most common operation. To access the value as a reference that is writable, use the operator() (e.g., in an atomic operation perhaps). To read on the host afterward, using hostRead() To write after construction, use hostWrite()
T | The type of the scalar value |
|
inline |
Default constructor allocates room on the device for one scalar of type T
|
inlineexplicit |
[ASYNCHRONOUS] This constructor allocates room on the device for one scalar of type T
and initializes it on device with the provided value.
|
inline |
Deallocates the scalar value on the device.
|
inline |
Copies and moves are shallow, not deep copy.
|
inline |
Copies and moves are shallow, not deep copy.
|
inline |
Returns a modifiable reference to the underlying data on the device.
|
inline |
Returns a host copy of the data. This is blocking.
|
inline |
[ASYNCHRONOUS] Writes a value to the device-resident underlying data
|
inline |
Returns a modifiable reference to the underlying data on the device.
|
inline |
Copies and moves are shallow, not deep copy.
|
inline |
Copies and moves are shallow, not deep copy.
|
inline |
Assign a value to the ScalarLiveOut object on the device.