Nektar++
Loading...
Searching...
No Matches
Namespaces
LinAdvDiffReactionBlockOpDeviceSumFacKernels.hpp File Reference

SumFac device kernels of the linearised advection-diffusion-reaction operator: one element per thread, with the elements of a warp interleaved lane by lane and the stage intermediates held in a global-memory workspace or, when it fits, in shared memory. More...

#include <LibUtilities/Backends/Backends_Device_API.hpp>
#include <LibUtilities/Backends/DeviceProperties.hpp>
#include <LibUtilities/BasicUtils/ShapeType.hpp>
#include <MultiRegions/ElmtOps/Helmholtz/HelmholtzBlockOpDeviceSumFacKernels.hpp>

Go to the source code of this file.

Namespaces

namespace  Nektar
 
namespace  Nektar::MultiRegions
 
namespace  Nektar::MultiRegions::detail
 

Detailed Description

SumFac device kernels of the linearised advection-diffusion-reaction operator: one element per thread, with the elements of a warp interleaved lane by lane and the stage intermediates held in a global-memory workspace or, when it fits, in shared memory.

These are the kernels the Device/SumFac block implementation launches (see LinAdvDiffReactionBlockOpDeviceSumFac.hpp); the SumFacTOP counterparts, where a whole thread block cooperates on one element, are in LinAdvDiffReactionBlockOpDeviceSumFacTOPKernels.hpp. Everything below is guarded by NEKTAR_ENABLE_DEVICE and DEVICE_COMPILE_ONLY, so it exists only in translation units compiled for a device back-end.

One thread evaluates one element. The block storage is reshaped to interleave width warpSize before the launch, so that the elements of a warp are interleaved: element e is handled by lane ilane = e % warpSize of warp iwarp = e / warpSize, and value n of that element sits at offset warpSize * n + ilane within its warp's group. The LinAdvDiffReactionKernelLauncher overloads stride over the elements of the block, slicing the flat workspace, the geometric data and the advection velocity per warp as they go.

A second grid dimension carries the field-component (or homogeneous-mode) index: the launchers read it as c, and the component count as ncomp, from the thread block's second index and range. The in and out arrays and every named workspace region hold every component's data together: each region's size is multiplied by ncomp, and component c's slice within it starts at c times the region's single-component size, with the warp-interleave offset applied inside that slice. The advection velocity is the exception: it is shared by the variables but not by the planes, so the 1D and 2D launchers read it on plane c % nhomo; a 3D field has a single plane.

Each launcher is the corresponding Helmholtz kernel with this family's advection kernel spliced in, and reuses the Helmholtz workspace and shared-memory sizing (HelmholtzWorkSpaceSize, HelmholtzSharedMemorySize) unchanged. Per element it runs

  1. the shape's BwdTrans sum-factorisation kernel, giving \(u\) at the quadrature points in the workspace slice bwd, preceded by the nodal-to-modal conversion (MatVecKernel) for the nodal shapes;
  2. PhysDeriv{1,2,3}DSumFacKernel, which applies the collapsed-coordinate factors and the derivative factors, so the deriv slices hold Cartesian derivatives, one component per coordinate direction;
  3. AddAdvection{1,2,3}DSumFacKernel (below), overwriting bwd with \(\mathbf{V}\cdot\nabla u + \lambda u\);
  4. ApplyMetric{1,2,3}DSumFacKernel of the Helmholtz family, which forms the diffusion flux in the reference directions and applies the quadrature weights and the Jacobian to it and to bwd – called with a unit coefficient, the reaction term having been folded in at the previous step;
  5. SumDerivTensor{1,2,3}DKernel of the PhysDeriv family, adding the contracted flux onto bwd;
  6. the shape's IProductWRTBase sum-factorisation kernel, followed by the transposed nodal conversion for the nodal shapes.

Definition in file LinAdvDiffReactionBlockOpDeviceSumFacKernels.hpp.