Skip to content

Commit a22a2a8

Browse files
generatedunixname499836121facebook-github-bot
authored andcommitted
Add retain-output argument (#145921)
Summary: 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. X-link: pytorch/pytorch#145921 Approved by: https://github.com/jansel Reviewed By: ZainRizvi, atalman Differential Revision: D69208159 fbshipit-source-id: 0d635d89a697157185fdb22999ccf7daea6319f4
1 parent 4b4f550 commit a22a2a8

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

userbenchmark/dynamo/dynamobench/common.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3229,6 +3229,13 @@ def get_example_inputs(self):
32293229
help="Enables Memory Snapshot tool for memory deep dives: https://pytorch.org/blog/understanding-gpu-memory-1/",
32303230
)
32313231

3232+
parser.add_argument(
3233+
"--retain-output",
3234+
action="store_true",
3235+
help="Enables appending to the already existing output file if it exists \
3236+
instead of deleting it and creating a new one.",
3237+
)
3238+
32323239
group_latency = parser.add_mutually_exclusive_group()
32333240
group_latency.add_argument(
32343241
"--cold-start-latency",
@@ -4078,7 +4085,11 @@ def detect_and_mark_batch(t):
40784085
)
40794086
else:
40804087
metrics.purge_old_log_files()
4081-
if output_filename and os.path.exists(output_filename):
4088+
if (
4089+
output_filename
4090+
and os.path.exists(output_filename)
4091+
and not args.retain_output
4092+
):
40824093
os.unlink(output_filename)
40834094
if original_dir:
40844095
os.chdir(original_dir)

0 commit comments

Comments
 (0)