@@ -8,13 +8,12 @@ println("Testing with unconstrained problem (ROSENBR):")
88nlp1 = CUTEstModel {Float64} (" ROSENBR" )
99x0 = nlp1. meta. x0
1010
11- # Test hess_coord allocations
12- println (" ✓ Problem loaded: $(nlp1. meta. name) ($(nlp1. meta. nvar) vars, $(nlp1. meta. ncon) cons)" )
11+ println (" Problem loaded: $(nlp1. meta. name) ($(nlp1. meta. nvar) vars, $(nlp1. meta. ncon) cons)" )
1312vals_h = Vector {Float64} (undef, nlp1. meta. nnzh)
1413hess_coord! (nlp1, x0, vals_h)
1514
1615b_hess = @benchmark hess_coord! ($ nlp1, $ x0, $ vals_h) samples= 100 evals= 5
17- println (" ✓ hess_coord!: $(b_hess. allocs) allocations, $(BenchmarkTools. prettytime (median (b_hess). time)) " )
16+ println (" hess_coord!: $(b_hess. allocs) allocations, $(BenchmarkTools. prettytime (median (b_hess). time)) " )
1817
1918finalize (nlp1)
2019
@@ -23,29 +22,29 @@ println("\nTesting with constrained problem (HS6):")
2322nlp2 = CUTEstModel {Float64} (" HS6" )
2423x0 = nlp2. meta. x0
2524
26- println (" ✓ Problem loaded: $(nlp2. meta. name) ($(nlp2. meta. nvar) vars, $(nlp2. meta. ncon) cons)" )
27- println (" nnzj: $(nlp2. meta. nnzj) , nnzh: $(nlp2. meta. nnzh) " )
25+ println (" Problem loaded: $(nlp2. meta. name) ($(nlp2. meta. nvar) vars, $(nlp2. meta. ncon) cons)" )
26+ println (" nnzj: $(nlp2. meta. nnzj) , nnzh: $(nlp2. meta. nnzh) " )
2827
2928# Test basic functionality
3029f = obj (nlp2, x0)
3130g = similar (x0)
3231grad! (nlp2, x0, g)
33- println (" ✓ obj/grad: f = $(round (f, digits= 6 )) , ||g|| = $(round (norm (g), digits= 6 )) " )
32+ println (" obj/grad: f = $(round (f, digits= 6 )) , ||g|| = $(round (norm (g), digits= 6 )) " )
3433
3534# Test constraint functions
3635c = Vector {Float64} (undef, nlp2. meta. ncon)
3736cons! (nlp2, x0, c)
38- println (" ✓ constraints: ||c|| = $(round (norm (c), digits= 6 )) " )
37+ println (" constraints: ||c|| = $(round (norm (c), digits= 6 )) " )
3938
4039# Test cons_coord - this should show major allocation improvements
4140println (" \n Testing cons_coord allocation improvements:" )
4241c1, rows1, cols1, vals1 = cons_coord (nlp2, x0)
4342
4443# Benchmark cons_coord
4544b_cons = @benchmark cons_coord ($ nlp2, $ x0) samples= 100 evals= 5
46- println (" ✓ cons_coord: $(b_cons. allocs) allocations, $(BenchmarkTools. prettytime (median (b_cons). time)) " )
47- println (" Memory: $(BenchmarkTools. prettymemory (median (b_cons). memory)) " )
48- println (" Returned $(length (vals1)) Jacobian elements" )
45+ println (" cons_coord: $(b_cons. allocs) allocations, $(BenchmarkTools. prettytime (median (b_cons). time)) " )
46+ println (" Memory: $(BenchmarkTools. prettymemory (median (b_cons). memory)) " )
47+ println (" Returned $(length (vals1)) Jacobian elements" )
4948
5049# Test cons_coord!
5150rows = Vector {Cint} (undef, nlp2. meta. nnzj)
@@ -54,23 +53,23 @@ vals = Vector{Float64}(undef, nlp2.meta.nnzj)
5453c_out = Vector {Float64} (undef, nlp2. meta. ncon)
5554
5655b_cons_inplace = @benchmark cons_coord! ($ nlp2, $ x0, $ c_out, $ rows, $ cols, $ vals) samples= 100 evals= 5
57- println (" ✓ cons_coord!: $(b_cons_inplace. allocs) allocations, $(BenchmarkTools. prettytime (median (b_cons_inplace). time)) " )
56+ println (" cons_coord!: $(b_cons_inplace. allocs) allocations, $(BenchmarkTools. prettytime (median (b_cons_inplace). time)) " )
5857
5958# Test type conversion
6059println (" \n Testing type conversion improvements:" )
6160x0_f32 = Float32 .(x0)
6261g_f32 = Vector {Float32} (undef, nlp2. meta. nvar)
6362
6463b_grad_conv = @benchmark grad! ($ nlp2, $ x0_f32, $ g_f32) samples= 100 evals= 5
65- println (" ✓ grad! with Float32->Float64 conversion: $(b_grad_conv. allocs) allocations" )
66- println (" Time: $(BenchmarkTools. prettytime (median (b_grad_conv). time)) " )
64+ println (" grad! with Float32->Float64 conversion: $(b_grad_conv. allocs) allocations" )
65+ println (" Time: $(BenchmarkTools. prettytime (median (b_grad_conv). time)) " )
6766
6867# Test hess_coord with constraints
6968vals_h2 = Vector {Float64} (undef, nlp2. meta. nnzh)
7069y = zeros (nlp2. meta. ncon)
7170hess_coord! (nlp2, x0, y, vals_h2)
7271
7372b_hess2 = @benchmark hess_coord! ($ nlp2, $ x0, $ y, $ vals_h2) samples= 100 evals= 5
74- println (" ✓ hess_coord! (constrained): $(b_hess2. allocs) allocations, $(BenchmarkTools. prettytime (median (b_hess2). time)) " )
73+ println (" hess_coord! (constrained): $(b_hess2. allocs) allocations, $(BenchmarkTools. prettytime (median (b_hess2). time)) " )
7574
7675finalize (nlp2)
0 commit comments