Memory loss in system solver

99 views
Skip to first unread message

Alberto Salvadori

unread,
Jul 24, 2020, 5:32:13 AM7/24/20
to deal.II User Group
Dear community

I have written the simple code below for solving a system using PETSc,
having defined 

Vector<double> incremental_displacement;
Vector<double> accumulated_displacement;

in the class LargeStrainMechanicalProblem_OneField<dim>.

It turns out that this code produces a memory loss, quite significant since I am solving my system thousands of times, eventually inducing the run to fail. I am not sure what is causing this issue and how to solve it, maybe more experienced users than myself can catch the problem with a snap of fingers. 

I have verified the issue on my mac (Catalina) as well as on linux ubuntu (4.15.0), using deal.ii 9.1.1.
Apparently the issue reveals only when mpi is invoked with more than one processor, whereas it does not emerge when running in serial or by mpirun -np 1.

Thanks in advance

Alberto

=========




template <int dim>
unsigned int LargeStrainMechanicalProblem_OneField<dim>
::
solve (
const unsigned penaltyAmplification
)

//
// this simplified version of solve has been written to find out
// the source of memory leak in parallel
//

{

PETScWrappers::MPI::Vector distributed_incremental_displacement (this>locally_owned_dofs,this->mpi_communicator);

distributed_incremental_displacement = incremental_displacement;

size_t
bicgstab_max_iterations = 20000 ;

double
tolerance = 1e-10 * this->system_rhs.l2_norm() ;

unsigned solver_control_last_step;

SolverControl bicgstab_solver_control ( bicgstab_max_iterations , tolerance ); 

PETScWrappers::PreconditionJacobi preconditioner( this->system_matrix );

this->pcout << " Bicgstab " << std::flush ;

PETScWrappers::SolverBicgstab BiCG (bicgstab_solver_control, this->mpi_communicator);

BiCG.solve (this->system_matrix, distributed_incremental_displacement, this->system_rhs, preconditioner);

solver_control_last_step = bicgstab_solver_control.last_step();

incremental_displacement = distributed_incremental_displacement;
accumulated_displacement += incremental_displacement;
this->hanging_node_constraints.distribute (accumulated_displacement);

return solver_control_last_step;

}

Alberto Salvadori

unread,
Jul 24, 2020, 12:07:05 PM7/24/20
to deal.II User Group
Dear community,

if I am not mistaking my analysis, it turned out that the memory loss is caused by this call:

BiCG.solve (this->system_matrix, distributed_incremental_displacement, this->system_rhs, preconditioner);

because if I turn it off the top command shows no change in the RES at all.

Maybe this is of use. Thanks in advance.

Alberto

Daniel Arndt

unread,
Jul 24, 2020, 3:37:02 PM7/24/20
to dea...@googlegroups.com
Alberto,

Have you tried running valgrind (in parallel) on your code? Admittedly, I expect quite a bit of false-positives from the MPI library but it should still help.

Best,
Daniel

Informativa sulla Privacy: http://www.unibs.it/node/8155

--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dealii+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/24389a5b-59ba-4f32-8c4b-06d23d0fe2ban%40googlegroups.com.

Wolfgang Bangerth

unread,
Jul 24, 2020, 11:46:08 PM7/24/20
to dea...@googlegroups.com
On 7/24/20 3:32 AM, Alberto Salvadori wrote:
>
> It turns out that this code produces a memory loss, quite significant since I
> am solving my system thousands of times, eventually inducing the run to fail.
> I am not sure what is causing this issue and how to solve it, maybe more
> experienced users than myself can catch the problem with a snap of fingers.
>
> I have verified the issue on my mac (Catalina) as well as on linux ubuntu
> (4.15.0), using deal.ii 9.1.1.
> Apparently the issue reveals only when mpi is invoked with more than one
> processor, whereas it does not emerge when running in serial or by mpirun -np 1.

Alberto -- I've taken a look at the SolverBicgstab class and don't see
anything glaringly obvious that would suggest where the memory is lost. It's
also funny that that would only happen with more than one processor because
the memory handling of PETSc vectors shouldn't be any different for one or
more processors.

Do you think you could come up with a simple test case that illustrates the
problem? In your case, I'd start with the code you have and remove basically
everything you do: replace the assembly by a function that just fills the
matrix with the identity matrix (or something similarly simple), remove
everything that does anything useful with the solution, remove graphical
output, etc. The only thing that should remain is the loop that repeatedly
solves a linear system and illustrates the memory leak, but the program no
longer has to do anything useful (in fact, it probably shouldn't -- it should
only exercise the one part you suspect of causing the memory leak).

I think that would make finding the root cause substantially simpler!

Best
W.

--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/

Richard Schussnig

unread,
Jul 25, 2020, 4:24:20 AM7/25/20
to deal.II User Group
Hi Alberto,
I might be having a similar or even the same problem with petsc! In my case, the memory accumulated is proportional to the number of iterations done in the SolverFGMRES solver. Also, when using trilinos (switch between petsc and trilinos see step 40 I believe), this does not(!) happen!
Please do report back, if you find anything - I did not look into it for now, but will do in a week or so.
Regards & good luck,
Richard

Alberto Salvadori

unread,
Jul 25, 2020, 4:29:43 AM7/25/20
to dea...@googlegroups.com
It happens to me the same, the memory loss increments at each call if the solver. It happens with BICG and with GMRES as well.

Alberto Salvadori
Associate Professor
DIMI, University of Brescia, Italy
> --
> The deal.II project is located at http://www.dealii.org/
> For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en
> ---
> You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to dealii+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/e0b379a9-dba7-4133-8ef0-ad308e680ffeo%40googlegroups.com.

--


Informativa sulla Privacy: http://www.unibs.it/node/8155
<http://www.unibs.it/node/8155>

Alberto Salvadori

unread,
Jul 28, 2020, 6:26:03 AM7/28/20
to deal.II User Group
Dear Wolfgang,

thank you for your guidance, I did what you suggested. Basically all calls in the system matrix construction have been removed but integration of unit per each element, with zero rhs. To make the system solvable, (non-zero, but it should be non relevant) Dirichlet boundary conditions have been imposed on the whole boundary. I checked the memory consumption through top->RES without solving the linear system, no issues arose. Again, as soon as I invoke 

BiCG.solve (this->system_matrix, distributed_incremental_displacement, this->system_rhs, preconditioner);

top->RES shows memory leaks. Guided by Richard remark, I implemented the trilinos solver as well. In such a case, no leaks at all. Even building the system matrix in the complete form.
My guess is that there must be either some conflicts or installation related issues with PETSc. Note that the system solution was always OK, the concern was just about the memory loss.

I did check that no issue arise in running step-18 from the library examples. 

In conclusion, the problem must be there, sorry I was not able to identify it more properly. Maybe Richard can be more precise, and I am at disposal, of course.

Hope this helps. 

Alberto

Alberto Salvadori

unread,
Jul 29, 2020, 11:09:01 AM7/29/20
to deal.II User Group
Hi Daniel,

here is the report of valgrind. Can you maybe help devising potential issues? I am afraid to be not sufficiently skilled, yet.
Thank you, I appreciate.

Alberto



albertosalvadori@ubuntu:~/Codes/m4_code/Release$ valgrind --leak-check=yes mpirun -np 4 ./m4_code_9.1.1 ../input/viscosity_test -mechanics
==15940== Memcheck, a memory error detector
==15940== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==15940== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==15940== Command: mpirun -np 4 ./m4_code_9.1.1 ../input/viscosity_test -mechanics
==15940==
==15940== Warning: noted but unhandled ioctl 0x5441 with no size/direction hints.
==15940==    This could cause spurious value errors to appear.
==15940==    See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a proper wrapper.
==15944== Warning: invalid file descriptor 1024 in syscall close()
==15944== Warning: invalid file descriptor 1025 in syscall close()
==15944== Warning: invalid file descriptor 1026 in syscall close()
==15944== Warning: invalid file descriptor 1027 in syscall close()
==15944==    Use --log-fd=<number> to select an alternative log fd.
==15944== Warning: invalid file descriptor 1028 in syscall close()
==15944== Warning: invalid file descriptor 1029 in syscall close()
==15945== Warning: invalid file descriptor 1024 in syscall close()
==15945== Warning: invalid file descriptor 1025 in syscall close()
==15945== Warning: invalid file descriptor 1026 in syscall close()
==15945== Warning: invalid file descriptor 1027 in syscall close()
==15945==    Use --log-fd=<number> to select an alternative log fd.
==15945== Warning: invalid file descriptor 1028 in syscall close()
==15945== Warning: invalid file descriptor 1029 in syscall close()
==15945== Warning: invalid file descriptor 1030 in syscall close()
==15946== Warning: invalid file descriptor 1024 in syscall close()
==15946== Warning: invalid file descriptor 1025 in syscall close()
==15946== Warning: invalid file descriptor 1026 in syscall close()
==15946== Warning: invalid file descriptor 1027 in syscall close()
==15946==    Use --log-fd=<number> to select an alternative log fd.
==15946== Warning: invalid file descriptor 1028 in syscall close()
==15946== Warning: invalid file descriptor 1029 in syscall close()
==15947== Warning: invalid file descriptor 1024 in syscall close()
==15947== Warning: invalid file descriptor 1025 in syscall close()
==15947== Warning: invalid file descriptor 1026 in syscall close()
==15947== Warning: invalid file descriptor 1027 in syscall close()
==15947==    Use --log-fd=<number> to select an alternative log fd.
==15947== Warning: invalid file descriptor 1028 in syscall close()
==15947== Warning: invalid file descriptor 1029 in syscall close()


  Welcome to m4_code, a multiphysics solver for several class of problems developed at the m4lab @ UNIBS.
  The problem that is going to be solved is: Mechanics for the data set ../input/viscosity_test

  Problem LargeStrainMechanicalProblem_OneField defined  

   Reading material parameters from file ../input/viscosity_test.materials ...  done
   Reading time discretization parameters from file ../input/viscosity_test.time_discretization ...  done

  Time = 0.0000, step =        0
   Initialization
   Reading discretization from file ../input/viscosity_test.msh ...  done
   Number of active cells:       24 (by partition: 6+6+6+6)
   Number of degrees of freedom: 153 (by partition: 63+30+33+27)
   Dirichlet faces: 36, Neumann faces (with non-zero tractions): 0, contact faces: 0
    NR it. 0, Assembling..., convergence achieved.
    Writing output...,     0.00 s. Elapsed time     0.00 s.

  Time = 0.0100, step =        1
  Cycle 0:
   Number of active cells:       24 (by partition: 6+6+6+6)
   Number of degrees of freedom: 153 (by partition: 63+30+33+27)
   Dirichlet faces: 36, symmetry faces: 0
   Dirichlet faces: 36, Neumann faces (with non-zero tractions): 0, contact faces: 0
    NR it. 0, Assembling...,     0.00 s, norm of residual is 85544.434331779601052
                 Jacobi - Bicgstab , solver converged in 8 iterations,     0.00 s, updating q. p. data,     0.00 s.
    NR it. 1, Assembling...,     0.00 s, norm of residual is    2.878811227221835 residual / initial_residual    0.000033652817389
                 Jacobi - Bicgstab , solver converged in 7 iterations,     0.00 s, updating q. p. data,     0.00 s.
    NR it. 2, Assembling...,     0.00 s, norm of residual is    1.251122517879704 residual / initial_residual    0.000014625411082
                 Jacobi - Bicgstab , solver converged in 8 iterations,     0.00 s, updating q. p. data,     0.00 s.
    NR it. 3, Assembling...,     0.00 s, norm of residual is    0.589683284238633 residual / initial_residual    0.000006893298072
                 Jacobi - Bicgstab , solver converged in 7 iterations,     0.00 s, updating q. p. data,     0.00 s.
    NR it. 4, Assembling...,     0.00 s, norm of residual is    0.286154795390284 residual / initial_residual    0.000003345101264
                 Jacobi - Bicgstab , solver converged in 7 iterations,     0.00 s, updating q. p. data,     0.00 s.
    NR it. 5, Assembling...,     0.00 s, norm of residual is    0.140996840962549 residual / initial_residual    0.000001648229275
                 Jacobi - Bicgstab , solver converged in 7 iterations,     0.00 s, updating q. p. data,     0.00 s.
    NR it. 6, Assembling...,     0.00 s, norm of residual is    0.070130790642500 residual / initial_residual    0.000000819817107, convergence achieved.
    Writing output...,     0.00 s. Elapsed time     0.01 s.

  Time = 0.0200, step =        2
    NR it. 0, Assembling...,     0.00 s, norm of residual is 85527.166469113071798
                 Jacobi - Bicgstab , solver converged in 8 iterations,     0.00 s, updating q. p. data,     0.00 s.
    NR it. 1, Assembling...,     0.00 s, norm of residual is    2.833292747597304 residual / initial_residual    0.000033127401089
                 Jacobi - Bicgstab , solver converged in 7 iterations,     0.00 s, updating q. p. data,     0.00 s.
    NR it. 2, Assembling...,     0.00 s, norm of residual is    1.237625339847165 residual / initial_residual    0.000014470552351
                 Jacobi - Bicgstab , solver converged in 8 iterations,     0.00 s, updating q. p. data,     0.00 s.
    NR it. 3, Assembling...,     0.00 s, norm of residual is    0.583941014065106 residual / initial_residual    0.000006827550101
                 Jacobi - Bicgstab , solver converged in 7 iterations,     0.00 s, updating q. p. data,     0.00 s.
    NR it. 4, Assembling...,     0.00 s, norm of residual is    0.283285692816626 residual / initial_residual    0.000003312230540
                 Jacobi - Bicgstab , solver converged in 7 iterations,     0.00 s, updating q. p. data,     0.00 s.
    NR it. 5, Assembling...,     0.00 s, norm of residual is    0.139462610870105 residual / initial_residual    0.000001630623539
                 Jacobi - Bicgstab , solver converged in 7 iterations,     0.00 s, updating q. p. data,     0.00 s.
    NR it. 6, Assembling...,     0.00 s, norm of residual is    0.069287951261074 residual / initial_residual    0.000000810127988, convergence achieved.
    Writing output...,     0.00 s. Elapsed time     0.01 s.

  Time = 0.0300, step =        3
    NR it. 0, Assembling...,     0.00 s, norm of residual is 85508.630080626477138
                 Jacobi - Bicgstab , solver converged in 8 iterations,     0.00 s, updating q. p. data,     0.00 s.
    NR it. 1, Assembling...,     0.00 s, norm of residual is    2.762016583926737 residual / initial_residual    0.000032301027175
                 Jacobi - Bicgstab , solver converged in 7 iterations,     0.00 s, updating q. p. data,     0.00 s.
    NR it. 2, Assembling...,     0.00 s, norm of residual is    1.208785226058421 residual / initial_residual    0.000014136412020
                 Jacobi - Bicgstab , solver converged in 8 iterations,     0.00 s, updating q. p. data,     0.00 s.
    NR it. 3, Assembling...,     0.00 s, norm of residual is    0.570076433206978 residual / initial_residual    0.000006666887689
                 Jacobi - Bicgstab , solver converged in 7 iterations,     0.00 s, updating q. p. data,     0.00 s.
    NR it. 4, Assembling...,     0.00 s, norm of residual is    0.276241018233497 residual / initial_residual    0.000003230563020
                 Jacobi - Bicgstab , solver converged in 7 iterations,     0.00 s, updating q. p. data,     0.00 s.
    NR it. 5, Assembling...,     0.00 s, norm of residual is    0.135804501324608 residual / initial_residual    0.000001588196433
                 Jacobi - Bicgstab , solver converged in 7 iterations,     0.00 s, updating q. p. data,     0.00 s.
    NR it. 6, Assembling...,     0.00 s, norm of residual is    0.067369573885574 residual / initial_residual    0.000000787868708, convergence achieved.
    Writing output...,     0.00 s. Elapsed time     0.01 s.

  Time = 0.0400, step =        4
    NR it. 0, Assembling...,     0.00 s, norm of residual is 85488.917497585309320
                 Jacobi - Bicgstab , solver converged in 8 iterations,     0.00 s, updating q. p. data,     0.00 s.
    NR it. 1, Assembling...,     0.00 s, norm of residual is    2.695011376135198 residual / initial_residual    0.000031524687118
                 Jacobi - Bicgstab , solver converged in 7 iterations,     0.00 s, updating q. p. data,     0.00 s.
    NR it. 2, Assembling...,     0.00 s, norm of residual is    1.181258398115642 residual / initial_residual    0.000013817678744
                 Jacobi - Bicgstab , solver converged in 8 iterations,     0.00 s, updating q. p. data,     0.00 s.
    NR it. 3, Assembling...,     0.00 s, norm of residual is    0.556795954922090 residual / initial_residual    0.000006513077615
                 Jacobi - Bicgstab , solver converged in 7 iterations,     0.00 s, updating q. p. data,     0.00 s.
    NR it. 4, Assembling...,     0.00 s, norm of residual is    0.269504925293314 residual / initial_residual    0.000003152513018
                 Jacobi - Bicgstab , solver converged in 7 iterations,     0.00 s, updating q. p. data,     0.00 s.
    NR it. 5, Assembling...,     0.00 s, norm of residual is    0.132319587221657 residual / initial_residual    0.000001547798137
                 Jacobi - Bicgstab , solver converged in 7 iterations,     0.00 s, updating q. p. data,     0.00 s.
    NR it. 6, Assembling...,     0.00 s, norm of residual is    0.065549752241302 residual / initial_residual    0.000000766763157, convergence achieved.
    Writing output...,     0.00 s. Elapsed time     0.01 s.

  Time = 0.0500, step =        5
    NR it. 0, Assembling...,     0.00 s, norm of residual is 85468.116351285294513
                 Jacobi - Bicgstab , solver converged in 8 iterations,     0.00 s, updating q. p. data,     0.00 s.
    NR it. 1, Assembling...,     0.00 s, norm of residual is    2.632626127873656 residual / initial_residual    0.000030802435344
                 Jacobi - Bicgstab , solver converged in 7 iterations,     0.00 s, updating q. p. data,     0.00 s.
    NR it. 2, Assembling...,     0.00 s, norm of residual is    1.155304911256316 residual / initial_residual    0.000013517378884
                 Jacobi - Bicgstab , solver converged in 8 iterations,     0.00 s, updating q. p. data,     0.00 s.
    NR it. 3, Assembling...,     0.00 s, norm of residual is    0.544238373865104 residual / initial_residual    0.000006367735679
                 Jacobi - Bicgstab , solver converged in 7 iterations,     0.00 s, updating q. p. data,     0.00 s.
    NR it. 4, Assembling...,     0.00 s, norm of residual is    0.263146637278587 residual / initial_residual    0.000003078886590
                 Jacobi - Bicgstab , solver converged in 7 iterations,     0.00 s, updating q. p. data,     0.00 s.
    NR it. 5, Assembling...,     0.00 s, norm of residual is    0.129041233945870 residual / initial_residual    0.000001509817221
                 Jacobi - Bicgstab , solver converged in 7 iterations,     0.00 s, updating q. p. data,     0.00 s.
    NR it. 6, Assembling...,     0.00 s, norm of residual is    0.063844231873425 residual / initial_residual    0.000000746994723, convergence achieved.
    Writing output...,     0.00 s. Elapsed time     0.01 s.

  Done.

==15940==
==15940== HEAP SUMMARY:
==15940==     in use at exit: 702,101 bytes in 9,911 blocks
==15940==   total heap usage: 43,195 allocs, 33,284 frees, 1,150,113,471 bytes allocated
==15940==
==15940== 136 bytes in 1 blocks are definitely lost in loss record 30 of 47
==15940==    at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15940==    by 0x4EFA039: orte_rmaps_base_print_mapping (in /home/dealii/spack/opt/spack/linux-ubuntu18.04-skylake/gcc-7.5.0/openmpi-3.1.5-i73g2jkrcifjgtsishpfwloiu5syp244/lib/libopen-rte.so.40.10.5)
==15940==    by 0x4E8BD1A: orte_pmix_server_register_nspace (in /home/dealii/spack/opt/spack/linux-ubuntu18.04-skylake/gcc-7.5.0/openmpi-3.1.5-i73g2jkrcifjgtsishpfwloiu5syp244/lib/libopen-rte.so.40.10.5)
==15940==    by 0x4ECC251: orte_odls_base_default_construct_child_list (in /home/dealii/spack/opt/spack/linux-ubuntu18.04-skylake/gcc-7.5.0/openmpi-3.1.5-i73g2jkrcifjgtsishpfwloiu5syp244/lib/libopen-rte.so.40.10.5)
==15940==    by 0x4ECFA51: orte_odls_default_launch_local_procs (in /home/dealii/spack/opt/spack/linux-ubuntu18.04-skylake/gcc-7.5.0/openmpi-3.1.5-i73g2jkrcifjgtsishpfwloiu5syp244/lib/libopen-rte.so.40.10.5)
==15940==    by 0x4E833A7: orte_daemon_recv (in /home/dealii/spack/opt/spack/linux-ubuntu18.04-skylake/gcc-7.5.0/openmpi-3.1.5-i73g2jkrcifjgtsishpfwloiu5syp244/lib/libopen-rte.so.40.10.5)
==15940==    by 0x4F09B0A: orte_rml_base_process_msg (in /home/dealii/spack/opt/spack/linux-ubuntu18.04-skylake/gcc-7.5.0/openmpi-3.1.5-i73g2jkrcifjgtsishpfwloiu5syp244/lib/libopen-rte.so.40.10.5)
==15940==    by 0x5218CF8: event_process_active_single_queue (event.c:1370)
==15940==    by 0x5218CF8: event_process_active (event.c:1440)
==15940==    by 0x5218CF8: opal_libevent2022_event_base_loop (event.c:1644)
==15940==    by 0x109679: orterun (in /home/dealii/spack/opt/spack/linux-ubuntu18.04-skylake/gcc-7.5.0/openmpi-3.1.5-i73g2jkrcifjgtsishpfwloiu5syp244/bin/orterun)
==15940==    by 0x5602B96: (below main) (libc-start.c:310)
==15940==
==15940== 2,036 (672 direct, 1,364 indirect) bytes in 4 blocks are definitely lost in loss record 43 of 47
==15940==    at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15940==    by 0x4EF75E0: orte_rmaps_base_setup_proc (in /home/dealii/spack/opt/spack/linux-ubuntu18.04-skylake/gcc-7.5.0/openmpi-3.1.5-i73g2jkrcifjgtsishpfwloiu5syp244/lib/libopen-rte.so.40.10.5)
==15940==    by 0x4EFF1E4: orte_rmaps_rr_byobj (in /home/dealii/spack/opt/spack/linux-ubuntu18.04-skylake/gcc-7.5.0/openmpi-3.1.5-i73g2jkrcifjgtsishpfwloiu5syp244/lib/libopen-rte.so.40.10.5)
==15940==    by 0x4EFE172: orte_rmaps_rr_map (in /home/dealii/spack/opt/spack/linux-ubuntu18.04-skylake/gcc-7.5.0/openmpi-3.1.5-i73g2jkrcifjgtsishpfwloiu5syp244/lib/libopen-rte.so.40.10.5)
==15940==    by 0x4EF4F7F: orte_rmaps_base_map_job (in /home/dealii/spack/opt/spack/linux-ubuntu18.04-skylake/gcc-7.5.0/openmpi-3.1.5-i73g2jkrcifjgtsishpfwloiu5syp244/lib/libopen-rte.so.40.10.5)
==15940==    by 0x5218CF8: event_process_active_single_queue (event.c:1370)
==15940==    by 0x5218CF8: event_process_active (event.c:1440)
==15940==    by 0x5218CF8: opal_libevent2022_event_base_loop (event.c:1644)
==15940==    by 0x109679: orterun (in /home/dealii/spack/opt/spack/linux-ubuntu18.04-skylake/gcc-7.5.0/openmpi-3.1.5-i73g2jkrcifjgtsishpfwloiu5syp244/bin/orterun)
==15940==    by 0x5602B96: (below main) (libc-start.c:310)
==15940==
==15940== LEAK SUMMARY:
==15940==    definitely lost: 808 bytes in 5 blocks
==15940==    indirectly lost: 1,364 bytes in 16 blocks
==15940==      possibly lost: 0 bytes in 0 blocks
==15940==    still reachable: 699,929 bytes in 9,890 blocks
==15940==         suppressed: 0 bytes in 0 blocks
==15940== Reachable blocks (those to which a pointer was found) are not shown.
==15940== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==15940==
==15940== For counts of detected and suppressed errors, rerun with: -v
==15940== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)


albertosalvadori@ubuntu:~/Codes/m4_code/Release$  valgrind --leak-check=yes ./m4_code_9.1.1 ../input/viscosity_test -mechanics
==16016== Memcheck, a memory error detector
==16016== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==16016== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==16016== Command: ./m4_code_9.1.1 ../input/viscosity_test -mechanics
==16016==


  Welcome to m4_code, a multiphysics solver for several class of problems developed at the m4lab @ UNIBS.
  The problem that is going to be solved is: Mechanics for the data set ../input/viscosity_test

  Problem LargeStrainMechanicalProblem_OneField defined  

   Reading material parameters from file ../input/viscosity_test.materials ...  done
   Reading time discretization parameters from file ../input/viscosity_test.time_discretization ...  done

  Time = 0.0000, step =        0
   Initialization
   Reading discretization from file ../input/viscosity_test.msh ...  done
   Number of active cells:       24 (by partition: 24)
   Number of degrees of freedom: 153 (by partition: 153)
   Dirichlet faces: 36, Neumann faces (with non-zero tractions): 0, contact faces: 0
    NR it. 0, Assembling..., convergence achieved.
    Writing output...,     0.13 s. Elapsed time     1.17 s.

  Time = 0.0100, step =        1
  Cycle 0:
   Number of active cells:       24 (by partition: 24)
   Number of degrees of freedom: 153 (by partition: 153)
   Dirichlet faces: 36, symmetry faces: 0
   Dirichlet faces: 36, Neumann faces (with non-zero tractions): 0, contact faces: 0
    NR it. 0, Assembling...,     0.49 s, norm of residual is 91034.225329364344361
                 Jacobi - Bicgstab , solver converged in 8 iterations,     0.12 s, updating q. p. data,     0.02 s.
    NR it. 1, Assembling...,     0.66 s, norm of residual is    2.878811227221786 residual / initial_residual    0.000031623394573
                 Jacobi - Bicgstab , solver converged in 7 iterations,     0.01 s, updating q. p. data,     0.01 s.
    NR it. 2, Assembling...,     0.69 s, norm of residual is    1.251122517853476 residual / initial_residual    0.000013743430159
                 Jacobi - Bicgstab , solver converged in 8 iterations,     0.01 s, updating q. p. data,     0.01 s.
    NR it. 3, Assembling...,     0.85 s, norm of residual is    0.589683284214466 residual / initial_residual    0.000006477599849
                 Jacobi - Bicgstab , solver converged in 7 iterations,     0.01 s, updating q. p. data,     0.01 s.
    NR it. 4, Assembling...,     0.72 s, norm of residual is    0.286154795364823 residual / initial_residual    0.000003143375959
                 Jacobi - Bicgstab , solver converged in 7 iterations,     0.01 s, updating q. p. data,     0.01 s.
    NR it. 5, Assembling...,     0.74 s, norm of residual is    0.140996840961326 residual / initial_residual    0.000001548833315
                 Jacobi - Bicgstab , solver converged in 7 iterations,     0.01 s, updating q. p. data,     0.01 s.
    NR it. 6, Assembling...,     0.73 s, norm of residual is    0.070130790656907 residual / initial_residual    0.000000770378288, convergence achieved.
    Writing output...,     0.02 s. Elapsed time     5.20 s.

  Time = 0.0200, step =        2
    NR it. 0, Assembling...,     0.76 s, norm of residual is 91019.816765709023457
                 Jacobi - Bicgstab , solver converged in 8 iterations,     0.01 s, updating q. p. data,     0.01 s.
    NR it. 1, Assembling...,     0.83 s, norm of residual is    2.833292747504541 residual / initial_residual    0.000031128306430
                 Jacobi - Bicgstab , solver converged in 7 iterations,     0.01 s, updating q. p. data,     0.01 s.
    NR it. 2, Assembling...,     0.76 s, norm of residual is    1.237625339758325 residual / initial_residual    0.000013597317417
                 Jacobi - Bicgstab , solver converged in 8 iterations,     0.01 s, updating q. p. data,     0.01 s.
    NR it. 3, Assembling...,     0.84 s, norm of residual is    0.583941014051878 residual / initial_residual    0.000006415537130
                 Jacobi - Bicgstab , solver converged in 7 iterations,     0.01 s, updating q. p. data,     0.01 s.
    NR it. 4, Assembling...,     0.76 s, norm of residual is    0.283285692895102 residual / initial_residual    0.000003112351826
                 Jacobi - Bicgstab , solver converged in 7 iterations,     0.01 s, updating q. p. data,     0.01 s.
    NR it. 5, Assembling...,     0.72 s, norm of residual is    0.139462610865597 residual / initial_residual    0.000001532222496
                 Jacobi - Bicgstab , solver converged in 7 iterations,     0.01 s, updating q. p. data,     0.01 s.
    NR it. 6, Assembling...,     0.84 s, norm of residual is    0.069287951197439 residual / initial_residual    0.000000761240284, convergence achieved.
    Writing output...,     0.02 s. Elapsed time     5.67 s.

  Time = 0.0300, step =        3
    NR it. 0, Assembling...,     0.88 s, norm of residual is 91004.270071844381164
                 Jacobi - Bicgstab , solver converged in 8 iterations,     0.01 s, updating q. p. data,     0.01 s.
    NR it. 1, Assembling...,     0.84 s, norm of residual is    2.762016583840568 residual / initial_residual    0.000030350406433
                 Jacobi - Bicgstab , solver converged in 7 iterations,     0.01 s, updating q. p. data,     0.01 s.
    NR it. 2, Assembling...,     0.86 s, norm of residual is    1.208785225800891 residual / initial_residual    0.000013282730853
                 Jacobi - Bicgstab , solver converged in 8 iterations,     0.01 s, updating q. p. data,     0.01 s.
    NR it. 3, Assembling...,     0.86 s, norm of residual is    0.570076432979952 residual / initial_residual    0.000006264282242
                 Jacobi - Bicgstab , solver converged in 7 iterations,     0.01 s, updating q. p. data,     0.01 s.
    NR it. 4, Assembling...,     0.85 s, norm of residual is    0.276241018094444 residual / initial_residual    0.000003035473147
                 Jacobi - Bicgstab , solver converged in 7 iterations,     0.01 s, updating q. p. data,     0.01 s.
    NR it. 5, Assembling...,     0.85 s, norm of residual is    0.135804501308918 residual / initial_residual    0.000001492287133
                 Jacobi - Bicgstab , solver converged in 7 iterations,     0.01 s, updating q. p. data,     0.01 s.
    NR it. 6, Assembling...,     0.85 s, norm of residual is    0.067369573855780 residual / initial_residual    0.000000740290250, convergence achieved.
    Writing output...,     0.03 s. Elapsed time     6.15 s.

  Time = 0.0400, step =        4
    NR it. 0, Assembling...,     0.82 s, norm of residual is 90987.672485545655945
                 Jacobi - Bicgstab , solver converged in 7 iterations,     0.01 s, updating q. p. data,     0.01 s.
    NR it. 1, Assembling...,     0.77 s, norm of residual is   11.855541044511227 residual / initial_residual    0.000130298321967
                 Jacobi - Bicgstab , solver converged in 7 iterations,     0.01 s, updating q. p. data,     0.01 s.
    NR it. 2, Assembling...,     0.81 s, norm of residual is    5.024194956080943 residual / initial_residual    0.000055218413867
                 Jacobi - Bicgstab , solver converged in 7 iterations,     0.01 s, updating q. p. data,     0.01 s.
    NR it. 3, Assembling...,     0.73 s, norm of residual is    2.386446299837078 residual / initial_residual    0.000026228237679
                 Jacobi - Bicgstab , solver converged in 8 iterations,     0.01 s, updating q. p. data,     0.01 s.
    NR it. 4, Assembling...,     0.74 s, norm of residual is    1.169642298363859 residual / initial_residual    0.000012854953494
                 Jacobi - Bicgstab , solver converged in 7 iterations,     0.01 s, updating q. p. data,     0.01 s.
    NR it. 5, Assembling...,     0.83 s, norm of residual is    0.580900730478848 residual / initial_residual    0.000006384389386
                 Jacobi - Bicgstab , solver converged in 7 iterations,     0.01 s, updating q. p. data,     0.01 s.
    NR it. 6, Assembling...,     0.83 s, norm of residual is    0.290601814573314 residual / initial_residual    0.000003193859197
                 Jacobi - Bicgstab , solver converged in 7 iterations,     0.01 s, updating q. p. data,     0.01 s.
    NR it. 7, Assembling...,     0.77 s, norm of residual is    0.146033689679270 residual / initial_residual    0.000001604983243
                 Jacobi - Bicgstab , solver converged in 7 iterations,     0.01 s, updating q. p. data,     0.01 s.
    NR it. 8, Assembling...,     0.71 s, norm of residual is    0.073608751294460 residual / initial_residual    0.000000808996969, convergence achieved.
    Writing output...,     0.02 s. Elapsed time     7.20 s.

  Time = 0.0500, step =        5
    NR it. 0, Assembling...,     0.71 s, norm of residual is 90970.106811760648270
                 Jacobi - Bicgstab , solver converged in 7 iterations,     0.01 s, updating q. p. data,     0.01 s.
    NR it. 1, Assembling...,     0.77 s, norm of residual is   11.664731903434573 residual / initial_residual    0.000128225988869
                 Jacobi - Bicgstab , solver converged in 7 iterations,     0.01 s, updating q. p. data,     0.01 s.
    NR it. 2, Assembling...,     0.84 s, norm of residual is    4.931906111288249 residual / initial_residual    0.000054214579757
                 Jacobi - Bicgstab , solver converged in 7 iterations,     0.01 s, updating q. p. data,     0.01 s.
    NR it. 3, Assembling...,     0.68 s, norm of residual is    2.341475280102340 residual / initial_residual    0.000025738952741
                 Jacobi - Bicgstab , solver converged in 8 iterations,     0.01 s, updating q. p. data,     0.01 s.
    NR it. 4, Assembling...,     0.66 s, norm of residual is    1.146702999151362 residual / initial_residual    0.000012605272648
                 Jacobi - Bicgstab , solver converged in 7 iterations,     0.01 s, updating q. p. data,     0.01 s.
    NR it. 5, Assembling...,     0.69 s, norm of residual is    0.568910548063869 residual / initial_residual    0.000006253818622
                 Jacobi - Bicgstab , solver converged in 7 iterations,     0.01 s, updating q. p. data,     0.01 s.
    NR it. 6, Assembling...,     0.79 s, norm of residual is    0.284260458923041 residual / initial_residual    0.000003124767782
                 Jacobi - Bicgstab , solver converged in 7 iterations,     0.01 s, updating q. p. data,     0.01 s.
    NR it. 7, Assembling...,     0.81 s, norm of residual is    0.142660328891304 residual / initial_residual    0.000001568211074
                 Jacobi - Bicgstab , solver converged in 7 iterations,     0.01 s, updating q. p. data,     0.01 s.
    NR it. 8, Assembling...,     0.77 s, norm of residual is    0.071808965799463 residual / initial_residual    0.000000789368819, convergence achieved.
    Writing output...,     0.02 s. Elapsed time     6.89 s.

  Done.

==16016==
==16016== HEAP SUMMARY:
==16016==     in use at exit: 128,896 bytes in 78 blocks
==16016==   total heap usage: 120,131 allocs, 120,053 frees, 58,222,758 bytes allocated
==16016==
==16016== 79 (64 direct, 15 indirect) bytes in 1 blocks are definitely lost in loss record 35 of 63
==16016==    at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==16016==    by 0x20C6CCC8: mca_mpool_hugepage_open (in /home/dealii/spack/opt/spack/linux-ubuntu18.04-skylake/gcc-7.5.0/openmpi-3.1.5-i73g2jkrcifjgtsishpfwloiu5syp244/lib/libopen-pal.so.40.10.5)
==16016==    by 0x20C176A9: mca_base_framework_components_open (in /home/dealii/spack/opt/spack/linux-ubuntu18.04-skylake/gcc-7.5.0/openmpi-3.1.5-i73g2jkrcifjgtsishpfwloiu5syp244/lib/libopen-pal.so.40.10.5)
==16016==    by 0x20C6B491: mca_mpool_base_open (in /home/dealii/spack/opt/spack/linux-ubuntu18.04-skylake/gcc-7.5.0/openmpi-3.1.5-i73g2jkrcifjgtsishpfwloiu5syp244/lib/libopen-pal.so.40.10.5)
==16016==    by 0x20C23110: mca_base_framework_open (in /home/dealii/spack/opt/spack/linux-ubuntu18.04-skylake/gcc-7.5.0/openmpi-3.1.5-i73g2jkrcifjgtsishpfwloiu5syp244/lib/libopen-pal.so.40.10.5)
==16016==    by 0x11F669F9: ompi_mpi_init (in /home/dealii/spack/opt/spack/linux-ubuntu18.04-skylake/gcc-7.5.0/openmpi-3.1.5-i73g2jkrcifjgtsishpfwloiu5syp244/lib/libmpi.so.40.10.4)
==16016==    by 0x11DF6104: PMPI_Init_thread (in /home/dealii/spack/opt/spack/linux-ubuntu18.04-skylake/gcc-7.5.0/openmpi-3.1.5-i73g2jkrcifjgtsishpfwloiu5syp244/lib/libmpi.so.40.10.4)
==16016==    by 0xCB60C0E: dealii::Utilities::MPI::MPI_InitFinalize::MPI_InitFinalize(int&, char**&, unsigned int) (in /home/dealii/spack/opt/spack/linux-ubuntu18.04-skylake/gcc-7.5.0/dealii-9.1.1-rwy6s7qygaqdwov6gm33spdz5fjaancw/lib/libdeal_II.so.9.1.1)
==16016==    by 0x19DBB8: main (in /home/albertosalvadori/Codes/m4_code/Release/m4_code_9.1.1)
==16016==
==16016== LEAK SUMMARY:
==16016==    definitely lost: 64 bytes in 1 blocks
==16016==    indirectly lost: 15 bytes in 1 blocks
==16016==      possibly lost: 0 bytes in 0 blocks
==16016==    still reachable: 128,817 bytes in 76 blocks
==16016==         suppressed: 0 bytes in 0 blocks
==16016== Reachable blocks (those to which a pointer was found) are not shown.
==16016== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==16016==
==16016== For counts of detected and suppressed errors, rerun with: -v
==16016== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)

Richard Schussnig

unread,
Jul 29, 2020, 3:12:25 PM7/29/20
to deal.II User Group
Hi again,

Great to hear that you were able to construct a minimal working example & pinpoint the error location,
that is already of great help, but please do share the MWE you have constructed! 
I can also confirm, that this behaviour described in the previous posts does not(!) occur when running step-18
(I am running v.9.0.1, which is why I did not want to bother the mailing list).

If we have step-18 and your MWE, we simply compare and see, where the error might come from, right?
-Unfortunately though, I am not overly skilled when it comes to C++,
so maybe someone else might be kind enough to help us out on that one? 

Regards,
Richard

Wolfgang Bangerth

unread,
Jul 29, 2020, 8:56:25 PM7/29/20
to dea...@googlegroups.com
On 7/29/20 1:12 PM, Richard Schussnig wrote:
>
> Great to hear that you were able to construct a minimal working example &
> pinpoint the error location,
> that is already of great help, but please do share the MWE you have constructed!
> I can also confirm, that this behaviour described in the previous posts does
> not(!) occur when running step-18
> (I am running v.9.0.1, which is why I did not want to bother the mailing list).
>
> If we have step-18 and your MWE, we simply compare and see, where the error
> might come from, right?
> -Unfortunately though, I am not overly skilled when it comes to C++,
> so maybe someone else might be kind enough to help us out on that one?

All help would definitely be appreciated! (Hi Richard :-)

Having the minimal example would be a great first step!.

Richard Schussnig

unread,
Aug 16, 2020, 1:45:00 PM8/16/20
to deal.II User Group
Hi again,
it seems my last comment got lost, but I wanted to post it here for others researching that issue:
I constructed a MWE and found out, that actually solving the system via GMRES, CG or BiCGstab
using any of the implementations provided by PETSc, Trilinos or the dealii versions thereof did not result in memory loss!
So, from my side this was a false alarm!
-Good luck finding that bug Alberto!

PS: I will make a new thread for the bug in my code if necessary!

Kind regards,
Richard
Reply all
Reply to author
Forward
0 new messages