Closed clasqui closed 1 year ago
My suggestion here is that, instead of letting @ccall
implicitly convert types, we expand the function in FFI to do ourselves the conversion
I don't think that is necessary. We just need to tell correctly the type. My guess is that instead of
..., values::Ref{Value}, ...
it should be
..., values::Ref{Vector{Value}}, ...
Can you try that?
Yep, this is what I already tried yesterday in PR #12
This solves the conversion for the values
parameter, but then another issue with the conversion of the descs
strings vector appears
Nice! Good catch. Merging now.
Wait @mofeing !! This was not the only issue with the type conversion in register :sweat_smile: after ai solved the first one, another one appeared! That's what I wanted to discuss with you
Ahh, okok. Tell me.
Next one is relative to the conversion of the descs
parameter:
ERROR: LoadError: MethodError: no method matching unsafe_convert(::Type{Ptr{Ptr{UInt8}}}, ::Base.RefValue{Vector{String}})
Closest candidates are:
unsafe_convert(::Type{Ptr{Tv}}, ::SuiteSparse.CHOLMOD.Sparse{Tv}) where Tv at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/SuiteSparse/src/cholmod.jl:296
unsafe_convert(::Type{Ptr{T}}, ::LinearAlgebra.Transpose{var"#s814", var"#s813"} where {var"#s814", var"#s813"<:(AbstractVecOrMat{T} where T)}) where T at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/LinearAlgebra/src/adjtrans.jl:222
unsafe_convert(::Type{Ptr{T}}, ::SharedArrays.SharedArray{T, N} where N) where T at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/SharedArrays/src/SharedArrays.jl:361
...
Stacktrace:
[1] Extrae_define_event_type(type::Int64, type_description::String, nvalues::Int64, values::Vector{Int64}, values_description::Base.RefValue{Vector{String}})
@ Extrae.FFI ~/Documents/BePPP/cobrexa/Extrae.jl/src/FFI.jl:134
[2] register(events::Vector{Event{400001, ValueCode} where ValueCode}, desc::String)
@ Extrae ~/Documents/BePPP/cobrexa/Extrae.jl/src/API.jl:139
[3] register
@ ~/Documents/BePPP/cobrexa/Extrae.jl/src/API.jl:132 [inlined]
[4] init()
@ Extrae ~/Documents/BePPP/cobrexa/Extrae.jl/src/API.jl:37
[5] addprocs_extrae(np::Int64; restrict::Bool, kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ Extrae ~/Documents/BePPP/cobrexa/Extrae.jl/src/Instrumentation/Distributed.jl:124
[6] addprocs_extrae(np::Int64)
@ Extrae ~/Documents/BePPP/cobrexa/Extrae.jl/src/Instrumentation/Distributed.jl:120
[7] top-level scope
@ ~/Documents/BePPP/cobrexa/Extrae.jl/scripts/test-distributed-work.jl:4
in expression starting at /home/mclasca/Documents/BePPP/cobrexa/Extrae.jl/scripts/test-distributed-work.jl:4
I did what is suggested in https://docs.julialang.org/en/v1/manual/calling-c-and-fortran-code/
I think the solution should be similar: remove the Ref(descs)
and leave only descs
in the register
function.
This shows another error, but I am not sure now if it is the same place (our solution was not correct) or another place (so we solved previous issue).
ERROR: LoadError: MethodError: no method matching String(::Int64)
Closest candidates are:
String(::String) at boot.jl:350
String(::Vector{UInt8}) at strings/string.jl:53
String(::Symbol) at strings/string.jl:83
...
Stacktrace:
[1] description(#unused#::Type{Event{400004, 0}})
@ Extrae ~/Documents/BePPP/cobrexa/Extrae.jl/src/API.jl:104
[2] description(#unused#::Event{400004, 0})
@ Extrae ~/Documents/BePPP/cobrexa/Extrae.jl/src/API.jl:105
[3] _broadcast_getindex_evalf
@ ./broadcast.jl:648 [inlined]
[4] _broadcast_getindex
@ ./broadcast.jl:621 [inlined]
[5] _getindex
@ ./broadcast.jl:645 [inlined]
[6] _getindex
@ ./broadcast.jl:644 [inlined]
[7] _broadcast_getindex
@ ./broadcast.jl:620 [inlined]
[8] getindex
@ ./broadcast.jl:575 [inlined]
[9] copy
@ ./broadcast.jl:922 [inlined]
[10] materialize
@ ./broadcast.jl:883 [inlined]
[11] register(events::Vector{Event{400004, ValueCode} where ValueCode}, desc::String)
@ Extrae ~/Documents/BePPP/cobrexa/Extrae.jl/src/API.jl:138
[12] register
@ ~/Documents/BePPP/cobrexa/Extrae.jl/src/API.jl:132 [inlined]
The error happens because description(::typeof(DistributedHandleEnd))
is not defined. Uploading a fix now.
When registering an event type, this error arises:
The cause seems to be the conversion of the vector of event values from Ref(Vector{Int64}) to Uint64, which is the type specified in https://github.com/bsc-quantic/Extrae.jl/blob/1ddee26d9b227d8675c558d62debb89b1619cd2b/src/FFI.jl#L134 for the
vlaues
parameter.My thought here is that Julia is not interpreting the vector as a pointer, which is something that we straightforward do in C.