]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Rename a couple of member variables to better reflect their purpose.
authorWolfgang Bangerth <bangerth@colostate.edu>
Thu, 13 Jan 2022 04:49:26 +0000 (21:49 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Fri, 14 Jan 2022 12:16:27 +0000 (05:16 -0700)
include/deal.II/base/mpi_consensus_algorithms.h
include/deal.II/base/mpi_consensus_algorithms.templates.h

index 38111dd31ec1549db206515a00a90c3e7bf6bd02..36a68fbc759552d0c7f6b4b838b0229e125a71bf 100644 (file)
@@ -466,8 +466,11 @@ namespace Utilities
 
         /**
          * Requests for sending requests and receiving answers to requests.
+         * The first half of the array is used for the receive-answer
+         * requests objects, the second half for the send-request request
+         * objects.
          */
-        std::vector<MPI_Request> send_and_recv_buffers;
+        std::vector<MPI_Request> send_request_and_recv_answer_requests;
 
         /**
          * Buffers for sending answers to requests.
@@ -477,7 +480,7 @@ namespace Utilities
         /**
          * Requests for sending answers to requests.
          */
-        std::vector<MPI_Request> requests_answers;
+        std::vector<MPI_Request> send_answer_requests;
 #endif
         /**
          * List of processes who have made a request to this process.
index 81a2941cdc52c348f5bf74a988f089d1a0b34ce4..fed4329d325a1ca4a9468990e1108107a88e16de 100644 (file)
@@ -445,9 +445,9 @@ namespace Utilities
         // 2) allocate memory
         recv_buffers.resize(n_targets);
         send_buffers.resize(n_targets);
-        send_and_recv_buffers.resize(2 * n_targets);
+        send_request_and_recv_answer_requests.resize(2 * n_targets);
 
-        requests_answers.resize(n_sources);
+        send_answer_requests.resize(n_sources);
         requests_buffers.resize(n_sources);
 
         // 4) send and receive
@@ -461,13 +461,14 @@ namespace Utilities
             this->process.create_request(rank, send_buffer);
 
             // start to send data
-            auto ierr = MPI_Isend(send_buffer.data(),
-                                  send_buffer.size() * sizeof(T1),
-                                  MPI_BYTE,
-                                  rank,
-                                  tag_request,
-                                  this->comm,
-                                  &send_and_recv_buffers[n_targets + i]);
+            auto ierr =
+              MPI_Isend(send_buffer.data(),
+                        send_buffer.size() * sizeof(T1),
+                        MPI_BYTE,
+                        rank,
+                        tag_request,
+                        this->comm,
+                        &send_request_and_recv_answer_requests[n_targets + i]);
             AssertThrowMPI(ierr);
 
             // start to receive data
@@ -479,7 +480,7 @@ namespace Utilities
                              rank,
                              tag_deliver,
                              this->comm,
-                             &send_and_recv_buffers[i]);
+                             &send_request_and_recv_answer_requests[i]);
             AssertThrowMPI(ierr);
           }
 
@@ -543,7 +544,7 @@ namespace Utilities
                          other_rank,
                          tag_deliver,
                          this->comm,
-                         &requests_answers[index]);
+                         &send_answer_requests[index]);
         AssertThrowMPI(ierr);
 #else
         (void)index;
@@ -557,20 +558,23 @@ namespace Utilities
       PEX<T1, T2>::clean_up_and_end_communication()
       {
 #ifdef DEAL_II_WITH_MPI
-        // finalize all MPI_Requests
-        if (send_and_recv_buffers.size() > 0)
+        // Finalize all MPI_Request objects for both the
+        // send-request and receive-answer operations.
+        if (send_request_and_recv_answer_requests.size() > 0)
           {
-            auto ierr = MPI_Waitall(send_and_recv_buffers.size(),
-                                    send_and_recv_buffers.data(),
-                                    MPI_STATUSES_IGNORE);
+            const int ierr =
+              MPI_Waitall(send_request_and_recv_answer_requests.size(),
+                          send_request_and_recv_answer_requests.data(),
+                          MPI_STATUSES_IGNORE);
             AssertThrowMPI(ierr);
           }
 
-        if (requests_answers.size() > 0)
+        // Then also check the send-answer requests.
+        if (send_answer_requests.size() > 0)
           {
-            auto ierr = MPI_Waitall(requests_answers.size(),
-                                    requests_answers.data(),
-                                    MPI_STATUSES_IGNORE);
+            const int ierr = MPI_Waitall(send_answer_requests.size(),
+                                         send_answer_requests.data(),
+                                         MPI_STATUSES_IGNORE);
             AssertThrowMPI(ierr);
           }
 

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.