Fix numba warning on Linux for using TBB#2010
Open
psavery wants to merge 1 commit into
Open
Conversation
This fixes the following numba warning on Linux: ``` Numba: Attempted to fork from a non-main thread, the TBB library may be in an invalid state in the child process. ``` The main idea is that forked subprocesses (which we indeed do, in order to take advantage of copy-on-write mechanics and let subprocesses share data), which only happen on Linux (Windows and Mac do "spawn"), would always print this numba warning, even though we were never actually using TBB in an invalid way. There's no way to suppress this warning, so we switch to OpenMP on Linux, which is just as performant. In fact, it has one better feature too: it will crash if we try to run numba in parallel mode on a forked subprocess. TBB was just undefined, but the OpenMP implementation will actually crash, which prevents developers from ever doing that. Signed-off-by: Patrick Avery <patrick.avery@kitware.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This fixes the following numba warning on Linux:
The main idea is that forked subprocesses (which we indeed do, in order to take advantage of copy-on-write mechanics and let subprocesses share data), which only happen on Linux (Windows and Mac do "spawn"), would always print this numba warning, even though we were never actually using TBB in an invalid way.
There's no way to suppress this warning, so we switch to OpenMP on Linux, which is just as performant.
In fact, it has one better feature too: it will crash if we try to run numba in parallel mode on a forked subprocess. TBB was just undefined, but the OpenMP implementation will actually crash, which prevents developers from ever doing that.