getfem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Getfem-commits] (no subject)


From: Yves Renard
Subject: [Getfem-commits] (no subject)
Date: Sat, 28 Oct 2017 08:48:32 -0400 (EDT)

branch: master
commit 33e8b61e8e80cdd51dfa73212bbd67d86577648b
Author: Yves Renard <address@hidden>
Date:   Sat Oct 28 14:48:11 2017 +0200

    Bug fixes for MPI parallelization
---
 src/getfem/getfem_mesh_region.h | 22 +++++++++++-----------
 src/getfem_generic_assembly.cc  |  2 ++
 src/getfem_mesh.cc              |  6 ++++--
 src/getfem_mesh_region.cc       | 12 ++++++++----
 src/getfem_models.cc            |  4 ----
 tests/elastostatic.param        |  4 ++--
 6 files changed, 27 insertions(+), 23 deletions(-)

diff --git a/src/getfem/getfem_mesh_region.h b/src/getfem/getfem_mesh_region.h
index aa34e40..de57419 100644
--- a/src/getfem/getfem_mesh_region.h
+++ b/src/getfem/getfem_mesh_region.h
@@ -176,24 +176,24 @@ namespace getfem {
 
     void  set_type(size_type type)  { type_ = type; }
 
-    /** in multithreaded part of the program makes only a partition of the 
+    /** In multithreaded part of the program makes only a partition of the 
     region visible in the index() and size() operations, as well as during 
     iterations with mr_visitor. This is a default behaviour*/
     void  allow_partitioning();
 
-    /**disregard partitioning, which means being able to see the whole region
+    /** Disregard partitioning, which means being able to see the whole region
     in multirheaded code. Can be used, for instance, for contact problems
     where master region is partitioned, while the slave region is not*/
     void  prohibit_partitioning();
 
     bool is_partitioning_allowed() const;
 
-    /**extract the next region number 
+    /** Extract the next region number 
     that does not yet exists in the mesh*/
     static size_type free_region_id(const getfem::mesh& m);
 
 
-    /** for regions which have been built with just a number 'id',
+    /** For regions which have been built with just a number 'id',
     from_mesh(m) sets the current region to 'm.region(id)'.  
     (works only once) 
     */
@@ -205,8 +205,8 @@ namespace getfem {
 
     face_bitset operator[](size_t cv) const;
 
-    /**index of the region convexes, or the convexes from the partition on the 
-    current thread*/
+    /** Index of the region convexes, or the convexes from the partition on 
the 
+    current thread. */
     const dal::bit_vector& index() const;
     void add(const dal::bit_vector &bv);
     void add(size_type cv, short_type f = short_type(-1));
@@ -217,18 +217,18 @@ namespace getfem {
     bool is_in(size_type cv, short_type f = short_type(-1)) const;
     bool is_in(size_type cv, short_type f, const mesh &m) const;
 
-    /**region size, or the size of the region partition on the current
+    /** Region size, or the size of the region partition on the current
     thread if the region is partitioned*/
     size_type size() const;
 
-    /**number of convexes in the region, or on the partition on the current
+    /** Number of convexes in the region, or on the partition on the current
     thread*/
     size_type nb_convex() const { return  index().card();}  
     bool is_empty() const;
-    /** return true if the region do contain only convex faces */
+    /** Return true if the region do contain only convex faces */
     bool is_only_faces() const;
     bool is_boundary() const { return is_only_faces(); }
-    /** return true if the region do not contain any convex face */
+    /** Return true if the region do not contain any convex face */
     bool is_only_convexes() const;
     face_bitset faces_of_convex(size_type cv) const;
     face_bitset and_mask() const;
@@ -257,7 +257,7 @@ namespace getfem {
       short_type f_;
       bool finished_;
 #if GETFEM_PARA_LEVEL > 1
-      mesh_region mpi_rg;
+      std::unique_ptr<mesh_region> mpi_rg;
 #endif
       void init(const mesh_region &s);
       void init(const dal::bit_vector &s);
diff --git a/src/getfem_generic_assembly.cc b/src/getfem_generic_assembly.cc
index dc79a60..2d8a4cd 100644
--- a/src/getfem_generic_assembly.cc
+++ b/src/getfem_generic_assembly.cc
@@ -7883,6 +7883,8 @@ namespace getfem {
     if (order == 1) {
       MPI_SUM_VECTOR(assembled_vector());
       MPI_SUM_VECTOR(unreduced_V);
+    } else if (order == 0) {
+      assembled_potential() = MPI_SUM_SCALAR(assembled_potential());
     }
 
     // Deal with reduced fems.
diff --git a/src/getfem_mesh.cc b/src/getfem_mesh.cc
index ebced27..69aae4b 100644
--- a/src/getfem_mesh.cc
+++ b/src/getfem_mesh.cc
@@ -153,8 +153,10 @@ namespace getfem {
       MPI_Comm_rank(MPI_COMM_WORLD, &rank);
       MPI_Comm_size(MPI_COMM_WORLD, &size);
 
-      if (size < 2) { mpi_region = mesh_region::all_convexes(); }
-      else {
+      if (size < 2) {
+       mpi_region = mesh_region::all_convexes();
+       mpi_region.from_mesh(*this);
+      } else {
         int ne = int(nb_convex());
         std::vector<int> xadj(ne+1), adjncy, numelt(ne), npart(ne);
         std::vector<int> indelt(nb_allocated_convex());
diff --git a/src/getfem_mesh_region.cc b/src/getfem_mesh_region.cc
index 51ab170..98f372e 100644
--- a/src/getfem_mesh_region.cc
+++ b/src/getfem_mesh_region.cc
@@ -190,12 +190,13 @@ namespace getfem {
 
   mesh_region::const_iterator mesh_region::begin( ) const 
   {
+    GMM_ASSERT1(p != 0, "Internal error");
     if (me_is_multithreaded_now() && partitioning_allowed) 
     { 
       update_partition_iterators();
       return itbegin;
     }
-    else return rp().m.begin();
+    else { return rp().m.begin(); }
   }
 
   mesh_region::const_iterator mesh_region::end  ( ) const 
@@ -534,9 +535,12 @@ namespace getfem {
        else
          init(m.convex_index());
       } else if (s.p.get())  {
-       if (intersect_with_mpi)
-         { mpi_rg = s; m.intersect_with_mpi_region(mpi_rg); init(mpi_rg); }
-       else
+       if (intersect_with_mpi) {
+         mpi_rg = std::make_unique<mesh_region>(s);
+         mpi_rg->from_mesh(m);
+         m.intersect_with_mpi_region(*mpi_rg);
+         init(*mpi_rg);
+       } else
          init(s);
       } else {
        if (intersect_with_mpi)
diff --git a/src/getfem_models.cc b/src/getfem_models.cc
index a3d9918..9ebe7b9 100644
--- a/src/getfem_models.cc
+++ b/src/getfem_models.cc
@@ -2672,10 +2672,6 @@ namespace getfem {
       if (version & BUILD_RHS) approx_external_load_ += brick.external_load;
     }
 
-    if (version & BUILD_RHS) {
-      if (is_complex()) MPI_SUM_VECTOR(crhs); else MPI_SUM_VECTOR(rrhs);
-    }
-
     // Generic expressions
     if (generic_expressions.size()) {
       model_real_plain_vector residual;
diff --git a/tests/elastostatic.param b/tests/elastostatic.param
index 9a3f196..4d7c154 100644
--- a/tests/elastostatic.param
+++ b/tests/elastostatic.param
@@ -25,14 +25,14 @@
 MU = 1.0;              % Lam� coefficient.
 LAMBDA = 1.0;          % Lam� coefficient.
 N = 2;
-NX = 10;                % number of subdivisions for structured meshes.
+NX = 100;               % number of subdivisions for structured meshes.
 QUAD = 0;
 FT = 3.0;               % parameter for the exact solution.
 SOL_SING = 0;           % 0 : Regular exact solution.
                         % 1 : Singular exact solution in r^{1/2}.
                        % 2 : Singular exact soluiton in r^{1/4}
 REFINE = 0;            % Mesh refinement option
-MIXED_PRESSURE=1;       % Mixed version or not.
+MIXED_PRESSURE=0;       % Mixed version or not.
 DIRICHLET_VERSION = 0;  % 0 = multipliers, 1 = penalization
 
 if (N == 1)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]