]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Check at runtime that we do not use multiple threads when using PETSc vectors
authorheister <heister@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 26 Mar 2013 20:17:22 +0000 (20:17 +0000)
committerheister <heister@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 26 Mar 2013 20:17:22 +0000 (20:17 +0000)
git-svn-id: https://svn.dealii.org/trunk@29046 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/source/lac/petsc_parallel_vector.cc
deal.II/source/lac/petsc_vector_base.cc

index 9d36ee63047bc0db652e4d115a44f5e6dd2ad774..70196a4add02316658571f6d10fe56d6c6e0e32f 100644 (file)
@@ -243,7 +243,6 @@ namespace PETScWrappers
       //64bit indices won't work yet:
       Assert (sizeof(unsigned int)==sizeof(PetscInt), ExcInternalError());
 
-
       std::vector<unsigned int> ghostindices;
       ghostnodes.fill_index_vector(ghostindices);
 
index 8de2a942bb505ddad984aed1a01fa36a4f2c123b..2deb0cc26f32cd8874f5e78cb808852dbb298a18 100644 (file)
@@ -20,6 +20,7 @@
 #  include <deal.II/lac/petsc_vector.h>
 #  include <deal.II/lac/petsc_parallel_vector.h>
 #  include <cmath>
+#  include <deal.II/base/multithread_info.h>
 
 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()."));
+  }
 
 
 

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.