cupyx.profiler.time_range#

class cupyx.profiler.time_range(message=None, color_id=None, argb_color=None, sync=False)[source]#

Mark function calls with ranges using NVTX/rocTX. This object can be used either as a decorator or a context manager.

When used as a decorator, the decorated function calls are marked as ranges:

>>> from cupyx.profiler import time_range
>>> @time_range()
... def function_to_profile():
...     pass

When used as a context manager, it describes the enclosed block as a nested range:

>>> from cupyx.profiler import time_range
>>> with time_range('some range in green', color_id=0):
...    # do something you want to measure
...    pass

The marked ranges are visible in the profiler (such as nvvp, nsys-ui, etc) timeline.

Parameters
  • message (str) – Name of a range. When used as a decorator, the default is func.__name__.

  • color_id – range color ID

  • argb_color – range color in ARGB (e.g. 0xFF00FF00 for green)

  • sync (bool) – If True, waits for completion of all outstanding processing on GPU before calling cupy.cuda.nvtx.RangePush() or cupy.cuda.nvtx.RangePop()

Methods

__call__(func)[source]#

Call self as a function.

__enter__()[source]#
__exit__(exc_type, exc_value, traceback)[source]#
__eq__(value, /)#

Return self==value.

__ne__(value, /)#

Return self!=value.

__lt__(value, /)#

Return self<value.

__le__(value, /)#

Return self<=value.

__gt__(value, /)#

Return self>value.

__ge__(value, /)#

Return self>=value.