-
Notifications
You must be signed in to change notification settings - Fork 165
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
dlopen libOpenCL by SONAME to support split prefix distributions #472
Comments
Thank you for rootcausing the issue! Looks like the issue is in Intel oneMKL product, so I reported the problem to the product team. Should be fixed in the next releases. |
Ah OK, I didn't realize this tracker is only for the interfaces. Yes, this issue can be closed then. What's the place to file issues against oneMKL itself then? #473 would probably be better suited there as well. |
For Intel oneMKL related problems we usually work with |
Please note, the fix for OpenCL library loading is available in oneMKL 2024.2 and 2024.2.1 latest releases. |
Summary
MKL dynamically loads
libOpenCL.so
by doingdlopen("libOpenCL.so")
. This ignores any previously loaded copy of the OpenCL loader, and instead MKL shoulddlopen
by SONAME to re-use the already loaded copy.Version
oneMKL from oneAPI 2024.1.0
Environment
Tested on Linux with MKL installed from Conda.
Observed behavior
At run time, oneMKL dynamically loads
libOpenCL.so
, for example here during execution ofsgemm
:It does so by simply calling
dlopen("libOpenCL.so")
. This is problematic because it does not respect any previously loaded copy of the OpenCL loader, as can be seen in theLD_DEBUG=libs
output of my application, here resulting in multiple copies oflibOpenCL
getting loaded:Although
libOpenCL.so
seems to be fine with multiple copies of the library getting loaded, it doesn't seem like a good idea. What's worse is that there might not be a globally discoverablelibOpenCL.so
, resulting in MKL breaking down when it tries to loadlibOpenCL.so
:Expected behavior
MKL should load
libOpenCL.so
by SONAME, by simply switching (or first trying) todlopen("libOpenCL.so.1")
. This would allow MKL to re-use the already loaded copy of the OpenCL loader, and avoid the issues with multiple copies of the library getting loaded, or the library not being found at all.The above situation is common with environments that use so-called split prefixes, where libraries are not globally discoverable. In Julia, we make sure the necessary dependencies are discoverable by eagerly
dlopen
ing them, leading to the situation described above. However, there are other projects using similar split prefixes, like Nix and spack, so this issue is not limited to Julia.The text was updated successfully, but these errors were encountered: