Skip to content

Commit 65f471e

Browse files
authored
Update print statements for consistency in tests
1 parent ead2a9e commit 65f471e

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

test/test_comprehensive.jl

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,60 +7,60 @@ println("Testing with unconstrained problem (ROSENBR):")
77
nlp1 = CUTEstModel{Float64}("ROSENBR")
88
x0 = nlp1.meta.x0
99

10-
println("Problem loaded: $(nlp1.meta.name) ($(nlp1.meta.nvar) vars, $(nlp1.meta.ncon) cons)")
10+
println("Problem loaded: $(nlp1.meta.name) ($(nlp1.meta.nvar) vars, $(nlp1.meta.ncon) cons)")
1111
vals_h = Vector{Float64}(undef, nlp1.meta.nnzh)
1212
hess_coord!(nlp1, x0, vals_h)
1313

1414
b_hess = @benchmark hess_coord!($nlp1, $x0, $vals_h) samples=100 evals=5
15-
println("hess_coord!: $(b_hess.allocs) allocations, $(BenchmarkTools.prettytime(median(b_hess).time))")
15+
println("hess_coord!: $(b_hess.allocs) allocations, $(BenchmarkTools.prettytime(median(b_hess).time))")
1616

1717
finalize(nlp1)
1818

1919
println("\nTesting with constrained problem (HS6):")
2020
nlp2 = CUTEstModel{Float64}("HS6")
2121
x0 = nlp2.meta.x0
2222

23-
println("Problem loaded: $(nlp2.meta.name) ($(nlp2.meta.nvar) vars, $(nlp2.meta.ncon) cons)")
24-
println(" nnzj: $(nlp2.meta.nnzj), nnzh: $(nlp2.meta.nnzh)")
23+
println("Problem loaded: $(nlp2.meta.name) ($(nlp2.meta.nvar) vars, $(nlp2.meta.ncon) cons)")
24+
println("nnzj: $(nlp2.meta.nnzj), nnzh: $(nlp2.meta.nnzh)")
2525

2626
f = obj(nlp2, x0)
2727
g = similar(x0)
2828
grad!(nlp2, x0, g)
29-
println("obj/grad: f = $(round(f, digits=6)), ||g|| = $(round(norm(g), digits=6))")
29+
println("obj/grad: f = $(round(f, digits=6)), ||g|| = $(round(norm(g), digits=6))")
3030

3131
c = Vector{Float64}(undef, nlp2.meta.ncon)
3232
cons!(nlp2, x0, c)
33-
println("constraints: ||c|| = $(round(norm(c), digits=6))")
33+
println("constraints: ||c|| = $(round(norm(c), digits=6))")
3434

3535
println("\nTesting cons_coord allocation improvements:")
3636
c1, rows1, cols1, vals1 = cons_coord(nlp2, x0)
3737

3838
b_cons = @benchmark cons_coord($nlp2, $x0) samples=100 evals=5
39-
println("cons_coord: $(b_cons.allocs) allocations, $(BenchmarkTools.prettytime(median(b_cons).time))")
40-
println(" Memory: $(BenchmarkTools.prettymemory(median(b_cons).memory))")
41-
println(" Returned $(length(vals1)) Jacobian elements")
39+
println("cons_coord: $(b_cons.allocs) allocations, $(BenchmarkTools.prettytime(median(b_cons).time))")
40+
println("Memory: $(BenchmarkTools.prettymemory(median(b_cons).memory))")
41+
println("Returned $(length(vals1)) Jacobian elements")
4242

4343
rows = Vector{Cint}(undef, nlp2.meta.nnzj)
4444
cols = Vector{Cint}(undef, nlp2.meta.nnzj)
4545
vals = Vector{Float64}(undef, nlp2.meta.nnzj)
4646
c_out = Vector{Float64}(undef, nlp2.meta.ncon)
4747

4848
b_cons_inplace = @benchmark cons_coord!($nlp2, $x0, $c_out, $rows, $cols, $vals) samples=100 evals=5
49-
println("cons_coord!: $(b_cons_inplace.allocs) allocations, $(BenchmarkTools.prettytime(median(b_cons_inplace).time))")
49+
println("cons_coord!: $(b_cons_inplace.allocs) allocations, $(BenchmarkTools.prettytime(median(b_cons_inplace).time))")
5050

5151
println("\nTesting type conversion improvements:")
5252
x0_f32 = Float32.(x0)
5353
g_f32 = Vector{Float32}(undef, nlp2.meta.nvar)
5454

5555
b_grad_conv = @benchmark grad!($nlp2, $x0_f32, $g_f32) samples=100 evals=5
56-
println("grad! with Float32->Float64 conversion: $(b_grad_conv.allocs) allocations")
57-
println(" Time: $(BenchmarkTools.prettytime(median(b_grad_conv).time))")
56+
println("grad! with Float32->Float64 conversion: $(b_grad_conv.allocs) allocations")
57+
println("Time: $(BenchmarkTools.prettytime(median(b_grad_conv).time))")
5858

5959
vals_h2 = Vector{Float64}(undef, nlp2.meta.nnzh)
6060
y = zeros(nlp2.meta.ncon)
6161
hess_coord!(nlp2, x0, y, vals_h2)
6262

6363
b_hess2 = @benchmark hess_coord!($nlp2, $x0, $y, $vals_h2) samples=100 evals=5
64-
println("hess_coord! (constrained): $(b_hess2.allocs) allocations, $(BenchmarkTools.prettytime(median(b_hess2).time))")
64+
println("hess_coord! (constrained): $(b_hess2.allocs) allocations, $(BenchmarkTools.prettytime(median(b_hess2).time))")
6565

6666
finalize(nlp2)

0 commit comments

Comments
 (0)