From ee6d16c48190e10598a6d18e2ce37186ae25933c Mon Sep 17 00:00:00 2001 From: bangerth Date: Mon, 25 Jan 2010 00:38:43 +0000 Subject: [PATCH] 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 --- tests/petsc/deal_solver_01.cc | 11 ++++++----- tests/petsc/deal_solver_02.cc | 13 +++++++------ tests/petsc/deal_solver_03.cc | 13 +++++++------ tests/petsc/deal_solver_04.cc | 13 +++++++------ tests/petsc/deal_solver_05.cc | 13 +++++++------ tests/petsc/deal_solver_06.cc | 11 ++++++----- 6 files changed, 40 insertions(+), 34 deletions(-) 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 (); } -- 2.39.5