Merge remote-tracking branch 'origin/binary_buffer' into binary_buffer

This commit is contained in:
2020-06-02 12:18:13 +02:00
5 changed files with 40 additions and 38 deletions
+1 -5
View File
@@ -21,11 +21,7 @@ coreAssociatedBuffer=(4 4 4 4 5 5 5 5 6 6 6 6 7 7 7 7 8 8 8 8 9 9 9 9 10 10 10 1
#coreAssociatedBuffer=(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32)
initialUDPport=50100
# strange that it doesn't work to add 08 or 09 (value too great for base (error token is "09"))
port=$((${initialUDPport}+10#${M}))
#port=`expr ${initialUDPport} + ${M}`
DETECTOR=JF07T32V01
echo ${port}
#taskset -c ${coreAssociatedBuffer[10#${M}]} /usr/bin/sf_buffer M${M} ${port} /gpfs/photonics/swissfel/buffer/${DETECTOR} > /gpfs/photonics/swissfel/buffer/${port}.log
taskset -c ${coreAssociatedBuffer[10#${M}]} /usr/bin/sf_buffer M${M} ${port} /gpfs/photonics/swissfel/buffer/${DETECTOR} ${M}
taskset -c ${coreAssociatedBuffer[10#${M}]} /usr/bin/sf_buffer ${DETECTOR} M${M} ${port} /gpfs/photonics/swissfel/buffer/${DETECTOR} ${M}
+1 -1
View File
@@ -2,4 +2,4 @@
coreAssociated="20,21,22,23"
taskset -c ${coreAssociated} /usr/bin/sf_stream tcp://129.129.241.42:9007 25 tcp://192.168.30.29:9107 10
taskset -c ${coreAssociated} /usr/bin/sf_stream /gpfs/photonics/swissfel/buffer/config/stream-JF07.json
+1 -1
View File
@@ -17,4 +17,4 @@ target_link_libraries(sf-buffer
hdf5_cpp)
enable_testing()
add_subdirectory(test/)
add_subdirectory(test/)
+10 -7
View File
@@ -17,11 +17,12 @@ using namespace std;
using namespace core_buffer;
int main (int argc, char *argv[]) {
if (argc != 5) {
if (argc != 6) {
cout << endl;
cout << "Usage: sf_buffer [device_name] [udp_port] [root_folder]";
cout << "Usage: sf_buffer [detector_name] [device_name] [udp_port] [root_folder]";
cout << "[source_id]";
cout << endl;
cout << "\tdetector_name: Detector name, example JF07T32V01" << endl;
cout << "\tdevice_name: Name to write to disk.";
cout << "\tudp_port: UDP port to connect to." << endl;
cout << "\troot_folder: FS root folder." << endl;
@@ -31,13 +32,15 @@ int main (int argc, char *argv[]) {
exit(-1);
}
string device_name = string(argv[1]);
int udp_port = atoi(argv[2]);
string root_folder = string(argv[3]);
int source_id = atoi(argv[4]);
string detector_name = string(argv[1]);
string device_name = string(argv[2]);
int udp_port = atoi(argv[3]);
string root_folder = string(argv[4]);
int source_id = atoi(argv[5]);
stringstream ipc_stream;
ipc_stream << BUFFER_LIVE_IPC_URL << source_id;
string LIVE_IPC_URL = BUFFER_LIVE_IPC_URL + detector_name + "-";
ipc_stream << LIVE_IPC_URL << source_id;
const auto ipc_address = ipc_stream.str();
auto ctx = zmq_ctx_new();
+27 -24
View File
@@ -13,42 +13,42 @@
#include "rapidjson/document.h"
#include "rapidjson/stringbuffer.h"
#include "rapidjson/writer.h"
#include <rapidjson/istreamwrapper.h>
#include <fstream>
using namespace std;
using namespace core_buffer;
// TODO: this needs to be re-read from external source
const string PEDE_FILENAME =
"/sf/bernina/data/p17534/res/JF_pedestals/pedestal_20200529_1408.JF07T32V01.res.h5";
const string GAIN_FILENAME =
"/sf/bernina/config/jungfrau/gainMaps/JF07T32V01/gains.h5";
int main (int argc, char *argv[])
{
if (argc != 5) {
if (argc != 2) {
cout << endl;
cout << "Usage: sf_stream ";
cout << " [streamvis_address] [reduction_factor_streamvis]";
cout << " [live_analysis_address] [reduction_factor_live_analysis]";
cout << " [config_json_file]";
cout << endl;
cout << "\tstreamvis_address: address to streamvis, example tcp://129.129.241.42:9007" << endl;
cout << "\treduction_factor_streamvis: 1 out of N (example 10) images to send to streamvis. For remaining send metadata." << endl;
cout << "\tlive_analysis_address: address to live_analysis, example tcp://129.129.241.42:9107" << endl;
cout << "\treduction_factor_live_analysis: 1 out of N (example 10) images to send to live analysis. For remaining send metadata. N<=1 - send every image" << endl;
cout << "\tconfig_json_file: json file with the configuration parameters(detector name, number of modules, pedestal and gain files" << endl;
cout << endl;
exit(-1);
}
string streamvis_address = string(argv[1]);
int reduction_factor_streamvis = (int) atoll(argv[2]);
string live_analysis_address = string(argv[3]);
int reduction_factor_live_analysis = (uint64_t) atoll(argv[4]);
string config_json_file = string(argv[1]);
ifstream ifs(config_json_file);
rapidjson::IStreamWrapper isw(ifs);
rapidjson::Document config_parameters;
config_parameters.ParseStream(isw);
string streamvis_address = config_parameters["streamvis_stream"].GetString();
int reduction_factor_streamvis = config_parameters["streamvis_rate"].GetInt();
string live_analysis_address = config_parameters["live_stream"].GetString();
int reduction_factor_live_analysis = config_parameters["live_rate"].GetInt();
const string PEDE_FILENAME = config_parameters["pedestal_file"].GetString();
const string GAIN_FILENAME = config_parameters["gain_file"].GetString();
const string DETECTOR_NAME = config_parameters["detector_name"].GetString();
size_t n_modules = config_parameters["n_modules"].GetInt();
size_t n_modules = 32;
FastQueue<ModuleFrameBuffer> queue(
n_modules * MODULE_N_BYTES,
STREAM_FASTQUEUE_SLOTS);
@@ -56,7 +56,9 @@ int main (int argc, char *argv[])
auto ctx = zmq_ctx_new();
zmq_ctx_set (ctx, ZMQ_IO_THREADS, STREAM_ZMQ_IO_THREADS);
LiveRecvModule recv_module(queue, n_modules, ctx, BUFFER_LIVE_IPC_URL);
const string LIVE_IPC_URL = BUFFER_LIVE_IPC_URL+DETECTOR_NAME+"-";
LiveRecvModule recv_module(queue, n_modules, ctx, LIVE_IPC_URL);
// 0mq sockets to streamvis and live analysis
void *socket_streamvis = zmq_socket(ctx, ZMQ_PUB);
@@ -147,8 +149,9 @@ int main (int argc, char *argv[])
header_alloc);
header.AddMember("run_name", run_name, header_alloc);
// TODO: Detector name should come as parameter to sf_stream
header.AddMember("number_frames_expected", "JF07T32V01", header_alloc);
rapidjson::Value detector_name;
detector_name.SetString(DETECTOR_NAME.c_str(), header_alloc);
header.AddMember("detector_name", detector_name, header_alloc);
header.AddMember("htype", "array-1.0", header_alloc);
header.AddMember("type", "uint16", header_alloc);