diff --git a/src/backends/wrappers/extrae/paraver_config.cpp b/src/backends/wrappers/extrae/paraver_config.cpp index a04799e7bc5154aa061f0ab244b00fe9a537c162..0caa3c03bc0eb6171e992a94740c61fc8f478f71 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)); diff --git a/src/delegator.cpp b/src/delegator.cpp index 9317f5df4a3c39ab1e6ef951d417b47d497c4209..b8a59f58760396d2000427771f47b1786f0d4940 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();