mxnet.profiler¶
Profiler setting methods.
Classes
|
Profiling Counter class. |
|
Profiling domain, used to group sub-objects like tasks, counters, etc into categories |
|
Profiling Event class. |
|
Profiling Frame class. |
|
Set marker for an instant in time. |
|
Profiling Task class. |
Functions
|
Dump profile and stop profiler. |
Dump profile and stop profiler. |
|
|
Return a printable string of aggregate profile stats. |
|
Pause profiling. |
|
Set up the configure of profiler (Deprecated). |
|
Set up the profiler state to ‘run’ or ‘stop’ (Deprecated). |
|
Resume paused profiling. |
|
Assign the profiler scope for the GPU memory profiler. |
|
Set up the configure of profiler (only accepts keyword arguments). |
|
Set up the profiler state to ‘run’ or ‘stop’. |
-
class
Counter
(domain, name, value=None)[source]¶ Bases:
object
Profiling Counter class.
The counter event can track a value as it changes over time.
- Parameters
domain (Domain object) – Domain to which this object belongs
name (string) – Name of the counter
value (integer, optional) – Initial value of the counter
Methods
decrement
([delta])Decrement counter value.
increment
([delta])Increment counter value.
set_value
(value)Set counter value.
-
decrement
(delta=1)[source]¶ Decrement counter value.
- Parameters
value_change (int) – Amount by which to subtract from the counter
-
class
Domain
(name)[source]¶ Bases:
object
Profiling domain, used to group sub-objects like tasks, counters, etc into categories Serves as part of ‘categories’ for chrome://tracing
Note: Domain handles are never destroyed.
- Parameters
name (string) – Name of the domain
Methods
new_counter
(name[, value])Create new Counter object owned by this domain
new_frame
(name)Create new Frame object owned by this domain
new_marker
(name)Create new Marker object owned by this domain
new_task
(name)Create new Task object owned by this domain
-
new_counter
(name, value=None)[source]¶ Create new Counter object owned by this domain
- Parameters
name (string) – Name of the counter
-
new_frame
(name)[source]¶ Create new Frame object owned by this domain
- Parameters
name (string) – Name of the frame
-
class
Event
(name)[source]¶ Bases:
object
Profiling Event class.
The event API is used to observe when demarcated events occur in your application, or to identify how long it takes to execute demarcated regions of code. Set annotations in the application to demarcate areas where events of interest occur. After running analysis, you can see the events marked in the Timeline pane. Event API is a per-thread function that works in resumed state. This function does not work in paused state.
- Parameters
name (string) – Name of the event
Methods
start
()Start timing scope for this object
stop
()Stop timing scope for this object
-
class
Frame
(domain, name)[source]¶ Bases:
object
Profiling Frame class.
Use the frame API to insert calls to the desired places in your code and analyze performance per frame, where frame is the time period between frame begin and end points. When frames are displayed in Intel VTune Amplifier, they are displayed in a separate track, so they provide a way to visually separate this data from normal task data.
This is different from Task in that each ‘Frame’ duration will be a discretely-numbered event in the VTune output, as well as its rate (frame-rate) shown. This is analogous to profiling each frame of some visual output, such as rendering a video game frame.
- Parameters
domain (Domain object) – Domain to which this object belongs
name (string) – Name of the frame
Methods
start
()Start timing scope for this object
stop
()Stop timing scope for this object
-
class
Marker
(domain, name)[source]¶ Bases:
object
Set marker for an instant in time.
The marker event marks a particular instant in time across some scope boundaries.
- Parameters
domain (Domain object) – Domain to which this object belongs
name (string) – Name of the marker
Methods
mark
([scope])Set up the profiler state to record operator.
-
class
Task
(domain, name)[source]¶ Bases:
object
Profiling Task class.
A task is a logical unit of work performed by a particular thread. Tasks can nest; thus, tasks typically correspond to functions, scopes, or a case block in a switch statement. You can use the Task API to assign tasks to threads.
This is different from Frame in that all profiling statistics for passes through the task’s begin and endpoints are accumulated together into a single statistical analysys, rather than a separate analysis for each pass (as with a Frame)
- Parameters
domain (Domain object) – Domain to which this object belongs
name (string) – Name of the task
Methods
start
()Start timing scope for this object
stop
()Stop timing scope for this object
-
dump
(finished=True, profile_process='worker')[source]¶ Dump profile and stop profiler. Use this to save profile in advance in case your program cannot exit normally.
- Parameters
finished (boolean) – Indicates whether to stop statistic output (dumping) after this dump. Default is True
profile_process (string) – whether to profile kvstore server or worker. server can only be profiled when kvstore is of type dist. if this is not passed, defaults to worker
-
dump_profile
()[source]¶ Dump profile and stop profiler. Use this to save profile in advance in case your program cannot exit normally.
-
dumps
(reset=False, format='table', sort_by='total', ascending=False)[source]¶ Return a printable string of aggregate profile stats.
- Parameters
reset (boolean) – indicates whether to clean aggeregate statistical data collected up to this point
format (string) – whether to return the aggregate stats in table of json format can take ‘table’ or ‘json’ defaults to ‘table’
sort_by (string) – can take ‘total’, ‘avg’, ‘min’, ‘max’, or ‘count’ by which stat to sort the entries in each category defaults to ‘total’
ascending (boolean) – whether to sort ascendingly defaults to False
-
pause
(profile_process='worker')[source]¶ Pause profiling.
- Parameters
profile_process (string) – whether to profile kvstore server or worker. server can only be profiled when kvstore is of type dist. if this is not passed, defaults to worker
-
profiler_set_config
(mode='symbolic', filename='profile.json')[source]¶ Set up the configure of profiler (Deprecated).
- Parameters
mode (string, optional) – Indicates whether to enable the profiler, can be ‘symbolic’, or ‘all’. Defaults to symbolic.
filename (string, optional) – The name of output trace file. Defaults to ‘profile.json’.
-
profiler_set_state
(state='stop')[source]¶ Set up the profiler state to ‘run’ or ‘stop’ (Deprecated).
- Parameters
state (string, optional) – Indicates whether to run the profiler, can be ‘stop’ or ‘run’. Default is stop.
-
resume
(profile_process='worker')[source]¶ Resume paused profiling.
- Parameters
profile_process (string) – whether to profile kvstore server or worker. server can only be profiled when kvstore is of type dist. if this is not passed, defaults to worker
-
scope
(name='<unk>:', append_mode=True)[source]¶ Assign the profiler scope for the GPU memory profiler.
It is implicitly invoked when the Gluon API is used.
- Parameters
name (Name of the Profiler Scope) –
append_mode (Whether to append the old profiler scope at the front.) –
-
set_config
(**kwargs)[source]¶ Set up the configure of profiler (only accepts keyword arguments).
- Parameters
filename (string,) – output file for profile data
gpu_memory_profile_filename_prefix (string) – filename prefix for the GPU memory profile
profile_all (boolean,) – all profile types enabled
profile_symbolic (boolean,) – whether to profile symbolic operators
profile_imperative (boolean,) – whether to profile imperative operators
profile_memory (boolean,) – whether to profile memory usage
profile_api (boolean,) – whether to profile the C API
continuous_dump (boolean,) – whether to periodically dump profiling data to file
dump_period (float,) – seconds between profile data dumps
aggregate_stats (boolean,) – whether to maintain aggregate stats in memory for console dump. Has some negative performance impact.
profile_process (string) – whether to profile kvstore server or worker. server can only be profiled when kvstore is of type dist. if this is not passed, defaults to worker
-
set_state
(state='stop', profile_process='worker')[source]¶ Set up the profiler state to ‘run’ or ‘stop’.
- Parameters
state (string, optional) – Indicates whether to run the profiler, can be ‘stop’ or ‘run’. Default is stop.
profile_process (string) – whether to profile kvstore server or worker. server can only be profiled when kvstore is of type dist. if this is not passed, defaults to worker