use TimerOutsputs to measure performance

This commit is contained in:
Jukka Aho
2017-08-13 14:16:20 +03:00
parent 6fcba926d0
commit dc75cfda03
2 changed files with 11 additions and 4 deletions
+2 -1
View File
@@ -13,7 +13,8 @@ const to = TimerOutput()
function print_statistics()
println(to)
end
export print_statistics
export print_statistics, @timeit, to
import Base: getindex, setindex!, convert, length, size, isapprox, similar,
start, first, next, done, last, endof, vec, ==, +, -, *, /, haskey, copy,
+9 -3
View File
@@ -217,7 +217,9 @@ function (solver::Solver{Modal})(; bc_invertible=false, P=nothing, symmetric=tru
info("Increment time t=$(round(solver.time, 3))")
info(repeat("-", 80))
initialize!(solver)
assemble!(solver; with_mass_matrix=true)
@timeit to "assemble matrices" begin
assemble!(solver; with_mass_matrix=true)
end
M, K, Kg, f = get_field_assembly(solver)
if solver.properties.geometric_stiffness
K += Kg
@@ -297,7 +299,9 @@ function (solver::Solver{Modal})(; bc_invertible=false, P=nothing, symmetric=tru
passed = false
try
om2, X = eigs(K_red + sigma*I, M_red; nev=props.nev, which=props.which)
@timeit to "solve eigenvalue problem using `eigs`" begin
om2, X = eigs(K_red + sigma*I, M_red; nev=props.nev, which=props.which)
end
passed = true
catch
info("failed to calculate eigenvalues for problem. Maybe stiffness matrix is not positive definite, checking...")
@@ -350,7 +354,9 @@ function (solver::Solver{Modal})(; bc_invertible=false, P=nothing, symmetric=tru
end
end
update_xdmf!(solver)
@timeit to "save results to Xdmf" begin
update_xdmf!(solver)
end
return true