CMS 3D CMS Logo

EDMetadataSentry.cc
Go to the documentation of this file.
5 
7  namespace detail {
9  auto const& device = detail::chooseDevice(streamID);
10 #ifdef ALPAKA_ACC_CPU_B_SEQ_T_SEQ_ENABLED
11  metadata_ = std::make_shared<EDMetadata>(cms::alpakatools::getQueueCache<Queue>().get(device));
12 #else
13  metadata_ = std::make_shared<EDMetadata>(cms::alpakatools::getQueueCache<Queue>().get(device),
14  cms::alpakatools::getEventCache<Event>().get(device));
15 #endif
16  }
17 
18  void EDMetadataSentry::finish(bool launchedAsyncWork) {
19  if (launchedAsyncWork) {
20  metadata_->recordEvent();
21  } else {
22  // If we are certain no asynchronous work was launched (i.e.
23  // the Queue was not used in any way), there is no need to
24  // synchronize, and the Event can be discarded.
25  metadata_->discardEvent();
26  }
27  }
28  } // namespace detail
29 } // namespace ALPAKA_ACCELERATOR_NAMESPACE
Device const & chooseDevice(edm::StreamID id)
Definition: chooseDevice.cc:9