Skip to content

[Python][ML] Raise if ImplicitMT is enabled for the RDataLoader - #23788

Merged
siliataider merged 1 commit into
root-project:masterfrom
siliataider:rdataloader-no-imt
Oct 23, 2026
Merged

siliataider merged 1 commit into
root-project:masterfrom
siliataider:rdataloader-no-imt

Conversation

@siliataider

@siliataider siliataider commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

This Pull request:

Changes or fixes:

The RDataLoader does not work when ROOT's ImplicitMT is enabled, in both eager and lazy loading modes. A runtime error is now raised to tell the user.

Caution

This is not possible:

ROOT.EnableImplicitMT(2)

df = RDataFrame(...)
dl = RDataLoader(...)
dl.save(...)
Traceback (most recent call last):
  File "example.py", line 6, in <module>
    dl.save(...)
  ...
RuntimeError: The RDataLoader does not support ImplicitMT, call ROOT.DisableImplicitMT().

Users can still enable ImplicitMT for other parts of their script and disable it for the ML part, as long as:

  • It is not enabled when the RDataFrames given to the RDataLoader are created, even if it is disabled just before creating the RDataLoader itself. An RDataFrame requires the same number of slots when starting its event loop as when it was constructed.

Caution

ROOT.EnableImplicitMT(2)
df = RDataFrame(...)

ROOT.DisableImplicitMT()
dl = RDataLoader(...)
dl.save(...)  # RuntimeError
  • It is not enabled between the creation of the RDataLoader and the use of its other functionality.

Caution

df = RDataFrame(...)
dl = RDataLoader(...)

ROOT.EnableImplicitMT(2)
dl.save(...)  # RuntimeError

Tip

This scenario is possible:

ROOT.EnableImplicitMT(2)
rdf = RDataFrame(...).Snapshot("t", "f.root")

ROOT.DisableImplicitMT()
df = RDataFrame("t", "f.root")
dl = RDataLoader(df, ...)
dl.save(...)

Checklist:

  • tested changes locally

@siliataider siliataider self-assigned this Oct 21, 2026
@siliataider siliataider added in:Python Interface in:ML Everything under ROOT/ML labels Oct 21, 2026
@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Test Results

    24 files      24 suites   4d 0h 12m 22s ⏱️
 3 895 tests  3 892 ✅ 0 💤 3 ❌
83 393 runs  83 390 ✅ 0 💤 3 ❌

For more details on these failures, see this check.

Results for commit 4e59624.

♻️ This comment has been updated with latest results.

@vepadulano vepadulano left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks, this was needed! Let's make sure the CI is not impacted, and see a minor suggestion.

Comment thread bindings/pyroot/pythonizations/python/ROOT/_pythonization/_ml_dataloader.py Outdated
@siliataider
siliataider force-pushed the rdataloader-no-imt branch 2 times, most recently from 2f3b886 to 9416478 Compare October 22, 2026 10:04
@siliataider
siliataider merged commit 73d351f into root-project:master Oct 23, 2026
58 of 63 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in:ML Everything under ROOT/ML in:Python Interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants