Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[profiler] add enabled API to autograd profiler #31380

Closed
wants to merge 3 commits into from

Conversation

rohan-varma
Copy link
Member

@rohan-varma rohan-varma commented Dec 17, 2019

Stack from ghstack:

For being able to profile async RPCs, we attach a RecordFunction object to the future that is created during the RPC to persist it across the lifetime of the RPC (this is implemented in the next PR:#31381 ). Since we'd only like to do this when profiling is enabled, this PR adds an enabled API to the autograd profiler.

Differential Revision: D19050391

For being able to profile async RPCs, we attach a `RecordFunction` object to the future that is created during the RPC to persist it across the lifetime of the RPC (this is implemented in the next PR: ). Since we'd only like to do this when profiling is enabled, this PR adds an enabled API to the autograd profiler.

Differential Revision: [D19050391](https://our.internmc.facebook.com/intern/diff/D19050391/)

[ghstack-poisoned]
@pritamdamania87
Copy link
Contributor

Don't we already check if the profiler is enabled in #31381 and attach the RecordFunction only in those cases? Otherwise the rf_ pointer is nullptr?

@rohan-varma
Copy link
Member Author

@pritamdamania87 : That check relies on this change, in particular, it uses torch.autograd._profiler_enabled() here: https://github.com/pytorch/pytorch/pull/31381/files#diff-5e438ccfe0d61a53077ec02243a79f07R277

For being able to profile async RPCs, we attach a `RecordFunction` object to the future that is created during the RPC to persist it across the lifetime of the RPC (this is implemented in the next PR:#31381  ). Since we'd only like to do this when profiling is enabled, this PR adds an enabled API to the autograd profiler.

Differential Revision: [D19050391](https://our.internmc.facebook.com/intern/diff/D19050391/)

[ghstack-poisoned]
rohan-varma added a commit that referenced this pull request Dec 20, 2019
Pull Request resolved: #31380

For being able to profile async RPCs, we attach a `RecordFunction` object to the future that is created during the RPC to persist it across the lifetime of the RPC (this is implemented in the next PR: ). Since we'd only like to do this when profiling is enabled, this PR adds an enabled API to the autograd profiler.
ghstack-source-id: 96040035

Differential Revision: [D19050391](https://our.internmc.facebook.com/intern/diff/D19050391/)
@kostmo
Copy link
Member

kostmo commented Dec 21, 2019

💊 CircleCI build failures summary and remediations

As of commit 9b40a7e:

  • 1/2 broken upstream at merge base 700109e (see grid view)

    You may want to rebase on the viable/strict branch (expand for instructions)

    If your commit is newer than viable/strict, you can try basing on an older, stable commit:

    git fetch origin viable/strict
    git rebase --onto viable/strict $(git merge-base origin/master HEAD)
    

    If your commit is older than viable/strict:

    git fetch origin viable/strict
    git rebase viable/strict
    

    Check out the recency history of this "viable master" tracking branch.

  • 1/2 failures introduced in this PR

Detailed failure analysis

One may explore the probable reasons each build failed interactively on the Dr. CI website.

🕵️ 1 new failure recognized by patterns

The following build failures don't appear to be due to upstream breakage:

See CircleCI build caffe2_onnx_py2_gcc5_ubuntu16_04_test (1/1)

Step: "Test" (full log | pattern match details)

Dec 21 11:16:48 E RuntimeError: required keyword attribute 'Y_scale' is undefined
Dec 21 11:16:48 k = 'Y_scale' 
Dec 21 11:16:48  
Dec 21 11:16:48     def _node_getitem(self, k): 
Dec 21 11:16:48         r""" 
Dec 21 11:16:48         Accessor for attributes of a node which is polymorphic over 
Dec 21 11:16:48         return type. 
Dec 21 11:16:48      
Dec 21 11:16:48         NB: This is monkey-patched onto Node. 
Dec 21 11:16:48         """ 
Dec 21 11:16:48 >       sel = self.kindOf(k) 
Dec 21 11:16:48 E       RuntimeError: required keyword attribute 'Y_scale' is undefined 
Dec 21 11:16:48  
Dec 21 11:16:48 ../.local/lib/python2.7/site-packages/torch/onnx/utils.py:836: RuntimeError 
Dec 21 11:16:48 =============================== warnings summary =============================== 
Dec 21 11:16:48 /usr/local/lib/python2.7/dist-packages/scipy/_lib/_numpy_compat.py:10 
Dec 21 11:16:48   /usr/local/lib/python2.7/dist-packages/scipy/_lib/_numpy_compat.py:10: DeprecationWarning: Importing from numpy.testing.nosetester is deprecated since 1.15.0, import from numpy.testing instead. 
Dec 21 11:16:48     from numpy.testing.nosetester import import_nose 
Dec 21 11:16:48  
Dec 21 11:16:48 /usr/local/lib/python2.7/dist-packages/scipy/stats/morestats.py:12 
Dec 21 11:16:48   /usr/local/lib/python2.7/dist-packages/scipy/stats/morestats.py:12: DeprecationWarning: Importing from numpy.testing.decorators is deprecated since numpy 1.15.0, import from numpy.testing instead. 
Dec 21 11:16:48     from numpy.testing.decorators import setastest 

🚧 1 upstream failure recognized by patterns:

These builds matched patterns, but were probably caused by upstream breakages:


This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.

Please report bugs/suggestions on the GitHub issue tracker.

This comment has been revised 7 times.

For being able to profile async RPCs, we attach a `RecordFunction` object to the future that is created during the RPC to persist it across the lifetime of the RPC (this is implemented in the next PR:#31381  ). Since we'd only like to do this when profiling is enabled, this PR adds an enabled API to the autograd profiler.

Differential Revision: [D19050391](https://our.internmc.facebook.com/intern/diff/D19050391/)

[ghstack-poisoned]
rohan-varma added a commit that referenced this pull request Dec 21, 2019
Pull Request resolved: #31380

For being able to profile async RPCs, we attach a `RecordFunction` object to the future that is created during the RPC to persist it across the lifetime of the RPC (this is implemented in the next PR: ). Since we'd only like to do this when profiling is enabled, this PR adds an enabled API to the autograd profiler.
ghstack-source-id: 96053933

Differential Revision: [D19050391](https://our.internmc.facebook.com/intern/diff/D19050391/)
@rohan-varma
Copy link
Member Author

Test failures are unrelated:

Dec 21 11:16:48 self = <[MemoryError("std::bad_alloc") raised in repr()] SafeRepr object at 0x7f634539b5f0>
Dec 21 11:16:48 k = 'Y_scale'
Dec 21 11:16:48 
Dec 21 11:16:48     def _node_getitem(self, k):
Dec 21 11:16:48         r"""
Dec 21 11:16:48         Accessor for attributes of a node which is polymorphic over
Dec 21 11:16:48         return type.
Dec 21 11:16:48     
Dec 21 11:16:48         NB: This is monkey-patched onto Node.
Dec 21 11:16:48         """
Dec 21 11:16:48 >       sel = self.kindOf(k)
Dec 21 11:16:48 E       RuntimeError: required keyword attribute 'Y_scale' is undefined
Dec 21 11:16:48 
Dec 21 11:16:48 ../.local/lib/python2.7/site-packages/torch/onnx/utils.py:836: RuntimeError

and

Dec 21 11:36:57 SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /var/lib/jenkins/workspace/third_party/fbgemm/src/QuantUtilsAvx2.cc:98:14 in 
Dec 21 11:36:57 Traceback (most recent call last):
Dec 21 11:36:57   File "test/run_test.py", line 456, in <module>
Dec 21 11:36:57     main()
Dec 21 11:36:57   File "test/run_test.py", line 449, in main
Dec 21 11:36:57     raise RuntimeError(message)
Dec 21 11:36:57 RuntimeError: test_quantization failed!
Dec 21 11:36:57 + cleanup
Dec 21 11:36:57 + retcode=1
Dec 21 11:36:57 + set +x

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in cc2d5ca.

@facebook-github-bot facebook-github-bot deleted the gh/rohan-varma/51/head branch December 26, 2019 15:17
wuhuikx pushed a commit to wuhuikx/pytorch that referenced this pull request Jan 30, 2020
Summary:
Pull Request resolved: pytorch#31380

For being able to profile async RPCs, we attach a `RecordFunction` object to the future that is created during the RPC to persist it across the lifetime of the RPC (this is implemented in the next PR: ). Since we'd only like to do this when profiling is enabled, this PR adds an enabled API to the autograd profiler.
ghstack-source-id: 96053933

Test Plan: Modified unit test.

Differential Revision: D19050391

fbshipit-source-id: aa382110e69d06b4a84c83b31d2bec2d8a81ba10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants