mirror of
https://github.com/saymrwulf/pytorch.git
synced 2026-05-14 20:57:59 +00:00
Add retain-output argument (#145921)
This PR add retain-output argument which enables appending to the already existing output file if it exists instead of deleting it and creating a new one. Pull Request resolved: https://github.com/pytorch/pytorch/pull/145921 Approved by: https://github.com/jansel
This commit is contained in:
parent
dd349207c5
commit
9da376daa6
1 changed files with 12 additions and 1 deletions
|
|
@ -3229,6 +3229,13 @@ def parse_args(args=None):
|
|||
help="Enables Memory Snapshot tool for memory deep dives: https://pytorch.org/blog/understanding-gpu-memory-1/",
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"--retain-output",
|
||||
action="store_true",
|
||||
help="Enables appending to the already existing output file if it exists \
|
||||
instead of deleting it and creating a new one.",
|
||||
)
|
||||
|
||||
group_latency = parser.add_mutually_exclusive_group()
|
||||
group_latency.add_argument(
|
||||
"--cold-start-latency",
|
||||
|
|
@ -4078,7 +4085,11 @@ def run(runner, args, original_dir=None):
|
|||
)
|
||||
else:
|
||||
metrics.purge_old_log_files()
|
||||
if output_filename and os.path.exists(output_filename):
|
||||
if (
|
||||
output_filename
|
||||
and os.path.exists(output_filename)
|
||||
and not args.retain_output
|
||||
):
|
||||
os.unlink(output_filename)
|
||||
if original_dir:
|
||||
os.chdir(original_dir)
|
||||
|
|
|
|||
Loading…
Reference in a new issue