-
Notifications
You must be signed in to change notification settings - Fork 1
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
Unable to construct StdVector{CxxPtr{TaskArg}}
from Vector{CxxRef{TaskArg}}
#80
Comments
Using Ray.jl af34bb3 and CxxWrap 0.14.2 on Julia 1.9.3 I see the following: julia> using Ray, CxxWrap; using Ray: ray_jll
julia> Ray.init()
julia> task_args = Ray.serialize_args([1,2,3])
3-element Vector{Any}:
Ray.ray_julia_jll.TaskArgByValueAllocated(Ptr{Nothing} @0x0000600000927e80)
Ray.ray_julia_jll.TaskArgByValueAllocated(Ptr{Nothing} @0x0000600000927fe0)
Ray.ray_julia_jll.TaskArgByValueAllocated(Ptr{Nothing} @0x00006000009248e0)
julia> task_arg_refs = CxxRef.(convert.(ray_jll.TaskArg, task_args))
3-element Vector{CxxRef{Ray.ray_julia_jll.TaskArg}}:
CxxRef{Ray.ray_julia_jll.TaskArg}(Ptr{Ray.ray_julia_jll.TaskArg} @0x0000600000927e80)
CxxRef{Ray.ray_julia_jll.TaskArg}(Ptr{Ray.ray_julia_jll.TaskArg} @0x0000600000927fe0)
CxxRef{Ray.ray_julia_jll.TaskArg}(Ptr{Ray.ray_julia_jll.TaskArg} @0x00006000009248e0)
julia> StdVector{CxxPtr{ray_jll.TaskArg}}(task_arg_refs)
ERROR: MethodError: Cannot `convert` an object of type CxxRef{Ray.ray_julia_jll.TaskArg} to an object of type CxxPtr{Ray.ray_julia_jll.TaskArg}
Closest candidates are:
convert(::Type{T}, ::T) where T
@ Base Base.jl:64
CxxPtr{T}(::CxxWrap.CxxWrapCore.CxxBaseRef) where T
@ CxxWrap ~/.julia/packages/CxxWrap/5IZvn/src/CxxWrap.jl:199
julia> task_arg_ptrs = CxxPtr.(convert.(ray_jll.TaskArg, task_args))
3-element Vector{CxxPtr{Ray.ray_julia_jll.TaskArg}}:
CxxPtr{Ray.ray_julia_jll.TaskArg}(Ptr{Ray.ray_julia_jll.TaskArg} @0x0000600000927e80)
CxxPtr{Ray.ray_julia_jll.TaskArg}(Ptr{Ray.ray_julia_jll.TaskArg} @0x0000600000927fe0)
CxxPtr{Ray.ray_julia_jll.TaskArg}(Ptr{Ray.ray_julia_jll.TaskArg} @0x00006000009248e0)
julia> StdVector{CxxPtr{ray_jll.TaskArg}}(task_arg_ptrs)
ERROR: StackOverflowError:
Stacktrace:
[1] append(v::CxxWrap.StdLib.StdVectorAllocated{CxxPtr{Ray.ray_julia_jll.TaskArg}}, a::Vector{CxxPtr{Ray.ray_julia_jll.TaskArg}})
@ CxxWrap.StdLib ~/.julia/packages/CxxWrap/5IZvn/src/StdLib.jl:33
[2] _append_dispatch(v::CxxWrap.StdLib.StdVectorAllocated{CxxPtr{Ray.ray_julia_jll.TaskArg}}, a::Vector{CxxPtr{Ray.ray_julia_jll.TaskArg}}, #unused#::Type{CxxWrap.CxxWrapCore.IsNormalType})
@ CxxWrap.StdLib ~/.julia/packages/CxxWrap/5IZvn/src/StdLib.jl:29
julia> StdVector{CxxPtr{ray_jll.TaskArg}}(CxxPtr.(task_args))
ERROR: MethodError: Cannot `convert` an object of type
CxxPtr{Ray.ray_julia_jll.TaskArgByValue} to an object of type
CxxPtr{Ray.ray_julia_jll.TaskArg}
Closest candidates are:
convert(::Type{T}, ::T) where T
@ Base Base.jl:64
CxxPtr{T}(::CxxWrap.CxxWrapCore.CxxBaseRef) where T
@ CxxWrap ~/.julia/packages/CxxWrap/5IZvn/src/CxxWrap.jl:199
julia> task_arg_ptr_vec = StdVector{CxxPtr{ray_jll.TaskArg}}()
0-element CxxWrap.StdLib.StdVectorAllocated{CxxPtr{Ray.ray_julia_jll.TaskArg}}
julia> for task_arg in task_args
push!(task_arg_ptr_vec, CxxPtr(task_arg))
end
julia> task_arg_ptr_vec
3-element CxxWrap.StdLib.StdVectorAllocated{CxxPtr{Ray.ray_julia_jll.TaskArg}}:
CxxPtr{Ray.ray_julia_jll.TaskArg}(Ptr{Ray.ray_julia_jll.TaskArg} @0x0000600000927e80)
CxxPtr{Ray.ray_julia_jll.TaskArg}(Ptr{Ray.ray_julia_jll.TaskArg} @0x0000600000927fe0)
CxxPtr{Ray.ray_julia_jll.TaskArg}(Ptr{Ray.ray_julia_jll.TaskArg} @0x00006000009248e0) Seems like we have a little more work to do with the |
omus
changed the title
Cannot convert
Unable to construct Oct 26, 2023
Vector
to StdVector
StdVector{CxxPtr{TaskArg}}
from Vector{CxxRef{TaskArg}}
Fixing this would allow us to drop this function: Lines 212 to 218 in af34bb3
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Originally posted by @omus in #72 (comment)
The text was updated successfully, but these errors were encountered: