profile.py 358 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# See LICENSE for license information.
"""Utils for profiling"""

from contextlib import contextmanager

from paddle.fluid import core


@contextmanager
def nvtx_range(msg):
    """Context to insert NVTX"""
    core.nvprof_nvtx_push(msg)
    yield
    core.nvprof_nvtx_pop()