From 091948536c7ac0e7b4167decbaa51cedf70dcd83 Mon Sep 17 00:00:00 2001 From: Jan de Cuveland Date: Tue, 3 Aug 2021 14:35:36 +0200 Subject: [PATCH 1/6] Update flesnet reference --- external/ipc/CMakeLists.txt | 7 +++-- .../ipc/TimesliceMultiSubscriber_init.patch | 31 ------------------- 2 files changed, 4 insertions(+), 34 deletions(-) delete mode 100644 external/ipc/TimesliceMultiSubscriber_init.patch diff --git a/external/ipc/CMakeLists.txt b/external/ipc/CMakeLists.txt index 4ba4e516c..e25b3fc13 100644 --- a/external/ipc/CMakeLists.txt +++ b/external/ipc/CMakeLists.txt @@ -5,10 +5,9 @@ download_project_if_needed(PROJECT fles_ipc GIT_REPOSITORY "https://github.com/cbm-fles/flesnet" - GIT_TAG "7329aa41f7a63cca1ddb775d3952ae4307681e0d" + GIT_TAG "5e01c9818b0b8d9268fb118eaae8d920544e2bab" GIT_STASH TRUE SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/ipc - PATCH_COMMAND "patch -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/TimesliceMultiSubscriber_init.patch" TEST_FILE CMakeLists.txt ) @@ -18,6 +17,7 @@ add_library(fles_logging SHARED ipc/lib/logging/log.cpp ipc/lib/logging/log.hpp) target_compile_definitions(fles_logging PUBLIC BOOST_LOG_DYN_LINK PUBLIC BOOST_LOG_USE_NATIVE_SYSLOG + PUBLIC BOOST_ERROR_CODE_HEADER_ONLY ) target_include_directories(fles_logging PUBLIC ipc/lib/logging/) @@ -62,10 +62,11 @@ ipc/lib/fles_ipc/TimesliceSubscriber.cpp ipc/lib/fles_ipc/TimesliceView.cpp ipc/lib/fles_ipc/TimesliceMultiInputArchive.cpp ipc/lib/fles_ipc/TimesliceMultiSubscriber.cpp +ipc/lib/fles_ipc/TimesliceAutoSource.cpp ) -Set_Source_Files_Properties(${SRCS} COMPILE_FLAGS "-std=c++${CMAKE_CXX_STANDARD} -O3 -ggdb -msse4.2 -Wall -Wpedantic -Wextra -Winit-self -Wundef -Wold-style-cast -Woverloaded-virtual -Wwrite-strings -Wnon-virtual-dtor -fno-omit-frame-pointer") +Set_Source_Files_Properties(${SRCS} COMPILE_FLAGS "-std=c++17 -O3 -ggdb -msse4.2 -Wall -Wpedantic -Wextra -Winit-self -Wundef -Wold-style-cast -Woverloaded-virtual -Wwrite-strings -Wnon-virtual-dtor -fno-omit-frame-pointer") Set(LIBRARY_NAME fles_ipc) If(UNIX AND NOT APPLE) diff --git a/external/ipc/TimesliceMultiSubscriber_init.patch b/external/ipc/TimesliceMultiSubscriber_init.patch deleted file mode 100644 index bcc17df7d..000000000 --- a/external/ipc/TimesliceMultiSubscriber_init.patch +++ /dev/null @@ -1,31 +0,0 @@ -diff --git a/lib/fles_ipc/TimesliceMultiSubscriber.cpp b/lib/fles_ipc/TimesliceMultiSubscriber.cpp -index 1668a8c..24952c9 100644 ---- a/lib/fles_ipc/TimesliceMultiSubscriber.cpp -+++ b/lib/fles_ipc/TimesliceMultiSubscriber.cpp -@@ -26,7 +26,7 @@ TimesliceMultiSubscriber::TimesliceMultiSubscriber( - L_(fatal) << "No server defined"; - exit(1); - } -- InitTimesliceSubscriber(); -+// InitTimesliceSubscriber(); - } - - void TimesliceMultiSubscriber::CreateHostPortFileList(std::string inputString) { -diff --git a/lib/fles_ipc/TimesliceMultiSubscriber.hpp b/lib/fles_ipc/TimesliceMultiSubscriber.hpp -index ed8e0d7..539a6e8 100644 ---- a/lib/fles_ipc/TimesliceMultiSubscriber.hpp -+++ b/lib/fles_ipc/TimesliceMultiSubscriber.hpp -@@ -42,10 +42,11 @@ public: - - bool eos() const override { return sortedSource_.empty(); } - -+ void InitTimesliceSubscriber(); -+ - private: - Timeslice* do_get() override; - -- void InitTimesliceSubscriber(); - void CreateHostPortFileList(std::string /*inputString*/); - std::unique_ptr GetNextTimeslice(); - - -- GitLab From bd4d3d7c7a8064b2954aecc9eded92d2c6f0287d Mon Sep 17 00:00:00 2001 From: Jan de Cuveland Date: Tue, 3 Aug 2021 14:36:03 +0200 Subject: [PATCH 2/6] Migrate from TimesliceMulti* classes to TimesliceAutoSource --- reco/steer/CbmSourceTsArchive.cxx | 53 ++----------------------------- reco/steer/CbmSourceTsArchive.h | 8 +---- 2 files changed, 3 insertions(+), 58 deletions(-) diff --git a/reco/steer/CbmSourceTsArchive.cxx b/reco/steer/CbmSourceTsArchive.cxx index 90fa59a0f..0e657fbd8 100644 --- a/reco/steer/CbmSourceTsArchive.cxx +++ b/reco/steer/CbmSourceTsArchive.cxx @@ -7,8 +7,7 @@ #include "CbmSourceTsArchive.h" -#include -#include +#include #include #include @@ -46,56 +45,8 @@ void CbmSourceTsArchive::Close() // ----- Initialisation --------------------------------------------------- Bool_t CbmSourceTsArchive::Init() { + fTsSource = new fles::TimesliceAutoSource(fFileNames); - switch (fCbmSourceType) { - // Use again when kFILE does not skipp the first TS by default anymore - // case Source_Type::kONLINE: { - case eCbmSourceType::kOnline: { - // Create a ";" separated string with all host/port combinations - // Build a semicolon-separated list of file names for TimesliceMultiInputArchive - string fileList; - for (const auto& fileName : fFileNames) { - fileList += fileName; - fileList += ";"; - } - fileList.pop_back(); // Remove last semicolon after last file name - - fTsSource = new fles::TimesliceMultiSubscriber(fileList, fHighWaterMark); - - /// Initialize the Multisubscriber - /// (This restores the original behavior after modifications needed to make the MQ version - dynamic_cast(fTsSource)->InitTimesliceSubscriber(); - - if (!fTsSource) { - LOG(fatal) << "Could not connect to the TS publisher."; - return kFALSE; - } - break; - } - // Se above - // case Source_Type::kFILE: { - case eCbmSourceType::kOffline: { - // Return error for empty file list and an offline run - if (fFileNames.empty()) return kFALSE; - - - // Build a semicolon-separated list of file names for TimesliceMultiInputArchive - string fileList; - for (const auto& fileName : fFileNames) { - fileList += fileName; - fileList += ";"; - } - fileList.pop_back(); // Remove last semicolon after last file name - - // Create the proper TS source - fTsSource = new fles::TimesliceMultiInputArchive(fileList); - if (!fTsSource) { - LOG(error) << "SourceTsArchive: Failed to create TSMultiInputArchive!"; - return kFALSE; - } - break; - } - } // Initialise unpacker fUnpack.Init(); LOG(info) << "Source: Init done"; diff --git a/reco/steer/CbmSourceTsArchive.h b/reco/steer/CbmSourceTsArchive.h index c67cba991..aa8f85347 100644 --- a/reco/steer/CbmSourceTsArchive.h +++ b/reco/steer/CbmSourceTsArchive.h @@ -24,7 +24,7 @@ ** @since 2 June 2021 ** ** This class allows to read time-slice data from file(s) and hands them to - ** the unpacking stage. It interfaces fles::TimesliceMultiInputArchive to cbmroot. + ** the unpacking stage. It interfaces fles::TimesliceAutoSource to cbmroot. **/ class CbmSourceTsArchive : public FairSource { @@ -106,9 +106,6 @@ public: /** @brief Reset clear the output vectors as preparation for the next timeslice. Forwarded to CbmRecoUnpack **/ virtual void Reset() { fUnpack.Reset(); } - /** @brief Set the high water mark (limit of buffered timeslice by the publisher) */ - void SetHighWaterMark(std::uint32_t value) { fHighWaterMark = value; } - /** @brief Set unpacker parameters (forced by base class) **/ virtual void SetParUnpackers() {} @@ -125,9 +122,6 @@ private: /** List of input file names **/ std::vector fFileNames = {}; - /** @brief Amount of Timeslices buffered before the publisher starts dropping new ones, if the old are not digested yet.*/ - std::uint32_t fHighWaterMark = 1; - /** @brief type of source that is currently used @remark currently we use kONLINE as default, since, kFILE skipps the first TS probably due to obsolete reasons (to be checked PR072021) */ Source_Type fSourceType = Source_Type::kONLINE; -- GitLab From c5a1efb54dd34939cb2670bf86047dd454057b74 Mon Sep 17 00:00:00 2001 From: Jan de Cuveland Date: Wed, 4 Aug 2021 00:56:31 +0200 Subject: [PATCH 3/6] Update flesnet reference --- external/ipc/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/ipc/CMakeLists.txt b/external/ipc/CMakeLists.txt index e25b3fc13..00855161e 100644 --- a/external/ipc/CMakeLists.txt +++ b/external/ipc/CMakeLists.txt @@ -5,7 +5,7 @@ download_project_if_needed(PROJECT fles_ipc GIT_REPOSITORY "https://github.com/cbm-fles/flesnet" - GIT_TAG "5e01c9818b0b8d9268fb118eaae8d920544e2bab" + GIT_TAG "406773b9f882d5e7d6fe226b5aab7ed435d51fb4" GIT_STASH TRUE SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/ipc TEST_FILE CMakeLists.txt -- GitLab From 5ba646441d8eef391589d0a629e2770796e8e009 Mon Sep 17 00:00:00 2001 From: Jan de Cuveland Date: Wed, 4 Aug 2021 02:08:57 +0200 Subject: [PATCH 4/6] Downgrade flesnet ipc library language standard to C++14 Flesnet generally uses C++17, but the fles_ipc classes can currently still be compiled as C++14. This is an attempt to keep the cbmroot CI working with GCC 4.9.2. --- external/ipc/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/ipc/CMakeLists.txt b/external/ipc/CMakeLists.txt index 00855161e..86cb88bc7 100644 --- a/external/ipc/CMakeLists.txt +++ b/external/ipc/CMakeLists.txt @@ -66,7 +66,7 @@ ipc/lib/fles_ipc/TimesliceAutoSource.cpp ) -Set_Source_Files_Properties(${SRCS} COMPILE_FLAGS "-std=c++17 -O3 -ggdb -msse4.2 -Wall -Wpedantic -Wextra -Winit-self -Wundef -Wold-style-cast -Woverloaded-virtual -Wwrite-strings -Wnon-virtual-dtor -fno-omit-frame-pointer") +Set_Source_Files_Properties(${SRCS} COMPILE_FLAGS "-std=c++14 -O3 -ggdb -msse4.2 -Wall -Wpedantic -Wextra -Winit-self -Wundef -Wold-style-cast -Woverloaded-virtual -Wwrite-strings -Wnon-virtual-dtor -fno-omit-frame-pointer") Set(LIBRARY_NAME fles_ipc) If(UNIX AND NOT APPLE) -- GitLab From 3a9780999188700bf816124087b8021cc6ed9ff0 Mon Sep 17 00:00:00 2001 From: Jan de Cuveland Date: Wed, 4 Aug 2021 14:21:34 +0200 Subject: [PATCH 5/6] Remove the CbmSourceType enum This change corresponds to Pascal's request at https://git.cbm.gsi.de/computing/cbmroot/-/merge_requests/455#note_13399 --- macro/run/run_unpack_online.C | 1 - macro/run/run_unpack_tsa.C | 1 - reco/steer/CbmSourceTsArchive.h | 21 --------------------- 3 files changed, 23 deletions(-) diff --git a/macro/run/run_unpack_online.C b/macro/run/run_unpack_online.C index f7761d3c0..3eb427bde 100644 --- a/macro/run/run_unpack_online.C +++ b/macro/run/run_unpack_online.C @@ -118,7 +118,6 @@ void run_unpack_online(std::string publisher = "localhost", Int_t serverHttpPort // ----- CbmSourceTsArchive ------------------------------------------- auto source = new CbmSourceTsArchive(publisher.data()); - source->SetCbmSourceType(CbmSourceTsArchive::eCbmSourceType::kOnline); auto unpack = source->GetRecoUnpack(); unpack->SetUnpackConfig(trdconfig); // ------------------------------------------------------------------------ diff --git a/macro/run/run_unpack_tsa.C b/macro/run/run_unpack_tsa.C index a230e2d5a..f44fdbca1 100644 --- a/macro/run/run_unpack_tsa.C +++ b/macro/run/run_unpack_tsa.C @@ -192,7 +192,6 @@ void run_unpack_tsa(std::string infile = "test.tsa", UInt_t runid = 0, const cha // ----- CbmSourceTsArchive ------------------------------------------- auto source = new CbmSourceTsArchive(infile.data()); - source->SetCbmSourceType(CbmSourceTsArchive::eCbmSourceType::kOffline); auto unpack = source->GetRecoUnpack(); unpack->SetDoPerfProfiling(doPerfProfiling); unpack->SetOutputFilename(perfProfFileName); diff --git a/reco/steer/CbmSourceTsArchive.h b/reco/steer/CbmSourceTsArchive.h index aa8f85347..d87dc668e 100644 --- a/reco/steer/CbmSourceTsArchive.h +++ b/reco/steer/CbmSourceTsArchive.h @@ -29,16 +29,6 @@ class CbmSourceTsArchive : public FairSource { public: - /** - * @brief Enum for switch of source type - * @remark This is a temporary fix as long as in the original FairSource::Source_Type kFILE leads to skipping the first Timeslice - */ - enum class eCbmSourceType : uint16_t - { - kOnline = 0, // Use when running with an online source (published data) - kOffline // Use when running with tsa files as source - }; - /** @brief Constructor ** @param fileName Name of (single) input file. ** @@ -74,11 +64,6 @@ public: **/ virtual Source_Type GetSourceType() { return fSourceType; } - /** @brief Get the Cbm Source type - ** @return eCbmSourceType - **/ - eCbmSourceType GetCbmSourceType() { return fCbmSourceType; } - /** * @brief Get the Reco Unpack * Access the CbmRecoUnpack class to add unpacker configs @@ -112,9 +97,6 @@ public: /** @brief Set the Source Type @param type */ void SetSourceType(Source_Type type) { fSourceType = type; } - /** @brief Set the Cbm Source Type @param type @remark temporary fix see enum */ - void SetCbmSourceType(eCbmSourceType type) { fCbmSourceType = type; } - /** @brief Provide dummy implementation of this virtual function as not relevant in our case **/ Bool_t SpecifyRunId() { return kTRUE; } @@ -125,9 +107,6 @@ private: /** @brief type of source that is currently used @remark currently we use kONLINE as default, since, kFILE skipps the first TS probably due to obsolete reasons (to be checked PR072021) */ Source_Type fSourceType = Source_Type::kONLINE; - /** @brief type of source that is currently used in the CBM definition @remark temprorary fix for the issue described in the comments of the enum */ - eCbmSourceType fCbmSourceType = eCbmSourceType::kOffline; - /** Time-slice source interface **/ fles::TimesliceSource* fTsSource = nullptr; //! -- GitLab From 397445f6f612fc48b4f9d6601be931bc53bf978c Mon Sep 17 00:00:00 2001 From: Jan de Cuveland Date: Sun, 15 Aug 2021 11:25:14 +0200 Subject: [PATCH 6/6] Update flesnet reference --- external/ipc/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/ipc/CMakeLists.txt b/external/ipc/CMakeLists.txt index 86cb88bc7..b85c7934a 100644 --- a/external/ipc/CMakeLists.txt +++ b/external/ipc/CMakeLists.txt @@ -5,7 +5,7 @@ download_project_if_needed(PROJECT fles_ipc GIT_REPOSITORY "https://github.com/cbm-fles/flesnet" - GIT_TAG "406773b9f882d5e7d6fe226b5aab7ed435d51fb4" + GIT_TAG "301000b321eb7bc3a47a79b2ceadf2aa844327fe" GIT_STASH TRUE SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/ipc TEST_FILE CMakeLists.txt -- GitLab