|
Nektar++
|
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 |
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
bwd, preceded by the nodal-to-modal conversion (MatVecKernel) for the nodal shapes;deriv slices hold Cartesian derivatives, one component per coordinate direction;bwd with \(\mathbf{V}\cdot\nabla u + \lambda u\);bwd – called with a unit coefficient, the reaction term having been folded in at the previous step;bwd;Definition in file LinAdvDiffReactionBlockOpDeviceSumFacKernels.hpp.