]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Rename methods in ConsensusAlgorithmProcess 9364/head
authorPeter Munch <peterrmuench@gmail.com>
Fri, 17 Jan 2020 06:17:34 +0000 (07:17 +0100)
committerPeter Munch <peterrmuench@gmail.com>
Fri, 17 Jan 2020 06:17:34 +0000 (07:17 +0100)
include/deal.II/base/mpi.h
include/deal.II/base/mpi_compute_index_owner_internal.h
include/deal.II/base/mpi_tags.h
source/base/mpi.cc

index 37557429b39dc68c135193617a0913e273b4b672..0ea19a9eb60f3570e876bc05096648fee38557d0 100644 (file)
@@ -993,7 +993,7 @@ namespace Utilities
        * @note The buffer is empty. Before using it, you have to set its size.
        */
       virtual void
-      pack_recv_buffer(const int other_rank, std::vector<T1> &send_buffer);
+      create_request(const int other_rank, std::vector<T1> &send_buffer);
 
       /**
        * Prepare the buffer where the payload of the answer of the request to
@@ -1004,7 +1004,8 @@ namespace Utilities
        * @param[out] recv_buffer data to be sent part of the request (optional)
        */
       virtual void
-      prepare_recv_buffer(const int other_rank, std::vector<T2> &recv_buffer);
+      prepare_buffer_for_answer(const int        other_rank,
+                                std::vector<T2> &recv_buffer);
 
       /**
        * Prepare the buffer where the payload of the answer of the request to
@@ -1019,9 +1020,9 @@ namespace Utilities
        *       its size.
        */
       virtual void
-      process_request(const unsigned int     other_rank,
-                      const std::vector<T1> &buffer_recv,
-                      std::vector<T2> &      request_buffer);
+      answer_request(const unsigned int     other_rank,
+                     const std::vector<T1> &buffer_recv,
+                     std::vector<T2> &      request_buffer);
 
       /**
        * Process the payload of the answer of the request to the process with
@@ -1031,8 +1032,7 @@ namespace Utilities
        * @param[in] recv_buffer data to be sent part of the request (optional)
        */
       virtual void
-      unpack_recv_buffer(const int              other_rank,
-                         const std::vector<T2> &recv_buffer);
+      read_answer(const int other_rank, const std::vector<T2> &recv_buffer);
     };
 
     /**
@@ -1222,7 +1222,7 @@ namespace Utilities
        * request and send an answer.
        */
       void
-      process_requests();
+      answer_requests();
 
       /**
        * Start to send all requests via ISend and post IRecvs for the incoming
@@ -1333,7 +1333,7 @@ namespace Utilities
        * the request and send an answer.
        */
       void
-      process_requests(int index);
+      answer_requests(int index);
 
       /**
        * Start to send all requests via ISend and post IRecvs for the incoming
index ba3b542c25625b3fa9eec0179964bfdf5be7fd9d..66f4c272b1264f1ef54745c4cf1491056864b64d 100644 (file)
@@ -81,23 +81,23 @@ namespace Utilities
 
           /**
            * Implementation of
-           * Utilities::MPI::ConsensusAlgorithmProcess::pack_recv_buffer().
+           * Utilities::MPI::ConsensusAlgorithmProcess::create_request().
            */
           virtual void
-          pack_recv_buffer(const int other_rank,
-                           std::vector<std::pair<types::global_dof_index,
-                                                 types::global_dof_index>>
-                             &send_buffer) override
+          create_request(const int other_rank,
+                         std::vector<std::pair<types::global_dof_index,
+                                               types::global_dof_index>>
+                           &send_buffer) override
           {
             send_buffer = this->buffers.at(other_rank);
           }
 
           /**
            * Implementation of
-           * Utilities::MPI::ConsensusAlgorithmProcess::process_request().
+           * Utilities::MPI::ConsensusAlgorithmProcess::answer_request().
            */
           virtual void
-          process_request(
+          answer_request(
             const unsigned int                                     other_rank,
             const std::vector<std::pair<types::global_dof_index,
                                         types::global_dof_index>> &buffer_recv,
@@ -632,13 +632,13 @@ namespace Utilities
 
           /**
            * Implementation of
-           * Utilities::MPI::ConsensusAlgorithmProcess::process_request(),
+           * Utilities::MPI::ConsensusAlgorithmProcess::answer_request(),
            * adding the owner of a particular index in request_buffer (and
            * keeping track of who requested a particular index in case that
            * information is also desired).
            */
           virtual void
-          process_request(
+          answer_request(
             const unsigned int                                     other_rank,
             const std::vector<std::pair<types::global_dof_index,
                                         types::global_dof_index>> &buffer_recv,
@@ -717,13 +717,13 @@ namespace Utilities
 
           /**
            * Implementation of
-           * Utilities::MPI::ConsensusAlgorithmProcess::pack_recv_buffer().
+           * Utilities::MPI::ConsensusAlgorithmProcess::create_request().
            */
           virtual void
-          pack_recv_buffer(const int other_rank,
-                           std::vector<std::pair<types::global_dof_index,
-                                                 types::global_dof_index>>
-                             &send_buffer) override
+          create_request(const int other_rank,
+                         std::vector<std::pair<types::global_dof_index,
+                                               types::global_dof_index>>
+                           &send_buffer) override
           {
             // create index set and compress data to be sent
             auto &   indices_i = indices_to_look_up_by_dict_rank[other_rank];
@@ -740,23 +740,23 @@ namespace Utilities
 
           /**
            * Implementation of
-           * Utilities::MPI::ConsensusAlgorithmProcess::prepare_recv_buffer().
+           * Utilities::MPI::ConsensusAlgorithmProcess::prepare_buffer_for_answer().
            */
           virtual void
-          prepare_recv_buffer(const int                  other_rank,
-                              std::vector<unsigned int> &recv_buffer) override
+          prepare_buffer_for_answer(
+            const int                  other_rank,
+            std::vector<unsigned int> &recv_buffer) override
           {
             recv_buffer.resize(recv_indices[other_rank].size());
           }
 
           /**
            * Implementation of
-           * Utilities::MPI::ConsensusAlgorithmProcess::unpack_recv_buffer().
+           * Utilities::MPI::ConsensusAlgorithmProcess::read_answer().
            */
           virtual void
-          unpack_recv_buffer(
-            const int                        other_rank,
-            const std::vector<unsigned int> &recv_buffer) override
+          read_answer(const int                        other_rank,
+                      const std::vector<unsigned int> &recv_buffer) override
           {
             Assert(recv_indices[other_rank].size() == recv_buffer.size(),
                    ExcMessage("Sizes do not match!"));
index 51fa10b714f621d8dc13bca87af0bf5a73abc24a..38dd155189d29ef67d6c715a605e147bc24bae90 100644 (file)
@@ -86,12 +86,12 @@ namespace Utilities
           fe_tools_extrapolate_end = fe_tools_extrapolate + 10,
 
           /// ConsensusAlgorithm_NBX::process
-          consensus_algorithm_nbx_process_request,
+          consensus_algorithm_nbx_answer_request,
           /// ConsensusAlgorithm_NBX::process
           consensus_algorithm_nbx_process_deliver,
 
           /// ConsensusAlgorithm_PEX::process
-          consensus_algorithm_pex_process_request,
+          consensus_algorithm_pex_answer_request,
           /// ConsensusAlgorithm_PEX::process
           consensus_algorithm_pex_process_deliver,
 
index 6b363f65a0ac69a401278321dfc5b36cada5711f..e9b71e0e463acea31ab55e0a72f73de6f0ffd90c 100644 (file)
@@ -236,9 +236,9 @@ namespace Utilities
       using T2 = int;
 
       virtual void
-      process_request(const unsigned int other_rank,
-                      const std::vector<T1> &,
-                      std::vector<T2> &) override
+      answer_request(const unsigned int other_rank,
+                     const std::vector<T1> &,
+                     std::vector<T2> &) override
       {
         this->sources.push_back(other_rank);
       }
@@ -961,9 +961,9 @@ namespace Utilities
 
     template <typename T1, typename T2>
     void
-    ConsensusAlgorithmProcess<T1, T2>::process_request(const unsigned int,
-                                                       const std::vector<T1> &,
-                                                       std::vector<T2> &)
+    ConsensusAlgorithmProcess<T1, T2>::answer_request(const unsigned int,
+                                                      const std::vector<T1> &,
+                                                      std::vector<T2> &)
     {
       // nothing to do
     }
@@ -972,8 +972,8 @@ namespace Utilities
 
     template <typename T1, typename T2>
     void
-    ConsensusAlgorithmProcess<T1, T2>::pack_recv_buffer(const int,
-                                                        std::vector<T1> &)
+    ConsensusAlgorithmProcess<T1, T2>::create_request(const int,
+                                                      std::vector<T1> &)
     {
       // nothing to do
     }
@@ -982,8 +982,9 @@ namespace Utilities
 
     template <typename T1, typename T2>
     void
-    ConsensusAlgorithmProcess<T1, T2>::prepare_recv_buffer(const int,
-                                                           std::vector<T2> &)
+    ConsensusAlgorithmProcess<T1, T2>::prepare_buffer_for_answer(
+      const int,
+      std::vector<T2> &)
     {
       // nothing to do
     }
@@ -992,9 +993,8 @@ namespace Utilities
 
     template <typename T1, typename T2>
     void
-    ConsensusAlgorithmProcess<T1, T2>::unpack_recv_buffer(
-      const int,
-      const std::vector<T2> &)
+    ConsensusAlgorithmProcess<T1, T2>::read_answer(const int,
+                                                   const std::vector<T2> &)
     {
       // nothing to do
     }
@@ -1035,7 +1035,7 @@ namespace Utilities
       // 2) answer requests and check if all requests of this process have been
       //    answered
       while (!check_own_state())
-        process_requests();
+        answer_requests();
 
       // 3) signal to all other processes that all requests of this process have
       //    been answered
@@ -1045,7 +1045,7 @@ namespace Utilities
       //    incoming requests until all processes have received the
       //    answer to all requests
       while (!check_global_state())
-        process_requests();
+        answer_requests();
 
       // 5) process the answer to all requests
       clean_up_and_end_communication();
@@ -1112,12 +1112,12 @@ namespace Utilities
 
     template <typename T1, typename T2>
     void
-    ConsensusAlgorithm_NBX<T1, T2>::process_requests()
+    ConsensusAlgorithm_NBX<T1, T2>::answer_requests()
     {
 #ifdef DEAL_II_WITH_MPI
 
       const int tag_request =
-        Utilities::MPI::internal::Tags::consensus_algorithm_nbx_process_request;
+        Utilities::MPI::internal::Tags::consensus_algorithm_nbx_answer_request;
       const int tag_deliver =
         Utilities::MPI::internal::Tags::consensus_algorithm_nbx_process_deliver;
 
@@ -1165,9 +1165,7 @@ namespace Utilities
 
           // process request
           auto &request_buffer = *request_buffers.back();
-          this->process.process_request(other_rank,
-                                        buffer_recv,
-                                        request_buffer);
+          this->process.answer_request(other_rank, buffer_recv, request_buffer);
 
           // start to send answer back
           ierr = MPI_Isend(request_buffer.data(),
@@ -1194,7 +1192,7 @@ namespace Utilities
       const auto n_targets = targets.size();
 
       const int tag_request =
-        Utilities::MPI::internal::Tags::consensus_algorithm_nbx_process_request;
+        Utilities::MPI::internal::Tags::consensus_algorithm_nbx_answer_request;
       const int tag_deliver =
         Utilities::MPI::internal::Tags::consensus_algorithm_nbx_process_deliver;
 
@@ -1213,7 +1211,7 @@ namespace Utilities
 
             // translate index set to a list of pairs
             auto &send_buffer = send_buffers[index];
-            this->process.pack_recv_buffer(rank, send_buffer);
+            this->process.create_request(rank, send_buffer);
 
             // start to send data
             auto ierr = MPI_Isend(send_buffer.data(),
@@ -1227,7 +1225,7 @@ namespace Utilities
 
             // start to receive data
             auto &recv_buffer = recv_buffers[index];
-            this->process.prepare_recv_buffer(rank, recv_buffer);
+            this->process.prepare_buffer_for_answer(rank, recv_buffer);
             ierr = MPI_Irecv(recv_buffer.data(),
                              recv_buffer.size() * sizeof(T2),
                              MPI_BYTE,
@@ -1286,7 +1284,7 @@ namespace Utilities
       // unpack data
       {
         for (unsigned int i = 0; i < targets.size(); i++)
-          this->process.unpack_recv_buffer(targets[i], recv_buffers[i]);
+          this->process.read_answer(targets[i], recv_buffers[i]);
       }
 #endif
     }
@@ -1315,7 +1313,7 @@ namespace Utilities
 
       // 2) answer requests
       for (unsigned int request = 0; request < n_requests; request++)
-        process_requests(request);
+        answer_requests(request);
 
       // 3) process answers
       clean_up_and_end_communication();
@@ -1325,11 +1323,11 @@ namespace Utilities
 
     template <typename T1, typename T2>
     void
-    ConsensusAlgorithm_PEX<T1, T2>::process_requests(int index)
+    ConsensusAlgorithm_PEX<T1, T2>::answer_requests(int index)
     {
 #ifdef DEAL_II_WITH_MPI
       const int tag_request =
-        Utilities::MPI::internal::Tags::consensus_algorithm_pex_process_request;
+        Utilities::MPI::internal::Tags::consensus_algorithm_pex_answer_request;
       const int tag_deliver =
         Utilities::MPI::internal::Tags::consensus_algorithm_pex_process_deliver;
 
@@ -1360,7 +1358,7 @@ namespace Utilities
 
       // process request
       auto &request_buffer = requests_buffers[index];
-      this->process.process_request(other_rank, buffer_recv, request_buffer);
+      this->process.answer_request(other_rank, buffer_recv, request_buffer);
 
       // start to send answer back
       ierr = MPI_Isend(request_buffer.data(),
@@ -1387,7 +1385,7 @@ namespace Utilities
       targets = this->process.compute_targets();
 
       const int tag_request =
-        Utilities::MPI::internal::Tags::consensus_algorithm_pex_process_request;
+        Utilities::MPI::internal::Tags::consensus_algorithm_pex_answer_request;
       const int tag_deliver =
         Utilities::MPI::internal::Tags::consensus_algorithm_pex_process_deliver;
 
@@ -1413,7 +1411,7 @@ namespace Utilities
 
           // pack data which should be sent
           auto &send_buffer = send_buffers[i];
-          this->process.pack_recv_buffer(rank, send_buffer);
+          this->process.create_request(rank, send_buffer);
 
           // start to send data
           auto ierr = MPI_Isend(send_buffer.data(),
@@ -1427,7 +1425,7 @@ namespace Utilities
 
           // start to receive data
           auto &recv_buffer = recv_buffers[i];
-          this->process.prepare_recv_buffer(rank, recv_buffer);
+          this->process.prepare_buffer_for_answer(rank, recv_buffer);
           ierr = MPI_Irecv(recv_buffer.data(),
                            recv_buffer.size() * sizeof(T2),
                            MPI_BYTE,
@@ -1470,7 +1468,7 @@ namespace Utilities
 
       // unpack received data
       for (unsigned int i = 0; i < targets.size(); i++)
-        this->process.unpack_recv_buffer(targets[i], recv_buffers[i]);
+        this->process.read_answer(targets[i], recv_buffers[i]);
 #endif
     }
 

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.