83#if defined(NEKTAR_ENABLE_DEVICE) && defined(DEVICE_COMPILE_ONLY)
101 typename TPhysSizeParameter1D,
102 std::enable_if_t<std::is_same_v<Implementation, SumFac> &&
103 IsPhysSizeParameter1D_v<TPhysSizeParameter1D>,
106inline constexpr unsigned int DivergenceSharedMemorySize(
107 [[maybe_unused]]
const TPhysSizeParameter1D sizeParam1D,
135 typename TPhysSizeParameter2D,
136 std::enable_if_t<std::is_same_v<Implementation, SumFac> &&
137 IsPhysSizeParameter2D_v<TPhysSizeParameter2D>,
140inline constexpr unsigned int DivergenceSharedMemorySize(
141 [[maybe_unused]]
const TPhysSizeParameter2D sizeParam2D,
152 const unsigned int nq0 = sizeParam2D.nq0();
153 const unsigned int nq1 = sizeParam2D.nq1();
180 typename TPhysSizeParameter3D,
181 std::enable_if_t<std::is_same_v<Implementation, SumFac> &&
182 IsPhysSizeParameter3D_v<TPhysSizeParameter3D>,
185inline constexpr unsigned int DivergenceSharedMemorySize(
186 const TPhysSizeParameter3D sizeParam3D,
190 const unsigned int nq0 = sizeParam3D.nq0();
191 const unsigned int nq1 = sizeParam3D.nq1();
192 const unsigned int nq2 = sizeParam3D.nq2();
201 return nq0 + 2u * nq1 + nq2;
211 return nq0 + nq1 + nq2;
241template <LibUtilities::ShapeType SHAPE_TYPE,
bool DEFORMED,
typename TData>
243 const unsigned int ilane,
const unsigned int ncoord,
const unsigned int nq0,
244 const unsigned int nq1,
const size_t inoffset,
const TData *
NEK_RESTRICT D0,
251 const unsigned int ndf = 2 * ncoord;
253 for (
unsigned int j = 0u, cnt_ji = 0u; j < nq1; ++j)
255 for (
unsigned int i = 0u; i < nq0; ++i, ++cnt_ji)
257 const unsigned int index =
warpsize * cnt_ji + ilane;
258 const unsigned int dfindex =
259 DEFORMED ? ndf *
warpsize * cnt_ji + ilane : ilane;
263 for (
unsigned int c = 0u;
c < 2u; ++
c)
265 const TData *inc =
in +
c * inoffset;
271 for (
unsigned int q = 0u;
q < nq0; ++
q)
274 D0[
q * nq0 + i] * inc[
warpsize * (nq0 * j +
q) + ilane];
280 for (
unsigned int q = 0u;
q < nq1; ++
q)
283 D1[
q * nq1 + j] * inc[
warpsize * (nq0 *
q + i) + ilane];
296 d1 * df[(2u *
c + 1u) *
warpsize + dfindex];
328template <LibUtilities::ShapeType SHAPE_TYPE,
bool DEFORMED,
typename TData>
330 const unsigned int ilane,
const unsigned int nq0,
const unsigned int nq1,
331 const unsigned int nq2,
const size_t inoffset,
const TData *
NEK_RESTRICT D0,
341 constexpr unsigned int ndf = 9u;
343 for (
unsigned int k = 0u, cnt_kji = 0u; k < nq2; k++)
345 for (
unsigned int j = 0u; j < nq1; j++)
347 for (
unsigned int i = 0u; i < nq0; i++, cnt_kji++)
349 const unsigned int index =
warpsize * cnt_kji + ilane;
350 const unsigned int dfindex =
351 DEFORMED ? ndf *
warpsize * cnt_kji + ilane : ilane;
355 for (
unsigned int c = 0u;
c < 3u; ++
c)
357 const TData *inc =
in +
c * inoffset;
363 for (
unsigned int q = 0u;
q < nq0; ++
q)
365 d0 += D0[
q * nq0 + i] *
366 inc[
warpsize * (nq0 * nq1 * k + nq0 * j +
q) +
373 for (
unsigned int q = 0u;
q < nq1; ++
q)
375 d1 += D1[
q * nq1 + j] *
376 inc[
warpsize * (nq0 * nq1 * k + nq0 *
q + i) +
383 for (
unsigned int q = 0u;
q < nq2; ++
q)
385 d2 += D2[
q * nq2 + k] *
386 inc[
warpsize * (nq0 * nq1 *
q + nq0 * j + i) +
394 TData tmp0 = f1m[j] * f2[k] * d0;
395 TData tmp1 = f0[i] * tmp0;
396 TData tmp2 = f2[k] * d1;
399 d2 += tmp1 + f1[j] * tmp2;
412 d2 += f0[i] * d0 + f1[j] * d1;
417 d1 * df[(3u *
c + 1u) *
warpsize + dfindex] +
418 d2 * df[(3u *
c + 2u) *
warpsize + dfindex];
470 bool DEFORMED,
typename TPhysSizeParameter1D,
typename TthreadBlock,
472 std::enable_if_t<std::is_same_v<Implementation, SumFac>,
bool>
475 const TPhysSizeParameter1D sizeParam1D,
const size_t nelmt,
477 [[maybe_unused]]
const size_t inoffset,
484 IsPhysSizeParameter1D_v<TPhysSizeParameter1D>,
485 "Template argument must be either of type "
486 "NonTemplatedPhysSizeParameter1D or TemplatedPhysSizeParameter1D.");
488 const unsigned int ncoord = sizeParam1D.ncoord();
489 const unsigned int nq0 = sizeParam1D.nq0();
491 const unsigned int ndf = ncoord;
492 const unsigned int dfsize = DEFORMED ? nq0 : 1u;
502 const TData *dfptr = df + ndf * dfsize *
warpsize * iwarp;
505 PhysDerivDir1DSumFacKernel<false, DEFORMED, 0>(ilane, ncoord, nq0, D0,
506 dfptr, inptr, outptr);
564 bool DEFORMED,
typename TPhysSizeParameter2D,
typename TthreadBlock,
566 std::enable_if_t<std::is_same_v<Implementation, SumFac>,
bool>
569 const TPhysSizeParameter2D sizeParam2D,
const size_t nelmt,
570 [[maybe_unused]]
const unsigned int elmtsPerBlock,
const size_t inoffset,
579 IsPhysSizeParameter2D_v<TPhysSizeParameter2D>,
580 "Template argument must be either of type "
581 "NonTemplatedPhysSizeParameter2D or TemplatedPhysSizeParameter2D.");
585 const unsigned int ncoord = sizeParam2D.ncoord();
586 const unsigned int nq0 = sizeParam2D.nq0();
587 const unsigned int nq1 = sizeParam2D.nq1();
588 const unsigned int nqTot = sizeParam2D.nqTot();
590 const unsigned int ndf = 2 * ncoord;
591 const unsigned int dfsize = DEFORMED ? nqTot : 1u;
595 TData *s_f0 =
nullptr;
596 TData *s_f1 =
nullptr;
619 const TData *dfptr = df + ndf * dfsize *
warpsize * iwarp;
623 Divergence2DSumFacKernel<SHAPE_TYPE, DEFORMED>(
624 ilane, ncoord, nq0, nq1, inoffset, D0, D1, s_f0, s_f1, dfptr, inptr,
681 bool DEFORMED,
typename TPhysSizeParameter3D,
typename TthreadBlock,
683 std::enable_if_t<std::is_same_v<Implementation, SumFac>,
bool>
686 const TPhysSizeParameter3D sizeParam3D,
const size_t nelmt,
687 [[maybe_unused]]
const unsigned int elmtsPerBlock,
const size_t inoffset,
697 IsPhysSizeParameter3D_v<TPhysSizeParameter3D>,
698 "Template argument must be either of type "
699 "NonTemplatedPhysSizeParameter3D or TemplatedPhysSizeParameter3D.");
703 const unsigned int nq0 = sizeParam3D.nq0();
704 const unsigned int nq1 = sizeParam3D.nq1();
705 const unsigned int nq2 = sizeParam3D.nq2();
706 const unsigned int nqTot = sizeParam3D.nqTot();
708 constexpr unsigned int ndf = 9u;
709 const unsigned int dfsize = DEFORMED ? nqTot : 1u;
713 TData *s_f0 =
nullptr;
714 TData *s_f1 =
nullptr;
715 TData *s_f1m =
nullptr;
716 TData *s_f2 =
nullptr;
769 const TData *dfptr = df + ndf * dfsize *
warpsize * iwarp;
772 Divergence3DSumFacKernel<SHAPE_TYPE, DEFORMED>(
773 ilane, nq0, nq1, nq2, inoffset, D0, D1, D2, s_f0, s_f1, s_f1m, s_f2,
774 dfptr, inptr, outptr);
#define NEK_DEVICE_INLINE
#define NEK_DEVICE_KERNEL
Device SumFac kernels of the physical derivative: one element per warp lane.
void div(const TData alpha, LibUtilities::MemoryRegion< TData > &x, LibUtilities::MemoryRegion< TData > &y)
NEK_DEVICE_KERNEL void const TData *NEK_RESTRICT const TData *NEK_RESTRICT const size_t const unsigned int const unsigned int const unsigned int const unsigned int const size_t const TData *NEK_RESTRICT const TData *NEK_RESTRICT const TUseSharedWsp TData *NEK_RESTRICT const TData *NEK_RESTRICT TData *NEK_RESTRICT const bool const bool unsigned char const TthreadBlock & threadBlock
constexpr unsigned int warpsize
static NEK_FORCE_INLINE void DivergenceKernelLauncher(const TPhysSizeParameter1D sizeParam1D, const typename simd_type::scalarType *D0, const simd_type *df_ptr, simd_type *wsp0, const simd_type *in0, simd_type *out)
Differentiate one element group of a 1D block: out = du/dx, with u the single component at in0.
FETCH_SHARED_MEMORY(shmemptr)
NEK_DEVICE_KERNEL void const TData *NEK_RESTRICT const TData *NEK_RESTRICT const size_t const unsigned int const unsigned int const unsigned int const unsigned int const size_t const TData *NEK_RESTRICT const TData *NEK_RESTRICT const TUseSharedWsp useSharedMemoryWsp
NEK_DEVICE_KERNEL void const TData *NEK_RESTRICT const TData *NEK_RESTRICT const size_t const unsigned int const unsigned int const unsigned int const unsigned int const size_t const TData *NEK_RESTRICT const TData *NEK_RESTRICT const TUseSharedWsp TData *NEK_RESTRICT const TData *NEK_RESTRICT in
NEK_DEVICE_KERNEL void const TData *NEK_RESTRICT const TData *NEK_RESTRICT const size_t const unsigned int const unsigned int const unsigned int const unsigned int const size_t const TData *NEK_RESTRICT const TData *NEK_RESTRICT const TUseSharedWsp TData *NEK_RESTRICT const TData *NEK_RESTRICT TData *NEK_RESTRICT const bool const bool unsigned char * shmemptr
NEK_DEVICE_KERNEL void const TData *NEK_RESTRICT const TData *NEK_RESTRICT const size_t const unsigned int elmtsPerBlock
NEK_DEVICE_KERNEL void const TData *NEK_RESTRICT const TData *NEK_RESTRICT const size_t nelmt
NEK_DEVICE_KERNEL void const TData *NEK_RESTRICT const TData *NEK_RESTRICT const size_t const unsigned int const unsigned int const unsigned int const unsigned int const size_t const TData *NEK_RESTRICT const TData *NEK_RESTRICT const TUseSharedWsp TData *NEK_RESTRICT const TData *NEK_RESTRICT TData *NEK_RESTRICT out
std::vector< double > p(NPUPPER)
static constexpr unsigned int warpSize