-
Notifications
You must be signed in to change notification settings - Fork 620
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
base: main
Are you sure you want to change the base?
Conversation
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]>
Signed-off-by: Kimball Thurston <[email protected]>
cmake/OpenEXRSetup.cmake
Outdated
@@ -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 |
There was a problem hiding this comment.
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.
website/install.rst
Outdated
use case), but TBB shares actual threads and uses an arena to control | ||
thread usage. | ||
|
||
To enable this, simple set the flag during config: |
There was a problem hiding this comment.
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]>
There was a problem hiding this 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.
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/