Skip to content

Commit cc00949

Browse files
authored
Add allocs test (#71)
* fix formatting * reduce alloc tests
1 parent 466d2cd commit cc00949

File tree

3 files changed

+8
-15
lines changed

3 files changed

+8
-15
lines changed

src/main.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,10 @@ end
163163
Update `Δq = -(∇f + 0.5 * (Hx * d)) ⋅ d` in-place.
164164
"""
165165
function compute_Δq(workspace, Hx, d, ∇f)
166-
mul!(workspace.Hd, Hx, d)
167-
workspace.Hd .*= 0.5
168-
workspace.Hd .+= ∇f
169-
return -dot(workspace.Hd, d)
166+
mul!(workspace.Hd, Hx, d)
167+
workspace.Hd .*= 0.5
168+
workspace.Hd .+= ∇f
169+
return -dot(workspace.Hd, d)
170170
end
171171

172172
function TRARC(

src/utils/hessian_rep.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ struct HessSparse{T,S,Vi,It<:Integer}
1818
rows::Vi
1919
cols::Vi
2020
vals::S
21-
H::Symmetric{T, SparseMatrixCSC{T, It}}
21+
H::Symmetric{T,SparseMatrixCSC{T,It}}
2222
function HessSparse(nlp::AbstractNLPModel{T,S}, n) where {T,S}
2323
rows, cols = hess_structure(nlp)
2424
vals = S(undef, nlp.meta.nnzh)

test/allocation_test.jl

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ for XData in (
1111
PDataKARC(S, T, n),
1212
PDataTRK(S, T, n),
1313
PDataST(S, T, n),
14-
# PDataSpectral(S, T, n),
1514
)
1615
@testset "Allocation test in ARCTR.decrease for $(typeof(XData))" begin
1716
alloc_decrease() = @allocated ARCTR.decrease(XData, α, TR)
@@ -37,15 +36,9 @@ ng = norm(g)
3736
calls, max_calls = 0, 1000000
3837

3938
for (Data, solve, limit_solve, limit_preprocess) in (
40-
#:solve_diag,
41-
#:solve_diagTR,
42-
# (PDataSpectral(S, T, n), :solve_modelARCDiag),
43-
# (PDataSpectral(S, T, n), :solve_modelARCDiagAbs),
44-
(PDataKARC, :solve_modelKARC, 112, 4488),
45-
(PDataTRK, :solve_modelTRK, 112, 2400),
46-
(PDataST, :solve_modelST_TR, 560, 0),
47-
#(PDataSpectral, :solve_modelTRDiag, 5408, 279328),
48-
#(PDataSpectral, :solve_modelTRDiagAbs, 5408, 279328),
39+
(PDataKARC, :solve_modelKARC, 112, 0),
40+
(PDataTRK, :solve_modelTRK, 112, 0),
41+
(PDataST, :solve_modelST_TR, 192, 0),
4942
)
5043
@testset "Allocation test in preprocess with $(Data)" begin
5144
XData = Data(S, T, n)

0 commit comments

Comments
 (0)