From: Timo Heister Date: Tue, 26 Mar 2013 20:17:22 +0000 (+0000) Subject: Check at runtime that we do not use multiple threads when using PETSc vectors X-Git-Tag: v8.0.0~886 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3279ee1e9a40a71e1a49d2dab65aea8320816c5e;p=dealii.git Check at runtime that we do not use multiple threads when using PETSc vectors git-svn-id: https://svn.dealii.org/trunk@29046 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/source/lac/petsc_parallel_vector.cc b/deal.II/source/lac/petsc_parallel_vector.cc index 9d36ee6304..70196a4add 100644 --- a/deal.II/source/lac/petsc_parallel_vector.cc +++ b/deal.II/source/lac/petsc_parallel_vector.cc @@ -243,7 +243,6 @@ namespace PETScWrappers //64bit indices won't work yet: Assert (sizeof(unsigned int)==sizeof(PetscInt), ExcInternalError()); - std::vector ghostindices; ghostnodes.fill_index_vector(ghostindices); diff --git a/deal.II/source/lac/petsc_vector_base.cc b/deal.II/source/lac/petsc_vector_base.cc index 8de2a942bb..2deb0cc26f 100644 --- a/deal.II/source/lac/petsc_vector_base.cc +++ b/deal.II/source/lac/petsc_vector_base.cc @@ -20,6 +20,7 @@ # include # include # include +# include DEAL_II_NAMESPACE_OPEN @@ -149,7 +150,11 @@ namespace PETScWrappers ghosted(false), last_action (::dealii::VectorOperation::unknown), attained_ownership(true) - {} + { + Assert( multithread_info.is_running_single_threaded(), + ExcMessage("PETSc does not support multi-threaded access, set " + "the thread limit to 1 in MPI_InitFinalize().")); + } @@ -161,6 +166,10 @@ namespace PETScWrappers last_action (::dealii::VectorOperation::unknown), attained_ownership(true) { + Assert( multithread_info.is_running_single_threaded(), + ExcMessage("PETSc does not support multi-threaded access, set " + "the thread limit to 1 in MPI_InitFinalize().")); + int ierr = VecDuplicate (v.vector, &vector); AssertThrow (ierr == 0, ExcPETScError(ierr)); @@ -177,7 +186,11 @@ namespace PETScWrappers ghosted(false), last_action (::dealii::VectorOperation::unknown), attained_ownership(false) - {} + { + Assert( multithread_info.is_running_single_threaded(), + ExcMessage("PETSc does not support multi-threaded access, set " + "the thread limit to 1 in MPI_InitFinalize().")); + }