]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add test 7968/head
authorDaniel Arndt <arndtd@ornl.gov>
Thu, 25 Apr 2019 22:42:32 +0000 (16:42 -0600)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Thu, 25 Apr 2019 23:05:18 +0000 (01:05 +0200)
tests/cuda/matrix_free_reinit_01.cu [new file with mode: 0644]
tests/cuda/matrix_free_reinit_01.with_mpi=on.with_p4est=on.mpirun=2.output [new file with mode: 0644]

diff --git a/tests/cuda/matrix_free_reinit_01.cu b/tests/cuda/matrix_free_reinit_01.cu
new file mode 100644 (file)
index 0000000..f0afe26
--- /dev/null
@@ -0,0 +1,98 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2019 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE.md at
+// the top level directory of deal.II.
+//
+// ---------------------------------------------------------------------
+
+
+
+// Test that initializing with CUDAWrappers::MatrixFree with empty ranges work.
+
+#include <deal.II/distributed/tria.h>
+
+#include <deal.II/dofs/dof_handler.h>
+#include <deal.II/dofs/dof_tools.h>
+
+#include <deal.II/fe/fe_q.h>
+
+#include <deal.II/grid/grid_generator.h>
+
+#include <deal.II/lac/affine_constraints.h>
+
+#include <deal.II/matrix_free/cuda_matrix_free.h>
+
+#include <deal.II/numerics/vector_tools.h>
+
+#include "../tests.h"
+
+
+
+template <int dim, int fe_degree>
+void
+test()
+{
+  typedef double Number;
+
+  parallel::distributed::Triangulation<dim> tria(MPI_COMM_WORLD);
+  GridGenerator::hyper_cube(tria);
+  tria.refine_global(1);
+
+  FE_Q<dim>       fe(fe_degree);
+  DoFHandler<dim> dof(tria);
+  dof.distribute_dofs(fe);
+
+  IndexSet owned_set = dof.locally_owned_dofs();
+  IndexSet relevant_set;
+  DoFTools::extract_locally_relevant_dofs(dof, relevant_set);
+
+  deallog << "locally owned dofs :" << std::endl;
+  owned_set.print(deallog.get_file_stream());
+
+  deallog << "locally relevant dofs :" << std::endl;
+  owned_set.print(deallog.get_file_stream());
+
+  AffineConstraints<double> constraints(relevant_set);
+  DoFTools::make_hanging_node_constraints(dof, constraints);
+  VectorTools::interpolate_boundary_values(dof,
+                                           0,
+                                           Functions::ZeroFunction<dim>(),
+                                           constraints);
+  constraints.close();
+
+  MappingQGeneric<dim>                  mapping(fe_degree);
+  CUDAWrappers::MatrixFree<dim, Number> mf_data;
+  const QGauss<1>                       quad(fe_degree + 1);
+  typename CUDAWrappers::MatrixFree<dim, Number>::AdditionalData
+    additional_data;
+  additional_data.mapping_update_flags = update_values | update_gradients |
+                                         update_JxW_values |
+                                         update_quadrature_points;
+  mf_data.reinit(mapping, dof, constraints, quad, additional_data);
+
+  deallog << "OK" << std::endl;
+}
+
+
+int
+main(int argc, char **argv)
+{
+  Utilities::MPI::MPI_InitFinalize mpi_initialization(
+    argc, argv, testing_max_num_threads());
+
+  unsigned int myid = Utilities::MPI::this_mpi_process(MPI_COMM_WORLD);
+  deallog.push(Utilities::int_to_string(myid));
+
+  init_cuda(true);
+  MPILogInitAll mpi_inilog;
+
+  test<2, 1>();
+}
diff --git a/tests/cuda/matrix_free_reinit_01.with_mpi=on.with_p4est=on.mpirun=2.output b/tests/cuda/matrix_free_reinit_01.with_mpi=on.with_p4est=on.mpirun=2.output
new file mode 100644 (file)
index 0000000..9986ba0
--- /dev/null
@@ -0,0 +1,13 @@
+
+DEAL:0:0::locally owned dofs :
+{[0,8]}
+DEAL:0:0::locally relevant dofs :
+{[0,8]}
+DEAL:0:0::OK
+
+DEAL:1:1::locally owned dofs :
+{}
+DEAL:1:1::locally relevant dofs :
+{}
+DEAL:1:1::OK
+

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.