From: Wolfgang Bangerth Date: Mon, 25 Jan 2010 00:38:43 +0000 (+0000) Subject: Destroy the memory pool of PETSc vectors before we end PETSc itself. We'll get memory... X-Git-Tag: v8.0.0~6592 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9f8509cd5ffc857a2bf3840cd47e1ac737fed5b6;p=dealii.git Destroy the memory pool of PETSc vectors before we end PETSc itself. We'll get memory corruption problems otherwise. git-svn-id: https://svn.dealii.org/trunk@20435 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/petsc/deal_solver_01.cc b/tests/petsc/deal_solver_01.cc index 78bbe7d316..6b93160119 100644 --- a/tests/petsc/deal_solver_01.cc +++ b/tests/petsc/deal_solver_01.cc @@ -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::release_unused_memory (); PetscFinalize (); } diff --git a/tests/petsc/deal_solver_02.cc b/tests/petsc/deal_solver_02.cc index 23302de7ce..52d42a5120 100644 --- a/tests/petsc/deal_solver_02.cc +++ b/tests/petsc/deal_solver_02.cc @@ -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::release_unused_memory (); PetscFinalize (); } diff --git a/tests/petsc/deal_solver_03.cc b/tests/petsc/deal_solver_03.cc index 7c221f8274..efa673537b 100644 --- a/tests/petsc/deal_solver_03.cc +++ b/tests/petsc/deal_solver_03.cc @@ -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::release_unused_memory (); PetscFinalize (); } diff --git a/tests/petsc/deal_solver_04.cc b/tests/petsc/deal_solver_04.cc index 0cd3ae5025..df9a78fd52 100644 --- a/tests/petsc/deal_solver_04.cc +++ b/tests/petsc/deal_solver_04.cc @@ -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::release_unused_memory (); PetscFinalize (); } diff --git a/tests/petsc/deal_solver_05.cc b/tests/petsc/deal_solver_05.cc index 1dd052dd0f..407e4055a0 100644 --- a/tests/petsc/deal_solver_05.cc +++ b/tests/petsc/deal_solver_05.cc @@ -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::release_unused_memory (); PetscFinalize (); } diff --git a/tests/petsc/deal_solver_06.cc b/tests/petsc/deal_solver_06.cc index fe2ef8870d..ed205d0bba 100644 --- a/tests/petsc/deal_solver_06.cc +++ b/tests/petsc/deal_solver_06.cc @@ -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::release_unused_memory (); PetscFinalize (); }