From: Bruno Turcksin Date: Thu, 18 May 2023 15:51:44 +0000 (+0000) Subject: Remove temporary Kokkos::View X-Git-Tag: v9.5.0-rc1~201^2~3 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e17d771a6853c51a3833af10cae8e484dce6dc64;p=dealii.git Remove temporary Kokkos::View --- 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 421e0abbcc..455dedf809 100644 --- a/include/deal.II/matrix_free/cuda_matrix_free.templates.h +++ b/include/deal.II/matrix_free/cuda_matrix_free.templates.h @@ -712,24 +712,22 @@ namespace CUDAWrappers dofs_per_cell = fe.n_dofs_per_cell(); q_points_per_cell = Utilities::fixed_power(n_q_points_1d); - const ::dealii::internal::MatrixFreeFunctions::ShapeInfo shape_info( - quad, fe); + ::dealii::internal::MatrixFreeFunctions::ShapeInfo shape_info(quad, + fe); unsigned int size_shape_values = n_dofs_1d * n_q_points_1d; - FE_DGQArbitraryNodes<1> fe_quad_co(quad); - const ::dealii::internal::MatrixFreeFunctions::ShapeInfo - shape_info_co(quad, fe_quad_co); + FE_DGQArbitraryNodes<1> fe_quad_co(quad); + ::dealii::internal::MatrixFreeFunctions::ShapeInfo shape_info_co( + quad, fe_quad_co); shape_values = Kokkos::View( Kokkos::view_alloc("shape_values", Kokkos::WithoutInitializing), size_shape_values); - auto shape_values_host = Kokkos::create_mirror_view(shape_values); - for (unsigned int i = 0; i < size_shape_values; ++i) - { - shape_values_host[i] = shape_info.data.front().shape_values[i]; - } - Kokkos::deep_copy(shape_values, shape_values_host); + Kokkos::deep_copy(shape_values, + Kokkos::View( + shape_info.data.front().shape_values.data(), + size_shape_values)); if (update_flags & update_gradients) { @@ -737,13 +735,10 @@ namespace CUDAWrappers Kokkos::View( Kokkos::view_alloc("shape_gradients", Kokkos::WithoutInitializing), size_shape_values); - auto shape_gradients_host = Kokkos::create_mirror_view(shape_gradients); - for (unsigned int i = 0; i < size_shape_values; ++i) - { - shape_gradients_host[i] = - shape_info.data.front().shape_gradients[i]; - } - Kokkos::deep_copy(shape_gradients, shape_gradients_host); + Kokkos::deep_copy(shape_gradients, + Kokkos::View( + shape_info.data.front().shape_gradients.data(), + size_shape_values)); co_shape_gradients = @@ -751,14 +746,10 @@ namespace CUDAWrappers Kokkos::view_alloc("co_shape_gradients", Kokkos::WithoutInitializing), size_shape_values); - auto co_shape_gradients_host = - Kokkos::create_mirror_view(co_shape_gradients); - for (unsigned int i = 0; i < size_shape_values; ++i) - { - co_shape_gradients_host[i] = - shape_info_co.data.front().shape_gradients[i]; - } - Kokkos::deep_copy(co_shape_gradients, co_shape_gradients_host); + Kokkos::deep_copy(co_shape_gradients, + Kokkos::View( + shape_info_co.data.front().shape_gradients.data(), + size_shape_values)); } internal::ReinitHelper helper(