Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-11-24 00:02:22

0001 #ifndef HeterogeneousCore_AlpakaCore_interface_alpaka_global_EDProducer_h
0002 #define HeterogeneousCore_AlpakaCore_interface_alpaka_global_EDProducer_h
0003 
0004 #include "FWCore/Framework/interface/global/EDProducer.h"
0005 #include "HeterogeneousCore/AlpakaCore/interface/alpaka/EDMetadataSentry.h"
0006 #include "HeterogeneousCore/AlpakaCore/interface/alpaka/Event.h"
0007 #include "HeterogeneousCore/AlpakaCore/interface/alpaka/EventSetup.h"
0008 #include "HeterogeneousCore/AlpakaCore/interface/alpaka/ProducerBase.h"
0009 #include "HeterogeneousCore/AlpakaInterface/interface/config.h"
0010 
0011 namespace ALPAKA_ACCELERATOR_NAMESPACE {
0012   namespace global {
0013     template <typename... Args>
0014     class EDProducer : public ProducerBase<edm::global::EDProducer, Args...> {
0015       static_assert(not edm::CheckAbility<edm::module::Abilities::kExternalWork, Args...>::kHasIt,
0016                     "ALPAKA_ACCELERATOR_NAMESPACE::global::EDProducer may not be used with ExternalWork ability. "
0017                     "Please use ALPAKA_ACCELERATOR_NAMESPACE::stream::SynchronizingEDProducer instead.");
0018 
0019     public:
0020       void produce(edm::StreamID sid, edm::Event& iEvent, edm::EventSetup const& iSetup) const final {
0021         detail::EDMetadataSentry sentry(sid);
0022         device::Event ev(iEvent, sentry.metadata());
0023         device::EventSetup const es(iSetup, ev.device());
0024         produce(sid, ev, es);
0025         sentry.finish();
0026       }
0027 
0028       virtual void produce(edm::StreamID sid, device::Event& iEvent, device::EventSetup const& iSetup) const = 0;
0029     };
0030   }  // namespace global
0031 }  // namespace ALPAKA_ACCELERATOR_NAMESPACE
0032 
0033 #endif