mxnet.profiler

Profiler setting methods.

Classes

Counter(domain, name[, value])

Profiling Counter class.

Domain(name)

Profiling domain, used to group sub-objects like tasks, counters, etc into categories

Event(name)

Profiling Event class.

Frame(domain, name)

Profiling Frame class.

Marker(domain, name)

Set marker for an instant in time.

Task(domain, name)

Profiling Task class.

Functions

dump([finished, profile_process])

Dump profile and stop profiler.

dump_profile()

Dump profile and stop profiler.

dumps([reset, format, sort_by, ascending])

Return a printable string of aggregate profile stats.

pause([profile_process])

Pause profiling.

profiler_set_config([mode, filename])

Set up the configure of profiler (Deprecated).

profiler_set_state([state])

Set up the profiler state to ‘run’ or ‘stop’ (Deprecated).

resume([profile_process])

Resume paused profiling.

set_config(**kwargs)

Set up the configure of profiler (only accepts keyword arguments).

set_state([state, profile_process])

Set up the profiler state to ‘run’ or ‘stop’.

class mxnet.profiler.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

increment(delta=1)[source]

Increment counter value.

Parameters

value_change (int) – Amount by which to add to the counter

set_value(value)[source]

Set counter value.

Parameters

value (int) – Value for the counter

class mxnet.profiler.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

new_marker(name)[source]

Create new Marker object owned by this domain

Parameters

name (string) – Name of the marker

new_task(name)[source]

Create new Task object owned by this domain

Parameters

name (string) – Name of the task

class mxnet.profiler.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

start()[source]

Start timing scope for this object

stop()[source]

Stop timing scope for this object

class mxnet.profiler.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

start()[source]

Start timing scope for this object

stop()[source]

Stop timing scope for this object

class mxnet.profiler.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.

mark(scope='process')[source]

Set up the profiler state to record operator.

Parameters

scope (string, optional) – Indicates what scope the marker should refer to. Can be ‘global’, ‘process’, thread’, task’, and ‘marker’ Default is process.

class mxnet.profiler.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

start()[source]

Start timing scope for this object

stop()[source]

Stop timing scope for this object

mxnet.profiler.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

mxnet.profiler.dump_profile()[source]

Dump profile and stop profiler. Use this to save profile in advance in case your program cannot exit normally.

mxnet.profiler.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

mxnet.profiler.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

mxnet.profiler.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’.

mxnet.profiler.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.

mxnet.profiler.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

mxnet.profiler.set_config(**kwargs)[source]

Set up the configure of profiler (only accepts keyword arguments).

Parameters
  • filename (string,) – output file for profile data

  • 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

mxnet.profiler.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