Skip to content

Core Deep Copy

Sam Reeve edited this page May 18, 2023 · 2 revisions

Overview

Deep Copy copies data between compatible AoSoA objects, including those with differing AoSoA vector lengths and those with different memory/execution spaces. Only AoSoA objects with the same set of member data types and size may be copied.

Implementation

Header File: Cabana_DeepCopy.hpp

Usage: To copy data between AoSoA elements

Interface

template<class DstAoSoA, class SrcAoSoA>
class deep_copy(
    DstAoSoA& dst,
    const SrcAoSoA& src
)

Template Parameters

  • Destination AoSoA: The destination for the copied data.
  • Source AoSoA: The source of the copied data.

Examples

Example: Deep Copy Tutorial

Example: Deep Copy Unit Test

  using T0 = float[3];
  using T1 = double;
  using DataTypes = Cabana::MemberTypes<T0,T1>;
  using SrcDeviceType = Kokkos::Device<Kokkos::Serial, Kokkos::HostSpace>;
  using DstDeviceType = Kokkos::Device<Kokkos::Cuda, Kokkos::CudaUVMSpace>;

  using DstAoSoA_t = Cabana::AoSoA<DataTypes,SrcDeviceType,16>;
  using SrcAoSoA_t = Cabana::AoSoA<DataTypes,DstDeviceType,1>;

  DstAoSoA_t dst_aosoa( num_data );
  SrcAoSoA_t src_aosoa( num_data );
  Cabana::deep_copy( dst_aosoa, src_aosoa );

This is part of the Programming Guide series

Clone this wiki locally