Merge proto files from multiprocess run into one file. (#63)

- Added script to merge multiprocess output automatically to one file when there are multiprocess proto files written into output folder
- Execute the merge multiprocess script from the rank 0 process
- Added the scripts folder path to env path, via setup-env.sh
- Installed merge_multiprocess_output.sh to /share/rocprofiler-systems/bin dir

Co-authored-by: David Galiffi <David.Galiffi@amd.com>
This commit is contained in:
Pranjal Swarup
2024-12-18 17:34:02 -05:00
committed by GitHub
parent 3fa37c991e
commit 0263e951ff
5 changed files with 77 additions and 0 deletions
+19
View File
@@ -263,6 +263,25 @@ post_process(tim::manager* _timemory_manager, bool& _perfetto_output_error)
_timemory_manager->add_file_output("protobuf", "perfetto", _filename);
}
ofs.close();
if(dmp::rank() == 0)
{
const char* file_path = _filename.c_str();
auto folder_path = [](std::string_view _v) {
return tim::filepath::dirname(std::string(_v));
};
// Execute the merge script
std::string command =
"merge-multiprocess-output.sh '" + folder_path(file_path) + "'";
int result = system(command.c_str());
if(result != 0)
{
ROCPROFSYS_VERBOSE(0,
"Failed to execute merge-multiprocess-output.sh with "
"folder path: %s\n",
folder_path(file_path).c_str());
}
}
}
else if(dmp::rank() == 0)
{