Phalanx  Development
 All Classes Functions Variables Typedefs Enumerations Friends Pages
Public Types | Public Member Functions | List of all members
PHX::ViewOfViews< OuterViewRank, InnerViewType, MemorySpace > Class Template Reference

#include <Phalanx_KokkosViewOfViews.hpp>

Public Types

using OuterDataType = typename PHX::v_of_v_utils::add_pointer< InnerViewType, OuterViewRank >::type
 
using OuterViewType = Kokkos::View< OuterDataType, MemorySpace >
 

Public Member Functions

template<typename... Extents>
 ViewOfViews (const std::string name, Extents...extents)
 
template<typename... Indices>
void addView (InnerViewType v, Indices...i)
 
void syncHostToDevice ()
 
auto getViewHost ()
 
auto getViewDevice ()
 

Detailed Description

template<int OuterViewRank, typename InnerViewType, typename MemorySpace>
class PHX::ViewOfViews< OuterViewRank, InnerViewType, MemorySpace >

Wrapper class that correctly handles ViewOfViews construction and object lifetime. Can be used for more than just Views as the inner object. 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:

  1. When UVM is not used in the outer view, we need to allocate the VofV on host and copy to device to set up the inner views correctly.
  2. Step 1 means that the host view must exist as long as the device view is being used, otherwise the views may go out of scope. This object exists to pair up the host and device view to make sure the inner views are not deleted early.

The documentation for this class was generated from the following file: