Skip to content

Commit f52e1d1

Browse files
committed
Fix the logic to copy the XLA dumps to desired location.
1 parent 1e757f0 commit f52e1d1

File tree

2 files changed

+5
-172
lines changed

2 files changed

+5
-172
lines changed

src/benchmark_utils.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import re
1717
from collections import defaultdict
1818
import subprocess
19+
import shutil
1920

2021

2122
def simple_timeit(f, *args, tries=10, task=None, trace_dir=None) -> float:
@@ -281,20 +282,13 @@ def rename_xla_dump(tmp_xla_dump_dir: str, dest_xla_dump_dir: str, benchmark_nam
281282
print(f"Skipping: '{original_filename}' already has the desired name or path.")
282283
continue
283284

284-
try:
285-
os.copy(original_filepath, new_filepath)
286-
except OSError as e:
287-
print(f"Error renaming file '{original_filepath}' to '{new_filepath}': {e}")
288-
except Exception as e:
289-
print(f"An unexpected error occurred while renaming '{original_filepath}': {e}")
290-
291285
# Copy the renamed files to desired location
292286
if is_local_directory_path(dest_xla_dump_dir):
293287
try:
294-
os.copy(original_filepath, new_filepath)
295-
except OSError as e:
296-
print(f"Error copy file '{original_filepath}' to '{new_filepath}': {e}")
288+
os.makedirs(dest_xla_dump_dir, exist_ok=True)
289+
shutil.copy(original_filepath, new_filepath)
297290
except Exception as e:
298-
print(f"An unexpected error occurred while renaming '{original_filepath}': {e}")
291+
print(f"An unexpected error occurred while copy '{original_filepath}': {e}")
299292
else:
300293
upload_to_storage(trace_dir=new_filepath, local_file=original_filepath)
294+
print(f"The XLA dump is stored in {dest_xla_dump_dir}")

src/hlo_helper.py

Lines changed: 0 additions & 161 deletions
This file was deleted.

0 commit comments

Comments
 (0)