From e47f1980ef8d3e54379869cc4414d7dfa64d9f25 Mon Sep 17 00:00:00 2001 From: Aleksandar Janicijevic Date: Fri, 31 Jan 2025 11:39:55 -0500 Subject: [PATCH 01/19] Fixed a bug in parsing command line arguments --- source/timemory/utility/argparse.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/source/timemory/utility/argparse.cpp b/source/timemory/utility/argparse.cpp index 28b051d84..314a2e20b 100644 --- a/source/timemory/utility/argparse.cpp +++ b/source/timemory/utility/argparse.cpp @@ -985,9 +985,7 @@ argument_parser::parse(const std::vector& _args, int verbose_level) // execute the argument-specific actions for(auto& itr : m_arg_map) { - if(exists(itr.first)) - itr.second->execute_actions(*this); - else if(itr.second->m_default) + if(exists(itr.first) || itr.second->m_is_default) itr.second->execute_actions(*this); } From d6ffeb93cce303e36895e05f0ff0ce3c0eccc7d1 Mon Sep 17 00:00:00 2001 From: Aleksandar Janicijevic Date: Fri, 31 Jan 2025 11:48:18 -0500 Subject: [PATCH 02/19] Fixed file format --- source/timemory/utility/filepath.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/timemory/utility/filepath.cpp b/source/timemory/utility/filepath.cpp index d685f6e87..2d724163b 100644 --- a/source/timemory/utility/filepath.cpp +++ b/source/timemory/utility/filepath.cpp @@ -42,6 +42,7 @@ # include #endif +#include #include #include #include @@ -49,7 +50,6 @@ #include #include #include -#include namespace tim { From 080b204cb16f4144fbfb5c1494d0f0f4cf752e76 Mon Sep 17 00:00:00 2001 From: Aleksandar Janicijevic Date: Fri, 31 Jan 2025 11:53:18 -0500 Subject: [PATCH 03/19] Fixed cmake formatting --- cmake/Modules/ConfigBinutils.cmake | 3 +-- cmake/Modules/ConfigLibunwind.cmake | 6 ++++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cmake/Modules/ConfigBinutils.cmake b/cmake/Modules/ConfigBinutils.cmake index 837bf6b3b..fd265121a 100644 --- a/cmake/Modules/ConfigBinutils.cmake +++ b/cmake/Modules/ConfigBinutils.cmake @@ -74,8 +74,7 @@ include(ExternalProject) externalproject_add( binutils-external PREFIX ${PROJECT_BINARY_DIR}/external/binutils - URL - ${TIMEMORY_BINUTILS_DOWNLOAD_URL} + URL ${TIMEMORY_BINUTILS_DOWNLOAD_URL} http://ftpmirror.gnu.org/gnu/binutils/binutils-2.40.tar.gz http://mirrors.kernel.org/sourceware/binutils/releases/binutils-2.40.tar.gz BUILD_IN_SOURCE 1 diff --git a/cmake/Modules/ConfigLibunwind.cmake b/cmake/Modules/ConfigLibunwind.cmake index 079610c1b..c679a5c77 100644 --- a/cmake/Modules/ConfigLibunwind.cmake +++ b/cmake/Modules/ConfigLibunwind.cmake @@ -149,7 +149,8 @@ if(TIMEMORY_INSTALL_HEADERS) endforeach() endif() -file(GLOB libunwind_libs "${PROJECT_BINARY_DIR}/external/libunwind/install/${CMAKE_INSTALL_LIBDIR}/*") +file(GLOB libunwind_libs + "${PROJECT_BINARY_DIR}/external/libunwind/install/${CMAKE_INSTALL_LIBDIR}/*") foreach(_LIB ${libunwind_libs}) if(IS_DIRECTORY ${_LIB}) @@ -176,7 +177,8 @@ target_include_directories( INTERFACE $ $) target_link_directories( - timemory-libunwind INTERFACE + timemory-libunwind + INTERFACE $ $) target_link_libraries( From 0eb3c2e897e95d91eb0333d52f1ea4887f32549f Mon Sep 17 00:00:00 2001 From: David Galiffi Date: Tue, 11 Feb 2025 14:06:14 -0500 Subject: [PATCH 04/19] Remove unused `m_is_default` from `struct argument`. Fixed argument action not being called when a default is defined (#3) --- source/timemory/utility/argparse.cpp | 2 +- source/timemory/utility/argparse.hpp | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/source/timemory/utility/argparse.cpp b/source/timemory/utility/argparse.cpp index 314a2e20b..654fde7d0 100644 --- a/source/timemory/utility/argparse.cpp +++ b/source/timemory/utility/argparse.cpp @@ -985,7 +985,7 @@ argument_parser::parse(const std::vector& _args, int verbose_level) // execute the argument-specific actions for(auto& itr : m_arg_map) { - if(exists(itr.first) || itr.second->m_is_default) + if(exists(itr.first) || itr.second->m_default) itr.second->execute_actions(*this); } diff --git a/source/timemory/utility/argparse.hpp b/source/timemory/utility/argparse.hpp index 0e090900c..4a4a0bf17 100644 --- a/source/timemory/utility/argparse.hpp +++ b/source/timemory/utility/argparse.hpp @@ -718,7 +718,6 @@ struct argument_parser bool is_separator() const; friend struct argument_parser; - bool m_is_default = false; int m_position = Position::IgnoreArgument; int m_count = Count::ANY; int m_min_count = Count::ANY; From fad254dde56e6d6deb6f9a643000ab678726db30 Mon Sep 17 00:00:00 2001 From: Pranjal Swarup Date: Fri, 21 Mar 2025 14:23:24 -0400 Subject: [PATCH 05/19] Update binutils version to 2.42 --- cmake/Modules/ConfigBinutils.cmake | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/cmake/Modules/ConfigBinutils.cmake b/cmake/Modules/ConfigBinutils.cmake index fd265121a..614884ad3 100644 --- a/cmake/Modules/ConfigBinutils.cmake +++ b/cmake/Modules/ConfigBinutils.cmake @@ -75,15 +75,14 @@ externalproject_add( binutils-external PREFIX ${PROJECT_BINARY_DIR}/external/binutils URL ${TIMEMORY_BINUTILS_DOWNLOAD_URL} - http://ftpmirror.gnu.org/gnu/binutils/binutils-2.40.tar.gz - http://mirrors.kernel.org/sourceware/binutils/releases/binutils-2.40.tar.gz + http://ftpmirror.gnu.org/gnu/binutils/binutils-2.42.tar.gz + http://mirrors.kernel.org/sourceware/binutils/releases/binutils-2.42.tar.gz BUILD_IN_SOURCE 1 CONFIGURE_COMMAND ${CMAKE_COMMAND} -E env CC=${CMAKE_C_COMPILER} CFLAGS=-fPIC\ -O3 CXX=${CMAKE_CXX_COMPILER} CXXFLAGS=-fPIC\ -O3 /configure --prefix=${TPL_STAGING_PREFIX} ${_binutils_CONFIG_FLAGS} - BUILD_COMMAND ${MAKE_COMMAND} all-libiberty all-bfd all-opcodes all-libelf - all-libsframe + BUILD_COMMAND ${MAKE_COMMAND} all-libiberty all-bfd all-opcodes all-libsframe INSTALL_COMMAND "" BUILD_BYPRODUCTS "${_TIMEMORY_BINUTILS_BUILD_BYPRODUCTS}") @@ -93,7 +92,7 @@ add_custom_command( COMMAND ${CMAKE_COMMAND} ARGS -E make_directory ${TPL_STAGING_PREFIX}/lib COMMAND install ARGS -C - ${PROJECT_BINARY_DIR}/external/binutils/src/binutils-external/bfd/libbfd.a + ${PROJECT_BINARY_DIR}/external/binutils/src/binutils-external/bfd/.libs/libbfd.a ${PROJECT_BINARY_DIR}/external/binutils/src/binutils-external/opcodes/libopcodes.a ${PROJECT_BINARY_DIR}/external/binutils/src/binutils-external/libiberty/libiberty.a ${PROJECT_BINARY_DIR}/external/binutils/src/binutils-external/libsframe/.libs/libsframe.a From 858cfc752a02cc46ef03bef8ca34aaafe2609d19 Mon Sep 17 00:00:00 2001 From: David Galiffi Date: Fri, 11 Apr 2025 14:59:41 -0400 Subject: [PATCH 06/19] Update rpath on libunwind libraries (#4) Invalid RPATH used for libunwind properties. Failing RPM generations and rpath check on RHEL 10. --------- Signed-off-by: David Galiffi --- cmake/Modules/ConfigLibunwind.cmake | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cmake/Modules/ConfigLibunwind.cmake b/cmake/Modules/ConfigLibunwind.cmake index c679a5c77..c51b80574 100644 --- a/cmake/Modules/ConfigLibunwind.cmake +++ b/cmake/Modules/ConfigLibunwind.cmake @@ -159,6 +159,16 @@ foreach(_LIB ${libunwind_libs}) if("${_LIB}" MATCHES "\\.so($|\\.)") execute_process(COMMAND ${CMAKE_STRIP} ${_LIB}) + find_program(CHRPATH_EXECUTABLE chrpath) + + if(CHRPATH_EXECUTABLE) + execute_process(COMMAND ${CHRPATH_EXECUTABLE} -r "$ORIGIN" ${_LIB}) + else() + message( + WARNING + "[timemory] chrpath not found. Skipping rpath modification for libunwind." + ) + endif() endif() install( From 5400e1349cb3266a1f9c605643c6d4f3871ced47 Mon Sep 17 00:00:00 2001 From: David Galiffi Date: Wed, 11 Jun 2025 15:34:10 -0500 Subject: [PATCH 07/19] Update GOTCHA submodule to fix CMake 4.0 build Signed-off-by: David Galiffi --- external/gotcha | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/gotcha b/external/gotcha index 5aff8260e..e4a8b0392 160000 --- a/external/gotcha +++ b/external/gotcha @@ -1 +1 @@ -Subproject commit 5aff8260e0756d7c182812ef6b92453374265e28 +Subproject commit e4a8b0392477f88dc8d5c649eae4fdab47f4f193 From b82ec24684b11c6750e5147b617a7c6485315820 Mon Sep 17 00:00:00 2001 From: marantic-amd Date: Tue, 8 Jul 2025 12:45:26 +0200 Subject: [PATCH 08/19] Removed in-file offsets. Replaced with simple line based parsing (#5) --- source/timemory/utility/procfs/cpuinfo.hpp | 96 ++++++++-------------- 1 file changed, 35 insertions(+), 61 deletions(-) diff --git a/source/timemory/utility/procfs/cpuinfo.hpp b/source/timemory/utility/procfs/cpuinfo.hpp index 162129134..f8ae0d333 100644 --- a/source/timemory/utility/procfs/cpuinfo.hpp +++ b/source/timemory/utility/procfs/cpuinfo.hpp @@ -45,10 +45,9 @@ struct freq auto operator()(size_t _idx) const; explicit operator bool() const; - static auto get(size_t _idx); - static size_t size() { return get_offsets().size(); } - static std::vector& get_offsets(); - static auto& get_ifstream() + static double get(size_t _idx); + static size_t size() { return std::thread::hardware_concurrency(); } + static auto& get_ifstream() { static thread_local auto _v = []() { auto _ifs = @@ -63,72 +62,47 @@ struct freq inline freq::operator bool() const { return (get_ifstream() != nullptr); } -inline auto +inline double freq::get(size_t _idx) { - auto& _ifs = get_ifstream(); - auto& _offsets = get_offsets(); - double _freq = 0.0; - _ifs->seekg(_offsets.at(_idx), _ifs->beg); - (*_ifs) >> _freq; - return _freq; -} + std::ifstream ifs("/proc/cpuinfo"); + if(!ifs) return 0.0; -inline auto -freq::operator()(size_t _idx) const -{ - return freq::get(_idx % size()); -} + std::string line; + size_t current_cpu = 0; -inline std::vector& -freq::get_offsets() -{ - static auto _v = []() { - auto _ncpu = std::thread::hardware_concurrency(); - std::vector _cpu_mhz_pos{}; - std::ifstream _ifs{ "/proc/cpuinfo" }; - if(_ifs) + while(std::getline(ifs, line)) + { + if(line.find("processor") == 0) { - for(size_t i = 0; i < _ncpu; ++i) + size_t idx; + if(sscanf(line.c_str(), "processor : %zu", &idx) == 1) { - short _n = 0; - std::string _st{}; - while(_ifs && _ifs.good()) - { - std::string _s{}; - _ifs >> _s; - if(!_ifs.good() || !_ifs) - break; - - if(_s == "cpu" || _s == "MHz" || _s == ":") - { - ++_n; - _st += _s + " "; - } - else - { - _n = 0; - _st = {}; - } - - if(_n == 3) - { - size_t _pos = _ifs.tellg(); - _cpu_mhz_pos.emplace_back(_pos + 1); - _ifs >> _s; - if(!_ifs.good() || !_ifs) - break; - break; - } - } + current_cpu = idx; } } + if(current_cpu == _idx && line.find("cpu MHz") == 0) + { + double freq = 0.0; + size_t pos = line.find(':'); + if(pos != std::string::npos) + { + std::string value = line.substr(pos + 1); + freq = std::stod(value); + return freq; + } + } + } - _ifs.close(); - return _cpu_mhz_pos; - }(); - return _v; + return 0.0; } + +inline auto +freq::operator()(size_t _idx) const +{ + return freq::get(_idx % size()); +} + } // namespace cpuinfo } // namespace procfs -} // namespace tim +} // namespace tim \ No newline at end of file From 469eced5c690bb7320b88bf7ce93e7333f349aa5 Mon Sep 17 00:00:00 2001 From: Sajina PK Date: Tue, 8 Jul 2025 18:53:07 -0400 Subject: [PATCH 09/19] Update gotcha submodule (#7) Update submodule to https://github.com/ROCm/GOTCHA/commit/c04cc3f36442c3a9e886bd4b517c5f133f134519 (v1.0.8 +). Now points to the ROCm fork of GOTCHA --- .gitmodules | 2 +- external/gotcha | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index 8235ed93c..21ef85d66 100644 --- a/.gitmodules +++ b/.gitmodules @@ -9,7 +9,7 @@ url = https://github.com/jrmadsen/Caliper.git [submodule "external/gotcha"] path = external/gotcha - url = https://github.com/jrmadsen/GOTCHA.git + url = https://github.com/ROCm/GOTCHA.git [submodule "external/llvm-ompt"] path = external/llvm-ompt url = https://github.com/NERSC/LLVM-openmp.git diff --git a/external/gotcha b/external/gotcha index e4a8b0392..c4623775e 160000 --- a/external/gotcha +++ b/external/gotcha @@ -1 +1 @@ -Subproject commit e4a8b0392477f88dc8d5c649eae4fdab47f4f193 +Subproject commit c4623775ef1bbc994977404a16028eb8232527bf From 5780cc73c0f9f97e99b7ef3efdde6a4a26ccf3d0 Mon Sep 17 00:00:00 2001 From: David Galiffi Date: Tue, 15 Jul 2025 17:13:01 -0400 Subject: [PATCH 10/19] Update gotcha submodule to fix its submodules (#8) Signed-off-by: David Galiffi --- external/gotcha | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/gotcha b/external/gotcha index c4623775e..6ef1232a0 160000 --- a/external/gotcha +++ b/external/gotcha @@ -1 +1 @@ -Subproject commit c4623775ef1bbc994977404a16028eb8232527bf +Subproject commit 6ef1232a0acc99f3340c2ca4c5d23890e9b8a459 From 4897ddad7150a10a31b414228e723f56f90ea391 Mon Sep 17 00:00:00 2001 From: marantic-amd Date: Tue, 12 Aug 2025 22:46:07 +0200 Subject: [PATCH 11/19] Add type info in ompt labeled arguments (#9) --- source/timemory/components/ompt/context.hpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/source/timemory/components/ompt/context.hpp b/source/timemory/components/ompt/context.hpp index 80d5756cb..8170c2ac2 100644 --- a/source/timemory/components/ompt/context.hpp +++ b/source/timemory/components/ompt/context.hpp @@ -41,9 +41,20 @@ namespace openmp { struct labeled_argument { + template + std::string get_type_name(const Type& arg) + { + const char* name = typeid(arg).name(); + int status; + std::unique_ptr demangledName( + abi::__cxa_demangle(name, nullptr, nullptr, &status), std::free); + return status == 0 ? demangledName.get() : name; + } + template labeled_argument(std::string_view _lbl, Tp&& _val) : label{ _lbl } + , type{ get_type_name(_val) } , value{ timemory::join::join("", std::forward(_val)) } {} @@ -55,6 +66,7 @@ struct labeled_argument } std::string_view label = {}; + std::string type = {}; std::string value = {}; }; From 8b017853c1020dcb6aa9af09a742b84d1777af06 Mon Sep 17 00:00:00 2001 From: Milan Radosavljevic Date: Tue, 19 Aug 2025 01:07:59 +0200 Subject: [PATCH 12/19] Enable string to be copied in print_help (#10) --- source/timemory/utility/argparse.cpp | 4 ++-- source/timemory/utility/argparse.hpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/timemory/utility/argparse.cpp b/source/timemory/utility/argparse.cpp index 654fde7d0..7f48c8991 100644 --- a/source/timemory/utility/argparse.cpp +++ b/source/timemory/utility/argparse.cpp @@ -289,7 +289,7 @@ argument_parser::enable_help() TIMEMORY_UTILITY_INLINE // clang-format on argument_parser::argument& -argument_parser::enable_help(const std::string& _extra, const std::string& _epilogue, +argument_parser::enable_help(const std::string _extra, const std::string _epilogue, int _exit_code) { m_help_enabled = true; @@ -414,7 +414,7 @@ argument_parser::enable_version( TIMEMORY_UTILITY_INLINE // clang-format on void -argument_parser::print_help(const std::string& _extra, const std::string& _epilogue) +argument_parser::print_help(const std::string _extra, const std::string _epilogue) { end_group(); diff --git a/source/timemory/utility/argparse.hpp b/source/timemory/utility/argparse.hpp index 4a4a0bf17..d0bad3922 100644 --- a/source/timemory/utility/argparse.hpp +++ b/source/timemory/utility/argparse.hpp @@ -874,7 +874,7 @@ struct argument_parser // //----------------------------------------------------------------------------------// // - void print_help(const std::string& _extra = {}, const std::string& _epilogue = {}); + void print_help(const std::string _extra = {}, const std::string _epilogue = {}); // //----------------------------------------------------------------------------------// // @@ -981,7 +981,7 @@ struct argument_parser /// \fn argument& enable_help() /// \brief Add a help command - argument& enable_help(const std::string& _extra, const std::string& _epilogue = {}, + argument& enable_help(const std::string _extra, const std::string _epilogue = {}, int _exit_code = EXIT_SUCCESS); /// \fn argument& enable_version( From b5e41aa9e4b83ab0868211d81924ac4f639bd998 Mon Sep 17 00:00:00 2001 From: ajanicijamd Date: Fri, 24 Oct 2025 10:52:04 -0400 Subject: [PATCH 13/19] Fixed code to strictly correct C++ so that Clang 20 would accept it (#12) --- source/timemory/tpls/cereal/cereal/types/tuple.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/timemory/tpls/cereal/cereal/types/tuple.hpp b/source/timemory/tpls/cereal/cereal/types/tuple.hpp index 3f02ba23d..ec1255068 100644 --- a/source/timemory/tpls/cereal/cereal/types/tuple.hpp +++ b/source/timemory/tpls/cereal/cereal/types/tuple.hpp @@ -101,7 +101,7 @@ struct serialize template inline static void apply(Archive& ar, std::tuple& tuple) { - serialize::template apply(ar, tuple); + serialize::template apply<>(ar, tuple); ar(TIMEMORY_CEREAL_NVP_(tuple_element_name::c_str(), std::get(tuple))); } @@ -123,7 +123,7 @@ template inline void TIMEMORY_CEREAL_SERIALIZE_FUNCTION_NAME(Archive& ar, std::tuple& tuple) { - tuple_detail::serialize>::value>::template apply( + tuple_detail::serialize>::value>::template apply<>( ar, tuple); } } // namespace cereal From 4daa81b7a49b918918bb12bcaa90fc2c4698d527 Mon Sep 17 00:00:00 2001 From: Sajina PK Date: Fri, 14 Nov 2025 10:03:13 -0500 Subject: [PATCH 14/19] Exclude perf_event_uncore events from evaluation (#13) * Exclude perf_event_uncore events from evaluation * Change1: Optimization and cleaner code fixes --- source/timemory/backends/papi.cpp | 11 ++++++++--- source/timemory/backends/papi.hpp | 4 ++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/source/timemory/backends/papi.cpp b/source/timemory/backends/papi.cpp index 853d5366d..e748cc8e5 100644 --- a/source/timemory/backends/papi.cpp +++ b/source/timemory/backends/papi.cpp @@ -39,6 +39,7 @@ #include #include +#include #include #include @@ -277,8 +278,8 @@ get_event_code(string_view_cref_t event_code_str) int event_code = -1; int retval = PAPI_event_name_to_code(event_code_str.data(), &event_code); working() = check(retval, TIMEMORY_JOIN(' ', "Warning!! Failure converting", - event_code_str, "to enum value") - .c_str()); + event_code_str, "to enum value") + .c_str()); return (retval == PAPI_OK) ? event_code : PAPI_NOT_INITED; #else consume_parameters(event_code_str); @@ -401,7 +402,7 @@ add_events(int event_set, string_t* events, int number) TIMEMORY_BACKENDS_INLINE hwcounter_info_t -available_events_info() +available_events_info(const std::unordered_set& excluded_components) { hwcounter_info_t evts{}; @@ -528,6 +529,10 @@ available_events_info() continue; # endif + // Skip excluded components + if(excluded_components.count(component->name) > 0) + continue; + // show this component has not found any events yet // int num_cmp_events = 0; diff --git a/source/timemory/backends/papi.hpp b/source/timemory/backends/papi.hpp index 35b8471be..d9f02fabf 100644 --- a/source/timemory/backends/papi.hpp +++ b/source/timemory/backends/papi.hpp @@ -254,7 +254,7 @@ check(int retval, string_view_cref_t mesg, bool quiet = false) #if defined(TIMEMORY_USE_PAPI) auto* error_str = PAPI_strerror(retval); auto&& _msg = TIMEMORY_JOIN(' ', "[timemory][papi]", mesg, ":: PAPI_error", - retval, ":", error_str); + retval, ":", error_str); if(settings::papi_fail_on_error()) { TIMEMORY_EXCEPTION(_msg); @@ -1023,7 +1023,7 @@ overflow(int evt_set, string_view_cref_t evt_name, int threshold, int flags, //--------------------------------------------------------------------------------------// hwcounter_info_t -available_events_info(); +available_events_info(const std::unordered_set& excluded_components = {}); //--------------------------------------------------------------------------------------// From 2dd05114aed794200a89593c488030f6f2f5a4ad Mon Sep 17 00:00:00 2001 From: David Galiffi Date: Wed, 19 Nov 2025 14:26:32 -0500 Subject: [PATCH 15/19] Update the ConfigLibunwind.cmake (#14) Fallback to use `patchelf`, if `chrpath` is not present. Change some logging from "WARNING"s to "AUTHOR_WARNING"s. Signed-off-by: David Galiffi --- cmake/Modules/ConfigLibunwind.cmake | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cmake/Modules/ConfigLibunwind.cmake b/cmake/Modules/ConfigLibunwind.cmake index c51b80574..9fd60538c 100644 --- a/cmake/Modules/ConfigLibunwind.cmake +++ b/cmake/Modules/ConfigLibunwind.cmake @@ -160,13 +160,16 @@ foreach(_LIB ${libunwind_libs}) if("${_LIB}" MATCHES "\\.so($|\\.)") execute_process(COMMAND ${CMAKE_STRIP} ${_LIB}) find_program(CHRPATH_EXECUTABLE chrpath) + find_program(PATCHELF_EXECUTABLE patchelf) if(CHRPATH_EXECUTABLE) execute_process(COMMAND ${CHRPATH_EXECUTABLE} -r "$ORIGIN" ${_LIB}) + elseif(PATCHELF_EXECUTABLE) + execute_process(COMMAND ${PATCHELF_EXECUTABLE} --set-rpath "$ORIGIN" ${_LIB}) else() message( - WARNING - "[timemory] chrpath not found. Skipping rpath modification for libunwind." + AUTHOR_WARNING + "[timemory] Neither chrpath nor patchelf found. Skipping rpath modification for libunwind." ) endif() endif() From 29037f3fdf86530578e2f58d4a542027054047bd Mon Sep 17 00:00:00 2001 From: anujshuk-amd Date: Mon, 8 Dec 2025 19:21:24 +0530 Subject: [PATCH 16/19] Fix: Replace hard-coded thread limit with TIMEMORY_MAX_THREADS (#18) --- CHANGELOG.md | 10 ++++++++++ VERSION | 2 +- source/timemory/operations/types.hpp | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9bc7fb000..0f4936900 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # timemory +## Version 4.0.1rc0 + +> Date: Tue Dec 3, 2025 + +### Bug Fixes + +- Fixed hard-coded thread limit in `operation::set_storage` + - Changed from `max_threads = 4096` to use `TIMEMORY_MAX_THREADS` + - Prevents segfaults when Linux thread IDs exceed 4096 + ## Version 3.2.4 > Date: Mon Jul 19 17:22:28 2021 -0500 diff --git a/VERSION b/VERSION index b19ee8389..c8621cb54 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -4.0.0rc0 +4.0.1rc0 diff --git a/source/timemory/operations/types.hpp b/source/timemory/operations/types.hpp index 40d6ad052..cb0850176 100644 --- a/source/timemory/operations/types.hpp +++ b/source/timemory/operations/types.hpp @@ -813,7 +813,7 @@ template struct set_storage { friend struct get_storage; - static constexpr size_t max_threads = 4096; + static constexpr size_t max_threads = TIMEMORY_MAX_THREADS; using type = T; using storage_array_t = std::array*, max_threads>; From 4fd21493ec5a58b8f9002d5eef5e5ada8cf783db Mon Sep 17 00:00:00 2001 From: Anuj Shukla Date: Wed, 17 Dec 2025 09:34:20 -0500 Subject: [PATCH 17/19] fix: prioritize GNU libunwind headers over system LLVM libunwind using BEFORE keyword --- cmake/Modules/ConfigLibunwind.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmake/Modules/ConfigLibunwind.cmake b/cmake/Modules/ConfigLibunwind.cmake index 9fd60538c..797cf24d6 100644 --- a/cmake/Modules/ConfigLibunwind.cmake +++ b/cmake/Modules/ConfigLibunwind.cmake @@ -185,8 +185,10 @@ install( DESTINATION ${CMAKE_INSTALL_LIBDIR}/timemory/libunwind/pkgconfig OPTIONAL) +# Add include directories with BEFORE to ensure they come first in include search path +# This ensures GNU libunwind headers are found before LLVM libunwind headers target_include_directories( - timemory-libunwind SYSTEM + timemory-libunwind BEFORE INTERFACE $ $) target_link_directories( From 32a0571c0992960c433811165672cf7d624ba124 Mon Sep 17 00:00:00 2001 From: Anuj Shukla Date: Tue, 23 Dec 2025 08:42:06 -0500 Subject: [PATCH 18/19] Just reverting to validate chnages --- cmake/Modules/ConfigLibunwind.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/Modules/ConfigLibunwind.cmake b/cmake/Modules/ConfigLibunwind.cmake index 797cf24d6..bfe4140e2 100644 --- a/cmake/Modules/ConfigLibunwind.cmake +++ b/cmake/Modules/ConfigLibunwind.cmake @@ -79,7 +79,7 @@ function(timemory_libunwind_configure) endfunction() function(timemory_libunwind_build) - message(STATUS "[timemory] Building libunwind...") + message(STATUS "[timemory] Building libunwind.......") timemory_libunwind_execute_process(${MAKE_EXE}) # remove installation if new build From d6ab91ac4e24a83abc2c913a2b7c4376188b4037 Mon Sep 17 00:00:00 2001 From: Anuj Shukla Date: Tue, 23 Dec 2025 12:58:57 -0500 Subject: [PATCH 19/19] Update libunwind to use official repo with v1.8-stable branch --- cmake/Modules/Packages.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/Modules/Packages.cmake b/cmake/Modules/Packages.cmake index 09b0e43a7..ae7aa9e4e 100644 --- a/cmake/Modules/Packages.cmake +++ b/cmake/Modules/Packages.cmake @@ -569,7 +569,7 @@ if(TIMEMORY_BUILD_YAML) timemory_checkout_git_submodule( RELATIVE_PATH external/yaml-cpp WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} - REPO_URL https://github.com/jrmadsen/yaml-cpp.git + REPO_URL https://github.com/jbeder/yaml-cpp.git REPO_BRANCH master) add_library(timemory-yaml-cpp STATIC) @@ -1138,8 +1138,8 @@ elseif(TIMEMORY_USE_LIBUNWIND AND TIMEMORY_BUILD_LIBUNWIND) RECURSIVE RELATIVE_PATH external/libunwind WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} - REPO_URL https://github.com/jrmadsen/libunwind.git - REPO_BRANCH master) + REPO_URL https://github.com/libunwind/libunwind.git + REPO_BRANCH v1.8-stable) include(ConfigLibunwind) else()