From 3c6f411f38c8a1f4fdfa2d64a0c7a4c771f9f8a6 Mon Sep 17 00:00:00 2001 From: Peter Munch Date: Tue, 28 Jan 2025 11:02:29 +0100 Subject: [PATCH] Consider number of components in n_local_dofs --- .../matrix_free/portable_matrix_free.templates.h | 11 +++++++---- include/deal.II/matrix_free/tools.h | 2 +- .../matrix_vector_host_device_multi_component.cc | 7 ++++--- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/include/deal.II/matrix_free/portable_matrix_free.templates.h b/include/deal.II/matrix_free/portable_matrix_free.templates.h index 8685b3df70..e8c760923b 100644 --- a/include/deal.II/matrix_free/portable_matrix_free.templates.h +++ b/include/deal.II/matrix_free/portable_matrix_free.templates.h @@ -367,9 +367,11 @@ namespace Portable size_t team_shmem_size(int /*team_size*/) const { - return SharedViewValues::shmem_size(Functor::n_local_dofs, + return SharedViewValues::shmem_size(Functor::n_local_dofs / + gpu_data.n_components, gpu_data.n_components) + - SharedViewGradients::shmem_size(Functor::n_local_dofs, + SharedViewGradients::shmem_size(Functor::n_local_dofs / + gpu_data.n_components, dim, gpu_data.n_components); } @@ -381,10 +383,11 @@ namespace Portable { // Get the scratch memory SharedViewValues values(team_member.team_shmem(), - Functor::n_local_dofs, + Functor::n_local_dofs / gpu_data.n_components, gpu_data.n_components); SharedViewGradients gradients(team_member.team_shmem(), - Functor::n_local_dofs, + Functor::n_local_dofs / + gpu_data.n_components, dim, gpu_data.n_components); diff --git a/include/deal.II/matrix_free/tools.h b/include/deal.II/matrix_free/tools.h index 5b3e15f5c9..988e6b6b4e 100644 --- a/include/deal.II/matrix_free/tools.h +++ b/include/deal.II/matrix_free/tools.h @@ -1492,7 +1492,7 @@ namespace MatrixFreeTools }; static constexpr unsigned int n_local_dofs = - dealii::Utilities::pow(fe_degree + 1, dim); + dealii::Utilities::pow(fe_degree + 1, dim) * n_components; static constexpr unsigned int n_q_points = dealii::Utilities::pow(n_q_points_1d, dim); diff --git a/tests/matrix_free_kokkos/matrix_vector_host_device_multi_component.cc b/tests/matrix_free_kokkos/matrix_vector_host_device_multi_component.cc index 10639ffba5..c5b8926966 100644 --- a/tests/matrix_free_kokkos/matrix_vector_host_device_multi_component.cc +++ b/tests/matrix_free_kokkos/matrix_vector_host_device_multi_component.cc @@ -198,9 +198,10 @@ public: phi.distribute_local_to_global(dst); } - static const unsigned int n_dofs_1d = fe_degree + 1; - static const unsigned int n_local_dofs = Utilities::pow(fe_degree + 1, dim); - static const unsigned int n_q_points = Utilities::pow(fe_degree + 1, dim); + static const unsigned int n_dofs_1d = fe_degree + 1; + static const unsigned int n_local_dofs = + Utilities::pow(fe_degree + 1, dim) * n_components; + static const unsigned int n_q_points = Utilities::pow(fe_degree + 1, dim); private: const unsigned int version; -- 2.39.5