Skip to content

Commit 0a70e38

Browse files
committed
Define a hash function for DArray
1 parent 9017eb6 commit 0a70e38

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/darray.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ localtype{T,N,D}(::Type{SubDArray{T,N,D}}) = localtype(D)
6666
localtype(A::SubOrDArray) = localtype(typeof(A))
6767
localtype(A::AbstractArray) = typeof(A)
6868

69+
Base.hash(d::DArray, h::UInt) = Base.hash(d.id, h)
70+
6971
## core constructors ##
7072

7173
function DArray(id, init, dims, pids, idxs, cuts)

test/darray.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using SpecialFunctions
22

3-
@testset "test distribute" begin
3+
@testset "test distribute and other constructors" begin
44
A = rand(1:100, (100,100))
55

66
@testset "test default distribute" begin
@@ -40,6 +40,11 @@ using SpecialFunctions
4040
close(DA1)
4141
close(DA2)
4242
end
43+
44+
@testset "Global DArray serialization issue #134" begin
45+
global A134 = drandn(1)
46+
@test DArray(I -> DistributedArrays.localpart(A134), A134) == A134
47+
end
4348
end
4449

4550
check_leaks()

0 commit comments

Comments
 (0)