PSS.LMC Tango Device Drivers

Note: tango doc tango example

The LMC schema emerging during the bridging phase will be progressively implemented inside the MVP prototype. It will comprise some emulation of main functions. It is foreseen also a minimal PSS pipeline functionality. We aim to collect the basic interaction modes with Cheetah in order to be able to control it by a simple device driver to be implemented in PI8. Basic information on Cheetah control has been reported in the AT4-362 documentation. The Cheetah pipeline is a single executable which contains either the CPU and the CUDA version of PSS and SPS pipeline. It is a CLI program and can be controlled either by a configuration program and by command line switches. The command line switch overrides the configuration file ones. The proposed design interact with Cheetah by means of command line and, in future, by OS level signals. We will implement the basic Cheetah pipeline (To became the CTRL module as defined in PSS.DDD) inheriting from the Capability d evice of Base classes (and from the subelement Capability when available).

Quickstart

TBD

PssPipeline device - CTRL

The PssPipeline device (CTRL) inherits from base classes Capability device R/W attributes are normally set by the subarray but can be directly accessed for testing purpose.

Parameters

Attribute Name

Attribute Type

Note/Description

scanID

Type: DevULong

RO

scan ID to be inserted in the output products

schedulingBlockID

Type: DevString

RO

Scheduling block unique identifier

frequencyBand

Type: IntEnum Class

RW

subarrayMembership

Type: DevUshort

range [1,16]

RW

ID of the affiliated subarray

Note:

FSP device can be shared among several subarrays, so this attribute can be implemented as an array.

sdpDestinationAddresses

Type: DevString

JSON formatted.

RW

Report the list of all the SDP addresses provided by SDP to receive the output products.

Specifies the Mac, IP, Port for each resource:

sdpLinkStatus

Type: DevBoolean/DevUShort

RO

True/1: the link is active

False/0: the link is down

sdpLinkCapacity

Type: DevFloat

RO

scanProgress

Type: DevUshort

RO

cmdFailureFlag

Type: DevBooelan

RO

Flag to signal a sub-element failure.

Reset by:

ObsReset, Restart, Off

Consider to add a flag for each command.

cmdFailureMessage

Type: DevString

RO

The last command report failure message.

healthFailureMessage

Type: DevString

RO

Provide info about capability health failure.

advancementStatus

Type: DevFloat

RO

See discussion ahead.

Commands

Command Name

Input/output args

Description

Note

On

Input:

None

Output:

(resultCode, resultMsg)

PSS pipeline: enable (?)

Standby

Input:

None

Output:

(resultCode, resultMsg)

Switch GPU off

Off

Input:

None

Output:

(resultCode, resultMsg)

PSS pipeline: disable (?)

ConfigureScan

Input: DevString

JSON formatted with scan configuration

Output:

(resultCode, resultMsg)

validate_configuration

Input:

DevString JSON formatted with scan configuration

Output:

none

Internal method of ConfigureScanCommand to validate the input json.

GoToIdle

Input:

None

Output:

(resultCode, resultMsg)

Synchronous command to transition the capability to IDLE.

Release allocated resources.

PssPipeline transits to IDLE obsState

Scan

Input: Array of strings

Output:

(resultCode, resultMsg)

Long running

Start a Scan

EndScan

Input: Array of strings

Output:

(resultCode, resultMsg)

End a Scan

Signal terminate

Abort

Input:

None

Output:

(resultCode, resultMsg)

End a Scan

Signal abort

ObsReset

Input:

None

Output:

(resultCode, resultMsg)

Reset Pipeline from FAULT to IDLE obsState.

Restart

Input:

None

Output:

(resultCode, resultMsg)

ConfigureLog

Input:

DevUshort

Output:

(resultCode, resultMsg)

Configure log level:

0 = debug

1 = log

2 = warnings

3 = errors

Cheetah command line interface

We start the Cheetah program with a command line of the form

./cheetah/pipeline/cheetah_pipeline –config cheetah.xml -p Dedispersion –log-level log

The different pipelines which can be selected are:

  • Empty

  • Dedispersion

  • RfiDetectionPipeline

  • SinglePulseHandler

For the input stream (the data source) there are the possibility to create synthetic internally generated data or external sources. We chose to use a standard file generated by sigproc fake (ska.dat hardcoded in the standard config file). The output of cheetah is on the standard output and it has a standard syslog format:

  • [log][tid=140474636963584][/home/baffa/src/ska/cheetah/cheetah/../cheetah/pipeline/detail/BeamLauncher.cpp:148][1600767420]Creating Beams….

  • [warn][tid=140474636963584][/home/baffa/src/ska/cheetah/cheetah/../cheetah/tdas/detail/Tdas.cpp:76][1600767420]No Time Domain Accelerated Search algorithm has been specified

  • [log][tid=140474636963584][/home/baffa/src/ska/cheetah/cheetah/../cheetah/pipeline/detail/BeamLauncher.cpp:171][1600767420]Finished creating pipelines

  • [log][tid=140474636963584][/home/baffa/src/ska/cheetah/cheetah/../cheetah/pipeline/detail/BeamLauncher.cpp:223][1600767420]Starting Beam: identifier to distinguish between other similar type blocks

  • [log][tid=140474527926016][/home/baffa/src/ska/cheetah/cheetah/../cheetah/sps/detail/Sps.cpp:110][1600767420]setting dedispersion buffer size to 2048 spectra

  • [log][tid=140474527926016][/home/baffa/src/ska/cheetah/cheetah/../cheetah/sps/detail/Sps.cpp:113][1600767420]setting buffer overlap to 1514 spectra

  • [log][tid=140474527926016][/home/baffa/src/ska/cheetah/cheetah/sigproc/src/SigProcFileStream.cpp:334][1600767424]resizing to 1024

  • [log][tid=140474527926016][/usr/local/include/panda/detail/Pipeline.cpp:63][1600767424]End of stream

Cheetah pipeline is a stand alone CLI program with its main output on stdout. The obvious choice to handle from Python such a program is to use a subprocess.Popen class 1. We give here an example of its use:

with p = subprocess.Popen([“./cheetah/pipeline/cheetah_pipeline”,”–config”,”cheetah.xml”, “-p”, “Dedispersion”, “–log-level”, “log”], stdout=PIPE) as proc:

printf(proc.stdout.read())

This command line approach makes Cheetah program completely deaf while running: it is not foreseen a communication channel from CONTROL to the pipeline. The only possible channel is the use of Posix signals. We list here few useful ones with default behaviour:

  1. SIGKILL 9 Kill signal → Terminate

  2. SIGTERM 15 Termination signal → Terminate

  3. SIGUSR1 30,10,16 User-defined → Terminate

  4. SIGSTOP 17,19,23 Stop process → Terminate

The use of SIGKILL, SIGTERM and SIGSTOP are clear and related to Abort (first and second) and to Stop (last). We have the opportunity to implement a custom channel by the use of SIGUSR1.

Advancement monitor

The CONTROL protocol requires to have the possibility to monitor, even in a coarse way, the pipeline advancement status. We proposed to add to the log channel an advancement message. But eve the simplest approach (the current step over the total number of steps of the required pipeline) is difficult to implement such an advancement approach. A possible workaround can be devise from the consideration that the processing time will be tuned to be slightly less than the [sub-]scan duration. We can take this value and use the ratio (time elapsed) / scan duration as base for a very rough evaluation of the advancement bar.

1

https://docs.python.org/3.8/library/subprocess.html?highlight=popen#subprocess.Popen