katgpucbf.fgpu.pfb module

PFB module.

These classes handle the operation of the GPU in performing the PFB-FIR part through a mako-templated kernel.

class katgpucbf.fgpu.pfb.PFBFIR(template: PFBFIRTemplate, command_queue: AbstractCommandQueue, samples: int, spectra: int)[source]

Bases: Operation

The windowing FIR filters that form the first part of the PFB.

The best place to look in order to understand how these work from a strictly DSP sense is Danny C. Price’s paper [Pri].

In general the operation can read some interval of the input slot and write to some interval of the output slot. The sizes of these slots need not be related. This can be useful to build up a larger output from smaller invocations that have different coarse delays.

[Pri]

Danny C. Price. Spectrometers and polyphase filterbanks in radio astronomy. arXiv:1607.03579.

Slots

The slots depend on template.complex_input. If it is false, then they are

inpols × (samples * input_sample_bits // BYTE_BITS), uint8

Input samples in a big chunk.

outpols × spectra × 2*channels, float32

FIR-filtered time data, ready to be processed by the FFT.

weights2*channels*taps, float32

The time-domain transfer function of the FIR filter to be applied.

total_powerpols, uint64

Sum of squares of input samples. This will not include every input sample. Rather, it will contain a specific tap from each PFB window (currently, the last tap, but that is an implementation detail).

This is incremented rather than overwritten. It is the caller’s responsibility to zero it when desired, or alternatively to track values before and after to measure the change.

Otherwise, they are

insamples, complex64

Input samples

outspectra × channels, complex64

See above

weightschannels*taps, float32

See above

Raises:
  • ValueError – If samples is not a multiple of 8 and complex_input is false

  • ValueError – If samples is too large (more than 2**29)

Parameters:
  • template – Template for the PFB-FIR operation.

  • command_queue – The GPU command queue (typically this will be an instance of katsdpsigproc.cuda.CommandQueue which wraps a CUDA Stream) on which actual processing operations are to be scheduled.

  • samples – Number of input samples that will be processed each time the operation is run.

  • spectra – Number of spectra that we will get from each chunk of samples.

class katgpucbf.fgpu.pfb.PFBFIRTemplate(context: AbstractContext, taps: int, channels: int, input_sample_bits: int, unzip_factor: int = 1, *, complex_input: bool = False, n_pols: int)[source]

Bases: object

Template for the PFB-FIR operation.

The operation can operate in two different modes. In the first mode (intended for a wideband channeliser), the input contains real digitiser samples (bit-packed integers). In the second mode (intended for a narrowband channeliser), the digitiser samples have already been preprocessed and the PFB operates on complex-valued inputs (floating point). The mode is selected with the complex_input parameter.

Parameters:
  • context – The GPU context that we’ll operate in.

  • taps – The number of taps that you want the resulting PFB-FIRs to have.

  • channels – Number of channels into which the input data will be decomposed.

  • input_sample_bits – Bits per each component of input. If complex_input is true, the input values are floating-point complex numbers and this must equal 32. Otherwise, the inputs are packed integers, and the value must be in DIG_SAMPLE_BITS_VALID.

  • unzip_factor – The output is reordered so that every unzip_factor’ith pair of outputs (or single complex output, if complex_input is true) is placed contiguously.

  • complex_input – Operation mode (see above).

  • n_pols – Number of polarisations to operate over. The polarisations are stored contiguously in memory, but have independent offsets.

Raises:
  • ValueError – If taps is not positive.

  • ValueError – If complex_input is true and input_sample_bits is not 32.

  • ValueError – If complex_input is false and input_sample_bits is not in DIG_SAMPLE_BITS_VALID.

  • ValueError – If channels is not an even power of 2.

  • ValueError – If channels is not a multiple of unzip_factor.

  • ValueError – If 2*channels is not a multiple of the workgroup size (currently 128).

instantiate(command_queue: AbstractCommandQueue, samples: int, spectra: int) PFBFIR[source]

Generate a PFBFIR object based on the template.