CMS 3D CMS Logo

SiPixelClustersSoACollection.h
Go to the documentation of this file.
1 #ifndef DataFormats_SiPixelClusterSoA_interface_alpaka_SiPixelClustersSoACollection_h
2 #define DataFormats_SiPixelClusterSoA_interface_alpaka_SiPixelClustersSoACollection_h
3 
4 #include <alpaka/alpaka.hpp>
5 
12 
15  std::conditional_t<std::is_same_v<Device, alpaka::DevCpu>, SiPixelClustersHost, SiPixelClustersDevice<Device>>;
16 } // namespace ALPAKA_ACCELERATOR_NAMESPACE
17 
18 namespace cms::alpakatools {
19  template <typename TDevice>
20  struct CopyToHost<SiPixelClustersDevice<TDevice>> {
21  template <typename TQueue>
22  static auto copyAsync(TQueue &queue, SiPixelClustersDevice<TDevice> const &srcData) {
23  // SiPixelClustersHost and SiPixelClustersDevice have a capacity larger than the ctor argument by one
24  SiPixelClustersHost dstData(srcData->metadata().size() - 1, queue);
25  alpaka::memcpy(queue, dstData.buffer(), srcData.buffer());
26  dstData.setNClusters(srcData.nClusters(), srcData.offsetBPIX2());
27 #ifdef GPU_DEBUG //keeping this untiil copies are in the Tracer
28  printf("SiPixelClustersSoACollection: I'm copying to host.\n");
29 #endif
30  return dstData;
31  }
32  };
33 } // namespace cms::alpakatools
34 
36 #endif // DataFormats_SiPixelClusterSoA_interface_alpaka_SiPixelClustersSoACollection_h
void setNClusters(uint32_t nClusters, int32_t offsetBPIX2)
#define ASSERT_DEVICE_MATCHES_HOST_COLLECTION(DEVICE_COLLECTION, HOST_COLLECTION)
static auto copyAsync(TQueue &queue, SiPixelClustersDevice< TDevice > const &srcData)
std::conditional_t< std::is_same_v< Device, alpaka::DevCpu >, SiPixelClustersHost, SiPixelClustersDevice< Device > > SiPixelClustersSoACollection