Skip to content

Commit cd7f684

Browse files
authored
Update FR tutorial to include file path, writer and print usage (#3058)
* Update FR tutorial to include file path, writer and print usage
1 parent 0b23f46 commit cd7f684

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

prototype_source/flight_recorder_tutorial.rst

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ Enabling Flight Recorder
4848
------------------------
4949
There are two required environment variables to get the initial version of Flight Recorder working.
5050

51+
- ``TORCH_NCCL_DEBUG_INFO_TEMP_FILE``: Setting the path where the flight recorder will be dumped with file prefix. One file per
52+
rank. The default value is ``/tmp/nccl_trace_rank_``.
5153
- ``TORCH_NCCL_TRACE_BUFFER_SIZE = (0, N)``: Setting ``N`` to a positive number enables collection.
5254
``N`` represents the number of entries that will be kept internally in a circular buffer.
5355
We recommended to set this value at *2000*.
@@ -71,6 +73,9 @@ Additional Settings
7173

7274
``fast`` is a new experimental mode that is shown to be much faster than the traditional ``addr2line``.
7375
Use this setting in conjunction with ``TORCH_NCCL_TRACE_CPP_STACK`` to collect C++ traces in the Flight Recorder data.
76+
- If you prefer not to have the flight recorder data dumped into the local disk but rather onto your own storage, you can define your own writer class.
77+
This class should inherit from class ``::c10d::DebugInfoWriter`` and then register the new writer using ``::c10d::DebugInfoWriter::registerWriter``
78+
before we initiate PyTorch distributed.
7479

7580
Retrieving Flight Recorder Data via an API
7681
------------------------------------------
@@ -169,9 +174,29 @@ To run the convenience script, follow these steps:
169174

170175
2. To run the script, use this command:
171176

172-
.. code:: python
177+
.. code:: shell
178+
179+
python fr_trace.py <dump dir containing trace files> [-o <output file>]
180+
181+
If you install the PyTorch nightly build or build from scratch with ``USE_DISTRIBUTED=1``, you can directly use the following
182+
command directly:
183+
184+
.. code:: shell
185+
186+
torchfrtrace <dump dir containing trace files> [-o <output file>]
187+
188+
189+
Currently, we support two modes for the analyzer script. The first mode allows the script to apply some heuristics to the parsed flight
190+
recorder dumps to generate a report identifying potential culprits for the timeout. The second mode is simply outputs the raw dumps.
191+
By default, the script prints flight recoder dumps for all ranks and all ``ProcessGroups``(PGs). This can be narrowed down to certain
192+
ranks and PGs. An example command is:
193+
194+
Caveat: tabulate module is needed, so you might need pip install it first.
195+
196+
.. code:: shell
173197
174-
python fr_trace.py -d <dump dir containing trace files> [-o <output file>]
198+
python fr_trace.py <dump dir containing trace files> -j [--selected-ranks i j k ...]
199+
torchfrtrace <dump dir containing trace files> -j [--selected-ranks i j k ...]
175200
176201
Conclusion
177202
----------

0 commit comments

Comments
 (0)