Skip to content

Commit

Permalink
Test the ES product labels work
Browse files Browse the repository at this point in the history
  • Loading branch information
makortel committed Feb 17, 2023
1 parent 36d6142 commit 6dead51
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,19 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
* Alpaka buffer that is then moved into an object of a class that
* is templated over the device type, and implicitly transfers the
* data product to device
*
* This class also tests the explicit label for ESProducts works
*/
class TestAlpakaESProducerB : public ESProducer {
public:
TestAlpakaESProducerB(edm::ParameterSet const& iConfig) {
auto cc = setWhatProduced(this);
auto cc = setWhatProduced(this, iConfig.getParameter<std::string>("explicitLabel"));
token_ = cc.consumes();
}

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
desc.add("explicitLabel", std::string{});
descriptions.addWithDefaultLabel(desc);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "FWCore/Framework/interface/ESTransientHandle.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/ESGetToken.h"
#include "FWCore/Utilities/interface/ESInputTag.h"
#include "HeterogeneousCore/AlpakaCore/interface/alpaka/ESGetToken.h"
#include "HeterogeneousCore/AlpakaCore/interface/alpaka/ESProducer.h"
#include "HeterogeneousCore/AlpakaCore/interface/alpaka/ModuleFactory.h"
Expand All @@ -23,12 +24,14 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
public:
TestAlpakaESProducerD(edm::ParameterSet const& iConfig) {
auto cc = setWhatProduced(this);
tokenA_ = cc.consumes();
tokenB_ = cc.consumes();
tokenA_ = cc.consumes(iConfig.getParameter<edm::ESInputTag>("srcA"));
tokenB_ = cc.consumes(iConfig.getParameter<edm::ESInputTag>("srcB"));
}

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
desc.add("srcA", edm::ESInputTag{});
desc.add("srcB", edm::ESInputTag{});
descriptions.addWithDefaultLabel(desc);
}

Expand Down
7 changes: 6 additions & 1 deletion HeterogeneousCore/AlpakaTest/test/testAlpakaModules_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,14 @@

from HeterogeneousCore.AlpakaTest.testAlpakaESProducerA_cfi import testAlpakaESProducerA
process.alpakaESProducerA = testAlpakaESProducerA.clone()
process.alpakaESProducerAdataLabel = process.alpakaESProducerA.clone(appendToDataLabel = cms.string("appendedLabel"))
process.alpakaESProducerB = cms.ESProducer("TestAlpakaESProducerB@alpaka")
process.alpakaESProducerBexplicitLabel = process.alpakaESProducerB.clone(explicitLabel = cms.string("explicitLabel"))
process.alpakaESProducerC = cms.ESProducer("TestAlpakaESProducerC@alpaka")
process.alpakaESProducerD = cms.ESProducer("TestAlpakaESProducerD@alpaka")
process.alpakaESProducerD = cms.ESProducer("TestAlpakaESProducerD@alpaka",
srcA = cms.ESInputTag("", "appendedLabel"),
srcB = cms.ESInputTag("", "explicitLabel"),
)

process.intProduct = cms.EDProducer("IntProducer", ivalue = cms.int32(42))

Expand Down

0 comments on commit 6dead51

Please sign in to comment.