I added the different types of accessors as specified in: https://github.com/amanzi/mesh_cache_prototype/blob/master/base_class_example.hpp
Please complete this file with more details on the desired implementation.
I will do some tests to see if the creation of Kokkos::subview is slower than the access via getCellFace(i,j).
Example 1: DV and if constexpr, see mesh_DV_constexpr.cc
The default accessor is based on the type of the MeshCache. Host access needs to be specified in each calls.
Example of Device Access:
|
if(mc.getCellVolume(i) != i) |
Example of Host Access:
|
v_h = mc.getCellFaces<memory::host>(2); |
Example 2: DV and copy constructor, see mesh_DV_layer.cc
In this case the MeshCache is "copied" (which doesnt imply deep copy for the Kokkos::View) and the type of MeshCache can be changed when rquesting the Mesh. This is a first version and can be improved.
Example of Device MeshCache and access:
Example of Host MeshCache creation (from the Device MeshCache):
|
MeshCache<host> mc_h(mc); |
This could be solved in the state when requesting the MeshCache with state->getMesh<host>().
Example 3: Multiple MeshCache with Kokkos::View (no DV), see mesh_V_dual.cc
WIP
I added the different types of accessors as specified in: https://github.com/amanzi/mesh_cache_prototype/blob/master/base_class_example.hpp
Please complete this file with more details on the desired implementation.
I will do some tests to see if the creation of
Kokkos::subviewis slower than the access viagetCellFace(i,j).Example 1: DV and
if constexpr, seemesh_DV_constexpr.ccThe default accessor is based on the type of the
MeshCache. Host access needs to be specified in each calls.Example of Device Access:
mesh_cache_prototype/mesh_DV_constexpr.cc
Line 156 in 9d55398
Example of Host Access:
mesh_cache_prototype/mesh_DV_constexpr.cc
Line 174 in 9d55398
Example 2: DV and copy constructor, see
mesh_DV_layer.ccIn this case the MeshCache is "copied" (which doesnt imply deep copy for the
Kokkos::View) and the type of MeshCache can be changed when rquesting the Mesh. This is a first version and can be improved.Example of Device
MeshCacheand access:mesh_cache_prototype/mesh_DV_layer.cc
Line 164 in 9d55398
Example of Host
MeshCachecreation (from the DeviceMeshCache):mesh_cache_prototype/mesh_DV_layer.cc
Line 183 in 9d55398
This could be solved in the
statewhen requesting theMeshCachewithstate->getMesh<host>().Example 3: Multiple
MeshCachewithKokkos::View(no DV), seemesh_V_dual.ccWIP