Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Require TBB to be found by cmake #3507

Merged
merged 12 commits into from
Oct 30, 2024

Conversation

benjaminhuth
Copy link
Member

Previously, the configuration could trun through even if TBB is not present on the system.

@github-actions github-actions bot added the Component - Examples Affects the Examples module label Aug 14, 2024
@benjaminhuth benjaminhuth added this to the next milestone Aug 14, 2024
andiwand
andiwand previously approved these changes Aug 14, 2024
Copy link

github-actions bot commented Aug 14, 2024

📊: Physics performance monitoring for 538aad1

Full contents

physmon summary

Copy link
Member

@paulgessinger paulgessinger left a comment

Choose a reason for hiding this comment

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

The reason for this was that the Sequencer currently falls back to running single threaded in this mode, which was added intentionally. If tbb becomes a hard requirement here, this configuration should be removed as well.

@timadye
Copy link
Contributor

timadye commented Aug 14, 2024

Just to put Paul's point another way... why do we need to requite TBB, when ACTS works fine (single-threaded) without it? (Or at least it used to, last time I checked.)

@benjaminhuth
Copy link
Member Author

benjaminhuth commented Aug 14, 2024

Okay, sure, but compilation fails in that case I think (at least that was what I experienced). Do we test the case where no TBB is present?

Shouldn't we use some more explicit logic here like having an option such as ACTS_EXAMPLES_NO_TBB or something like that?

@paulgessinger
Copy link
Member

@benjaminhuth We do have ACTS_USE_EXAMPLES_TBB, we just fall back to OFF if we don't find TBB. I'm ok to make this explicit only without fallback.

@andiwand
Copy link
Contributor

I agree, if ACTS_USE_EXAMPLES_TBB is on we should definitely use it without a fallback. Not finding it is an error case IMO

@timadye
Copy link
Contributor

timadye commented Aug 15, 2024

But mostly ACTS_USE_EXAMPLES_TBB is on by default, rather than requested by the user with an explicit -DACTS_USE_EXAMPLES_TBB=ON. In this case, it is nice to have the fallback to OFF to make building ACTS easier for users that just want get something working without having to install tbb or find another CMake option. Is this possible to fall back to OFF iif it isn't specified?

The question remains why it didn't compile for you. That may be a more important issue to solve.

@benjaminhuth benjaminhuth marked this pull request as draft August 15, 2024 14:41
@benjaminhuth
Copy link
Member Author

benjaminhuth commented Aug 15, 2024

I think you're right @timadye: I should try to reproduce the compile failure.

Anyhow: I think if ACTS_USE_EXAMPLES_TBB=ON and TBB is not found, we should fail the cmake configuration. maybe with a message that indicates that -D ACTS_USE_EXAMPLES_TBB=ON is the right option to make it work.

@andiwand
Copy link
Contributor

Maybe I am missing something but this is what is actually change in the PR, right? expect for a more descriptive message

@paulgessinger
Copy link
Member

@andiwand Almost, but it's using the TBB_FOUND variable in a way that doesn't make sense anymore without the fallback. I think it's maybe a 10 line refactor to clean it up.

@benjaminhuth
Copy link
Member Author

I found the source of the compile errore: The track finding algorithm unconditionally uses tbb::combinable because of the memory statistics. Should we hide this behind a preprocessor define @paulgessinger ?

@paulgessinger
Copy link
Member

@benjaminhuth True, that was me, and I forgot about it to be honest. I don't have a strong opinion what the best solution is. I would probably lean towards avoiding making the single threaded use case require workarounds in many places, and therefore switch back to hard-requiring TBB?

@timadye
Copy link
Contributor

timadye commented Aug 20, 2024

I think it is a pity to add a required dependency without good reason. It seems this one should be quite easy to #ifndef ACTS_EXAMPLES_NO_TBB around the #include and m_memoryStatistics definition and use (2 places). I think that just means we don't get memory stats in the case without tbb.

A more complete solution would be to make a dummy class like tbbWrap.hpp does, but I don't think that's necessary in this case.

@paulgessinger
Copy link
Member

paulgessinger commented Aug 21, 2024

@timadye It's a required dependency for our example framework, not the core lib, but I see your point.

I don't know, your call @benjaminhuth

@benjaminhuth
Copy link
Member Author

benjaminhuth commented Aug 21, 2024

Okay, during testing I found an additional place with explicit TBB dependency:

tbb::enumerable_thread_specific<Acts::FpeMonitor::Result> fpeResult{};

Actually since this involves the FPE mechanism I would now lean towards dropping the possibility to build without TBB...

On the other hand, if we would stick to TBB being optional, we should definitively test it in the CI.

@benjaminhuth
Copy link
Member Author

I think that these build errors were not observered for such a long time also indicates the option is not widely used.

@timadye
Copy link
Contributor

timadye commented Aug 21, 2024

OK, I guess I can't argue with that.

Do these direct uses of tbb conflict with tbbWrap's other function of bypassing tbb setup when running in a single-threaded mode? That definitely was useful to simplify debugging.

@benjaminhuth benjaminhuth marked this pull request as ready for review August 21, 2024 14:45
timadye
timadye previously approved these changes Aug 21, 2024
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
25.21% Line Coverage on New Code (required ≥ 50%)

See analysis details on SonarCloud

@paulgessinger
Copy link
Member

@benjaminhuth getting_started.md needs an update I believe. I can override the coverage failure afterwards.

@acts-policybot acts-policybot bot dismissed timadye’s stale review October 30, 2024 09:46

Invalidated by push of 56d2c1d

@github-actions github-actions bot added Component - Documentation Affects the documentation and removed Stale labels Oct 30, 2024
Copy link
Member

@paulgessinger paulgessinger left a comment

Choose a reason for hiding this comment

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

I'm ok with this.

Copy link
Contributor

@timadye timadye left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link

@kodiakhq kodiakhq bot merged commit e2789b6 into acts-project:main Oct 30, 2024
42 checks passed
@paulgessinger paulgessinger modified the milestones: next, v37.4.0, v37.3.0 Nov 8, 2024
Rosie-Hasan pushed a commit to Rosie-Hasan/acts that referenced this pull request Nov 13, 2024
Previously, the configuration could trun through even if TBB is not present on the system.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component - Documentation Affects the documentation Component - Examples Affects the Examples module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Example Framework does not compile in an environment without TBB
5 participants