CMS 3D CMS Logo

PixelTrackDumpCUDA.cc
Go to the documentation of this file.
1 #include <cuda_runtime.h>
2 #include <Eigen/Core> // needed here by soa layout
3 
20 
23 
26 
27 template <typename TrackerTraits>
29 public:
32 
35 
36  explicit PixelTrackDumpCUDAT(const edm::ParameterSet& iConfig);
37  ~PixelTrackDumpCUDAT() override = default;
38 
39  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
40 
41 private:
42  void analyze(edm::StreamID streamID, edm::Event const& iEvent, const edm::EventSetup& iSetup) const override;
43  const bool m_onGPU;
48 };
49 
50 template <typename TrackerTraits>
52  : m_onGPU(iConfig.getParameter<bool>("onGPU")) {
53  if (m_onGPU) {
54  tokenGPUTrack_ = consumes(iConfig.getParameter<edm::InputTag>("pixelTrackSrc"));
55  tokenGPUVertex_ = consumes(iConfig.getParameter<edm::InputTag>("pixelVertexSrc"));
56  } else {
57  tokenSoATrack_ = consumes(iConfig.getParameter<edm::InputTag>("pixelTrackSrc"));
58  tokenSoAVertex_ = consumes(iConfig.getParameter<edm::InputTag>("pixelVertexSrc"));
59  }
60 }
61 
62 template <typename TrackerTraits>
65 
66  desc.add<bool>("onGPU", true);
67  desc.add<edm::InputTag>("pixelTrackSrc", edm::InputTag("pixelTracksCUDA"));
68  desc.add<edm::InputTag>("pixelVertexSrc", edm::InputTag("pixelVerticesCUDA"));
69  descriptions.addWithDefaultLabel(desc);
70 }
71 
72 template <typename TrackerTraits>
74  edm::Event const& iEvent,
75  const edm::EventSetup& iSetup) const {
76  if (m_onGPU) {
77  auto const& hTracks = iEvent.get(tokenGPUTrack_);
79 
80  auto const& tracks = ctx.get(hTracks);
81  auto const* tsoa = &tracks;
82  assert(tsoa->buffer());
83 
84  auto const& vertices = ctx.get(iEvent.get(tokenGPUVertex_));
85  auto const* vsoa = &vertices;
86  assert(vsoa->buffer());
87 
88  } else {
89  auto const& tsoa = iEvent.get(tokenSoATrack_);
90  assert(tsoa.buffer());
91 
92  auto const& vsoa = iEvent.get(tokenSoAVertex_);
93  assert(vsoa.buffer());
94  }
95 }
96 
99 
edm::EDGetTokenT< cms::cuda::Product< TrackSoADevice > > tokenGPUTrack_
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::EDGetTokenT< cms::cuda::Product< VertexSoADevice > > tokenGPUVertex_
PixelTrackDumpCUDAT(const edm::ParameterSet &iConfig)
assert(be >=bs)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
edm::EDGetTokenT< TrackSoAHost > tokenSoATrack_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
void analyze(edm::StreamID streamID, edm::Event const &iEvent, const edm::EventSetup &iSetup) const override
edm::EDGetTokenT< VertexSoAHost > tokenSoAVertex_
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
ZVertexSoAHeterogeneousHost< zVertex::utilities::MAXTRACKS > ZVertexSoAHost
ZVertexSoAHeterogeneousDevice< zVertex::utilities::MAXTRACKS > ZVertexSoADevice
~PixelTrackDumpCUDAT() override=default