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

Logging Tweaks, main branch (2025.02.27.) #898

Merged
merged 2 commits into from
Feb 27, 2025

Conversation

krasznaa
Copy link
Member

Since we're anyway having a heated debate about logging in #897 already, let me throw some oil on that fire with this PR.

I'm basically reviving some ideas from #837 in this one. So that the configuration of the applications would get printed in a (to me...) nice way, using the logging infrastructure. Going from the current:

[bash][Legolas]:traccc > ./out/build/cuda-native-fp32/bin/traccc_seq_example
15:00:28    TracccExampl   INFO      Running Full Tracking Chain on the Host
Detector Options:
├ Detector file:                   geometries/odd/odd-detray_geometry_detray.json
├ Material file:                   geometries/odd/odd-detray_material_detray.json
├ Surface grid file:               geometries/odd/odd-detray_surface_grids_detray.json
├ Use detray detector:             true
└ Digitization file:               geometries/odd/odd-digi-geometric-config.json
Input Data Options:
├ Use ACTS geometry source:        true
...

To:

[bash][Legolas]:traccc > ./out/build/cuda-native-fp32/bin/traccc_seq_example
14:56:50    TracccExampleSeqCpuOptions    INFO      Running Full Tracking Chain on the Host
14:56:50    TracccExampleSeqCpuOptions    INFO      
14:56:50    TracccExampleSeqCpuOptions    INFO      Detector Options:
14:56:50    TracccExampleSeqCpuOptions    INFO      ├ Detector file:                   geometries/odd/odd-detray_geometry_detray.json
14:56:50    TracccExampleSeqCpuOptions    INFO      ├ Material file:                   geometries/odd/odd-detray_material_detray.json
14:56:50    TracccExampleSeqCpuOptions    INFO      ├ Surface grid file:               geometries/odd/odd-detray_surface_grids_detray.json
14:56:50    TracccExampleSeqCpuOptions    INFO      ├ Use detray detector:             true
14:56:50    TracccExampleSeqCpuOptions    INFO      └ Digitization file:               geometries/odd/odd-digi-geometric-config.json
14:56:50    TracccExampleSeqCpuOptions    INFO      Input Data Options:
14:56:50    TracccExampleSeqCpuOptions    INFO      ├ Use ACTS geometry source:        true
...

The one new trick I have in this PR compared to #837 is the split_output_decorator class. That would allow us to pass multi-line strings to the logger, and have them appear in a (to me) pleasing fashion.

We will still need to update a number of places in the code to make everything end up in the loggers, but I think split_output_decorator will help us with a number of other places as well. (For instance with how Detray prints messages of its own.)

Most importantly it would be one that would split multi-line log
messages during the output construction. And it would use longer
source names in the printout by default.
@krasznaa krasznaa added improvement Improve an existing feature examples Changes to the examples labels Feb 27, 2025
@krasznaa krasznaa requested a review from stephenswat February 27, 2025 14:01
Copy link
Member

@stephenswat stephenswat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this design a lot. 👍

@krasznaa krasznaa force-pushed the LoggingTweaks-main-20250227 branch from b0e465f to 2d49cf0 Compare February 27, 2025 14:21
@krasznaa
Copy link
Member Author

Forgot to move the help printout to the logger previously. Now it looks like:

[bash][Legolas]:traccc > ./out/build/cuda-native-fp32/bin/traccc_seq_example -h
15:21:37    TracccExampleSeqCpuOptions    INFO      Full Tracking Chain on the Host:
15:21:37    TracccExampleSeqCpuOptions    INFO        -h [ --help ]                         Print this help message
15:21:37    TracccExampleSeqCpuOptions    INFO      
15:21:37    TracccExampleSeqCpuOptions    INFO      Detector Options:
15:21:37    TracccExampleSeqCpuOptions    INFO        --detector-file arg (=geometries/odd/odd-detray_geometry_detray.json)
15:21:37    TracccExampleSeqCpuOptions    INFO                                              Detector file
15:21:37    TracccExampleSeqCpuOptions    INFO        --material-file arg (=geometries/odd/odd-detray_material_detray.json)
15:21:37    TracccExampleSeqCpuOptions    INFO                                              Material file
15:21:37    TracccExampleSeqCpuOptions    INFO        --grid-file arg (=geometries/odd/odd-detray_surface_grids_detray.json)
15:21:37    TracccExampleSeqCpuOptions    INFO                                              Surface grid file
15:21:37    TracccExampleSeqCpuOptions    INFO        --use-detray-detector arg (=1)        Use detray::detector for the geometry 
15:21:37    TracccExampleSeqCpuOptions    INFO                                              handling
15:21:37    TracccExampleSeqCpuOptions    INFO        --digitization-file arg (=geometries/odd/odd-digi-geometric-config.json)
15:21:37    TracccExampleSeqCpuOptions    INFO                                              Digitization file
15:21:37    TracccExampleSeqCpuOptions    INFO      
15:21:37    TracccExampleSeqCpuOptions    INFO      Input Data Options:
15:21:37    TracccExampleSeqCpuOptions    INFO        --use-acts-geom-source arg (=1)       Use acts geometry source
15:21:37    TracccExampleSeqCpuOptions    INFO        --input-data-format arg (=csv)        Format of the input file(s)
15:21:37    TracccExampleSeqCpuOptions    INFO        --input-directory arg (=odd/geant4_10muon_10GeV/)
15:21:37    TracccExampleSeqCpuOptions    INFO                                              Directory holding the input files
15:21:37    TracccExampleSeqCpuOptions    INFO        --input-events arg (=1)               Number of input events to process
15:21:37    TracccExampleSeqCpuOptions    INFO        --input-skip arg (=0)                 Number of input events to skip
15:21:37    TracccExampleSeqCpuOptions    INFO      
15:21:37    TracccExampleSeqCpuOptions    INFO      Output Data Options:
15:21:37    TracccExampleSeqCpuOptions    INFO        --output-data-format arg (=csv)       Format of the output file(s)
15:21:37    TracccExampleSeqCpuOptions    INFO        --output-directory arg                Directory to store the output files
15:21:37    TracccExampleSeqCpuOptions    INFO      
15:21:37    TracccExampleSeqCpuOptions    INFO      Clusterization Options:
15:21:37    TracccExampleSeqCpuOptions    INFO        --threads-per-partition arg (=256)    The number of threads per partition
15:21:37    TracccExampleSeqCpuOptions    INFO        --max-cells-per-thread arg (=16)      The maximum number of cells per thread
15:21:37    TracccExampleSeqCpuOptions    INFO        --target-cells-per-thread arg (=8)    The target number of cells per thread
15:21:37    TracccExampleSeqCpuOptions    INFO        --backup-size-multiplier arg (=256)   The size multiplier of the backup 
15:21:37    TracccExampleSeqCpuOptions    INFO                                              scratch space
15:21:37    TracccExampleSeqCpuOptions    INFO      
15:21:37    TracccExampleSeqCpuOptions    INFO      Track Seeding Options:
15:21:37    TracccExampleSeqCpuOptions    INFO      
15:21:37    TracccExampleSeqCpuOptions    INFO      Track Finding Options:
15:21:37    TracccExampleSeqCpuOptions    INFO        --max-num-branches-per-seed arg (=10) Max number of branches per seed
15:21:37    TracccExampleSeqCpuOptions    INFO        --max-num-branches-per-surface arg (=10)
15:21:37    TracccExampleSeqCpuOptions    INFO                                              Max number of branches per surface
15:21:37    TracccExampleSeqCpuOptions    INFO        --track-candidates-range MIN:MAX (=3:100)
15:21:37    TracccExampleSeqCpuOptions    INFO                                              Range of track candidates number
15:21:37    TracccExampleSeqCpuOptions    INFO        --min-step-length-for-next-surface arg (=0.5)
15:21:37    TracccExampleSeqCpuOptions    INFO                                              Minimum step length that track should 
15:21:37    TracccExampleSeqCpuOptions    INFO                                              make to reach the next surface. This 
15:21:37    TracccExampleSeqCpuOptions    INFO                                              should be set higher than the overstep 
15:21:37    TracccExampleSeqCpuOptions    INFO                                              tolerance not to make it stay on the 
15:21:37    TracccExampleSeqCpuOptions    INFO                                              same surface
15:21:37    TracccExampleSeqCpuOptions    INFO        --max-step-counts-for-next-surface arg (=100)
15:21:37    TracccExampleSeqCpuOptions    INFO                                              Maximum step counts that track can make
15:21:37    TracccExampleSeqCpuOptions    INFO                                              to reach the next surface
15:21:37    TracccExampleSeqCpuOptions    INFO        --chi2-max arg (=10)                  Maximum Chi suqare that measurements 
15:21:37    TracccExampleSeqCpuOptions    INFO                                              can be included in the track
15:21:37    TracccExampleSeqCpuOptions    INFO        --nmax-per-seed arg (=10)             Maximum number of branches which each 
15:21:37    TracccExampleSeqCpuOptions    INFO                                              initial seed can have at a step.
15:21:37    TracccExampleSeqCpuOptions    INFO        --max-num-skipping-per-cand arg (=3)  Maximum allowed number of skipped steps
15:21:37    TracccExampleSeqCpuOptions    INFO                                              per candidate
15:21:37    TracccExampleSeqCpuOptions    INFO        --particle-hypothesis arg (=13)       PDG number for the particle hypothesis
15:21:37    TracccExampleSeqCpuOptions    INFO      
15:21:37    TracccExampleSeqCpuOptions    INFO      Track Propagation Options:
15:21:37    TracccExampleSeqCpuOptions    INFO        --constraint-step-size-mm arg (=3.40282347e+38)
15:21:37    TracccExampleSeqCpuOptions    INFO                                              The constrained step size [mm]
15:21:37    TracccExampleSeqCpuOptions    INFO        --overstep-tolerance-um arg (=-300)   The overstep tolerance [um]
15:21:37    TracccExampleSeqCpuOptions    INFO        --min-mask-tolerance-mm arg (=9.99999975e-06)
15:21:37    TracccExampleSeqCpuOptions    INFO                                              The minimum mask tolerance [mm]
15:21:37    TracccExampleSeqCpuOptions    INFO        --max-mask-tolerance-mm arg (=3)      The maximum mask tolerance [mm]
15:21:37    TracccExampleSeqCpuOptions    INFO        --search-window arg (=0:0)            Size of the grid surface search window
15:21:37    TracccExampleSeqCpuOptions    INFO        --rk-tolerance-mm [mm] arg (=9.99999975e-05)
15:21:37    TracccExampleSeqCpuOptions    INFO                                              The Runge-Kutta stepper tolerance
15:21:37    TracccExampleSeqCpuOptions    INFO      
15:21:37    TracccExampleSeqCpuOptions    INFO      Track Ambiguity Resolution Options:
15:21:37    TracccExampleSeqCpuOptions    INFO        --perform-ambiguity-resolution arg (=1)
15:21:37    TracccExampleSeqCpuOptions    INFO                                              Perform track ambiguity resolution
15:21:37    TracccExampleSeqCpuOptions    INFO      
15:21:37    TracccExampleSeqCpuOptions    INFO      Performance Measurement Options:
15:21:37    TracccExampleSeqCpuOptions    INFO        --check-performance                   Run performance checks
[bash][Legolas]:traccc >

Though it's a fair debate whether this is helping or not... 🤔

Stopped the helper classes from using std::cout directly,
re-directing their output into a multi-line string instead.
Which would then be given to a logger.
@krasznaa krasznaa force-pushed the LoggingTweaks-main-20250227 branch from 2d49cf0 to b118bb0 Compare February 27, 2025 14:30
@stephenswat stephenswat merged commit 5f93fe3 into acts-project:main Feb 27, 2025
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
examples Changes to the examples improvement Improve an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants