]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Simplify some MPI code. 14120/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Fri, 8 Jul 2022 23:38:08 +0000 (17:38 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Sat, 9 Jul 2022 03:52:56 +0000 (21:52 -0600)
source/multigrid/mg_transfer_internal.cc

index e5357ac76c1703fa23c93b86f69216dc68fa83ac..f442e6b9e6668c3fc9f0ff1b896e7ae1dca50b48 100644 (file)
@@ -291,31 +291,16 @@ namespace internal
               {
                 requests.push_back(MPI_Request());
                 std::vector<DoFPair> &data = send_data[dest];
-                // If there is nothing to send, we still need to send a message,
-                // because the receiving end will be waitng. In that case we
-                // just send an empty message.
-                if (data.size())
-                  {
-                    const int ierr = MPI_Isend(data.data(),
-                                               data.size() * sizeof(data[0]),
-                                               MPI_BYTE,
-                                               dest,
-                                               mpi_tag,
-                                               tria->get_communicator(),
-                                               &*requests.rbegin());
-                    AssertThrowMPI(ierr);
-                  }
-                else
-                  {
-                    const int ierr = MPI_Isend(nullptr,
-                                               0,
-                                               MPI_BYTE,
-                                               dest,
-                                               mpi_tag,
-                                               tria->get_communicator(),
-                                               &*requests.rbegin());
-                    AssertThrowMPI(ierr);
-                  }
+
+                const int ierr =
+                  MPI_Isend(data.data(),
+                            data.size() * sizeof(decltype(*data.data())),
+                            MPI_BYTE,
+                            dest,
+                            mpi_tag,
+                            tria->get_communicator(),
+                            &*requests.rbegin());
+                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.