Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "FWCore/Framework/interface/ESTransientHandle.h"
0002 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0003 #include "FWCore/Utilities/interface/ESGetToken.h"
0004 #include "HeterogeneousCore/AlpakaCore/interface/alpaka/ESGetToken.h"
0005 #include "HeterogeneousCore/AlpakaCore/interface/alpaka/ESProducer.h"
0006 #include "HeterogeneousCore/AlpakaCore/interface/alpaka/ModuleFactory.h"
0007 #include "HeterogeneousCore/AlpakaInterface/interface/config.h"
0008 #include "HeterogeneousCore/AlpakaInterface/interface/memory.h"
0009 #include "HeterogeneousCore/AlpakaTest/interface/AlpakaESTestData.h"
0010 #include "HeterogeneousCore/AlpakaTest/interface/AlpakaESTestRecords.h"
0011 #include "HeterogeneousCore/AlpakaTest/interface/ESTestData.h"
0012 #include "HeterogeneousCore/AlpakaTest/interface/alpaka/AlpakaESTestData.h"
0013 
0014 #include "testESAlgoAsync.h"
0015 
0016 namespace ALPAKA_ACCELERATOR_NAMESPACE {
0017   /**
0018    * This class demonstrates an ESProducer that
0019    * - consumes device ESProducts (that were produced on different Records)
0020    * - calls a kernel on the queue
0021    */
0022   class TestAlpakaESProducerD : public ESProducer {
0023   public:
0024     TestAlpakaESProducerD(edm::ParameterSet const& iConfig) {
0025       auto cc = setWhatProduced(this);
0026       tokenA_ = cc.consumes();
0027       tokenB_ = cc.consumes();
0028     }
0029 
0030     static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0031       edm::ParameterSetDescription desc;
0032       descriptions.addWithDefaultLabel(desc);
0033     }
0034 
0035     std::optional<AlpakaESTestDataDDevice> produce(device::Record<AlpakaESTestRecordD> const& iRecord) {
0036       auto const& dataA = iRecord.get(tokenA_);
0037       auto const& dataB = iRecord.get(tokenB_);
0038 
0039       return testESAlgoAsync(iRecord.queue(), dataA, dataB);
0040     }
0041 
0042   private:
0043     device::ESGetToken<AlpakaESTestDataA, AlpakaESTestRecordA> tokenA_;
0044     device::ESGetToken<cms::alpakatest::AlpakaESTestDataB<Device>, AlpakaESTestRecordB> tokenB_;
0045   };
0046 }  // namespace ALPAKA_ACCELERATOR_NAMESPACE
0047 
0048 DEFINE_FWK_EVENTSETUP_ALPAKA_MODULE(TestAlpakaESProducerD);