scream icon indicating copy to clipboard operation
scream copied to clipboard

Fix Field sync methods in case the field is a subfield

Open bartgol opened this issue 1 year ago • 5 comments

E.g, for D2H, doing Kokkos::deep_copy((m_data.d_view,m_data.h_view); will copy the full N+1 dim field. Besides being more than what we asked, it may also be conceptually wrong.

~If the field is a subfield, we should~

  • ~create a "scratch" view at construction time (or, better, lazy init that scratch inside this call)~
  • ~reshape into the correct view, and (e.g., for D2H) deep copy from m_data.d_view into the scratch (done on dev), then from scratch call D2H.~

Edit: perhaps we don't need the scratch pad. We can simply switch on the field rank, call get_view<DT,Host>() and get_view<DT,Device>() and call deep copy on those... So it should be quick to implement...

bartgol avatar Aug 27 '24 17:08 bartgol