Skip to content

[PWGLF] lambdaTwoPartPolarization: fill the sparse histograms as CompactTHnSparse - #18934

Open
ktf wants to merge 1 commit into
AliceO2Group:masterfrom
ktf:pr18934
Open

ktf wants to merge 1 commit into
AliceO2Group:masterfrom
ktf:pr18934

Conversation

@ktf

@ktf ktf commented Nov 26, 2026

Copy link
Copy Markdown
Member

Use HistType::kCompactTHnSparseF for the ten THnSparseF of the task. The
histograms are filled the same way and are written out as THnSparseF, so
the output is unchanged; only the in-memory storage differs (about 10 B per
filled bin instead of about 70 B, and no 2-3x peak while the bin map grows).

Measured on the first 21 time frames of train 813131 (LHC23zzh_pass5_small),
two wagons of the task: peak RSS of the two devices 867 / 767 MB instead of
3025 / 2265 MB, same run time, AnalysisResults.root identical bin by bin
(71 objects).

Needs kCompactTHnSparseF in O2 (DPL Analysis: add CompactTHnSparse).

…actTHnSparse

Use HistType::kCompactTHnSparseF for the ten THnSparseF of the task. The
histograms are filled the same way and are written out as THnSparseF, so
the output is unchanged; only the in-memory storage differs (about 10 B per
filled bin instead of about 70 B, and no 2-3x peak while the bin map grows).

Measured on the first 21 time frames of train 813131 (LHC23zzh_pass5_small),
two wagons of the task: peak RSS of the two devices 867 / 767 MB instead of
3025 / 2265 MB, same run time, AnalysisResults.root identical bin by bin
(71 objects).

Needs kCompactTHnSparseF in O2 (DPL Analysis: add CompactTHnSparse).
@github-actions

Copy link
Copy Markdown

O2 linter results: ❌ 0 errors, ⚠️ 20 warnings, 🔕 0 disabled

@alibuild

Copy link
Copy Markdown
Collaborator

Error while checking build/O2Physics/staging for 406f718 at 2026-11-26 12:06:

## sw/BUILD/O2Physics-latest/log
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:175:45: error: 'kCompactTHnSparseF' is not a member of 'o2::framework::HistType'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:175:15: error: no matching function for call to 'o2::framework::HistogramRegistry::add(const char [11], const char [1], <brace-enclosed initializer list>)'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:176:49: error: 'kCompactTHnSparseF' is not a member of 'o2::framework::HistType'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:176:15: error: no matching function for call to 'o2::framework::HistogramRegistry::add(const char [15], const char [1], <brace-enclosed initializer list>)'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:177:49: error: 'kCompactTHnSparseF' is not a member of 'o2::framework::HistType'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:177:15: error: no matching function for call to 'o2::framework::HistogramRegistry::add(const char [15], const char [1], <brace-enclosed initializer list>)'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:179:53: error: 'kCompactTHnSparseF' is not a member of 'o2::framework::HistType'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:179:15: error: no matching function for call to 'o2::framework::HistogramRegistry::add(const char [19], const char [1], <brace-enclosed initializer list>)'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:180:54: error: 'kCompactTHnSparseF' is not a member of 'o2::framework::HistType'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:180:15: error: no matching function for call to 'o2::framework::HistogramRegistry::add(const char [20], const char [1], <brace-enclosed initializer list>)'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:182:57: error: 'kCompactTHnSparseF' is not a member of 'o2::framework::HistType'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:182:15: error: no matching function for call to 'o2::framework::HistogramRegistry::add(const char [23], const char [1], <brace-enclosed initializer list>)'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:183:57: error: 'kCompactTHnSparseF' is not a member of 'o2::framework::HistType'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:183:15: error: no matching function for call to 'o2::framework::HistogramRegistry::add(const char [23], const char [1], <brace-enclosed initializer list>)'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:184:58: error: 'kCompactTHnSparseF' is not a member of 'o2::framework::HistType'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:184:15: error: no matching function for call to 'o2::framework::HistogramRegistry::add(const char [24], const char [1], <brace-enclosed initializer list>)'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:185:58: error: 'kCompactTHnSparseF' is not a member of 'o2::framework::HistType'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:185:15: error: no matching function for call to 'o2::framework::HistogramRegistry::add(const char [24], const char [1], <brace-enclosed initializer list>)'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:188:44: error: 'kCompactTHnSparseF' is not a member of 'o2::framework::HistType'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:188:15: error: no matching function for call to 'o2::framework::HistogramRegistry::add(const char [10], const char [1], <brace-enclosed initializer list>)'
ninja: build stopped: subcommand failed.

Full log here.

@alibuild

Copy link
Copy Markdown
Collaborator

Error while checking build/O2Physics/code-check for 406f718 at 2026-11-26 12:07:

## sw/BUILD/O2Physics-latest/log
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:175:45: error: 'kCompactTHnSparseF' is not a member of 'o2::framework::HistType'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:175:15: error: no matching function for call to 'o2::framework::HistogramRegistry::add(const char [11], const char [1], <brace-enclosed initializer list>)'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:176:49: error: 'kCompactTHnSparseF' is not a member of 'o2::framework::HistType'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:176:15: error: no matching function for call to 'o2::framework::HistogramRegistry::add(const char [15], const char [1], <brace-enclosed initializer list>)'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:177:49: error: 'kCompactTHnSparseF' is not a member of 'o2::framework::HistType'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:177:15: error: no matching function for call to 'o2::framework::HistogramRegistry::add(const char [15], const char [1], <brace-enclosed initializer list>)'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:179:53: error: 'kCompactTHnSparseF' is not a member of 'o2::framework::HistType'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:179:15: error: no matching function for call to 'o2::framework::HistogramRegistry::add(const char [19], const char [1], <brace-enclosed initializer list>)'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:180:54: error: 'kCompactTHnSparseF' is not a member of 'o2::framework::HistType'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:180:15: error: no matching function for call to 'o2::framework::HistogramRegistry::add(const char [20], const char [1], <brace-enclosed initializer list>)'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:182:57: error: 'kCompactTHnSparseF' is not a member of 'o2::framework::HistType'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:182:15: error: no matching function for call to 'o2::framework::HistogramRegistry::add(const char [23], const char [1], <brace-enclosed initializer list>)'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:183:57: error: 'kCompactTHnSparseF' is not a member of 'o2::framework::HistType'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:183:15: error: no matching function for call to 'o2::framework::HistogramRegistry::add(const char [23], const char [1], <brace-enclosed initializer list>)'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:184:58: error: 'kCompactTHnSparseF' is not a member of 'o2::framework::HistType'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:184:15: error: no matching function for call to 'o2::framework::HistogramRegistry::add(const char [24], const char [1], <brace-enclosed initializer list>)'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:185:58: error: 'kCompactTHnSparseF' is not a member of 'o2::framework::HistType'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:185:15: error: no matching function for call to 'o2::framework::HistogramRegistry::add(const char [24], const char [1], <brace-enclosed initializer list>)'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:188:44: error: 'kCompactTHnSparseF' is not a member of 'o2::framework::HistType'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:188:15: error: no matching function for call to 'o2::framework::HistogramRegistry::add(const char [10], const char [1], <brace-enclosed initializer list>)'
ninja: build stopped: subcommand failed.

Full log here.

@ktf

ktf commented Nov 26, 2026

Copy link
Copy Markdown
Member Author

This uses a new kind of compact histogram, introduced in AliceO2Group/AliceO2#16198, which is bin-to-bin and I/O compatible with THnSparse while occupying significantly less memory and space on disk. Would you mind having a look and let me know what you think of it?

@romainschotter

Copy link
Copy Markdown
Collaborator

Hi @ktf ! The PR looks good.
Just for my curiosity, have you already tested the compact THnSparse? How much do we gain in terms of memory and disk space compared to a regular THnSparse?
Thank you very much!

@ktf

ktf commented Nov 26, 2026

Copy link
Copy Markdown
Member Author

@romainschotter see the commit message above. It's quite drastic, if confirmed. ~800 MB in place of 2/3 GB.

@romainschotter

Copy link
Copy Markdown
Collaborator

Hi @ktf !
My mistake, I missed the numbers in the above commit message.
That's indeed a significant improvement.
In that case, I will approve the PR.
Thank you very much!

@romainschotter
romainschotter enabled auto-merge (squash) November 26, 2026 11:18
@ktf

ktf commented Nov 26, 2026

Copy link
Copy Markdown
Member Author

How do you want to validate it? We just merge, run once, and revert if there is any issue?

@ktf

ktf commented Nov 26, 2026

Copy link
Copy Markdown
Member Author

Of course the PR will become green only tomorrow once O2 daily has the feature in.

@alibuild

Copy link
Copy Markdown
Collaborator

Error while checking build/O2Physics/o2 for 406f718 at 2026-11-26 12:25:

## sw/BUILD/O2Physics-latest/log
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:175:45: error: 'kCompactTHnSparseF' is not a member of 'o2::framework::HistType'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:175:15: error: no matching function for call to 'o2::framework::HistogramRegistry::add(const char [11], const char [1], <brace-enclosed initializer list>)'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:176:49: error: 'kCompactTHnSparseF' is not a member of 'o2::framework::HistType'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:176:15: error: no matching function for call to 'o2::framework::HistogramRegistry::add(const char [15], const char [1], <brace-enclosed initializer list>)'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:177:49: error: 'kCompactTHnSparseF' is not a member of 'o2::framework::HistType'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:177:15: error: no matching function for call to 'o2::framework::HistogramRegistry::add(const char [15], const char [1], <brace-enclosed initializer list>)'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:179:53: error: 'kCompactTHnSparseF' is not a member of 'o2::framework::HistType'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:179:15: error: no matching function for call to 'o2::framework::HistogramRegistry::add(const char [19], const char [1], <brace-enclosed initializer list>)'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:180:54: error: 'kCompactTHnSparseF' is not a member of 'o2::framework::HistType'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:180:15: error: no matching function for call to 'o2::framework::HistogramRegistry::add(const char [20], const char [1], <brace-enclosed initializer list>)'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:182:57: error: 'kCompactTHnSparseF' is not a member of 'o2::framework::HistType'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:182:15: error: no matching function for call to 'o2::framework::HistogramRegistry::add(const char [23], const char [1], <brace-enclosed initializer list>)'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:183:57: error: 'kCompactTHnSparseF' is not a member of 'o2::framework::HistType'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:183:15: error: no matching function for call to 'o2::framework::HistogramRegistry::add(const char [23], const char [1], <brace-enclosed initializer list>)'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:184:58: error: 'kCompactTHnSparseF' is not a member of 'o2::framework::HistType'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:184:15: error: no matching function for call to 'o2::framework::HistogramRegistry::add(const char [24], const char [1], <brace-enclosed initializer list>)'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:185:58: error: 'kCompactTHnSparseF' is not a member of 'o2::framework::HistType'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:185:15: error: no matching function for call to 'o2::framework::HistogramRegistry::add(const char [24], const char [1], <brace-enclosed initializer list>)'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:188:44: error: 'kCompactTHnSparseF' is not a member of 'o2::framework::HistType'
/sw/SOURCES/O2Physics/slc9_x86-64-slc9_x86-64/0/PWGLF/Tasks/Strangeness/lambdaTwoPartPolarization.cxx:188:15: error: no matching function for call to 'o2::framework::HistogramRegistry::add(const char [10], const char [1], <brace-enclosed initializer list>)'
ninja: build stopped: subcommand failed.

Full log here.

@romainschotter

Copy link
Copy Markdown
Collaborator

Yes, I think we could ask the main analyser to run the task on the same dataset, both with and without this PR, and compare: i) the outputs, to ensure that they remain unchanged, and i) the performance, to verify that there is indeed an improvement.
I would suggest performing the first check locally to ensure that exactly the same AO2D files are used in both cases, allowing for a proper 1-to-1 comparison and avoiding potential grid fluctuations.
@jikim1290, could you please take care of these checks?
Thank you very much!

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

Labels

Development

Successfully merging this pull request may close these issues.

3 participants