diff --git a/test/basic-nodes.jl b/test/basic-nodes.jl deleted file mode 100644 index f11dd02cf..000000000 --- a/test/basic-nodes.jl +++ /dev/null @@ -1,35 +0,0 @@ - -@testset "Distribution ($nw workers)" for nw=1:nworkers() - ctx = Context(workers()[1:nw]) - x = rand(10, 10, 10) - - @testset "SliceDimension{$dim}" for dim=1:3 - - dist_x = distribute(x, SliceDimension{dim}()) - computed = compute(ctx, dist_x) - - @test metadata(computed) == meta_test[nw][dim] - - expected = map(idx->x[idx...], meta_test[nw][dim]) - test_each_ref(computed, expected) do chunk, correct - @test chunk == correct - end - - @test gather(ctx, dist_x) == x - end - - @testset "Bcast" for dim=1:3 - - dist_1 = distribute(1, Bcast()) - computed = compute(ctx, dist_1) - - @test metadata(computed) == meta_test[nw][dim] - - expected = map(idx->x[idx...], meta_test[nw][dim]) - test_each_ref(computed, expected) do chunk, correct - @test chunk == correct - end - - @test gather(ctx, dist_x) == x - end -end diff --git a/test/distribute.jl b/test/distribute.jl deleted file mode 100644 index aa21c13fa..000000000 --- a/test/distribute.jl +++ /dev/null @@ -1,55 +0,0 @@ -import Dagger: SliceDimension, Bcast - -meta_test = Any[ - Any[ - Any[UnitRange[1:10,1:10,1:10]], - Any[UnitRange[1:10,1:10,1:10]], - Any[UnitRange[1:10,1:10,1:10]], - ], Any[ - Any[UnitRange[1:5,1:10,1:10],UnitRange[6:10,1:10,1:10]], - Any[UnitRange[1:10,1:5,1:10],UnitRange[1:10,6:10,1:10]], - Any[UnitRange[1:10,1:10,1:5],UnitRange[1:10,1:10,6:10]], - ], Any[ - Any[UnitRange[1:3,1:10,1:10],UnitRange[4:7,1:10,1:10],UnitRange[8:10,1:10,1:10]], - Any[UnitRange[1:10,1:3,1:10],UnitRange[1:10,4:7,1:10],UnitRange[1:10,8:10,1:10]], - Any[UnitRange[1:10,1:10,1:3],UnitRange[1:10,1:10,4:7],UnitRange[1:10,1:10,8:10]], - ], Any[ - Any[UnitRange[1:3,1:10,1:10],UnitRange[4:5,1:10,1:10],UnitRange[6:7,1:10,1:10],UnitRange[8:10,1:10,1:10]], - Any[UnitRange[1:10,1:3,1:10],UnitRange[1:10,4:5,1:10],UnitRange[1:10,6:7,1:10],UnitRange[1:10,8:10,1:10]], - Any[UnitRange[1:10,1:10,1:3],UnitRange[1:10,1:10,4:5],UnitRange[1:10,1:10,6:7],UnitRange[1:10,1:10,8:10]], - ] -] - -@testset "Distribution ($nw workers)" for nw=1:nworkers() - ctx = Context(workers()[1:nw]) - x = rand(10, 10, 10) - - @testset "Array distributions" begin - @testset "SliceDimension{$dim}" for dim=1:3 - - dist_x = distribute(x, SliceDimension{dim}()) - computed = compute(ctx, dist_x) - - @test metadata(computed) == meta_test[nw][dim] - - expected = map(idx->x[idx...], meta_test[nw][dim]) - test_each_ref(computed, expected) do chunk, correct - @test chunk == correct - end - - @test gather(ctx, dist_x) == x - end - end - - @testset "Bcast" for dim=1:3 - - dist_1 = distribute(1, Bcast()) - computed = compute(ctx, dist_1) - - expected = ones(Int, nw) - test_each_ref(computed, expected) do chunk, correct - @test chunk == 1 - end - end - -end diff --git a/test/redistribute.jl b/test/redistribute.jl deleted file mode 100644 index 69d21683b..000000000 --- a/test/redistribute.jl +++ /dev/null @@ -1,26 +0,0 @@ -@testset "redistribution ($nw workers)" for nw=1:nworkers() - ctx = Context(workers()[1:nw]) - x = rand(10, 10, 10) - - @testset "Array distributions" begin - @testset "SliceDimension{$dim}" for dim=1:3 - for to_dim=1:3 - to_dim == dim && break - - dist_x = distribute(x, cutdim(dim)) - redist = redistribute(compute(ctx, dist_x), cutdim(to_dim)) - computed = compute(ctx, redist) - - @test metadata(computed) == meta_test[nw][to_dim] - - expected = map(idx->x[idx...], meta_test[nw][to_dim]) - test_each_ref(computed, expected) do chunk, correct - @test chunk == correct - end - - @test gather(ctx, redist) == x - end - end - end - -end diff --git a/test/show.jl b/test/show.jl deleted file mode 100644 index 13417ca64..000000000 --- a/test/show.jl +++ /dev/null @@ -1,8 +0,0 @@ -a = rand(10,10) -b = distribute(a) -c = Dagger.map(x -> x^2, b) -d = reduce(+, 0.0, c) - -@test show(IOBuffer(), b) == 1 -@test show(IOBuffer(), c) == 1 -@test show(IOBuffer(), d) == 1 diff --git a/test/thunk.jl b/test/thunk.jl deleted file mode 100644 index 4162af1e4..000000000 --- a/test/thunk.jl +++ /dev/null @@ -1,12 +0,0 @@ - -@testset "@par macro" begin - @par t = 1+2 - - @test t == Thunk(+, (1,2), id=:t) - - @par begin - a = 3 - b = a+3 - end - @test b == Thunk(+, (3, 3), id=:b) -end diff --git a/test/util.jl b/test/util.jl deleted file mode 100644 index ce8e8e595..000000000 --- a/test/util.jl +++ /dev/null @@ -1,47 +0,0 @@ -import Dagger: DistData, refs -@everywhere begin - type RemoteTestSet <: Test.AbstractTestSet - description::AbstractString - hostref::RemoteChannel - end - RemoteTestSet(desc; hostref=RemoteChannel()) = - RemoteTestSet(desc, hostref) - - function Test.record(ts::RemoteTestSet, t) - put!(ts.hostref, (myid(), t)) - end - - function Test.finish(ts::RemoteTestSet) - end - - function test_runner(f, localpart, aux, ref) - Test.@testset RemoteTestSet hostref=ref "Remote test" begin - f(localpart, aux) - end - end -end - -function test_each_ref(f::Function, node::DistData, args::Vector) - # Ship a test to each ref - test_results = Array{Any}(length(refs(node))) - host_testset = Test.get_testset() - - result_ref = RemoteChannel() - @async while true - pid, result = take!(result_ref) - if isa(result, Test.Fail) - println("Test failure on worker $pid") - end - Test.record(host_testset, result) - end - - @sync begin - for (idx, r) in enumerate(refs(node)) - pid, ref = r - @async begin - result = remotecall_fetch(pid, - (f, x, y, r) -> test_runner(f, fetch(x), y, r), f, ref, args[idx], result_ref) - end - end - end -end