In three-dimensional configurations with one homogeneous direction (3DH1D), computing
∂u∕∂z requires a Fourier-space wavenumber multiplication that is independent of the
per-element operators used for the x and y directions. This is factored out into PhysDerivZOp,
which is specialised on the ExecSpace template parameter of PhysDerivOp:
HostSpace Delegates the z-derivative to the existing FFTW-based ExpListHomogeneous1D
pipeline.
DeviceSpace Executes a D2Z transform, a multiply of each Fourier mode by ikzβ (with
β = 2π∕Lz), and an inverse Z2D transform entirely on the GPU. The pipeline runs
per block and in place on the block device memory, so no gather into (or scatter
out of) a contiguous plane-major scratch buffer is needed. Enabled when CMake
is configured with NEKTAR_ENABLE_DEVICE=CUDA.
The device specialisation lives in PhysDerivZOpDevice.hpp and calls the single
entry point PhysDerivZDirect unconditionally. That function is declared in
LibUtilities/FFT/PhysDerivZCuFFT.h, and defined and explicitly instantiated for double
and single precision in PhysDerivZCuFFT.cu; it picks one of two implementations at compile
time:
Drives the three stages with cached cuFFT plans. Any even number of homogeneous planes is supported.
Fuses all three stages into a single kernel, one thread block per xy pencil, avoiding
the overhead of separate cuFFT plan launches. Used when NEKTAR_USE_CUFFTDX
is defined; requires a CUDA toolkit with cuFFTDx support, and the number of
homogeneous planes must be one of 16, 32, 64, 128, 256 or 512. The transform
size and precision are compile-time parameters, and the elements-per-thread count
is whatever cuFFTDx suggests for that pair rather than a value imposed here.
With either implementation, PhysDerivZOpImpl captures the whole z-pipeline as a CUDA
graph on the second call and replays it on subsequent calls. The wait on the per-block
producer streams is deliberately left outside the captured graph, so that a replay still orders
itself against whatever last wrote the input.
NEKTAR_USE_CUFFT_STATIC Link cuFFT statically (default: OFF). Required to enable cuFFT store-callback
support in NekCuFFT.
NEKTAR_USE_CUFFTDX Use the fused cuFFTDx kernel instead of cuFFT for the DeviceSpace z-derivative.
Requires the cuFFTDx header-only library and a compatible GPU architecture.