]> https://gitweb.dealii.org/ - dealii.git/commitdiff
ConsensusAlgorithmsPayload: switch internal data type 16631/head
authorPeter Munch <peterrmuench@gmail.com>
Sun, 11 Feb 2024 22:43:59 +0000 (23:43 +0100)
committerPeter Munch <peterrmuench@gmail.com>
Mon, 12 Feb 2024 07:42:32 +0000 (08:42 +0100)
include/deal.II/base/mpi_compute_index_owner_internal.h
source/base/mpi_compute_index_owner_internal.cc

index c5fb582b134b4e256189f39907d018f67783a32d..8ee2f963b4ed4b8f627a920fff16100b929f3fb0 100644 (file)
@@ -282,7 +282,8 @@ namespace Utilities
            */
           std::vector<std::vector<
             std::pair<unsigned int,
-                      std::vector<std::pair<unsigned int, unsigned int>>>>>
+                      std::vector<std::pair<types::global_dof_index,
+                                            types::global_dof_index>>>>>
             requesters;
 
           /**
@@ -366,10 +367,11 @@ namespace Utilities
            * therefore only need to append at the end.
            */
           void
-          append_index_origin(const unsigned int index_within_dictionary,
-                              const unsigned int rank_of_request,
-                              const unsigned int rank_of_owner,
-                              unsigned int      &owner_index_guess);
+          append_index_origin(
+            const types::global_dof_index index_within_dictionary,
+            const unsigned int            rank_of_request,
+            const unsigned int            rank_of_owner,
+            unsigned int                 &owner_index_guess);
         };
 
         /* ------------------------- inline functions ----------------------- */
index e31a8760ccad8111eb4f3f31c0fdd99ad3d15345..01392dc80b13f096ae2bcd66548e93e79c02b3c5 100644 (file)
@@ -606,7 +606,8 @@ namespace Utilities
           // sent in total can be deduced both via the MPI status message at
           // the receiver site as well as be counting the buckets from
           // different requesters.
-          std::vector<std::vector<unsigned int>> send_data(requesters.size());
+          std::vector<std::vector<types::global_dof_index>> send_data(
+            requesters.size());
           for (unsigned int i = 0; i < requesters.size(); ++i)
             {
               // special code for our own indices
@@ -636,13 +637,15 @@ namespace Utilities
                         }
                     }
                   send_requests.push_back(MPI_Request());
-                  const int ierr = MPI_Isend(send_data[i].data(),
-                                             send_data[i].size(),
-                                             MPI_UNSIGNED,
-                                             dict.actually_owning_rank_list[i],
-                                             mpi_tag,
-                                             comm,
-                                             &send_requests.back());
+                  const int ierr =
+                    MPI_Isend(send_data[i].data(),
+                              send_data[i].size(),
+                              Utilities::MPI::mpi_type_id_for_type<
+                                types::global_dof_index>,
+                              dict.actually_owning_rank_list[i],
+                              mpi_tag,
+                              comm,
+                              &send_requests.back());
                   AssertThrowMPI(ierr);
                 }
             }
@@ -657,20 +660,25 @@ namespace Utilities
 
               // retrieve size of incoming message
               int number_amount;
-              ierr = MPI_Get_count(&status, MPI_UNSIGNED, &number_amount);
+              ierr = MPI_Get_count(
+                &status,
+                Utilities::MPI::mpi_type_id_for_type<types::global_dof_index>,
+                &number_amount);
               AssertThrowMPI(ierr);
 
               // receive message
               Assert(number_amount % 2 == 0, ExcInternalError());
-              std::vector<std::pair<unsigned int, unsigned int>> buffer(
-                number_amount / 2);
-              ierr = MPI_Recv(buffer.data(),
-                              number_amount,
-                              MPI_UNSIGNED,
-                              status.MPI_SOURCE,
-                              status.MPI_TAG,
-                              comm,
-                              &status);
+              std::vector<
+                std::pair<types::global_dof_index, types::global_dof_index>>
+                buffer(number_amount / 2);
+              ierr = MPI_Recv(
+                buffer.data(),
+                number_amount,
+                Utilities::MPI::mpi_type_id_for_type<types::global_dof_index>,
+                status.MPI_SOURCE,
+                status.MPI_TAG,
+                comm,
+                &status);
               AssertThrowMPI(ierr);
 
               // unpack the message and translate the dictionary-local
@@ -733,10 +741,10 @@ namespace Utilities
 
         void
         ConsensusAlgorithmsPayload::append_index_origin(
-          const unsigned int index_within_dict,
-          const unsigned int rank_of_request,
-          const unsigned int rank_of_owner,
-          unsigned int      &owner_index_guess)
+          const types::global_dof_index index_within_dict,
+          const unsigned int            rank_of_request,
+          const unsigned int            rank_of_owner,
+          unsigned int                 &owner_index_guess)
         {
           // remember who requested which index. We want to use an
           // std::vector with simple addressing, via a good guess from the
@@ -749,7 +757,8 @@ namespace Utilities
           if (request.empty() || request.back().first != rank_of_request)
             request.emplace_back(
               rank_of_request,
-              std::vector<std::pair<unsigned int, unsigned int>>());
+              std::vector<
+                std::pair<types::global_dof_index, types::global_dof_index>>());
 
           auto &intervals = request.back().second;
           if (intervals.empty() || intervals.back().second != index_within_dict)

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.