From 53aef8a643c2a84741bf34466261391a58aab9e6 Mon Sep 17 00:00:00 2001 From: Valentin Seitz Date: Fri, 9 Aug 2024 18:11:46 +0200 Subject: [PATCH 1/2] set initlized actually to true ;) --- src/delegator.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/delegator.cpp b/src/delegator.cpp index 9317f5d..b8a59f5 100644 --- a/src/delegator.cpp +++ b/src/delegator.cpp @@ -186,6 +186,8 @@ void Delegator::Init() { std::cout << "nesMiK Info: Successfully initialized with backend: \"" << backend << "\"" << std::endl; } + + did_initialize_ = true; } // should be thread safe to call? @@ -193,6 +195,14 @@ void Delegator::RegionStart(std::string_view name) { if (!nesmik_on_) { return; } + if (!did_initialize_) { + std::cout << "neSmiK Warning: called region_start(\"" << name + << "\") without calling nesmik_init()" << std::endl; + Init(); + std::cout + << "neSmiK Warning: Forced to init on region_start from MPI-Rank: " + << mpi_helper_->getRankNumber() << std::endl; + } name_stack_.push(std::string(name)); switch (backend_selection_) { case BackendMode::NotProperlyNested: @@ -208,6 +218,13 @@ void Delegator::RegionStop(std::string_view name) { if (!nesmik_on_) { return; } + if (!did_initialize_) { + std::cout << "neSmiK Warning: called region_stop(\"" << name + << "\") without calling nesmik_init()" << std::endl; + Init(); + std::cout << "neSmiK Warning: Forced to init on region_stop from MPI-Rank: " + << mpi_helper_->getRankNumber() << std::endl; + } switch (backend_selection_) { case BackendMode::NotProperlyNested: npn_annotation_strategy_->RegionStop({name}); @@ -229,6 +246,15 @@ void Delegator::RegionStopLast() { if (!nesmik_on_) { return; } + if (!did_initialize_) { + std::cout << "neSmiK Warning: called region_stop_last() without calling " + "nesmik_init()" + << std::endl; + Init(); + std::cout + << "neSmiK Warning: Forced to init on region_stop_last from MPI-Rank: " + << mpi_helper_->getRankNumber() << std::endl; + } const std::string stack_empty = "NESMIK: STACK EMPTPY"; const std::string &last_region_name = name_stack_.empty() ? stack_empty : name_stack_.top(); -- GitLab From ba34a9c3d78568df166b7b15d33799f3bf0117af Mon Sep 17 00:00:00 2001 From: Valentin Seitz Date: Fri, 9 Aug 2024 18:12:19 +0200 Subject: [PATCH 2/2] make sure the derference works, even when empty --- src/backends/wrappers/extrae/paraver_config.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/backends/wrappers/extrae/paraver_config.cpp b/src/backends/wrappers/extrae/paraver_config.cpp index a04799e..0caa3c0 100644 --- a/src/backends/wrappers/extrae/paraver_config.cpp +++ b/src/backends/wrappers/extrae/paraver_config.cpp @@ -93,10 +93,16 @@ void ParaverConfig::addTimeline(ParaverTimelineWindow window_config) { auto replaced_window_y_pos = std::regex_replace( replaced_event_num, std::regex("NESMIK_REPLACE_WINDOW_Y_POSITION"), std::to_string(150)); + extrae_value max_value_in_array{0}; + + auto max_value_in_array_iterator = + std::max_element(window_config.semantic_maximums.begin(), + window_config.semantic_maximums.end()); + + if (max_value_in_array_iterator != window_config.semantic_maximums.end()) { + max_value_in_array = *max_value_in_array_iterator; + } - const extrae_type max_value_in_array = - *std::max_element(window_config.semantic_maximums.begin(), - window_config.semantic_maximums.end()); auto replaced_semantic_max = std::regex_replace( replaced_window_y_pos, std::regex("NESMIK_REPLACE_SEMANTIC_MAX"), std::to_string(max_value_in_array)); -- GitLab