CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
EERecHitGPUtoSoA.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 EERecHitGPUtoSoA : public edm::stream::EDProducer<edm::ExternalWork> {
36 public:
37  explicit EERecHitGPUtoSoA(const edm::ParameterSet& ps);
38  ~EERecHitGPUtoSoA() 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>("EERecHitGPUTok"))},
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  HGCRecHitCPUProduct& prod_ = *prodPtr_;
67  KernelManagerHGCalRecHit km(prod_.get(), gpuRecHits.get());
68  km.transfer_soa_to_host(ctx.stream());
69 }
70 
72 
const double w
Definition: UKUtility.cc:23
void acquire(edm::Event const &, edm::EventSetup const &, edm::WaitingTaskWithArenaHolder) override
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
cms::cuda::ContextState ctxState_
def move
Definition: eostools.py:511
EERecHitGPUtoSoA(const edm::ParameterSet &ps)
void produce(edm::Event &, const edm::EventSetup &) override
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< cms::cuda::Product< HGCRecHitGPUProduct > > recHitGPUToken_
std::unique_ptr< HGCRecHitCPUProduct > prodPtr_
edm::EDPutTokenT< HGCRecHitCPUProduct > recHitCPUSoAToken_
void transfer_soa_to_host(const cudaStream_t &)
~EERecHitGPUtoSoA() override