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

Fix data race in EventHeaderCreator #224

Merged
merged 4 commits into from
Sep 12, 2024
Merged

Conversation

m-fila
Copy link
Contributor

@m-fila m-fila commented Aug 20, 2024

BEGINRELEASENOTES

  • Fixed data race in EventHeaderCreator and make it ready for GaudiHive

ENDRELEASENOTES

A static local variable was not thread safe and resulting in a data race when used in parallel environment of GaudiHive (skipping or duplicating event numbers).

I considered two ways to fix it:

  • use EventContex to get the event number as seen by scheduler. Currently supplying the EventContex as input to k4FWCore::Transformer is not allowed so the algorithm will stay in non-functional form. If there is any filtering done by some algorithms earlier in the sequence then this will be not reflected in the event number as it's determined as the scheduler starts this event. If two events are loaded from input the ordering of event numbers given to them will be the same as ordering of loading.
  • use atomic member variable as counter. If there is any filtering done by some algorithms earlier in the sequence then this will be reflected in the event numbers as the event number is determined only when this algorithm is executed. If two events are loaded from input the ordering of event numbers given to them doesn't have to be the same as the order of loading - it will be the same as order of execution which might be different

In both cases the event numbers in the output will be not sorted.

The version with with EventContext is used currently but can be changed if needed

@jmcarcell jmcarcell enabled auto-merge (squash) September 12, 2024 13:45
@jmcarcell jmcarcell merged commit 11707c3 into key4hep:main Sep 12, 2024
3 of 7 checks passed
@m-fila m-fila deleted the event_header branch September 12, 2024 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants