The Kokkos object that can hold a host reference and a device-compatible copy of a variable. More...
#include <KokkosReferenceWrapper.h>
Public Member Functions | |
| DualReferenceWrapper (H &reference) | |
| Constructor. | |
| DualReferenceWrapper (const DualReferenceWrapper< H, D > &object) | |
| Copy constructor. | |
| KOKKOS_FUNCTION const D & | device () const |
| Get the device copy. | |
| H & | host () |
| Get the host reference. | |
| const H & | host () const |
Protected Attributes | |
| H & | _reference |
| Writeable host reference of the variable. | |
| const D | _copy |
| Device copy of the variable. | |
The Kokkos object that can hold a host reference and a device-compatible copy of a variable.
Reference of a host variable is not accessible on device, so if there is a variable that should be stored as a reference but still needs to be accessed on device, define an instance of this class and construct it with the reference of the variable. This class holds the device copy as well as the host reference of the variable. The copy constructor of this object that copies the host reference to the device copy is invoked whenever a Kokkos functor containing this object is dispatched to device, so it is guaranteed that the device copy is always up-to-date with the host reference when it is used on device. Therefore, D must be constructible from H.
| H | The host reference type |
| D | The device copy type |
Definition at line 33 of file KokkosReferenceWrapper.h.
|
inline |
Constructor.
| reference | The host reference of the variable to store |
Definition at line 40 of file KokkosReferenceWrapper.h.
|
inline |
Copy constructor.
Definition at line 44 of file KokkosReferenceWrapper.h.
|
inline |
Get the device copy.
Definition at line 63 of file KokkosReferenceWrapper.h.
|
inline |
Get the host reference.
Definition at line 54 of file KokkosReferenceWrapper.h.
|
inline |
Definition at line 55 of file KokkosReferenceWrapper.h.
|
protected |
Device copy of the variable.
Definition at line 80 of file KokkosReferenceWrapper.h.
Referenced by Moose::Kokkos::DualReferenceWrapper< H, D >::device().
|
protected |
Writeable host reference of the variable.
Definition at line 76 of file KokkosReferenceWrapper.h.
Referenced by Moose::Kokkos::DualReferenceWrapper< H, D >::host(), and Moose::Kokkos::DualReferenceWrapper< H, D >::host().