Skip to content

Commit

Permalink
Merge pull request #135 from JuliaParallel/amitm/fixfor0.6
Browse files Browse the repository at this point in the history
Define a hash function for DArray
  • Loading branch information
andreasnoack committed May 5, 2017
2 parents f707410 + 0a70e38 commit 12a9596
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/darray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ localtype{T,N,D}(::Type{SubDArray{T,N,D}}) = localtype(D)
localtype(A::SubOrDArray) = localtype(typeof(A))
localtype(A::AbstractArray) = typeof(A)

Base.hash(d::DArray, h::UInt) = Base.hash(d.id, h)

## core constructors ##

function DArray(id, init, dims, pids, idxs, cuts)
Expand Down
7 changes: 6 additions & 1 deletion test/darray.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using SpecialFunctions

@testset "test distribute" begin
@testset "test distribute and other constructors" begin
A = rand(1:100, (100,100))

@testset "test default distribute" begin
Expand Down Expand Up @@ -40,6 +40,11 @@ using SpecialFunctions
close(DA1)
close(DA2)
end

@testset "Global DArray serialization issue #134" begin
global A134 = drandn(1)
@test DArray(I -> DistributedArrays.localpart(A134), A134) == A134
end
end

check_leaks()
Expand Down

0 comments on commit 12a9596

Please sign in to comment.