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

Add an option to use TBB as the global provider #1852

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

kdt3rd
Copy link
Contributor

@kdt3rd kdt3rd commented Sep 29, 2024

My dev days contribution :)

This was inspired based on #1285, although does not use a TBB task group to do any sync at this point, as if someone were to provide an alternate thread pool provider, the task group would then fail miserably. Additionally, this only sets the global thread pool provider to the TBB one to retain the previous contract where creating a thread pool actually created threads.

Can be enabled with -DOPENEXR_USE_TBB=ON added to cmake

Website preview: https://openexr--1852.org.readthedocs.build/en/1852/

This does NOT change the default thread pool provider if you manually
instantiate a thread pool, as that would change the contract of the
previous definition of the thread pool and likely cause deadlocks when
users expected separate threads in separate thread pools

Signed-off-by: Kimball Thurston <[email protected]>
The code was normally fine, but potentially problematic depending on
thread provider to delete the thread pool prior to waiting for all the
tasks to finish

Signed-off-by: Kimball Thurston <[email protected]>
Signed-off-by: Kimball Thurston <[email protected]>
@@ -42,6 +42,11 @@ option(OPENEXR_INSTALL_PKG_CONFIG "Install OpenEXR.pc file" ON)
# Whether to enable threading. This can be disabled, although thread pool and tasks
# are still used, just processed immediately
option(OPENEXR_ENABLE_THREADING "Enables threaded processing of requests" ON)
# will use TBB for the global thread pool by default
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment's kinda confusing ~ the option is OFF (which is what I would expect) but the comment says TBB is used by default, which is only true if the option is ON.

use case), but TBB shares actual threads and uses an arena to control
thread usage.

To enable this, simple set the flag during config:
Copy link
Contributor

Choose a reason for hiding this comment

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

spelling: simply
maybe just omit the word simple/y :)

Signed-off-by: Kimball Thurston <[email protected]>
Copy link
Contributor

@meshula meshula left a comment

Choose a reason for hiding this comment

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

Thanks, the wording is perfectly clear now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants