acts icon indicating copy to clipboard operation
acts copied to clipboard

refactor: Do not allocate memory if the surface is connected with a detector elโ€ฆ

Open junggjo9 opened this issue 1 year ago โ€ข 9 comments

If the surface has an associated detector element its internal transform is never accessed consuming memory for no-reason. If the transform is a unique_ptr which is released in such cases, the footprint should be reduced

junggjo9 avatar Apr 01 '24 09:04 junggjo9

Codecov Report

Attention: Patch coverage is 23.52941% with 13 lines in your changes missing coverage. Please review.

Project coverage is 47.64%. Comparing base (5885ee8) to head (3939692).

Files Patch % Lines
Core/src/Surfaces/Surface.cpp 30.76% 2 Missing and 7 partials :warning:
Core/src/Surfaces/PlaneSurface.cpp 0.00% 0 Missing and 2 partials :warning:
Core/src/Geometry/CylinderLayer.cpp 0.00% 0 Missing and 1 partial :warning:
Core/src/Geometry/DiscLayer.cpp 0.00% 0 Missing and 1 partial :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3069      +/-   ##
==========================================
- Coverage   47.65%   47.64%   -0.01%     
==========================================
  Files         507      507              
  Lines       29205    29211       +6     
  Branches    14010    14012       +2     
==========================================
+ Hits        13917    13919       +2     
- Misses       5264     5265       +1     
- Partials    10024    10027       +3     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Apr 01 '24 09:04 codecov[bot]

This is what we used to have before. I think @asalzburger at some point measured that having the transform locally improved performance. But I forget the details.

paulgessinger avatar Apr 01 '24 13:04 paulgessinger

Hmm, the transform is never used if the detector element is present.... Confused, I am

junggjo9 avatar Apr 01 '24 16:04 junggjo9

The transform is only used for surfaces which don't have a detector element. Otherwise the transform is retrieved from the detector element, and that's where for example the alignment is handled.

paulgessinger avatar Apr 01 '24 16:04 paulgessinger

Yep, that what I'm saying too ;)

junggjo9 avatar Apr 02 '24 09:04 junggjo9

So for all other surfaces, boundaries etc, the transform is accessed locally.

paulgessinger avatar Apr 03 '24 14:04 paulgessinger

This is what we used to have before. I think @asalzburger at some point measured that having the transform locally improved performance. But I forget the details.

Hi, yes I remember that there was a visible (but small performance change), however, we can just see with this PR if this is still a measurable effect?

asalzburger avatar Apr 09 '24 12:04 asalzburger

I could imagine that this is an additional cache miss because of the additional indirection. After measuring this we would have to weight the CPU increase against the MEM decrease

andiwand avatar Apr 09 '24 13:04 andiwand

Results from the propagation test on 3 threads

patched:

10:03:28    Sequencer      INFO      Processed 100000 events in 1223.381458 s (wall clock)
10:03:28    Sequencer      INFO      Average time per event: 48.693846 ms/event

main:

22:24:31    Sequencer      INFO      Processed 100000 events in 1237.661429 s (wall clock)
22:24:31    Sequencer      INFO      Average time per event: 49.130005 ms/event

junggjo9 avatar Apr 24 '24 20:04 junggjo9

@junggjo9 @paulgessinger @asalzburger @andiwand In the tests, it makes a difference of around 1% (not sure if this is significant). How should we proceed with this?

AJPfleger avatar May 03 '24 07:05 AJPfleger

no significant change in performance - good from my side

image

image

andiwand avatar May 15 '24 06:05 andiwand

There are a couple of CI failure

  • Can you check the formatting @junggjo9 ?
  • I guess the CI Bridge ones are false positives
  • codecov complains - I guess because there are a couple more branches which are not directly tested right now? Should we add some unit tests to capture the new behavior?

andiwand avatar Jun 03 '24 14:06 andiwand

:white_check_mark: Athena integration test results [bd98f568e0ad2fa570dc8fdb5572ae1b78dcc7e4]

:white_check_mark: All tests successful

status job report
:green_circle: report_pull_request
:green_circle: run_art_test: test_data18_13TeV_1000evt
:green_circle: run_art_test: test_ttbarPU40_reco
:green_circle: test_ActsDumpGeometryIdentifiers
:green_circle: test_ActsCheckObjectCountsWorkflow
:green_circle: test_ActsEFTrackFit
:green_circle: test_ActsPersistifySeeds
:green_circle: test_ActsBenchmarkWithSpot
:green_circle: test_ActsAnalogueClustering
:green_circle: test_ActsWorkflowHeavyIons
:green_circle: test_ActsWorkflowFastTracking
:green_circle: test_ActsWorkflowCached
:green_circle: test_ActsWorkflow
:green_circle: test_ActsValidateAmbiguityResolution
:green_circle: test_ActsValidateResolvedTracks
:green_circle: test_ActsValidateTracks
:green_circle: test_ActsValidateActsCoreSpacePoints
:green_circle: test_ActsValidateActsSpacePoints
:green_circle: test_ActsValidateSeeds
:green_circle: test_ActsValidateOrthogonalSeeds
:green_circle: test_ActsValidateClusters
:green_circle: test_ActsPersistifyEDM
:green_circle: test_ActsGSFRefitting
:green_circle: test_ActsKfRefitting
:green_circle: test_ActsExtrapolationAlgTest
:green_circle: test_ActsITkTest
:green_circle: run_workflow_tests_run4_mc
:green_circle: run_workflow_tests_run2_mc
:green_circle: run_workflow_tests_run2_data
:green_circle: run_workflow_tests_run3_mc
:green_circle: run_workflow_tests_run3_data
:green_circle: run_unit_tests

acts-project-service avatar Jul 03 '24 21:07 acts-project-service