From: Daniel Arndt Date: Thu, 25 Apr 2019 16:55:52 +0000 (+0200) Subject: Clean up CUDAWrappers::MatrixFree::reinit interface X-Git-Tag: v9.1.0-rc1~159^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F7966%2Fhead;p=dealii.git Clean up CUDAWrappers::MatrixFree::reinit interface --- diff --git a/include/deal.II/matrix_free/cuda_matrix_free.h b/include/deal.II/matrix_free/cuda_matrix_free.h index 67af1c1d7a..1dd8b64812 100644 --- a/include/deal.II/matrix_free/cuda_matrix_free.h +++ b/include/deal.II/matrix_free/cuda_matrix_free.h @@ -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 & mapping, - const DoFHandler & dof_handler, - const AffineConstraints &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 & dof_handler, - const AffineConstraints &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 & mapping, diff --git a/include/deal.II/matrix_free/cuda_matrix_free.templates.h b/include/deal.II/matrix_free/cuda_matrix_free.templates.h index 67720c10ed..2f98886f76 100644 --- a/include/deal.II/matrix_free/cuda_matrix_free.templates.h +++ b/include/deal.II/matrix_free/cuda_matrix_free.templates.h @@ -539,47 +539,21 @@ namespace CUDAWrappers const DoFHandler & dof_handler, const AffineConstraints &constraints, const Quadrature<1> & quad, - const MPI_Comm & comm, const AdditionalData additional_data) { - internal_reinit(mapping, - dof_handler, - constraints, - quad, - std::make_shared(comm), - additional_data); - } - - - - template - void - MatrixFree::reinit(const DoFHandler & dof_handler, - const AffineConstraints &constraints, - const Quadrature<1> & quad, - const MPI_Comm & comm, - const AdditionalData additional_data) - { - internal_reinit(StaticMappingQ1::mapping, - dof_handler, - constraints, - quad, - std::make_shared(comm), - additional_data); - } - - - - template - void - MatrixFree::reinit(const Mapping & mapping, - const DoFHandler & dof_handler, - const AffineConstraints &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 *>(&triangulation)) + internal_reinit(mapping, + dof_handler, + constraints, + quad, + std::make_shared( + 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::mapping, - dof_handler, - constraints, - quad, - nullptr, - additional_data); + reinit(StaticMappingQ1::mapping, + dof_handler, + constraints, + quad, + additional_data); } diff --git a/tests/cuda/matrix_free_matrix_vector_10.cu b/tests/cuda/matrix_free_matrix_vector_10.cu index 63a887d5c0..6bd47711ce 100644 --- a/tests/cuda/matrix_free_matrix_vector_10.cu +++ b/tests/cuda/matrix_free_matrix_vector_10.cu @@ -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); diff --git a/tests/cuda/matrix_free_matrix_vector_10a.cu b/tests/cuda/matrix_free_matrix_vector_10a.cu index 5e4b2c4d5e..beb61bda3b 100644 --- a/tests/cuda/matrix_free_matrix_vector_10a.cu +++ b/tests/cuda/matrix_free_matrix_vector_10a.cu @@ -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); diff --git a/tests/cuda/matrix_free_matrix_vector_19.cu b/tests/cuda/matrix_free_matrix_vector_19.cu index c60eb40588..f838070a50 100644 --- a/tests/cuda/matrix_free_matrix_vector_19.cu +++ b/tests/cuda/matrix_free_matrix_vector_19.cu @@ -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);