Add support for NVTX functions.#1748
Conversation
apaszke
left a comment
There was a problem hiding this comment.
I'd be nice to add support for colors too. Should be easy to do
setup.py
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
torch/cuda/nvtx.py
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
colesbury
left a comment
There was a problem hiding this comment.
A simple test would be good so at least we can check that the library is loaded correctly.
torch/cuda/nvtx.py
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
torch/cuda/nvtx.py
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
This looks good, just fix the lint and the Python 3 contbuild |
This commit adds support for the simple, ASCII message only
NVTX functions. There are a few more but these are the ones
I'm mostly interested in.
I tested by running this script under nvprof:
import torch.cuda.nvtx
torch.cuda.nvtx.range_push("foo")
torch.cuda.nvtx.mark("bar")
torch.cuda.nvtx.range_pop()
And verifying that the events showed up.
NB: An earlier version of this patch lazily loaded libNvExtTools.so.
At the prompting of @colesbury, we decided against this, because
dynamically loading the library means we can get into bad
situations where we load the wrong version of the library. If we
do it at build time, this situation won't occur.
Signed-off-by: Edward Z. Yang <ezyang@fb.com>
- Remove redundant imports from torch.cuda.nvtx - Import torch.cuda.nvtx from torch.cuda, so it becomes available when you import torch.cuda - Add a small, trivial test to test_cuda.py Signed-off-by: Edward Z. Yang <ezyang@fb.com>
Signed-off-by: Edward Z. Yang <ezyang@fb.com>
Signed-off-by: Edward Z. Yang <ezyang@fb.com>
|
All good! |
| global lib | ||
| if lib is None: | ||
| lib = ctypes.cdll.LoadLibrary(None) | ||
| lib.nvtxMarkA.restype = None |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
…8bdbe7 Summary: Previous import was fd60104394fa353e1762f44ecad1b2166e33deef Included changes: - **[c553fb3](onnx/onnx@c553fb3)**: Handle negative axis in scan shape inference (pytorch#1748) <G. Ramalingam> - **[51b6ecc](onnx/onnx@51b6ecc)**: external_data: Store large tensor values in separate files (pytorch#678) <Michał Karzyński> - **[ba05f26](onnx/onnx@ba05f26)**: Scan output axes (pytorch#1737) <G. Ramalingam> - **[90920c0](onnx/onnx@90920c0)**: Add NonZero op. (pytorch#1714) <Sergii Dymchenko> - **[c4cf112](onnx/onnx@c4cf112)**: fix the test cases for constantofshape (pytorch#1746) <Lu Fang> - **[d902349](onnx/onnx@d902349)**: Add sample implementation support (pytorch#1712) <Lu Fang> Differential Revision: D13745693 fbshipit-source-id: 057d827652e85ad19be8f0243d874e036bf69898
…8bdbe7 (#16190) Summary: Pull Request resolved: #16190 Previous import was fd60104394fa353e1762f44ecad1b2166e33deef Included changes: - **[c553fb3](onnx/onnx@c553fb3)**: Handle negative axis in scan shape inference (#1748) <G. Ramalingam> - **[51b6ecc](onnx/onnx@51b6ecc)**: external_data: Store large tensor values in separate files (#678) <Michał Karzyński> - **[ba05f26](onnx/onnx@ba05f26)**: Scan output axes (#1737) <G. Ramalingam> - **[90920c0](onnx/onnx@90920c0)**: Add NonZero op. (#1714) <Sergii Dymchenko> - **[c4cf112](onnx/onnx@c4cf112)**: fix the test cases for constantofshape (#1746) <Lu Fang> - **[d902349](onnx/onnx@d902349)**: Add sample implementation support (#1712) <Lu Fang> Differential Revision: D13745693 fbshipit-source-id: 05e2cce9ae1dfa2865db83840df64673d55cea57
This commit adds support for the simple, ASCII message only
NVTX functions. There are a few more but these are the ones
I'm mostly interested in.
I tested by running this script under nvprof:
And verifying that the events showed up.
Signed-off-by: Edward Z. Yang ezyang@fb.com