Skip to content

Added new time profiler HandlersTimeProfiler which allows per handler time profiling #1398

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

Merged
merged 18 commits into from
Oct 31, 2020
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
e94f66c
added new HandlersTimeProfiler with handler level details and added t…
harsh8398 Oct 23, 2020
02b2c8b
updated docs and docstring for HandlersTimeProfiler (#1346)
harsh8398 Oct 23, 2020
b0859bf
Merge branch 'master' into master
harsh8398 Oct 23, 2020
2b8c97e
updated HandlersTimeProfiler to support any events and updated detach…
harsh8398 Oct 24, 2020
3a9cd9d
Merge remote-tracking branch 'upstream/master'
harsh8398 Oct 26, 2020
f800759
updated HandlersTimeProfiler with code improvements and implemented c…
harsh8398 Oct 26, 2020
3830cb6
updated HandlersTimeProfiler to handle event handler bundle better (#…
harsh8398 Oct 27, 2020
47655c2
Merge branch 'master' into master
harsh8398 Oct 27, 2020
1075fbd
Merge remote-tracking branch 'upstream/master'
harsh8398 Oct 30, 2020
7f7fb75
HandlersTimeProfiler: added threshold for filtering profiled time for…
harsh8398 Oct 30, 2020
fe5eff3
Merge branch 'master' of github.com:harsh8398/ignite
harsh8398 Oct 30, 2020
2574349
HandlersTimeProfiler: add tests and type hints (#1398)
harsh8398 Oct 31, 2020
3d775dc
Merge branch 'master' into master
vfdev-5 Oct 31, 2020
93b5a54
HandlersTimeProfiler: use FloatTensor for list to tensor conversion (…
harsh8398 Oct 31, 2020
5d96d7e
Merge branch 'master' of github.com:harsh8398/ignite
harsh8398 Oct 31, 2020
0ec0f55
HandlersTimeProfiler: use torch.tensor for list to tensor conversion …
harsh8398 Oct 31, 2020
4b7d4cd
HandlersTimeProfiler: remove unnecessary import (#1398)
harsh8398 Oct 31, 2020
593961c
HandlersTimeProfiler: move tensor conversion in compute_basic_stats (…
harsh8398 Oct 31, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 47 additions & 1 deletion docs/source/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ Simpliest way to fetch time of single epoch and complete training is to use
For details, see :class:`~ignite.engine.events.State`.


Detailed profiling
Basic time profiling
``````````````````

User can setup :class:`~ignite.contrib.handlers.time_profilers.BasicTimeProfiler` to fetch times spent in data
Expand Down Expand Up @@ -446,6 +446,52 @@ Typical output:
For details, see :class:`~ignite.contrib.handlers.time_profilers.BasicTimeProfiler`.


Event handlers time profiling
``````````````````

If you want to get time breakdown per handler basis then you can setup
:class:`~ignite.contrib.handlers.time_profilers.HandlersTimeProfiler`:

.. code-block:: python

from ignite.contrib.handlers import HandlersTimeProfiler

trainer = ...

# Create an object of the profiler and attach an engine to it
profiler = HandlersTimeProfiler()
profiler.attach(trainer)

@trainer.on(Events.EPOCH_COMPLETED(every=10))
def log_intermediate_results():
profiler.print_results(profiler.get_results())

trainer.run(dataloader, max_epochs=3)

Typical output:

.. code-block:: text

----------------------------------------- ----------------------- -------------- ...
Handler Event Name Total(s)
----------------------------------------- ----------------------- --------------
run.<locals>.log_training_results EPOCH_COMPLETED 19.43245
run.<locals>.log_validation_results EPOCH_COMPLETED 2.55271
run.<locals>.log_time EPOCH_COMPLETED 0.00049
run.<locals>.log_intermediate_results EPOCH_COMPLETED 0.00106
run.<locals>.log_training_loss ITERATION_COMPLETED 0.059
run.<locals>.log_time COMPLETED not triggered
----------------------------------------- ----------------------- --------------
Total 22.04571
----------------------------------------- ----------------------- --------------
Processing took total 11.29543s [min/index: 0.00393s/1875, max/index: 0.00784s/0,
mean: 0.00602s, std: 0.00034s]
Dataflow took total 16.24365s [min/index: 0.00533s/1874, max/index: 0.01129s/937,
mean: 0.00866s, std: 0.00113s]

For details, see :class:`~ignite.contrib.handlers.time_profilers.HandlersTimeProfiler`.


Custom time measures
````````````````````

Expand Down
2 changes: 1 addition & 1 deletion ignite/contrib/handlers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from ignite.contrib.handlers.polyaxon_logger import PolyaxonLogger
from ignite.contrib.handlers.stores import EpochOutputStore
from ignite.contrib.handlers.tensorboard_logger import TensorboardLogger
from ignite.contrib.handlers.time_profilers import BasicTimeProfiler
from ignite.contrib.handlers.time_profilers import BasicTimeProfiler, HandlersTimeProfiler
from ignite.contrib.handlers.tqdm_logger import ProgressBar
from ignite.contrib.handlers.trains_logger import TrainsLogger
from ignite.contrib.handlers.visdom_logger import VisdomLogger
Expand Down
Loading