File indexing completed on 2024-04-06 12:15:44
0001 #include "CUDADataFormats/PortableTestObjects/interface/TestHostCollection.h"
0002 #include "FWCore/Framework/interface/Event.h"
0003 #include "FWCore/Framework/interface/EventSetup.h"
0004 #include "FWCore/Framework/interface/Frameworkfwd.h"
0005 #include "FWCore/Framework/interface/stream/EDProducer.h"
0006 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0007 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0008 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0009 #include "FWCore/ServiceRegistry/interface/Service.h"
0010 #include "FWCore/Utilities/interface/EDGetToken.h"
0011 #include "FWCore/Utilities/interface/InputTag.h"
0012 #include "FWCore/Utilities/interface/StreamID.h"
0013
0014 #include "TestAlgo.h"
0015
0016 class TestPortableProducerCPU : public edm::stream::EDProducer<> {
0017 public:
0018 TestPortableProducerCPU(edm::ParameterSet const& config)
0019 : hostToken_{produces()}, size_{config.getParameter<int32_t>("size")} {}
0020
0021 void produce(edm::Event& event, edm::EventSetup const&) override {
0022
0023 cudatest::TestHostCollection hostProduct{size_};
0024 algo_.fill(hostProduct);
0025
0026
0027 event.emplace(hostToken_, std::move(hostProduct));
0028 }
0029
0030 static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0031 edm::ParameterSetDescription desc;
0032 desc.add<int32_t>("size");
0033 descriptions.addWithDefaultLabel(desc);
0034 }
0035
0036 private:
0037 const edm::EDPutTokenT<cudatest::TestHostCollection> hostToken_;
0038 const int32_t size_;
0039
0040
0041 cudatest::TestAlgo algo_;
0042 };
0043
0044 #include "FWCore/Framework/interface/MakerMacros.h"
0045 DEFINE_FWK_MODULE(TestPortableProducerCPU);