CMS 3D CMS Logo

TracksSoACollection.h
Go to the documentation of this file.
1 #ifndef DataFormats_TrackSoA_interface_alpaka_TracksSoACollection_h
2 #define DataFormats_TrackSoA_interface_alpaka_TracksSoACollection_h
3 
4 #include <type_traits>
5 
6 #include <alpaka/alpaka.hpp>
7 
15 
16 // TODO: The class is created via inheritance of the PortableCollection.
17 // This is generally discouraged, and should be done via composition.
18 // See: https://github.com/cms-sw/cmssw/pull/40465#discussion_r1067364306
19 
21 
22  template <typename TrackerTraits>
23  using TracksSoACollection = std::conditional_t<std::is_same_v<Device, alpaka::DevCpu>,
26 
27  //Classes definition for Phase1/Phase2/HIonPhase1, to make the classes_def lighter. Not actually used in the code.
28  namespace pixelTrack {
32  } // namespace pixelTrack
33 } // namespace ALPAKA_ACCELERATOR_NAMESPACE
34 
35 namespace cms::alpakatools {
36  template <typename TrackerTraits, typename TDevice>
37  struct CopyToHost<TracksDevice<TrackerTraits, TDevice>> {
38  template <typename TQueue>
39  static auto copyAsync(TQueue& queue, TracksDevice<TrackerTraits, TDevice> const& deviceData) {
41  alpaka::memcpy(queue, hostData.buffer(), deviceData.buffer());
42 #ifdef GPU_DEBUG
43  printf("TracksSoACollection: I'm copying to host.\n");
44 #endif
45  return hostData;
46  }
47  };
48 } // namespace cms::alpakatools
49 
53 
54 #endif // DataFormats_TrackSoA_interface_alpaka_TracksSoACollection_h
TracksSoACollection< pixelTopology::Phase1 > TracksSoACollectionPhase1
#define ASSERT_DEVICE_MATCHES_HOST_COLLECTION(DEVICE_COLLECTION, HOST_COLLECTION)
static auto copyAsync(TQueue &queue, TracksDevice< TrackerTraits, TDevice > const &deviceData)
TracksSoACollection< pixelTopology::HIonPhase1 > TracksSoACollectionHIonPhase1
std::conditional_t< std::is_same_v< Device, alpaka::DevCpu >, TracksHost< TrackerTraits >, TracksDevice< TrackerTraits, Device > > TracksSoACollection
TracksSoACollection< pixelTopology::Phase2 > TracksSoACollectionPhase2