root icon indicating copy to clipboard operation
root copied to clipboard

Spurious TMVA related rebuild

Open pcanal opened this issue 8 months ago • 5 comments

Check duplicate issues.

  • [ ] Checked for duplicates

Description

Running 2 consecutive builds, the second build would ideally do nothing. With alma9 CI configuration, a second build rebuilds this:

[ 96%] Built target emitFromONNX
TMVA SOFIE Operator Conv:  asymmetric padding not supported. Assume an average padding
[ 96%] Built target SofieCompileModels_ONNX
[ 96%] Building CXX object tmva/sofie/test/CMakeFiles/TestCustomModelsFromONNX.dir/TestCustomModelsFromONNX.cxx.o
[ 96%] Linking CXX executable TestCustomModelsFromONNX
[ 96%] Built target TestCustomModelsFromONNX
[ 96%] Built target emitFromROOT
TMVA SOFIE Operator Conv:  asymmetric padding not supported. Assume an average padding
[ 96%] Built target SofieCompileModels_ROOT
[ 96%] Building CXX object tmva/sofie/test/CMakeFiles/TestCustomModelsFromROOT.dir/TestCustomModelsFromROOT.cxx.o
[ 96%] Linking CXX executable TestCustomModelsFromROOT

This is due to the emitFromONNX being unconditionally run and producing header files that are input to the next steps.

Reproducer

make
make

ROOT version

master

Installation method

local build

Operating system

Linux

Additional context

No response

pcanal avatar Apr 29 '25 18:04 pcanal

Maybe related: https://github.com/root-project/root/issues/18432

ferdymercury avatar Apr 29 '25 18:04 ferdymercury

Optimally, the header files should not be produced in the the build step but when running the tests. The generated header files are ONNX models converted to C++ by TMVA-SOFIE. As it is now, TMVA-SOFIE development is quite annoying because if you are in an intermediate development state where not all SOFIE usecases work, the compilation will fail at the first failing model. You don't have the opportunity to run all the tests after the build to see where you stand. This is something I discussed also yesterday with @lmoneta.

@sanjibansg, can something be done about this?

guitargeek avatar Apr 29 '25 18:04 guitargeek

@sanjibansg, ping on this. I have a suggestion to maybe make this more actionable: in the ROOT tests in roottest, a similar problem was already solved. Also there, we have tests that depend on artifacts that are CMake targets, for example the libraries with the dictionaries. Instead of building these targets together with ROOT, we exclude them from the main build with EXCLUDE_FROM_ALL, and instead have additional tests that manually build these targets. The actual tests then depend on the tests that generate the artifacts via fixtures.

This is all implemented in the ROOTTEST_GENERATE_DICTIONARY macro:

  • https://github.com/root-project/root/blob/master/roottest/cmake/modules/RoottestMacros.cmake#L363 Here is a usage example:
  • https://github.com/root-project/root/blob/master/roottest/root/io/json/CMakeLists.txt#L10

Could implementing the same mechanism for the SOFIE tests a good way forward? You would just have to add some EXCLUDE_FROM_ALLs to the target and add some new tests that run the CMake commands to build the targets instead.

guitargeek avatar Jun 02 '25 11:06 guitargeek

@sanjibansg, ping on this. I have a suggestion to maybe make this more actionable: in the ROOT tests in roottest, a similar problem was already solved. Also there, we have tests that depend on artifacts that are CMake targets, for example the libraries with the dictionaries. Instead of building these targets together with ROOT, we exclude them from the main build with EXCLUDE_FROM_ALL, and instead have additional tests that manually build these targets. The actual tests then depend on the tests that generate the artifacts via fixtures.

This is all implemented in the ROOTTEST_GENERATE_DICTIONARY macro:

  • https://github.com/root-project/root/blob/master/roottest/cmake/modules/RoottestMacros.cmake#L363 Here is a usage example:
  • https://github.com/root-project/root/blob/master/roottest/root/io/json/CMakeLists.txt#L10

Could implementing the same mechanism for the SOFIE tests a good way forward? You would just have to add some EXCLUDE_FROM_ALLs to the target and add some new tests that run the CMake commands to build the targets instead.

Hi Jonas, Thanks for your suggestion, I will work on this with Lorenzo.

sanjibansg avatar Jun 02 '25 13:06 sanjibansg

@sanjibansg do you have an eta?

dpiparo avatar Jun 14 '25 09:06 dpiparo