Skip to content

Commit 368e062

Browse files
committed
Introduced TORCH_TRACE/tlparse
1 parent 134d92a commit 368e062

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

recipes_source/torch_logs.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,24 @@ def fn(x, y):
8888
except Exception as e:
8989
print(f"Error during {name}: {str(e)}")
9090

91-
if __name__ == "__main__":
92-
run_debugging_suite()
91+
92+
run_debugging_suite()
93+
94+
######################################################################
95+
# Use TORCH_TRACE/tlparse to produce produce compilation reports
96+
# ~~~~~~~~~~
97+
#
98+
# In this section, we introduce the usage of TORCH_TRACE and tlparse to produce reports.
99+
# First, we run `TORCH_TRACE="/tmp/tracedir" python script.py` to generate the raw trace logs.
100+
# We have replace `/tmp/tracedir` with a path to a directory you want to store the trace logs
101+
# and reaplce script with the name of your script.
102+
#
103+
# Next, we are going to pass the trace log to `tlparse` to generate compilation reports. We run
104+
# `pip install tlparse` and then `tlparse /tmp/tracedir`. This will open up your browser with
105+
# HTML like generated above.
106+
#
107+
# By default, reports generated by `tlparse` are
108+
# stored in the directory `tl_out`. You can change that by doing `tlparse /tmp/tracedir -o output_dir/`.
93109

94110
######################################################################
95111
# Conclusion

0 commit comments

Comments
 (0)