From 6dbaee40fbe627388f3ad8014fd83ec2390d772d Mon Sep 17 00:00:00 2001 From: Valentin Seitz Date: Tue, 4 Jun 2024 17:01:12 +0200 Subject: [PATCH 1/3] added hashed extrae values --- src/backends/extrae/extrae_type_stack.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/backends/extrae/extrae_type_stack.cpp b/src/backends/extrae/extrae_type_stack.cpp index 21fb90a..afdd112 100644 --- a/src/backends/extrae/extrae_type_stack.cpp +++ b/src/backends/extrae/extrae_type_stack.cpp @@ -186,14 +186,15 @@ void ExtraeTypeStackStrategy::finalize() noexcept { unsigned int numberOfRegionsRegistered = regionMapData.regionNameToValue.size(); - std::vector values{}; + std::vector hashed_values{}; std::vector routine_names{}; for (const auto &item : regionMapData.regionNameToValue) { - const auto &routine_name = item.first; + const auto ®ion_name = item.first; const auto &value = item.second; - routine_names.push_back(routine_name); - values.push_back(value); + routine_names.push_back(region_name); + const auto hashed_value = std::hash{}(region_name); + hashed_values.push_back(static_cast(hashed_value)); } // leaking memory a bit, but c vs c++ strings are not worth making it not // leaky? @@ -208,7 +209,7 @@ void ExtraeTypeStackStrategy::finalize() noexcept { extrae_type_t type = baseType+level; std::string description = "Level: " + std::to_string(level); Extrae_define_event_type(&type, const_cast(description.c_str()), - &numberOfRegionsRegistered, values.data(), routine_c_names); + &numberOfRegionsRegistered, hashed_values.data(), routine_c_names); } -- GitLab From 9323d0620e97b267152f010c6db5a413eb747186 Mon Sep 17 00:00:00 2001 From: Valentin Seitz Date: Tue, 4 Jun 2024 17:35:40 +0200 Subject: [PATCH 2/3] actuallly compute hashes --- src/backends/extrae/extrae_type_stack.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/backends/extrae/extrae_type_stack.cpp b/src/backends/extrae/extrae_type_stack.cpp index afdd112..a2d0362 100644 --- a/src/backends/extrae/extrae_type_stack.cpp +++ b/src/backends/extrae/extrae_type_stack.cpp @@ -137,7 +137,7 @@ ExtraeTypeStackStrategy::get_value_by_region_name(const std::string &name) { else // if not allocate new entry { - const auto newValue= regionMapData.regionNameToValue.size()+1; + const extrae_value newValue= std::hash{}(name); regionMapData.regionNameToValue[name] = newValue; return newValue; } @@ -186,15 +186,14 @@ void ExtraeTypeStackStrategy::finalize() noexcept { unsigned int numberOfRegionsRegistered = regionMapData.regionNameToValue.size(); - std::vector hashed_values{}; + std::vector values{}; std::vector routine_names{}; for (const auto &item : regionMapData.regionNameToValue) { const auto ®ion_name = item.first; const auto &value = item.second; routine_names.push_back(region_name); - const auto hashed_value = std::hash{}(region_name); - hashed_values.push_back(static_cast(hashed_value)); + values.push_back(static_cast(value)); } // leaking memory a bit, but c vs c++ strings are not worth making it not // leaky? @@ -209,7 +208,7 @@ void ExtraeTypeStackStrategy::finalize() noexcept { extrae_type_t type = baseType+level; std::string description = "Level: " + std::to_string(level); Extrae_define_event_type(&type, const_cast(description.c_str()), - &numberOfRegionsRegistered, hashed_values.data(), routine_c_names); + &numberOfRegionsRegistered, values.data(), routine_c_names); } -- GitLab From 5bf325920675a4776a011d5e7cf0baccaf99cff0 Mon Sep 17 00:00:00 2001 From: Valentin Seitz Date: Tue, 4 Jun 2024 17:40:11 +0200 Subject: [PATCH 3/3] try now without static cast --- src/backends/extrae/extrae_type_stack.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backends/extrae/extrae_type_stack.cpp b/src/backends/extrae/extrae_type_stack.cpp index a2d0362..1ac1be2 100644 --- a/src/backends/extrae/extrae_type_stack.cpp +++ b/src/backends/extrae/extrae_type_stack.cpp @@ -193,7 +193,7 @@ void ExtraeTypeStackStrategy::finalize() noexcept { const auto ®ion_name = item.first; const auto &value = item.second; routine_names.push_back(region_name); - values.push_back(static_cast(value)); + values.push_back(value); } // leaking memory a bit, but c vs c++ strings are not worth making it not // leaky? -- GitLab