@@ -363,8 +363,7 @@ _localindex(i::AbstractUnitRange, offset) = (first(i)-offset):(last(i)-offset)
363
363
Equivalent to `Array(view(A, I...))` but optimised for the case that the data is local.
364
364
Can return a view into `localpart(A)`
365
365
"""
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}
368
367
J = map (i-> Base. unalias (A, i), to_indices (A, I))
369
368
J = map (j-> isa (j, Base. Slice) ? j. indices : j, J)
370
369
@boundscheck checkbounds (A, J... )
@@ -597,12 +596,7 @@ function Base.copyto!(a::Array, s::SubDArray)
597
596
return a
598
597
end
599
598
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
599
+ reindex (A, I, J) = Base. reindex (I, J)
606
600
607
601
function DArray (SD:: SubArray{T,N} ) where {T,N}
608
602
D = SD. parent
@@ -661,9 +655,7 @@ function Base.getindex(d::DArray, i::Int...)
661
655
end
662
656
663
657
Base. getindex (d:: DArray ) = d[1 ]
664
- if VERSION > v " 1.1-"
665
658
Base. getindex (d:: SubDArray , I:: Int... ) = invoke (getindex, Tuple{SubArray{<: Any ,N},Vararg{Int,N}} where N, d, I... )
666
- end
667
659
Base. getindex (d:: SubOrDArray , I:: Union{Int,UnitRange{Int},Colon,Vector{Int},StepRange{Int,Int}} ...) = view (d, I... )
668
660
669
661
function Base. isassigned (D:: DArray , i:: Integer... )
@@ -793,13 +785,12 @@ Base.@propagate_inbounds Base.getindex(M::MergedIndices{J,N}, I::Vararg{Int, N})
793
785
const ReshapedMergedIndices{T,N,M<: MergedIndices } = Base. ReshapedArray{T,N,M}
794
786
const SubMergedIndices{T,N,M<: Union{MergedIndices, ReshapedMergedIndices} } = SubArray{T,N,M}
795
787
const 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)... ))
788
+ @inline Base. checkbounds_indices (:: Type{Bool} , inds:: Tuple{} , 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{Any} , I:: Tuple{MergedIndicesOrSub,Vararg{Any}} ) =
791
+ Base. checkbounds_indices (Bool, inds, (parent (parent (I[1 ])). indices... , tail (I)... ))
792
+ @inline Base. checkbounds_indices (:: Type{Bool} , inds:: Tuple , I:: Tuple{MergedIndicesOrSub,Vararg{Any}} ) =
793
+ Base. checkbounds_indices (Bool, inds, (parent (parent (I[1 ])). indices... , tail (I)... ))
803
794
804
795
# The tricky thing here is that we want to optimize the accesses into the
805
796
# distributed array, but in doing so, we lose track of which indices in I we
@@ -851,8 +842,6 @@ function Base.fill!(A::DArray, x)
851
842
return A
852
843
end
853
844
854
- using Random
855
-
856
845
function Random. rand! (A:: DArray , :: Type{T} ) where T
857
846
asyncmap (procs (A)) do p
858
847
remotecall_wait ((A, T)-> rand! (localpart (A), T), p, A, T)
0 commit comments