Skip to content

Commit 6b4579b

Browse files
committed
pmap tests
1 parent 11ca009 commit 6b4579b

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

Project.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ StructArrays = "0.6"
2828
julia = "1.10"
2929

3030
[extras]
31+
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"
3132
FiniteDifferences = "26cc04aa-876d-5657-8c51-4c34ba976000"
3233
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
3334
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
@@ -36,4 +37,4 @@ Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7"
3637
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
3738

3839
[targets]
39-
test = ["ForwardDiff", "LinearAlgebra", "Random", "Symbolics", "Test", "FiniteDifferences"]
40+
test = ["Distributed", "FiniteDifferences", "ForwardDiff", "LinearAlgebra", "Random", "Symbolics", "Test"]

test/gradcheck.jl

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
using Test
1111
using ChainRulesCore
1212
using Diffractor
13+
using Distributed: pmap
1314
using FiniteDifferences
1415
using LinearAlgebra
1516

@@ -283,23 +284,24 @@ end
283284
@test jacobicheck(xs -> map(x -> x^2, xs), rand(2,3))
284285

285286
# MethodError: no method matching copy(::Nothing)
286-
@test_broken jacobicheck((xss...) -> sum(map((xs...) -> sqrt(sum(xs.^2)), xss...)), [rand(5) for _ in 1:6]...)
287+
@test_broken jacobicheck((xss...) -> map((xs...) -> sqrt(sum(xs.^2)), xss...), [rand(5) for _ in 1:6]...)
287288

288289
# MethodError: no method matching copy(::Nothing)
289290
@test_broken gradcheck(y -> map(x -> x*y, 1:5), 3)
290291
@test_broken gradient(v -> sum([x for x in v]), [1.1,2.2,3.3]) == ([1, 1, 1],)
291292
end
292293

293-
@test_skip @testset "bascis, pmap" begin
294-
@test jacobicheck(xs -> sum(pmap(x -> x^2, xs)), rand(2,3))
295-
@test jacobicheck((xss...) -> sum(pmap((xs...) -> sqrt(sum(xs.^2)), xss...)), [rand(5) for _ in 1:6]...)
294+
@testset "bascis, pmap" begin
295+
# BoundsError: attempt to access 0-element Core.Compiler.UnitRange{Int64} at index [0]
296+
@test_broken jacobicheck(xs -> pmap(x -> x^2, xs), rand(2,3))
297+
@test_broken jacobicheck((xss...) -> pmap((xs...) -> sqrt(sum(xs.^2)), xss...), [rand(5) for _ in 1:6]...)
296298

297299
function foo(y)
298300
bar = (x) -> x*y
299301
sum(pmap(bar, 1:5))
300302
end
301-
@test gradtest(foo, 3)
302-
@test gradient(v -> sum([x for x in v]), [1.1,2.2,3.3]) == ([1, 1, 1],)
303+
# BoundsError: attempt to access 0-element Core.Compiler.UnitRange{Int64} at index [0]
304+
@test_broken jacobicheck(y -> pmap(x -> x*y, 1:5), 3)
303305
end
304306

305307
@testset "Tuple adjoint" begin
@@ -402,4 +404,3 @@ end
402404
# end
403405
# @test gradcheck(bar, [5.0])
404406
# end
405-

0 commit comments

Comments
 (0)