From 90d4752f8bdc52bf7642547eb1641896a0eafd14 Mon Sep 17 00:00:00 2001 From: Bruno Turcksin Date: Mon, 15 May 2023 13:41:22 +0000 Subject: [PATCH] Fix reviewer's comment --- examples/step-64/step-64.cc | 2 +- .../matrix_free/cuda_hanging_nodes_internal.h | 76 +++++++++---------- .../deal.II/matrix_free/cuda_matrix_free.h | 6 +- tests/cuda/cuda_evaluate_1d_shape.cc | 2 +- 4 files changed, 43 insertions(+), 43 deletions(-) diff --git a/examples/step-64/step-64.cc b/examples/step-64/step-64.cc index 0c99de0a16..f63796d109 100644 --- a/examples/step-64/step-64.cc +++ b/examples/step-64/step-64.cc @@ -78,7 +78,7 @@ namespace Step64 // Since CUDAWrappers::MatrixFree::Data doesn't know about the size of its // arrays, we need to store the number of quadrature points and the - // numbers of degrees of freedom in this class to do necessary index + // number of degrees of freedom in this class to do necessary index // conversions. static const unsigned int n_dofs_1d = fe_degree + 1; static const unsigned int n_local_dofs = Utilities::pow(n_dofs_1d, dim); diff --git a/include/deal.II/matrix_free/cuda_hanging_nodes_internal.h b/include/deal.II/matrix_free/cuda_hanging_nodes_internal.h index 8063eee3bb..90942f92fe 100644 --- a/include/deal.II/matrix_free/cuda_hanging_nodes_internal.h +++ b/include/deal.II/matrix_free/cuda_hanging_nodes_internal.h @@ -54,7 +54,7 @@ namespace CUDAWrappers template DEAL_II_HOST_DEVICE inline bool - is_constrained_dof( + is_constrained_dof_2d( const dealii::internal::MatrixFreeFunctions::ConstraintKinds & constraint_mask, const unsigned int x_idx, @@ -78,7 +78,7 @@ namespace CUDAWrappers template DEAL_II_HOST_DEVICE inline bool - is_constrained_dof( + is_constrained_dof_3d( const dealii::internal::MatrixFreeFunctions::ConstraintKinds & constraint_mask, const unsigned int x_idx, @@ -156,7 +156,7 @@ namespace CUDAWrappers unconstrained))) != dealii::internal::MatrixFreeFunctions::ConstraintKinds::unconstrained; - Number t[n_q_points]; + Number tmp[n_q_points]; Kokkos::parallel_for( Kokkos::TeamThreadRange(team_member, n_q_points), [&](const int &q_point) { @@ -170,15 +170,15 @@ namespace CUDAWrappers dealii::internal::MatrixFreeFunctions::ConstraintKinds::subcell_y; const unsigned int interp_idx = (direction == 0) ? x_idx : y_idx; - t[q_point] = 0; + tmp[q_point] = 0; // Flag is true if for the given direction, the dof is constrained // with the right type and is on the correct side (left (= 0) or right // (= fe_degree)) const bool constrained_dof = - is_constrained_dof(constraint_mask, - x_idx, - y_idx); + is_constrained_dof_2d(constraint_mask, + x_idx, + y_idx); if (constrained_face && constrained_dof) { @@ -198,7 +198,7 @@ namespace CUDAWrappers transpose ? constraint_weights[i * n_q_points_1d + interp_idx] : constraint_weights[interp_idx * n_q_points_1d + i]; - t[q_point] += w * values[real_idx]; + tmp[q_point] += w * values[real_idx]; } } else @@ -216,25 +216,25 @@ namespace CUDAWrappers constraint_weights[(fe_degree - interp_idx) * n_q_points_1d + fe_degree - i]; - t[q_point] += w * values[real_idx]; + tmp[q_point] += w * values[real_idx]; } } } }); - // The synchronization is done for all the threads in one block with - // each block being assigned to one element. + // The synchronization is done for all the threads in one team with + // each team being assigned to one element. team_member.team_barrier(); Kokkos::parallel_for(Kokkos::TeamThreadRange(team_member, n_q_points), [&](const int &q_point) { const unsigned int x_idx = q_point % n_q_points_1d; const unsigned int y_idx = q_point / n_q_points_1d; const bool constrained_dof = - is_constrained_dof( + is_constrained_dof_2d( constraint_mask, x_idx, y_idx); if (constrained_face && constrained_dof) values[index2(x_idx, y_idx)] = - t[q_point]; + tmp[q_point]; }); team_member.team_barrier(); @@ -304,7 +304,7 @@ namespace CUDAWrappers dealii::internal::MatrixFreeFunctions::ConstraintKinds::edge_z; const auto constrained_face = constraint_mask & (face1 | face2 | edge); - Number t[n_q_points]; + Number tmp[n_q_points]; Kokkos::parallel_for( Kokkos::TeamThreadRange(team_member, n_q_points), [&](const int &q_point) { @@ -316,16 +316,16 @@ namespace CUDAWrappers (direction == 1) ? y_idx : z_idx; const bool constrained_dof = - is_constrained_dof(constraint_mask, - x_idx, - y_idx, - z_idx, - face1_type, - face2_type, - face1, - face2, - edge); - t[q_point] = 0; + is_constrained_dof_3d(constraint_mask, + x_idx, + y_idx, + z_idx, + face1_type, + face2_type, + face1, + face2, + edge); + tmp[q_point] = 0; if ((constrained_face != dealii::internal::MatrixFreeFunctions:: ConstraintKinds::unconstrained) && constrained_dof) @@ -348,7 +348,7 @@ namespace CUDAWrappers transpose ? constraint_weights[i * n_q_points_1d + interp_idx] : constraint_weights[interp_idx * n_q_points_1d + i]; - t[q_point] += w * values[real_idx]; + tmp[q_point] += w * values[real_idx]; } } else @@ -369,14 +369,14 @@ namespace CUDAWrappers constraint_weights[(fe_degree - interp_idx) * n_q_points_1d + fe_degree - i]; - t[q_point] += w * values[real_idx]; + tmp[q_point] += w * values[real_idx]; } } } }); - // The synchronization is done for all the threads in one block with - // each block being assigned to one element. + // The synchronization is done for all the threads in one team with + // each team being assigned to one element. team_member.team_barrier(); Kokkos::parallel_for( @@ -386,19 +386,19 @@ namespace CUDAWrappers const unsigned int y_idx = (q_point / n_q_points_1d) % n_q_points_1d; const unsigned int z_idx = q_point / (n_q_points_1d * n_q_points_1d); const bool constrained_dof = - is_constrained_dof(constraint_mask, - x_idx, - y_idx, - z_idx, - face1_type, - face2_type, - face1, - face2, - edge); + is_constrained_dof_3d(constraint_mask, + x_idx, + y_idx, + z_idx, + face1_type, + face2_type, + face1, + face2, + edge); if ((constrained_face != dealii::internal::MatrixFreeFunctions:: ConstraintKinds::unconstrained) && constrained_dof) - values[index3(x_idx, y_idx, z_idx)] = t[q_point]; + values[index3(x_idx, y_idx, z_idx)] = tmp[q_point]; }); team_member.team_barrier(); diff --git a/include/deal.II/matrix_free/cuda_matrix_free.h b/include/deal.II/matrix_free/cuda_matrix_free.h index 0a4d68f764..3666d7e853 100644 --- a/include/deal.II/matrix_free/cuda_matrix_free.h +++ b/include/deal.II/matrix_free/cuda_matrix_free.h @@ -652,9 +652,9 @@ namespace CUDAWrappers Kokkos::MemoryTraits>; DEAL_II_HOST_DEVICE - SharedData(const TeamHandle &team_member, - SharedView1D values, - SharedView2D gradients) + SharedData(const TeamHandle & team_member, + const SharedView1D &values, + const SharedView2D &gradients) : team_member(team_member) , values(values) , gradients(gradients) diff --git a/tests/cuda/cuda_evaluate_1d_shape.cc b/tests/cuda/cuda_evaluate_1d_shape.cc index 0da2826aa7..face0d389c 100644 --- a/tests/cuda/cuda_evaluate_1d_shape.cc +++ b/tests/cuda/cuda_evaluate_1d_shape.cc @@ -20,7 +20,7 @@ // much easier to check their correctness directly rather than from the results // in dependent functions -#include "deal.II/base/memory_space.h" +#include #include #include -- 2.39.5