Repository: dealii/dealii
Pull request #18261: portable matrix-free: fix GPU crash in compute_diagonal()
Author: login: tjhei
Labels: name: GPU
name: ready to test
Created: 2025-03-19T21:29:44Z | Merged: 2025-03-20T20:03:49Z

fixes #18210

The Functor passed to Kokkos::parallel_for() is placed into constant memory, which is read-only. This means the HelmholtzOperatorQuad can not be modified by setting a member variable to the current cell index for example. Instead, add access functions for the necessary functions to FEEvaluation and query the information as needed.

This took @masterleinad and me a whole day to figure out.

FYI @YiminJin (this was not your fault!)

Linked issue #18210: step-64 crashes on GPU
as noted in https://github.com/dealii/dealii/pull/18124#issuecomment-2706767595 and caused by #18124. I can reproduce with CUDA even without MPI. My error is different:
```
Cycle 0                                                                                                                     
   Number of active cells:       8                                                                                          
   Number of degrees of freedom: 343                                                                                        
cudaDeviceSynchronize() error( cudaErrorLaunchFailure): unspecified launch failure /ssd/libs-candi-petsc-kokkos-cuda4/tmp/un
pack/kokkos-4.4.00/core/src/Cuda/Kokkos_Cuda_Instance.cpp:153                                                               
Backtrace:                                                                                                                  
[0x752705eeedc9] Kokkos::Impl::save_stacktrace()                                                                            
[0x752705ec44d0] Kokkos::Impl::host_abort(char const*)                                                                      
[0x752705ef6bd6] Kokkos::Impl::cuda_internal_error_abort(cudaError, char const*, char const*, int)                          
[0x752705ef6d56] Kokkos::Impl::cuda_device_synchronize(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocat
or<char> > const&)                                                                                                          
[0x752705edf2ed] Kokkos::Impl::ExecSpaceManager::static_fence(std::__cxx11::basic_string<char, std::char_traits<char>, std::
allocator<char> > const&)                                                                                                   
[0x7526b992ec7c] void Kokkos::deep_copy<double*, Kokkos::LayoutLeft, Kokkos::Device<Kokkos::Serial, Kokkos::CudaHostPinnedSp
ace>, Kokkos::Experimental::EmptyViewHooks, Kokkos::MemoryTraits<0u>, double*, Kokkos::CudaSpace>(Kokkos::View<double*, Kokk
os::LayoutLeft, Kokkos::Device<Kokkos::Serial, Kokkos::CudaHostPinnedSpace>, Kokkos::Experimental::EmptyViewHooks, Kokkos::M
emoryTraits<0u> > const&, Kokkos::View<double*, Kokkos::CudaSpace> const&, std::enable_if<(std::is_void<Kokkos::ViewTraits<d
ouble*, Kokkos::LayoutLeft, Kokkos::Device<Kokkos::Serial, Kokkos::CudaHostPinnedSpace>, Kokkos::Experimental::EmptyViewHook
s, Kokkos::MemoryTraits<0u> >::specialize>::value&&std::is_void<Kokkos::ViewTraits<double*, Kokkos::CudaSpace>::specialize>:
:value)&&((((unsigned int)Kokkos::ViewTraits<double*, Kokkos::LayoutLeft, Kokkos::Device<Kokkos::Serial, Kokkos::CudaHostPin
nedSpace>, Kokkos::Experimental::EmptyViewHooks, Kokkos::MemoryTraits<0u> >::rank)!=(0))||(((unsigned int)Kokkos::ViewTraits
<double*, Kokkos::CudaSpace>::rank)!=(0))), void>::type*)                                                                   
[0x7526b99040da] auto Kokkos::create_mirror_view_and_copy<Kokkos::CudaHostPinnedSpace, std::__cxx11::basic_string<char, std:
:char_traits<char>, std::allocator<char> >, double*, Kokkos::CudaSpace, void>(Kokkos::Impl::ViewCtorProp<Kokkos::CudaHostPin
nedSpace, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > const&, Kokkos::View<double*, Ko
kkos::CudaSpace> const&)                                                                                                    
[0x7526b9904262] Kokkos::Impl::MirrorViewType<Kokkos::CudaHostPinnedSpace, double*, Kokkos::CudaSpace>::view_type Kokkos::cr
eate_mirror_view_and_copy<Kokkos::CudaHostPinnedSpace, double*, Kokkos::CudaSpace, void>(Kokkos::CudaHostPinnedSpace const&,
 Kokkos::View<double*, Kokkos::CudaSpace> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<ch
ar> > const&, std::enable_if<std::is_void<Kokkos::ViewTraits<double*, Kokkos::CudaSpace>::specialize>::value, void>::type*) 
[0x7526b98e219e] dealii::LinearAlgebra::distributed::Vector<double, dealii::MemorySpace::Default>::compress_start(unsigned i
nt, dealii::VectorOperation::values)                                                                                        
[0x7526b98e1e77] dealii::LinearAlgebra::distributed::Vector<double, dealii::MemorySpace::Default>::compress(dealii::VectorOp
eration::values)                                                                                                            
[0x61808c4f9ca0] void dealii::Portable::MatrixFree<3, double>::distributed_cell_loop<dealii::MatrixFreeTools::CellAction<3, 
3, 4, 1, double, Step64::HelmholtzOperatorQuad<3, 3> > >(dealii::MatrixFreeTools::CellAction<3, 3, 4, 1, double, Step64::Hel
mholtzOperatorQuad<3, 3> > const&, dealii::LinearAlgebra::distributed::Vector<double, dealii::MemorySpace::Default> const&, dealii::LinearAlgebra::distributed::Vector<double, dealii::MemorySpace::Default>&) const
[0x61808c4ebf04] void dealii::Portable::MatrixFree<3, double>::cell_loop<dealii::MatrixFreeTools::CellAction<3, 3, 4, 1, double, Step64::HelmholtzOperatorQuad<3, 3> >, dealii::LinearAlgebra::distributed::Vector<double, dealii::MemorySpace::Default> >(dealii::MatrixFreeTools::CellAction<3, 3, 4, 1, double, Step64::HelmholtzOperatorQuad<3, 3> > const&, dealii::LinearAlgeb
ra::distributed::Vector<double, dealii::MemorySpace::Default> const&, dealii::LinearAlgebra::distributed::Vector<double, dea
lii::MemorySpace::Default>&) const
[0x61808c4df53c] void dealii::MatrixFreeTools::compute_diagonal<3, 3, 4, 1, double, dealii::MemorySpace::Default, Step64::HelmholtzOperatorQuad<3, 3> >(dealii::Portable::MatrixFree<3, double> const&, dealii::LinearAlgebra::distributed::Vector<double, dealii::MemorySpace::Default>&, Step64::HelmholtzOperatorQuad<3, 3> const&, dealii::EvaluationFlags::EvaluationFlags, dealii::EvaluationFlags::EvaluationFlags, unsigned int, unsigned int, unsigned int, unsigned int)
[0x61808c4d0f03] Step64::HelmholtzOperator<3, 3>::compute_diagonal()
[0x61808c4dcf83] Step64::HelmholtzProblem<3, 3>::solve()
[0x61808c4cfdb5] Step64::HelmholtzProblem<3, 3>::run()
[0x61808c4b0a66] main
```


Diff:
diff --git a/doc/news/changes/minor/20250319tjhei b/doc/news/changes/minor/20250319tjhei
new file mode 100644
index 000000000000..341ec4c104d2
--- /dev/null
+++ b/doc/news/changes/minor/20250319tjhei
@@ -0,0 +1,5 @@
+New: Portable::FEEvaluation::get_current_cell_index() and
+Portable::FEEvaluation::get_matrix_free_data() allow querying
+the current Portable::MatrixFree::Data object and the current cell index respectively.
+<br>
+(Daniel Arndt, Timo Heister, 2025/03/19)
diff --git a/examples/step-64/step-64.cc b/examples/step-64/step-64.cc
index aee6c2025860..e51fbbfaa782 100644
--- a/examples/step-64/step-64.cc
+++ b/examples/step-64/step-64.cc
@@ -122,29 +122,15 @@ namespace Step64
   class HelmholtzOperatorQuad
   {
   public:
-    DEAL_II_HOST_DEVICE HelmholtzOperatorQuad(
-      const typename Portable::MatrixFree<dim, double>::Data *gpu_data,
-      double                                                 *coef,
-      int                                                     cell)
-      : gpu_data(gpu_data)
-      , coef(coef)
-      , cell(cell)
+    DEAL_II_HOST_DEVICE HelmholtzOperatorQuad(double *coef)
+      : coef(coef)
     {}
 
     DEAL_II_HOST_DEVICE void operator()(
       Portable::FEEvaluation<dim, fe_degree, fe_degree + 1, 1, double> *fe_eval,
       const int q_point) const;
 
-    DEAL_II_HOST_DEVICE void set_matrix_free_data(
-      const typename Portable::MatrixFree<dim, double>::Data &data)
-    {
-      gpu_data = &data;
-    }
 
-    DEAL_II_HOST_DEVICE void set_cell(int new_cell)
-    {
-      cell = new_cell;
-    }
 
     static const unsigned int n_q_points =
       dealii::Utilities::pow(fe_degree + 1, dim);
@@ -152,9 +138,7 @@ namespace Step64
     static const unsigned int n_local_dofs = n_q_points;
 
   private:
-    const typename Portable::MatrixFree<dim, double>::Data *gpu_data;
-    double                                                 *coef;
-    int                                                     cell;
+    double *coef;
   };
 
 
@@ -170,10 +154,17 @@ namespace Step64
     Portable::FEEvaluation<dim, fe_degree, fe_degree + 1, 1, double> *fe_eval,
     const int q_point) const
   {
-    const unsigned int pos =
-      gpu_data->local_q_point_id(cell, n_q_points, q_point);
+    const int cell_index = fe_eval->get_current_cell_index();
+    const typename Portable::MatrixFree<dim, double>::Data *gpu_data =
+      fe_eval->get_matrix_free_data();
 
-    fe_eval->submit_value(coef[pos] * fe_eval->get_value(q_point), q_point);
+    const unsigned int position =
+      gpu_data->local_q_point_id(cell_index, n_q_points, q_point);
+    auto coeff = coef[position];
+
+    auto value = fe_eval->get_value(q_point);
+
+    fe_eval->submit_value(coeff * value, q_point);
     fe_eval->submit_gradient(fe_eval->get_gradient(q_point), q_point);
   }
 
@@ -218,7 +209,7 @@ namespace Step64
   // vector.
   template <int dim, int fe_degree>
   DEAL_II_HOST_DEVICE void LocalHelmholtzOperator<dim, fe_degree>::operator()(
-    const unsigned int                                      cell,
+    const unsigned int /*cell*/,
     const typename Portable::MatrixFree<dim, double>::Data *gpu_data,
     Portable::SharedData<dim, double>                      *shared_data,
     const double                                           *src,
@@ -229,7 +220,7 @@ namespace Step64
     fe_eval.read_dof_values(src);
     fe_eval.evaluate(EvaluationFlags::values | EvaluationFlags::gradients);
     fe_eval.apply_for_each_quad_point(
-      HelmholtzOperatorQuad<dim, fe_degree>(gpu_data, coef, cell));
+      HelmholtzOperatorQuad<dim, fe_degree>(coef));
     fe_eval.integrate(EvaluationFlags::values | EvaluationFlags::gradients);
     fe_eval.distribute_local_to_global(dst);
   }
@@ -363,7 +354,7 @@ namespace Step64
     initialize_dof_vector(inverse_diagonal);
 
     HelmholtzOperatorQuad<dim, fe_degree> helmholtz_operator_quad(
-      nullptr, coef.get_values(), -1);
+      coef.get_values());
 
     MatrixFreeTools::compute_diagonal<dim, fe_degree, fe_degree + 1, 1, double>(
       mf_data,
diff --git a/include/deal.II/matrix_free/portable_fe_evaluation.h b/include/deal.II/matrix_free/portable_fe_evaluation.h
index ae23f70eb807..21de3dccb04f 100644
--- a/include/deal.II/matrix_free/portable_fe_evaluation.h
+++ b/include/deal.II/matrix_free/portable_fe_evaluation.h
@@ -126,6 +126,22 @@ namespace Portable
     DEAL_II_HOST_DEVICE
     FEEvaluation(const data_type *data, SharedData<dim, Number> *shdata);
 
+    /**
+     * Return the index of the current cell.
+     */
+    DEAL_II_HOST_DEVICE
+    int
+    get_current_cell_index();
+
+    /**
+     * Return a pointer to the MatrixFree<dim, Number>::Data object on device
+     * that contains necessary constraint, dof index, and shape function
+     * information for evaluation used in the matrix-free kernels.
+     */
+    DEAL_II_HOST_DEVICE
+    const data_type *
+    get_matrix_free_data();
+
     /**
      * For the vector @p src, read out the values on the degrees of freedom of
      * the current cell, and store them internally. Similar functionality as
@@ -270,6 +286,38 @@ namespace Portable
 
 
 
+  template <int dim,
+            int fe_degree,
+            int n_q_points_1d,
+            int n_components_,
+            typename Number>
+  DEAL_II_HOST_DEVICE int
+  FEEvaluation<dim, fe_degree, n_q_points_1d, n_components_, Number>::
+    get_current_cell_index()
+  {
+    return cell_id;
+  }
+
+
+
+  template <int dim,
+            int fe_degree,
+            int n_q_points_1d,
+            int n_components_,
+            typename Number>
+  DEAL_II_HOST_DEVICE const typename FEEvaluation<dim,
+                                                  fe_degree,
+                                                  n_q_points_1d,
+                                                  n_components_,
+                                                  Number>::data_type *
+  FEEvaluation<dim, fe_degree, n_q_points_1d, n_components_, Number>::
+    get_matrix_free_data()
+  {
+    return data;
+  }
+
+
+
   template <int dim,
             int fe_degree,
             int n_q_points_1d,
diff --git a/include/deal.II/matrix_free/tools.h b/include/deal.II/matrix_free/tools.h
index 351ffb3246ba..00545cbfb533 100644
--- a/include/deal.II/matrix_free/tools.h
+++ b/include/deal.II/matrix_free/tools.h
@@ -1407,8 +1407,7 @@ namespace MatrixFreeTools
         Portable::
           FEEvaluation<dim, fe_degree, n_q_points_1d, n_components, Number>
             fe_eval(gpu_data, shared_data);
-        m_quad_operation.set_matrix_free_data(*gpu_data);
-        m_quad_operation.set_cell(cell);
+
         constexpr int dofs_per_cell = decltype(fe_eval)::tensor_dofs_per_cell;
         typename decltype(fe_eval)::value_type
           diagonal[dofs_per_cell / n_components] = {};
@@ -1503,7 +1502,7 @@ namespace MatrixFreeTools
         dealii::Utilities::pow(n_q_points_1d, dim);
 
     private:
-      mutable QuadOperation                  m_quad_operation;
+      const QuadOperation                    m_quad_operation;
       const EvaluationFlags::EvaluationFlags m_evaluation_flags;
       const EvaluationFlags::EvaluationFlags m_integration_flags;
     };
diff --git a/tests/matrix_free_kokkos/compute_diagonal_util.h b/tests/matrix_free_kokkos/compute_diagonal_util.h
index bb2f6ed80924..a76fc837b37b 100644
--- a/tests/matrix_free_kokkos/compute_diagonal_util.h
+++ b/tests/matrix_free_kokkos/compute_diagonal_util.h
@@ -59,15 +59,6 @@ class LaplaceOperatorQuad
     fe_eval->submit_gradient(fe_eval->get_gradient(q_point), q_point);
   }
 
-  DEAL_II_HOST_DEVICE
-  void
-  set_cell(int)
-  {}
-
-  DEAL_II_HOST_DEVICE void
-  set_matrix_free_data(const typename Portable::MatrixFree<dim, Number>::Data &)
-  {}
-
   static const unsigned int n_q_points =
     dealii::Utilities::pow(fe_degree + 1, dim);
 


Reviews:
user: login: Rombur
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-03-19T22:26:03Z
user: login: tjhei
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-03-20T00:23:00Z
user: login: marcfehling
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-03-20T08:54:08Z
user: login: Rombur
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-03-20T12:46:06Z
user: login: masterleinad
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-03-20T17:30:14Z
user: login: masterleinad
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-03-20T17:32:02Z
user: login: Rombur
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-03-20T18:04:00Z
user: login: Rombur
state: APPROVED
author_association: MEMBER
submitted_at: 2025-03-20T18:04:58Z
user: login: kronbichler
state: APPROVED
author_association: MEMBER
submitted_at: 2025-03-20T18:20:35Z
user: login: tjhei
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-03-20T18:27:05Z
user: login: Rombur
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-03-20T18:38:07Z

Review comments:
diff_hunk: @@ -0,0 +1,7 @@
+Changed: The MatrixFreeTools::compute_diagonal() function used with
+Portable::MatrixFree no longer provides the current cell using set_cell() or
+the matrix-free data using set_matrix_free_data(), it can be queried using
+Portable::FEEvaluation::get_current_cell_index() and
+Portable::get_matrix_free_data() respectively.
+<br>
+(Daniel Arndt, Timo Heister, 2025/03/19)
path: doc/news/changes/minor/20250319tjhei
user: login: Rombur
body: I don't think we need a changelog. These functions were added in https://github.com/dealii/dealii/pull/17579 after the latest release.
created_at: 2025-03-19T21:50:31Z
author_association: MEMBER
diff_hunk: @@ -126,6 +126,22 @@ namespace Portable
     DEAL_II_HOST_DEVICE
     FEEvaluation(const data_type *data, SharedData<dim, Number> *shdata);
 
+    /**
+     * Return the index of the current cell.
+     */
+    DEAL_II_HOST_DEVICE
+    int
+    get_current_cell_index();
+
+    /**
+     * Return a pointer to the MatrixFree<dim, Number>::Data object on device
+     * that contains necessary constraint, dof index, and shape function
+     * information for evaluation used in the matrix-free kernels.
+     */
+    DEAL_II_HOST_DEVICE
+    const data_type *
+    get_matrix_free_data();
path: include/deal.II/matrix_free/portable_fe_evaluation.h
user: login: Rombur
body: Why did you introduce these new functions? They don't fit the current interface. If you look at step-64 for instance. The interface of the operator gives you the cell index (`cell`) and the Data object (`gpu_data`).
```
DEAL_II_HOST_DEVICE void LocalHelmholtzOperator<dim, fe_degree>::operator()(
    const unsigned int                                      cell,
    const typename Portable::MatrixFree<dim, double>::Data *gpu_data,
    Portable::SharedData<dim, double>                      *shared_data,
    const double                                           *src,
    double                                                 *dst) const
```
Now, you just ignore these variables and call the new functions at each quadrature points to get them. 

The `QuadOperation` object in `ComputeDiagonalCellAction` should not be a member variable. That's the issue. Instead call `QuadOperation` when you call `apply_for_each_quad_point`.

I am not opposed to changing the interface but we need to make sure that everything fits together.
created_at: 2025-03-19T22:13:28Z
author_association: MEMBER
diff_hunk: @@ -126,6 +126,22 @@ namespace Portable
     DEAL_II_HOST_DEVICE
     FEEvaluation(const data_type *data, SharedData<dim, Number> *shdata);
 
+    /**
+     * Return the index of the current cell.
+     */
+    DEAL_II_HOST_DEVICE
+    int
+    get_current_cell_index();
+
+    /**
+     * Return a pointer to the MatrixFree<dim, Number>::Data object on device
+     * that contains necessary constraint, dof index, and shape function
+     * information for evaluation used in the matrix-free kernels.
+     */
+    DEAL_II_HOST_DEVICE
+    const data_type *
+    get_matrix_free_data();
path: include/deal.II/matrix_free/portable_fe_evaluation.h
user: login: tjhei
body: I understand, but this is somewhat tricky to achieve, because the Quad operator for vmult() is created in the user code while for compute_diagonal() it would be inside deal.II. For that reason we cannot construct the object (we don't know ``coefficient`` for example).

Note that the two new member functions also exist for the nonportable MatrixFree. At least the cell index is very useful and used in ASPECT. So, exposing that doesn't sound like a problem to me. We could think about not passing them to operator(), not sure what you think about that.
created_at: 2025-03-20T00:23:00Z
author_association: MEMBER
diff_hunk: @@ -229,7 +220,7 @@ namespace Step64
     fe_eval.read_dof_values(src);
     fe_eval.evaluate(EvaluationFlags::values | EvaluationFlags::gradients);
     fe_eval.apply_for_each_quad_point(
-      HelmholtzOperatorQuad<dim, fe_degree>(gpu_data, coef, cell));
+      HelmholtzOperatorQuad<dim, fe_degree>(coef));
path: examples/step-64/step-64.cc
user: login: marcfehling
body: The function parameter `cell` is now unused. CI complains about it.
created_at: 2025-03-20T08:54:08Z
author_association: MEMBER
diff_hunk: @@ -126,6 +126,22 @@ namespace Portable
     DEAL_II_HOST_DEVICE
     FEEvaluation(const data_type *data, SharedData<dim, Number> *shdata);
 
+    /**
+     * Return the index of the current cell.
+     */
+    DEAL_II_HOST_DEVICE
+    int
+    get_current_cell_index();
+
+    /**
+     * Return a pointer to the MatrixFree<dim, Number>::Data object on device
+     * that contains necessary constraint, dof index, and shape function
+     * information for evaluation used in the matrix-free kernels.
+     */
+    DEAL_II_HOST_DEVICE
+    const data_type *
+    get_matrix_free_data();
path: include/deal.II/matrix_free/portable_fe_evaluation.h
user: login: Rombur
body: > we don't know coefficient for example

`ComputeDiagonalCellAction` could take a user-defined `AdditionalData` structure where you put in coefficient or anything else you want. When we call the constructor, we pass the structure.

> We could think about not passing them to operator(), not sure what you think about that.

Yes, maybe. We need to think about what we want the user interface to look like.
created_at: 2025-03-20T12:46:06Z
author_association: MEMBER
diff_hunk: @@ -0,0 +1,7 @@
+Changed: The MatrixFreeTools::compute_diagonal() function used with
+Portable::MatrixFree no longer provides the current cell using set_cell() or
+the matrix-free data using set_matrix_free_data(), it can be queried using
+Portable::FEEvaluation::get_current_cell_index() and
+Portable::get_matrix_free_data() respectively.
+<br>
+(Daniel Arndt, Timo Heister, 2025/03/19)
path: doc/news/changes/minor/20250319tjhei
user: login: masterleinad
body: I think we can skip talking abut `set_cell` and `set_matrix_free_data` but should keep the newly added functions.
created_at: 2025-03-20T17:30:14Z
author_association: MEMBER
diff_hunk: @@ -0,0 +1,7 @@
+Changed: The MatrixFreeTools::compute_diagonal() function used with
+Portable::MatrixFree no longer provides the current cell using set_cell() or
+the matrix-free data using set_matrix_free_data(), it can be queried using
+Portable::FEEvaluation::get_current_cell_index() and
+Portable::get_matrix_free_data() respectively.
path: doc/news/changes/minor/20250319tjhei
user: login: masterleinad
body: ```suggestion
New: Portable::FEEvaluation::get_current_cell_index() and
Portable::FEEvaluation::get_matrix_free_data() allow querying 
the current Portable::MatrixFree::Data object and the current cell index respectively.
```
created_at: 2025-03-20T17:32:02Z
author_association: MEMBER
diff_hunk: @@ -126,6 +126,22 @@ namespace Portable
     DEAL_II_HOST_DEVICE
     FEEvaluation(const data_type *data, SharedData<dim, Number> *shdata);
 
+    /**
+     * Return the index of the current cell.
+     */
+    DEAL_II_HOST_DEVICE
+    int
+    get_current_cell_index();
+
+    /**
+     * Return a pointer to the MatrixFree<dim, Number>::Data object on device
+     * that contains necessary constraint, dof index, and shape function
+     * information for evaluation used in the matrix-free kernels.
+     */
+    DEAL_II_HOST_DEVICE
+    const data_type *
+    get_matrix_free_data();
path: include/deal.II/matrix_free/portable_fe_evaluation.h
user: login: Rombur
body: We will rework the current interface
created_at: 2025-03-20T18:04:00Z
author_association: MEMBER
diff_hunk: @@ -270,6 +286,38 @@ namespace Portable
 
 
 
+  template <int dim,
+            int fe_degree,
+            int n_q_points_1d,
+            int n_components_,
+            typename Number>
+  DEAL_II_HOST_DEVICE int
+  FEEvaluation<dim, fe_degree, n_q_points_1d, n_components_, Number>::
+    get_current_cell_index()
path: include/deal.II/matrix_free/portable_fe_evaluation.h
user: login: Rombur
body: We probably want to inline these functions.
created_at: 2025-03-20T18:04:52Z
author_association: MEMBER
diff_hunk: @@ -270,6 +286,38 @@ namespace Portable
 
 
 
+  template <int dim,
+            int fe_degree,
+            int n_q_points_1d,
+            int n_components_,
+            typename Number>
+  DEAL_II_HOST_DEVICE int
+  FEEvaluation<dim, fe_degree, n_q_points_1d, n_components_, Number>::
+    get_current_cell_index()
path: include/deal.II/matrix_free/portable_fe_evaluation.h
user: login: tjhei
body: Can I do that in a follow-up? After the planned restructuring, they have to change anyways.
created_at: 2025-03-20T18:27:05Z
author_association: MEMBER
diff_hunk: @@ -270,6 +286,38 @@ namespace Portable
 
 
 
+  template <int dim,
+            int fe_degree,
+            int n_q_points_1d,
+            int n_components_,
+            typename Number>
+  DEAL_II_HOST_DEVICE int
+  FEEvaluation<dim, fe_degree, n_q_points_1d, n_components_, Number>::
+    get_current_cell_index()
path: include/deal.II/matrix_free/portable_fe_evaluation.h
user: login: Rombur
body: Sure
created_at: 2025-03-20T18:38:07Z
author_association: MEMBER

PR comments:
user: login: masterleinad
created_at: 2025-03-19T21:36:24Z
body: Thisb worked before beacuse the size of the functor changed in https://github.com/dealii/dealii/pull/18124.
author_association: MEMBER
user: login: kronbichler
created_at: 2025-03-20T18:20:48Z
body: I like this change.
author_association: MEMBER