TBB Re-Configuration Fix, main branch (2024.10.30.) #759
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As discussed with @stephenswat earlier today, @paulgessinger's update in #682 revealed a deeper issue with our build.
What happened was that oneDPL would call
find_package(TBB)
to access TBB, when using the"dpcpp"
backend. (The one we actually use.)https://github.com/oneapi-src/oneDPL/blob/main/CMakeLists.txt#L163
This would:
TBB_DIR
cache variable, pointing at the external TBB version that was found.This would work ~fine on the first CMake configuration. Even though at this point oneDPL would link against a different version of TBB than the one building together with the project. 😦 But on a re-configuration, we would now bump into:
https://github.com/oneapi-src/oneTBB/blob/v2021.7.0/CMakeLists.txt#L210
I.e. on this re-configuration we would completely abandon our own TBB version, and rather pick up the external version that was previously found by oneDPL.
To fix this, I had to do two things:
TBB_DIR
by itself would not make it abandon setting up its own version of TBB. (In https://github.com/oneapi-src/oneTBB/blob/v2021.13.0/CMakeLists.txt#L236 the previousOR
was changed to anAND
.)find_package(TBB)
be practically a no-op. This way ensuring that oneDPL would actually use the TBB version that we are building ourselves.Yepp, some non-trivial CMake-ing going on here... 😛
P.S. I moved the setup of TBB before (Roc)Thrust, because those can also conditionally use TBB themselves. Even if in our current build they don't.