Allocation tests fail in Julia v1.5+ #185
Comments
using #186 shows it's |
I don't know what If we switch to diff --git a/Project.toml b/Project.toml
index e4aa578..c3545aa 100644
--- a/Project.toml
+++ b/Project.toml
@@ -11,6 +11,7 @@ SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
[compat]
+BenchmarkTools = "0.5"
DiffRules = "^0.0"
DualNumbers = ">=0.6.0"
FDM = "^0.6"
diff --git a/test/sensitivities/functional/functional.jl b/test/sensitivities/functional/functional.jl
index 7a4b6b4..8e462ba 100644
--- a/test/sensitivities/functional/functional.jl
+++ b/test/sensitivities/functional/functional.jl
@@ -234,8 +234,8 @@ using DiffRules: diffrule, hasdiffrule
let
@eval foo_small() = sum($f(tanh, Leaf(Tape(), randn(10, 10))))
@eval foo_large() = sum($f(tanh, Leaf(Tape(), randn(10, 100))))
- @test allocs(@benchmark foo_small()) == allocs(@benchmark foo_large())
- @test allocs(@benchmark ∇(foo_small())) == allocs(@benchmark ∇(foo_large()))
+ @test (@ballocated foo_small()) == (@ballocated foo_large())
+ @test (@ballocated ∇(foo_small())) == (@ballocated ∇(foo_large()))
end
end then tests fail on Julia 1.4 (and 1.5 but with slightly different numbers): f = map: Test Failed at /Users/nick/repos/Nabla.jl/test/sensitivities/functional/functional.jl:237
Expression: #= /Users/nick/repos/Nabla.jl/test/sensitivities/functional/functional.jl:237 =# @ballocated(foo_small()) == #= /Users/nick/repos/Nabla.jl/test/sensitivities/functional/functional.jl:237 =# @ballocated(foo_large())
Evaluated: 2144 == 16608
...
...
f = map: Test Failed at /Users/nick/repos/Nabla.jl/test/sensitivities/functional/functional.jl:238
Expression: #= /Users/nick/repos/Nabla.jl/test/sensitivities/functional/functional.jl:238 =# @ballocated(∇(foo_small())) == #= /Users/nick/repos/Nabla.jl/test/sensitivities/functional/functional.jl:238 =# @ballocated(∇(foo_large()))
Evaluated: 5184 == 34112
...
...
f = broadcast: Test Failed at /Users/nick/repos/Nabla.jl/test/sensitivities/functional/functional.jl:237
Expression: #= /Users/nick/repos/Nabla.jl/test/sensitivities/functional/functional.jl:237 =# @ballocated(foo_small()) == #= /Users/nick/repos/Nabla.jl/test/sensitivities/functional/functional.jl:237 =# @ballocated(foo_large())
Evaluated: 2144 == 16608
...
...
f = broadcast: Test Failed at /Users/nick/repos/Nabla.jl/test/sensitivities/functional/functional.jl:238
Expression: #= /Users/nick/repos/Nabla.jl/test/sensitivities/functional/functional.jl:238 =# @ballocated(∇(foo_small())) == #= /Users/nick/repos/Nabla.jl/test/sensitivities/functional/functional.jl:238 =# @ballocated(∇(foo_large()))
Evaluated: 5232 == 34160 |
...any objections to just deleting these test, @willtebbutt ? |
IIRC these were designed to ensure that the number of allocations isn't proportional to the size of the inputs. i.e. if we change something and all of a sudden these operations produce an allocation for each element of the input matrices, that would be very bad, which is why I was attempting to count the total number of allocations as opposed to the total amount of memory allocated. It might be possible to make these tests pass by just making |
well, i guess i don't understand what |
I answered on Slack so I'll answer here:
|
Nabla.jl/test/sensitivities/functional/functional.jl
Lines 230 to 238 in da2b7ef
map
orbroadcast
version of the testThe text was updated successfully, but these errors were encountered: