Skip to content

Conversation

@hageboeck
Copy link
Member

@hageboeck hageboeck commented Feb 4, 2025

  • Move the copy of artifacts (e.g. tutorials) from build time to configure time, and use a faster copy function.
  • At build time, replace the one-by-one copy of headers by copy in batches.

Here are some results:

make -j6 move_headers New Old
1st invocation 10.7 s 34.5 s
2nd invocation 2.7 s 3.8 s
Invocation after touching a header in core/ 3.1 s 4.2 s
Invocation after touching a header in RooFit/hs3 2.9 s 3.9 s

For the copy of artifacts, there is no agreement yet since it's more complicated. I will factor this part out into a second PR.

Fix #14953

@hageboeck hageboeck self-assigned this Feb 4, 2025
@hageboeck hageboeck requested a review from bellenot as a code owner February 4, 2025 11:00
@hageboeck hageboeck requested a review from dpiparo February 4, 2025 11:02
@bellenot
Copy link
Member

bellenot commented Feb 4, 2025

The error on Windows is related to this PR:

error MSB8066: Custom build for 'C:\ROOT-CI\build\CMakeFiles\b4bf4ec5a2a2748fa3fe14aac0b491c8\Bswapcpy.h.rule;C:\ROOT-CI\build\CMakeFiles\d52c4a97b544285cfdcb9662e36a1605\BasicFCN.h.rule;C:\ROOT-CI\build\CMakeFiles\5cbe746a32c517ce8263460eaed96b46\eglew.h.rule;C:\ROOT-CI\build\CMakeFiles\6f62a2407de5b487a7d37393f911fe87\AdaptiveIntegratorMultiDim.h.rule;C:\ROOT-CI\build\CMakeFiles\f946b1f1f35c1bd8f320cb3e49e00bca\3DConversions.h.rule;C:\ROOT-CI\build\CMakeFiles\d4bf7379258006facfcfa53f75f5956b\ABObj.h.rule;C:\ROOT-CI\build\CMakeFiles\a35c8b97151be13ed3d204ad6ed80264\RAnyObjectHolder.hxx.rule;C:\ROOT-CI\build\CMakeFiles\456e85c62d06e0cd87d98ee60dcc2e4f\EExecutionPolicy.hxx.rule;C:\ROOT-CI\build\CMakeFiles\c353aed7a3bd6dbf0923bb9dc4fba686\ActionHelpers.hxx.rule;C:\ROOT-CI\build\CMakeFiles\9bbd6f9b9a1ccee3bcd008c06562308d\RFieldFundamental.hxx.rule;C:\ROOT-CI\build\CMakeFiles\3fbab4c4bb0860c35dbc49b686024422\daos.h.rule;C:\ROOT-CI\build\CMakeFiles\06709d940c4eaf4b90467c901d21fad5\CodegenImpl.h.rule;C:\ROOT-CI\build\CMakeFiles\2600cfd80747fb5960de4549ed2956e4\MathFuncs.h.rule;C:\ROOT-CI\build\CMakeFiles\193c5d220ee00c87398efe41e5bca113\LikelihoodGradientWrapper.h.rule;C:\ROOT-CI\build\CMakeFiles\7e106373c3f52de7795b17f694a854fe\JSONIO.h.rule;C:\ROOT-CI\build\CMakeFiles\c562cae4eae5394921ddc3d0cafa5f56\RooCatTypeLegacy.h.rule;C:\ROOT-CI\build\CMakeFiles\ebec96819e385d9ea45a1b2d103e31b8\AsymptoticCalculator.h.rule;C:\ROOT-CI\build\CMakeFiles\cd2d88b30ee96ff2fdca17cad3e08856\Asimov.h.rule;C:\ROOT-CI\build\CMakeFiles\0bd4f58f57ed53aeade166f8902ab30f\HistFactoryImpl.h.rule;C:\ROOT-CI\build\CMakeFiles\4ff935d273915365070a61ee0cd1b02c\BDTEventWrapper.h.rule;C:\ROOT-CI\build\CMakeFiles\db29aecca489daaa0f06f6367b1d3b81\RBatchGenerator.hxx.rule;C:\ROOT-CI\build\CMakeFiles\ec821efde375e08e4c351de8c63c89b6\Adadelta.h.rule;C:\ROOT-CI\build\CMakeFiles\addb20638c349f1661791f2822729cf7\Cpu.h.rule;C:\ROOT-CI\build\CMakeFiles\1690471466c052fbb378442159d120a1\CpuBuffer.h.rule;C:\ROOT-CI\build\CMakeFiles\c9afbfdea5ae89c0c83ece15ff85d3eb\DataLoader.h.rule;C:\ROOT-CI\build\CMakeFiles\c0ea46944f6274260ea7991effa94d3e\ContextHandles.h.rule;C:\ROOT-CI\build\CMakeFiles\36bb35dee450defb44862eb7f6abee62\GRULayer.h.rule;C:\ROOT-CI\build\CMakeFiles\d580fcda3530414ad56cc58ed53c3de0\bbox.h.rule;C:\ROOT-CI\build\CMakeFiles\c9dbea440c663f8cf1755fecccca54fd\TF1Data.h.rule;C:\ROOT-CI\build\CMakeFiles\837d695c63a67b677c4a78432d56e457\move_headers.rule;C:\ROOT-CI\src\CMakeLists.txt' exited with code 9020. [C:\ROOT-CI\build\move_headers.vcxproj]

@github-actions
Copy link

github-actions bot commented Feb 4, 2025

Test Results

    18 files      18 suites   4d 16h 59m 42s ⏱️
 2 720 tests  2 720 ✅ 0 💤 0 ❌
47 258 runs  47 258 ✅ 0 💤 0 ❌

Results for commit 11d1161.

♻️ This comment has been updated with latest results.

@hageboeck hageboeck force-pushed the header_copy branch 2 times, most recently from b4d2aad to 594345f Compare February 5, 2025 09:52
@hageboeck
Copy link
Member Author

hageboeck commented Feb 5, 2025

The error on Windows is related to this PR:

error MSB8066: Custom build for 'C:\ROOT-CI\build\CMakeFiles\b4bf4ec5a2a2748fa3fe14aac0b491c8\Bswapcpy.h.rule;C:\ROOT-CI\build\CMakeFiles\d52c4a97b544285cfdcb9662e36a1605\BasicFCN.h.rule;C:\ROOT-CI\build\CMakeFiles\5cbe746a32c517ce8263460eaed96b46\eglew.h.rule;C:\ROOT-CI\build\CMakeFiles\6f62a2407de5b487a7d37393f911fe87\AdaptiveIntegratorMultiDim.h.rule;C:\ROOT-CI\build\CMakeFiles\f946b1f1f35c1bd8f320cb3e49e00bca\3DConversions.h.rule;C:\ROOT-CI\build\CMakeFiles\d4bf7379258006facfcfa53f75f5956b\ABObj.h.rule;C:\ROOT-CI\build\CMakeFiles\a35c8b97151be13ed3d204ad6ed80264\RAnyObjectHolder.hxx.rule;C:\ROOT-CI\build\CMakeFiles\456e85c62d06e0cd87d98ee60dcc2e4f\EExecutionPolicy.hxx.rule;C:\ROOT-CI\build\CMakeFiles\c353aed7a3bd6dbf0923bb9dc4fba686\ActionHelpers.hxx.rule;C:\ROOT-CI\build\CMakeFiles\9bbd6f9b9a1ccee3bcd008c06562308d\RFieldFundamental.hxx.rule;C:\ROOT-CI\build\CMakeFiles\3fbab4c4bb0860c35dbc49b686024422\daos.h.rule;C:\ROOT-CI\build\CMakeFiles\06709d940c4eaf4b90467c901d21fad5\CodegenImpl.h.rule;C:\ROOT-CI\build\CMakeFiles\2600cfd80747fb5960de4549ed2956e4\MathFuncs.h.rule;C:\ROOT-CI\build\CMakeFiles\193c5d220ee00c87398efe41e5bca113\LikelihoodGradientWrapper.h.rule;C:\ROOT-CI\build\CMakeFiles\7e106373c3f52de7795b17f694a854fe\JSONIO.h.rule;C:\ROOT-CI\build\CMakeFiles\c562cae4eae5394921ddc3d0cafa5f56\RooCatTypeLegacy.h.rule;C:\ROOT-CI\build\CMakeFiles\ebec96819e385d9ea45a1b2d103e31b8\AsymptoticCalculator.h.rule;C:\ROOT-CI\build\CMakeFiles\cd2d88b30ee96ff2fdca17cad3e08856\Asimov.h.rule;C:\ROOT-CI\build\CMakeFiles\0bd4f58f57ed53aeade166f8902ab30f\HistFactoryImpl.h.rule;C:\ROOT-CI\build\CMakeFiles\4ff935d273915365070a61ee0cd1b02c\BDTEventWrapper.h.rule;C:\ROOT-CI\build\CMakeFiles\db29aecca489daaa0f06f6367b1d3b81\RBatchGenerator.hxx.rule;C:\ROOT-CI\build\CMakeFiles\ec821efde375e08e4c351de8c63c89b6\Adadelta.h.rule;C:\ROOT-CI\build\CMakeFiles\addb20638c349f1661791f2822729cf7\Cpu.h.rule;C:\ROOT-CI\build\CMakeFiles\1690471466c052fbb378442159d120a1\CpuBuffer.h.rule;C:\ROOT-CI\build\CMakeFiles\c9afbfdea5ae89c0c83ece15ff85d3eb\DataLoader.h.rule;C:\ROOT-CI\build\CMakeFiles\c0ea46944f6274260ea7991effa94d3e\ContextHandles.h.rule;C:\ROOT-CI\build\CMakeFiles\36bb35dee450defb44862eb7f6abee62\GRULayer.h.rule;C:\ROOT-CI\build\CMakeFiles\d580fcda3530414ad56cc58ed53c3de0\bbox.h.rule;C:\ROOT-CI\build\CMakeFiles\c9dbea440c663f8cf1755fecccca54fd\TF1Data.h.rule;C:\ROOT-CI\build\CMakeFiles\837d695c63a67b677c4a78432d56e457\move_headers.rule;C:\ROOT-CI\src\CMakeLists.txt' exited with code 9020. [C:\ROOT-CI\build\move_headers.vcxproj]

@bellenot I might have found the problem: The command line seems to be too long. After splitting the copy command in packs of 100 (there is more than 1000 headers otherwise), the build seemed to succeed. Let's wait for the latest run.

Copy link
Member

@pcanal pcanal left a comment

Choose a reason for hiding this comment

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

With the copy of the artefact (seemingly) only at configure time, we have the following 'failures':

$ echo >> src/tutorials/hsimple.C 
$ ls -l src/tutorials/hsimple.C tutorials/hsimple.C 
-rw-r--r--. 1 pcanal us_cms 3572 Feb  5 17:41 src/tutorials/hsimple.C
-rw-r--r--. 1 pcanal us_cms 3571 Feb  5 16:23 tutorials/hsimple.C
$ ninja
[2/2] Updating etc/gitinfo.txt.
-- Found Git: /usr/bin/git (found version "2.43.5") 
$ ls -l src/tutorials/hsimple.C tutorials/hsimple.C 
-rw-r--r--. 1 pcanal us_cms 3572 Feb  5 17:41 src/tutorials/hsimple.C
-rw-r--r--. 1 pcanal us_cms 3571 Feb  5 16:23 tutorials/hsimple.C

I.e. the copied hsimple.C is not updated after a local modification in the source.

@hageboeck
Copy link
Member Author

With the copy of the artefact (seemingly) only at configure time, we have the following 'failures':

$ echo >> src/tutorials/hsimple.C 
$ ls -l src/tutorials/hsimple.C tutorials/hsimple.C 
-rw-r--r--. 1 pcanal us_cms 3572 Feb  5 17:41 src/tutorials/hsimple.C
-rw-r--r--. 1 pcanal us_cms 3571 Feb  5 16:23 tutorials/hsimple.C
$ ninja
[2/2] Updating etc/gitinfo.txt.
-- Found Git: /usr/bin/git (found version "2.43.5") 
$ ls -l src/tutorials/hsimple.C tutorials/hsimple.C 
-rw-r--r--. 1 pcanal us_cms 3572 Feb  5 17:41 src/tutorials/hsimple.C
-rw-r--r--. 1 pcanal us_cms 3571 Feb  5 16:23 tutorials/hsimple.C

I.e. the copied hsimple.C is not updated after a local modification in the source.

That was my intention. I wanted to reduce the number of CMake targets, since I consider the macros and tutorials mostly stable.
I would anyway recommend to root.exe <sourceDir>/<macro> instead of make -jX; root.exe <buildDir>/<macro>

@hageboeck hageboeck force-pushed the header_copy branch 2 times, most recently from feb75a7 to cf683aa Compare February 10, 2025 16:53
@hageboeck
Copy link
Member Author

@pcanal I decided to factor out the copy of artifacts into a second PR, so at least the improvement due to the faster copying of headers can be merged already. Could you have a look again?

@hageboeck hageboeck requested a review from pcanal February 10, 2025 16:53
@pcanal
Copy link
Member

pcanal commented Feb 10, 2025

I decided to factor out the copy of artifacts into a second PR

Great. I was about to propose that :)

@hageboeck hageboeck changed the title [CMake] Speed up copying of headers and tutorials [CMake] Speed up copying of headers Feb 11, 2025
@hageboeck hageboeck requested a review from pcanal February 14, 2025 13:15
hageboeck and others added 2 commits February 19, 2025 16:49
To copy headers to the build tree, ROOT was creating one target per header.
Headers are copied in packs of 100 (Windows doesn't support very long command lines).
This significantly reduces the number of CMake targets and speeds up the build.

A simple test that only moves headers:
make -j6 move_headers   New     Old
1st invocation          10.7 s  34.5 s
2nd invocation           2.7 s   3.8 s

Fix root-project#14953.

Co-authored-by: Philippe Canal <pcanal@fnal.gov>
The intention of __allBuiltins was to build builtins as part of
moving headers.
The existing code was seemingly creating a target dependency using
add_custom_target(move_headers DEPENDS ${__allBuiltins})

However, this argument only accepts file dependencies. The dependency
was therefore ignored. Since it doesn't seem to have caused any
problems, it is removed here explicitly.
Copy link
Member

@pcanal pcanal left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks.

@hageboeck hageboeck merged commit f33985d into root-project:master Feb 24, 2025
21 checks passed
@hageboeck hageboeck deleted the header_copy branch February 24, 2025 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[cmake] Glob when copying headers and tutorials

3 participants