File indexing completed on 2024-05-10 02:20:34
0001 #ifndef DataFormats_SiPixelDigiSoA_interface_alpaka_SiPixelDigisSoACollection_h
0002 #define DataFormats_SiPixelDigiSoA_interface_alpaka_SiPixelDigisSoACollection_h
0003
0004 #include <cstdint>
0005
0006 #include <alpaka/alpaka.hpp>
0007
0008 #include "DataFormats/Portable/interface/alpaka/PortableCollection.h"
0009 #include "DataFormats/SiPixelDigiSoA/interface/SiPixelDigisDevice.h"
0010 #include "DataFormats/SiPixelDigiSoA/interface/SiPixelDigisHost.h"
0011 #include "HeterogeneousCore/AlpakaInterface/interface/CopyToHost.h"
0012 #include "HeterogeneousCore/AlpakaInterface/interface/config.h"
0013
0014 namespace ALPAKA_ACCELERATOR_NAMESPACE {
0015
0016 using SiPixelDigisSoACollection =
0017 std::conditional_t<std::is_same_v<Device, alpaka::DevCpu>, SiPixelDigisHost, SiPixelDigisDevice<Device>>;
0018
0019 }
0020
0021 namespace cms::alpakatools {
0022 template <typename TDevice>
0023 struct CopyToHost<SiPixelDigisDevice<TDevice>> {
0024 template <typename TQueue>
0025 static auto copyAsync(TQueue &queue, SiPixelDigisDevice<TDevice> const &srcData) {
0026 SiPixelDigisHost dstData(srcData.view().metadata().size() - 1, queue);
0027 alpaka::memcpy(queue, dstData.buffer(), srcData.buffer());
0028 dstData.setNModules(srcData.nModules());
0029 return dstData;
0030 }
0031 };
0032 }
0033
0034 ASSERT_DEVICE_MATCHES_HOST_COLLECTION(SiPixelDigisSoACollection, SiPixelDigisHost);
0035
0036 #endif