]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Clean up CUDAWrappers::MatrixFree::reinit interface 7966/head
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Thu, 25 Apr 2019 16:55:52 +0000 (18:55 +0200)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Thu, 25 Apr 2019 19:50:30 +0000 (21:50 +0200)
include/deal.II/matrix_free/cuda_matrix_free.h
include/deal.II/matrix_free/cuda_matrix_free.templates.h
tests/cuda/matrix_free_matrix_vector_10.cu
tests/cuda/matrix_free_matrix_vector_10a.cu
tests/cuda/matrix_free_matrix_vector_19.cu

index 67af1c1d7a3efa66d31378faa22e27340e838055..1dd8b6481255ec13f096e78fb8a36a15d82e3a93 100644 (file)
@@ -156,35 +156,7 @@ namespace CUDAWrappers
      * degrees of freedom, the DoFHandler and the mapping describe the
      * transformation from unit to real cell, and the finite element
      * underlying the DoFHandler together with the quadrature formula
-     * describe the local operations. This function supports distributed
-     * computation (MPI).
-     */
-    void
-    reinit(const Mapping<dim> &             mapping,
-           const DoFHandler<dim> &          dof_handler,
-           const AffineConstraints<Number> &constraints,
-           const Quadrature<1> &            quad,
-           const MPI_Comm &                 comm,
-           const AdditionalData             additional_data = AdditionalData());
-
-    /**
-     * Initializes the data structures. Same as above but using a Q1 mapping.
-     */
-    void
-    reinit(const DoFHandler<dim> &          dof_handler,
-           const AffineConstraints<Number> &constraints,
-           const Quadrature<1> &            quad,
-           const MPI_Comm &                 comm,
-           const AdditionalData             AdditionalData = AdditionalData());
-
-    /**
-     * Extracts the information needed to perform loops over cells. The
-     * DoFHandler and AffineConstraints objects describe the layout of
-     * degrees of freedom, the DoFHandler and the mapping describe the
-     * transformation from unit to real cell, and the finite element
-     * underlying the DoFHandler together with the quadrature formula
-     * describe the local operations. This function does not support distributed
-     * computation.
+     * describe the local operations.
      */
     void
     reinit(const Mapping<dim> &             mapping,
index 67720c10edd27c71b0fe637b52304faff795c19b..2f98886f76956eb57e254885dd01e6b8a011e14f 100644 (file)
@@ -539,47 +539,21 @@ namespace CUDAWrappers
                                   const DoFHandler<dim> &          dof_handler,
                                   const AffineConstraints<Number> &constraints,
                                   const Quadrature<1> &            quad,
-                                  const MPI_Comm &                 comm,
                                   const AdditionalData additional_data)
   {
-    internal_reinit(mapping,
-                    dof_handler,
-                    constraints,
-                    quad,
-                    std::make_shared<const MPI_Comm>(comm),
-                    additional_data);
-  }
-
-
-
-  template <int dim, typename Number>
-  void
-  MatrixFree<dim, Number>::reinit(const DoFHandler<dim> &          dof_handler,
-                                  const AffineConstraints<Number> &constraints,
-                                  const Quadrature<1> &            quad,
-                                  const MPI_Comm &                 comm,
-                                  const AdditionalData additional_data)
-  {
-    internal_reinit(StaticMappingQ1<dim>::mapping,
-                    dof_handler,
-                    constraints,
-                    quad,
-                    std::make_shared<const MPI_Comm>(comm),
-                    additional_data);
-  }
-
-
-
-  template <int dim, typename Number>
-  void
-  MatrixFree<dim, Number>::reinit(const Mapping<dim> &             mapping,
-                                  const DoFHandler<dim> &          dof_handler,
-                                  const AffineConstraints<Number> &constraints,
-                                  const Quadrature<1> &            quad,
-                                  const AdditionalData additional_data)
-  {
-    internal_reinit(
-      mapping, dof_handler, constraints, quad, nullptr, additional_data);
+    const auto &triangulation = dof_handler.get_triangulation();
+    if (const auto parallel_triangulation =
+          dynamic_cast<const parallel::Triangulation<dim> *>(&triangulation))
+      internal_reinit(mapping,
+                      dof_handler,
+                      constraints,
+                      quad,
+                      std::make_shared<const MPI_Comm>(
+                        parallel_triangulation->get_communicator()),
+                      additional_data);
+    else
+      internal_reinit(
+        mapping, dof_handler, constraints, quad, nullptr, additional_data);
   }
 
 
@@ -591,12 +565,11 @@ namespace CUDAWrappers
                                   const Quadrature<1> &            quad,
                                   const AdditionalData additional_data)
   {
-    internal_reinit(StaticMappingQ1<dim>::mapping,
-                    dof_handler,
-                    constraints,
-                    quad,
-                    nullptr,
-                    additional_data);
+    reinit(StaticMappingQ1<dim>::mapping,
+           dof_handler,
+           constraints,
+           quad,
+           additional_data);
   }
 
 
index 63a887d5c0e313ab5c61b2dc654f9592d6919021..6bd47711cec0136b8af06963e3ecc4c1119194b6 100644 (file)
@@ -112,8 +112,7 @@ test()
   additional_data.mapping_update_flags = update_values | update_gradients |
                                          update_JxW_values |
                                          update_quadrature_points;
-  mf_data.reinit(
-    mapping, dof, constraints, quad, MPI_COMM_WORLD, additional_data);
+  mf_data.reinit(mapping, dof, constraints, quad, additional_data);
 
   const unsigned int coef_size =
     tria.n_locally_owned_active_cells() * std::pow(fe_degree + 1, dim);
index 5e4b2c4d5e67915d282171e6a91f8a824dc7214d..beb61bda3b0471ea28f874fcd64a6e1904ae3f85 100644 (file)
@@ -114,8 +114,7 @@ test()
   additional_data.mapping_update_flags = update_values | update_gradients |
                                          update_JxW_values |
                                          update_quadrature_points;
-  mf_data.reinit(
-    mapping, dof, constraints, quad, MPI_COMM_WORLD, additional_data);
+  mf_data.reinit(mapping, dof, constraints, quad, additional_data);
 
   const unsigned int coef_size =
     tria.n_locally_owned_active_cells() * std::pow(fe_degree + 1, dim);
index c60eb4058890ec191bf8fa7a06856728dbf8f82c..f838070a50c981cdd30a944d95f091ae589462e9 100644 (file)
@@ -108,8 +108,7 @@ test()
   additional_data.mapping_update_flags = update_values | update_gradients |
                                          update_JxW_values |
                                          update_quadrature_points;
-  mf_data.reinit(
-    mapping, dof, constraints, quad, MPI_COMM_WORLD, additional_data);
+  mf_data.reinit(mapping, dof, constraints, quad, additional_data);
 
   const unsigned int coef_size =
     tria.n_locally_owned_active_cells() * std::pow(fe_degree + 1, dim);

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.