Files
rocm-systems/source/python/rocprofsys/__init__.py
T

90 rader
2.7 KiB
Python
Normal vy Historik

2022-04-21 21:36:07 -05:00
#!/usr/bin/env python@_VERSION@
2022-04-05 00:24:34 -05:00
# MIT License
#
2025-01-15 13:06:12 -05:00
# Copyright (c) 2025 Advanced Micro Devices, Inc. All Rights Reserved.
2022-04-05 00:24:34 -05:00
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
from __future__ import absolute_import
__author__ = "AMD ROCm"
__copyright__ = "Copyright 2024, Advanced Micro Devices, Inc."
2022-04-05 00:24:34 -05:00
__license__ = "MIT"
__version__ = "@PROJECT_VERSION@"
__maintainer__ = "AMD ROCm"
2022-04-05 00:24:34 -05:00
__status__ = "Development"
"""
This submodule imports the timemory Python function profiler
"""
try:
2022-08-28 03:56:13 -05:00
import os
os.environ["ROCPROFSYS_PATH"] = os.path.abspath(
2022-08-28 03:56:13 -05:00
os.path.join(os.path.dirname(__file__), "../../..")
)
from .libpyrocprofsys import coverage
2022-07-25 20:24:34 -05:00
from . import user
2022-04-05 00:24:34 -05:00
from .profiler import Profiler, FakeProfiler
from .libpyrocprofsys.profiler import (
2022-04-05 00:24:34 -05:00
profiler_function,
profiler_init,
profiler_finalize,
)
from .libpyrocprofsys import initialize
from .libpyrocprofsys import finalize
from .libpyrocprofsys import is_initialized
from .libpyrocprofsys import is_finalized
from .libpyrocprofsys.profiler import config as Config
2022-04-05 00:24:34 -05:00
config = Config
profile = Profiler
noprofile = FakeProfiler
__all__ = [
"initialize",
"finalize",
2022-04-05 20:40:27 -05:00
"is_initialized",
"is_finalized",
2022-04-05 00:24:34 -05:00
"Profiler",
"Config",
"FakeProfiler",
"profiler_function",
"profiler_init",
"profiler_finalize",
"config",
"profile",
"noprofile",
2022-05-08 01:40:56 -05:00
"coverage",
2022-07-25 20:24:34 -05:00
"user",
2022-04-05 00:24:34 -05:00
]
2022-04-05 20:40:27 -05:00
import atexit
def _finalize_at_exit():
if not is_finalized():
finalize()
atexit.register(_finalize_at_exit)
2022-04-05 00:24:34 -05:00
except Exception as e:
print("{}".format(e))