cms-patatrack / pixeltrack-standalone

Standalone Patatrack pixel tracking
Apache License 2.0
17 stars 35 forks source link

Implement event batching in the miniframework #364

Open asubah opened 2 years ago

asubah commented 2 years ago

This PR picks up from where @fwyzard left in #143. It contains 3 main commits:

Add a doneWaiting overload without the exception argument:

This commit is not related to the implementation of event batching. It just allows us to call doneWaiting() without passing an exception pointer instead of passing an empty pointer.

Add event batching support for fwtest:

The event batching feature is enabled by passing the --batchEvents <batch-size> option.

From original PR

  • the Source is responsible for reading (up to) N events at a time;
  • the Events are stored in an EventBatch and passed to each Worker as an EventRange (for produce()) or ConstEventRange (for acquire); the (Const)EventRange class allows (const) iteration and a (const) range-loop over the events, without any possibility of adding/dropping events;
  • the Worker passes the events to the various EDProducer-like base classes in the same way;
  • the existing EDProducer and EDProducerExternalWork base classes loop over the events in the range, and call acquire and produce one event at a time; modules that derive from them can be used without any changes;
  • introduce two new EDBatchingProducer and EDBatchingProducerExternalWork base classes that pass the range of Events to the module's acquire and produce methods; the module's implementation can then loop over the events, process them in parallel, etc.

The framework tests have been reorganised and extended to test all four EDProdcer-like base classes:

  • EDProducer;
  • EDProducerExternalWork;
  • EDBatchingProducer;
  • EDBatchingProducerExternalWork.

Note: The commit deletes the files src/fwtest/plugin-Test2/TestProducer2.cc and src/fwtest/plugin-Test2/TestProducer3.cc and replaces them with batching test.

Copy event batching support from fwtest to cuda:

This commit copies the same event baching implementation to cuda. The cuda modules are not changed at the moment, they still process each event individually even if batching is used. The modules will be updated in the future to take advantage of batching.