From: Luca Heltai Date: Sun, 15 Jan 2023 09:09:45 +0000 (+0100) Subject: Merge pull request #14678 from luca-heltai/stefanozampini/petsc-init-finalize X-Git-Tag: v9.5.0-rc1~648 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=23f8a1c7e6b387e5fcc25c9ece4523631570b435;p=dealii.git Merge pull request #14678 from luca-heltai/stefanozampini/petsc-init-finalize do not finalize PETSc/SLEPc if not initalized from deal.II --- 23f8a1c7e6b387e5fcc25c9ece4523631570b435 diff --cc source/base/mpi.cc index fcb0344c04,8cb2a9c34d..e11ddbec3c --- a/source/base/mpi.cc +++ b/source/base/mpi.cc @@@ -967,17 -968,30 +968,18 @@@ namespace Utilitie PETScWrappers::MPI::Vector>::release_unused_memory(); GrowingVectorMemory< PETScWrappers::MPI::BlockVector>::release_unused_memory(); - + } # ifdef DEAL_II_WITH_SLEPC - // and now end SLEPc (with PETSc) - SlepcFinalize(); + // and now end SLEPc with PETSc if we did so + if (finalize_petscslepc) + SlepcFinalize(); # else - // or just end PETSc. - PetscFinalize(); + // or just end PETSc if we did so + if (finalize_petscslepc) + PetscFinalize(); # endif - } #endif -// There is a similar issue with CUDA: The destructor of static objects might -// run after the CUDA driver is unloaded. Hence, also release all memory -// related to CUDA vectors. -#ifdef DEAL_II_WITH_CUDA - GrowingVectorMemory< - LinearAlgebra::distributed::Vector>:: - release_unused_memory(); - GrowingVectorMemory< - LinearAlgebra::distributed::Vector>:: - release_unused_memory(); -#endif - #ifdef DEAL_II_WITH_P4EST // now end p4est and libsc // Note: p4est has no finalize function