CMS 3D CMS Logo

TritonEDProducer.h
Go to the documentation of this file.
1 #ifndef HeterogeneousCore_SonicTriton_TritonEDProducer
2 #define HeterogeneousCore_SonicTriton_TritonEDProducer
3 
4 //TritonDummyCache include comes first for overload resolution
10 
11 //inherited classes that use a non-default GlobalCache should be sure to call the parent initializeGlobalCache()
12 template <typename G, typename... Capabilities>
13 class TritonEDProducerT : public SonicEDProducer<TritonClient, edm::GlobalCache<G>, Capabilities...> {
14 public:
16  : SonicEDProducer<TritonClient, edm::GlobalCache<G>, Capabilities...>(cfg) {}
17 
18  //use this function to avoid calling TritonService functions Nstreams times
19  static std::unique_ptr<G> initializeGlobalCache(edm::ParameterSet const& pset) {
21  const auto& clientPset = pset.getParameterSet("Client");
22  ts->addModel(clientPset.getParameter<std::string>("modelName"),
23  clientPset.getParameter<edm::FileInPath>("modelConfigPath").fullPath());
24  return nullptr;
25  }
26 
27  static void globalEndJob(G*) {}
28 
29  //destroy client before destructor called to unregister any shared memory before TritonService shuts down fallback server
30  virtual void tritonEndStream() {}
31  void endStream() final {
33  this->client_.reset();
34  }
35 };
36 
37 template <typename... Capabilities>
39 
40 #endif
virtual void tritonEndStream()
std::string fullPath() const
Definition: FileInPath.cc:161
static std::unique_ptr< G > initializeGlobalCache(edm::ParameterSet const &pset)
void addModel(const std::string &modelName, const std::string &path)
void endStream() final
TritonEDProducerT(edm::ParameterSet const &cfg)
HLT enums.
static void globalEndJob(G *)