From: heister Date: Tue, 12 Oct 2010 18:46:58 +0000 (+0000) Subject: new test documenting a memory leak in FGMRES. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a96402446cefa00daa52686ca73de5ae4471c899;p=dealii-svn.git new test documenting a memory leak in FGMRES. git-svn-id: https://svn.dealii.org/trunk@22310 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/lac/solver_leak.cc b/tests/lac/solver_leak.cc new file mode 100644 index 0000000000..0b1a0b20d6 --- /dev/null +++ b/tests/lac/solver_leak.cc @@ -0,0 +1,96 @@ +//---------------------------------------------------------------------- +// $Id: solver.cc 21548 2010-07-20 19:58:37Z kanschat $ +// +// Copyright (C) 1998 - 2005, 2010 by the deal.II authors +// +// This file is subject to QPL and may not be distributed +// without copyright and license information. Please refer +// to the file deal.II/doc/license.html for the text and +// further information on this license. +// +//---------------------------------------------------------------------- + + +// test all solver with a start value that is already a solution (i.e. 0 +// iterations). This caused a memory leak in FGMRES. + + +#include "../tests.h" +#include "testmatrix.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +template +void +check_solve( const MATRIX& A, + VECTOR& u, VECTOR& f) +{ + GrowingVectorMemory<> mem; + SolverControl control(100, 1.e-3); + SOLVER solver(control, mem); + PreconditionIdentity prec_no; + u = 0.; + f = 0.; + + try + { + solver.solve(A, u, f, prec_no); + } + catch (std::exception& e) + { + deallog << e.what() << std::endl; + } +} + +int main() +{ + std::ofstream logfile("solver_leak/output"); +// logfile.setf(std::ios::fixed); + deallog << std::setprecision(4); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + for (unsigned int size=4; size <= 30; size *= 3) + { + unsigned int dim = (size-1)*(size-1); + + deallog << "Size " << size << " Unknowns " << dim << std::endl; + + // Make matrix + FDMatrix testproblem(size, size); + SparsityPattern structure(dim, dim, 5); + testproblem.five_point_structure(structure); + structure.compress(); + SparseMatrix A(structure); + testproblem.five_point(A); + + Vector f(dim); + Vector u(dim); + Vector res(dim); + + deallog.push("alreadydone"); + check_solve >(A,u,f); + check_solve >(A,u,f); +// check_solve >(A,u,f); + check_solve >(A,u,f); + check_solve >(A,u,f); + + deallog.pop(); + } + +} + diff --git a/tests/lac/solver_leak/cmp/generic b/tests/lac/solver_leak/cmp/generic new file mode 100644 index 0000000000..a5b623b562 --- /dev/null +++ b/tests/lac/solver_leak/cmp/generic @@ -0,0 +1,159 @@ + +DEAL::Size 4 Unknowns 9 +DEAL::SOR-diff:0 +DEAL:no-fail:cg::Starting value 3.000 +DEAL:no-fail:cg::Convergence step 3 value 0 +DEAL:no-fail:Bicgstab::Starting value 3.000 +DEAL:no-fail:Bicgstab::Convergence step 3 value 0 +DEAL:no-fail:GMRES::Starting value 3.000 +DEAL:no-fail:GMRES::Convergence step 3 value 0 +DEAL:no-fail:GMRES::Starting value 3.000 +DEAL:no-fail:GMRES::Convergence step 3 value 0 +DEAL:no-fail:QMRS::Starting value 3.000 +DEAL:no-fail:QMRS::Convergence step 3 value 0 +DEAL:no:Richardson::Starting value 3.000 +DEAL:no:Richardson::Convergence step 24 value 0.0007118 +DEAL:no:cg::Starting value 3.000 +DEAL:no:cg::Convergence step 3 value 0 +DEAL:no:Bicgstab::Starting value 3.000 +DEAL:no:Bicgstab::Convergence step 3 value 0 +DEAL:no:GMRES::Starting value 3.000 +DEAL:no:GMRES::Convergence step 3 value 0 +DEAL:no:GMRES::Starting value 3.000 +DEAL:no:GMRES::Convergence step 3 value 0 +DEAL:no:QMRS::Starting value 3.000 +DEAL:no:QMRS::Convergence step 3 value 0 +DEAL:rich:Richardson::Starting value 3.000 +DEAL:rich:Richardson::Convergence step 42 value 0.0008696 +DEAL:rich:cg::Starting value 3.000 +DEAL:rich:cg::Convergence step 3 value 0 +DEAL:rich:Bicgstab::Starting value 3.000 +DEAL:rich:Bicgstab::Convergence step 3 value 0 +DEAL:rich:GMRES::Starting value 1.800 +DEAL:rich:GMRES::Convergence step 3 value 0 +DEAL:rich:GMRES::Starting value 1.800 +DEAL:rich:GMRES::Convergence step 3 value 0 +DEAL:rich:QMRS::Starting value 3.000 +DEAL:rich:QMRS::Convergence step 3 value 0 +DEAL:ssor:RichardsonT::Starting value 3.000 +DEAL:ssor:RichardsonT::Convergence step 7 value 0.0006128 +DEAL:ssor:Richardson::Starting value 3.000 +DEAL:ssor:Richardson::Convergence step 7 value 0.0006128 +DEAL:ssor:cg::Starting value 3.000 +DEAL:ssor:cg::Convergence step 4 value 6.018e-05 +DEAL:ssor:Bicgstab::Starting value 3.000 +DEAL:ssor:Bicgstab::Convergence step 2 value 0.0003670 +DEAL:ssor:GMRES::Starting value 1.920 +DEAL:ssor:GMRES::Convergence step 3 value 0.0003574 +DEAL:ssor:GMRES::Starting value 1.920 +DEAL:ssor:GMRES::Convergence step 3 value 0.0003574 +DEAL:ssor:QMRS::Starting value 3.000 +DEAL:ssor:QMRS::Convergence step 4 value 0.0001345 +DEAL:sor:RichardsonT::Starting value 3.000 +DEAL:sor:RichardsonT::Convergence step 7 value 0.0004339 +DEAL:sor:Richardson::Starting value 3.000 +DEAL:sor:Richardson::Convergence step 7 value 0.0004339 +DEAL:sor:cg::Starting value 3.000 +DEAL:sor:cg::Failure step 100 value 0.2585 +DEAL:sor::Iterative method reported convergence failure in step 100 with residual 0.258509 +DEAL:sor:Bicgstab::Starting value 3.000 +DEAL:sor:Bicgstab::Convergence step 5 value 0 +DEAL:sor:GMRES::Starting value 1.462 +DEAL:sor:GMRES::Convergence step 5 value 0 +DEAL:sor:GMRES::Starting value 1.462 +DEAL:sor:GMRES::Convergence step 5 value 0 +DEAL:psor:RichardsonT::Starting value 3.000 +DEAL:psor:RichardsonT::Convergence step 8 value 0.0004237 +DEAL:psor:Richardson::Starting value 3.000 +DEAL:psor:Richardson::Convergence step 8 value 0.0004237 +DEAL:psor:cg::Starting value 3.000 +DEAL:psor:cg::Failure step 100 value 0.1024 +DEAL:psor::Iterative method reported convergence failure in step 100 with residual 0.102391 +DEAL:psor:Bicgstab::Starting value 3.000 +DEAL:psor:Bicgstab::Convergence step 4 value 0.0002656 +DEAL:psor:GMRES::Starting value 1.467 +DEAL:psor:GMRES::Convergence step 5 value 0.0006649 +DEAL:psor:GMRES::Starting value 1.467 +DEAL:psor:GMRES::Convergence step 5 value 0.0006649 +DEAL::Size 12 Unknowns 121 +DEAL::SOR-diff:0 +DEAL:no-fail:cg::Starting value 11.00 +DEAL:no-fail:cg::Failure step 10 value 0.1496 +DEAL:no-fail::Iterative method reported convergence failure in step 10 with residual 0.149566 +DEAL:no-fail:Bicgstab::Starting value 11.00 +DEAL:no-fail:Bicgstab::Convergence step 10 value 0.0002572 +DEAL:no-fail:GMRES::Starting value 11.00 +DEAL:no-fail:GMRES::Failure step 10 value 0.8414 +DEAL:no-fail::Iterative method reported convergence failure in step 10 with residual 0.841354 +DEAL:no-fail:GMRES::Starting value 11.00 +DEAL:no-fail:GMRES::Failure step 10 value 0.8414 +DEAL:no-fail::Iterative method reported convergence failure in step 10 with residual 0.841354 +DEAL:no-fail:QMRS::Starting value 11.00 +DEAL:no-fail:QMRS::Failure step 10 value 0.4215 +DEAL:no-fail::Iterative method reported convergence failure in step 10 with residual 0.421504 +DEAL:no:Richardson::Starting value 11.00 +DEAL:no:Richardson::Failure step 100 value 0.3002 +DEAL:no::Iterative method reported convergence failure in step 100 with residual 0.300171 +DEAL:no:cg::Starting value 11.00 +DEAL:no:cg::Convergence step 15 value 0.0005794 +DEAL:no:Bicgstab::Starting value 11.00 +DEAL:no:Bicgstab::Convergence step 10 value 0.0002572 +DEAL:no:GMRES::Starting value 11.00 +DEAL:no:GMRES::Convergence step 43 value 0.0009788 +DEAL:no:GMRES::Starting value 11.00 +DEAL:no:GMRES::Convergence step 43 value 0.0009788 +DEAL:no:QMRS::Starting value 11.00 +DEAL:no:QMRS::Convergence step 16 value 0.0002583 +DEAL:rich:Richardson::Starting value 11.00 +DEAL:rich:Richardson::Failure step 100 value 1.219 +DEAL:rich::Iterative method reported convergence failure in step 100 with residual 1.2187 +DEAL:rich:cg::Starting value 11.00 +DEAL:rich:cg::Convergence step 15 value 0.0005794 +DEAL:rich:Bicgstab::Starting value 11.00 +DEAL:rich:Bicgstab::Convergence step 10 value 0.0002572 +DEAL:rich:GMRES::Starting value 6.600 +DEAL:rich:GMRES::Convergence step 42 value 0.0007803 +DEAL:rich:GMRES::Starting value 6.600 +DEAL:rich:GMRES::Convergence step 42 value 0.0007803 +DEAL:rich:QMRS::Starting value 11.00 +DEAL:rich:QMRS::Convergence step 16 value 0.0002583 +DEAL:ssor:RichardsonT::Starting value 11.00 +DEAL:ssor:RichardsonT::Convergence step 48 value 0.0009502 +DEAL:ssor:Richardson::Starting value 11.00 +DEAL:ssor:Richardson::Convergence step 48 value 0.0009502 +DEAL:ssor:cg::Starting value 11.00 +DEAL:ssor:cg::Convergence step 8 value 0.0005816 +DEAL:ssor:Bicgstab::Starting value 11.00 +DEAL:ssor:Bicgstab::Convergence step 4 value 0.0003834 +DEAL:ssor:GMRES::Starting value 13.27 +DEAL:ssor:GMRES::Convergence step 7 value 0.0008206 +DEAL:ssor:GMRES::Starting value 13.27 +DEAL:ssor:GMRES::Convergence step 7 value 0.0008206 +DEAL:ssor:QMRS::Starting value 11.00 +DEAL:ssor:QMRS::Convergence step 9 value 0.0004140 +DEAL:sor:RichardsonT::Starting value 11.00 +DEAL:sor:RichardsonT::Convergence step 88 value 0.0009636 +DEAL:sor:Richardson::Starting value 11.00 +DEAL:sor:Richardson::Convergence step 88 value 0.0009636 +DEAL:sor:cg::Starting value 11.00 +DEAL:sor:cg::Failure step 100 value 5.643 +DEAL:sor::Iterative method reported convergence failure in step 100 with residual 5.64329 +DEAL:sor:Bicgstab::Starting value 11.00 +DEAL:sor:Bicgstab::Convergence step 12 value 0.0007246 +DEAL:sor:GMRES::Starting value 7.322 +DEAL:sor:GMRES::Convergence step 23 value 0.0006981 +DEAL:sor:GMRES::Starting value 7.322 +DEAL:sor:GMRES::Convergence step 23 value 0.0006981 +DEAL:psor:RichardsonT::Starting value 11.00 +DEAL:psor:RichardsonT::Convergence step 89 value 0.0009736 +DEAL:psor:Richardson::Starting value 11.00 +DEAL:psor:Richardson::Convergence step 89 value 0.0009736 +DEAL:psor:cg::Starting value 11.00 +DEAL:psor:cg::Failure step 100 value 2.935 +DEAL:psor::Iterative method reported convergence failure in step 100 with residual 2.93488 +DEAL:psor:Bicgstab::Starting value 11.00 +DEAL:psor:Bicgstab::Convergence step 10 value 0.0003167 +DEAL:psor:GMRES::Starting value 7.345 +DEAL:psor:GMRES::Convergence step 20 value 0.0008491 +DEAL:psor:GMRES::Starting value 7.345 +DEAL:psor:GMRES::Convergence step 20 value 0.0008491