Skip to content

Commit

Permalink
_cudf_nvtx_annotate: add RMM's memory profiler
Browse files Browse the repository at this point in the history
  • Loading branch information
madsbk committed May 27, 2024
1 parent 8458306 commit 61093a4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions python/cudf/cudf/utils/nvtx_annotation.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Copyright (c) 2023, NVIDIA CORPORATION.
# Copyright (c) 2023-2024, NVIDIA CORPORATION.

import hashlib
from functools import partial

from nvtx import annotate

import rmm.statistics

_NVTX_COLORS = ["green", "blue", "purple", "rapids"]


Expand All @@ -18,11 +20,12 @@ def _get_color_for_nvtx(name):

def _cudf_nvtx_annotate(func, domain="cudf_python"):
"""Decorator for applying nvtx annotations to methods in cudf."""
return annotate(
nvtx_wrapped = annotate(
message=func.__qualname__,
color=_get_color_for_nvtx(func.__qualname__),
domain=domain,
)(func)
return rmm.statistics.profiler()(nvtx_wrapped)


_dask_cudf_nvtx_annotate = partial(
Expand Down

0 comments on commit 61093a4

Please sign in to comment.