CMS 3D CMS Logo

PortableCollection.h
Go to the documentation of this file.
1 #ifndef DataFormats_Portable_interface_alpaka_PortableDeviceCollection_h
2 #define DataFormats_Portable_interface_alpaka_PortableDeviceCollection_h
3 
4 #include <optional>
5 
6 #include <alpaka/alpaka.hpp>
7 
13 
15 
16 #if defined ALPAKA_ACC_CPU_B_SEQ_T_SEQ_ENABLED
17  // ... or any other CPU-based accelerators
18 
19  // generic SoA-based product in host memory
20  template <typename T>
22 
23 #else
24 
25  // generic SoA-based product in device memory
26  template <typename T>
28 
29 #endif // ALPAKA_ACC_CPU_B_SEQ_T_SEQ_ENABLED
30 
31 } // namespace ALPAKA_ACCELERATOR_NAMESPACE
32 
33 namespace traits {
34 
35  // specialise the trait for the device provided by the ALPAKA_ACCELERATOR_NAMESPACE
36  template <typename T>
39  };
40 
41 } // namespace traits
42 
43 namespace cms::alpakatools {
44  // TODO: Is this the right place for the specialization? Or should it be in PortableDeviceProduct?
45  template <typename T>
48 
49  template <typename TQueue>
52  HostDataType hostData(deviceData->metadata().size(), queue);
53  alpaka::memcpy(queue, hostData.buffer(), deviceData.buffer());
54  return hostData;
55  }
56  };
57 } // namespace cms::alpakatools
58 
59 #endif // DataFormats_Portable_interface_alpaka_PortableDeviceCollection_h
static HostDataType transferAsync(TQueue &queue, ALPAKA_ACCELERATOR_NAMESPACE::PortableCollection< T > const &deviceData)
typename traits::PortableCollectionTrait< T, TDev >::CollectionType PortableCollection
long double T