From dfcb968e4b5a200339dbf6d525f7566b1953abed Mon Sep 17 00:00:00 2001 From: Andrej Babic Date: Thu, 8 Apr 2021 13:20:20 +0200 Subject: [PATCH 1/6] Improved jf-live-writer README --- jf-live-writer/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jf-live-writer/README.md b/jf-live-writer/README.md index 27286b8..95e1139 100644 --- a/jf-live-writer/README.md +++ b/jf-live-writer/README.md @@ -13,6 +13,8 @@ docker build -f jf-live-writer/debug.Dockerfile -t jf-live-writer . (Running this command from the project root is mandatory as the entire project folder needs to be part of the build context.) +# Build on your local machine + ## Building In order to build this executable you need to specify the cmake variable ``` @@ -21,7 +23,7 @@ cmake3 -DBUILD_JF_LIVE_WRITER=ON The project will not build if you do not have installed the PHDF5 library. Please follow instructions below on how to do that manually. -## Install PHDF5 manually +## Install PHDF5 ``` wget https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.12/hdf5-1.12.0/src/hdf5-1.12.0.tar.gz tar -xzf hdf5-1.12.0.tar.gz From 246d5e7dde05807a7812f90b86ce21cc0038a2ab Mon Sep 17 00:00:00 2001 From: Andrej Babic Date: Wed, 14 Apr 2021 11:59:56 +0200 Subject: [PATCH 2/6] Add debug output to BufferUtils --- CMakeLists.txt | 4 +++- core-buffer/src/BufferUtils.cpp | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dc317ef..45791a4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,8 +7,10 @@ set (SF_DAQ_BUFFER_VERSION "1.0.0") set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) -# Download and unpack googletest at configure time +set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DMY_DEBUG") +set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG_OUTPUT") +# Download and unpack googletest at configure time configure_file(googletest.in googletest-download/CMakeLists.txt) execute_process( diff --git a/core-buffer/src/BufferUtils.cpp b/core-buffer/src/BufferUtils.cpp index b6b1bb5..5d9dd9f 100644 --- a/core-buffer/src/BufferUtils.cpp +++ b/core-buffer/src/BufferUtils.cpp @@ -7,6 +7,7 @@ #include #include #include +#include using namespace std; using namespace buffer_config; @@ -92,6 +93,10 @@ void* BufferUtils::connect_socket( string ipc_address = BUFFER_LIVE_IPC_URL + detector_name + "-" + stream_name; +#ifdef DEBUG_OUTPUT + cout << "[BufferUtils::connect_socket]"; + cout << " IPC address: " << ipc_address << endl; +#endif void* socket = zmq_socket(ctx, ZMQ_SUB); if (socket == nullptr) { From c1666d92b21dd07f556c8d9f9a13f272d8e8d67b Mon Sep 17 00:00:00 2001 From: Andrej Babic Date: Wed, 14 Apr 2021 12:19:30 +0200 Subject: [PATCH 3/6] Fix number of arguments in live writer input --- jf-live-writer/src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jf-live-writer/src/main.cpp b/jf-live-writer/src/main.cpp index f379356..59dcdc1 100644 --- a/jf-live-writer/src/main.cpp +++ b/jf-live-writer/src/main.cpp @@ -16,7 +16,7 @@ using namespace live_writer_config; int main (int argc, char *argv[]) { - if (argc != 3) { + if (argc != 2) { cout << endl; cout << "Usage: jf_live_writer [detector_json_filename]" << endl; cout << "\tdetector_json_filename: detector config file path." << endl; From 5a46846c01a711bc8f35298fc54de42a71b7cf59 Mon Sep 17 00:00:00 2001 From: Andrej Babic Date: Wed, 14 Apr 2021 12:19:46 +0200 Subject: [PATCH 4/6] Add debug output to writer --- jf-live-writer/src/JFH5Writer.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/jf-live-writer/src/JFH5Writer.cpp b/jf-live-writer/src/JFH5Writer.cpp index 7209d39..08ec2a9 100644 --- a/jf-live-writer/src/JFH5Writer.cpp +++ b/jf-live-writer/src/JFH5Writer.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include "live_writer_config.hpp" @@ -62,11 +63,27 @@ void JFH5Writer::open_run(const int64_t run_id, bits_per_pixel_ = bits_per_pixel; image_n_bytes_ = (image_y_size_ * image_x_size_ * bits_per_pixel_) / 8; +#ifdef DEBUG_OUTPUT + cout << "[JFH5Writer::open_run]"; + cout << " run_id:" << current_run_id_; + cout << " output_file:" << output_file; + cout << " bits_per_pixel:" << bits_per_pixel_; + cout << " image_y_size:" << image_y_size_; + cout << " image_x_size:" << image_x_size_; + cout << " image_n_bytes:" << image_n_bytes_; + cout << endl; +#endif + open_file(output_file, n_images); } void JFH5Writer::close_run() { + +#ifdef DEBUG_OUTPUT + cout << "[JFH5Writer::close_run] run_id:" << current_run_id_ << endl; +#endif + close_file(); current_run_id_ = NO_RUN_ID; From d8d038c476e1c6c55a83518f09cc36d631afcf7c Mon Sep 17 00:00:00 2001 From: Andrej Babic Date: Wed, 14 Apr 2021 15:03:12 +0200 Subject: [PATCH 5/6] Fix name of def in main CMake --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 45791a4..74c7972 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ set (SF_DAQ_BUFFER_VERSION "1.0.0") set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) -set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DMY_DEBUG") +set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG_OUTPUT") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG_OUTPUT") # Download and unpack googletest at configure time From d339d06c6f8f19dfbb86b9b19caf3d00b72b57ea Mon Sep 17 00:00:00 2001 From: Andrej Babic Date: Wed, 14 Apr 2021 17:19:23 +0200 Subject: [PATCH 6/6] Renamed broker agent to writer agent for the writer driver --- jf-live-writer/src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jf-live-writer/src/main.cpp b/jf-live-writer/src/main.cpp index 59dcdc1..6a57521 100644 --- a/jf-live-writer/src/main.cpp +++ b/jf-live-writer/src/main.cpp @@ -38,7 +38,7 @@ int main (int argc, char *argv[]) auto ctx = zmq_ctx_new(); zmq_ctx_set(ctx, ZMQ_IO_THREADS, LIVE_ZMQ_IO_THREADS); auto receiver = BufferUtils::connect_socket( - ctx, config.detector_name, "broker-agent"); + ctx, config.detector_name, "writer-agent"); RamBuffer ram_buffer(config.detector_name, config.n_modules);