]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Merge pull request #14678 from luca-heltai/stefanozampini/petsc-init-finalize
authorLuca Heltai <luca.heltai@sissa.it>
Sun, 15 Jan 2023 09:09:45 +0000 (10:09 +0100)
committerGitHub <noreply@github.com>
Sun, 15 Jan 2023 09:09:45 +0000 (10:09 +0100)
do not finalize PETSc/SLEPc if not initalized from deal.II

1  2 
include/deal.II/base/mpi.h
source/base/mpi.cc

Simple merge
index fcb0344c04685f0d2839928f5c42abcc99d4ca10,8cb2a9c34d12ead1c5dcdc4946e6a71cb0abf7f3..e11ddbec3c8b5f74761be6dae52639491598371e
@@@ -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<double, MemorySpace::CUDA>>::
 -        release_unused_memory();
 -      GrowingVectorMemory<
 -        LinearAlgebra::distributed::Vector<float, MemorySpace::CUDA>>::
 -        release_unused_memory();
 -#endif
 -
  #ifdef DEAL_II_WITH_P4EST
        // now end p4est and libsc
        // Note: p4est has no finalize function

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.