[rocprofv3] Add rocpd output support (part 1: prelude) (#401)

* [rocprofv3] Add rocpd output support (part 1: prelude)

- git submodules for sqlite3, GOTCHA, and pybind11
- HIP stream data
- rocprofiler_query_intercept_table_name(...)
- serialization load
- rocprofiler::sdk::get_perfetto_category(KindT)
- rocprofiler::sdk::parse::strip
- common library updates
  - md5sum
  - hasher
  - simple_timer
  - static_tl_object
  - get_process_start_time_ns(pid_t)
- output library updates
  - node_info
  - file_generator (generator is now virtual base class)
  - stream info updates

* Added submodules

* Code review updates

* Minor unused-but-set-X warning fixes

* Update CI

- install libsqlite3-dev package

* Update CI

- install libsqlite3-dev package

* Fix static thread-local object memory leak

- also fix signal handler chaining

* Remove URL from comment

* Remove page migration exception

* Enable ROCPROFILER_BUILD_SQLITE3 by default

- try find_package(SQLite3) first and then build when ROCPROFILER_BUILD_SQLITE3=ON

* Fix gotcha installation

- make install of target optional

* Validate tracing + counter collection dispatch data

- i.e. correlation ids, thread ids, timestamps

* Make find_package(SQLite3) optional

- ROCm CI does not have SQLite3 dev package installed and cannot build from source (missing tclsh)

* Fixes to tracing + counter collection test

* get_process_start_time_ns update

- original implementation did not work

* Fix pytest-packages test_perfetto_data for counter collection

- erroneous failure when used with same PMC + multiple agents

* cmake policy: option() honors normal variables

- for GOTCHA submodule

* Improve samples/api_buffered_tracing stability

- reduce likelihood of sporadic exception throw

* Update gotcha submodule

---------

Co-authored-by: Jonathan R. Madsen <jonathanrmadsen@gmail.com>
This commit is contained in:
Madsen, Jonathan
2025-05-18 20:11:26 -05:00
committed by GitHub
parent 65786f619d
commit 7166b1ab58
86 changed files with 4120 additions and 1730 deletions
+29 -10
View File
@@ -82,7 +82,8 @@ const auto env_regexes =
std::string
format_path_impl(std::string _fpath, const std::vector<output_key>& _keys)
{
if(_fpath.find('%') == std::string::npos && _fpath.find('$') == std::string::npos)
if(_fpath.find('%') == std::string::npos && _fpath.find('{') == std::string::npos &&
_fpath.find('$') == std::string::npos)
return _fpath;
auto _replace = [](auto& _v, const output_key& pitr) {
@@ -133,9 +134,9 @@ format_path_impl(std::string _fpath, const std::vector<output_key>& _keys)
// remove %arg<N>% where N >= argc
try
{
std::regex _re{"(.*)%(arg[0-9]+)%([-/_]*)(.*)"};
auto _re = std::regex{"(.*)(%|\\{)(arg[0-9]+)(%|\\})([-/_]*)(.*)"};
while(std::regex_search(_fpath, _re))
_fpath = std::regex_replace(_fpath, _re, "$1$4");
_fpath = std::regex_replace(_fpath, _re, "$1$6");
} catch(std::exception& _e)
{
ROCP_WARNING << "[rocprofiler] " << __FUNCTION__ << " threw an exception :: " << _e.what()
@@ -148,7 +149,8 @@ format_path_impl(std::string _fpath, const std::vector<output_key>& _keys)
std::string
format_path(std::string&& _fpath, const std::vector<output_key>& _keys)
{
if(_fpath.find('%') == std::string::npos && _fpath.find('$') == std::string::npos)
if(_fpath.find('%') == std::string::npos && _fpath.find('{') == std::string::npos &&
_fpath.find('$') == std::string::npos)
return _fpath;
auto _ref = _fpath;
@@ -156,23 +158,40 @@ format_path(std::string&& _fpath, const std::vector<output_key>& _keys)
return (_fpath == _ref) ? _fpath : format_path(std::move(_fpath), _keys);
}
template <typename Tp>
Tp
get_variable_env(Tp _default_v, std::initializer_list<std::string_view>&& _options)
{
// set env variables towards end override preceding environment variables
auto _val = _default_v;
for(auto itr : _options)
_val = common::get_env<Tp>(itr, std::move(_val));
return _val;
}
} // namespace
int
get_mpi_size()
{
static int _v = common::get_env<int>(
"OMPI_COMM_WORLD_SIZE",
common::get_env<int>("MV2_COMM_WORLD_SIZE", common::get_env<int>("MPI_SIZE", 0)));
static int _v = get_variable_env<int>(0,
{"MPI_SIZE", // most generic to most runtime-specific
"MPI_LOCALNRANKS",
"MPI_NRANKS",
"MV2_COMM_WORLD_SIZE",
"OMPI_COMM_WORLD_SIZE"});
return _v;
}
int
get_mpi_rank()
{
static int _v = common::get_env<int>(
"OMPI_COMM_WORLD_RANK",
common::get_env<int>("MV2_COMM_WORLD_RANK", common::get_env<int>("MPI_RANK", -1)));
static int _v = get_variable_env<int>(0,
{"MPI_RANK", // most generic to most runtime-specific
"MPI_LOCALRANKID",
"MPI_RANKID",
"MV2_COMM_WORLD_RANK",
"OMPI_COMM_WORLD_RANK"});
return _v;
}