Skip to content

Commit a275218

Browse files
committed
Cleanup.
Document change linearindexes -> linearindices. Clean up comments and unused code.
1 parent e347baf commit a275218

File tree

4 files changed

+7
-18
lines changed

4 files changed

+7
-18
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,12 @@ Indexing via symbols is used for this, specifically symbols `:L`,`:LP`,`:l`,`:lp
7474
are all equivalent. For example, `d[:L]` returns the localpart of `d`
7575
while `d[:L]=v` sets `v` as the localpart of `d`.
7676

77-
* `localindexes(a::DArray)` gives a tuple of the index ranges owned by the
77+
* `localindices(a::DArray)` gives a tuple of the index ranges owned by the
7878
local process.
7979

8080
* `convert(Array, a::DArray)` brings all the data to the local process.
8181

82-
Indexing a `DArray` (square brackets) with ranges of indexes always
82+
Indexing a `DArray` (square brackets) with ranges of indices always
8383
creates a `SubArray`, not copying any data.
8484

8585

@@ -225,7 +225,7 @@ Garbage Collection and DArrays
225225
------------------------------
226226

227227
When a DArray is constructed (typically on the master process), the returned DArray objects stores information on how the
228-
array is distributed, which procesor holds which indexes and so on. When the DArray object
228+
array is distributed, which procesor holds which indices and so on. When the DArray object
229229
on the master process is garbage collected, all particpating workers are notified and
230230
localparts of the DArray freed on each worker.
231231

src/darray.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ function DArray(refs)
198198
nindices = Array{NTuple{length(dimdist),UnitRange{Int}}}(undef, dimdist...)
199199

200200
for i in 1:length(nindices)
201-
subidx = CartesianIndices(dimdist)[i] #ind2sub(dimdist, i)
201+
subidx = CartesianIndices(dimdist)[i]
202202
nindices[i] = ntuple(length(subidx)) do x
203203
idx_in_dim = subidx[x]
204204
startidx = 1
@@ -525,7 +525,7 @@ Base.reshape(A::DArray{T,1,S}, d::Dims) where {T,S<:Array} = begin
525525
sztail = size(B)[2:end]
526526

527527
for i=1:div(length(B),nr)
528-
i2 = CartesianIndices(sztail)[i] #ind2sub(sztail, i)
528+
i2 = CartesianIndices(sztail)[i]
529529
globalidx = [ I[j][i2[j-1]] for j=2:nd ]
530530

531531
a = sub2ind(d, d1offs, globalidx...)

src/mapreduce.jl

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -84,17 +84,6 @@ Base.reducedim_initarray(A::DArray, region, v0, ::Type{R}) where {R} = begin
8484
end
8585
Base.reducedim_initarray(A::DArray, region, v0::T) where {T} = Base.reducedim_initarray(A, region, v0, T)
8686

87-
#Base.reducedim_initarray0(A::DArray, region, v0, ::Type{R}) where {R} = begin
88-
# # Store reduction on lowest pids
89-
# pids = A.pids[ntuple(i -> i in region ? (1:1) : (:), ndims(A))...]
90-
# chunks = similar(pids, Future)
91-
# @sync for i in eachindex(pids)
92-
# @async chunks[i...] = remotecall_wait(() -> Base.reducedim_initarray0(localpart(A), region, v0, R), pids[i...])
93-
# end
94-
# return DArray(chunks)
95-
#end
96-
#Base.reducedim_initarray0(A::DArray, region, v0::T) where {T} = Base.reducedim_initarray0(A, region, v0, T)
97-
9887
# Compute mapreducedim of each localpart and store the result in a new DArray
9988
mapreducedim_within(f, op, A::DArray, region) = begin
10089
arraysize = [size(A)...]
@@ -144,7 +133,8 @@ end
144133
#end
145134

146135
# TODO implement reduce, mapreduce with dims keyword
147-
# There are tests that call these on `DArray`s but they currently fall back to `AbstractArray` methods
136+
# There are tests that call these on `DArray`s but they currently run very slow
137+
# and I suspect that they fall back to `AbstractArray` methods
148138

149139

150140
function nnz(A::DArray)

test/runtests.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ end
1313
@everywhere using DistributedArrays
1414
@everywhere using DistributedArrays.SPMD
1515
@everywhere using Random
16-
@everywhere using LinearAlgebra: LowerTriangular
1716

1817
@everywhere srand(1234 + myid())
1918

0 commit comments

Comments
 (0)