From 5828e1f640417db7d564b27f2d4835c7a72a0a18 Mon Sep 17 00:00:00 2001 From: Valentin Seitz Date: Tue, 23 Jul 2024 16:02:18 +0200 Subject: [PATCH] add hotfix to online write output on 0 rank --- src/backends/extrae/extrae_type_stack.cpp | 10 +++++----- src/backends/extrae/extrae_type_stack.hpp | 3 +++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/backends/extrae/extrae_type_stack.cpp b/src/backends/extrae/extrae_type_stack.cpp index 94e89a6..be8be21 100644 --- a/src/backends/extrae/extrae_type_stack.cpp +++ b/src/backends/extrae/extrae_type_stack.cpp @@ -13,12 +13,10 @@ extern "C" { #include } -ExtraeTypeStackStrategy::ExtraeTypeStackStrategy() { +ExtraeTypeStackStrategy::ExtraeTypeStackStrategy() : mpi_helper_{} { parallelism_descriptor_ = { .mpi_descriptor_ = MPIDescriptor::Aware, - .thread_descriptor_ = - ThreadDescriptor::Supported // i guess no test currently for this - }; + .thread_descriptor_ = ThreadDescriptor::Unsupported}; } const std::string ExtraeTypeStackStrategy::paraverConfigHead = R"( @@ -119,6 +117,7 @@ void ExtraeTypeStackStrategy::Init() noexcept { // https://github.com/bsc-performance-tools/extrae/blob/daee11a2f98e301eb146608f51df0c844e1ff381/include/extrae_types.h#L33 Extrae_init(); didInitialize = true; + std::cout << "NESMIK forced to Initialize extrae" << std::endl; } } @@ -204,7 +203,8 @@ void ExtraeTypeStackStrategy::Finalize() noexcept { routine_c_names); } - if (write_config_file_.getValue().value_or(write_config_file_default_)) { + if (write_config_file_.getValue().value_or(write_config_file_default_) && + mpi_helper_.IsRankNumber(0)) { std::string fileName = "nesmik_annotations.cfg"; std::ofstream outputFile; outputFile.open(fileName); diff --git a/src/backends/extrae/extrae_type_stack.hpp b/src/backends/extrae/extrae_type_stack.hpp index 616766f..df59582 100644 --- a/src/backends/extrae/extrae_type_stack.hpp +++ b/src/backends/extrae/extrae_type_stack.hpp @@ -2,6 +2,7 @@ #include #include #include +#include #include "strategies.hpp" // #include @@ -32,6 +33,8 @@ class ExtraeTypeStackStrategy : public ProperlyNestedAnnotationStrategy { inline static const int paraverConfigWindowHeight_ = 115; inline static const int paraverConfigWindowHeightPad_ = 35; + MPIHelper mpi_helper_; + inline static bool didInitialize{false}; inline static thread_local RegionStackData regionStackData; -- GitLab