babic_a c12601f756 Add JFH5LiveWriter
In comparison with the normal writer, the block operations
have been dropped and the buffering of metadata is not sparse
anymore. Direct chunk writing used for data and buffering +
dump at end for metadata.
2020-07-20 14:49:43 +02:00
2020-07-20 14:49:43 +02:00
2020-07-17 11:20:50 +02:00
2020-05-11 10:47:11 +02:00
2020-07-17 11:37:29 +02:00
2020-03-24 11:36:29 +01:00

sf_daq_buffer

Overview of current architecture and component interaction.

Overview image

Architecture

Software

Linux configuration

Build

To compile this repo you will need to install the following packages on RH7:

  • devtoolset-9
  • cmake3
  • zeromq-devel
  • hdf5-devel
yum install devtoolset-9
yum install cmake3
yum install zeromq-devel
yum install hdf5-devel

Step by step procedure to build the repo:

scl enable devtoolset-9 bash
git clone https://github.com/paulscherrerinstitute/sf_daq_buffer.git
cd sf_daq_buffer
mkdir build
cd build/
cmake3 ..
make

It is recommended to create symbolic links to the executables you will be using inside your PATH.

Example:

ln -s "$(pwd)""/""sf_buffer" /usr/bin/sf_buffer
ln -s "$(pwd)""/""sf_stream" /usr/bin/sf_stream
ln -s "$(pwd)""/""sf_writer" /usr/bin/sf_writer

Warnings

Zeromq

Zeromq version 4.1.4 (default on RH7) has a LINGER bug. Sometimes, the last message is not sent (the connection gets dropped before the message is in the buffer). Since we use PUSH/PULL to modulate the sf_replay speed, this is a key functionality we are using.

Please install a later version:

cd /etc/yum.repos.d/
wget https://download.opensuse.org/repositories/network:messaging:zeromq:release-stable/RHEL_7/network:messaging:zeromq:release-stable.repo
yum remove zeromq
yum remove openpgm
yum install libsodium-devel
yum install zeromq-devel

Terminology

In order to unify the way we write code and talk about concept the following terminology definitions should be followed:

  • frame (data from a single module)
  • image (data of the assembled image)
  • start_pulse_id and stop_pulse_id (not end_pulse_id) is used to determine the inclusive range (both start and stop pulse_id are included) of pulses.
  • pulse_id_step (how many pulses to skip between images).
  • detector_folder (root folder of the buffer for a specific detector on disk)
  • module_name (name of one module inside the detector_folder)
  • data_folder (folder where we group more buffer files based on pulse_id range)

Data location in buffer

The written by sf_buffer are saved to:

[detector_folder]/[module_name]/[data_folder]/[data_file].bin

  • detector_folder should always be passed as an absolute path.
  • module_name is usually composed like "M00", "M01".
  • data_folder and data_file are automatically calculated based on the current pulse_id, FOLDER_MOD and FILE_MOD attributes.
// FOLDER_MOD = 100000
int data_folder = (pulse_id % FOLDER_MOD) * FOLDER_MOD; 
// FILE_MOD = 1000
int data_file = (pulse_id % FILE_MOD) * FILE_MOD; 

FOLDER_MOD == 100000 means that each data_folder will contain data for 100000 pulses, while FILE_MOD == 1000 means that each file inside the data_folder will contain 1000 pulses. The total number of data_files in each data_folder will therefore be FILE_MOD / FOLDER_MOD = 100.

Data request ranges

Data request ranges are composed of:

  • start_pulse_id (first pulse_id to be included in the file)
  • stop_pulse_id (last pulse_id to be included in the file)
  • pulse_id_step (how many pulses to skip between images.)

pulse_id_step can be used to write data at different frequencies:

  • pulse_id_step == 1 (100Hz, write very pulse_id)
  • pulse_id_step == 2 (50hz, write every second pulse)
  • pulse_id_step == 10 (10Hz, write every 10th pulse)

The next pulse_id to be written is calculated internally as:

auto next_pulse_id = currnet_pulse_id + pulse_id_step;

The loop criteria for writing is:

for (
        auto curr_pulse_id = start_pulse_id; 
        curr_pulse_id <= stop_pulse_id;
        curr_pulse_id += pulse_id_step
) {
    // Write curr_pulse_id to output file.
}

Warning

If your stop_pulse_id cannot be reached by adding step_pulse_id to start_pulse_id (start_pulse_id + (n * pulse_id_step) != stop_pulse_id for any n) it will not be included in the final file.

S
Description
No description provided
Readme 3.2 MiB
Languages
C++ 91.1%
Python 4.9%
CMake 3.2%
Dockerfile 0.4%
Shell 0.4%