The Kokkos object that can hold the reference of a variable. More...
#include <KokkosReferenceWrapper.h>
Public Member Functions | |
| ReferenceWrapper (T &reference) | |
| Constructor. More... | |
| ReferenceWrapper (const ReferenceWrapper< T > &object) | |
| Copy constructor. More... | |
| KOKKOS_FUNCTION | operator const T & () const |
| Get the const reference of the stored variable. More... | |
| KOKKOS_FUNCTION const T & | operator* () const |
| Get the const reference of the stored variable. More... | |
| KOKKOS_FUNCTION const T * | operator-> () const |
| Get the const pointer to the stored variable. More... | |
| template<typename... Args> | |
| KOKKOS_FUNCTION auto | operator() (Args &&... args) const -> decltype(auto) |
| Forward arguments to the stored variable's const operator() depending on the architecture this function is being called on. More... | |
| operator const T & () const | |
| Get the const reference of the stored host reference. More... | |
| const T & | operator* () const |
| Get the const reference of the stored host reference. More... | |
| const T * | operator-> () const |
| Get the const pointer of the stored host reference. More... | |
| template<typename... Args> | |
| auto | operator() (Args &&... args) const -> decltype(auto) |
| Forward arguments to the stored host reference's const operator() More... | |
| operator T& () | |
| Get the writeable reference of the stored host reference. More... | |
| T & | operator* () |
| Get the writeable reference of the stored host reference. More... | |
| T * | operator-> () |
| Get the writeable pointer of the stored host reference. More... | |
| template<typename... Args> | |
| auto | operator() (Args &&... args) -> decltype(auto) |
| Forward arguments to the stored host reference's operator() More... | |
Protected Attributes | |
| T & | _reference |
| Writeable host reference of the variable. More... | |
| const T | _copy |
| Device copy of the variable. More... | |
The Kokkos object that can hold the reference 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, the variable must be copy constructible.
Definition at line 31 of file KokkosReferenceWrapper.h.
|
inline |
Constructor.
| reference | The writeable reference of the variable to store |
Definition at line 38 of file KokkosReferenceWrapper.h.
|
inline |
Copy constructor.
Definition at line 42 of file KokkosReferenceWrapper.h.
|
inline |
Get the const reference of the stored variable.
Definition at line 53 of file KokkosReferenceWrapper.h.
|
inline |
Get the const reference of the stored host reference.
Definition at line 98 of file KokkosReferenceWrapper.h.
|
inline |
Get the writeable reference of the stored host reference.
Definition at line 123 of file KokkosReferenceWrapper.h.
|
inline |
Forward arguments to the stored variable's const operator() depending on the architecture this function is being called on.
| args | The variadic arguments to be forwarded |
Definition at line 87 of file KokkosReferenceWrapper.h.
|
inline |
Forward arguments to the stored host reference's const operator()
| args | The variadic arguments to be forwarded |
Definition at line 114 of file KokkosReferenceWrapper.h.
|
inline |
Forward arguments to the stored host reference's operator()
| args | The variadic arguments to be forwarded |
Definition at line 139 of file KokkosReferenceWrapper.h.
|
inline |
Get the const reference of the stored variable.
Definition at line 64 of file KokkosReferenceWrapper.h.
|
inline |
Get the const reference of the stored host reference.
Definition at line 103 of file KokkosReferenceWrapper.h.
|
inline |
Get the writeable reference of the stored host reference.
Definition at line 128 of file KokkosReferenceWrapper.h.
|
inline |
Get the const pointer to the stored variable.
Definition at line 75 of file KokkosReferenceWrapper.h.
|
inline |
Get the const pointer of the stored host reference.
Definition at line 108 of file KokkosReferenceWrapper.h.
|
inline |
Get the writeable pointer of the stored host reference.
Definition at line 133 of file KokkosReferenceWrapper.h.
|
protected |
Device copy of the variable.
Definition at line 152 of file KokkosReferenceWrapper.h.
Referenced by Moose::Kokkos::ReferenceWrapper< T >::operator const T &(), Moose::Kokkos::ReferenceWrapper< Real >::operator()(), Moose::Kokkos::ReferenceWrapper< Real >::operator*(), and Moose::Kokkos::ReferenceWrapper< Real >::operator->().
|
protected |
Writeable host reference of the variable.
Definition at line 148 of file KokkosReferenceWrapper.h.
Referenced by Moose::Kokkos::ReferenceWrapper< T >::operator const T &(), Moose::Kokkos::ReferenceWrapper< T >::operator T&(), Moose::Kokkos::ReferenceWrapper< Real >::operator()(), Moose::Kokkos::ReferenceWrapper< Real >::operator*(), Moose::Kokkos::ReferenceWrapper< Real >::operator->(), and Moose::Kokkos::Scalar< Real >::operator=().
1.8.14