katgpucbf.fgpu.compute module

The Compute class specifies the sequence of operations on the GPU.

Allocations of memory for input, intermediate and output are also handled here.

class katgpucbf.fgpu.compute.Compute(template: ComputeTemplate, command_queue: AbstractCommandQueue, samples: int, spectra: int, spectra_per_heap: int, *, seed: int, sequence_first: int, sequence_step: int = 1)[source]

Bases: OperationSequence

The DSP processing pipeline handling F-engine operation.

The actual running of this operation isn’t done through the _run() method or by calling it directly, if you’re familiar with the usual method of composing operations. Fgpu’s compute is streaming rather than batched, i.e. we have to coordinate the receiving of new data and the transmission of processed data along with the actual processing operation.

Currently, no internal checks for consistency of the parameters are performed. The following constraints are assumed, Bad Things(TM) may happen if they aren’t followed:

  • spectra_per_heap <= spectra - i.e. a chunk of data must be enough to send out at least one heap.

  • spectra % spectra_per_heap == 0

  • samples >= output.window (see fgpu.output.Output). An input chunk requires at least enough samples to output a single spectrum.

  • samples % 8 == 0

Parameters:
  • template – Template for the channelisation operation sequence.

  • command_queue – The GPU command queue (typically this will be a CUDA Stream) on which actual processing operations are to be scheduled.

  • samples – Number of samples in each input chunk (per polarisation), including padding samples.

  • spectra – Number of spectra in each output chunk.

  • spectra_per_heap – Number of spectra to send in each output heap.

  • seed – See RandomStateBuilder.

  • sequence_first – See RandomStateBuilder.

  • sequence_step – See RandomStateBuilder.

run_backend(out: DeviceArray, saturated: DeviceArray) None[source]

Run the FFT and postproc on the data which has been PFB-FIRed.

Postproc incorporates fine-delay, requantisation and corner-turning.

Parameters:

out – Destination for the processed data.

run_ddc(samples: DeviceArray, first_sample: int) None[source]

Run the narrowband DDC kernel on the received samples.

Parameters:
  • samples – A device array containing the samples.

  • first_sample – Timestamp (in samples) of the initial sample. This is used to correctly phase the mixer.

run_narrowband_frontend(in_offsets: Sequence[int], out_offset: int, spectra: int) None[source]

Run the PFB-FIR on the received samples, for a narrowband pipeline.

Parameters:
  • in_offsets – Index of first sample in input array to process (one for each pol).

  • out_offset – Index of first sample in output array to write.

  • spectra – How many spectra worth of samples to push through the PFB-FIR.

run_wideband_frontend(samples: DeviceArray, dig_total_power: DeviceArray, in_offsets: Sequence[int], out_offset: int, spectra: int) None[source]

Run the PFB-FIR on the received samples, for a wideband pipeline.

Parameters:
  • samples – A device arrays containing the samples

  • dig_total_power – A device array holding digitiser total power for each pol. This is not zeroed.

  • in_offsets – Index of first sample in input array to process (one for each pol).

  • out_offset – Index of first sample in output array to write.

  • spectra – How many spectra worth of samples to push through the PFB-FIR.

class katgpucbf.fgpu.compute.ComputeTemplate(context: AbstractContext, taps: int, channels: int, dig_sample_bits: int, out_bits: int, dither: DitherType, narrowband: NarrowbandConfig | None)[source]

Bases: object

Template for the channelisation operation sequence.

The reason for doing things this way can be read in the relevant katsdpsigproc docs.

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 output channels into which the input data will be decomposed.

  • dig_sample_bits – Number of bits per digitiser sample.

  • out_bits – Number of bits per output real component.

  • dither – Type of dithering to apply before quantisation.

  • narrowband – Configuration for narrowband operation. If None, wideband is assumed.

instantiate(command_queue: AbstractCommandQueue, samples: int, spectra: int, spectra_per_heap: int, *, seed: int, sequence_first: int, sequence_step: int = 1) Compute[source]

Generate a Compute object based on the template.

class katgpucbf.fgpu.compute.NarrowbandConfig(decimation: int, mix_frequency: Fraction, weights: ndarray, discard: bool)[source]

Bases: object

Configuration for a narrowband stream.

decimation: int

Factor by which bandwidth is reduced

discard: bool

Whether we are to discard the outer 50% of channels

mix_frequency: Fraction

Mixer frequency, in cycles per ADC sample

weights: ndarray

Downconversion filter weights (float)