From dd252384d6d122a2476f17cf7f200a5828675d87 Mon Sep 17 00:00:00 2001 From: Thomas Fischer <thomas.fischer@ufz.de> Date: Thu, 4 Mar 2021 14:30:44 +0100 Subject: [PATCH] drop debug output --- NumLib/DOF/SimpleMatrixVectorProvider.cpp | 2 ++ NumLib/ODESolver/NonlinearSolver.cpp | 16 +++++++++++++++- NumLib/ODESolver/TimeDiscretizedODESystem.cpp | 8 ++++++++ ProcessLib/TimeLoop.cpp | 11 ++++++++--- 4 files changed, 33 insertions(+), 4 deletions(-) diff --git a/NumLib/DOF/SimpleMatrixVectorProvider.cpp b/NumLib/DOF/SimpleMatrixVectorProvider.cpp index 67fe93e7154..6068240c68f 100644 --- a/NumLib/DOF/SimpleMatrixVectorProvider.cpp +++ b/NumLib/DOF/SimpleMatrixVectorProvider.cpp @@ -111,6 +111,7 @@ GlobalMatrix& SimpleMatrixVectorProvider:: getMatrix(std::size_t& id) { + INFO("MEMORY SimpleMatrixVectorProvider: used_matrices: {:d}, unused_matrices: {:d}", _used_matrices.size(), _unused_matrices.size()); return *getMatrix_<true>(id).first; } @@ -180,6 +181,7 @@ GlobalVector& SimpleMatrixVectorProvider:: getVector(std::size_t& id) { + INFO("MEMORY SimpleMatrixVectorProvider: used_vectors: {:d}, unused_vectors: {:d}", _used_vectors.size(), _unused_vectors.size()); return *getVector_<true>(id).first; } diff --git a/NumLib/ODESolver/NonlinearSolver.cpp b/NumLib/ODESolver/NonlinearSolver.cpp index 6a8ffcd420a..978625d828c 100644 --- a/NumLib/ODESolver/NonlinearSolver.cpp +++ b/NumLib/ODESolver/NonlinearSolver.cpp @@ -15,6 +15,7 @@ #include "BaseLib/ConfigTree.h" #include "BaseLib/Error.h" #include "BaseLib/Logging.h" +#include "BaseLib/MemWatch.h" #include "BaseLib/RunTime.h" #include "ConvergenceCriterion.h" #include "MathLib/LinAlg/LinAlg.h" @@ -53,6 +54,8 @@ NonlinearSolverStatus NonlinearSolver<NonlinearSolverTag::Picard>::solve( postIterationCallback, int const process_id) { + BaseLib::MemWatch mem_watch; + namespace LinAlg = MathLib::LinAlg; auto& sys = *_equation_system; @@ -79,8 +82,8 @@ NonlinearSolverStatus NonlinearSolver<NonlinearSolverTag::Picard>::solve( BaseLib::RunTime time_iteration; time_iteration.start(); - timer_dirichlet.start(); + sys.computeKnownSolutions(*x_new[process_id], process_id); sys.applyKnownSolutions(*x_new[process_id]); time_dirichlet += timer_dirichlet.elapsed(); @@ -89,9 +92,17 @@ NonlinearSolverStatus NonlinearSolver<NonlinearSolverTag::Picard>::solve( BaseLib::RunTime time_assembly; time_assembly.start(); + const unsigned long mem_begin = mem_watch.getVirtMemUsage() / (1024 * 1024); sys.assemble(x_new, x_prev, process_id); + const unsigned long mem_assemble = mem_watch.getVirtMemUsage() / (1024 * 1024); + INFO("MEMORY solve: assemble {:d} MB", mem_assemble - mem_begin); sys.getA(A); + const unsigned long mem_get_A = mem_watch.getVirtMemUsage() / (1024 * 1024); + INFO("MEMORY solve: mem_get_A {:d} MB", mem_get_A - mem_assemble); sys.getRhs(*x_prev[process_id], rhs); + const unsigned long mem_get_Rhs = mem_watch.getVirtMemUsage() / (1024 * 1024); + INFO("MEMORY solve: mem_get_Rhs {:d} MB", mem_get_Rhs - mem_get_A); + INFO("[time] Assembly took {:g} s.", time_assembly.elapsed()); // Subtract non-equilibrium initial residuum if set @@ -179,6 +190,9 @@ NonlinearSolverStatus NonlinearSolver<NonlinearSolverTag::Picard>::solve( // Update x s.t. in the next iteration we will compute the right delta x LinAlg::copy(*x_new[process_id], *x[process_id]); + const unsigned long mem_end = mem_watch.getVirtMemUsage() / (1024 * 1024); + INFO("MEMORY solve: iteration {:d} MB", mem_end - mem_begin); + INFO("[time] Iteration #{:d} took {:g} s.", iteration, time_iteration.elapsed()); diff --git a/NumLib/ODESolver/TimeDiscretizedODESystem.cpp b/NumLib/ODESolver/TimeDiscretizedODESystem.cpp index d28ea348a1c..b742bdd283a 100644 --- a/NumLib/ODESolver/TimeDiscretizedODESystem.cpp +++ b/NumLib/ODESolver/TimeDiscretizedODESystem.cpp @@ -10,6 +10,7 @@ #include "TimeDiscretizedODESystem.h" +#include "BaseLib/MemWatch.h" #include "MathLib/LinAlg/ApplyKnownSolution.h" #include "MathLib/LinAlg/UnifiedMatrixSetters.h" #include "NumLib/IndexValueVector.h" @@ -85,6 +86,8 @@ void TimeDiscretizedODESystem<ODESystemTag::FirstOrderImplicitQuasilinear, std::vector<GlobalVector*> xdot(x_new_timestep.size()); _xdot_ids.resize(x_new_timestep.size()); + INFO("MEMORY _xdot_ids[0]: {:d}", _xdot_ids[0]); + for (std::size_t i = 0; i < xdot.size(); i++) { xdot[i] = &NumLib::GlobalVectorProvider::provider.getVector(_xdot_ids[i]); @@ -215,6 +218,9 @@ void TimeDiscretizedODESystem<ODESystemTag::FirstOrderImplicitQuasilinear, std::vector<GlobalVector*> const& x_prev, int const process_id) { + BaseLib::MemWatch mem_watch; + const unsigned long mem_begin = mem_watch.getVirtMemUsage() / (1024 * 1024); + namespace LinAlg = MathLib::LinAlg; auto const t = _time_disc.getCurrentTime(); @@ -244,6 +250,8 @@ void TimeDiscretizedODESystem<ODESystemTag::FirstOrderImplicitQuasilinear, { NumLib::GlobalVectorProvider::provider.releaseVector(*v); } + const unsigned long mem_assemble = mem_watch.getVirtMemUsage() / (1024 * 1024); + INFO("MEMORY TimeDiscretizedODESystem: assemble {:d} MB", mem_assemble - mem_begin); } void TimeDiscretizedODESystem< diff --git a/ProcessLib/TimeLoop.cpp b/ProcessLib/TimeLoop.cpp index dd0fafac706..0cc388ba15e 100644 --- a/ProcessLib/TimeLoop.cpp +++ b/ProcessLib/TimeLoop.cpp @@ -585,7 +585,7 @@ bool TimeLoop::loop() BaseLib::MemWatch mem_watch; while (t < _end_time) { - const unsigned long mem_begin_time_step = mem_watch.getVirtMemUsage(); + const unsigned long mem_begin_time_step = mem_watch.getVirtMemUsage() / (1024 * 1024); BaseLib::RunTime time_timestep; time_timestep.start(); @@ -615,6 +615,9 @@ bool TimeLoop::loop() preTimestepForAllProcesses(t, dt, _per_process_data, _process_solutions); + const unsigned long mem_preTimestepForAllProcesses = mem_watch.getVirtMemUsage() / (1024 * 1024); + INFO("MEMORY timestep {:d}: before non-linear solver : {:d} MB", timesteps, mem_preTimestepForAllProcesses - mem_begin_time_step); + if (is_staggered_coupling) { nonlinear_solver_status = @@ -625,6 +628,8 @@ bool TimeLoop::loop() nonlinear_solver_status = solveUncoupledEquationSystems(t, dt, timesteps); } + const unsigned long mem_nonlinear_solver = mem_watch.getVirtMemUsage() / (1024 * 1024); + INFO("MEMORY timestep {:d}: after non-linear solver: {:d} MB", timesteps, mem_nonlinear_solver - mem_begin_time_step); // Run post time step only if the last iteration was successful. // Otherwise it runs the risks to get the same errors as in the last @@ -664,8 +669,8 @@ bool TimeLoop::loop() dt, timesteps, t); break; } - const unsigned long mem_end_time_step = mem_watch.getVirtMemUsage(); - INFO("memory at begin of timestep: {:d}, memory at end of timestep: {:d}, diff: {:d}", mem_begin_time_step, mem_end_time_step, mem_end_time_step - mem_begin_time_step); + const unsigned long mem_end_time_step = mem_watch.getVirtMemUsage() / (1024 * 1024); + INFO("MEMORY timestep {:d}: mem at begin: {:d} MB, mem at end: {:d} MB, diff: {:d} MB", timesteps, mem_begin_time_step, mem_end_time_step, mem_end_time_step - mem_begin_time_step); } INFO( -- GitLab