Skip to content

Conversation

@rfaasse
Copy link
Contributor

@rfaasse rfaasse commented Dec 3, 2025

📝 Description
This PR puts the suite without kernel in a separate file. This means that any test that only includes the new file, (implicitly) includes a lot less headers. This has two advantages:

  • First of all, the compilation unit for that specific test compiles more quickly, as less headers are included in the compilation unit.
  • Second, the compilation unit for that specific test is dependent on a smaller number of other headers, meaning it will need to be recompiled less often (as that's only triggered when there are changes in the respective cpp file, or any (indirectly) included headers.

In this PR the separation and one example is shown. For this specific example the compile times are as follows:

before:
38279ms applications/GeoMechanicsApplication/CMakeFiles/KratosGeoMechanicsCoreTest.dir/tests/cpp_tests/custom_conditions/test_axisymmetric_U_Pw_normal_face_load_condition.cpp.obj

after:
28510ms applications/GeoMechanicsApplication/CMakeFiles/KratosGeoMechanicsCoreTest.dir/tests/cpp_tests/custom_conditions/test_axisymmetric_U_Pw_normal_face_load_condition.cpp.obj

Of course due to parallel building this doesn't mean we win 10 seconds for each test, but it is significant and also helps rebuilding less often in the first place (winning even more time).

By slowly converting tests in the same fashion as this example, we'll improve include health and build times

…m gtest

To avoid in the future to have to indirectly include things like 'kernel.h' for every unit test
@rfaasse rfaasse requested a review from a team as a code owner December 3, 2025 08:38
@rfaasse rfaasse marked this pull request as draft December 3, 2025 08:38
@rfaasse rfaasse changed the title [GeoMechanicsApplicationGeo/separate test suites to improve compilation [GeoMechanicsApplication] Separate test suites to improve compilation Dec 3, 2025
@rfaasse
Copy link
Contributor Author

rfaasse commented Dec 3, 2025

I didn't mean for this PR to be reviewed yet (but created it without making it a draft, my mistake), so please wait until I put it as ready for review again 👍

@rfaasse rfaasse requested a review from avdg81 December 3, 2025 10:01
@rfaasse rfaasse marked this pull request as ready for review December 3, 2025 10:01
@rfaasse rfaasse self-assigned this Dec 3, 2025
Copy link
Contributor

@markelov208 markelov208 left a comment

Choose a reason for hiding this comment

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

Hi Richard, thank you for speeding up the compilation. It looks that we should use more gtests instead of KRATOS macros, right?

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.

3 participants