Fix path to post-processing merge script (#187)

- Path to merge script not found unless user explicitly sources "share/rocprofiler-systems/setup-env.sh" to setup PATHs.
- Instead, let's derive the path when the application loads and use it when executing the helper script
- Rename script to rocprof-sys-merge-output.sh.
- Change install folder to <prefix>/libexec/rocprofiler-systems based on dev-ops feedback.
- Updated PATH variable in the modulefile and source scrtipt.
- For SWDEV-528101

[ROCm/rocprofiler-systems commit: adc66956b0]
Этот коммит содержится в:
David Galiffi
2025-05-02 16:52:54 -04:00
коммит произвёл GitHub
родитель 31dc2414e3
Коммит 6fe19b681a
10 изменённых файлов: 103 добавлений и 26 удалений
+16 -1
Просмотреть файл
@@ -124,9 +124,11 @@ get_initial_environment()
auto _dl_libpath = get_realpath(get_internal_libpath("librocprof-sys-dl.so"));
auto _omni_libpath = get_realpath(get_internal_libpath("librocprof-sys.so"));
auto _libexecpath = get_realpath(get_internal_script_path());
update_env(_env, "LD_PRELOAD", _dl_libpath, UPD_APPEND);
update_env(_env, "LD_LIBRARY_PATH", tim::filepath::dirname(_dl_libpath), UPD_APPEND);
update_env(_env, "ROCPROFSYS_SCRIPT_PATH", _libexecpath, UPD_REPLACE);
auto _mode = get_env<std::string>("ROCPROFSYS_MODE", "sampling", false);
@@ -136,7 +138,6 @@ get_initial_environment()
if(!getenv("OMP_TOOL_LIBRARIES"))
update_env(_env, "OMP_TOOL_LIBRARIES", _dl_libpath, UPD_APPEND);
#endif
return _env;
}
@@ -150,6 +151,20 @@ get_internal_libpath(const std::string& _lib)
return rocprofsys::common::join("/", _dir, "..", "lib", _lib);
}
std::string
get_internal_script_path(void)
{
auto _exe = std::string_view{ realpath("/proc/self/exe", nullptr) };
auto _pos = _exe.find_last_of('/');
auto _dir = std::string{ "./" };
if(_pos != std::string_view::npos) _dir = _exe.substr(0, _pos);
auto _script_dir =
rocprofsys::common::join("/", _dir, "..", "libexec", "rocprofiler-systems");
return _script_dir;
}
void
print_updated_environment(std::vector<char*> _env)
{