Skip to content

Commit

Permalink
Adjust code after arrayview from getindex to make tests pass
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasnoack committed Nov 23, 2014
1 parent c68b696 commit ae4a176
Show file tree
Hide file tree
Showing 16 changed files with 66 additions and 58 deletions.
4 changes: 2 additions & 2 deletions base/LineEdit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -432,10 +432,10 @@ function edit_move_up(s)
end

function edit_move_down(buf::IOBuffer)
npos = rsearch(buf.data[1:buf.size], '\n', position(buf))
npos = rsearch(copy(buf.data[1:buf.size]), '\n', position(buf))
# We're interested in character count, not byte count
offset = length(bytestring(buf.data[(npos+1):(position(buf))]))
npos2 = search(buf.data[1:buf.size], '\n', position(buf)+1)
npos2 = search(copy(buf.data[1:buf.size]), '\n', position(buf)+1)
if npos2 == 0 #we're in the last line
return false
end
Expand Down
2 changes: 1 addition & 1 deletion base/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ function splice!(a::Vector, i::Integer, ins=_default_splice)
end

function splice!{T<:Integer}(a::Vector, r::UnitRange{T}, ins=_default_splice)
v = a[r]
v = copy(a[r])
m = length(ins)
if m == 0
deleteat!(a, r)
Expand Down
2 changes: 1 addition & 1 deletion base/darray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function chunk_idxs(dims, chunks)
idxs, cuts
end

function localpartindex(pmap::Vector{Int})
function localpartindex(pmap::StridedVector{Int})
mi = myid()
for i = 1:length(pmap)
if pmap[i] == mi
Expand Down
2 changes: 1 addition & 1 deletion base/help.jl
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function print_help_entries(io::IO, entries)
end
end

func_expr_from_symbols(s::Vector{Symbol}) = length(s) == 1 ? s[1] : Expr(:., func_expr_from_symbols(s[1:end-1]), Expr(:quote, s[end]))
func_expr_from_symbols(s::Vector{Symbol}) = length(s) == 1 ? s[1] : Expr(:., func_expr_from_symbols(copy(s[1:end-1])), Expr(:quote, s[end]))

function help(io::IO, fname::AbstractString, obj=0)
init_help()
Expand Down
6 changes: 3 additions & 3 deletions base/linalg/cholmod.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ const chm_l_com = fill(0xff, chm_com_sz)
## chm_com and chm_l_com must be initialized at runtime because they contain pointers
## to functions in libc.so, whose addresses can change
function cmn(::Type{Int32})
if isnan(reinterpret(Float64,chm_com[1:8])[1])
if isnan(reinterpret(Float64, copy(chm_com[1:8]))[1])
@isok ccall((:cholmod_start, :libcholmod), Cint, (Ptr{UInt8},), chm_com)
end
chm_com
end
function cmn(::Type{Int64})
if isnan(reinterpret(Float64,chm_l_com[1:8])[1])
if isnan(reinterpret(Float64, copy(chm_l_com[1:8]))[1])
@isok ccall((:cholmod_l_start, :libcholmod), Cint, (Ptr{UInt8},), chm_l_com)
end
chm_l_com
Expand Down Expand Up @@ -839,7 +839,7 @@ end

A_ldiv_B!(L::CholmodFactor, B) = L\B # Revisit this to see if allocation can be avoided. It should be possible at least for the right hand side.
(\){T<:CHMVTypes}(L::CholmodFactor{T}, B::CholmodDense{T}) = solve(L, B, CHOLMOD_A)
(\){T<:CHMVTypes}(L::CholmodFactor{T}, b::Vector{T}) = reshape(solve(L, CholmodDense!(b), CHOLMOD_A).mat, length(b))
(\){T<:CHMVTypes}(L::CholmodFactor{T}, b::StridedVector{T}) = reshape(solve(L, CholmodDense!(convert(Vector{T}, b)), CHOLMOD_A).mat, length(b))
(\){T<:CHMVTypes}(L::CholmodFactor{T}, B::Matrix{T}) = solve(L, CholmodDense!(B),CHOLMOD_A).mat
function (\){Tv<:CHMVTypes,Ti<:CHMITypes}(L::CholmodFactor{Tv,Ti},B::CholmodSparse{Tv,Ti})
solve(L,B,CHOLMOD_A)
Expand Down
2 changes: 1 addition & 1 deletion base/linalg/dense.jl
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ function inv{S}(A::StridedMatrix{S})
return convert(typeof(Ac), Ai)
end

function factorize{T}(A::Matrix{T})
function factorize{T}(A::StridedMatrix{T})
m, n = size(A)
if m == n
if m == 1 return A[1] end
Expand Down
6 changes: 3 additions & 3 deletions base/linalg/factorization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,19 @@ convert{T}(::Type{Factorization{T}}, A::QRPivoted) = convert(QRPivoted{T}, A)

function getindex(A::QR, d::Symbol)
m, n = size(A)
d == :R && return triu!(A.factors[1:min(m,n), 1:n])
d == :R && return triu(A.factors[1:min(m,n), 1:n])
d == :Q && return QRPackedQ(A.factors,A.τ)
throw(KeyError(d))
end
function getindex(A::QRCompactWY, d::Symbol)
m, n = size(A)
d == :R && return triu!(A.factors[1:min(m,n), 1:n])
d == :R && return triu(A.factors[1:min(m,n), 1:n])
d == :Q && return QRCompactWYQ(A.factors,A.T)
throw(KeyError(d))
end
function getindex{T}(A::QRPivoted{T}, d::Symbol)
m, n = size(A)
d == :R && return triu!(A.factors[1:min(m,n), 1:n])
d == :R && return triu(A.factors[1:min(m,n), 1:n])
d == :Q && return QRPackedQ(A.factors,A.τ)
d == :p && return A.jpvt
if d == :P
Expand Down
59 changes: 31 additions & 28 deletions base/linalg/lapack.jl
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ for (tzrzf, ormrz, elty) in
function tzrzf!(A::StridedMatrix{$elty})
m, n = size(A)
if n < m throw(DimensionMismatch("matrix cannot have fewer columns than rows")) end
lda = max(1, m)
lda = stride(A, 2)
tau = similar(A, $elty, m)
work = Array($elty, 1)
lwork = -1
Expand All @@ -434,7 +434,7 @@ for (tzrzf, ormrz, elty) in
ccall(($(blasfunc(tzrzf)), liblapack), Void,
(Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt},
Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt}, Ptr{BlasInt}),
&m, &n, A, &lda,
&m, &n, A, &max(1, lda),
tau, work, &lwork, info)
if i == 1
lwork = blas_int(real(work[1]))
Expand Down Expand Up @@ -2025,19 +2025,19 @@ for (trcon, trevc, trrfs, elty) in
#Decide what exactly to return
if howmny=='S' #compute selected eigenvectors
if side=='L' #left eigenvectors only
return select, VL[:,1:m[1]]
return select, copy(VL[:,1:m[1]])
elseif side=='R' #right eigenvectors only
return select, VR[:,1:m[1]]
return select, copy(VR[:,1:m[1]])
else #side=='B' #both eigenvectors
return select, VL[:,1:m[1]], VR[:,1:m[1]]
return select, copy(VL[:,1:m[1]]), copy(VR[:,1:m[1]])
end
else #compute all eigenvectors
if side=='L' #left eigenvectors only
return VL[:,1:m[1]]
return copy(VL[:,1:m[1]])
elseif side=='R' #right eigenvectors only
return VR[:,1:m[1]]
return copy(VR[:,1:m[1]])
else #side=='B' #both eigenvectors
return VL[:,1:m[1]], VR[:,1:m[1]]
return copy(VL[:,1:m[1]]), copy(VR[:,1:m[1]])
end
end
end
Expand Down Expand Up @@ -2144,19 +2144,19 @@ for (trcon, trevc, trrfs, elty, relty) in
#Decide what exactly to return
if howmny=='S' #compute selected eigenvectors
if side=='L' #left eigenvectors only
return select, VL[:,1:m[1]]
return select, copy(VL[:,1:m[1]])
elseif side=='R' #right eigenvectors only
return select, VR[:,1:m[1]]
return select, copy(VR[:,1:m[1]])
else #side=='B' #both eigenvectors
return select, VL[:,1:m[1]], VR[:,1:m[1]]
return select, copy(VL[:,1:m[1]]), copy(VR[:,1:m[1]])
end
else #compute all eigenvectors
if side=='L' #left eigenvectors only
return VL[:,1:m[1]]
return copy(VL[:,1:m[1]])
elseif side=='R' #right eigenvectors only
return VR[:,1:m[1]]
return copy(VR[:,1:m[1]])
else #side=='B' #both eigenvectors
return VL[:,1:m[1]], VR[:,1:m[1]]
return copy(VL[:,1:m[1]]), copy(VR[:,1:m[1]])
end
end
end
Expand Down Expand Up @@ -2243,7 +2243,7 @@ for (stev, stebz, stegr, stein, elty) in
w, iblock, isplit, work,
iwork, info)
@lapackerror
w[1:m[1]], iblock[1:m[1]], isplit[1:nsplit[1]]
copy(w[1:m[1]]), copy(iblock[1:m[1]]), copy(isplit[1:nsplit[1]])
end
#* DSTEGR computes selected eigenvalues and, optionally, eigenvectors
#* of a real symmetric tridiagonal matrix T. Any such unreduced matrix has
Expand Down Expand Up @@ -2288,7 +2288,7 @@ for (stev, stebz, stegr, stein, elty) in
end
end
@lapackerror
w[1:m[1]], Z[:,1:m[1]]
copy(w[1:m[1]]), copy(Z[:,1:m[1]])
end
#* DSTEIN computes the eigenvectors of a real symmetric tridiagonal
#* matrix T corresponding to specified eigenvalues, using inverse
Expand All @@ -2297,7 +2297,8 @@ for (stev, stebz, stegr, stein, elty) in
# $ IWORK, IFAIL, INFO )
# We allow the user to specify exactly which eigenvectors to get by
# specifying the eigenvalues (which may be approximate) via w_in
function stein!(dv::Vector{$elty}, ev_in::Vector{$elty}, w_in::Vector{$elty}, iblock_in::Vector{BlasInt}, isplit_in::Vector{BlasInt})
function stein!(dv::StridedVector{$elty}, ev_in::StridedVector{$elty}, w_in::StridedVector{$elty}, iblock_in::StridedVector{BlasInt}, isplit_in::StridedVector{BlasInt})
chkstride1(dv, ev_in, w_in, iblock_in, isplit_in)
n = length(dv)
if length(ev_in) != (n-1) throw(DimensionMismatch("stein!")) end
ev = [ev_in; zeros($elty,1)]
Expand Down Expand Up @@ -2341,12 +2342,12 @@ for (stev, stebz, stegr, stein, elty) in
end
end
end
stegr!(jobz::BlasChar, dv::Vector, ev::Vector) = stegr!(jobz, 'A', dv, ev, 0.0, 0.0, 0, 0)
stegr!(jobz::BlasChar, dv::StridedVector, ev::StridedVector) = stegr!(jobz, 'A', dv, ev, 0.0, 0.0, 0, 0)

# Allow user to skip specification of iblock and isplit
stein!(dv::Vector, ev::Vector, w_in::Vector)=stein!(dv, ev, w_in, zeros(BlasInt,0), zeros(BlasInt,0))
stein!(dv::StridedVector, ev::StridedVector, w_in::StridedVector) = stein!(dv, ev, w_in, zeros(BlasInt,0), zeros(BlasInt,0))
# Allow user to specify just one eigenvector to get in stein!
stein!(dv::Vector, ev::Vector, eval::Real)=stein!(dv, ev, [eval], zeros(BlasInt,0), zeros(BlasInt,0))
stein!(dv::StridedVector, ev::StridedVector, eval::Real) = stein!(dv, ev, [eval], zeros(BlasInt,0), zeros(BlasInt,0))

## (SY) symmetric real matrices - Bunch-Kaufman decomposition,
## solvers (direct and factored) and inverse.
Expand Down Expand Up @@ -2900,7 +2901,7 @@ for (syev, syevr, sygvd, elty) in
iwork = Array(BlasInt, liwork)
end
end
w[1:m[1]], Z[:,1:(jobz == 'V' ? m[1] : 0)]
copy(w[1:m[1]]), copy(Z[:,1:(jobz == 'V' ? m[1] : 0)])
end
syevr!(jobz::BlasChar, A::StridedMatrix{$elty}) = syevr!(jobz, 'A', 'U', A, 0.0, 0.0, 0, 0, -1.0)
# Generalized eigenproblem
Expand Down Expand Up @@ -3045,7 +3046,7 @@ for (syev, syevr, sygvd, elty, relty) in
iwork = Array(BlasInt, liwork)
end
end
w[1:m[1]], Z[:,1:(jobz == 'V' ? m[1] : 0)]
copy(w[1:m[1]]), copy(Z[:,1:(jobz == 'V' ? m[1] : 0)])
end
syevr!(jobz::BlasChar, A::StridedMatrix{$elty}) = syevr!(jobz, 'A', 'U', A, 0.0, 0.0, 0, 0, -1.0)
# SUBROUTINE ZHEGVD( ITYPE, JOBZ, UPLO, N, A, LDA, B, LDB, W, WORK,
Expand Down Expand Up @@ -3125,6 +3126,8 @@ for (bdsqr, relty, elty) in
# Do checks
@chkuplo
length(e_) == n - 1 || throw(DimensionMismatch("off-diagonal has length $(length(e_)) but should have length $(n - 1)"))
size(Vt, 1) == n || throw(DimensionMismatch("first dimension of matrix Vt has length $(size(Vt, 1)), but should be $n"))
size(C, 1) == n || throw(DimensionMismatch("first dimension of matrix C has length $(size(C, 1)), but should be $n"))
if ncvt > 0
ldvt >= n || throw(DimensionMismatch("leading dimension of Vt must be at least $n"))
end
Expand Down Expand Up @@ -3228,7 +3231,7 @@ for (gecon, elty) in
# DOUBLE PRECISION A( LDA, * ), WORK( * )
chkstride1(A)
n = chksquare(A)
lda = max(1, stride(A, 2))
lda = stride(A, 2)
rcond = Array($elty, 1)
work = Array($elty, 4n)
iwork = Array(BlasInt, n)
Expand All @@ -3237,7 +3240,7 @@ for (gecon, elty) in
(Ptr{UInt8}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt},
Ptr{$elty}, Ptr{$elty}, Ptr{$elty}, Ptr{BlasInt},
Ptr{BlasInt}),
&normtype, &n, A, &lda, &anorm, rcond, work, iwork,
&normtype, &n, A, &max(1, lda), &anorm, rcond, work, iwork,
info)
@lapackerror
rcond[1]
Expand All @@ -3262,7 +3265,7 @@ for (gecon, elty, relty) in
# COMPLEX*16 A( LDA, * ), WORK( * )
chkstride1(A)
n = size(A, 2)
lda = max(1, size(A, 1))
lda = stride(A, 2)
rcond = Array($relty, 1)
work = Array($elty, 2n)
rwork = Array($relty, 2n)
Expand All @@ -3271,7 +3274,7 @@ for (gecon, elty, relty) in
(Ptr{BlasChar}, Ptr{BlasInt}, Ptr{$elty}, Ptr{BlasInt},
Ptr{$relty}, Ptr{$relty}, Ptr{$elty}, Ptr{$relty},
Ptr{BlasInt}),
&normtype, &n, A, &lda, &anorm, rcond, work, rwork,
&normtype, &n, A, &max(1, lda), &anorm, rcond, work, rwork,
info)
@lapackerror
rcond[1]
Expand Down Expand Up @@ -3441,7 +3444,7 @@ for (gees, gges, elty) in
end
end
@lapackerror
A, B, complex(alphar, alphai), beta, vsl[1:(jobvsl == 'V' ? n : 0),:], vsr[1:(jobvsr == 'V' ? n : 0),:]
A, B, complex(alphar, alphai), beta, copy(vsl[1:(jobvsl == 'V' ? n : 0),:]), copy(vsr[1:(jobvsr == 'V' ? n : 0),:])
end
end
end
Expand Down Expand Up @@ -3532,7 +3535,7 @@ for (gees, gges, elty, relty) in
end
end
@lapackerror
A, B, alpha, beta, vsl[1:(jobvsl == 'V' ? n : 0),:], vsr[1:(jobvsr == 'V' ? n : 0),:]
A, B, alpha, beta, copy(vsl[1:(jobvsl == 'V' ? n : 0),:]), copy(vsr[1:(jobvsr == 'V' ? n : 0),:])
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions base/linalg/lu.jl
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ end
function getindex{T,S<:StridedMatrix}(A::LU{T,S}, d::Symbol)
m, n = size(A)
if d == :L
L = tril!(A.factors[1:m, 1:min(m,n)])
L = tril(A.factors[1:m, 1:min(m,n)])
for i = 1:min(m,n); L[i,i] = one(T); end
return L
end
d == :U && return triu!(A.factors[1:min(m,n), 1:n])
d == :U && return triu(A.factors[1:min(m,n), 1:n])
d == :p && return ipiv2perm(A.ipiv, m)
if d == :P
p = A[:p]
Expand Down
4 changes: 2 additions & 2 deletions base/linalg/matmul.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ function scale!(C::AbstractMatrix, b::AbstractVector, A::AbstractMatrix)
end
C
end
scale(A::Matrix, b::Vector) = scale!(similar(A, promote_type(eltype(A),eltype(b))), A, b)
scale(b::Vector, A::Matrix) = scale!(similar(b, promote_type(eltype(A),eltype(b)), size(A)), b, A)
scale(A::AbstractMatrix, b::AbstractVector) = scale!(similar(A, promote_type(eltype(A),eltype(b))), A, b)
scale(b::AbstractVector, A::AbstractMatrix) = scale!(similar(b, promote_type(eltype(A),eltype(b)), size(A)), b, A)

# Dot products

Expand Down
5 changes: 4 additions & 1 deletion base/multidimensional.jl
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,10 @@ end
_getindex(A, I::(Union(Int,AbstractVector)...)) =
_getindex!(similar(A, index_shape(I...)), A, I...)

@nsplat N getindex(A::Array, I::NTuple{N,UnitRange{Int}}...) = slice(A, I...)
@nsplat N function getindex(A::Array, I::NTuple{N,UnitRange{Int}}...)
checkbounds(A, I...)
slice(A, I...)

This comment has been minimized.

Copy link
@timholy

timholy Nov 24, 2014

Member

Personally, I'm pleased to see the slice here.

This comment has been minimized.

Copy link
@andreasnoack

andreasnoack Nov 24, 2014

Author Member

Let's see if it goes through. In any case, it will be easy to change.

If you have a bit of time, it would be great if you could try to build this branch and run the socket.jl tests and see if it tells you anything. It is failing in a cartesian iteration, but an identical copy of the failing function doesn't fail.

This comment has been minimized.

Copy link
@timholy

timholy Nov 24, 2014

Member

For me it's failing on this statement: ip"0:0:0:0:0:ffff:127.0.0.1", with the error

ERROR: `isless` has no method matching isless(::Int64, ::(Bool,CartesianIndex_1))

Is that what you see? And that it's failing in parseipv6fields?

The error message indicates that some comparison is being made directly on the state variable returned by iterating over an AbstractArray. Nothing in the code makes me think this is a reasonable error. I'm wondering if this is a consequence of type-inference problems with staged functions, e.g., #8504.

This comment has been minimized.

Copy link
@andreasnoack

andreasnoack Nov 24, 2014

Author Member

Exactly that. If you make a function foo with the same content as parseipv6fields then it doesn't create the error. However, I cannot reproduce the error on master with slice.

This comment has been minimized.

Copy link
@timholy

timholy Nov 24, 2014

Member

I suspect that what's happening is it's getting compiled once for an Array input, which uses linear indexing, and then it's using that cached function for a SubArray input which uses cartesian indexing. It must not be inlining the call to start, but it is inlining done and/or next, and it's the mismatch between these that's causing the error. Or something like that.

I just put a bandaid on the problem in 63b2ae9. This will only hide the problem, but I bet the 1d case is the major concern in solving the bootstrap problem. I also slapped a "priority" label on #8504, because it's serious.

This comment has been minimized.

Copy link
@andreasnoack

andreasnoack Nov 24, 2014

Author Member

I just rebased this branch on latest master which includes your fix, 63b2ae9, and now the socket.jl tests don't terminate at all.

This comment has been minimized.

Copy link
@timholy

timholy Nov 24, 2014

Member

Perhaps try building with #8973?

This comment has been minimized.

Copy link
@andreasnoack

andreasnoack Nov 24, 2014

Author Member

Sorry. I should have updated this one. It was a new problem with a wait that never returned, but it is now fixed with a copy.

end

@nsplat N function getindex(A::Array, I::NTuple{N,Union(Real,AbstractVector)}...)
checkbounds(A, I...)
Expand Down
1 change: 1 addition & 0 deletions base/string.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ string(xs...) = print_to_string(xs...)

bytestring() = ""
bytestring(s::Array{UInt8,1}) = bytestring(pointer(s),length(s))
bytestring{N}(s::SubArray{UInt8,1,Array{UInt8,N},(UnitRange{Int64},),1}) = bytestring(pointer(s),length(s))
bytestring(s::AbstractString...) = print_to_string(s...)

function bytestring(p::Union(Ptr{UInt8},Ptr{Int8}))
Expand Down
22 changes: 11 additions & 11 deletions test/arpack.jl
Original file line number Diff line number Diff line change
Expand Up @@ -92,21 +92,21 @@ size(Phi::CPM)=(size(Phi.kraus,1)^2,size(Phi.kraus,3)^2)
issym(Phi::CPM)=false
ishermitian(Phi::CPM)=false

function *{T<:Base.LinAlg.BlasFloat}(Phi::CPM{T},rho::Vector{T})
rho=reshape(rho,(size(Phi.kraus,3),size(Phi.kraus,3)))
rho2=zeros(T,(size(Phi.kraus,1),size(Phi.kraus,1)))
for s=1:size(Phi.kraus,2)
As=slice(Phi.kraus,:,s,:)
rho2+=As*rho*As'
function *{T<:Base.LinAlg.BlasFloat}(Phi::CPM{T}, rho::StridedVector{T})
rho = reshape(rho, (size(Phi.kraus, 3), size(Phi.kraus, 3)))
rho2 = zeros(T, (size(Phi.kraus, 1), size(Phi.kraus, 1)))
for s = 1:size(Phi.kraus, 2)
As = slice(Phi.kraus, :, s, :)
rho2 += As*rho*As'
end
return reshape(rho2,(size(Phi.kraus,1)^2,))
return reshape(rho2, (size(Phi.kraus,1)^2,))
end
# Generate random isometry
(Q,R)=qr(randn(100,50))
Q=reshape(Q,(50,2,50))
(Q,R) = qr(randn(100,50))
Q = reshape(Q,(50,2,50))
# Construct trace-preserving completely positive map from this
Phi=CPM(Q)
(d,v,nconv,numiter,numop,resid) = eigs(Phi,nev=1,which=:LM)
Phi = CPM(Q)
(d,v,nconv,numiter,numop,resid) = eigs(Phi, nev=1, which=:LM)
# Properties: largest eigenvalue should be 1, largest eigenvector, when reshaped as matrix
# should be a Hermitian positive definite matrix (up to an arbitrary phase)

Expand Down
2 changes: 1 addition & 1 deletion test/arrayops.jl
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,7 @@ Nmax = 3 # TODO: go up to CARTESIAN_DIMS+2 (currently this exposes problems)
for N = 1:Nmax
#indexing with (Range1, Range1, Range1)
args = ntuple(N, d->Range1{Int})
@test Base.return_types(getindex, tuple(Array{Float32, N}, args...)) == [Array{Float32, N}]
@test Base.return_types(getindex, tuple(Array{Float32, N}, args...)) == [SubArray{Float32,N,Array{Float32,N},ntuple(N, d->UnitRange{Int64}),1}]
@test Base.return_types(getindex, tuple(BitArray{N}, args...)) == Any[BitArray{N}]
@test Base.return_types(setindex!, tuple(Array{Float32, N}, Array{Int, 1}, args...)) == [Array{Float32, N}]
# Indexing with (Range1, Range1, Float64)
Expand Down
1 change: 1 addition & 0 deletions test/bitarray.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
tc{N}(r1::NTuple{N}, r2::NTuple{N}) = all(map(x->tc(x...), [zip(r1,r2)...]))
tc{N}(r1::BitArray{N}, r2::Union(BitArray{N},Array{Bool,N})) = true
tc{N,M}(r1::BitArray{N}, r2::SubArray{Bool,N,Array{Bool,M},NTuple{N,UnitRange{Int64}},1}) = true
tc{T}(r1::T, r2::T) = true
tc(r1,r2) = false

Expand Down
2 changes: 1 addition & 1 deletion test/parallel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if nprocs() < 3
end

id_me = myid()
id_other = filter(x -> x != id_me, procs())[rand(1:(nprocs()-1))]
id_other = filter(x -> x != id_me, procs())[rand(1:(nprocs() - 1))]

@test fetch(@spawnat id_other myid()) == id_other
@test @fetchfrom id_other begin myid() end == id_other
Expand Down

1 comment on commit ae4a176

@andreasnoack
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jakebolewski I think I'm almost through with the arrayviews-from-getindex transition, but I cannot fix the test fail in socket.jl. Could you please take a look?

I'm wondering if a wrong method is being called. Maybe because of inlining since the backtrace is also difficult to use. The slow version of iteration is only defined in multidimensional.jl so maybe that can explain it.

Please sign in to comment.