Skip to content

Stream the MC kinematics in the ITS and MFT MC track QC tasks - #2698

Open
sawenzel wants to merge 2 commits into
AliceO2Group:masterfrom
sawenzel:mc-tracks-qc-memory
Open

sawenzel wants to merge 2 commits into
AliceO2Group:masterfrom
sawenzel:mc-tracks-qc-memory

Conversation

@sawenzel

@sawenzel sawenzel commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

This PR reduces the memory of ITSTrackSimTask and QcMFTTrackMCTask by reading the MC kinematics one event at a time.

Both tasks loaded all MC tracks of all events of the timeframe and kept a per-track record for each of them, and nothing was released before the end of the run. For PbPb with Geant4 (about 2.7 million MC tracks per signal event), heaptrack at 4 orbits shows 3.8 GB of cached MC tracks, plus 1.8 GB (ITS) or 1.4 GB (MFT) of per-track records. Events are now read and released one by one, and records are kept only for the tracks that are used. In addition, the cluster-label container of ITSTrackSimTask was released without being deleted and is no longer leaked, and labels with an event ID outside the event range are skipped.

The effect on one timeframe of 8 orbits (nightly MC LHC22k4_nightly, run 311511, 28 signal events, 75.6M MC tracks):

before after
ITS task total (PSS) 8.6 GB 2.55 GB
MFT task total (PSS) 7.9 GB 2.27 GB
ITS o2-qc device 7.7 GB 1.60 GB
MFT o2-qc device 7.1 GB 1.38 GB

These two tasks, with the ITS-TPC matching QC (companion AliceO2 PR), dominate the QC pass of the MC jobs, which peaks at a median of 27 GB.

Note that the histograms are unchanged: the 45 histograms of the ITS task and the 9 of the MFT task have identical bin contents, errors and entries before and after.

The measurements use the recompiled files preloaded into o2-qc of the CVMFS daily v20261007-1. The branch is not yet built with the QC CI.

Assisted by Claude Code.

sawenzel and others added 2 commits October 8, 2026 10:28
This reduces the memory of ITSTrackSimTask and QcMFTTrackMCTask from the size of all kinematics of the TF to that of the largest event.

- The tasks cached all MC tracks of all events and kept a per-track record for each of them.
- Events are now read and released one by one, and records are kept only for the tracks that are used.
- The cluster-label container of ITSTrackSimTask is no longer leaked.
- The histograms are unchanged (45 ITS and 9 MFT histograms compared bin by bin, same entries).

Peak memory (sum of PSS) on one PbPb timeframe of 8 orbits (28 signal events, 75.6M MC tracks):

| | before | after |
|---|---:|---:|
| ITS task total | 8.44 GB | 2.40 GB |
| MFT task total | 7.80 GB | 2.16 GB |
| ITS `o2-qc` device | 7.66 GB | 1.57 GB |
| MFT `o2-qc` device | 7.04 GB | 1.40 GB |
| wall time ITS / MFT | 33 s / 40 s | 36 s / 40 s |

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This skips MC labels whose event ID is outside the event range of the kinematics in ITSTrackSimTask and QcMFTTrackMCTask.

- Such labels would index the per-event arrays out of range.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant