#include <Phalanx_KokkosViewOfViews.hpp>
|
using | InnerViewTypeManaged = InnerViewType |
|
using | InnerViewTypeUnmanaged = decltype(PHX::details::getUnmanaged(std::declval< InnerViewType >())) |
|
using | OuterViewDataTypeManagedInner = typename PHX::v_of_v_utils::add_pointer< InnerViewTypeManaged, OuterViewRank >::type |
|
using | OuterViewDataTypeUnmanagedInner = typename PHX::v_of_v_utils::add_pointer< InnerViewTypeUnmanaged, OuterViewRank >::type |
|
using | OuterViewManaged = Kokkos::View< OuterViewDataTypeManagedInner, OuterViewProps...> |
|
using | OuterViewUnmanaged = Kokkos::View< OuterViewDataTypeUnmanagedInner, OuterViewProps...> |
|
using | OuterViewManagedHostMirror = typename OuterViewManaged::HostMirror |
|
using | OuterViewUnmanagedHostMirror = typename OuterViewUnmanaged::HostMirror |
|
|
template<typename... Extents> |
| ViewOfViews2 (const std::string name, Extents...extents) |
|
template<typename... Extents> |
void | initialize (const std::string name, Extents...extents) |
| Allocate the out view objects. Extents are for the outer view.
|
|
template<typename... Indices> |
void | setView (InnerViewType v, Indices...i) |
| Set an inner device view on the outer view. Indices are the outer view indices.
|
|
void | syncHostToDevice () |
|
auto | getViewHost () |
|
auto | getViewDevice () |
| Returns device view of views.
|
|
template<int OuterViewRank, typename InnerViewType, typename... OuterViewProps>
class PHX::ViewOfViews2< OuterViewRank, InnerViewType, OuterViewProps >
Wrapper class that correctly handles ViewOfViews construction and object lifetime. This class makes sure the host view stays in scope for the life of the device view and makes sure that the device is synced to host before use.
Main restrictions:
- When UVM is not used in the outer view, we need to allocate the VofV on host and deep_copy to device to set up the inner views correctly.
- Step 1 means that the host view must exist as long as the device view is being used, otherwise the inner views may go out of scope and delete memory. This object exists to pair up the host and device view to make sure the inner views are not deleted early.
- The InnerViewType template parameter must be managed. We will add the unmanaged tag internally.
- This object assumes that all inner views are on device. When the accessors reference Host/Device it is with respect to the outer view. If a user wants to initialize the inner view data, they must do that manually external to this object and deep_copy to the device views.
- Parameters
-
OuterViewRank | The rank of the outerview. |
InnerViewType | The type of inner view. Currently MUST be a Managed view! |
OuterViewProps | View properties for the outer view (i.e. space, layout, memory traits, ...). |
template<int OuterViewRank, typename InnerViewType, typename... OuterViewProps>
auto PHX::ViewOfViews2< OuterViewRank, InnerViewType, OuterViewProps >::getViewHost |
( |
| ) |
|
|
inline |
Returns a host mirror view for the outer view, where the inner views are still on device.
template<int OuterViewRank, typename InnerViewType, typename... OuterViewProps>
void PHX::ViewOfViews2< OuterViewRank, InnerViewType, OuterViewProps >::syncHostToDevice |
( |
| ) |
|
|
inline |
Note this only syncs the outer view. The inner views are assumed to be on device for both host and device outer views.
The documentation for this class was generated from the following file:
- design/Phalanx_KokkosViewOfViews.hpp