![]() |
ryujin 2.1.1 revision ee5cbcbf2346c1299c942d0e1f13b46449973c18
|
#include <source/gpu.h>


Public Types | |
| using | value_type = std::remove_pointer_t< T > |
Public Member Functions | |
| template<typename InitializedMemorySpace = dealii::MemorySpace::Host> requires (!is_array) | |
| Mirrored (const std::string &label="mirrored object", const TransferPolicy transfer_policy=TransferPolicy::explicit_transfers, InitializedMemorySpace={}) | |
| template<typename InitializedMemorySpace = dealii::MemorySpace::Host> requires (is_array) | |
| Mirrored (const std::string &label="mirrored array", const std::size_t size=0, const TransferPolicy transfer_policy=TransferPolicy::explicit_transfers, InitializedMemorySpace={}) | |
| template<typename InitializedMemorySpace = dealii::MemorySpace::Host> requires (is_array) | |
| void | reinit (const std::size_t size, const TransferPolicy transfer_policy=TransferPolicy::explicit_transfers, InitializedMemorySpace={}) |
| std::size_t | size () const |
| template<typename MemorySpace = dealii::MemorySpace::Host> | |
| value_type * | view () |
| template<typename MemorySpace = dealii::MemorySpace::Host> | |
| const value_type * | view () const |
Public Member Functions inherited from ryujin::MirroredStorage< Mirrored< T > > | |
| bool | is_resident () const |
| bool | is_pinned () const |
| void | copy_to_memory_space () const |
| void | move_to_memory_space () |
| TransferPolicy | transfer_policy () const |
| void | set_transfer_policy (const TransferPolicy transfer_policy) |
Static Public Attributes | |
| static constexpr bool | is_array = std::is_pointer_v<T> |
Internal fields, methods, and friends | |
| class | MirroredStorage< Mirrored< T > > |
Additional Inherited Members | |
Protected Member Functions inherited from ryujin::MirroredStorage< Mirrored< T > > | |
| MirroredStorage ()=default | |
| void | prepare_read_access () const |
| void | prepare_write_access () |
| void | reset_residency (const bool host_resident, const bool default_resident) |
A convenience wrapper around MirroredStorage that maintains a (trivially copyable) payload mirrored between the host and default (device) memory spaces.
This allows to encapsulate a "POD style" payload (such as the runtime parameters of a class) in a single structure that is moved into device memory once - instead of copying individual parameters field by field into a "view" object that is then captured by value in a computation loop.
The class operates in one of two modes that are selected by the template argument:
T.T. The length is set in the constructor, or with reinit() and queried with size().Intended usage of the scalar mode, here with the TransferPolicy::implicit_transfers_host_resident policy so that the payload is transferred on demand and the host storage - into which the runtime parameters are bound - is never deallocated:
The array mode uses the same raw pointer interface, but the storage is sized explicitly with reinit():
| using ryujin::Mirrored< T >::value_type = std::remove_pointer_t<T> |
| ryujin::Mirrored< T >::Mirrored | ( | const std::string & | label = "mirrored object", |
| const TransferPolicy | transfer_policy = TransferPolicy::explicit_transfers, |
||
| InitializedMemorySpace | = {} |
||
| ) |
Constructor for the scalar mode. Allocates the storage of a single object on the selected memory space. The label is used as the Kokkos allocation label, transfer_policy selects the transfer policy, see the documentation of TransferPolicy, and the (defaulted) last argument selects the memory space that is initialized.
| ryujin::Mirrored< T >::Mirrored | ( | const std::string & | label = "mirrored array", |
| const std::size_t | size = 0, |
||
| const TransferPolicy | transfer_policy = TransferPolicy::explicit_transfers, |
||
| InitializedMemorySpace | = {} |
||
| ) |
Constructor for the array mode. Allocates the storage of a single object on the selected memory space. The label is used as the Kokkos allocation label, transfer_policy selects the transfer policy, see the documentation of TransferPolicy, and the (defaulted) last argument selects the memory space that is initialized.
| void ryujin::Mirrored< T >::reinit | ( | const std::size_t | size, |
| const TransferPolicy | transfer_policy = TransferPolicy::explicit_transfers, |
||
| InitializedMemorySpace | = {} |
||
| ) |
Reinitialize the object to maintain size objects. The storage is (re)allocated (and zero initialized) on the selected default memory space.
| std::size_t ryujin::Mirrored< T >::size | ( | ) | const |
Return the number of stored objects.
| value_type * ryujin::Mirrored< T >::view | ( | ) |
Return a writable pointer to the stored object residing in the selected memory space. In the array mode the pointer references the first of size() contiguously stored objects.
Referenced by ryujin::HyperbolicModule< Description, dim, Number >::step().
| const value_type * ryujin::Mirrored< T >::view | ( | ) | const |
Return a read only pointer to the stored object residing in the selected memory space. In the array mode the pointer references the first of size() contiguously stored objects.
|
friend |
|
staticconstexpr |