Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:26:22

0001 #ifndef RecoLocalTracker_SiPixelRecHits_interface_alpaka_PixelCPEFastParamsCollection_h
0002 #define RecoLocalTracker_SiPixelRecHits_interface_alpaka_PixelCPEFastParamsCollection_h
0003 
0004 #include <cstdint>
0005 #include <alpaka/alpaka.hpp>
0006 #include "HeterogeneousCore/AlpakaInterface/interface/config.h"
0007 #include "RecoLocalTracker/SiPixelRecHits/interface/PixelCPEFastParamsHost.h"
0008 #include "RecoLocalTracker/SiPixelRecHits/interface/PixelCPEFastParamsDevice.h"
0009 #include "DataFormats/Portable/interface/alpaka/PortableCollection.h"
0010 #include "HeterogeneousCore/AlpakaInterface/interface/CopyToDevice.h"
0011 
0012 // TODO: The class is created via inheritance of the PortableCollection.
0013 // This is generally discouraged, and should be done via composition.
0014 // See: https://github.com/cms-sw/cmssw/pull/40465#discussion_r1067364306
0015 namespace ALPAKA_ACCELERATOR_NAMESPACE {
0016 
0017   template <typename TrackerTraits>
0018   using PixelCPEFastParams = std::conditional_t<std::is_same_v<Device, alpaka::DevCpu>,
0019                                                 PixelCPEFastParamsHost<TrackerTraits>,
0020                                                 PixelCPEFastParamsDevice<Device, TrackerTraits>>;
0021 
0022   using PixelCPEFastParamsPhase1 = PixelCPEFastParams<pixelTopology::Phase1>;
0023   using PixelCPEFastParamsPhase2 = PixelCPEFastParams<pixelTopology::Phase2>;
0024 
0025 }  // namespace ALPAKA_ACCELERATOR_NAMESPACE
0026 
0027 namespace cms::alpakatools {
0028   template <typename TrackerTraits>
0029   struct CopyToDevice<PixelCPEFastParamsHost<TrackerTraits>> {
0030     template <typename TQueue>
0031     static auto copyAsync(TQueue& queue, PixelCPEFastParamsHost<TrackerTraits> const& srcData) {
0032       using TDevice = typename alpaka::trait::DevType<TQueue>::type;
0033       PixelCPEFastParamsDevice<TDevice, TrackerTraits> dstData(queue);
0034       alpaka::memcpy(queue, dstData.buffer(), srcData.buffer());
0035       return dstData;
0036     }
0037   };
0038 }  // namespace cms::alpakatools
0039 
0040 #endif  // DataFormats_PixelCPEFastParamsoA_interface_alpaka_PixelCPEFastParamsCollection_h