]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix MPI support for older versions 7680/head
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Mon, 4 Feb 2019 01:08:20 +0000 (02:08 +0100)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Mon, 4 Feb 2019 01:45:46 +0000 (02:45 +0100)
include/deal.II/lac/scalapack.h
source/lac/scalapack.cc
source/lac/sparsity_tools.cc

index e44ef1ffe48ce88cb6682f0f2cd4c27b9e8fd40b..ebc212f622fd426d03b52b8a94fb483938273b8a 100644 (file)
@@ -203,6 +203,8 @@ public:
    * The user has to ensure that all processes call this with identical @p rank.
    * The @p rank refers to a process of the MPI communicator used to create the process grid
    * of the distributed matrix.
+   *
+   * @note This function requires MPI-3.0 support
    */
   void
   copy_from(const LAPACKFullMatrix<NumberType> &matrix,
@@ -213,6 +215,7 @@ public:
    *
    * @note This function should only be used for relatively small matrix
    * dimensions. It is primarily intended for debugging purposes.
+   * This function requires MPI-3.0 support
    */
   void
   copy_to(FullMatrix<NumberType> &matrix) const;
index 9a5f1bb157351f2df8cf963b0c4179db62941857..8651557833d8ad12223fd806b48193dda6f57c53 100644 (file)
@@ -361,18 +361,19 @@ void
 ScaLAPACKMatrix<NumberType>::copy_from(const LAPACKFullMatrix<NumberType> &B,
                                        const unsigned int                  rank)
 {
+#  if DEAL_II_MPI_VERSION_GTE(3, 0)
   if (n_rows * n_columns == 0)
     return;
 
   const unsigned int this_mpi_process(
     Utilities::MPI::this_mpi_process(this->grid->mpi_communicator));
 
-#  ifdef DEBUG
+#    ifdef DEBUG
   Assert(Utilities::MPI::max(rank, this->grid->mpi_communicator) == rank,
          ExcMessage("All processes have to call routine with identical rank"));
   Assert(Utilities::MPI::min(rank, this->grid->mpi_communicator) == rank,
          ExcMessage("All processes have to call routine with identical rank"));
-#  endif
+#    endif
 
   // root process has to be active in the grid of A
   if (this_mpi_process == rank)
@@ -484,6 +485,11 @@ ScaLAPACKMatrix<NumberType>::copy_from(const LAPACKFullMatrix<NumberType> &B,
     MPI_Comm_free(&communicator_B);
 
   state = LAPACKSupport::matrix;
+#  else
+  (void)B;
+  (void)rank;
+  AssertThrow(false, ExcNotImplemented());
+#  endif
 }
 
 
@@ -528,18 +534,19 @@ void
 ScaLAPACKMatrix<NumberType>::copy_to(LAPACKFullMatrix<NumberType> &B,
                                      const unsigned int            rank) const
 {
+#  if DEAL_II_MPI_VERSION_GTE(3, 0)
   if (n_rows * n_columns == 0)
     return;
 
   const unsigned int this_mpi_process(
     Utilities::MPI::this_mpi_process(this->grid->mpi_communicator));
 
-#  ifdef DEBUG
+#    ifdef DEBUG
   Assert(Utilities::MPI::max(rank, this->grid->mpi_communicator) == rank,
          ExcMessage("All processes have to call routine with identical rank"));
   Assert(Utilities::MPI::min(rank, this->grid->mpi_communicator) == rank,
          ExcMessage("All processes have to call routine with identical rank"));
-#  endif
+#    endif
 
   if (this_mpi_process == rank)
     {
@@ -650,6 +657,11 @@ ScaLAPACKMatrix<NumberType>::copy_to(LAPACKFullMatrix<NumberType> &B,
   MPI_Group_free(&group_B);
   if (MPI_COMM_NULL != communicator_B)
     MPI_Comm_free(&communicator_B);
+#  else
+  (void)B;
+  (void)rank;
+  AssertThrow(false, ExcNotImplemented());
+#  endif
 }
 
 
index e6698f28aa2cadc18ac9f8884143d4b7327b64fc..e04c9e54f4fae6d099430c2b1a4421c804f31db0 100644 (file)
@@ -994,13 +994,14 @@ namespace SparsityTools
       unsigned int idx = 0;
       for (const auto &sparsity_line : send_data)
         {
-          const int ierr = MPI_Isend(sparsity_line.second.data(),
-                                     sparsity_line.second.size(),
-                                     DEAL_II_DOF_INDEX_MPI_TYPE,
-                                     sparsity_line.first,
-                                     124,
-                                     mpi_comm,
-                                     &requests[idx++]);
+          const int ierr =
+            MPI_Isend(DEAL_II_MPI_CONST_CAST(sparsity_line.second.data()),
+                      sparsity_line.second.size(),
+                      DEAL_II_DOF_INDEX_MPI_TYPE,
+                      sparsity_line.first,
+                      124,
+                      mpi_comm,
+                      &requests[idx++]);
           AssertThrowMPI(ierr);
         }
     }
@@ -1138,13 +1139,14 @@ namespace SparsityTools
       unsigned int idx = 0;
       for (const auto &sparsity_line : send_data)
         {
-          const int ierr = MPI_Isend(sparsity_line.second.data(),
-                                     sparsity_line.second.size(),
-                                     DEAL_II_DOF_INDEX_MPI_TYPE,
-                                     sparsity_line.first,
-                                     124,
-                                     mpi_comm,
-                                     &requests[idx++]);
+          const int ierr =
+            MPI_Isend(DEAL_II_MPI_CONST_CAST(sparsity_line.second.data()),
+                      sparsity_line.second.size(),
+                      DEAL_II_DOF_INDEX_MPI_TYPE,
+                      sparsity_line.first,
+                      124,
+                      mpi_comm,
+                      &requests[idx++]);
           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.