version GIT relicensing-7278-g091132d5eb 2026-12-02 03:10:01+00:00
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
portable_evaluation_kernels.h
Go to the documentation of this file.
1// -----------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
4// Copyright (C) 2017 - 2025 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Detailed license information governing the source code and contributions
9// can be found in LICENSE.md and CONTRIBUTING.md at the top level directory.
10//
11// -----------------------------------------------------------------------------
12
13
14#ifndef dealii__evaluation_kernels_h
15#define dealii__evaluation_kernels_h
16
17#include <deal.II/base/config.h>
18
20
24
25#include <Kokkos_Core.hpp>
26
27
29
30
31namespace Portable
32{
33 namespace internal
34 {
42 constexpr bool
43 use_collocation_evaluation(const unsigned int fe_degree,
44 const unsigned int n_q_points_1d)
45 {
46 // TODO: are the conditions suit for GPU parallelization?
47 return (n_q_points_1d > fe_degree) && (n_q_points_1d < 200) &&
48 (n_q_points_1d <= 3 * fe_degree / 2 + 1);
49 }
50
51
52
62 template <int dim, int fe_degree, int n_q_points_1d, typename Number>
64 {
65 using TeamHandle = Kokkos::TeamPolicy<
66 MemorySpace::Default::kokkos_space::execution_space>::member_type;
67 using SharedView = Kokkos::View<Number *,
68 MemorySpace::Default::kokkos_space::
69 execution_space::scratch_memory_space,
70 Kokkos::MemoryTraits<Kokkos::Unmanaged>>;
71
72 DEAL_II_HOST_DEVICE static void
73 evaluate(const unsigned int dof_handler_index,
74 const unsigned int n_components,
75 const EvaluationFlags::EvaluationFlags evaluation_flag,
76 const typename MatrixFree<dim, Number>::Data *data)
77 {
78 if (evaluation_flag == EvaluationFlags::nothing)
79 return;
80
81 // the evaluator does not need temporary storage since no in-place
82 // operation takes place in this function
83 auto scratch_for_eval =
84 Kokkos::subview(data->shared_data[dof_handler_index].scratch_pad,
85 Kokkos::make_pair(0, 0));
87 dim,
88 fe_degree + 1,
89 n_q_points_1d,
90 Number>
91 eval(data->team_member,
92 data->precomputed_data[dof_handler_index].shape_values,
93 data->precomputed_data[dof_handler_index].shape_gradients,
94 data->precomputed_data[dof_handler_index].co_shape_gradients,
95 scratch_for_eval);
96
97 for (unsigned int c = 0; c < n_components; ++c)
98 {
99 auto u =
100 Kokkos::subview(data->shared_data[dof_handler_index].values,
101 Kokkos::ALL,
102 c);
103 auto grad_u =
104 Kokkos::subview(data->shared_data[dof_handler_index].gradients,
105 Kokkos::ALL,
106 Kokkos::ALL,
107 c);
108
109 if constexpr (dim == 1)
110 {
111 auto temp = Kokkos::subview(
112 data->shared_data[dof_handler_index].scratch_pad,
113 Kokkos::make_pair(0, n_q_points_1d));
114
115 if (evaluation_flag & EvaluationFlags::gradients)
116 eval.template gradients<0, true, false, false>(
117 u, Kokkos::subview(grad_u, Kokkos::ALL, 0));
118 if (evaluation_flag & EvaluationFlags::values)
119 {
120 eval.template values<0, true, false, false>(u, temp);
121 populate_view<false>(data->team_member,
122 u,
123 temp,
124 n_q_points_1d);
125 }
126 }
127 else if constexpr (dim == 2)
128 {
129 constexpr int temp_size = (fe_degree + 1) * n_q_points_1d;
130 auto temp = Kokkos::subview(
131 data->shared_data[dof_handler_index].scratch_pad,
132 Kokkos::make_pair(0, temp_size));
133
134 // grad x
135 if (evaluation_flag & EvaluationFlags::gradients)
136 {
137 eval.template gradients<0, true, false, false>(u, temp);
138 eval.template values<1, true, false, false>(
139 temp, Kokkos::subview(grad_u, Kokkos::ALL, 0));
140 }
141
142 // grad y
143 eval.template values<0, true, false, false>(u, temp);
144 if (evaluation_flag & EvaluationFlags::gradients)
145 eval.template gradients<1, true, false, false>(
146 temp, Kokkos::subview(grad_u, Kokkos::ALL, 1));
147
148 // val: can use values applied in x
149 if (evaluation_flag & EvaluationFlags::values)
150 eval.template values<1, true, false, false>(temp, u);
151 }
152 else if constexpr (dim == 3)
153 {
154 constexpr int temp1_size = Utilities::pow(fe_degree + 1, 2) *
155 n_q_points_1d,
156 temp2_size = Utilities::pow(n_q_points_1d, 2) *
157 (fe_degree + 1);
158
159 auto temp1 = Kokkos::subview(
160 data->shared_data[dof_handler_index].scratch_pad,
161 Kokkos::make_pair(0, temp1_size));
162 auto temp2 = Kokkos::subview(
163 data->shared_data[dof_handler_index].scratch_pad,
164 Kokkos::make_pair(temp1_size, temp1_size + temp2_size));
165
166 if (evaluation_flag & EvaluationFlags::gradients)
167 {
168 // grad x
169 eval.template gradients<0, true, false, false>(u, temp1);
170 eval.template values<1, true, false, false>(temp1, temp2);
171 eval.template values<2, true, false, false>(
172 temp2, Kokkos::subview(grad_u, Kokkos::ALL, 0));
173 }
174
175 // grad y
176 eval.template values<0, true, false, false>(u, temp1);
177 if (evaluation_flag & EvaluationFlags::gradients)
178 {
179 eval.template gradients<1, true, false, false>(temp1,
180 temp2);
181 eval.template values<2, true, false, false>(
182 temp2, Kokkos::subview(grad_u, Kokkos::ALL, 1));
183 }
184
185 // grad z: can use the values applied in x direction stored
186 // in temp1
187 eval.template values<1, true, false, false>(temp1, temp2);
188 if (evaluation_flag & EvaluationFlags::gradients)
189 eval.template gradients<2, true, false, false>(
190 temp2, Kokkos::subview(grad_u, Kokkos::ALL, 2));
191
192 // val: can use the values applied in x & y direction stored
193 // in temp2
194 if (evaluation_flag & EvaluationFlags::values)
195 eval.template values<2, true, false, false>(temp2, u);
196 }
197 else
198 Assert(false, ExcMessage("dim must not exceed 3!"));
199 }
200 }
201
202
203
204 DEAL_II_HOST_DEVICE static void
205 integrate(const unsigned int dof_handler_index,
206 const unsigned int n_components,
207 const EvaluationFlags::EvaluationFlags integration_flag,
208 const typename MatrixFree<dim, Number>::Data *data)
209 {
210 if (integration_flag == EvaluationFlags::nothing)
211 return;
212
213 // the evaluator does not need temporary storage since no in-place
214 // operation takes place in this function
215 auto scratch_for_eval =
216 Kokkos::subview(data->shared_data[dof_handler_index].scratch_pad,
217 Kokkos::make_pair(0, 0));
219 dim,
220 fe_degree + 1,
221 n_q_points_1d,
222 Number>
223 eval(data->team_member,
224 data->precomputed_data[dof_handler_index].shape_values,
225 data->precomputed_data[dof_handler_index].shape_gradients,
226 data->precomputed_data[dof_handler_index].co_shape_gradients,
227 scratch_for_eval);
228
229 for (unsigned int c = 0; c < n_components; ++c)
230 {
231 auto u =
232 Kokkos::subview(data->shared_data[dof_handler_index].values,
233 Kokkos::ALL,
234 c);
235 auto grad_u =
236 Kokkos::subview(data->shared_data[dof_handler_index].gradients,
237 Kokkos::ALL,
238 Kokkos::ALL,
239 c);
240
241 if constexpr (dim == 1)
242 {
243 auto temp = Kokkos::subview(
244 data->shared_data[dof_handler_index].scratch_pad,
245 Kokkos::make_pair(0, fe_degree + 1));
246
247 if ((integration_flag & EvaluationFlags::values) &&
248 !(integration_flag & EvaluationFlags::gradients))
249 {
250 eval.template values<0, false, false, false>(u, temp);
251 populate_view<false>(data->team_member,
252 u,
253 temp,
254 fe_degree + 1);
255 }
256 if (integration_flag & EvaluationFlags::gradients)
257 {
258 if (integration_flag & EvaluationFlags::values)
259 {
260 eval.template values<0, false, false, false>(u, temp);
261 eval.template gradients<0, false, true, false>(
262 Kokkos::subview(grad_u, Kokkos::ALL, 0), temp);
263 populate_view<false>(data->team_member,
264 u,
265 temp,
266 fe_degree + 1);
267 }
268 else
269 eval.template gradients<0, false, false, false>(
270 Kokkos::subview(grad_u, Kokkos::ALL, 0), u);
271 }
272 }
273 else if constexpr (dim == 2)
274 {
275 constexpr int temp_size = (fe_degree + 1) * n_q_points_1d;
276 auto temp = Kokkos::subview(
277 data->shared_data[dof_handler_index].scratch_pad,
278 Kokkos::make_pair(0, temp_size));
279
280 if ((integration_flag & EvaluationFlags::values) &&
281 !(integration_flag & EvaluationFlags::gradients))
282 {
283 eval.template values<1, false, false, false>(u, temp);
284 eval.template values<0, false, false, false>(temp, u);
285 }
286 if (integration_flag & EvaluationFlags::gradients)
287 {
288 eval.template gradients<1, false, false, false>(
289 Kokkos::subview(grad_u, Kokkos::ALL, 1), temp);
290 if (integration_flag & EvaluationFlags::values)
291 eval.template values<1, false, true, false>(u, temp);
292 eval.template values<0, false, false, false>(temp, u);
293 eval.template values<1, false, false, false>(
294 Kokkos::subview(grad_u, Kokkos::ALL, 0), temp);
295 eval.template gradients<0, false, true, false>(temp, u);
296 }
297 }
298 else if constexpr (dim == 3)
299 {
300 constexpr int temp1_size = Utilities::pow(n_q_points_1d, 2) *
301 (fe_degree + 1),
302 temp2_size = Utilities::pow(fe_degree + 1, 2) *
303 n_q_points_1d;
304
305 auto temp1 = Kokkos::subview(
306 data->shared_data[dof_handler_index].scratch_pad,
307 Kokkos::make_pair(0, temp1_size));
308 auto temp2 = Kokkos::subview(
309 data->shared_data[dof_handler_index].scratch_pad,
310 Kokkos::make_pair(temp1_size, temp1_size + temp2_size));
311
312 if ((integration_flag & EvaluationFlags::values) &&
313 !(integration_flag & EvaluationFlags::gradients))
314 {
315 eval.template values<2, false, false, false>(u, temp1);
316 eval.template values<1, false, false, false>(temp1, temp2);
317 eval.template values<0, false, false, false>(temp2, u);
318 }
319 if (integration_flag & EvaluationFlags::gradients)
320 {
321 eval.template gradients<2, false, false, false>(
322 Kokkos::subview(grad_u, Kokkos::ALL, 2), temp1);
323 if (integration_flag & EvaluationFlags::values)
324 eval.template values<2, false, true, false>(u, temp1);
325 eval.template values<1, false, false, false>(temp1, temp2);
326 eval.template values<2, false, false, false>(
327 Kokkos::subview(grad_u, Kokkos::ALL, 1), temp1);
328 eval.template gradients<1, false, true, false>(temp1,
329 temp2);
330 eval.template values<0, false, false, false>(temp2, u);
331 eval.template values<2, false, false, false>(
332 Kokkos::subview(grad_u, Kokkos::ALL, 0), temp1);
333 eval.template values<1, false, false, false>(temp1, temp2);
334 eval.template gradients<0, false, true, false>(temp2, u);
335 }
336 }
337 else
338 Assert(false, ExcMessage("dim must not exceed 3!"));
339 }
340 }
341 };
342
343
344
357 template <int dim, int fe_degree, typename Number>
359 {
360 DEAL_II_HOST_DEVICE static void
361 evaluate(const unsigned int dof_handler_index,
362 const unsigned int n_components,
363 const EvaluationFlags::EvaluationFlags evaluation_flag,
364 const typename MatrixFree<dim, Number>::Data *data)
365 {
366 // since the dof values have already been stored in
367 // shared_data->values, there is nothing to do if the gradients are
368 // not required
369 if (!(evaluation_flag & EvaluationFlags::gradients))
370 return;
371
372 constexpr int n_points = Utilities::pow(fe_degree + 1, dim);
373 auto scratch_for_eval =
374 Kokkos::subview(data->shared_data[dof_handler_index].scratch_pad,
375 Kokkos::make_pair(0, n_points));
376
378 dim,
379 fe_degree + 1,
380 fe_degree + 1,
381 Number>
382 eval(data->team_member,
383 data->precomputed_data[dof_handler_index].shape_values,
384 data->precomputed_data[dof_handler_index].shape_gradients,
385 data->precomputed_data[dof_handler_index].co_shape_gradients,
386 scratch_for_eval);
387
388 for (unsigned int c = 0; c < n_components; ++c)
389 {
390 auto u =
391 Kokkos::subview(data->shared_data[dof_handler_index].values,
392 Kokkos::ALL,
393 c);
394 auto grad_u =
395 Kokkos::subview(data->shared_data[dof_handler_index].gradients,
396 Kokkos::ALL,
397 Kokkos::ALL,
398 c);
399
400 eval.template co_gradients<0, true, false, false>(
401 u, Kokkos::subview(grad_u, Kokkos::ALL, 0));
402 if constexpr (dim > 1)
403 eval.template co_gradients<1, true, false, false>(
404 u, Kokkos::subview(grad_u, Kokkos::ALL, 1));
405 if constexpr (dim > 2)
406 eval.template co_gradients<2, true, false, false>(
407 u, Kokkos::subview(grad_u, Kokkos::ALL, 2));
408 }
409 }
410
411
412 DEAL_II_HOST_DEVICE static void
413 integrate(const unsigned int dof_handler_index,
414 const unsigned int n_components,
415 const EvaluationFlags::EvaluationFlags integration_flag,
416 const typename MatrixFree<dim, Number>::Data *data)
417 {
418 // since the quad values have already been stored in
419 // shared_data->values, there is nothing to do if the gradients are
420 // not required
421 if (!(integration_flag & EvaluationFlags::gradients))
422 return;
423
424 constexpr int n_points = Utilities::pow(fe_degree + 1, dim);
425 auto scratch_for_eval =
426 Kokkos::subview(data->shared_data[dof_handler_index].scratch_pad,
427 Kokkos::make_pair(0, n_points));
428
430 dim,
431 fe_degree + 1,
432 fe_degree + 1,
433 Number>
434 eval(data->team_member,
435 data->precomputed_data[dof_handler_index].shape_values,
436 data->precomputed_data[dof_handler_index].shape_gradients,
437 data->precomputed_data[dof_handler_index].co_shape_gradients,
438 scratch_for_eval);
439
440 for (unsigned int c = 0; c < n_components; ++c)
441 {
442 auto u =
443 Kokkos::subview(data->shared_data[dof_handler_index].values,
444 Kokkos::ALL,
445 c);
446 auto grad_u =
447 Kokkos::subview(data->shared_data[dof_handler_index].gradients,
448 Kokkos::ALL,
449 Kokkos::ALL,
450 c);
451
452 if constexpr (dim == 1)
453 {
454 if (integration_flag & EvaluationFlags::values)
455 eval.template co_gradients<0, false, true, false>(
456 Kokkos::subview(grad_u, Kokkos::ALL, 0), u);
457 else
458 eval.template co_gradients<0, false, false, false>(
459 Kokkos::subview(grad_u, Kokkos::ALL, 0), u);
460 }
461 else if constexpr (dim == 2)
462 {
463 if (integration_flag & EvaluationFlags::values)
464 eval.template co_gradients<1, false, true, false>(
465 Kokkos::subview(grad_u, Kokkos::ALL, 1), u);
466 else
467 eval.template co_gradients<1, false, false, false>(
468 Kokkos::subview(grad_u, Kokkos::ALL, 1), u);
469 eval.template co_gradients<0, false, true, false>(
470 Kokkos::subview(grad_u, Kokkos::ALL, 0), u);
471 }
472 else if constexpr (dim == 3)
473 {
474 if (integration_flag & EvaluationFlags::values)
475 eval.template co_gradients<2, false, true, false>(
476 Kokkos::subview(grad_u, Kokkos::ALL, 2), u);
477 else
478 eval.template co_gradients<2, false, false, false>(
479 Kokkos::subview(grad_u, Kokkos::ALL, 2), u);
480 eval.template co_gradients<1, false, true, false>(
481 Kokkos::subview(grad_u, Kokkos::ALL, 1), u);
482 eval.template co_gradients<0, false, true, false>(
483 Kokkos::subview(grad_u, Kokkos::ALL, 0), u);
484 }
485 else
486 Assert(false, ExcMessage("dim must not exceed 3!"));
487 }
488 }
489 };
490
491
492
503 template <int dim, int fe_degree, int n_q_points_1d, typename Number>
505 {
506 DEAL_II_HOST_DEVICE static void
507 evaluate(const unsigned int dof_handler_index,
508 const unsigned int n_components,
509 const EvaluationFlags::EvaluationFlags evaluation_flag,
510 const typename MatrixFree<dim, Number>::Data *data)
511 {
512 constexpr int scratch_size = Utilities::pow(n_q_points_1d, dim);
513 auto scratch_for_eval =
514 Kokkos::subview(data->shared_data[dof_handler_index].scratch_pad,
515 Kokkos::make_pair(0, scratch_size));
516
518 dim,
519 fe_degree + 1,
520 n_q_points_1d,
521 Number>
522 eval(data->team_member,
523 data->precomputed_data[dof_handler_index].shape_values,
524 data->precomputed_data[dof_handler_index].shape_gradients,
525 data->precomputed_data[dof_handler_index].co_shape_gradients,
526 scratch_for_eval);
527
528 for (unsigned int c = 0; c < n_components; ++c)
529 {
530 auto u =
531 Kokkos::subview(data->shared_data[dof_handler_index].values,
532 Kokkos::ALL,
533 c);
534 auto grad_u =
535 Kokkos::subview(data->shared_data[dof_handler_index].gradients,
536 Kokkos::ALL,
537 Kokkos::ALL,
538 c);
539
540 eval.template values<0, true, false, true>(u, u);
541 if constexpr (dim > 1)
542 eval.template values<1, true, false, true>(u, u);
543 if constexpr (dim > 2)
544 eval.template values<2, true, false, true>(u, u);
545
546 if (evaluation_flag & EvaluationFlags::gradients)
547 {
548 eval.template co_gradients<0, true, false, false>(
549 u, Kokkos::subview(grad_u, Kokkos::ALL, 0));
550 if constexpr (dim > 1)
551 eval.template co_gradients<1, true, false, false>(
552 u, Kokkos::subview(grad_u, Kokkos::ALL, 1));
553 if constexpr (dim > 2)
554 eval.template co_gradients<2, true, false, false>(
555 u, Kokkos::subview(grad_u, Kokkos::ALL, 2));
556 }
557 }
558 }
559
560
561 DEAL_II_HOST_DEVICE static void
562 integrate(const unsigned int dof_handler_index,
563 const unsigned int n_components,
564 const EvaluationFlags::EvaluationFlags integration_flag,
565 const typename MatrixFree<dim, Number>::Data *data)
566 {
567 constexpr int scratch_size = Utilities::pow(n_q_points_1d, dim);
568 auto scratch_for_eval =
569 Kokkos::subview(data->shared_data[dof_handler_index].scratch_pad,
570 Kokkos::make_pair(0, scratch_size));
571
573 dim,
574 fe_degree + 1,
575 n_q_points_1d,
576 Number>
577 eval(data->team_member,
578 data->precomputed_data[dof_handler_index].shape_values,
579 data->precomputed_data[dof_handler_index].shape_gradients,
580 data->precomputed_data[dof_handler_index].co_shape_gradients,
581 scratch_for_eval);
582
583 for (unsigned int c = 0; c < n_components; ++c)
584 {
585 auto u =
586 Kokkos::subview(data->shared_data[dof_handler_index].values,
587 Kokkos::ALL,
588 c);
589 auto grad_u =
590 Kokkos::subview(data->shared_data[dof_handler_index].gradients,
591 Kokkos::ALL,
592 Kokkos::ALL,
593 c);
594
595 // apply derivatives in collocation space
596 if (integration_flag & EvaluationFlags::gradients)
597 {
598 if constexpr (dim == 1)
599 {
600 if (integration_flag & EvaluationFlags::values)
601 eval.template co_gradients<0, false, true, false>(
602 Kokkos::subview(grad_u, Kokkos::ALL, 0), u);
603 else
604 eval.template co_gradients<0, false, false, false>(
605 Kokkos::subview(grad_u, Kokkos::ALL, 0), u);
606 }
607 else if constexpr (dim == 2)
608 {
609 if (integration_flag & EvaluationFlags::values)
610 eval.template co_gradients<1, false, true, false>(
611 Kokkos::subview(grad_u, Kokkos::ALL, 1), u);
612 else
613 eval.template co_gradients<1, false, false, false>(
614 Kokkos::subview(grad_u, Kokkos::ALL, 1), u);
615 eval.template co_gradients<0, false, true, false>(
616 Kokkos::subview(grad_u, Kokkos::ALL, 0), u);
617 }
618 else if constexpr (dim == 3)
619 {
620 if (integration_flag & EvaluationFlags::values)
621 eval.template co_gradients<2, false, true, false>(
622 Kokkos::subview(grad_u, Kokkos::ALL, 2), u);
623 else
624 eval.template co_gradients<2, false, false, false>(
625 Kokkos::subview(grad_u, Kokkos::ALL, 2), u);
626 eval.template co_gradients<1, false, true, false>(
627 Kokkos::subview(grad_u, Kokkos::ALL, 1), u);
628 eval.template co_gradients<0, false, true, false>(
629 Kokkos::subview(grad_u, Kokkos::ALL, 0), u);
630 }
631 else
632 Assert(false, ExcMessage("dim must not exceed 3!"));
633 }
634
635 // transform back to the original space
636 if constexpr (dim > 2)
637 eval.template values<2, false, false, true>(u, u);
638 if constexpr (dim > 1)
639 eval.template values<1, false, false, true>(u, u);
640 eval.template values<0, false, false, true>(u, u);
641 }
642 }
643 };
644
645 namespace batched
646 {
647
648
653 template <int dim, typename Number>
655 {
656 using TeamHandle = Kokkos::TeamPolicy<
657 MemorySpace::Default::kokkos_space::execution_space>::member_type;
658
660 Kokkos::View<Number **,
661 MemorySpace::Default::kokkos_space::execution_space::
662 scratch_memory_space,
663 Kokkos::MemoryTraits<Kokkos::Unmanaged>>;
665 Kokkos::View<Number ***,
666 MemorySpace::Default::kokkos_space::execution_space::
667 scratch_memory_space,
668 Kokkos::MemoryTraits<Kokkos::Unmanaged>>;
670 Kokkos::View<Number *,
671 MemorySpace::Default::kokkos_space::execution_space::
672 scratch_memory_space,
673 Kokkos::MemoryTraits<Kokkos::Unmanaged>>;
675 Kokkos::View<Number *,
676 MemorySpace::Default::kokkos_space::execution_space::
677 scratch_memory_space,
678 Kokkos::MemoryTraits<Kokkos::Unmanaged>>;
679
687 void
689 const TeamHandle &team_handle,
690 const unsigned int n_q_points_per_cell,
691 const int batch_size,
692 const typename MatrixFree<dim, Number>::PrecomputedData &gpu_data)
693 {
694 const unsigned int n_points = batch_size * n_q_points_per_cell;
695
696 values = SharedViewValues(team_handle.team_shmem(),
697 n_points,
698 gpu_data.n_components);
699 gradients = SharedViewGradients(team_handle.team_shmem(),
700 n_points,
701 dim,
702 gpu_data.n_components);
704 SharedViewScratchPad(team_handle.team_shmem(),
705 batch_size * gpu_data.scratch_pad_size);
706
707 // For symmetric collocation elements, the shape_values are the
708 // identity and do not need to be stored in shared memory
709 if (gpu_data.element_type >= ::internal::MatrixFreeFunctions::
710 ElementType::tensor_symmetric)
711 {
712 shape_values = SharedViewShapeData(team_handle.team_shmem(),
713 gpu_data.shape_values.size());
714
715 Kokkos::parallel_for(Kokkos::TeamVectorRange(
716 team_handle, gpu_data.shape_values.size()),
717 [&](const int i) {
718 shape_values(i) = gpu_data.shape_values[i];
719 });
720 }
721
722 // For symmetric elements, we need to store the shape gradients in the
723 // collocation space for faster evaluation. For other elements, we
724 // store the shape gradients in the reference space.
725 if (gpu_data.element_type <= ::internal::MatrixFreeFunctions::
726 ElementType::tensor_symmetric)
727 {
729 SharedViewShapeData(team_handle.team_shmem(),
730 gpu_data.co_shape_gradients.size());
731
732 Kokkos::parallel_for(
733 Kokkos::TeamVectorRange(team_handle,
734 gpu_data.co_shape_gradients.size()),
735 [&](const int i) {
736 co_shape_gradients(i) = gpu_data.co_shape_gradients[i];
737 });
738 }
739 else
740 {
742 SharedViewShapeData(team_handle.team_shmem(),
743 gpu_data.shape_gradients.size());
744
745 Kokkos::parallel_for(
746 Kokkos::TeamVectorRange(team_handle,
747 gpu_data.shape_gradients.size()),
748 [&](const int i) {
749 shape_gradients(i) = gpu_data.shape_gradients[i];
750 });
751 }
752 }
753
758 static std::size_t
760 const unsigned int n_q_points_per_cell,
761 const int batch_size,
762 const typename MatrixFree<dim, Number>::PrecomputedData &gpu_data)
763 {
764 using ElementType =
766
767 const unsigned int n_points = batch_size * n_q_points_per_cell;
768
769 std::size_t result =
770 SharedViewValues::shmem_size(n_points, gpu_data.n_components) +
771 SharedViewGradients::shmem_size(n_points,
772 dim,
773 gpu_data.n_components) +
774 SharedViewScratchPad::shmem_size(batch_size *
775 gpu_data.scratch_pad_size);
776
777 if (gpu_data.element_type >= ElementType::tensor_symmetric)
778 result +=
779 SharedViewShapeData::shmem_size(gpu_data.shape_values.size());
780
781 if (gpu_data.element_type <= ElementType::tensor_symmetric)
782 result += SharedViewShapeData::shmem_size(
783 gpu_data.co_shape_gradients.size());
784 else
785 result +=
786 SharedViewShapeData::shmem_size(gpu_data.shape_gradients.size());
787
788 return result;
789 }
790
795
800
805
818 };
819
820
826 template <int dim, typename Number>
828 {
829 using TeamHandle = Kokkos::TeamPolicy<
830 MemorySpace::Default::kokkos_space::execution_space>::member_type;
831
836
840 const unsigned int n_q_points;
841
846 const unsigned int n_dof_handler;
847
853 const Kokkos::pair<int, int> cell_range;
854
859 const Kokkos::Array<typename MatrixFree<dim, Number>::PrecomputedData,
861
867 Kokkos::Array<SharedData<dim, Number>, n_max_dof_handlers> &shared_data;
868
874 {
875 Assert(cell_range.first <= cell_range.second, ExcInternalError());
876 return cell_range.second - cell_range.first;
877 }
878 };
879
890 template <int dim, int fe_degree, int n_q_points_1d, typename Number>
892 {
894 Kokkos::View<Number *,
895 MemorySpace::Default::kokkos_space::execution_space::
896 scratch_memory_space,
897 Kokkos::MemoryTraits<Kokkos::Unmanaged>>;
898
899
900 DEAL_II_HOST_DEVICE static void
901 evaluate(const unsigned int dof_handler_index,
902 const unsigned int n_components,
903 const EvaluationFlags::EvaluationFlags evaluation_flag,
905 {
906 if (evaluation_flag == EvaluationFlags::nothing)
907 return;
908
909 const int batch_size = data->batch_size();
910
911 // the evaluator does not need temporary storage since no in-place
912 // operation takes place in this function
913 auto scratch_for_eval =
914 Kokkos::subview(data->shared_data[dof_handler_index].scratch_pad,
915 Kokkos::make_pair(0, 0));
917 dim,
918 fe_degree + 1,
919 n_q_points_1d,
920 Number>
921 eval(
922 data->team_member,
923 data->shared_data[dof_handler_index].shape_values,
924 data->shared_data[dof_handler_index].shape_gradients,
925 SharedView(), // co_shape_gradients are not needed for evaluation
926 scratch_for_eval,
927 batch_size);
928
929 for (unsigned int c = 0; c < n_components; ++c)
930 {
931 auto u =
932 Kokkos::subview(data->shared_data[dof_handler_index].values,
933 Kokkos::ALL,
934 c);
935 auto grad_u =
936 Kokkos::subview(data->shared_data[dof_handler_index].gradients,
937 Kokkos::ALL,
938 Kokkos::ALL,
939 c);
940
941 if constexpr (dim == 1)
942 {
943 auto temp = Kokkos::subview(
944 data->shared_data[dof_handler_index].scratch_pad,
945 Kokkos::make_pair(0, batch_size * n_q_points_1d));
946
947 if (evaluation_flag & EvaluationFlags::gradients)
948 eval.template derivative<0, true, false, false>(
949 u, Kokkos::subview(grad_u, Kokkos::ALL, 0));
950 if (evaluation_flag & EvaluationFlags::values)
951 {
952 eval.template value<0, true, false, false>(u, temp);
953 populate_view<false>(data->team_member,
954 u,
955 temp,
956 batch_size * n_q_points_1d);
957 }
958 }
959 else if constexpr (dim == 2)
960 {
961 const int temp_size =
962 batch_size * (fe_degree + 1) * n_q_points_1d;
963 auto temp = Kokkos::subview(
964 data->shared_data[dof_handler_index].scratch_pad,
965 Kokkos::make_pair(0, temp_size));
966
967 // grad x
968 if (evaluation_flag & EvaluationFlags::gradients)
969 {
970 eval.template derivative<0, true, false, false>(u, temp);
971 eval.template value<1, true, false, false>(
972 temp, Kokkos::subview(grad_u, Kokkos::ALL, 0));
973 }
974
975 // grad y
976 eval.template value<0, true, false, false>(u, temp);
977 if (evaluation_flag & EvaluationFlags::gradients)
978 eval.template derivative<1, true, false, false>(
979 temp, Kokkos::subview(grad_u, Kokkos::ALL, 1));
980
981 // val: can use values applied in x
982 if (evaluation_flag & EvaluationFlags::values)
983 eval.template value<1, true, false, false>(temp, u);
984 }
985 else if constexpr (dim == 3)
986 {
987 const int temp1_size = batch_size *
988 Utilities::pow(fe_degree + 1, 2) *
989 n_q_points_1d;
990 const int temp2_size = batch_size *
991 Utilities::pow(n_q_points_1d, 2) *
992 (fe_degree + 1);
993
994 auto temp1 = Kokkos::subview(
995 data->shared_data[dof_handler_index].scratch_pad,
996 Kokkos::make_pair(0, temp1_size));
997 auto temp2 = Kokkos::subview(
998 data->shared_data[dof_handler_index].scratch_pad,
999 Kokkos::make_pair(temp1_size, temp1_size + temp2_size));
1000
1001 if (evaluation_flag & EvaluationFlags::gradients)
1002 {
1003 // grad x
1004 eval.template derivative<0, true, false, false>(u, temp1);
1005 eval.template value<1, true, false, false>(temp1, temp2);
1006 eval.template value<2, true, false, false>(
1007 temp2, Kokkos::subview(grad_u, Kokkos::ALL, 0));
1008 }
1009
1010 // grad y
1011 eval.template value<0, true, false, false>(u, temp1);
1012 if (evaluation_flag & EvaluationFlags::gradients)
1013 {
1014 eval.template derivative<1, true, false, false>(temp1,
1015 temp2);
1016 eval.template value<2, true, false, false>(
1017 temp2, Kokkos::subview(grad_u, Kokkos::ALL, 1));
1018 }
1019
1020 // grad z: can use the values applied in x direction stored
1021 // in temp1
1022 eval.template value<1, true, false, false>(temp1, temp2);
1023 if (evaluation_flag & EvaluationFlags::gradients)
1024 eval.template derivative<2, true, false, false>(
1025 temp2, Kokkos::subview(grad_u, Kokkos::ALL, 2));
1026
1027 // val: can use the values applied in x & y direction stored
1028 // in temp2
1029 if (evaluation_flag & EvaluationFlags::values)
1030 eval.template value<2, true, false, false>(temp2, u);
1031 }
1032 else
1033 Assert(false, ExcMessage("dim must not exceed 3!"));
1034 }
1035 }
1036
1037
1038
1039 DEAL_II_HOST_DEVICE static void
1040 integrate(const unsigned int dof_handler_index,
1041 const unsigned int n_components,
1042 const EvaluationFlags::EvaluationFlags integration_flag,
1044 {
1045 if (integration_flag == EvaluationFlags::nothing)
1046 return;
1047
1048 const int batch_size = data->batch_size();
1049
1050 // the evaluator does not need temporary storage since no in-place
1051 // operation takes place in this function
1052 auto scratch_for_eval =
1053 Kokkos::subview(data->shared_data[dof_handler_index].scratch_pad,
1054 Kokkos::make_pair(0, 0));
1056 dim,
1057 fe_degree + 1,
1058 n_q_points_1d,
1059 Number>
1060 eval(
1061 data->team_member,
1062 data->shared_data[dof_handler_index].shape_values,
1063 data->shared_data[dof_handler_index].shape_gradients,
1064 SharedView(), // co_shape_gradients are not needed for evaluation
1065 scratch_for_eval,
1066 batch_size);
1067
1068 for (unsigned int c = 0; c < n_components; ++c)
1069 {
1070 auto u =
1071 Kokkos::subview(data->shared_data[dof_handler_index].values,
1072 Kokkos::ALL,
1073 c);
1074 auto grad_u =
1075 Kokkos::subview(data->shared_data[dof_handler_index].gradients,
1076 Kokkos::ALL,
1077 Kokkos::ALL,
1078 c);
1079
1080 if constexpr (dim == 1)
1081 {
1082 auto temp = Kokkos::subview(
1083 data->shared_data[dof_handler_index].scratch_pad,
1084 Kokkos::make_pair(0, batch_size * (fe_degree + 1)));
1085
1086 if ((integration_flag & EvaluationFlags::values) &&
1087 !(integration_flag & EvaluationFlags::gradients))
1088 {
1089 eval.template value<0, false, false, false>(u, temp);
1090 populate_view<false>(data->team_member,
1091 u,
1092 temp,
1093 batch_size * (fe_degree + 1));
1094 }
1095 if (integration_flag & EvaluationFlags::gradients)
1096 {
1097 if (integration_flag & EvaluationFlags::values)
1098 {
1099 eval.template value<0, false, false, false>(u, temp);
1100 eval.template derivative<0, false, true, false>(
1101 Kokkos::subview(grad_u, Kokkos::ALL, 0), temp);
1102 populate_view<false>(data->team_member,
1103 u,
1104 temp,
1105 batch_size * (fe_degree + 1));
1106 }
1107 else
1108 eval.template derivative<0, false, false, false>(
1109 Kokkos::subview(grad_u, Kokkos::ALL, 0), u);
1110 }
1111 }
1112 else if constexpr (dim == 2)
1113 {
1114 const int temp_size =
1115 batch_size * (fe_degree + 1) * n_q_points_1d;
1116 auto temp = Kokkos::subview(
1117 data->shared_data[dof_handler_index].scratch_pad,
1118 Kokkos::make_pair(0, temp_size));
1119
1120 if ((integration_flag & EvaluationFlags::values) &&
1121 !(integration_flag & EvaluationFlags::gradients))
1122 {
1123 eval.template value<1, false, false, false>(u, temp);
1124 eval.template value<0, false, false, false>(temp, u);
1125 }
1126 if (integration_flag & EvaluationFlags::gradients)
1127 {
1128 eval.template derivative<1, false, false, false>(
1129 Kokkos::subview(grad_u, Kokkos::ALL, 1), temp);
1130 if (integration_flag & EvaluationFlags::values)
1131 eval.template value<1, false, true, false>(u, temp);
1132 eval.template value<0, false, false, false>(temp, u);
1133 eval.template value<1, false, false, false>(
1134 Kokkos::subview(grad_u, Kokkos::ALL, 0), temp);
1135 eval.template derivative<0, false, true, false>(temp, u);
1136 }
1137 }
1138 else if constexpr (dim == 3)
1139 {
1140 const int temp1_size = batch_size *
1141 Utilities::pow(n_q_points_1d, 2) *
1142 (fe_degree + 1);
1143 const int temp2_size = batch_size *
1144 Utilities::pow(fe_degree + 1, 2) *
1145 n_q_points_1d;
1146
1147 auto temp1 = Kokkos::subview(
1148 data->shared_data[dof_handler_index].scratch_pad,
1149 Kokkos::make_pair(0, temp1_size));
1150 auto temp2 = Kokkos::subview(
1151 data->shared_data[dof_handler_index].scratch_pad,
1152 Kokkos::make_pair(temp1_size, temp1_size + temp2_size));
1153
1154 if ((integration_flag & EvaluationFlags::values) &&
1155 !(integration_flag & EvaluationFlags::gradients))
1156 {
1157 eval.template value<2, false, false, false>(u, temp1);
1158 eval.template value<1, false, false, false>(temp1, temp2);
1159 eval.template value<0, false, false, false>(temp2, u);
1160 }
1161 if (integration_flag & EvaluationFlags::gradients)
1162 {
1163 eval.template derivative<2, false, false, false>(
1164 Kokkos::subview(grad_u, Kokkos::ALL, 2), temp1);
1165 if (integration_flag & EvaluationFlags::values)
1166 eval.template value<2, false, true, false>(u, temp1);
1167 eval.template value<1, false, false, false>(temp1, temp2);
1168 eval.template value<2, false, false, false>(
1169 Kokkos::subview(grad_u, Kokkos::ALL, 1), temp1);
1170 eval.template derivative<1, false, true, false>(temp1,
1171 temp2);
1172 eval.template value<0, false, false, false>(temp2, u);
1173 eval.template value<2, false, false, false>(
1174 Kokkos::subview(grad_u, Kokkos::ALL, 0), temp1);
1175 eval.template value<1, false, false, false>(temp1, temp2);
1176 eval.template derivative<0, false, true, false>(temp2, u);
1177 }
1178 }
1179 else
1180 Assert(false, ExcMessage("dim must not exceed 3!"));
1181 }
1182 }
1183 };
1184
1185
1200 template <int dim, int fe_degree, typename Number>
1202 {
1204 Kokkos::View<Number *,
1205 MemorySpace::Default::kokkos_space::execution_space::
1206 scratch_memory_space,
1207 Kokkos::MemoryTraits<Kokkos::Unmanaged>>;
1208
1209 DEAL_II_HOST_DEVICE static void
1210 evaluate(const unsigned int dof_handler_index,
1211 const unsigned int n_components,
1212 const EvaluationFlags::EvaluationFlags evaluation_flag,
1214 {
1215 Assert(dim >= 1 && dim <= 3, ExcMessage("dim must be 1, 2, or 3"));
1216
1217 // since the dof values have already been stored in
1218 // shared_data->values, there is nothing to do if the gradients are
1219 // not required
1220 if (!(evaluation_flag & EvaluationFlags::gradients))
1221 return;
1222
1223 const int batch_size = data->batch_size();
1224
1225 // the evaluator does not need temporary storage since no in-place
1226 // operation takes place in this function
1227 auto scratch_for_eval =
1228 Kokkos::subview(data->shared_data[dof_handler_index].scratch_pad,
1229 Kokkos::make_pair(0, 0));
1230
1232 dim,
1233 fe_degree + 1,
1234 fe_degree + 1,
1235 Number>
1236 eval(data->team_member,
1237 SharedView(), // shape_values are identity
1238 SharedView(), // shape_gradients are not used
1239 data->shared_data[dof_handler_index].co_shape_gradients,
1240 scratch_for_eval,
1241 batch_size);
1242
1243 for (unsigned int c = 0; c < n_components; ++c)
1244 {
1245 auto u =
1246 Kokkos::subview(data->shared_data[dof_handler_index].values,
1247 Kokkos::ALL,
1248 c);
1249 auto grad_u =
1250 Kokkos::subview(data->shared_data[dof_handler_index].gradients,
1251 Kokkos::ALL,
1252 Kokkos::ALL,
1253 c);
1254 // apply derivatives in collocation space fused along all dim
1255 // directions
1256 eval.template co_gradient<false, false>(u, grad_u);
1257 }
1258 }
1259
1260
1261 DEAL_II_HOST_DEVICE static void
1262 integrate(const unsigned int dof_handler_index,
1263 const unsigned int n_components,
1264 const EvaluationFlags::EvaluationFlags integration_flag,
1266 {
1267 Assert(dim >= 1 && dim <= 3, ExcMessage("dim must be 1, 2, or 3"));
1268
1269 // since the quad values have already been stored in
1270 // shared_data->values, there is nothing to do if the gradients are
1271 // not required
1272 if (!(integration_flag & EvaluationFlags::gradients))
1273 return;
1274
1275 const int batch_size = data->batch_size();
1276
1277 // the evaluator does not need temporary storage since no in-place
1278 // operation takes place in this function
1279 auto scratch_for_eval =
1280 Kokkos::subview(data->shared_data[dof_handler_index].scratch_pad,
1281 Kokkos::make_pair(0, 0));
1282
1284 dim,
1285 fe_degree + 1,
1286 fe_degree + 1,
1287 Number>
1288 eval(data->team_member,
1289 SharedView(), // shape_values are identity
1290 SharedView(), // shape_gradients are not used
1291 data->shared_data[dof_handler_index].co_shape_gradients,
1292 scratch_for_eval,
1293 batch_size);
1294
1295 for (unsigned int c = 0; c < n_components; ++c)
1296 {
1297 auto u =
1298 Kokkos::subview(data->shared_data[dof_handler_index].values,
1299 Kokkos::ALL,
1300 c);
1301 auto grad_u =
1302 Kokkos::subview(data->shared_data[dof_handler_index].gradients,
1303 Kokkos::ALL,
1304 Kokkos::ALL,
1305 c);
1306
1307 // apply derivatives in collocation space fused along all dim
1308 // directions
1309 if (integration_flag & EvaluationFlags::values)
1310 eval.template co_gradient<true, true>(grad_u, u);
1311 else
1312 eval.template co_gradient<true, false>(grad_u, u);
1313 }
1314 }
1315 };
1316
1328 template <int dim, int fe_degree, int n_q_points_1d, typename Number>
1330 {
1332 Kokkos::View<Number *,
1333 MemorySpace::Default::kokkos_space::execution_space::
1334 scratch_memory_space,
1335 Kokkos::MemoryTraits<Kokkos::Unmanaged>>;
1336
1337 DEAL_II_HOST_DEVICE static void
1338 evaluate(const unsigned int dof_handler_index,
1339 const unsigned int n_components,
1340 const EvaluationFlags::EvaluationFlags evaluation_flag,
1342 {
1343 const int batch_size = data->batch_size();
1344
1345 // the evaluator does not need temporary storage since no in-place
1346 // operation takes place in this function as each in-place operation
1347 // requires populate_view() copy and extra team_barrier(). We call
1348 // populate_view() manually only when necessary, and this bring around
1349 // 5% performance improvement
1350 auto scratch_for_eval =
1351 Kokkos::subview(data->shared_data[dof_handler_index].scratch_pad,
1352 Kokkos::make_pair(0, 0));
1353
1355 dim,
1356 fe_degree + 1,
1357 n_q_points_1d,
1358 Number>
1359 eval(data->team_member,
1360 data->shared_data[dof_handler_index].shape_values,
1361 SharedView(), // shape_gradients are not used
1362 data->shared_data[dof_handler_index].co_shape_gradients,
1363 scratch_for_eval,
1364 batch_size);
1365
1366 for (unsigned int c = 0; c < n_components; ++c)
1367 {
1368 auto u =
1369 Kokkos::subview(data->shared_data[dof_handler_index].values,
1370 Kokkos::ALL,
1371 c);
1372 auto grad_u =
1373 Kokkos::subview(data->shared_data[dof_handler_index].gradients,
1374 Kokkos::ALL,
1375 Kokkos::ALL,
1376 c);
1377
1378 if constexpr (dim == 1)
1379 {
1380 const auto &temp =
1381 data->shared_data[dof_handler_index].scratch_pad;
1382
1383 eval.template value<0, true, false, false>(u, temp);
1384
1385 populate_view<false>(data->team_member,
1386 u,
1387 temp,
1388 batch_size * data->n_q_points);
1389 }
1390 else if constexpr (dim == 2)
1391 {
1392 const auto &temp =
1393 data->shared_data[dof_handler_index].scratch_pad;
1394
1395 eval.template value<0, true, false, false>(u, temp);
1396 eval.template value<1, true, false, false>(temp, u);
1397 }
1398 else // dim == 3
1399 {
1400 const auto &temp =
1401 data->shared_data[dof_handler_index].scratch_pad;
1402
1403 eval.template value<0, true, false, false>(u, temp);
1404 eval.template value<1, true, false, false>(temp, u);
1405 eval.template value<2, true, false, false>(u, temp);
1406
1407 populate_view<false>(data->team_member,
1408 u,
1409 temp,
1410 batch_size * data->n_q_points);
1411 }
1412
1413 // apply derivatives in collocation space fused along all dim
1414 // directions
1415 if (evaluation_flag & EvaluationFlags::gradients)
1416 eval.template co_gradient<false, false>(u, grad_u);
1417 }
1418 }
1419
1420
1421 DEAL_II_HOST_DEVICE static void
1422 integrate(const unsigned int dof_handler_index,
1423 const unsigned int n_components,
1424 const EvaluationFlags::EvaluationFlags integration_flag,
1426 {
1427 const int batch_size = data->batch_size();
1428
1429 // the evaluator does not need temporary storage since no in-place
1430 // operation takes place in this function as each in-place operation
1431 // requires populate_view() copy and extra team_barrier(). We call
1432 // populate_view() manually only when necessary, and this bring around
1433 // 5% performance improvement in 3D
1434 auto scratch_for_eval =
1435 Kokkos::subview(data->shared_data[dof_handler_index].scratch_pad,
1436 Kokkos::make_pair(0, 0));
1437
1439 dim,
1440 fe_degree + 1,
1441 n_q_points_1d,
1442 Number>
1443 eval(data->team_member,
1444 data->shared_data[dof_handler_index].shape_values,
1445 SharedView(), // shape_gradients are not used
1446 data->shared_data[dof_handler_index].co_shape_gradients,
1447 scratch_for_eval,
1448 batch_size);
1449
1450 for (unsigned int c = 0; c < n_components; ++c)
1451 {
1452 auto u =
1453 Kokkos::subview(data->shared_data[dof_handler_index].values,
1454 Kokkos::ALL,
1455 c);
1456 auto grad_u =
1457 Kokkos::subview(data->shared_data[dof_handler_index].gradients,
1458 Kokkos::ALL,
1459 Kokkos::ALL,
1460 c);
1461
1462 // apply derivatives in collocation space fused along all dim
1463 // directions
1464 if (integration_flag & EvaluationFlags::gradients)
1465 {
1466 if (integration_flag & EvaluationFlags::values)
1467 eval.template co_gradient<true, true>(grad_u, u);
1468 else
1469 eval.template co_gradient<true, false>(grad_u, u);
1470 }
1471
1472 if constexpr (dim == 1)
1473 {
1474 const auto &temp =
1475 data->shared_data[dof_handler_index].scratch_pad;
1476
1477 eval.template value<0, false, false, false>(u, temp);
1478
1479 populate_view<false>(data->team_member,
1480 u,
1481 temp,
1482 batch_size * (fe_degree + 1));
1483 }
1484 else if constexpr (dim == 2)
1485 {
1486 const auto &temp =
1487 data->shared_data[dof_handler_index].scratch_pad;
1488
1489 eval.template value<1, false, false, false>(u, temp);
1490 eval.template value<0, false, false, false>(temp, u);
1491 }
1492 else if constexpr (dim == 3)
1493 {
1494 const auto &temp =
1495 data->shared_data[dof_handler_index].scratch_pad;
1496
1497 eval.template value<2, false, false, false>(u, temp);
1498 eval.template value<1, false, false, false>(temp, u);
1499 eval.template value<0, false, false, false>(u, temp);
1500
1501 populate_view<false>(data->team_member,
1502 u,
1503 temp,
1504 batch_size *
1505 Utilities::pow(fe_degree + 1, dim));
1506 }
1507 else
1508 Assert(false, ExcMessage("dim must not exceed 3!"));
1509 }
1510 }
1511 };
1512
1513 } // namespace batched
1514 } // end of namespace internal
1515} // end of namespace Portable
1516
1517
1519
1520#endif
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:38
#define DEAL_II_HOST_DEVICE
Definition config.h:171
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:39
#define Assert(cond, exc)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcMessage(std::string arg1)
std::vector< index_type > data
Definition mpi.cc:734
EvaluationFlags
The EvaluationFlags enum.
constexpr bool use_collocation_evaluation(const unsigned int fe_degree, const unsigned int n_q_points_1d)
constexpr unsigned int n_max_dof_handlers
constexpr T pow(const T base, const int iexp)
Definition utilities.h:966
Kokkos::View< Number *, MemorySpace::Default::kokkos_space > shape_gradients
Kokkos::View< Number *, MemorySpace::Default::kokkos_space > shape_values
Kokkos::View< Number *, MemorySpace::Default::kokkos_space > co_shape_gradients
::internal::MatrixFreeFunctions::ElementType element_type
static void integrate(const unsigned int dof_handler_index, const unsigned int n_components, const EvaluationFlags::EvaluationFlags integration_flag, const typename MatrixFree< dim, Number >::Data *data)
static void evaluate(const unsigned int dof_handler_index, const unsigned int n_components, const EvaluationFlags::EvaluationFlags evaluation_flag, const typename MatrixFree< dim, Number >::Data *data)
static void evaluate(const unsigned int dof_handler_index, const unsigned int n_components, const EvaluationFlags::EvaluationFlags evaluation_flag, const typename MatrixFree< dim, Number >::Data *data)
static void integrate(const unsigned int dof_handler_index, const unsigned int n_components, const EvaluationFlags::EvaluationFlags integration_flag, const typename MatrixFree< dim, Number >::Data *data)
Kokkos::TeamPolicy< MemorySpace::Default::kokkos_space::execution_space >::member_type TeamHandle
static void evaluate(const unsigned int dof_handler_index, const unsigned int n_components, const EvaluationFlags::EvaluationFlags evaluation_flag, const typename MatrixFree< dim, Number >::Data *data)
static void integrate(const unsigned int dof_handler_index, const unsigned int n_components, const EvaluationFlags::EvaluationFlags integration_flag, const typename MatrixFree< dim, Number >::Data *data)
Kokkos::View< Number *, MemorySpace::Default::kokkos_space::execution_space::scratch_memory_space, Kokkos::MemoryTraits< Kokkos::Unmanaged > > SharedView
Kokkos::Array< SharedData< dim, Number >, n_max_dof_handlers > & shared_data
Kokkos::TeamPolicy< MemorySpace::Default::kokkos_space::execution_space >::member_type TeamHandle
const Kokkos::Array< typename MatrixFree< dim, Number >::PrecomputedData, n_max_dof_handlers > & precomputed_data
static void integrate(const unsigned int dof_handler_index, const unsigned int n_components, const EvaluationFlags::EvaluationFlags integration_flag, const BatchedData< dim, Number > *data)
static void evaluate(const unsigned int dof_handler_index, const unsigned int n_components, const EvaluationFlags::EvaluationFlags evaluation_flag, const BatchedData< dim, Number > *data)
Kokkos::View< Number *, MemorySpace::Default::kokkos_space::execution_space::scratch_memory_space, Kokkos::MemoryTraits< Kokkos::Unmanaged > > SharedView
static void integrate(const unsigned int dof_handler_index, const unsigned int n_components, const EvaluationFlags::EvaluationFlags integration_flag, const BatchedData< dim, Number > *data)
static void evaluate(const unsigned int dof_handler_index, const unsigned int n_components, const EvaluationFlags::EvaluationFlags evaluation_flag, const BatchedData< dim, Number > *data)
Kokkos::View< Number *, MemorySpace::Default::kokkos_space::execution_space::scratch_memory_space, Kokkos::MemoryTraits< Kokkos::Unmanaged > > SharedView
static void evaluate(const unsigned int dof_handler_index, const unsigned int n_components, const EvaluationFlags::EvaluationFlags evaluation_flag, const BatchedData< dim, Number > *data)
static void integrate(const unsigned int dof_handler_index, const unsigned int n_components, const EvaluationFlags::EvaluationFlags integration_flag, const BatchedData< dim, Number > *data)
Kokkos::View< Number *, MemorySpace::Default::kokkos_space::execution_space::scratch_memory_space, Kokkos::MemoryTraits< Kokkos::Unmanaged > > SharedView
void reinit(const TeamHandle &team_handle, const unsigned int n_q_points_per_cell, const int batch_size, const typename MatrixFree< dim, Number >::PrecomputedData &gpu_data)
Kokkos::View< Number ***, MemorySpace::Default::kokkos_space::execution_space::scratch_memory_space, Kokkos::MemoryTraits< Kokkos::Unmanaged > > SharedViewGradients
Kokkos::View< Number *, MemorySpace::Default::kokkos_space::execution_space::scratch_memory_space, Kokkos::MemoryTraits< Kokkos::Unmanaged > > SharedViewShapeData
Kokkos::View< Number *, MemorySpace::Default::kokkos_space::execution_space::scratch_memory_space, Kokkos::MemoryTraits< Kokkos::Unmanaged > > SharedViewScratchPad
Kokkos::View< Number **, MemorySpace::Default::kokkos_space::execution_space::scratch_memory_space, Kokkos::MemoryTraits< Kokkos::Unmanaged > > SharedViewValues
static std::size_t shmem_size(const unsigned int n_q_points_per_cell, const int batch_size, const typename MatrixFree< dim, Number >::PrecomputedData &gpu_data)
Kokkos::TeamPolicy< MemorySpace::Default::kokkos_space::execution_space >::member_type TeamHandle