From b715f5d4b385704129386067416162392e1f92bf Mon Sep 17 00:00:00 2001 From: JOAN VINYALS YLLA CATALA Date: Thu, 3 Oct 2024 09:44:47 +0200 Subject: [PATCH] Fix PartialTracer state event change stopped The Extrae::PartialTracer state changed when momentarily enabling extrae to record the neSmiK events. --- .../extrae_partial_tracer.cpp | 26 +++++++++++-------- .../extrae_partial_tracer.hpp | 4 +-- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/backends/extrae_partial_tracer/extrae_partial_tracer.cpp b/src/backends/extrae_partial_tracer/extrae_partial_tracer.cpp index 79f0691..b59040c 100644 --- a/src/backends/extrae_partial_tracer/extrae_partial_tracer.cpp +++ b/src/backends/extrae_partial_tracer/extrae_partial_tracer.cpp @@ -19,27 +19,27 @@ ExtraePartialTracer::ExtraePartialTracer() extrae_wrapper_.RegisterTypeWithDescription(type_description_, state_type_); } -void ExtraePartialTracer::shutdown() noexcept { +void ExtraePartialTracer::shutdown(bool annotate) noexcept { if (debug_output_.getValue().value_or(false) && mpi_helper_.IsRankNumber(0)) { std::cout << "neSmiK Partial Tracer: Shutting down" << std::endl; } - extrae_wrapper_.StopWithTypeAndRegionName(state_type_, "ON"); + if (annotate) extrae_wrapper_.StopWithTypeAndRegionName(state_type_, "ON"); Extrae_shutdown(); is_shutdown_ = true; } -void ExtraePartialTracer::start() noexcept { +void ExtraePartialTracer::start(bool annotate) noexcept { if (debug_output_.getValue().value_or(false) && mpi_helper_.IsRankNumber(0)) { std::cout << "neSmiK Partial Tracer: Starting up" << std::endl; } Extrae_restart(); - extrae_wrapper_.StartWithTypeAndRegionName(state_type_, "ON"); + if (annotate) extrae_wrapper_.StartWithTypeAndRegionName(state_type_, "ON"); is_shutdown_ = false; } void ExtraePartialTracer::Init() noexcept { // And pause extrae - shutdown(); + shutdown(true); // then we check the env const auto number_of_names = region_names_env_.getValue().value().size(); @@ -119,7 +119,7 @@ void ExtraePartialTracer::RegionStart( << std::endl; } // We need to startup extrae and emit the region_start event - start(); + start(true); } else { if (debug_output_.getValue().value_or(false) && mpi_helper_.IsRankNumber(0)) { @@ -136,9 +136,11 @@ void ExtraePartialTracer::RegionStart( } else // If we are not running but env is set, we still add it to the trace if (write_all_regions_.getValue().value_or(false)) { - start(); + // We don't want to annotate this start and shutdownd as it is + // conceptually turned of. + start(false); type_stack_strategy_->RegionStart(region); - shutdown(); + shutdown(false); } } @@ -152,9 +154,11 @@ void ExtraePartialTracer::RegionStopLast( } else // If were shutdown we still add it if the env is set if (write_all_regions_.getValue().value_or(false)) { - start(); + // We don't want to annotate this start and shutdownd as it is + // conceptually turned of. + start(false); type_stack_strategy_->RegionStopLast(region); - shutdown(); + shutdown(false); } std::vector matching_jobs; @@ -184,7 +188,7 @@ void ExtraePartialTracer::RegionStopLast( << std::endl; } // We need to stop extrae - shutdown(); + shutdown(true); } else { if (debug_output_.getValue().value_or(false) && mpi_helper_.IsRankNumber(0)) { diff --git a/src/backends/extrae_partial_tracer/extrae_partial_tracer.hpp b/src/backends/extrae_partial_tracer/extrae_partial_tracer.hpp index d613fd7..5b7d74d 100644 --- a/src/backends/extrae_partial_tracer/extrae_partial_tracer.hpp +++ b/src/backends/extrae_partial_tracer/extrae_partial_tracer.hpp @@ -55,8 +55,8 @@ class ExtraePartialTracer : public ProperlyNestedAnnotationStrategy { bool is_shutdown_{true}; ExtraeWrapper extrae_wrapper_; std::unique_ptr type_stack_strategy_; - void shutdown() noexcept; - void start() noexcept; + void shutdown(bool annotate) noexcept; + void start(bool annotate) noexcept; const actual_extrae_type state_type_{82000}; const std::string type_description_ = "Extrae::PartialTracer State"; -- GitLab