diff options
author | James Reed <jamesreed@fb.com> | 2019-03-29 17:06:08 -0700 |
---|---|---|
committer | Facebook Github Bot <facebook-github-bot@users.noreply.github.com> | 2019-03-29 17:14:03 -0700 |
commit | 85f36014e2628fe291e94be8e5d156b4e6015afd (patch) | |
tree | d76d0f458e6c529a5025562bcc134483312936ad /.gitignore | |
parent | e2fd1d966fdf9ff384ba9d9e302f56146029f9f2 (diff) | |
download | pytorch-85f36014e2628fe291e94be8e5d156b4e6015afd.tar.gz pytorch-85f36014e2628fe291e94be8e5d156b4e6015afd.tar.bz2 pytorch-85f36014e2628fe291e94be8e5d156b4e6015afd.zip |
Experimental logging/counters API (#18235)
Summary:
This defines a generic counters API that users can utilize to provide monitoring functionality in e.g. a production service. We expose both counters for runtime internals as well as a TorchScript API to create user-defined counters. Synopsis of the API:
- `torch/csrc/jit/script/logging.h` specifies the externally-facing API in C++
- `torch/jit/_logging.py` specifies the Python API
We use an interface, `LoggerBase`, to define the interactions between users and a logging backend. Implementing a subclass of `LoggerBase` allows the user to handle these events in a custom way, such as logging into a DB or calling into an infra-specific counters API.
From the frontend perspective, we can create log events in two ways:
1. We provide an `add_stat_value(name, val)` function. This calls into the Logger backend with a key/value pair. For example, we might call `add_stat_value('foo', 1)` to bump an event counter.
2. We provide a `time_point()` function to record a timestamp in nanoseconds. This can be used in conjunction with `add_stat_value` to record runtime wall clock durations.
Examples of frontend usage can be found in `test_jit.py TestLogging`.
We provide a trivial `LockingLogger` implementation as an example and for testing purposes. It is likely not ready for production usage. It demonstrates that a backend implementing the API can do things like specify aggregation types and report these aggregate stats via the `get_counters()` API.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/18235
Differential Revision: D14545060
Pulled By: jamesr66a
fbshipit-source-id: 04099543a1898cfdd411511e46e03d5dce9b4881
Diffstat (limited to '.gitignore')
-rw-r--r-- | .gitignore | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore index 66eb2df0e4..b67a756efb 100644 --- a/.gitignore +++ b/.gitignore @@ -203,7 +203,6 @@ docs/dev *.sst *.ldb LOCK -LOG* CURRENT MANIFEST-* |