-
Notifications
You must be signed in to change notification settings - Fork 50
Core Deep Copy
Sam Reeve edited this page May 18, 2023
·
2 revisions
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.
Header File: Cabana_DeepCopy.hpp
Usage: To copy data between AoSoA elements
template<class DstAoSoA, class SrcAoSoA>
class deep_copy(
DstAoSoA& dst,
const SrcAoSoA& src
)
-
Destination AoSoA
: The destination for the copied data. -
Source AoSoA
: The source of the copied data.
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
Cabana - A Co-Designed Library for Exascale Particle Simulations