Skip to content

[DF] Improve Snapshot branch-address-resetting logic #8375

Merged
eguiraud merged 7 commits intoroot-project:masterfrom
eguiraud:df_fix_snapshot
Jun 10, 2021
Merged

[DF] Improve Snapshot branch-address-resetting logic #8375
eguiraud merged 7 commits intoroot-project:masterfrom
eguiraud:df_fix_snapshot

Conversation

@eguiraud
Copy link
Copy Markdown
Contributor

@eguiraud eguiraud commented Jun 8, 2021

Instead of TTree::AddClone + TTree::CopyAddresses, use the data-block
callback mechanism to reset addresses when needed.
We cannot trust TTree::CopyAddresses to do the right thing because
the output branch might be a different kind of branch than the input
branch (e.g. TBranch vs TBranchElement), which leads to the problem
described at #8295 .

This fixes #8295 for what regards Snapshot.

This PR also adds support for "data-block" callbacks, wired to TChain's TNotify mechanism, to be able to react to changes of the underlying TTree (e.g. by resetting the input address of Snapshot's output branches). This is a pre-requisite for the fix, but it also makes it relatively simple to implement DefinePerSample as requested in #6745 .

As a side-effect, since we now don't rely on TTree::CopyAddresses in Snapshot anymore, this PR should also fix #7727 .

@eguiraud eguiraud requested review from Axel-Naumann and pcanal June 8, 2021 16:10
@eguiraud eguiraud self-assigned this Jun 8, 2021
@eguiraud eguiraud requested a review from oshadura as a code owner June 8, 2021 16:10
@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, mac1014/python3, mac11.0/cxx17, windows10/cxx14
How to customize builds

@phsft-bot
Copy link
Copy Markdown

Build failed on ROOT-ubuntu16/nortcxxmod.
Running on sft-ubuntu-1604-3.cern.ch:/build/workspace/root-pullrequests-build
See console output.

Errors:

  • [2021-06-08T16:16:06.213Z] FAILED: /usr/bin/ccache /usr/bin/c++ -DVECCORE_ENABLE_VC -I/mnt/build/workspace/root-pullrequests-build/root/tree/dataframe/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/unix/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/clingutils/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/textinput/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/thread/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/zip/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/rint/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/clib/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/meta/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/gui/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/cont/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/foundation/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/base/inc -Iginclude -I/mnt/build/workspace/root-pullrequests-build/root/tree/tree/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/imt/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/multiproc/inc -I/mnt/build/workspace/root-pullrequests-build/root/math/mathcore/inc -I/mnt/build/workspace/root-pullrequests-build/root/math/mathcore/v7/inc -Iexternals/mnt/build/workspace/root-pullrequests-build/install/include -I/mnt/build/workspace/root-pullrequests-build/root/tree/treeplayer/inc -I/mnt/build/workspace/root-pullrequests-build/root/hist/hist/inc -I/mnt/build/workspace/root-pullrequests-build/root/math/matrix/inc -I/mnt/build/workspace/root-pullrequests-build/root/math/vecops/inc -I/mnt/build/workspace/root-pullrequests-build/root/net/net/inc -I/mnt/build/workspace/root-pullrequests-build/root/io/io/inc -I/mnt/build/workspace/root-pullrequests-build/root/graf2d/gpad/inc -I/mnt/build/workspace/root-pullrequests-build/root/graf2d/graf/inc -I/mnt/build/workspace/root-pullrequests-build/root/graf3d/g3d/inc -fdiagnostics-color=always -std=c++11 -pipe -Wshadow -Wall -W -Woverloaded-virtual -fsigned-char -pthread -O3 -fPIC -std=c++11 -MD -MT tree/dataframe/CMakeFiles/ROOTDataFrame.dir/src/RLoopManager.cxx.o -MF tree/dataframe/CMakeFiles/ROOTDataFrame.dir/src/RLoopManager.cxx.o.d -o tree/dataframe/CMakeFiles/ROOTDataFrame.dir/src/RLoopManager.cxx.o -c /mnt/build/workspace/root-pullrequests-build/root/tree/dataframe/src/RLoopManager.cxx
  • [2021-06-08T16:16:06.213Z] /mnt/build/workspace/root-pullrequests-build/root/tree/dataframe/src/RLoopManager.cxx:379:43: error: no matching function for call to ‘ROOT::Detail::RDF::RCallCleanUpTask::RCallCleanUpTask(<brace-enclosed initializer list>)’
  • [2021-06-08T16:16:06.213Z] /mnt/build/workspace/root-pullrequests-build/root/tree/dataframe/src/RLoopManager.cxx:404:38: error: no matching function for call to ‘ROOT::Detail::RDF::RCallCleanUpTask::RCallCleanUpTask(<brace-enclosed initializer list>)’
  • [2021-06-08T16:16:06.213Z] /mnt/build/workspace/root-pullrequests-build/root/tree/dataframe/src/RLoopManager.cxx:428:47: error: no matching function for call to ‘ROOT::Detail::RDF::RCallCleanUpTask::RCallCleanUpTask(<brace-enclosed initializer list>)’
  • [2021-06-08T16:16:06.213Z] /mnt/build/workspace/root-pullrequests-build/root/tree/dataframe/src/RLoopManager.cxx:453:42: error: no matching function for call to ‘ROOT::Detail::RDF::RCallCleanUpTask::RCallCleanUpTask(<brace-enclosed initializer list>)’
  • [2021-06-08T16:16:06.213Z] /mnt/build/workspace/root-pullrequests-build/root/tree/dataframe/src/RLoopManager.cxx:483:41: error: no matching function for call to ‘ROOT::Detail::RDF::RCallCleanUpTask::RCallCleanUpTask(<brace-enclosed initializer list>)’
  • [2021-06-08T16:16:06.213Z] /mnt/build/workspace/root-pullrequests-build/root/tree/dataframe/src/RLoopManager.cxx:518:43: error: no matching function for call to ‘ROOT::Detail::RDF::RCallCleanUpTask::RCallCleanUpTask(<brace-enclosed initializer list>)’

Warnings:

  • [2021-06-08T16:16:06.213Z] /mnt/build/workspace/root-pullrequests-build/root/tree/dataframe/src/RLoopManager.cxx:303:18: warning: non-static reference ‘ROOT::Detail::RDF::RLoopManager& ROOT::Detail::RDF::RCallCleanUpTask::fLoopManager’ in class without a constructor [-Wuninitialized]

@phsft-bot
Copy link
Copy Markdown

Build failed on mac1014/python3.
Running on macphsft17.dyndns.cern.ch:/build/jenkins/workspace/root-pullrequests-build
See console output.

Errors:

  • [2021-06-08T16:54:38.905Z] FAILED: tree/dataframe/CMakeFiles/ROOTDataFrame.dir/src/RLoopManager.cxx.o
  • [2021-06-08T16:54:39.472Z] /build/jenkins/workspace/root-pullrequests-build/root/tree/dataframe/src/RLoopManager.cxx:379:24: error: no matching constructor for initialization of 'ROOT::Detail::RDF::RCallCleanUpTask'
  • [2021-06-08T16:54:39.472Z] /build/jenkins/workspace/root-pullrequests-build/root/tree/dataframe/src/RLoopManager.cxx:404:21: error: no matching constructor for initialization of 'ROOT::Detail::RDF::RCallCleanUpTask'
  • [2021-06-08T16:54:39.472Z] /build/jenkins/workspace/root-pullrequests-build/root/tree/dataframe/src/RLoopManager.cxx:428:24: error: no matching constructor for initialization of 'ROOT::Detail::RDF::RCallCleanUpTask'
  • [2021-06-08T16:54:39.472Z] /build/jenkins/workspace/root-pullrequests-build/root/tree/dataframe/src/RLoopManager.cxx:453:21: error: no matching constructor for initialization of 'ROOT::Detail::RDF::RCallCleanUpTask'
  • [2021-06-08T16:54:39.472Z] /build/jenkins/workspace/root-pullrequests-build/root/tree/dataframe/src/RLoopManager.cxx:483:24: error: no matching constructor for initialization of 'ROOT::Detail::RDF::RCallCleanUpTask'
  • [2021-06-08T16:54:39.472Z] /build/jenkins/workspace/root-pullrequests-build/root/tree/dataframe/src/RLoopManager.cxx:518:24: error: no matching constructor for initialization of 'ROOT::Detail::RDF::RCallCleanUpTask'

Warnings:

  • [2021-06-08T16:54:39.472Z] /build/jenkins/workspace/root-pullrequests-build/root/tree/dataframe/src/RLoopManager.cxx:302:8: warning: struct 'RCallCleanUpTask' does not declare any constructor to initialize its non-modifiable members

@phsft-bot
Copy link
Copy Markdown

Build failed on ROOT-performance-centos8-multicore/default.
Running on olbdw-01.cern.ch:/data/sftnight/workspace/root-pullrequests-build
See console output.

Errors:

  • [2021-06-08T17:33:37.658Z] /data/sftnight/workspace/root-pullrequests-build/root/tree/dataframe/src/RLoopManager.cxx:379:43: error: no matching function for call to ‘ROOT::Detail::RDF::RCallCleanUpTask::RCallCleanUpTask(<brace-enclosed initializer list>)’
  • [2021-06-08T17:33:37.659Z] /data/sftnight/workspace/root-pullrequests-build/root/tree/dataframe/src/RLoopManager.cxx:404:38: error: no matching function for call to ‘ROOT::Detail::RDF::RCallCleanUpTask::RCallCleanUpTask(<brace-enclosed initializer list>)’
  • [2021-06-08T17:33:37.659Z] /data/sftnight/workspace/root-pullrequests-build/root/tree/dataframe/src/RLoopManager.cxx:428:47: error: no matching function for call to ‘ROOT::Detail::RDF::RCallCleanUpTask::RCallCleanUpTask(<brace-enclosed initializer list>)’
  • [2021-06-08T17:33:37.659Z] /data/sftnight/workspace/root-pullrequests-build/root/tree/dataframe/src/RLoopManager.cxx:453:42: error: no matching function for call to ‘ROOT::Detail::RDF::RCallCleanUpTask::RCallCleanUpTask(<brace-enclosed initializer list>)’
  • [2021-06-08T17:33:37.659Z] /data/sftnight/workspace/root-pullrequests-build/root/tree/dataframe/src/RLoopManager.cxx:483:41: error: no matching function for call to ‘ROOT::Detail::RDF::RCallCleanUpTask::RCallCleanUpTask(<brace-enclosed initializer list>)’
  • [2021-06-08T17:33:37.659Z] /data/sftnight/workspace/root-pullrequests-build/root/tree/dataframe/src/RLoopManager.cxx:518:43: error: no matching function for call to ‘ROOT::Detail::RDF::RCallCleanUpTask::RCallCleanUpTask(<brace-enclosed initializer list>)’

Warnings:

  • [2021-06-08T17:33:37.658Z] /data/sftnight/workspace/root-pullrequests-build/root/tree/dataframe/src/RLoopManager.cxx:303:18: warning: non-static reference ‘ROOT::Detail::RDF::RLoopManager& ROOT::Detail::RDF::RCallCleanUpTask::fLoopManager’ in class without a constructor [-Wuninitialized]

@phsft-bot
Copy link
Copy Markdown

Build failed on mac11.0/cxx17.
Running on macphsft23.dyndns.cern.ch:/Users/sftnight/build/workspace/root-pullrequests-build
See console output.

Failing tests:

@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, mac1014/python3, mac11.0/cxx17, windows10/cxx14
How to customize builds

@phsft-bot
Copy link
Copy Markdown

Build failed on ROOT-ubuntu16/nortcxxmod.
Running on sft-ubuntu-1604-1.cern.ch:/build/workspace/root-pullrequests-build
See console output.

Errors:

  • [2021-06-09T09:42:54.536Z] FAILED: /usr/bin/ccache /usr/bin/c++ -DVECCORE_ENABLE_VC -I/mnt/build/workspace/root-pullrequests-build/root/tree/dataframe/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/unix/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/clingutils/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/textinput/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/thread/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/zip/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/rint/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/clib/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/meta/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/gui/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/cont/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/foundation/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/base/inc -Iginclude -I/mnt/build/workspace/root-pullrequests-build/root/tree/tree/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/imt/inc -I/mnt/build/workspace/root-pullrequests-build/root/core/multiproc/inc -I/mnt/build/workspace/root-pullrequests-build/root/math/mathcore/inc -I/mnt/build/workspace/root-pullrequests-build/root/math/mathcore/v7/inc -Iexternals/mnt/build/workspace/root-pullrequests-build/install/include -I/mnt/build/workspace/root-pullrequests-build/root/tree/treeplayer/inc -I/mnt/build/workspace/root-pullrequests-build/root/hist/hist/inc -I/mnt/build/workspace/root-pullrequests-build/root/math/matrix/inc -I/mnt/build/workspace/root-pullrequests-build/root/math/vecops/inc -I/mnt/build/workspace/root-pullrequests-build/root/net/net/inc -I/mnt/build/workspace/root-pullrequests-build/root/io/io/inc -I/mnt/build/workspace/root-pullrequests-build/root/graf2d/gpad/inc -I/mnt/build/workspace/root-pullrequests-build/root/graf2d/graf/inc -I/mnt/build/workspace/root-pullrequests-build/root/graf3d/g3d/inc -fdiagnostics-color=always -std=c++11 -pipe -Wshadow -Wall -W -Woverloaded-virtual -fsigned-char -pthread -O3 -fPIC -std=c++11 -MD -MT tree/dataframe/CMakeFiles/ROOTDataFrame.dir/src/RLoopManager.cxx.o -MF tree/dataframe/CMakeFiles/ROOTDataFrame.dir/src/RLoopManager.cxx.o.d -o tree/dataframe/CMakeFiles/ROOTDataFrame.dir/src/RLoopManager.cxx.o -c /mnt/build/workspace/root-pullrequests-build/root/tree/dataframe/src/RLoopManager.cxx
  • [2021-06-09T09:42:54.536Z] /mnt/build/workspace/root-pullrequests-build/root/tree/dataframe/src/RLoopManager.cxx:379:43: error: no matching function for call to ‘ROOT::Detail::RDF::RCallCleanUpTask::RCallCleanUpTask(<brace-enclosed initializer list>)’
  • [2021-06-09T09:42:54.537Z] /mnt/build/workspace/root-pullrequests-build/root/tree/dataframe/src/RLoopManager.cxx:404:38: error: no matching function for call to ‘ROOT::Detail::RDF::RCallCleanUpTask::RCallCleanUpTask(<brace-enclosed initializer list>)’
  • [2021-06-09T09:42:54.537Z] /mnt/build/workspace/root-pullrequests-build/root/tree/dataframe/src/RLoopManager.cxx:428:47: error: no matching function for call to ‘ROOT::Detail::RDF::RCallCleanUpTask::RCallCleanUpTask(<brace-enclosed initializer list>)’
  • [2021-06-09T09:42:54.537Z] /mnt/build/workspace/root-pullrequests-build/root/tree/dataframe/src/RLoopManager.cxx:453:42: error: no matching function for call to ‘ROOT::Detail::RDF::RCallCleanUpTask::RCallCleanUpTask(<brace-enclosed initializer list>)’
  • [2021-06-09T09:42:54.537Z] /mnt/build/workspace/root-pullrequests-build/root/tree/dataframe/src/RLoopManager.cxx:483:41: error: no matching function for call to ‘ROOT::Detail::RDF::RCallCleanUpTask::RCallCleanUpTask(<brace-enclosed initializer list>)’
  • [2021-06-09T09:42:54.537Z] /mnt/build/workspace/root-pullrequests-build/root/tree/dataframe/src/RLoopManager.cxx:518:43: error: no matching function for call to ‘ROOT::Detail::RDF::RCallCleanUpTask::RCallCleanUpTask(<brace-enclosed initializer list>)’

Warnings:

  • [2021-06-09T09:42:54.536Z] /mnt/build/workspace/root-pullrequests-build/root/tree/dataframe/src/RLoopManager.cxx:303:18: warning: non-static reference ‘ROOT::Detail::RDF::RLoopManager& ROOT::Detail::RDF::RCallCleanUpTask::fLoopManager’ in class without a constructor [-Wuninitialized]

@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, mac1014/python3, mac11.0/cxx17, windows10/cxx14
How to customize builds

@phsft-bot
Copy link
Copy Markdown

Build failed on ROOT-ubuntu16/nortcxxmod.
Running on sft-ubuntu-1604-1.cern.ch:/build/workspace/root-pullrequests-build
See console output.

Failing tests:

@phsft-bot
Copy link
Copy Markdown

Build failed on ROOT-performance-centos8-multicore/default.
Running on olbdw-01.cern.ch:/data/sftnight/workspace/root-pullrequests-build
See console output.

Failing tests:

@phsft-bot
Copy link
Copy Markdown

Build failed on mac1014/python3.
Running on macphsft17.dyndns.cern.ch:/build/jenkins/workspace/root-pullrequests-build
See console output.

Failing tests:

@phsft-bot
Copy link
Copy Markdown

Build failed on mac11.0/cxx17.
Running on macphsft23.dyndns.cern.ch:/Users/sftnight/build/workspace/root-pullrequests-build
See console output.

Failing tests:

@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, mac1014/python3, mac11.0/cxx17, windows10/cxx14
How to customize builds

1 similar comment
@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, mac1014/python3, mac11.0/cxx17, windows10/cxx14
How to customize builds

eguiraud and others added 6 commits June 10, 2021 09:36
These are callbacks that are run at the beginning of a new "data
block": in the case of a TChain, a new data block starts when the
TChain switches TTrees or when a new multi-thread task starts.
In other cases a new data block starts with each new task.
In the future RDataSources might be able to provide their own
definition of a data block.

For now, only actions are wired to the data-block callback logic.
In the future we could also offer a special kind of Defines that
only update their values at the beginning of a data block, which
would provide a `DefinePerSample` feature.
Instead of TTree::AddClone + TTree::CopyAddresses, use the data-block
callback mechanism to reset addresses when needed.
We cannot trust TTree::CopyAddresses to do the right thing because
the output branch might be a different kind of branch than the input
branch (e.g. TBranch vs TBranchElement), which leads to the problem
described at root-project#8295 .

Note that TBranch::SetAddress (which we now call directly to keep the
address of the output branches synced with the location of the input
variables) needs the address of a _pointer that points to the object
associated to the branch_ instead of just the address of that object
unless the output branch is really a simple TBranch.
We reuse fBranchAddresses as storage for these pointers, which until
now was only used in case the column was of RVec type.

This fixes root-project#8295.
As a side-effect of moving away from TTree::AddClone +
TTree::CopyAddresses, these changes also fix root-project#7727.
@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, mac1014/python3, mac11.0/cxx17, windows10/cxx14
How to customize builds

@eguiraud
Copy link
Copy Markdown
Contributor Author

Rebased just to clean the commit history a bit, the set of changes is exactly the same.

@eguiraud eguiraud merged commit 3f94894 into root-project:master Jun 10, 2021
@eguiraud eguiraud deleted the df_fix_snapshot branch June 10, 2021 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants