-
Notifications
You must be signed in to change notification settings - Fork 3
Shared Memory
Last updated: September 13, 2019
SimpleScan has the ability to attach to Poll2's shared-memory (shm) output socket for real-time
analysis of experimental data. We start simpleScan (as described in run the scan),
except we omit the -i flag and replace it with -s as shown below.
simpleScan -s -o data.root -f
The -s flag tells simpleScan that we want to read from the socket instead of from a file. Poll2's shm
output stream must be enabled by typing shm in the Poll2 control terminal, otherwise simpleScan
will attempt to decode Poll2's status update output stream and will throw a lot of errors.
NOTE: Due to limitations with Poll2's socket handler, only one program may attach to its output socket at any given time. The monitor program uses a different socket than the shm and may be used at the same time as shm mode.
Since sockets are handled on the system level, they may behave differently on some systems than on others. There is a known shm issue at higher Poll2 data rates (> ~1 MB/s) where simpleScan starts to get out of position in the current shm buffer because Poll2 is writting events to the socket faster than simpleScan can read and process those events. This results in simpleScan throwing errors related to sanity checks on the input data (e.g. Slot Read Errors and so on).
WARNING: If the output data rate is too high, both Poll2 and simpleScan can lock up due to them competing for access to the same socket. This could result in the acquisition computer freezing and needing to be hard-restarted (obviously bad).
When running in shared-memory mode, the Poll2 polling-threshold should be kept low (< 5%). This reduces the amount of data which Poll2 writes to the socket at any given time and, thus, helps simpleScan keep up.
The polling-threshold should be set back to a more reasonable value (> 10%) when switching to data-recording mode, as low polling-thresholds will result in ldf files which are more "chopped up" and are much less efficient to write and read.
It is also recommended that data-to-disk be disabled when running in shm mode. This is accomplished by using
startacq instead of run in Poll2.