From: Daniel Arndt Date: Thu, 25 Apr 2019 22:42:32 +0000 (-0600) Subject: Add test X-Git-Tag: v9.1.0-rc1~166^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=299baa3983a291aa3292067176e9d04e7e70cace;p=dealii.git Add test --- diff --git a/tests/cuda/matrix_free_reinit_01.cu b/tests/cuda/matrix_free_reinit_01.cu new file mode 100644 index 0000000000..f0afe26dd9 --- /dev/null +++ b/tests/cuda/matrix_free_reinit_01.cu @@ -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 + +#include +#include + +#include + +#include + +#include + +#include + +#include + +#include "../tests.h" + + + +template +void +test() +{ + typedef double Number; + + parallel::distributed::Triangulation tria(MPI_COMM_WORLD); + GridGenerator::hyper_cube(tria); + tria.refine_global(1); + + FE_Q fe(fe_degree); + DoFHandler 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 constraints(relevant_set); + DoFTools::make_hanging_node_constraints(dof, constraints); + VectorTools::interpolate_boundary_values(dof, + 0, + Functions::ZeroFunction(), + constraints); + constraints.close(); + + MappingQGeneric mapping(fe_degree); + CUDAWrappers::MatrixFree mf_data; + const QGauss<1> quad(fe_degree + 1); + typename CUDAWrappers::MatrixFree::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 index 0000000000..9986ba068d --- /dev/null +++ b/tests/cuda/matrix_free_reinit_01.with_mpi=on.with_p4est=on.mpirun=2.output @@ -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 +