CMS 3D CMS Logo

HEFRecHitGPUtoSoA.cc
Go to the documentation of this file.
1 #include <iostream>
2 #include <memory>
3 #include <chrono>
4 #include <cuda_runtime.h>
5 
17 
22 
27 
31 
34 
35 class HEFRecHitGPUtoSoA : public edm::stream::EDProducer<edm::ExternalWork> {
36 public:
37  explicit HEFRecHitGPUtoSoA(const edm::ParameterSet& ps);
38  ~HEFRecHitGPUtoSoA() override;
39 
41  void produce(edm::Event&, const edm::EventSetup&) override;
42 
43 private:
47 
48  std::unique_ptr<HGCRecHitCPUProduct> prodPtr_;
49 };
50 
52  : recHitGPUToken_{consumes<cms::cuda::Product<HGCRecHitGPUProduct>>(
53  ps.getParameter<edm::InputTag>("HEFRecHitGPUTok"))},
54  recHitCPUSoAToken_(produces<HGCRecHitCPUProduct>()) {}
55 
57 
59  edm::EventSetup const& setup,
61  cms::cuda::ScopedContextAcquire ctx{event.streamID(), std::move(w)};
62  const auto& gpuRecHits = ctx.get(event, recHitGPUToken_);
63 
64  prodPtr_ = std::make_unique<HGCRecHitCPUProduct>(gpuRecHits.nHits(), ctx.stream());
65 
66  KernelManagerHGCalRecHit km((*prodPtr_).get(), gpuRecHits.get());
67  km.transfer_soa_to_host(ctx.stream());
68 }
69 
71 
HEFRecHitGPUtoSoA
Definition: HEFRecHitGPUtoSoA.cc:35
HEFRecHitGPUtoSoA::~HEFRecHitGPUtoSoA
~HEFRecHitGPUtoSoA() override
Definition: HEFRecHitGPUtoSoA.cc:56
HEFRecHitGPUtoSoA::prodPtr_
std::unique_ptr< HGCRecHitCPUProduct > prodPtr_
Definition: HEFRecHitGPUtoSoA.cc:48
HEFRecHitGPUtoSoA::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: HEFRecHitGPUtoSoA.cc:70
HGCRecHitGPUProduct.h
edm::EDGetTokenT
Definition: EDGetToken.h:33
edm::EDPutTokenT< HGCRecHitCPUProduct >
HGCSiliconDetId.h
RecHitTools.h
ESProducer.h
EDProducer.h
KernelManagerHGCalRecHit
Definition: KernelManagerHGCalRecHit.h:33
HGCRecHitCPUProduct.h
HEFRecHitGPUtoSoA::recHitCPUSoAToken_
edm::EDPutTokenT< HGCRecHitCPUProduct > recHitCPUSoAToken_
Definition: HEFRecHitGPUtoSoA.cc:46
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
edm::WaitingTaskWithArenaHolder
Definition: WaitingTaskWithArenaHolder.h:34
MakerMacros.h
HGCalWaferIndex.h
HGCRecHit.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Service.h
w
const double w
Definition: UKUtility.cc:23
HEFRecHitGPUtoSoA::acquire
void acquire(edm::Event const &, edm::EventSetup const &, edm::WaitingTaskWithArenaHolder) override
Definition: HEFRecHitGPUtoSoA.cc:58
KernelManagerHGCalRecHit.h
EDGetToken.h
TFileService.h
KernelManagerHGCalRecHit::transfer_soa_to_host
void transfer_soa_to_host(const cudaStream_t &)
cms::cuda::ContextState
Definition: ContextState.h:15
HGCRecHitCollections.h
HGCalGeometry.h
edm::ParameterSet
Definition: ParameterSet.h:47
EDPutToken.h
HEFRecHitGPUtoSoA::recHitGPUToken_
edm::EDGetTokenT< cms::cuda::Product< HGCRecHitGPUProduct > > recHitGPUToken_
Definition: HEFRecHitGPUtoSoA.cc:45
HEFRecHitGPUtoSoA::HEFRecHitGPUtoSoA
HEFRecHitGPUtoSoA(const edm::ParameterSet &ps)
Definition: HEFRecHitGPUtoSoA.cc:51
cudaCheck.h
edm::stream::EDProducer
Definition: EDProducer.h:36
edm::EventSetup
Definition: EventSetup.h:58
InputTag.h
HEFRecHitGPUtoSoA::ctxState_
cms::cuda::ContextState ctxState_
Definition: HEFRecHitGPUtoSoA.cc:44
CUDAService.h
cms::cuda::ScopedContextAcquire
Definition: ScopedContext.h:101
ContextState.h
eostools.move
def move(src, dest)
Definition: eostools.py:511
ScopedContext.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
Exception.h
HGCalDDDConstants.h
ParameterSet.h
event
Definition: event.py:1
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15