CMS 3D CMS Logo

ProductBase.cc
Go to the documentation of this file.
3 
4 namespace cms::cuda {
5  bool ProductBase::isAvailable() const {
6  // if default-constructed, the product is not available
7  if (not event_) {
8  return false;
9  }
10  return eventWorkHasCompleted(event_.get());
11  }
12 
14  // Make sure that the production of the product in the GPU is
15  // complete before destructing the product. This is to make sure
16  // that the EDM stream does not move to the next event before all
17  // asynchronous processing of the current is complete.
18 
19  // TODO: a callback notifying a WaitingTaskHolder (or similar)
20  // would avoid blocking the CPU, but would also require more work.
21  //
22  // Intentionally not checking the return value to avoid throwing
23  // exceptions. If this call would fail, we should get failures
24  // elsewhere as well.
25  if (event_) {
26  cudaEventSynchronize(event_.get());
27  }
28  }
29 } // namespace cms::cuda
cms::cuda
Definition: Product.h:14
cms::cuda::eventWorkHasCompleted
bool eventWorkHasCompleted(cudaEvent_t event)
Definition: eventWorkHasCompleted.h:18
ProductBase.h
eventWorkHasCompleted.h
cms::cuda::ProductBase::isAvailable
bool isAvailable() const
Definition: ProductBase.cc:5
cms::cuda::ProductBase::~ProductBase
~ProductBase()
Definition: ProductBase.cc:13
cms::cuda::ProductBase::event_
SharedEventPtr event_
Definition: ProductBase.h:80