Skip to content
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

Failing offsetarrays test #28101

Closed
martinholters opened this issue Jul 13, 2018 · 7 comments
Closed

Failing offsetarrays test #28101

martinholters opened this issue Jul 13, 2018 · 7 comments

Comments

@martinholters
Copy link
Member

https://freebsdci.julialang.org/#/builders/1/builds/11271 (master):

Error in testset offsetarray:
Test Failed at /home/julia/ci/worker/11rel-amd64/build/test/offsetarray.jl:365
  Expression: maximum(A, dims=1) == OffsetArray(maximum(parent(A), dims=1), A.offsets)
   Evaluated: [0.949121 0.374514 0.839718 0.883561] == [0.949121 0.170196 0.839718 0.883561]

https://freebsdci.julialang.org/#builders/1/builds/11275 (#28079):

Error in testset offsetarray:
Test Failed at /usr/home/julia/julia-fbsd-buildbot/worker/11rel-amd64/build/test/offsetarray.jl:365
  Expression: maximum(A, dims=1) == OffsetArray(maximum(parent(A), dims=1), A.offsets)
   Evaluated: [0.933049 0.721069 0.480884 0.692188] == [0.933049 0.721069 0.369098 0.692188]

https://freebsdci.julialang.org/#/builders/1/builds/11274 (#28099):

Error in testset offsetarray:
Test Failed at /home/julia/ci/worker/11rel-amd64/build/test/offsetarray.jl:365
  Expression: maximum(A, dims=1) == OffsetArray(maximum(parent(A), dims=1), A.offsets)
   Evaluated: [0.658427 0.962348 0.890035 0.473921] == [0.658427 0.962348 0.890035 0.372744]

https://travis-ci.org/JuliaLang/julia/jobs/403462714 (master):

Error in testset offsetarray:
Test Failed at /tmp/julia/share/julia/test/offsetarray.jl:365
  Expression: maximum(A, dims=1) == OffsetArray(maximum(parent(A), dims=1), A.offsets)
   Evaluated: [0.814057 0.837049 0.789705 0.40065] == [0.814057 0.837049 0.789705 0.385899]
@andreasnoack
Copy link
Member

Unfortunately that very much looks like something that #27845 could have caused. Maybe something has changed since the PR CI ran. I can't look into it so maybe we should revert for now.

@andreasnoack
Copy link
Member

Just tried locally though and the tests pass.

@martinholters
Copy link
Member Author

Worth noting: The differing value on the LHS is always (well, in these four cases at least) larger than on the RHS. So it might pick up a wrong initial value which, only with a certain chance, is too large. E.g. a value from another column.

@martinholters
Copy link
Member Author

julia> A = OffsetArray(reshape(16:-1:1, (4, 4)), (-3,5))
OffsetArray{Int64,2,Base.ReshapedArray{Int64,2,StepRange{Int64,Int64},Tuple{}}} with indices -2:1×6:9:
 16  12  8  4
 15  11  7  3
 14  10  6  2
 13   9  5  1

julia> @test maximum(A, dims=1) == OffsetArray(maximum(parent(A), dims=1), A.offsets)
Test Failed at REPL[9]:1
  Expression: maximum(A, dims=1) == OffsetArray(maximum(parent(A), dims=1), A.offsets)
   Evaluated: [16 13 13 13] == [16 12 8 4]
ERROR: There was an error during testing

@andreasnoack
Copy link
Member

Thanks. It's the wrong slice I'm using. Let's revert and I'll come up with something better.

@andreasnoack
Copy link
Member

There seems to be something weird about views of OffsetArrays which is the root cause of this issue here.

julia> A = OffsetArray(reshape(16:-1:1, (4, 4)), (-3,5))
OffsetArray{Int64,2,Base.ReshapedArray{Int64,2,StepRange{Int64,Int64},Tuple{}}} with indices -2:1×6:9:
 16  12  8  4
 15  11  7  3
 14  10  6  2
 13   9  5  1

julia> idx = (Base.Slice(-2:-2), Base.Slice(6:9))
(Base.Slice(-2:-2), Base.Slice(6:9))

julia> A[idx...]
OffsetArray{Int64,2,Array{Int64,2}} with indices -2:-2×6:9:
 16  12  8  4

julia> view(A, idx...)
view(::OffsetArray{Int64,2,Base.ReshapedArray{Int64,2,StepRange{Int64,Int64},Tuple{}}}, :, :) with eltype Int64 with indices -2:-2×6:9:
 16  15  14  13

julia> view(A, idx[1].indices, idx[2].indices)
1×4 view(::OffsetArray{Int64,2,Base.ReshapedArray{Int64,2,StepRange{Int64,Int64},Tuple{}}}, -2:-2, 6:9) with eltype Int64:
 16  12  8  4

cc: @mbauman @timholy

@mbauman
Copy link
Member

mbauman commented Jul 13, 2018

This is due to Slice playing double-duty — it both represents an idempotent vector such that s[i] == i AND it represents an entire axis.

Views exploit the latter for performance. That's what you're running into here. Looks like this problem is more urgent than I had thought. I'll see what I can do here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants