Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More of the DataProxy to ESProductResolver renaming #46204

Merged
merged 1 commit into from
Oct 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion FWCore/Concurrency/scripts/edmStreamStallGrapher.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ def plotPerStreamAboveFirstAndPrepareStack(points, allStackTimes, ax, stream, he
allStackTimes[color].extend(theTS*(nthreads-threadOffset))

#----------------------------------------------
# The same ES module can have multiple Proxies running concurrently
# The same ES module can have multiple Resolvers running concurrently
# so we need to reference count the names of the active modules
class RefCountSet(set):
def __init__(self):
Expand Down
18 changes: 9 additions & 9 deletions FWCore/Framework/interface/CallbackBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ namespace edm {
class CallbackBase {
public:
CallbackBase(T* iProd, std::shared_ptr<TProduceFunc> iProduceFunc, unsigned int iID, const TDecorator& iDec)
: proxyData_{},
: resolverData_{},
producer_(iProd),
callingContext_(&iProd->description(), iID),
produceFunction_(std::move(iProduceFunc)),
Expand Down Expand Up @@ -127,13 +127,13 @@ namespace edm {
try {
convertException::wrap([this, &serviceToken, &record, &eventSetupImpl, &produceFunctor] {
ESModuleCallingContext const& context = callingContext_;
auto proxies = getTokenIndices();
auto resolvers = getTokenIndices();
if (postMayGetResolvers_) {
proxies = &((*postMayGetResolvers_).front());
resolvers = &((*postMayGetResolvers_).front());
}
TRecord rec;
ESParentContext pc{&context};
rec.setImpl(record, transitionID(), proxies, eventSetupImpl, &pc);
rec.setImpl(record, transitionID(), resolvers, eventSetupImpl, &pc);
ServiceRegistry::Operate operate(serviceToken.lock());
record->activityRegistry()->preESModuleSignal_.emit(record->key(), context);
struct EndGuard {
Expand Down Expand Up @@ -202,12 +202,12 @@ namespace edm {

template <class DataT>
void holdOntoPointer(DataT* iData) {
proxyData_[produce::find_index<TReturn, DataT>::value] = iData;
resolverData_[produce::find_index<TReturn, DataT>::value] = iData;
}

template <class RemainingContainerT, class DataT, class ProductsT>
void setData(ProductsT& iProducts) {
DataT* temp = reinterpret_cast<DataT*>(proxyData_[produce::find_index<TReturn, DataT>::value]);
DataT* temp = reinterpret_cast<DataT*>(resolverData_[produce::find_index<TReturn, DataT>::value]);
if (nullptr != temp) {
moveFromTo(iProducts, *temp);
}
Expand Down Expand Up @@ -243,14 +243,14 @@ namespace edm {

void prefetchNeededDataAsync(WaitingTaskHolder task,
EventSetupImpl const* iImpl,
ESResolverIndex const* proxies,
ESResolverIndex const* resolvers,
ServiceToken const& token) const noexcept {
auto recs = producer_->getTokenRecordIndices(id_);
auto n = producer_->numberOfTokenIndices(id_);
for (size_t i = 0; i != n; ++i) {
auto rec = iImpl->findImpl(recs[i]);
if (rec) {
rec->prefetchAsync(task, proxies[i], iImpl, token, ESParentContext{&callingContext_});
rec->prefetchAsync(task, resolvers[i], iImpl, token, ESParentContext{&callingContext_});
}
}
}
Expand All @@ -264,7 +264,7 @@ namespace edm {
return static_cast<bool>(postMayGetResolvers_);
}

std::array<void*, produce::size<TReturn>::value> proxyData_;
std::array<void*, produce::size<TReturn>::value> resolverData_;
std::optional<std::vector<ESResolverIndex>> postMayGetResolvers_;
propagate_const<T*> producer_;
ESModuleCallingContext callingContext_;
Expand Down
6 changes: 3 additions & 3 deletions FWCore/Framework/interface/CallbackExternalWork.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,13 @@ namespace edm {
try {
convertException::wrap([this, &holder, &serviceToken, &record, &eventSetupImpl] {
ESModuleCallingContext const& context = Base::callingContext();
auto proxies = Base::getTokenIndices();
auto resolvers = Base::getTokenIndices();
if (Base::postMayGetResolvers()) {
proxies = &((*Base::postMayGetResolvers()).front());
resolvers = &((*Base::postMayGetResolvers()).front());
}
TRecord rec;
edm::ESParentContext pc{&context};
rec.setImpl(record, Base::transitionID(), proxies, eventSetupImpl, &pc);
rec.setImpl(record, Base::transitionID(), resolvers, eventSetupImpl, &pc);
ServiceRegistry::Operate operate(serviceToken.lock());
record->activityRegistry()->preESModuleAcquireSignal_.emit(record->key(), context);
struct EndGuard {
Expand Down
4 changes: 2 additions & 2 deletions FWCore/Framework/interface/ESProducer.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
set at run-time instead of compile time can be obtained by inheriting from ESProductResolverFactoryProducer instead.)

If only one algorithm is being encapsulated then the user needs to
1) add a method name 'produce' to the class. The 'produce' takes as its argument a const reference
1) add a method named 'produce' to the class. The 'produce' takes as its argument a const reference
to the record that is to hold the data item being produced. If only one data item is being produced,
the 'produce' method must return either an 'std::unique_ptr' or 'std::shared_ptr' to the object being
produced. (The choice depends on if the EventSetup or the ESProducer is managing the lifetime of
the object). If multiple items are being Produced they the 'produce' method must return an
the object). If multiple items are being Produced then the 'produce' method must return an
ESProducts<> object which holds all of the items.
2) add 'setWhatProduced(this);' to their classes constructor

Expand Down
4 changes: 2 additions & 2 deletions FWCore/Framework/interface/ESProductResolver.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// -*- C++ -*-
#ifndef FWCore_Framework_ESProductResolver_h
#define FWCore_Framework_ESProductResolver_h
// -*- C++ -*-
//
// Package: Framework
// Class : ESProductResolver
//
/**\class edm::eventsetup::ESProductResolver

Description: Base class for data Proxies held by a EventSetupRecord
Description: Base class for product resolvers held by a EventSetupRecord

Usage:
This class defines the interface used to handle retrieving data from an
Expand Down
8 changes: 4 additions & 4 deletions FWCore/Framework/interface/ESProductResolverFactoryProducer.h
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
// -*- C++ -*-
#ifndef Framework_ESProductResolverFactoryProducer_h
#define Framework_ESProductResolverFactoryProducer_h
// -*- C++ -*-
//
// Package: Framework
// Class : ESProductResolverFactoryProducer
//
/**\class ESProductResolverFactoryProducer ESProductResolverFactoryProducer.h FWCore/Framework/interface/ESProductResolverFactoryProducer.h
/**\class edm::ESProductResolverFactoryProducer

Description: An EventSetup algorithmic Provider that manages Factories of Proxies
Description: An EventSetup algorithmic Provider that manages Factories of Resolvers

Usage:
This class is used when the algorithms in the EventSetup that are to be run on demand are encapsulated
in edm::eventsetup::ProductResolvers's. This 'design pattern' is more flexible than having the algorithm embedded
directly in the Provider (see ESProducer for such an implemenation).

Users inherit from this class and then call the 'registerFactory' method in their class' constructor
in order to get their Proxies registered. For most users, the already available templated Factory classes
in order to get their Resolvers registered. For most users, the already available templated Factory classes
should suffice and therefore they should not need to create their own Factories.

Example: register one Factory that creates a resolver that takes no arguments
Expand Down
6 changes: 3 additions & 3 deletions FWCore/Framework/interface/ESProductResolverProvider.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// -*- C++ -*-
#ifndef FWCore_Framework_ESProductResolverProvider_h
#define FWCore_Framework_ESProductResolverProvider_h
// -*- C++ -*-
//
// Package: Framework
// Class : ESProductResolverProvider
Expand All @@ -22,7 +22,7 @@
CondDBESSource is the main such class) then the registerResolvers
function must be overridden. For the same EventSetupRecordKey, the
vector returned should contain the same DataKeys in the same order for
all the different iovIndexes. DataProxies associated with the same
all the different iovIndexes. ESProductResolver's associated with the same
EventSetupRecordKey should have caches that use different memory, but
other than that they should also be the same.

Expand All @@ -33,7 +33,7 @@
All other functions are intended for use by the Framework or tests
and should not be called in classes derived from ESProductResolverProvider.
They are primarily used when initializing the EventSetup system
so the DataProxies are available for use when needed.
so the ESProductResolver's are available for use when needed.
*/
//
// Author: Chris Jones
Expand Down
6 changes: 3 additions & 3 deletions FWCore/Framework/interface/ESProductResolverTemplate.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// -*- C++ -*-
#ifndef FWCore_Framework_ESProductResolverTemplate_h
#define FWCore_Framework_ESProductResolverTemplate_h
// -*- C++ -*-
//
// Package: Framework
// Class : ESProductResolverTemplate
//
/**\class ESProductResolverTemplate ESProductResolverTemplate.h FWCore/Framework/interface/ESProductResolverTemplate.h
/**\class edm::eventsetup::ESProductResolverTemplate

Description: A ESProductResolver base class which allows one to write type-safe proxies
Description: A ESProductResolver base class which allows one to write type-safe resolvers

Note that ESProductResolver types that inherit from this are not allowed
to get data from the EventSetup (they cannot consume anything).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// -*- C++ -*-
#ifndef FWCore_Framework_ESSourceConcurrentESProductResolverTemplate_h
#define FWCore_Framework_ESSourceConcurrentESProductResolverTemplate_h
// -*- C++ -*-
//
// Package: FWCore/Framework
// Class : ESSourceConcurrentESProductResolverTemplate
//
/**\class ESSourceConcurrentESProductResolverTemplate ESSourceConcurrentESProductResolverTemplate.h "FWCore/Framework/interface/ESSourceConcurrentESProductResolverTemplate.h"
/**\class edm::eventsetup::ESSourceConcurrentESProductResolverTemplate

Description: An ESSource specific ESProductResolver which is type safe and can run concurrently with other DataProxies from the same ESSource.
Description: An ESSource specific ESProductResolver which is type safe and can run concurrently with other ESProductResolvers from the same ESSource.

Usage:
Inherit from this class and override
Expand Down
9 changes: 5 additions & 4 deletions FWCore/Framework/interface/ESSourceProductResolverBase.h
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
// -*- C++ -*-
#ifndef FWCore_Framework_ESSourceProductResolverBase_h
#define FWCore_Framework_ESSourceProductResolverBase_h
// -*- C++ -*-
//
// Package: FWCore/Framework
// Class : ESSourceProductResolverBase
//
/**\class ESSourceProductResolverBase ESSourceProductResolverBase.h "FWCore/Framework/interface/ESSourceProductResolverBase.h"
/**\class edm::eventsetup::ESSourceProductResolverBase

Description: Base class for DataProxies for ESSources that can be specialized based on concurrency needs
Description: Base class for ESProductResolvers for ESSources that can be specialized based on concurrency needs

Usage:
The ESSourceProductResolverBase provides the bases for DataProxies needed for ESSources. It allows customization of synchronization needs via the use of template parameters.
The ESSourceProductResolverBase provides the bases for ProductResolvers needed for ESSources.
It allows customization of synchronization needs via the use of template parameters.

NOTE: if inheriting classes override `void invalidateCache()` they must be sure to call this classes
implementation as part of the call.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// -*- C++ -*-
#ifndef FWCore_Framework_ESSourceProductResolverConcurrentBase_h
#define FWCore_Framework_ESSourceProductResolverConcurrentBase_h
// -*- C++ -*-
//
// Package: FWCore/Framework
// Class : ESSourceProductResolverConcurrentBase
//
/**\class ESSourceProductResolverConcurrentBase ESSourceProductResolverConcurrentBase.h "FWCore/Framework/interface/ESSourceProductResolverConcurrentBase.h"
/**\class edm::eventsetup::ESSourceProductResolverConcurrentBase

Description: Base class for DataProxies for ESSources that require no synchronization
Description: Base class for ESProductResolver for ESSources that require no synchronization

Usage:
The ESSourceProductResolverConcurrentBase allows DataProxies from the same ESSource to be called concurrently.
The ESSourceProductResolverConcurrentBase allows ESProductResolvers from the same ESSource to be called concurrently.

NOTE: if inheriting classes override `void invalidateCache()` they must be sure to call this classes
implementation as part of the call.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// -*- C++ -*-
#ifndef FWCore_Framework_ESSourceProductResolverNonConcurrentBase_h
#define FWCore_Framework_ESSourceProductResolverNonConcurrentBase_h
// -*- C++ -*-
//
// Package: FWCore/Framework
// Class : ESSourceProductResolverNonConcurrentBase
//
/**\class ESSourceProductResolverNonConcurrentBase ESSourceProductResolverNonConcurrentBase.h "FWCore/Framework/interface/ESSourceProductResolverNonConcurrentBase.h"
/**\class edm::eventsetup::ESSourceProductResolverNonConcurrentBase

Description: Base class for DataProxies for ESSources that require synchronization
Description: Base class for ESProductResolvers for ESSources that require synchronization

Usage:
The ESSourceProductResolverNonConcurrentBase uses a SerialTaskQueue to serialize all DataProxies for the ESSource and a
The ESSourceProductResolverNonConcurrentBase uses a SerialTaskQueue to serialize all ESProductResolvers for the ESSource and a
std::mutex to protect from concurrent calls to a ESProductResolver and the ESSource itself. Such concurrent calls
can happen if concurrent LuminosityBlocks are being used.

Expand Down
4 changes: 2 additions & 2 deletions FWCore/Framework/interface/EventSetupProvider.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// -*- C++ -*-
#ifndef FWCore_Framework_EventSetupProvider_h
#define FWCore_Framework_EventSetupProvider_h
// -*- C++ -*-
//
// Package: Framework
// Class: EventSetupProvider
Expand Down Expand Up @@ -83,7 +83,7 @@ namespace edm {

void finishConfiguration(NumberOfConcurrentIOVs const&, bool& hasNonconcurrentFinder);

///Used when we need to force a Record to reset all its proxies
///Used when we need to force a Record to reset all its resolvers
void resetRecordPlusDependentRecords(EventSetupRecordKey const&);

///Used when testing that all code properly updates on IOV changes of all Records
Expand Down
2 changes: 1 addition & 1 deletion FWCore/Framework/interface/EventSetupRecord.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
use to get data associated with a record.

This class holds a pointer to an EventSetupRecordImpl class, which
is the class used to get the DataProxies associated with a given Record.
is the class used to get the ESProductResolvers associated with a given Record.
It also has a pointer to the EventSetupImpl which is used to lookup
dependent records in DependentRecordImplementation.

Expand Down
22 changes: 11 additions & 11 deletions FWCore/Framework/interface/EventSetupRecordImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@
Description: Base class for all Records in an EventSetup. Holds data with the same lifetime.

Usage:
This class contains the Proxies that make up a given Record. It
This class contains the Resolvers that make up a given Record. It
is designed to be reused time after time, rather than it being
destroyed and a new one created every time a new Record is
required. Proxies can only be added by the EventSetupRecordProvider class which
required. Resolvers can only be added by the EventSetupRecordProvider class which
uses the 'add' function to do this.

When the set of Proxies for a Records changes, i.e. a
When the set of Resolvers for a Records changes, i.e. a
ESProductResolverProvider is added of removed from the system, then the
Proxies in a Record need to be changed as appropriate.
Resolvers in a Record need to be changed as appropriate.
In this design it was decided the easiest way to achieve this was
to erase all Proxies in a Record.
to erase all Resolvers in a Record.

It is important for the management of the Records that each Record
know the ValidityInterval that represents the time over which its data is valid.
Expand Down Expand Up @@ -120,7 +120,7 @@ namespace edm {

// The following member functions should only be used by EventSetupRecordProvider
bool add(DataKey const& iKey, ESProductResolver* iResolver);
void clearProxies();
void clearResolvers();

///Set the cache identifier and validity interval when starting a new IOV
///In addition, also notify the ESProductResolver's a new IOV is starting.
Expand All @@ -147,8 +147,8 @@ namespace edm {
ComponentDescription const*,
DataKey const&) const;

void invalidateProxies();
void resetIfTransientInProxies();
void invalidateResolvers();
void resetIfTransientInResolvers();

private:
void const* getFromResolverAfterPrefetch(ESResolverIndex iResolverIndex,
Expand All @@ -164,7 +164,7 @@ namespace edm {
std::shared_ptr<ESHandleExceptionFactory>& whyFailedFactory) const {
DataKey const* dataKey = nullptr;
assert(iResolverIndex.value() > -1 and
iResolverIndex.value() < static_cast<ESResolverIndex::Value_t>(keysForProxies_.size()));
iResolverIndex.value() < static_cast<ESResolverIndex::Value_t>(keysForResolvers_.size()));
void const* pValue = this->getFromResolverAfterPrefetch(iResolverIndex, iTransientAccessOnly, oDesc, dataKey);
iData = reinterpret_cast<DataT const*>(pValue);
}
Expand All @@ -181,8 +181,8 @@ namespace edm {
CMS_THREAD_SAFE mutable ValidityInterval validity_;

EventSetupRecordKey key_;
std::vector<DataKey> keysForProxies_;
std::vector<edm::propagate_const<ESProductResolver*>> proxies_;
std::vector<DataKey> keysForResolvers_;
std::vector<edm::propagate_const<ESProductResolver*>> resolvers_;
ActivityRegistry const* activityRegistry_;
unsigned long long cacheIdentifier_;
unsigned int iovIndex_;
Expand Down
Loading