[WIP] Preload cudart before cuvs native library load to prevent downstream class load errors - #2376
Open
rahulgoswami wants to merge 3 commits into
Open
[WIP] Preload cudart before cuvs native library load to prevent downstream class load errors#2376rahulgoswami wants to merge 3 commits into
rahulgoswami wants to merge 3 commits into
Conversation
…class load errors
Contributor
|
/ok to test a849ecd |
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.
Fixes: #2300
Issue happens because libcudart.so (a dependency of libcuvs.so (or libcuvs_c.so?)) is not available during the class loading sequence unless explicitly loaded via System.loadLibrary() call . The symbol lookup space (where Java looks for dependent native libraries) gets defined in one of the header class files (To-Do: add exact header) that gets generated as a Panama FFM binding. And this loading sequence looks for libcuvs.so but not for libcudart.so.
As opposed to the initial proposal in the GH issue of making the loadLibrary() call in CvVSProvider.provider() call, Claude suggested it might be better to introduce it in the library load sequence in NativeDependencyLoader.java instead and I went with that approach.
To-Do: Write up a more detailed description of the root cause and the solution.