Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-06-25 22:35:15

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 PixelCPEFastParamsHIonPhase1 = PixelCPEFastParams<pixelTopology::HIonPhase1>;
0024   using PixelCPEFastParamsPhase2 = PixelCPEFastParams<pixelTopology::Phase2>;
0025 
0026 }  // namespace ALPAKA_ACCELERATOR_NAMESPACE
0027 
0028 namespace cms::alpakatools {
0029   template <typename TrackerTraits>
0030   struct CopyToDevice<PixelCPEFastParamsHost<TrackerTraits>> {
0031     template <typename TQueue>
0032     static auto copyAsync(TQueue& queue, PixelCPEFastParamsHost<TrackerTraits> const& srcData) {
0033       using TDevice = typename alpaka::trait::DevType<TQueue>::type;
0034       PixelCPEFastParamsDevice<TDevice, TrackerTraits> dstData(queue);
0035       alpaka::memcpy(queue, dstData.buffer(), srcData.buffer());
0036       return dstData;
0037     }
0038   };
0039 }  // namespace cms::alpakatools
0040 
0041 #endif  // DataFormats_PixelCPEFastParamsoA_interface_alpaka_PixelCPEFastParamsCollection_h