Repository navigation
Conversation
This removes the shared scratch state from the Chebyshev field evaluation, so that one field can be evaluated from several threads. - Chebyshev3D keeps the mapped coordinates in a local array instead of a member. - Chebyshev3DCalc evaluates into scratch on the stack, or into a thread-local buffer for parameterisations larger than 64 rows or columns. The ALICE maps use at most 14. - MagneticWrapperChebyshev no longer uses static coordinates in the TPC integrals. - The arithmetic is unchanged, so the field values are bit-identical. - A unit test evaluates the field from 8 threads and compares with a sequential pass. This prepares the simulation for multithreaded Geant4, where all workers share one field. https://its.cern.ch/jira/browse/O2-7305 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This makes the evaluation of the magnetic field safe to call from several threads on one shared
MagneticFieldobject, which is what multithreaded Geant4 workers will do.So far,
Chebyshev3DandChebyshev3DCalcevaluated through scratch arrays held as class members, and the TPC integrals inMagneticWrapperChebyshevused static coordinates. Concurrent calls therefore overwrote each other's intermediate results and returned wrong field values. The scratch now lives on the stack. It is sized for 64 rows and columns, while the ALICE field maps use at most 14. Larger parameterisations fall back to a thread-local buffer.Note that the arithmetic, including the narrowing of the mapped coordinates to
float, is unchanged, so the field values are bit-identical. A seededo2-simrun (10 Pythia8 pp events, all detectors, Geant4,-j 8) gives identical kinematics and hits compared withdev. In a standalone benchmark of the evaluation the difference is within 2 %.A new unit test evaluates the field,
getBzand the two TPC integrals from 8 threads and compares them with a sequential pass. Ondevthis test fails, on this branch it passes.Relates to https://its.cern.ch/jira/browse/O2-7305
Assisted by Claude Code.