@@ -363,8 +363,7 @@ _localindex(i::AbstractUnitRange, offset) = (first(i)-offset):(last(i)-offset)
363363Equivalent to `Array(view(A, I...))` but optimised for the case that the data is local.
364364Can return a view into `localpart(A)`
365365"""
366- function makelocal (A:: DArray{<:Any, <:Any, AT} , I:: Vararg{Any, N} ) where {N, AT}
367- Base. @_inline_meta
366+ @inline function makelocal (A:: DArray{<:Any, <:Any, AT} , I:: Vararg{Any, N} ) where {N, AT}
368367 J = map (i-> Base. unalias (A, i), to_indices (A, I))
369368 J = map (j-> isa (j, Base. Slice) ? j. indices : j, J)
370369 @boundscheck checkbounds (A, J... )
@@ -597,17 +596,10 @@ function Base.copyto!(a::Array, s::SubDArray)
597596 return a
598597end
599598
600- if VERSION < v " 1.2"
601- # This is an internal API that has changed
602- reindex (A, I, J) = Base. reindex (A, I, J)
603- else
604- reindex (A, I, J) = Base. reindex (I, J)
605- end
606-
607599function DArray (SD:: SubArray{T,N} ) where {T,N}
608600 D = SD. parent
609601 DArray (size (SD), procs (D)) do I
610- lindices = reindex (SD, SD. indices, I)
602+ lindices = Base . reindex (SD. indices, I)
611603 convert (Array, D[lindices... ])
612604 end
613605end
@@ -661,9 +653,7 @@ function Base.getindex(d::DArray, i::Int...)
661653end
662654
663655Base. getindex (d:: DArray ) = d[1 ]
664- if VERSION > v " 1.1-"
665656Base. getindex (d:: SubDArray , I:: Int... ) = invoke (getindex, Tuple{SubArray{<: Any ,N},Vararg{Int,N}} where N, d, I... )
666- end
667657Base. getindex (d:: SubOrDArray , I:: Union{Int,UnitRange{Int},Colon,Vector{Int},StepRange{Int,Int}} ...) = view (d, I... )
668658
669659function Base. isassigned (D:: DArray , i:: Integer... )
@@ -793,13 +783,12 @@ Base.@propagate_inbounds Base.getindex(M::MergedIndices{J,N}, I::Vararg{Int, N})
793783const ReshapedMergedIndices{T,N,M<: MergedIndices } = Base. ReshapedArray{T,N,M}
794784const SubMergedIndices{T,N,M<: Union{MergedIndices, ReshapedMergedIndices} } = SubArray{T,N,M}
795785const MergedIndicesOrSub = Union{MergedIndices, ReshapedMergedIndices, SubMergedIndices}
796- import Base: checkbounds_indices
797- @inline checkbounds_indices (:: Type{Bool} , inds:: Tuple{} , I:: Tuple{MergedIndicesOrSub,Vararg{Any}} ) =
798- checkbounds_indices (Bool, inds, (parent (parent (I[1 ])). indices... , tail (I)... ))
799- @inline checkbounds_indices (:: Type{Bool} , inds:: Tuple{Any} , I:: Tuple{MergedIndicesOrSub,Vararg{Any}} ) =
800- checkbounds_indices (Bool, inds, (parent (parent (I[1 ])). indices... , tail (I)... ))
801- @inline checkbounds_indices (:: Type{Bool} , inds:: Tuple , I:: Tuple{MergedIndicesOrSub,Vararg{Any}} ) =
802- checkbounds_indices (Bool, inds, (parent (parent (I[1 ])). indices... , tail (I)... ))
786+ @inline Base. checkbounds_indices (:: Type{Bool} , inds:: Tuple{} , I:: Tuple{MergedIndicesOrSub,Vararg{Any}} ) =
787+ Base. checkbounds_indices (Bool, inds, (parent (parent (I[1 ])). indices... , tail (I)... ))
788+ @inline Base. checkbounds_indices (:: Type{Bool} , inds:: Tuple{Any} , I:: Tuple{MergedIndicesOrSub,Vararg{Any}} ) =
789+ Base. checkbounds_indices (Bool, inds, (parent (parent (I[1 ])). indices... , tail (I)... ))
790+ @inline Base. checkbounds_indices (:: Type{Bool} , inds:: Tuple , I:: Tuple{MergedIndicesOrSub,Vararg{Any}} ) =
791+ Base. checkbounds_indices (Bool, inds, (parent (parent (I[1 ])). indices... , tail (I)... ))
803792
804793# The tricky thing here is that we want to optimize the accesses into the
805794# distributed array, but in doing so, we lose track of which indices in I we
@@ -851,8 +840,6 @@ function Base.fill!(A::DArray, x)
851840 return A
852841end
853842
854- using Random
855-
856843function Random. rand! (A:: DArray , :: Type{T} ) where T
857844 asyncmap (procs (A)) do p
858845 remotecall_wait ((A, T)-> rand! (localpart (A), T), p, A, T)
0 commit comments