katgpucbf.fgpu.postproc module
Postproc module.
These classes handle the operation of the GPU in performing the fine-delay, per-channel gains, requantisation and corner-turn through a mako-templated kernel.
- class katgpucbf.fgpu.postproc.Postproc(template: PostprocTemplate, command_queue: AbstractCommandQueue, spectra: int, spectra_per_heap: int, *, seed: int, sequence_first: int, sequence_step: int = 1)[source]
Bases:
OperationThe fine-delay, requant and corner-turn operations coming after the PFB.
Slots
- inN_POLS × spectra × unzip_factor × channels // unzip_factor, complex64
Input channelised data for the two polarisations. These are formed by taking the complex-to-complex Fourier transform of the input reinterpreted as a complex input. See FFT for details.
- outspectra // spectra_per_heap × out_channels × spectra_per_heap × N_POLS
Output F-engine data, quantised and corner-turned, ready for transmission on the network. See
gaussian_dtype()for the type.- saturatedspectra // spectra_per_heap × N_POLS, uint32
Number of saturated complex values in out.
- fine_delayspectra × N_POLS, float32
Fine delay in samples (one value per pol).
- phasespectra × N_POLS, float32
Fixed phase adjustment in radians (one value per pol).
- gainsout_channels × N_POLS, complex64
Per-channel gain (one value per pol).
- rand_statesimplementation-defined
Random states. This slot is set up by the constructor and should normally not need to be touched. It is only present if dithering is enabled.
- Parameters:
template (PostprocTemplate) – The template for the post-processing operation.
command_queue (AbstractCommandQueue) – The GPU command queue (typically this will be a CUDA Stream) on which actual processing operations are to be scheduled.
spectra (int) – Number of spectra on which post-prodessing will be performed.
spectra_per_heap (int) – Number of spectra to send out per heap.
seed – See
RandomStateBuilder. These are ignored if the template disables dithering.sequence_first – See
RandomStateBuilder. These are ignored if the template disables dithering.sequence_step – See
RandomStateBuilder. These are ignored if the template disables dithering.
- class katgpucbf.fgpu.postproc.PostprocTemplate(context: AbstractContext, channels: int, unzip_factor: int = 1, *, complex_pfb: bool, out_bits: int, dither: DitherType, out_channels: tuple[int, int] | None = None)[source]
Bases:
objectTemplate for the postproc operation.
- Parameters:
context – The GPU context that we’ll operate in.
channels – Number of input channels in each spectrum.
unzip_factor – Radix of the final Cooley-Tukey FFT step performed by the kernel.
complex_pfb – If true, the PFB is a complex-to-complex transform, and no real-to-complex fixup is needed. Additionally, the DC channel is considered to be the centre of the band i.e. it is written to the middle of the output rather than the start (and similarly, gains for it are loaded from the middle of the gain array etc).
out_bits – Bits per real/imaginary value. Only 4 or 8 are currently supported. When 4, the real part is in the most-significant bits.
dither – Type of dithering to apply before quantisation.
out_channels – Range of channels to write to the output (defaults to all).