Skip to content

Commit 2063b4b

Browse files
authored
Remove fix -50 in coord memory nlp allocation tests (#114)
* Remove fix -50 in coord memory nlp allocation tests * handle al2 == 0
1 parent ae713da commit 2063b4b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/nlp/coord-memory.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function coord_memory_nlp(nlp::AbstractNLPModel; linear_api = false, exclude = [
2020
V = zeros(nlp.meta.nnzh)
2121
hess_coord!(nlp, x, V)
2222
al2 = @allocated hess_coord!(nlp, x, V)
23-
@test al2 < al1 - 50
23+
@test (al2 < al1) | (al2 == 0)
2424
end
2525

2626
if m > 0
@@ -29,15 +29,15 @@ function coord_memory_nlp(nlp::AbstractNLPModel; linear_api = false, exclude = [
2929
al1 = @allocated vals = hess_coord(nlp, x, y)
3030
hess_coord!(nlp, x, y, V)
3131
al2 = @allocated hess_coord!(nlp, x, y, V)
32-
@test al2 < al1 - 50
32+
@test (al2 < al1) | (al2 == 0)
3333
end
3434

3535
if jth_hess_coord exclude
3636
vals = jth_hess_coord(nlp, x, m)
3737
al1 = @allocated vals = jth_hess_coord(nlp, x, m)
3838
jth_hess_coord!(nlp, x, m, V)
3939
al2 = @allocated jth_hess_coord!(nlp, x, m, V)
40-
@test al2 < al1 - 50
40+
@test (al2 < al1) | (al2 == 0)
4141
end
4242

4343
if jac_coord exclude
@@ -46,22 +46,22 @@ function coord_memory_nlp(nlp::AbstractNLPModel; linear_api = false, exclude = [
4646
V = zeros(nlp.meta.nnzj)
4747
jac_coord!(nlp, x, vals)
4848
al2 = @allocated jac_coord!(nlp, x, vals)
49-
@test al2 < al1 - 50
49+
@test (al2 < al1) | (al2 == 0)
5050
if linear_api && nlp.meta.nlin > 0
5151
vals = jac_lin_coord(nlp, x)
5252
al1 = @allocated vals = jac_lin_coord(nlp, x)
5353
V = zeros(nlp.meta.lin_nnzj)
5454
jac_lin_coord!(nlp, x, vals)
5555
al2 = @allocated jac_lin_coord!(nlp, x, vals)
56-
@test al2 < al1 - 50
56+
@test (al2 < al1) | (al2 == 0)
5757
end
5858
if linear_api && nlp.meta.nnln > 0
5959
vals = jac_nln_coord(nlp, x)
6060
al1 = @allocated vals = jac_nln_coord(nlp, x)
6161
V = zeros(nlp.meta.nln_nnzj)
6262
jac_nln_coord!(nlp, x, vals)
6363
al2 = @allocated jac_nln_coord!(nlp, x, vals)
64-
@test al2 < al1 - 50
64+
@test (al2 < al1) | (al2 == 0)
6565
end
6666
end
6767
end

0 commit comments

Comments
 (0)