pytorch
f8d331b3 - PyTorch Execution Graph Observers (#55957)

Commit
3 years ago
PyTorch Execution Graph Observers (#55957) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/55957 This diff adds an execution graph observer that tracks all operators (dispatcher autograd, jit, user defined, etc.) and their inputs and outputs. The results are written to a temp JSON file which can be used for further analysis. This support various use cases, such as dependency analysis, performance optimizations, etc. Some minor refactoring of existing code for clarity and completeness. Test Plan: Example output: {F603167736} ``` => buck build caffe2/torch/fb/observers:execution_graph_observer_runner --show-output => buck-out/gen/caffe2/torch/fb/observers/execution_graph_observer_runner --pytorch_enable_execution_graph_observer=true --pytorch_execution_graph_observer_iter_label="## START ##" --pytorch_execution_graph_observer_iter_target=3 I0414 01:26:55.834039 1038798 ExecutionGraphObserver.cpp:408] Enabled PyTorch execution graph observer I0414 01:26:55.834717 1038798 ExecutionGraphObserver.cpp:411] Matching iteration start label: "## START ##" I0414 01:26:55.834940 1038798 ExecutionGraphObserver.cpp:423] Target iteration: 3 I0414 01:26:55.835962 1038798 ExecutionGraphObserverRunner.cpp:50] Running test execution graph observer runner. I0414 01:26:55.836180 1038798 ExecutionGraphObserverRunner.cpp:51] iterations: 10 I0414 01:26:55.836419 1038798 ExecutionGraphObserverRunner.cpp:52] output file name: /tmp/pytorch_execution_graph_1618388815_1038798_3.json I0414 01:26:56.246432 1038798 ExecutionGraphObserver.cpp:137] Writing PyTorch execution graph to: /tmp/pytorch_execution_graph_1618388815_1038798_3.json I0414 01:26:56.278715 1038798 ExecutionGraphObserver.cpp:314] PyTorch execution graph is written to file: /tmp/pytorch_execution_graph_1618388815_1038798_3.json ``` see `/tmp/pytorch_execution_graph_[timestamp]_[process_id]_[iter_target].json` Reviewed By: albanD Differential Revision: D27238906 fbshipit-source-id: 3eb717d7d512e2d51d3162e9995b1ccd18e5a725
Author
Parents
Loading