CMS 3D CMS Logo

List of all members | Protected Member Functions | Private Types | Static Private Member Functions
ALPAKA_ACCELERATOR_NAMESPACE::ESProducer Class Reference

#include <ESProducer.h>

Inheritance diagram for ALPAKA_ACCELERATOR_NAMESPACE::ESProducer:
edm::ESProducer edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider ALPAKA_ACCELERATOR_NAMESPACE::TestAlpakaESProducerA ALPAKA_ACCELERATOR_NAMESPACE::TestAlpakaESProducerB ALPAKA_ACCELERATOR_NAMESPACE::TestAlpakaESProducerC ALPAKA_ACCELERATOR_NAMESPACE::TestAlpakaESProducerD

Protected Member Functions

template<typename T >
auto setWhatProduced (T *iThis, edm::es::Label const &label={})
 
template<typename T , typename TReturn , typename TRecord >
auto setWhatProduced (T *iThis, TReturn(T ::*iMethod)(TRecord const &), edm::es::Label const &label={})
 
template<typename T , typename TReturn , typename TRecord >
auto setWhatProduced (T *iThis, TReturn(T ::*iMethod)(device::Record< TRecord > const &), edm::es::Label const &label={})
 
- Protected Member Functions inherited from edm::ESProducer
template<typename T >
auto setWhatProduced (T *iThis, const es::Label &iLabel={})
 
template<typename T >
auto setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
auto setWhatProduced (T *iThis, const std::string &iLabel)
 
template<typename T , typename TDecorator >
auto setWhatProduced (T *iThis, const TDecorator &iDec, const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord >
auto setWhatProduced (T *iThis, TReturn(T ::*iMethod)(const TRecord &), const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord , typename TArg >
auto setWhatProduced (T *iThis, TReturn(T ::*iMethod)(const TRecord &), const TArg &iDec, const es::Label &iLabel={})
 
template<typename TFunc >
auto setWhatProduced (TFunc &&func, const es::Label &iLabel={})
 
template<typename TReturn , typename TRecord , typename TFunc , typename TDecorator >
ESConsumesCollectorT< TRecord > setWhatProduced (TFunc &&func, TDecorator &&iDec, const es::Label &iLabel={})
 
void usesResources (std::vector< std::string > const &)
 
- Protected Member Functions inherited from edm::ESProxyFactoryProducer
template<class TFactory >
void registerFactory (std::unique_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
virtual void registerFactoryWithKey (const EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ProxyFactoryBase > iFactory, const std::string &iLabel=std::string())
 
KeyedProxiesVector registerProxies (const EventSetupRecordKey &, unsigned int iovIndex) override
 
- Protected Member Functions inherited from edm::eventsetup::DataProxyProvider
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &key)
 

Private Types

using Base = edm::ESProducer
 

Static Private Member Functions

static void throwSomeNullException ()
 

Additional Inherited Members

- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
 ESProducer (const ESProducer &)=delete
 
ESProxyIndex const * getTokenIndices (unsigned int iIndex) const
 
ESRecordIndex const * getTokenRecordIndices (unsigned int iIndex) const
 
bool hasMayConsumes () const noexcept
 
size_t numberOfTokenIndices (unsigned int iIndex) const
 
ESProducer const & operator= (const ESProducer &)=delete
 
SerialTaskQueueChainqueue ()
 
template<typename Record >
std::optional< std::vector< ESProxyIndex > > updateFromMayConsumes (unsigned int iIndex, const Record &iRecord) const
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &) final
 
 ~ESProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
 ESProxyFactoryProducer (const ESProxyFactoryProducer &)=delete
 
const ESProxyFactoryProduceroperator= (const ESProxyFactoryProducer &)=delete
 
 ~ESProxyFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::DataProxyProvider
void createKeyedProxies (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
 DataProxyProvider ()
 
 DataProxyProvider (const DataProxyProvider &)=delete
 
const ComponentDescriptiondescription () const
 
void fillRecordsNotAllowingConcurrentIOVs (std::set< EventSetupRecordKey > &recordsNotAllowingConcurrentIOVs) const
 
virtual void initConcurrentIOVs (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
bool isUsingRecord (const EventSetupRecordKey &key) const
 
KeyedProxieskeyedProxies (const EventSetupRecordKey &iRecordKey, unsigned int iovIndex=0)
 
const DataProxyProvideroperator= (const DataProxyProvider &)=delete
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~DataProxyProvider () noexcept(false)
 
- Static Public Member Functions inherited from edm::eventsetup::DataProxyProvider
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Types inherited from edm::ESProxyFactoryProducer
using EventSetupRecordKey = eventsetup::EventSetupRecordKey
 
- Protected Types inherited from edm::eventsetup::DataProxyProvider
using KeyedProxiesVector = std::vector< std::pair< DataKey, std::shared_ptr< DataProxy > >>
 

Detailed Description

The ESProducer is a base class for modules producing data into the host memory space and/or the device memory space defined by the backend (i.e. ALPAKA_ACCELERATOR_NAMESPACE). The interface looks similar to the normal edm::ESProducer.

When producing a host product, the produce function should have the the usual Record argument. For producing a device product, the produce funtion should have device::Record<Record> argument.

Definition at line 23 of file ESProducer.h.

Member Typedef Documentation

◆ Base

Definition at line 24 of file ESProducer.h.

Member Function Documentation

◆ setWhatProduced() [1/3]

template<typename T >
auto ALPAKA_ACCELERATOR_NAMESPACE::ESProducer::setWhatProduced ( T iThis,
edm::es::Label const &  label = {} 
)
inlineprotected

◆ setWhatProduced() [2/3]

template<typename T , typename TReturn , typename TRecord >
auto ALPAKA_ACCELERATOR_NAMESPACE::ESProducer::setWhatProduced ( T iThis,
TReturn(T ::*)(TRecord const &)  iMethod,
edm::es::Label const &  label = {} 
)
inlineprotected

Definition at line 33 of file ESProducer.h.

33  {}) {
34  return Base::setWhatProduced(iThis, iMethod, label);
35  }
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
char const * label

◆ setWhatProduced() [3/3]

template<typename T , typename TReturn , typename TRecord >
auto ALPAKA_ACCELERATOR_NAMESPACE::ESProducer::setWhatProduced ( T iThis,
TReturn(T ::*)(device::Record< TRecord > const &)  iMethod,
edm::es::Label const &  label = {} 
)
inlineprotected

Definition at line 38 of file ESProducer.h.

40  {}) {
42  using ProductType = ESDeviceProduct<TProduct>;
43  using ReturnType = detail::ESDeviceProductWithStorage<TProduct, TReturn>;
44  return Base::setWhatProduced(
45  [iThis, iMethod](TRecord const& record) -> std::unique_ptr<ProductType> {
46  // TODO: move the multiple device support into EventSetup system itself
47  auto const& devices = cms::alpakatools::devices<Platform>();
48  std::vector<std::shared_ptr<Queue>> queues;
49  queues.reserve(devices.size());
50  auto ret = std::make_unique<ReturnType>(devices.size());
51  bool allnull = true;
52  bool anynull = false;
53  for (auto const& dev : devices) {
54  device::Record<TRecord> const deviceRecord(record, dev);
55  auto prod = std::invoke(iMethod, iThis, deviceRecord);
56  if (prod) {
57  allnull = false;
58  ret->insert(dev, std::move(prod));
59  } else {
60  anynull = true;
61  }
62  queues.push_back(deviceRecord.queuePtr());
63  }
64  // TODO: to be changed asynchronous later
65  for (auto& queuePtr : queues) {
66  alpaka::wait(*queuePtr);
67  }
68  if (allnull) {
69  return nullptr;
70  } else if (anynull) {
71  // TODO: throwing an exception if the iMethod() returns
72  // null for some of th devices of one backend is
73  // suboptimal. On the other hand, in the near term
74  // multiple devices per backend is useful only for
75  // private tests (not production), and the plan is to
76  // make the EventSetup system itself aware of multiple
77  // devies (or memory spaces). I hope this exception
78  // would be good-enough until we get there.
80  }
81  return ret;
82  },
83  label);
84  }
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
ret
prodAgent to be discontinued
char const * label
std::map< DetId, double > ReturnType
std::vector< alpaka::Dev< TPlatform > > const & devices()
Definition: devices.h:36
def move(src, dest)
Definition: eostools.py:511

◆ throwSomeNullException()

void ALPAKA_ACCELERATOR_NAMESPACE::ESProducer::throwSomeNullException ( )
staticprivate

Definition at line 5 of file ESProducer.cc.

References Exception, and edm::errors::UnimplementedFeature.

5  {
7  << "The Alpaka backend has multiple devices. The device-specific produce() function returned a null product "
8  "for some of the devices of the backend, but not all. This is not currently supported.";
9  }