]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
gather new_numbers using MPI_Allgatherv
authordenis.davydov <denis.davydov@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 11 Jul 2014 17:42:30 +0000 (17:42 +0000)
committerdenis.davydov <denis.davydov@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 11 Jul 2014 17:42:30 +0000 (17:42 +0000)
git-svn-id: https://svn.dealii.org/branches/branch_sharedtria@33138 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/source/dofs/dof_handler_policy.cc

index 63118915532e0b39fe0a6433d239fbf74b1baa59..462e3372dba678076bc3e6f243aa743eaa6abe62 100644 (file)
@@ -1011,7 +1011,7 @@ namespace internal
            }
          else
            {
-             const bool renumber_debug = true;
+             const bool renumber_debug = false;
 
              Assert(new_numbers.size() == dof_handler.locally_owned_dofs().n_elements(),
                     ExcInternalError());
@@ -1046,11 +1046,25 @@ namespace internal
              //gather new numbers among processors into one vector
                {
                  std::vector<types::global_dof_index> new_numbers_copy (new_numbers);
-                 MPI_Barrier (tr->get_communicator ());
-                 MPI_Allgather (&new_numbers_copy[0],     new_numbers_copy.size (),
-                                DEAL_II_DOF_INDEX_MPI_TYPE,
-                                &gathered_new_numbers[0], new_numbers_copy.size (),
-                                DEAL_II_DOF_INDEX_MPI_TYPE,
+                 // displs:
+                 // Entry i specifies the displacement (relative to recvbuf )
+                 // at which to place the incoming data from process i
+                 // rcounts:
+                 // containing the number of elements that are to be received from each process
+                 std::vector<int> displs(n_cpu),
+                                  rcounts(n_cpu);
+                 types::global_dof_index shift = 0;
+                 for (unsigned int i = 0; i < n_cpu; i++)
+                   {
+                     displs[i]  = shift;
+                     rcounts[i] = number_cache_current.n_locally_owned_dofs_per_processor[i];
+                     shift     += rcounts[i];
+                   }
+                 MPI_Allgatherv (&new_numbers_copy[0],     new_numbers_copy.size (),
+                                 DEAL_II_DOF_INDEX_MPI_TYPE,
+                                 &gathered_new_numbers[0], &rcounts[0],
+                                 &displs[0],
+                                 DEAL_II_DOF_INDEX_MPI_TYPE,
                                 tr->get_communicator ());
                }
 

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.