allow providing full fr trace path (#165639)

Summary:
- allow users to specify the full path instead of fr suffixing the rank id
- this will be used by torchft to provide the global rank id accross all replicas
- we can't just prefix the replica id because analysis tool expects the file name to provide a unique integer

---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/pytorch/pytorch/pull/165639).
* #165638
* #165640
* #165677
* #165642
* __->__ #165639

Pull Request resolved: https://github.com/pytorch/pytorch/pull/165639
Approved by: https://github.com/fduwjj
This commit is contained in:
Tushar Jain
2025-10-17 04:43:41 +00:00
committed by PyTorch MergeBot
parent 43d78423ac
commit 7e150467f7

View File

@ -7,7 +7,10 @@ namespace c10d {
void DebugInfoWriter::write(const std::string& trace) {
std::string filename = filename_;
if (enable_dynamic_filename_) {
filename = c10::str(getCvarString({"TORCH_FR_DUMP_TEMP_FILE"}, ""), rank_);
LOG(INFO) << "Writing Flight Recorder debug info to a dynamic file name";
filename = c10::str(getCvarString({"TORCH_FR_DUMP_TEMP_FILE"}, ""));
} else {
LOG(INFO) << "Writing Flight Recorder debug info to a static file name";
}
// Open a file for writing. The ios::binary flag is used to write data as
// binary.