-
Notifications
You must be signed in to change notification settings - Fork 39
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
v0.9.0 breaks MacOS #205
Comments
@bhanukumar314 can you please try to install the underlying OpenCL_jll binary: https://github.com/JuliaBinaryWrappers/OpenCL_jll.jl You can |
No change even with OpenCL_jll loaded. (@v1.8) pkg> status OpenCL (@v1.8) pkg> status OpenCL_jll julia> using OpenCL julia> using OpenCL_jll julia> cl.platforms() |
That is not what I asked in the comment. Can you please try to access OpenCL_jll.libopencl? |
I am able to access that variable, as well as the other related ones. It displays julia> OpenCL_jll.libopencl |
Yes, so OpenCL.jl uses OpenCL_jll as the underlying complied C library. The good news is that it is properly installed. Now, can you please confirm that you have a OpenCL driver installed in your machine? I know that MacOS is particularly problematic with OpenCL support. Try to install the PoCL driver for example, or a more specific one for your own hardware. On Ubuntu for example, you have intel-opencl beignet-opencl, etc as possible drivers to recognize the hardware. |
Also, take a look at this post on Discourse: https://discourse.julialang.org/t/opencl-jl-v0-9/88437 |
PoCL installs successfully; also, I had installed clinfo from homebrew and it successfully recognizes the OpenCL platform on my machine. So it's a problem specifically with OpenCL.jl v0.9.0 not being able to recognize it. Here is the clinfo output from the M1 Pro machine. bkumar ~ % clinfo Platform Name Apple NULL platform behavior |
The previous version had a path hard-coded in the case of MacOS as you can see here: https://github.com/JuliaGPU/OpenCL.jl/pull/196/files The idea of using OpenCL_jll is that we install a local library as an artifact and load it instead. Maybe we need to do something else in MacOS to recognize the local library instead of the global one? Can you try to uninstall the global OpenCL or similar experiments? |
Uninstalling the global OpenCL probably isn’t a good idea, since it’s a System library (which potentially other softwares depend on) and these are my main systems which I need to keep functional. There isn’t any straightforward way of uninstalling it anyways on MacOS. Any other ideas? As far as I can tell OpenCL.jl isn’t recognizing any library at all, neither local nor global. |
You need to make sure that the local OpenCL library that is being installed
by OpenCl_jll can find the drivers installed on the system. Can you list
the drivers you have currently installed? I'm typing from my phone right
now...
Em seg., 17 de out. de 2022 22:09, Bhanu Kumar ***@***.***>
escreveu:
… Uninstalling the global OpenCL probably isn’t a good idea, since it’s a
System library (which potentially other softwares depend on) and these are
my main systems which I need to keep functional. There isn’t any
straightforward way of uninstalling it anyways on MacOS. Any other ideas?
As far as I can tell OpenCL.jl isn’t recognizing any library at all,
neither local nor global.
—
Reply to this email directly, view it on GitHub
<#205 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAZQW3JUIRK7JZLHMFIOXRLWDX2FTANCNFSM6AAAAAARHPLDRE>
.
You are receiving this because you commented.Message ID: <JuliaGPU/OpenCL.
***@***.***>
|
The OpenCL driver that Macs use is a custom Apple-developed driver compatible with up to OpenCL 1.2. It is a framework included by default on every Mac; I've copied and pasted below the info about it from the System Information application. OpenCL: Version: 4.7 |
Got it. I don't have a MacOS to debug it myself. Do you have suggestions on how to make the local ICD loader library recognize this global pre-installed driver? Maybe other people had similar issues on MacOS in the past? We are trying to avoid hard-coded paths to pre-installed libraries, and I am assuming that there is a way to make this driver "more visible" to the local library that OpenCL_jll installs. |
So I'm not an OpenCL or Julia development expert myself, but searching around on the internet, my best guess is that this problem is related to the fact that OpenCL is a "library" on Linux and a "framework" on MacOS. OpenCL_jll is generated using BinaryBuilder.jl it seems? BinaryBuilder.jl has different product types for libraries vs frameworks; according to its documentation, frameworks have to be encapsulated as FrameworkProduct types instead of LibraryProduct types. See https://docs.binarybuilder.org/dev/reference/#BinaryBuilderBase.FrameworkProduct However, according to the README.md for OpenCL_jll.jl, it only generates a LibraryProduct for libopencl, which thus I assume would not work on MacOS. |
Also, on MacOS, when compiling (for instance with clang), one does not refer to "libopencl", but just "OpenCL"; thus, for instance, one uses the option -framework OpenCL during compilation on MacOS instead of -lopencl during compilation. See for instance https://stackoverflow.com/questions/49656832/what-is-the-lopencl-on-mac I have zero experience with BinaryBuilder.jl, but perhaps this is enough information for you to understand a potential solution? |
@giordano can you give a hand here? |
@bhanukumar314 I think one way forward is try to generate the PoCL_jll driver with BinaryBuilder.jl and add it here as a dependency so that the local OpenCL_jll installation can find a safe driver always independently of MaCOS, Windows, Linux etc. |
Of course adding PoCL would not hurt, but PoCL as far as I’m aware doesn’t support most AMD GPUs, which is what all the newer Intel Macs have. I also don’t know if it works with Apple Silicon or not; it would be best if the FrameworkProduct for Apple’s OpenCL implementation can just be added to OpenCL_jll. |
If you can help with this framework detail @bhanukumar314 that would be super helpful. I am not a MacOS users myself and am quite busy with other activities currently to stop and try to fix the issue, unfortunately. |
What exactly is the incompatibility between the Khronos ICD loader from OpenCL_jll and macOS' libOpenCL.jl? If it's just a missing ICD specification, that can be overridden with environment variables: OCL_ICD_FILENAMES or OCL_ICD_VENDORS. In fact, I recently reworked OpenCL_jll to automatically set these based on a global array, e.g., as done here by pocl_jll: https://github.com/JuliaBinaryWrappers/pocl_jll.jl/blob/6c8509126286a8dcbce574a96871aa633ac3bda1/src/wrappers/aarch64-apple-darwin-llvm_version%2B14.asserts.jl#L28 Could you try if adding the path to macOS' libOpenCL.dylib (or whatever it's called; I have an M-series processor so can't test) to the OpenCL_jll.drivers array makes OpenCL.jl detect the Apple OpenCL implementation? |
Okay, I found out that even my M3 macbook still has a functioning OpenCL framework, see #221. However, with OpenCL being officially deprecated on macOS since 2018 (10.14), I don't think we should keep this open as an issue. If anybody really needs native macOS support, I'd suggest using an older version of OpenCL.jl, or having a look at the linked PR. |
v0.9.0 seems to have broken the library's functionality on MacOS (at least on Monterey, where I tested it). The library fails to find the Apple OpenCL platform. The same behavior is seen both on the Apple Silicon build of Julia (tested on an M1 Pro 16 inch MacBook Pro) as well as on the Intel x86-64 build of Julia (tested on an i9 16 inch MacBook Pro).
On v0.9.0:
julia> cl.platforms()
ERROR: CLError(code=-1001, CL_PLATFORM_NOT_FOUND_KHR)
Stacktrace:
[1] macro expansion
@ ~/.julia/packages/OpenCL/BTcrM/src/macros.jl:6 [inlined]
[2] platforms()
@ OpenCL.cl ~/.julia/packages/OpenCL/BTcrM/src/platform.jl:43
[3] top-level scope
@ none:1
On v0.8.1
julia> cl.platforms()
1-element Vector{OpenCL.cl.Platform}:
OpenCL.Platform('Apple' @0x000000007fff0000)
The text was updated successfully, but these errors were encountered: