]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Destroy the memory pool of PETSc vectors before we end PETSc itself. We'll get memory...
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 25 Jan 2010 00:38:43 +0000 (00:38 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 25 Jan 2010 00:38:43 +0000 (00:38 +0000)
git-svn-id: https://svn.dealii.org/trunk@20435 0785d39b-7218-0410-832d-ea1e28bc413d

tests/petsc/deal_solver_01.cc
tests/petsc/deal_solver_02.cc
tests/petsc/deal_solver_03.cc
tests/petsc/deal_solver_04.cc
tests/petsc/deal_solver_05.cc
tests/petsc/deal_solver_06.cc

index 78bbe7d316edbbf9803d30331c458ff620920be9..6b931601191f57720d12b5b447f6726dce23083f 100644 (file)
@@ -1,8 +1,8 @@
 //----------------------------  petsc_deal_solver_01.cc  ---------------------------
 //    $Id$
-//    Version: $Name$ 
+//    Version: $Name$
 //
-//    Copyright (C) 2004, 2005 by the deal.II authors
+//    Copyright (C) 2004, 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
@@ -39,10 +39,10 @@ check_solve( SOLVER& solver, const MATRIX& A,
             VECTOR& u, VECTOR& f, const PRECONDITION& P)
 {
   deallog << "Solver type: " << typeid(solver).name() << std::endl;
-  
+
   u = 0.;
   f = 1.;
-  try 
+  try
     {
       solver.solve(A,u,f,P);
     }
@@ -73,7 +73,7 @@ int main(int argc, char **argv)
     unsigned int dim = (size-1)*(size-1);
 
     deallog << "Size " << size << " Unknowns " << dim << std::endl;
-      
+
                                      // Make matrix
     FDMatrix testproblem(size, size);
     PETScWrappers::SparseMatrix  A(dim, dim, 5);
@@ -91,6 +91,7 @@ int main(int argc, char **argv)
     PreconditionIdentity preconditioner;
     check_solve (solver, A,u,f, preconditioner);
   }
+  GrowingVectorMemory<PETScWrappers::Vector>::release_unused_memory ();
   PetscFinalize ();
 }
 
index 23302de7ce5eaa48229ff6ade761dfc1a917638e..52d42a5120fe49e3d304ef30aaa6dc37d6e2900b 100644 (file)
@@ -1,8 +1,8 @@
 //----------------------------  petsc_deal_solver_02.cc  ---------------------------
 //    $Id$
-//    Version: $Name$ 
+//    Version: $Name$
 //
-//    Copyright (C) 2004, 2005 by the deal.II authors
+//    Copyright (C) 2004, 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
@@ -41,10 +41,10 @@ check_solve( SOLVER& solver, const MATRIX& A,
             VECTOR& u, VECTOR& f, const PRECONDITION& P)
 {
   deallog << "Solver type: " << typeid(solver).name() << std::endl;
-  
+
   u = 0.;
   f = 1.;
-  try 
+  try
     {
       solver.solve(A,u,f,P);
     }
@@ -66,7 +66,7 @@ int main(int argc, char **argv)
   deallog.attach(logfile);
   deallog.depth_console(0);
   deallog.threshold_double(1.e-10);
-  
+
   PetscInitialize(&argc,&argv,0,0);
   {
     SolverControl control(100, 1.e-3);
@@ -75,7 +75,7 @@ int main(int argc, char **argv)
     unsigned int dim = (size-1)*(size-1);
 
     deallog << "Size " << size << " Unknowns " << dim << std::endl;
-      
+
                                      // Make matrix
     FDMatrix testproblem(size, size);
     PETScWrappers::SparseMatrix  A(dim, dim, 5);
@@ -93,6 +93,7 @@ int main(int argc, char **argv)
     PreconditionIdentity preconditioner;
     check_solve (solver, A,u,f, preconditioner);
   }
+  GrowingVectorMemory<PETScWrappers::Vector>::release_unused_memory ();
   PetscFinalize ();
 }
 
index 7c221f8274654a0e4265ba085029facf3dff488e..efa673537b25e4c340eb3c129ad00c3b12fd6c92 100644 (file)
@@ -1,8 +1,8 @@
 //----------------------------  petsc_deal_solver_03.cc  ---------------------------
 //    $Id$
-//    Version: $Name$ 
+//    Version: $Name$
 //
-//    Copyright (C) 2004, 2005 by the deal.II authors
+//    Copyright (C) 2004, 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
@@ -41,10 +41,10 @@ check_solve( SOLVER& solver, const MATRIX& A,
             VECTOR& u, VECTOR& f, const PRECONDITION& P)
 {
   deallog << "Solver type: " << typeid(solver).name() << std::endl;
-  
+
   u = 0.;
   f = 1.;
-  try 
+  try
     {
       solver.solve(A,u,f,P);
     }
@@ -66,7 +66,7 @@ int main(int argc, char **argv)
   deallog.attach(logfile);
   deallog.depth_console(0);
   deallog.threshold_double(1.e-10);
-  
+
   PetscInitialize(&argc,&argv,0,0);
   {
     SolverControl control(100, 1.e-3);
@@ -75,7 +75,7 @@ int main(int argc, char **argv)
     unsigned int dim = (size-1)*(size-1);
 
     deallog << "Size " << size << " Unknowns " << dim << std::endl;
-      
+
                                      // Make matrix
     FDMatrix testproblem(size, size);
     PETScWrappers::SparseMatrix  A(dim, dim, 5);
@@ -93,6 +93,7 @@ int main(int argc, char **argv)
     PreconditionIdentity preconditioner;
     check_solve (solver, A,u,f, preconditioner);
   }
+  GrowingVectorMemory<PETScWrappers::Vector>::release_unused_memory ();
   PetscFinalize ();
 }
 
index 0cd3ae5025610ff9bdc48c1ce33a3f6b564b34a3..df9a78fd52d0ec5f7495762a1dfe4ef61362f62d 100644 (file)
@@ -1,8 +1,8 @@
 //----------------------------  petsc_deal_solver_04.cc  ---------------------------
 //    $Id$
-//    Version: $Name$ 
+//    Version: $Name$
 //
-//    Copyright (C) 2004, 2005 by the deal.II authors
+//    Copyright (C) 2004, 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
@@ -40,10 +40,10 @@ check_solve( SOLVER& solver, const MATRIX& A,
             VECTOR& u, VECTOR& f, const PRECONDITION& P)
 {
   deallog << "Solver type: " << typeid(solver).name() << std::endl;
-  
+
   u = 0.;
   f = 1.;
-  try 
+  try
     {
       solver.solve(A,u,f,P);
     }
@@ -65,7 +65,7 @@ int main(int argc, char **argv)
   deallog.attach(logfile);
   deallog.depth_console(0);
   deallog.threshold_double(1.e-10);
-  
+
   PetscInitialize(&argc,&argv,0,0);
   {
     SolverControl control(100, 1.e-3);
@@ -74,7 +74,7 @@ int main(int argc, char **argv)
     unsigned int dim = (size-1)*(size-1);
 
     deallog << "Size " << size << " Unknowns " << dim << std::endl;
-      
+
                                      // Make matrix
     FDMatrix testproblem(size, size);
     PETScWrappers::SparseMatrix  A(dim, dim, 5);
@@ -92,6 +92,7 @@ int main(int argc, char **argv)
     PreconditionIdentity preconditioner;
     check_solve (solver, A,u,f, preconditioner);
   }
+  GrowingVectorMemory<PETScWrappers::Vector>::release_unused_memory ();
   PetscFinalize ();
 }
 
index 1dd052dd0f1852f47ac7705a02f327241b6901d9..407e4055a02244cd7ce30c8e7355d0b6aab14861 100644 (file)
@@ -1,8 +1,8 @@
 //----------------------------  petsc_deal_solver_05.cc  ---------------------------
 //    $Id$
-//    Version: $Name$ 
+//    Version: $Name$
 //
-//    Copyright (C) 2004, 2005 by the deal.II authors
+//    Copyright (C) 2004, 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
@@ -39,10 +39,10 @@ check_solve( SOLVER& solver, const MATRIX& A,
             VECTOR& u, VECTOR& f, const PRECONDITION& P)
 {
   deallog << "Solver type: " << typeid(solver).name() << std::endl;
-  
+
   u = 0.;
   f = 1.;
-  try 
+  try
     {
       solver.solve(A,u,f,P);
     }
@@ -64,7 +64,7 @@ int main(int argc, char **argv)
   deallog.attach(logfile);
   deallog.depth_console(0);
   deallog.threshold_double(1.e-10);
-  
+
   PetscInitialize(&argc,&argv,0,0);
   {
     SolverControl control(100, 1.e-3);
@@ -73,7 +73,7 @@ int main(int argc, char **argv)
     unsigned int dim = (size-1)*(size-1);
 
     deallog << "Size " << size << " Unknowns " << dim << std::endl;
-      
+
                                      // Make matrix
     FDMatrix testproblem(size, size);
     PETScWrappers::SparseMatrix  A(dim, dim, 5);
@@ -91,6 +91,7 @@ int main(int argc, char **argv)
     PreconditionIdentity preconditioner;
     check_solve (solver, A,u,f, preconditioner);
   }
+  GrowingVectorMemory<PETScWrappers::Vector>::release_unused_memory ();
   PetscFinalize ();
 }
 
index fe2ef8870dec2d76218c628e329e28dd21408730..ed205d0bba489d8945be6588dee83c96ade42814 100644 (file)
@@ -1,8 +1,8 @@
 //----------------------------  petsc_deal_solver_06.cc  ---------------------------
 //    $Id$
-//    Version: $Name$ 
+//    Version: $Name$
 //
-//    Copyright (C) 2004, 2005 by the deal.II authors
+//    Copyright (C) 2004, 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
@@ -39,10 +39,10 @@ check_solve( SOLVER& solver, const MATRIX& A,
             VECTOR& u, VECTOR& f, const PRECONDITION& P)
 {
   deallog << "Solver type: " << typeid(solver).name() << std::endl;
-  
+
   u = 0.;
   f = 1.;
-  try 
+  try
     {
       solver.solve(A,u,f,P);
     }
@@ -71,7 +71,7 @@ int main(int argc, char **argv)
     SolverControl control(10000, 1.e-3);
 
     deallog << "Size " << size << " Unknowns " << dim << std::endl;
-      
+
                                      // Make matrix
     FDMatrix testproblem(size, size);
     PETScWrappers::SparseMatrix  A(dim, dim, 5);
@@ -89,6 +89,7 @@ int main(int argc, char **argv)
     PreconditionIdentity preconditioner;
     check_solve (solver, A,u,f, preconditioner);
   }
+  GrowingVectorMemory<PETScWrappers::Vector>::release_unused_memory ();
   PetscFinalize ();
 }
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.