-
Notifications
You must be signed in to change notification settings - Fork 38
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
Error creating context on Julia v0.6 #137
Comments
Is this an error that you can reproduce? |
Can't reproduce using latest master:
|
@dfdx, I am using the Beignet driver on an Intel integrated graphics card: julia> versioninfo()
Julia Version 0.6.1-pre.0
Commit dcf39a1dda* (2017-06-19 13:06 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz
WORD_SIZE: 64
BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
LAPACK: libopenblas64_
LIBM: libopenlibm
LLVM: libLLVM-3.9.1 (ORCJIT, skylake) Beignet version:
Graphics card:
Do you spot any problem with this configuration right away? I think it was working the first time I compiled Julia v0.6, but I uninstalled beignet from git and installed the stable version from Arch repos. Will anything change if I try to rebuild Julia? |
I'm not sure about stability of Julia 0.6.1, so I'd start with checking out 0.6.0. No package recompilation should be needed, but just in case you can also run The next thing I'd try is to run the same code from |
I am using the branch I will definitely try |
I can create context with pyopencl just fine, so the issue is indeed Julia-related. What else could I try to debug it further? I don't know where to look next. |
@dfdx, this is probably the cause: I appreciate if you can take a look at it, |
I'm not very deep into development of OpenCL.jl itself, so other contributors may be more helpful. But I have a couple of ideas you can try:
As far as I can see, our calls to |
Thank you, I tried with the v0.6 binary and the error is the same. I am on OpenCL I can try another driver, but Beignet was working perfectly fine in previous Julia releases. :/ @tkelman do you think this issue is also due to compiler DLL's? I saw that you fixed similar issue here: |
that issue is windows specific so has nothing to do with this |
I think it's worth to try to recover the old behavior first, i.e. compile beignet from git again. |
@vchuravy could you please give a hand on this issue? I tried creating a context with pyopencl and it is working just fine with the Beignet driver: python> import pyopencl as cl
python> cl.create_some_context(0)
<pyopencl.Context at 0x30787d0 on <pyopencl.Device 'Intel(R) HD Graphics Skylake ULT GT2' on 'Intel Gen OCL Driver' at 0x7f1023dcef60>> The same attempt with julia> using OpenCL
julia> cl.create_some_context()
ERROR: ReadOnlyMemoryError()
Stacktrace:
[1] clGetPlatformIDs(::Int64, ::Ptr{Void}, ::Base.RefValue{UInt32}) at /home/juliohm/.julia/v0.6/OpenCL/src/api.jl:17
[2] macro expansion at /home/juliohm/.julia/v0.6/OpenCL/src/macros.jl:4 [inlined]
[3] platforms() at /home/juliohm/.julia/v0.6/OpenCL/src/platform.jl:21
[4] create_some_context() at /home/juliohm/.julia/v0.6/OpenCL/src/context.jl:235 Given this experiment, I am sure this issue is not on the driver side. I appreciate if you can take a look at it when you have some time. |
Problem solved out of nowhere, probably some driver update. |
The issue is back, PyOpenCL works fine. |
I can reproduce the issue with: nplatforms = Ref{UInt32}()
cl.api.clGetPlatformIDs(0, C_NULL, nplatforms)
ERROR: ReadOnlyMemoryError()
Stacktrace:
[1] clGetPlatformIDs(::Int64, ::Ptr{Void}, ::Base.RefValue{UInt32}) at /home/juliohm/.julia/v0.6/OpenCL/src/api.jl:15 My clinfo output shows that the |
reduce to ccall? julia> n = Ref{UInt32}()
Base.RefValue{UInt32}(0x0000000b)
julia> ccall((:clGetPlatformIDs, :libOpenCL), Cint, (Cuint, Ptr{Cuint}, Ptr{UInt32}), 0, C_NULL, n)
0
julia> n
Base.RefValue{UInt32}(0x00000002) |
Same error @iblis17 , the Any suggestion for next debugging steps? |
You are on Linux right?
On my system I eventually get something like:
Telling me that My suspicion is that they will be different |
Hi @vchuravy , the first time I run, there is a lot of output, maybe part of it is cropped at the very beginning, but there is no reference to libOpenCL. Is there any way to redirect this output to a file, my terminal is probably not helping. The second time I run, the output is small, has a reference to libOpenCL in it:
When I do the same operation in Python, it seems to link to beignet's libcl.so file correctly:
If you look at Julia's output, it has the wrong libOpenCL.so that is installed system-wise for some reason. I didn't installed it explicitly as far as I remember. How come Julia finds it first before the Beignet one? Maybe a runtime path issue? I will try to put beignet in front of my libpath to see if anything changes. |
hmm, searching |
@iblis17 I am just wondering why Python can find the correct Beignet library even though it is in a different path? Maybe they do in a more conservative way by querying clinfo or something? |
Julia loads You got an error code there:
So something on your system is missconfigured. Are you on a debian system? If so you can try:
|
@vchuravy the error -1001 only happens when I try to run the call for the second time. The first call returns the ReadMemoryError. I am on Arch Linux, this is what I get from Python and Julia with LD_DEBUG=libs Python
Julia
|
|
This is what I get as well: /usr/lib/libOpenCL.so is owned by ocl-icd 2.2.11-1 |
So the difference that I am seeing is that. Julia uses |
I get the same owner:
|
Julia also links with /usr/lib/beignet/libcl.so beside libOpenCL.so is that expected? |
Yes it is, but I just noticed something else. |
So Julia is building with LLVM 3.9, do you think if I rebuild Julia with system's LLVM 5.0 the issue can go away? I can also give a second try on Julia from Arch repo, it seems like following the release cycle well. |
Giving it a try, building Julia again with USE_LLVM=1 in Make.inc |
Oh yes, I remember, Julia doesn't support LLVM 5.0 right? What is a solution to this issue then? The build just failed. |
🤔 I don't think 0.6 can work with LLVM 5.0 and |
Will Julia v0.7 (and v1.0) support more recent versions of LLVM? Or there is any alternative solution to this situation with OpenCL? |
on 0.7, LLVM 5.0 compiles, but not regularly tested. LLVM 6.0 doesn't compiled, IIRC. |
maybe you can
then, hack the cmake file to build with Julia's LLVM |
seems beignet supports LLVM 3.9 |
I will try build Julia v0.7 from master, thank you for the info. |
I can confirm that the |
@juliohm can you try JuliaLang/julia#24890 with v0.7 (and LLVM 3.9.1)? |
@vchuravy could you please confirm I just need to clone inhorton's fork, checkout his branch with the fix, and build it with LLVM 3.9? |
Building it, I will report the success or not of the attempt soon it is done. Thanks. |
I can confirm that cloning that branch and building it with no changes to the |
Check your versioninfo().
…On Tue, Jan 16, 2018, 00:01 Júlio Hoffimann ***@***.***> wrote:
I can confirm that cloning that branch and building it with no changes to
the Make.inc has worked well with the ccall we have been trying. How can
I make sure it is linking to LLVM 3.9?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#137 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAI3alPdMXEuCrkCCUqjvAvyL1T0DWkyks5tLC1FgaJpZM4OErM0>
.
|
LLVM 3.9.1 confirmed:
|
I hit this exact issue (arch linux /w beignet). So glad I found the info here! I'm not quite ready to jump to 0.7, so I recompiled beignet against llvm3.9:
Now OpenCL.jl on 0.6.2 seems to work! edit: I was getting warnings printed about "X server found. dri2 connection failed!", which appears to be a wayland issue - switching to Xorg solved the issue and I new/future versions of wayland shouldn't print the error. |
@ssfrr How do you tell cmake to use clang-3.9? I'm finding that after running cmake as you suggest above that when I look in the CMakeCache.txt file that clang-3.6 is being used. |
I'm not sure, I don't think I needed to do anything magical. Maybe I didn't have any other versions of clang installed when I ran the install? I'm not familiar with the beignet build process other than what I listed above, but perhaps you can just manually edit the paths within the |
Apparently you edit the build/CMakeCache.txt file and change all the '3.6' to '3.9' - I'm not entirely sure if that's the official cmake-way, but I think that worked. Not entirely sure how that CMakeCache.txt gets used by the generated Makefile but didn't dig very deep into that makefile. I'd guess the better way to do this would be to add something on the cmake commandline, but I'm not sure what that would be. |
Closing the issue since the information here refers to Julia v0.6 and Julia v0.7 era. The situation of OpenCL.jl in recent Julia versions is still problematic though. |
Could you please help in solving this issue?
The text was updated successfully, but these errors were encountered: