Closed ranocha closed 3 years ago
I observe the same error, but only on a fresh run (either new REPL or the test environment)
Here is an MWE using julia --threads=2
.
julia> using Pkg; Pkg.status(["Polyester", "ThreadingUtilities"], mode=PKGMODE_MANIFEST)
Status `~/.julia/environments/v1.6/Manifest.toml`
[f517fe37] Polyester v0.3.2
[8290d209] ThreadingUtilities v0.4.5
julia> using Polyester
julia> struct Wrapper{T}
src::T
end
julia> getsrc(w::Wrapper) = w.src
getsrc (generic function with 1 method)
julia> function foo!(dest, wrapper)
@batch for i in eachindex(dest)
dest[i] = getsrc(wrapper)[i]
end
end
foo! (generic function with 1 method)
julia> dest = zeros(10); wrapper = Wrapper(zero(dest) .+ 1);
julia> foo!(dest, wrapper)
Task
next: Nothing nothing
queue: Nothing nothing
storage: Nothing nothing
donenotify: Base.GenericCondition{Base.Threads.SpinLock}
waitq: Base.InvasiveLinkedList{Task}
head: Nothing nothing
tail: Nothing nothing
lock: Base.Threads.SpinLock
owned: Int64 0
result: MethodError
f: getsrc (function of type typeof(getsrc))
args: Tuple{StrideArraysCore.Reference{Wrapper{Vector{Float64}}}}
1: StrideArraysCore.Reference{Wrapper{Vector{Float64}}}
data: Wrapper{Vector{Float64}}
src: Array{Float64}((10,)) [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
world: UInt64 0x00000000000073be
logstate: Nothing nothing
code: ThreadingUtilities.ThreadTask
p: Ptr{UInt64} @0x00007fead8b0dd00
_state: UInt8 0x02
sticky: Bool true
_isexception: Bool true
julia> dest # should have entries `1.0` everywhere
10-element Vector{Float64}:
0.0
0.0
0.0
0.0
0.0
1.0
1.0
1.0
1.0
1.0
The old release v0.4.4 of ThreadingUtilities works fine in this case.
julia> using Pkg; Pkg.status(["Polyester", "ThreadingUtilities"], mode=PKGMODE_MANIFEST)
Status `~/.julia/environments/v1.6/Manifest.toml`
[f517fe37] Polyester v0.3.2
[8290d209] ThreadingUtilities v0.4.4
julia> using Polyester
[ Info: Precompiling Polyester [f517fe37-dbe3-4b94-8317-1923a5111588]
julia> struct Wrapper{T}
src::T
end
julia> getsrc(w::Wrapper) = w.src
getsrc (generic function with 1 method)
julia> function foo!(dest, wrapper)
@batch for i in eachindex(dest)
dest[i] = getsrc(wrapper)[i]
end
end
foo! (generic function with 1 method)
julia> dest = zeros(10); wrapper = Wrapper(zero(dest) .+ 1);
julia> foo!(dest, wrapper)
julia> dest # should have entries `1.0` everywhere
10-element Vector{Float64}:
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
Great! Thanks a lot for the quick fixes :+1:
It looks like the newest updates of Polyester and/or this package broke our threaded tests at Trixi.jl:
https://github.com/trixi-framework/Trixi.jl/runs/3015829388?check_suite_focus=true#step:6:14705
I might be able to reproduce some MWE later...