Open VarLad opened 1 week ago
What does cl.svm_capabilities(cl.device())
return?
For both my NVIDIA and AMD GPUs (with Zink), that is, running with:
RUSTICL_ENABLE=zink julia
I get: (coarse_grain_buffer = false, fine_grain_buffer = false, fine_grain_system = false)
I'm guessing that I'll need to wait for proper SVM support in RustiCL to start using OpenCL.jl.
That being said, this is different for CPU.
For CPU (running with RUSTICL_ENABLE=llvmpipe julia
)
I get (coarse_grain_buffer = true, fine_grain_buffer = true, fine_grain_system = true)
But when I try creating an array, I get a slightly different error:
julia> CLArray([1,2])
2-element CLArray{Int64, 1}:
Error showing value of type CLArray{Int64, 1}:
ERROR: CLError(code=-59, CL_INVALID_OPERATION)
Stacktrace:
[1] throw_api_error(res::Int32)
@ OpenCL.cl ~/.julia/packages/OpenCL/VxZWM/lib/cl/libopencl.jl:3
[2] check
@ ~/.julia/packages/OpenCL/VxZWM/lib/cl/libopencl.jl:14 [inlined]
[3] clEnqueueSVMMemcpy
@ ~/.julia/packages/OpenCL/VxZWM/lib/cl/api.jl:34 [inlined]
[4] enqueue_svm_memcpy(dst::Ptr{Int64}, src::Ptr{Int64}, nbytes::Int64; blocking::Bool, wait_for::Vector{OpenCL.cl.Event})
@ OpenCL.cl ~/.julia/packages/OpenCL/VxZWM/lib/cl/svm.jl:63
[5] enqueue_svm_memcpy
@ ~/.julia/packages/OpenCL/VxZWM/lib/cl/svm.jl:57 [inlined]
[6] unsafe_copyto!(dst::Vector{Int64}, dst_off::Int64, src::CLArray{Int64, 1}, src_off::Int64, N::Int64; blocking::Bool)
@ OpenCL ~/.julia/packages/OpenCL/VxZWM/src/array.jl:226
[7] unsafe_copyto!
@ ~/.julia/packages/OpenCL/VxZWM/src/array.jl:222 [inlined]
[8] copyto!
@ ~/.julia/packages/OpenCL/VxZWM/src/array.jl:191 [inlined]
[9] copyto!
@ ~/.julia/packages/OpenCL/VxZWM/src/array.jl:202 [inlined]
[10] Array
@ ~/.julia/packages/OpenCL/VxZWM/src/array.jl:127 [inlined]
[11] Array
@ ./boot.jl:605 [inlined]
[12] convert
@ ./array.jl:607 [inlined]
[13] adapt_storage
@ ~/.julia/packages/GPUArrays/qt4ax/src/host/abstractarray.jl:115 [inlined]
[14] adapt_structure
@ ~/.julia/packages/Adapt/7T9au/src/Adapt.jl:57 [inlined]
[15] adapt
@ ~/.julia/packages/Adapt/7T9au/src/Adapt.jl:40 [inlined]
[16] print_array
@ ~/.julia/packages/GPUArrays/qt4ax/src/host/abstractarray.jl:118 [inlined]
[17] show(io::IOContext{Base.TTY}, ::MIME{Symbol("text/plain")}, X::CLArray{Int64, 1})
@ Base ./arrayshow.jl:399
[18] (::REPL.var"#68#69"{REPL.REPLDisplay{REPL.LineEditREPL}, MIME{Symbol("text/plain")}, Base.RefValue{Any}})(io::Any)
@ REPL ~/.julia/juliaup/julia-1.11.0-rc4+0.x64.linux.gnu/share/julia/stdlib/v1.11/REPL/src/REPL.jl:348
[19] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
@ REPL ~/.julia/juliaup/julia-1.11.0-rc4+0.x64.linux.gnu/share/julia/stdlib/v1.11/REPL/src/REPL.jl:646
[20] display(d::REPL.REPLDisplay, mime::MIME{Symbol("text/plain")}, x::Any)
@ REPL ~/.julia/juliaup/julia-1.11.0-rc4+0.x64.linux.gnu/share/julia/stdlib/v1.11/REPL/src/REPL.jl:334
[21] display
@ ~/.julia/juliaup/julia-1.11.0-rc4+0.x64.linux.gnu/share/julia/stdlib/v1.11/REPL/src/REPL.jl:353 [inlined]
[22] display(x::Any)
@ Base.Multimedia ./multimedia.jl:340
[23] #invokelatest#2
@ ./essentials.jl:1054 [inlined]
[24] invokelatest
@ ./essentials.jl:1051 [inlined]
[25] print_response(errio::IO, response::Any, show_value::Bool, have_color::Bool, specialdisplay::Union{Nothing, AbstractDisplay})
@ REPL ~/.julia/juliaup/julia-1.11.0-rc4+0.x64.linux.gnu/share/julia/stdlib/v1.11/REPL/src/REPL.jl:390
[26] (::REPL.var"#70#71"{REPL.LineEditREPL, Pair{Any, Bool}, Bool, Bool})(io::Any)
@ REPL ~/.julia/juliaup/julia-1.11.0-rc4+0.x64.linux.gnu/share/julia/stdlib/v1.11/REPL/src/REPL.jl:359
[27] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
@ REPL ~/.julia/juliaup/julia-1.11.0-rc4+0.x64.linux.gnu/share/julia/stdlib/v1.11/REPL/src/REPL.jl:646
[28] print_response(repl::REPL.AbstractREPL, response::Any, show_value::Bool, have_color::Bool)
@ REPL ~/.julia/juliaup/julia-1.11.0-rc4+0.x64.linux.gnu/share/julia/stdlib/v1.11/REPL/src/REPL.jl:357
[29] (::REPL.var"#do_respond#96"{Bool, Bool, REPL.var"#112#130"{…}, REPL.LineEditREPL, REPL.LineEdit.Prompt})(s::REPL.LineEdit.MIState, buf::Any, ok::Bool)
@ REPL ~/.julia/juliaup/julia-1.11.0-rc4+0.x64.linux.gnu/share/julia/stdlib/v1.11/REPL/src/REPL.jl:988
[30] #invokelatest#2
@ ./essentials.jl:1054 [inlined]
[31] invokelatest
@ ./essentials.jl:1051 [inlined]
[32] run_interface(terminal::REPL.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
@ REPL.LineEdit ~/.julia/juliaup/julia-1.11.0-rc4+0.x64.linux.gnu/share/julia/stdlib/v1.11/REPL/src/LineEdit.jl:2749
[33] run_frontend(repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef)
@ REPL ~/.julia/juliaup/julia-1.11.0-rc4+0.x64.linux.gnu/share/julia/stdlib/v1.11/REPL/src/REPL.jl:1456
[34] (::REPL.var"#75#81"{REPL.LineEditREPL, REPL.REPLBackendRef})()
@ REPL ~/.julia/juliaup/julia-1.11.0-rc4+0.x64.linux.gnu/share/julia/stdlib/v1.11/REPL/src/REPL.jl:461
Some type information was truncated. Use `show(err)` to see complete types.
Is the latter a display
issue where its having trouble displaying the elements of type CLAarray
on the REPL? 🤔
Is the latter a
display
issue where its having trouble displaying the elements of typeCLAarray
on the REPL? 🤔
Looks like it. Does manually copying back to an Array
work?
I get:
(coarse_grain_buffer = false, fine_grain_buffer = false, fine_grain_system = false)
Guess I didn't add the check; the CLArray
constructor should probably detect this and error out.
Apparently this works (for CPU):
julia> x = CLArray([1,2]);
julia> y = CLArray([2,3]);
julia> v = x + y;
julia> u = x .* y;
julia> typeof(u)
CLArray{Int64, 1}
That's interesting. I wonder if it's something to do with the cross-queue usage of the allocations (the REPL display code runs on another task, which uses another queue).
Tried with AMD Vega8 GPU as well as RTX3050M The command to run julia:
and to reproduce: