Rename Omnitrace to ROCm Systems Profiler (#4)
The Omnitrace program is being renamed.
Full name: "ROCm Systems Profiler"
Package name: "rocprofiler-systems"
Binary / Library names: "rocprof-sys-*"
---------
Co-authored-by: Xuan Chen <xuchen@amd.com>
Signed-off-by: David Galiffi <David.Galiffi@amd.com>
[ROCm/rocprofiler-systems commit: d07bf508a9]
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
c444ba6131
Коммит
489eda995d
@@ -1,12 +1,12 @@
|
||||
# ########################################################################################
|
||||
#
|
||||
# omnitrace (Python)
|
||||
# rocprofsys (Python)
|
||||
#
|
||||
# ########################################################################################
|
||||
|
||||
if(OMNITRACE_BUILD_STATIC_LIBSTDCXX)
|
||||
# omnitrace_message(FATAL_ERROR "static libstdc++ is not compatible with python
|
||||
# bindings")
|
||||
if(ROCPROFSYS_BUILD_STATIC_LIBSTDCXX)
|
||||
# rocprofiler_systems_message(FATAL_ERROR "static libstdc++ is not compatible with
|
||||
# python bindings")
|
||||
endif()
|
||||
|
||||
# if set, will screw up loading library
|
||||
@@ -17,27 +17,27 @@ set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME python)
|
||||
|
||||
# ########################################################################################
|
||||
|
||||
function(OMNITRACE_CONFIGURE_PYTARGET _TARGET _VERSION)
|
||||
function(ROCPROFILER_SYSTEMS_CONFIGURE_PYTARGET _TARGET _VERSION)
|
||||
|
||||
add_library(omnitrace::${_TARGET} ALIAS ${_TARGET})
|
||||
target_link_libraries(${_TARGET} PRIVATE libpyomnitrace-interface)
|
||||
add_dependencies(libpyomnitrace ${_TARGET})
|
||||
add_library(rocprofiler-systems::${_TARGET} ALIAS ${_TARGET})
|
||||
target_link_libraries(${_TARGET} PRIVATE libpyrocprofiler-systems-interface)
|
||||
add_dependencies(libpyrocprofsys ${_TARGET})
|
||||
|
||||
set_target_properties(
|
||||
${_TARGET}
|
||||
PROPERTIES PREFIX ""
|
||||
OUTPUT_NAME libpyomnitrace
|
||||
OUTPUT_NAME libpyrocprofsys
|
||||
LIBRARY_OUTPUT_DIRECTORY
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/omnitrace
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/rocprofsys
|
||||
ARCHIVE_OUTPUT_DIRECTORY
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/omnitrace
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/rocprofsys
|
||||
RUNTIME_OUTPUT_DIRECTORY
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/omnitrace
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/rocprofsys
|
||||
PDB_OUTPUT_DIRECTORY
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/omnitrace
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/rocprofsys
|
||||
${EXTRA_PROPERTIES})
|
||||
|
||||
set(_PYLIB ${CMAKE_INSTALL_PYTHONDIR}/omnitrace)
|
||||
set(_PYLIB ${CMAKE_INSTALL_PYTHONDIR}/rocprofsys)
|
||||
if(NOT IS_ABSOLUTE "${_PYLIB}")
|
||||
set(_PYLIB ${CMAKE_INSTALL_PREFIX}/${_PYLIB})
|
||||
endif()
|
||||
@@ -54,71 +54,72 @@ function(OMNITRACE_CONFIGURE_PYTARGET _TARGET _VERSION)
|
||||
|
||||
install(
|
||||
TARGETS ${_TARGET}
|
||||
DESTINATION ${CMAKE_INSTALL_PYTHONDIR}/omnitrace
|
||||
DESTINATION ${CMAKE_INSTALL_PYTHONDIR}/rocprofsys
|
||||
OPTIONAL)
|
||||
endfunction()
|
||||
|
||||
# ########################################################################################
|
||||
|
||||
add_library(omnitrace-python-compile-options INTERFACE)
|
||||
add_library(omnitrace::omnitrace-python-compile-options ALIAS
|
||||
omnitrace-python-compile-options)
|
||||
add_library(rocprofiler-systems-python-compile-options INTERFACE)
|
||||
add_library(rocprofiler-systems::rocprofiler-systems-python-compile-options ALIAS
|
||||
rocprofiler-systems-python-compile-options)
|
||||
add_target_cxx_flag_if_avail(
|
||||
omnitrace-python-compile-options "-Wno-unused-value" "-Wno-range-loop-analysis"
|
||||
"-Wno-deprecated-declarations" "-Wno-unused-but-set-parameter"
|
||||
"-ftls-model=global-dynamic")
|
||||
rocprofiler-systems-python-compile-options "-Wno-unused-value"
|
||||
"-Wno-range-loop-analysis" "-Wno-deprecated-declarations"
|
||||
"-Wno-unused-but-set-parameter" "-ftls-model=global-dynamic")
|
||||
|
||||
file(GLOB pyheaders ${CMAKE_CURRENT_LIST_DIR}/libpyomnitrace*.hpp)
|
||||
set(pysources ${CMAKE_CURRENT_LIST_DIR}/libpyomnitrace.cpp)
|
||||
file(GLOB pyheaders ${CMAKE_CURRENT_LIST_DIR}/libpyrocprofsys*.hpp)
|
||||
set(pysources ${CMAKE_CURRENT_LIST_DIR}/libpyrocprofsys.cpp)
|
||||
|
||||
set(pybind_libs pybind11::module)
|
||||
|
||||
add_library(libpyomnitrace-interface INTERFACE)
|
||||
add_library(libpyrocprofiler-systems-interface INTERFACE)
|
||||
target_link_libraries(
|
||||
libpyomnitrace-interface
|
||||
libpyrocprofiler-systems-interface
|
||||
INTERFACE pybind11::module
|
||||
timemory::timemory-headers
|
||||
omnitrace::omnitrace-headers
|
||||
omnitrace::omnitrace-compile-options
|
||||
omnitrace::omnitrace-static-libgcc-optional
|
||||
omnitrace::omnitrace-lto
|
||||
omnitrace::omnitrace-dl-library
|
||||
omnitrace::omnitrace-user-library
|
||||
omnitrace::omnitrace-python
|
||||
omnitrace::omnitrace-python-compile-options)
|
||||
rocprofiler-systems::rocprofiler-systems-headers
|
||||
rocprofiler-systems::rocprofiler-systems-compile-options
|
||||
rocprofiler-systems::rocprofiler-systems-static-libgcc-optional
|
||||
rocprofiler-systems::rocprofiler-systems-lto
|
||||
rocprofiler-systems::rocprofiler-systems-dl-library
|
||||
rocprofiler-systems::rocprofiler-systems-user-library
|
||||
rocprofiler-systems::rocprofiler-systems-python
|
||||
rocprofiler-systems::rocprofiler-systems-python-compile-options)
|
||||
|
||||
omnitrace_target_compile_definitions(libpyomnitrace-interface
|
||||
INTERFACE OMNITRACE_PYBIND11_SOURCE)
|
||||
rocprofiler_systems_target_compile_definitions(libpyrocprofiler-systems-interface
|
||||
INTERFACE ROCPROFSYS_PYBIND11_SOURCE)
|
||||
|
||||
add_custom_target(libpyomnitrace)
|
||||
add_custom_target(libpyrocprofsys)
|
||||
|
||||
file(GLOB_RECURSE PYTHON_FILES ${CMAKE_CURRENT_SOURCE_DIR}/omnitrace/*.py)
|
||||
file(GLOB_RECURSE PYTHON_FILES ${CMAKE_CURRENT_SOURCE_DIR}/rocprofsys/*.py)
|
||||
foreach(_IN ${PYTHON_FILES})
|
||||
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/omnitrace"
|
||||
"${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/omnitrace" _OUT
|
||||
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/rocprofsys"
|
||||
"${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/rocprofsys" _OUT
|
||||
"${_IN}")
|
||||
configure_file(${_IN} ${_OUT} @ONLY)
|
||||
install(
|
||||
FILES ${_OUT}
|
||||
DESTINATION ${CMAKE_INSTALL_PYTHONDIR}/omnitrace
|
||||
DESTINATION ${CMAKE_INSTALL_PYTHONDIR}/rocprofsys
|
||||
OPTIONAL)
|
||||
endforeach()
|
||||
|
||||
omnitrace_python_console_script("omnitrace-python" "omnitrace")
|
||||
rocprofiler_systems_python_console_script("${BINARY_NAME_PREFIX}-python" "rocprofsys")
|
||||
|
||||
set(_INDEX 0)
|
||||
foreach(_VERSION ${OMNITRACE_PYTHON_VERSIONS})
|
||||
# add_library(libpyomnitrace MODULE ${pysources} ${pyheaders})
|
||||
list(GET OMNITRACE_PYTHON_ROOT_DIRS ${_INDEX} Python3_ROOT_DIR)
|
||||
omnitrace_pybind11_add_module(
|
||||
libpyomnitrace-${_VERSION} MODULE
|
||||
foreach(_VERSION ${ROCPROFSYS_PYTHON_VERSIONS})
|
||||
# add_library(libpyrocprofsys MODULE ${pysources} ${pyheaders})
|
||||
list(GET ROCPROFSYS_PYTHON_ROOT_DIRS ${_INDEX} Python3_ROOT_DIR)
|
||||
rocprofiler_systems_pybind11_add_module(
|
||||
libpyrocprofiler-systems-${_VERSION} MODULE
|
||||
PYTHON_VERSION ${_VERSION}
|
||||
VISIBILITY "hidden" ${pysources} ${pyheaders})
|
||||
omnitrace_configure_pytarget(libpyomnitrace-${_VERSION} ${_VERSION})
|
||||
rocprofiler_systems_configure_pytarget(libpyrocprofiler-systems-${_VERSION}
|
||||
${_VERSION})
|
||||
|
||||
if(OMNITRACE_USE_PYTHON)
|
||||
omnitrace_python_console_script(
|
||||
"omnitrace-python" "omnitrace"
|
||||
if(ROCPROFSYS_USE_PYTHON)
|
||||
rocprofiler_systems_python_console_script(
|
||||
"${BINARY_NAME_PREFIX}-python" "rocprofsys"
|
||||
VERSION ${_VERSION}
|
||||
ROOT_DIR "${Python3_ROOT_DIR}")
|
||||
endif()
|
||||
|
||||
@@ -54,20 +54,21 @@ foreach(_VAR FIND_STRATEGY FIND_VIRTUALENV FIND_FRAMEWORK FIND_IMPLEMENTATIONS
|
||||
if(DEFINED Python3_${_VAR})
|
||||
set(Python_${_VAR}
|
||||
"${Python3_${_VAR}}"
|
||||
CACHE STRING "Set via Python3_${_VAR} setting (omnitrace)")
|
||||
CACHE STRING "Set via Python3_${_VAR} setting (rocprofsys)")
|
||||
mark_as_advanced(Python_${_VAR})
|
||||
mark_as_advanced(Python3_${_VAR})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# display version
|
||||
omnitrace_add_feature(OMNITRACE_PYTHON_VERSIONS "Python version for omnitrace" DOC)
|
||||
rocprofiler_systems_add_feature(ROCPROFSYS_PYTHON_VERSIONS
|
||||
"Python version for rocprofsys" DOC)
|
||||
|
||||
option(PYBIND11_INSTALL "Enable Pybind11 installation" OFF)
|
||||
|
||||
if(OMNITRACE_BUILD_PYTHON AND NOT TARGET pybind11)
|
||||
if(ROCPROFSYS_BUILD_PYTHON AND NOT TARGET pybind11)
|
||||
# checkout PyBind11 if not checked out
|
||||
omnitrace_checkout_git_submodule(
|
||||
rocprofiler_systems_checkout_git_submodule(
|
||||
RECURSIVE
|
||||
RELATIVE_PATH external/pybind11
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
@@ -78,15 +79,16 @@ if(OMNITRACE_BUILD_PYTHON AND NOT TARGET pybind11)
|
||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION OFF)
|
||||
endif()
|
||||
set(PYBIND11_NOPYTHON ON)
|
||||
omnitrace_save_variables(IPO VARIABLES CMAKE_INTERPROCEDURAL_OPTIMIZATION)
|
||||
rocprofiler_systems_save_variables(IPO VARIABLES CMAKE_INTERPROCEDURAL_OPTIMIZATION)
|
||||
add_subdirectory(${PROJECT_SOURCE_DIR}/external/pybind11)
|
||||
omnitrace_restore_variables(IPO VARIABLES CMAKE_INTERPROCEDURAL_OPTIMIZATION)
|
||||
rocprofiler_systems_restore_variables(IPO
|
||||
VARIABLES CMAKE_INTERPROCEDURAL_OPTIMIZATION)
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND ${PYTHON_EXECUTABLE} -c
|
||||
"import time ; print('{} {}'.format(time.ctime(), time.tzname[0]))"
|
||||
OUTPUT_VARIABLE OMNITRACE_INSTALL_DATE
|
||||
OUTPUT_VARIABLE ROCPROFSYS_INSTALL_DATE
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
|
||||
|
||||
string(REPLACE " " " " OMNITRACE_INSTALL_DATE "${OMNITRACE_INSTALL_DATE}")
|
||||
string(REPLACE " " " " ROCPROFSYS_INSTALL_DATE "${ROCPROFSYS_INSTALL_DATE}")
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
function(OMNITRACE_FIND_PYTHON _VAR)
|
||||
function(ROCPROFILER_SYSTEMS_FIND_PYTHON _VAR)
|
||||
set(options REQUIRED QUIET)
|
||||
set(args VERSION ROOT_DIR)
|
||||
set(kwargs COMPONENTS)
|
||||
@@ -68,13 +68,13 @@ function(OMNITRACE_FIND_PYTHON _VAR)
|
||||
"${_PYTHON_VERSION_LIST}"
|
||||
PARENT_SCOPE)
|
||||
else()
|
||||
omnitrace_message(WARNING "${_PYTHON_ERROR_VALUE}")
|
||||
rocprofiler_systems_message(WARNING "${_PYTHON_ERROR_VALUE}")
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
#
|
||||
# Internal: find the appropriate link time optimization flags for this compiler
|
||||
function(_OMNITRACE_PYBIND11_ADD_LTO_FLAGS target_name prefer_thin_lto)
|
||||
function(_ROCPROFSYS_PYBIND11_ADD_LTO_FLAGS target_name prefer_thin_lto)
|
||||
# Checks whether the given CXX/linker flags can compile and link a cxx file. cxxflags
|
||||
# and linkerflags are lists of flags to use. The result variable is a unique variable
|
||||
# name for each set of flags: the compilation result will be cached base on the result
|
||||
@@ -141,9 +141,9 @@ function(_OMNITRACE_PYBIND11_ADD_LTO_FLAGS target_name prefer_thin_lto)
|
||||
endif()
|
||||
|
||||
if(PYBIND11_LTO_CXX_FLAGS)
|
||||
omnitrace_message(STATUS "${target_name} :: LTO enabled")
|
||||
rocprofiler_systems_message(STATUS "${target_name} :: LTO enabled")
|
||||
else()
|
||||
omnitrace_message(
|
||||
rocprofiler_systems_message(
|
||||
STATUS
|
||||
"${target_name} :: LTO disabled (not supported by the compiler and/or linker)"
|
||||
)
|
||||
@@ -162,14 +162,14 @@ function(_OMNITRACE_PYBIND11_ADD_LTO_FLAGS target_name prefer_thin_lto)
|
||||
endif()
|
||||
endfunction()
|
||||
#
|
||||
function(OMNITRACE_PYBIND11_ADD_MODULE target_name)
|
||||
function(ROCPROFILER_SYSTEMS_PYBIND11_ADD_MODULE target_name)
|
||||
set(options MODULE SHARED EXCLUDE_FROM_ALL NO_EXTRAS SYSTEM THIN_LTO LTO)
|
||||
set(args PYTHON_VERSION VISIBILITY CXX_STANDARD)
|
||||
set(kwargs)
|
||||
cmake_parse_arguments(ARG "${options}" "${args}" "${kwargs}" ${ARGN})
|
||||
|
||||
if(ARG_MODULE AND ARG_SHARED)
|
||||
omnitrace_message(FATAL_ERROR "Can't be both MODULE and SHARED")
|
||||
rocprofiler_systems_message(FATAL_ERROR "Can't be both MODULE and SHARED")
|
||||
elseif(ARG_SHARED)
|
||||
set(lib_type SHARED)
|
||||
else()
|
||||
@@ -261,7 +261,7 @@ function(OMNITRACE_PYBIND11_ADD_MODULE target_name)
|
||||
endif()
|
||||
|
||||
if(ARG_LTO OR ARG_THIN_LTO)
|
||||
_omnitrace_pybind11_add_lto_flags(${target_name} ${ARG_THIN_LTO})
|
||||
_rocprofiler_systems_pybind11_add_lto_flags(${target_name} ${ARG_THIN_LTO})
|
||||
endif()
|
||||
|
||||
if(NOT MSVC AND NOT ${CMAKE_BUILD_TYPE} MATCHES Debug|RelWithDebInfo)
|
||||
|
||||
@@ -16,6 +16,6 @@ global-exclude *__pycache__*
|
||||
|
||||
# recursive excludes
|
||||
|
||||
recursive-exclude omnitrace_causal_viewer.egg-info *
|
||||
recursive-exclude rocprofsys_causal_viewer.egg-info *
|
||||
recursive-exclude build *
|
||||
recursive-exclude dist *
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Omnitrace Causal Viewer
|
||||
# ROCm Systems Profiler Causal Viewer
|
||||
|
||||
## Installation
|
||||
|
||||
@@ -13,13 +13,13 @@ python -m pip install .
|
||||
#### Console Script
|
||||
|
||||
```console
|
||||
omnitrace-causal-plot <args...>
|
||||
rocprof-sys-causal-plot <args...>
|
||||
```
|
||||
|
||||
#### Module
|
||||
|
||||
```console
|
||||
python -m omnitrace_causal_viewer <args...>
|
||||
python -m rocprof-sys_causal_viewer <args...>
|
||||
```
|
||||
|
||||
### From source tree
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
[metadata]
|
||||
name = omnitrace-causal-viewer
|
||||
url = https://github.com/ROCm/omnitrace
|
||||
download_url = https://github.com/ROCm/omnitrace.git
|
||||
name = rocprof-sys-causal-viewer
|
||||
url = https://github.com/ROCm/rocprofiler-systems
|
||||
download_url = https://github.com/ROCm/rocprofiler-systems.git
|
||||
maintainer = AMD Research
|
||||
license = MIT
|
||||
description = GUI for viewing Omnitrace causal profiles
|
||||
description = GUI for viewing ROCm Systems Profiler causal profiles
|
||||
keywords =
|
||||
gui
|
||||
causal profiling
|
||||
@@ -22,7 +22,7 @@ classifiers =
|
||||
Programming Language :: Python :: 3
|
||||
|
||||
[options]
|
||||
packages = omnitrace_causal_viewer
|
||||
packages = rocprof_sys_causal_viewer
|
||||
zip_safe = true
|
||||
include_package_data = true
|
||||
|
||||
|
||||
@@ -47,16 +47,16 @@ def parse_requirements(fname="requirements.txt"):
|
||||
|
||||
|
||||
setup(
|
||||
name="omnitrace-causal-viewer",
|
||||
name="rocprof-sys-causal-viewer",
|
||||
version=get_project_version(),
|
||||
description="GUI for viewing causal profilers",
|
||||
long_description=get_long_description(),
|
||||
long_description_content_type="text/markdown",
|
||||
author="AMD Research",
|
||||
packages=["omnitrace_causal_viewer"],
|
||||
package_dir={"omnitrace_causal_viewer": "source"},
|
||||
packages=["rocprof_sys_causal_viewer"],
|
||||
package_dir={"rocprof_sys_causal_viewer": "source"},
|
||||
package_data={
|
||||
"omnitrace_causal_viewer": [
|
||||
"rocprof_sys_causal_viewer": [
|
||||
"source/assets/*",
|
||||
"source/workloads/*",
|
||||
"source/VERSION",
|
||||
@@ -65,6 +65,8 @@ setup(
|
||||
install_requires=parse_requirements(),
|
||||
python_requires=">=3.6",
|
||||
entry_points={
|
||||
"console_scripts": ["omnitrace-causal-plot=omnitrace_causal_viewer.__main__:main"]
|
||||
"console_scripts": [
|
||||
"rocprof-sys-causal-plot=rocprof_sys_causal_viewer.__main__:main"
|
||||
]
|
||||
},
|
||||
)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
# MIT License
|
||||
#
|
||||
# Copyright (c) 2023 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
# Copyright (c) 2023-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -24,7 +24,7 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
__author__ = "AMD Research"
|
||||
__copyright__ = "Copyright 2023, Advanced Micro Devices, Inc."
|
||||
__copyright__ = "Copyright 2023-2024, Advanced Micro Devices, Inc."
|
||||
__license__ = "MIT"
|
||||
__maintainer__ = "AMD Research"
|
||||
__status__ = "Development"
|
||||
@@ -118,7 +118,7 @@ def main():
|
||||
|
||||
for itr in [
|
||||
settings_path,
|
||||
os.path.join(os.environ.get("HOME"), ".omnitrace-causal-plot.json"),
|
||||
os.path.join(os.environ.get("HOME"), ".rocprof-sys-causal-plot.json"),
|
||||
]:
|
||||
if os.path.exists(itr):
|
||||
with open(itr, "r") as f:
|
||||
@@ -143,18 +143,18 @@ def main():
|
||||
settings[key] = value
|
||||
|
||||
my_parser = argparse.ArgumentParser(
|
||||
description="AMD's OmniTrace Causal Profiling GUI",
|
||||
description="AMD's ROCm Systems Profiler Causal Profiling GUI",
|
||||
prog="tool",
|
||||
allow_abbrev=False,
|
||||
formatter_class=lambda prog: argparse.RawTextHelpFormatter(
|
||||
prog, max_help_position=40
|
||||
),
|
||||
usage="""
|
||||
omnitrace-causal-plot [ARGS...]
|
||||
rocprof-sys-causal-plot [ARGS...]
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Examples:
|
||||
\tomnitrace-causal-plot --path workloads/toy -n 0
|
||||
\trocprof-sys-causal-plot --path workloads/toy -n 0
|
||||
-------------------------------------------------------------------------------
|
||||
""",
|
||||
)
|
||||
@@ -162,7 +162,9 @@ def main():
|
||||
my_parser.add_argument(
|
||||
"--version",
|
||||
action="version",
|
||||
version="OmniTrace Causal Viewer v{}\n".format(f"{__version__}".strip("\n")),
|
||||
version="ROCm Systems Profiler Causal Viewer v{}\n".format(
|
||||
f"{__version__}".strip("\n")
|
||||
),
|
||||
)
|
||||
|
||||
my_parser.add_argument(
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
# MIT License
|
||||
#
|
||||
# Copyright (c) 2023 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
# Copyright (c) 2023-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -24,7 +24,7 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
__author__ = "AMD Research"
|
||||
__copyright__ = "Copyright 2023, Advanced Micro Devices, Inc."
|
||||
__copyright__ = "Copyright 2023-2024, Advanced Micro Devices, Inc."
|
||||
__license__ = "MIT"
|
||||
__maintainer__ = "AMD Research"
|
||||
__status__ = "Development"
|
||||
@@ -270,7 +270,7 @@ class experiment_progress(object):
|
||||
def process_samples(data, _data):
|
||||
if not _data:
|
||||
return data
|
||||
for record in _data["omnitrace"]["causal"]["records"]:
|
||||
for record in _data["rocprofsys"]["causal"]["records"]:
|
||||
for samp in record["samples"]:
|
||||
_info = samp["info"]
|
||||
_count = samp["count"]
|
||||
@@ -303,7 +303,7 @@ def process_data(data, _data, experiments, progress_points):
|
||||
_selection_filter = re.compile(experiments)
|
||||
_progresspt_filter = re.compile(progress_points)
|
||||
|
||||
for record in _data["omnitrace"]["causal"]["records"]:
|
||||
for record in _data["rocprofsys"]["causal"]["records"]:
|
||||
for exp in record["experiments"]:
|
||||
_speedup = exp["virtual_speedup"]
|
||||
_duration = exp["duration"]
|
||||
@@ -612,8 +612,8 @@ def parse_files(
|
||||
with open(file, "r") as j:
|
||||
_data = json.load(j)
|
||||
dict_data = {}
|
||||
# make sure the JSON is an omnitrace causal JSON
|
||||
if "omnitrace" not in _data or "causal" not in _data["omnitrace"]:
|
||||
# make sure the JSON is an rocprof-sys causal JSON
|
||||
if "rocprofsys" not in _data or "causal" not in _data["rocprofsys"]:
|
||||
continue
|
||||
dict_data[file] = process_data({}, _data, experiments, progress_points)
|
||||
samps = process_samples({}, _data)
|
||||
@@ -831,8 +831,8 @@ def find_causal_files(workload_path, verbose, recursive):
|
||||
with open(itr, "r") as f:
|
||||
inp_data = json.load(f)
|
||||
if (
|
||||
"omnitrace" not in inp_data.keys()
|
||||
or "causal" not in inp_data["omnitrace"].keys()
|
||||
"rocprofsys" not in inp_data.keys()
|
||||
or "causal" not in inp_data["rocprofsys"].keys()
|
||||
):
|
||||
if verbose >= 2:
|
||||
print(f"{itr} is not a causal profile")
|
||||
|
||||
+64
-63
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -20,12 +20,12 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#include "libpyomnitrace.hpp"
|
||||
#include "libpyrocprofsys.hpp"
|
||||
#include "dl/dl.hpp"
|
||||
#include "library/coverage.hpp"
|
||||
#include "library/coverage/impl.hpp"
|
||||
#include "omnitrace/categories.h"
|
||||
#include "omnitrace/user.h"
|
||||
#include "rocprofiler-systems/categories.h"
|
||||
#include "rocprofiler-systems/user.h"
|
||||
|
||||
#include <timemory/backends/process.hpp>
|
||||
#include <timemory/backends/threading.hpp>
|
||||
@@ -53,10 +53,10 @@
|
||||
#include <stdexcept>
|
||||
#include <unordered_map>
|
||||
|
||||
#define OMNITRACE_PYTHON_VERSION \
|
||||
#define ROCPROFSYS_PYTHON_VERSION \
|
||||
((10000 * PY_MAJOR_VERSION) + (100 * PY_MINOR_VERSION) + PY_MICRO_VERSION)
|
||||
|
||||
namespace pyomnitrace
|
||||
namespace pyrocprofsys
|
||||
{
|
||||
namespace pyprofile
|
||||
{
|
||||
@@ -73,17 +73,17 @@ namespace pyuser
|
||||
py::module
|
||||
generate(py::module& _pymod);
|
||||
}
|
||||
} // namespace pyomnitrace
|
||||
} // namespace pyrocprofsys
|
||||
|
||||
template <typename... Tp>
|
||||
using uomap_t = std::unordered_map<Tp...>;
|
||||
|
||||
PYBIND11_MODULE(libpyomnitrace, omni)
|
||||
PYBIND11_MODULE(libpyrocprofsys, omni)
|
||||
{
|
||||
using namespace pyomnitrace;
|
||||
using namespace pyrocprofsys;
|
||||
|
||||
py::doc("Omnitrace Python bindings for profiling, user API, and code coverage "
|
||||
"post-processing");
|
||||
py::doc("ROCm Systems Profiler Python bindings for profiling, user API, and "
|
||||
"code coverage post-processing");
|
||||
|
||||
static bool _is_initialized = false;
|
||||
static bool _is_finalized = false;
|
||||
@@ -110,22 +110,22 @@ PYBIND11_MODULE(libpyomnitrace, omni)
|
||||
"initialize",
|
||||
[](const std::string& _v) {
|
||||
if(_is_initialized)
|
||||
throw std::runtime_error("Error! omnitrace is already initialized");
|
||||
throw std::runtime_error("Error! rocprofsys is already initialized");
|
||||
_is_initialized = true;
|
||||
omnitrace_set_mpi(_get_use_mpi(), false);
|
||||
omnitrace_init("trace", false, _v.c_str());
|
||||
rocprofsys_set_mpi(_get_use_mpi(), false);
|
||||
rocprofsys_init("trace", false, _v.c_str());
|
||||
},
|
||||
"Initialize omnitrace");
|
||||
"Initialize rocprofsys");
|
||||
|
||||
omni.def(
|
||||
"initialize",
|
||||
[](const py::list& _v) {
|
||||
if(_is_initialized)
|
||||
throw std::runtime_error("Error! omnitrace is already initialized");
|
||||
throw std::runtime_error("Error! rocprofsys is already initialized");
|
||||
_is_initialized = true;
|
||||
omnitrace_set_instrumented(
|
||||
static_cast<int>(omnitrace::dl::InstrumentMode::PythonProfile));
|
||||
omnitrace_set_mpi(_get_use_mpi(), false);
|
||||
rocprofsys_set_instrumented(
|
||||
static_cast<int>(rocprofsys::dl::InstrumentMode::PythonProfile));
|
||||
rocprofsys_set_mpi(_get_use_mpi(), false);
|
||||
std::string _cmd = {};
|
||||
std::string _cmd_line = {};
|
||||
for(auto&& itr : _v)
|
||||
@@ -136,46 +136,46 @@ PYBIND11_MODULE(libpyomnitrace, omni)
|
||||
if(!_cmd_line.empty())
|
||||
{
|
||||
_cmd_line = _cmd_line.substr(_cmd_line.find_first_not_of(' '));
|
||||
tim::set_env("OMNITRACE_COMMAND_LINE", _cmd_line, 0);
|
||||
tim::set_env("ROCPROFSYS_COMMAND_LINE", _cmd_line, 0);
|
||||
}
|
||||
omnitrace_init("trace", false, _cmd.c_str());
|
||||
rocprofsys_init("trace", false, _cmd.c_str());
|
||||
},
|
||||
"Initialize omnitrace");
|
||||
"Initialize rocprofsys");
|
||||
|
||||
omni.def(
|
||||
"finalize",
|
||||
[]() {
|
||||
if(_is_finalized)
|
||||
throw std::runtime_error("Error! omnitrace is already finalized");
|
||||
throw std::runtime_error("Error! rocprofsys is already finalized");
|
||||
_is_finalized = true;
|
||||
omnitrace_finalize();
|
||||
rocprofsys_finalize();
|
||||
},
|
||||
"Finalize omnitrace");
|
||||
"Finalize rocprofsys");
|
||||
|
||||
pyprofile::generate(omni);
|
||||
pycoverage::generate(omni);
|
||||
pyuser::generate(omni);
|
||||
|
||||
auto _python_path = tim::get_env("OMNITRACE_PATH", std::string{}, false);
|
||||
auto _libpath = std::string{ "libomnitrace-dl.so" };
|
||||
auto _python_path = tim::get_env("ROCPROFSYS_PATH", std::string{}, false);
|
||||
auto _libpath = std::string{ "librocprof-sys-dl.so" };
|
||||
if(!_python_path.empty()) _libpath = TIMEMORY_JOIN("/", _python_path, _libpath);
|
||||
// permit env override if default path fails/is wrong
|
||||
_libpath = tim::get_env("OMNITRACE_DL_LIBRARY", _libpath);
|
||||
_libpath = tim::get_env("ROCPROFSYS_DL_LIBRARY", _libpath);
|
||||
// this is necessary when building with -static-libstdc++
|
||||
// without it, loading libomnitrace.so within libomnitrace-dl.so segfaults
|
||||
// without it, loading librocprof-sys.so within librocprof-sys-dl.so segfaults
|
||||
if(!dlopen(_libpath.c_str(), RTLD_NOW | RTLD_GLOBAL))
|
||||
{
|
||||
auto _msg =
|
||||
TIMEMORY_JOIN("", "dlopen(\"", _libpath, "\", RTLD_NOW | RTLD_GLOBAL)");
|
||||
perror(_msg.c_str());
|
||||
fprintf(stderr, "[omnitrace][dl][pid=%i] %s :: %s\n", getpid(), _msg.c_str(),
|
||||
fprintf(stderr, "[rocprofsys][dl][pid=%i] %s :: %s\n", getpid(), _msg.c_str(),
|
||||
dlerror());
|
||||
}
|
||||
}
|
||||
|
||||
//======================================================================================//
|
||||
//
|
||||
namespace pyomnitrace
|
||||
namespace pyrocprofsys
|
||||
{
|
||||
namespace pyprofile
|
||||
{
|
||||
@@ -185,7 +185,7 @@ using profiler_vec_t = std::vector<profiler_t>;
|
||||
using profiler_label_map_t = std::unordered_map<std::string, profiler_vec_t>;
|
||||
using profiler_index_map_t = std::unordered_map<uint32_t, profiler_label_map_t>;
|
||||
using strset_t = std::unordered_set<std::string>;
|
||||
using note_t = omnitrace_annotation_t;
|
||||
using note_t = rocprofsys_annotation_t;
|
||||
using annotations_t = std::array<note_t, 6>;
|
||||
//
|
||||
namespace
|
||||
@@ -223,12 +223,12 @@ struct config
|
||||
strset_t exclude_functions = default_exclude_functions;
|
||||
strset_t exclude_filenames = default_exclude_filenames;
|
||||
std::vector<profiler_t> records = {};
|
||||
annotations_t annotations = { note_t{ "file", OMNITRACE_STRING, nullptr },
|
||||
note_t{ "line", OMNITRACE_INT32, nullptr },
|
||||
note_t{ "lasti", OMNITRACE_INT32, nullptr },
|
||||
note_t{ "argcount", OMNITRACE_INT32, nullptr },
|
||||
note_t{ "nlocals", OMNITRACE_INT32, nullptr },
|
||||
note_t{ "stacksize", OMNITRACE_INT32, nullptr } };
|
||||
annotations_t annotations = { note_t{ "file", ROCPROFSYS_STRING, nullptr },
|
||||
note_t{ "line", ROCPROFSYS_INT32, nullptr },
|
||||
note_t{ "lasti", ROCPROFSYS_INT32, nullptr },
|
||||
note_t{ "argcount", ROCPROFSYS_INT32, nullptr },
|
||||
note_t{ "nlocals", ROCPROFSYS_INT32, nullptr },
|
||||
note_t{ "stacksize", ROCPROFSYS_INT32, nullptr } };
|
||||
};
|
||||
//
|
||||
inline config&
|
||||
@@ -268,7 +268,7 @@ get_config()
|
||||
int
|
||||
get_frame_lineno(PyFrameObject* frame)
|
||||
{
|
||||
#if OMNITRACE_PYTHON_VERSION >= 31100
|
||||
#if ROCPROFSYS_PYTHON_VERSION >= 31100
|
||||
return PyFrame_GetLineNumber(frame);
|
||||
#else
|
||||
return frame->f_lineno;
|
||||
@@ -278,7 +278,7 @@ get_frame_lineno(PyFrameObject* frame)
|
||||
int
|
||||
get_frame_lasti(PyFrameObject* frame)
|
||||
{
|
||||
#if OMNITRACE_PYTHON_VERSION >= 31100
|
||||
#if ROCPROFSYS_PYTHON_VERSION >= 31100
|
||||
return PyFrame_GetLasti(frame);
|
||||
#else
|
||||
return frame->f_lasti;
|
||||
@@ -288,7 +288,7 @@ get_frame_lasti(PyFrameObject* frame)
|
||||
auto
|
||||
get_frame_code(PyFrameObject* frame)
|
||||
{
|
||||
#if OMNITRACE_PYTHON_VERSION >= 31100
|
||||
#if ROCPROFSYS_PYTHON_VERSION >= 31100
|
||||
return PyFrame_GetCode(frame);
|
||||
#else
|
||||
return frame->f_code;
|
||||
@@ -311,7 +311,7 @@ profiler_function(py::object pframe, const char* swhat, py::object arg)
|
||||
|
||||
if(pframe.is_none() || pframe.ptr() == nullptr) return;
|
||||
|
||||
static auto _omnitrace_path = _config.base_module_path;
|
||||
static auto _rocprofsys_path = _config.base_module_path;
|
||||
|
||||
auto* frame = reinterpret_cast<PyFrameObject*>(pframe.ptr());
|
||||
|
||||
@@ -454,7 +454,7 @@ profiler_function(py::object pframe, const char* swhat, py::object arg)
|
||||
: _full;
|
||||
|
||||
if(!_config.include_internal &&
|
||||
strncmp(_full.c_str(), _omnitrace_path.c_str(), _omnitrace_path.length()) == 0)
|
||||
strncmp(_full.c_str(), _rocprofsys_path.c_str(), _rocprofsys_path.length()) == 0)
|
||||
{
|
||||
if(_config.verbose > 2)
|
||||
TIMEMORY_PRINT_HERE("Skipping internal function: %s", _func.c_str());
|
||||
@@ -514,14 +514,15 @@ profiler_function(py::object pframe, const char* swhat, py::object arg)
|
||||
}
|
||||
|
||||
_config.records.emplace_back([&_label_ref, _annotate]() {
|
||||
omnitrace_pop_category_region(OMNITRACE_CATEGORY_PYTHON, _label_ref.c_str(),
|
||||
(_annotate) ? _config.annotations.data()
|
||||
: nullptr,
|
||||
_config.annotations.size());
|
||||
rocprofsys_pop_category_region(ROCPROFSYS_CATEGORY_PYTHON, _label_ref.c_str(),
|
||||
(_annotate) ? _config.annotations.data()
|
||||
: nullptr,
|
||||
_config.annotations.size());
|
||||
});
|
||||
omnitrace_push_category_region(OMNITRACE_CATEGORY_PYTHON, _label_ref.c_str(),
|
||||
(_annotate) ? _config.annotations.data() : nullptr,
|
||||
_config.annotations.size());
|
||||
rocprofsys_push_category_region(ROCPROFSYS_CATEGORY_PYTHON, _label_ref.c_str(),
|
||||
(_annotate) ? _config.annotations.data()
|
||||
: nullptr,
|
||||
_config.annotations.size());
|
||||
};
|
||||
|
||||
// stop function
|
||||
@@ -556,7 +557,7 @@ generate(py::module& _pymod)
|
||||
try
|
||||
{
|
||||
auto _file =
|
||||
py::module::import("omnitrace").attr("__file__").cast<std::string>();
|
||||
py::module::import("rocprofsys").attr("__file__").cast<std::string>();
|
||||
if(_file.find('/') != std::string::npos)
|
||||
_file = _file.substr(0, _file.find_last_of('/'));
|
||||
get_config().base_module_path = _file;
|
||||
@@ -675,7 +676,7 @@ namespace pycoverage
|
||||
py::module
|
||||
generate(py::module& _pymod)
|
||||
{
|
||||
namespace coverage = omnitrace::coverage;
|
||||
namespace coverage = rocprofsys::coverage;
|
||||
using coverage_data_vector_t = std::vector<coverage::coverage_data>;
|
||||
|
||||
py::module _pycov = _pymod.def_submodule("coverage", "Code coverage");
|
||||
@@ -774,7 +775,7 @@ generate(py::module& _pymod)
|
||||
|
||||
try
|
||||
{
|
||||
ar->setNextName("omnitrace");
|
||||
ar->setNextName("rocprofsys");
|
||||
ar->startNode();
|
||||
ar->setNextName("coverage");
|
||||
ar->startNode();
|
||||
@@ -798,7 +799,7 @@ generate(py::module& _pymod)
|
||||
auto ar =
|
||||
tim::policy::output_archive<cereal::PrettyJSONOutputArchive>::get(oss);
|
||||
|
||||
ar->setNextName("omnitrace");
|
||||
ar->setNextName("rocprofsys");
|
||||
ar->startNode();
|
||||
ar->setNextName("coverage");
|
||||
ar->startNode();
|
||||
@@ -812,7 +813,7 @@ generate(py::module& _pymod)
|
||||
std::ofstream ofs{};
|
||||
if(tim::filepath::open(ofs, _name))
|
||||
{
|
||||
tim::operation::file_output_message<omnitrace::coverage::code_coverage>{}(
|
||||
tim::operation::file_output_message<rocprofsys::coverage::code_coverage>{}(
|
||||
_name, std::string{ "coverage" });
|
||||
ofs << oss.str() << "\n";
|
||||
}
|
||||
@@ -930,25 +931,25 @@ generate(py::module& _pymod)
|
||||
{
|
||||
py::module _pyuser = _pymod.def_submodule("user", "User instrumentation");
|
||||
|
||||
_pyuser.def("start_trace", &omnitrace_user_start_trace,
|
||||
_pyuser.def("start_trace", &rocprofsys_user_start_trace,
|
||||
"Enable tracing on this thread and all subsequently created threads");
|
||||
_pyuser.def("stop_trace", &omnitrace_user_stop_trace,
|
||||
_pyuser.def("stop_trace", &rocprofsys_user_stop_trace,
|
||||
"Disable tracing on this thread and all subsequently created threads");
|
||||
_pyuser.def(
|
||||
"start_thread_trace", &omnitrace_user_start_thread_trace,
|
||||
"start_thread_trace", &rocprofsys_user_start_thread_trace,
|
||||
"Enable tracing on this thread. Does not apply to subsequently created threads");
|
||||
_pyuser.def(
|
||||
"stop_thread_trace", &omnitrace_user_stop_thread_trace,
|
||||
"stop_thread_trace", &rocprofsys_user_stop_thread_trace,
|
||||
"Enable tracing on this thread. Does not apply to subsequently created threads");
|
||||
_pyuser.def("push_region", &omnitrace_user_push_region,
|
||||
_pyuser.def("push_region", &rocprofsys_user_push_region,
|
||||
"Start a user-defined region");
|
||||
_pyuser.def("pop_region", &omnitrace_user_pop_region, "Start a user-defined region");
|
||||
_pyuser.def("error_string", &omnitrace_user_error_string,
|
||||
_pyuser.def("pop_region", &rocprofsys_user_pop_region, "Start a user-defined region");
|
||||
_pyuser.def("error_string", &rocprofsys_user_error_string,
|
||||
"Return a descriptor for the provided error code");
|
||||
|
||||
return _pyuser;
|
||||
}
|
||||
} // namespace pyuser
|
||||
} // namespace pyomnitrace
|
||||
} // namespace pyrocprofsys
|
||||
//
|
||||
//======================================================================================//
|
||||
+4
-3
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -21,6 +21,7 @@
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
#define PYBIND11_DETAILED_ERROR_MESSAGES
|
||||
|
||||
#include <pybind11/cast.h>
|
||||
#include <pybind11/embed.h>
|
||||
@@ -48,9 +49,9 @@
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
|
||||
namespace pyomnitrace
|
||||
namespace pyrocprofsys
|
||||
{
|
||||
namespace py = pybind11;
|
||||
using namespace std::placeholders; // for _1, _2, _3...
|
||||
using namespace py::literals;
|
||||
} // namespace pyomnitrace
|
||||
} // namespace pyrocprofsys
|
||||
+12
-12
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python@_VERSION@
|
||||
# MIT License
|
||||
#
|
||||
# Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
# Copyright (c) 2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,11 +23,11 @@
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
__author__ = "AMD Research"
|
||||
__copyright__ = "Copyright 2022, Advanced Micro Devices, Inc."
|
||||
__author__ = "AMD ROCm"
|
||||
__copyright__ = "Copyright 2024, Advanced Micro Devices, Inc."
|
||||
__license__ = "MIT"
|
||||
__version__ = "@PROJECT_VERSION@"
|
||||
__maintainer__ = "AMD Research"
|
||||
__maintainer__ = "AMD ROCm"
|
||||
__status__ = "Development"
|
||||
|
||||
"""
|
||||
@@ -37,23 +37,23 @@ This submodule imports the timemory Python function profiler
|
||||
try:
|
||||
import os
|
||||
|
||||
os.environ["OMNITRACE_PATH"] = os.path.abspath(
|
||||
os.environ["ROCPROFSYS_PATH"] = os.path.abspath(
|
||||
os.path.join(os.path.dirname(__file__), "../../..")
|
||||
)
|
||||
|
||||
from .libpyomnitrace import coverage
|
||||
from .libpyrocprofsys import coverage
|
||||
from . import user
|
||||
from .profiler import Profiler, FakeProfiler
|
||||
from .libpyomnitrace.profiler import (
|
||||
from .libpyrocprofsys.profiler import (
|
||||
profiler_function,
|
||||
profiler_init,
|
||||
profiler_finalize,
|
||||
)
|
||||
from .libpyomnitrace import initialize
|
||||
from .libpyomnitrace import finalize
|
||||
from .libpyomnitrace import is_initialized
|
||||
from .libpyomnitrace import is_finalized
|
||||
from .libpyomnitrace.profiler import config as Config
|
||||
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
|
||||
|
||||
config = Config
|
||||
profile = Profiler
|
||||
+25
-25
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python@_VERSION@
|
||||
# MIT License
|
||||
#
|
||||
# Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
# Copyright (c) 2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,11 +23,11 @@
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
__author__ = "AMD Research"
|
||||
__copyright__ = "Copyright 2022, Advanced Micro Devices, Inc."
|
||||
__author__ = "AMD ROCm"
|
||||
__copyright__ = "Copyright 2024, Advanced Micro Devices, Inc."
|
||||
__license__ = "MIT"
|
||||
__version__ = "@PROJECT_VERSION@"
|
||||
__maintainer__ = "AMD Research"
|
||||
__maintainer__ = "AMD ROCm"
|
||||
__status__ = "Development"
|
||||
|
||||
""" @file __main__.py
|
||||
@@ -40,7 +40,7 @@ import argparse
|
||||
import traceback
|
||||
|
||||
PY3 = sys.version_info[0] == 3
|
||||
_OMNITRACE_PYTHON_SCRIPT_FILE = None
|
||||
_ROCPROFSYS_PYTHON_SCRIPT_FILE = None
|
||||
|
||||
# Python 3.x compatibility utils: execfile
|
||||
try:
|
||||
@@ -81,7 +81,7 @@ def parse_args(args=None):
|
||||
if args is None:
|
||||
args = sys.argv[1:]
|
||||
|
||||
from .libpyomnitrace.profiler import config as _profiler_config
|
||||
from .libpyrocprofsys.profiler import config as _profiler_config
|
||||
|
||||
def str2bool(v):
|
||||
if isinstance(v, bool):
|
||||
@@ -102,9 +102,9 @@ def parse_args(args=None):
|
||||
_default_label.append("line")
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
"omnitrace",
|
||||
"rocprofsys",
|
||||
add_help=True,
|
||||
epilog="usage: {} -m omnitrace <OMNITRACE_ARGS> -- <SCRIPT> <SCRIPT_ARGS>".format(
|
||||
epilog="usage: {} -m rocprofsys <ROCPROFSYS_ARGS> -- <SCRIPT> <SCRIPT_ARGS>".format(
|
||||
os.path.basename(sys.executable)
|
||||
),
|
||||
)
|
||||
@@ -130,7 +130,7 @@ def parse_args(args=None):
|
||||
default=None,
|
||||
type=str,
|
||||
metavar="FILE",
|
||||
help="Omnitrace configuration file",
|
||||
help="ROCm Systems Profiler configuration file",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-s",
|
||||
@@ -290,7 +290,7 @@ def main(main_args=sys.argv):
|
||||
raise RuntimeError(
|
||||
"Could not determine input script in '{}'. Use '--' before "
|
||||
"the script and its arguments to ensure correct parsing. \nE.g. "
|
||||
"python -m omnitrace -- ./script.py".format(" ".join(argv))
|
||||
"python -m rocprofsys -- ./script.py".format(" ".join(argv))
|
||||
)
|
||||
|
||||
if len(argv) > 1:
|
||||
@@ -305,21 +305,21 @@ def main(main_args=sys.argv):
|
||||
break
|
||||
|
||||
if argv:
|
||||
os.environ["OMNITRACE_COMMAND_LINE"] = " ".join(argv)
|
||||
os.environ["ROCPROFSYS_COMMAND_LINE"] = " ".join(argv)
|
||||
|
||||
if opts.config is not None:
|
||||
os.environ["OMNITRACE_CONFIG_FILE"] = ":".join(
|
||||
[os.environ.get("OMNITRACE_CONFIG_FILE", ""), opts.config]
|
||||
os.environ["ROCPROFSYS_CONFIG_FILE"] = ":".join(
|
||||
[os.environ.get("ROCPROFSYS_CONFIG_FILE", ""), opts.config]
|
||||
)
|
||||
|
||||
from .libpyomnitrace import initialize
|
||||
from .libpyrocprofsys import initialize
|
||||
|
||||
if os.path.isfile(argv[0]):
|
||||
argv[0] = os.path.realpath(argv[0])
|
||||
|
||||
initialize(argv)
|
||||
|
||||
from .libpyomnitrace.profiler import config as _profiler_config
|
||||
from .libpyrocprofsys.profiler import config as _profiler_config
|
||||
|
||||
_profiler_config.trace_c = opts.trace_c
|
||||
_profiler_config.include_args = "args" in opts.label
|
||||
@@ -335,7 +335,7 @@ def main(main_args=sys.argv):
|
||||
_profiler_config.annotate_trace = opts.annotate_trace
|
||||
_profiler_config.verbosity = opts.verbosity
|
||||
|
||||
print("[omnitrace]> profiling: {}".format(argv))
|
||||
print("[rocprofsys]> profiling: {}".format(argv))
|
||||
|
||||
main_args[:] = argv
|
||||
if opts.setup is not None:
|
||||
@@ -357,8 +357,8 @@ def main(main_args=sys.argv):
|
||||
# Make sure the script's directory is on sys.path
|
||||
sys.path.insert(0, os.path.dirname(script_file))
|
||||
|
||||
_OMNITRACE_PYTHON_SCRIPT_FILE = script_file
|
||||
os.environ["OMNITRACE_PYTHON_SCRIPT_FILE"] = script_file
|
||||
_ROCPROFSYS_PYTHON_SCRIPT_FILE = script_file
|
||||
os.environ["ROCPROFSYS_PYTHON_SCRIPT_FILE"] = script_file
|
||||
|
||||
prof = Profiler()
|
||||
fake = FakeProfiler()
|
||||
@@ -398,16 +398,16 @@ def main(main_args=sys.argv):
|
||||
|
||||
if __name__ == "__main__":
|
||||
args = sys.argv
|
||||
if _OMNITRACE_PYTHON_SCRIPT_FILE is None:
|
||||
_OMNITRACE_PYTHON_SCRIPT_FILE = os.environ.get(
|
||||
"OMNITRACE_PYTHON_SCRIPT_FILE", None
|
||||
if _ROCPROFSYS_PYTHON_SCRIPT_FILE is None:
|
||||
_ROCPROFSYS_PYTHON_SCRIPT_FILE = os.environ.get(
|
||||
"ROCPROFSYS_PYTHON_SCRIPT_FILE", None
|
||||
)
|
||||
|
||||
if "--" not in args and _OMNITRACE_PYTHON_SCRIPT_FILE is not None:
|
||||
args = [args[0]] + ["--", _OMNITRACE_PYTHON_SCRIPT_FILE] + args[1:]
|
||||
os.environ["OMNITRACE_USE_PID"] = "ON"
|
||||
if "--" not in args and _ROCPROFSYS_PYTHON_SCRIPT_FILE is not None:
|
||||
args = [args[0]] + ["--", _ROCPROFSYS_PYTHON_SCRIPT_FILE] + args[1:]
|
||||
os.environ["ROCPROFSYS_USE_PID"] = "ON"
|
||||
|
||||
main(args)
|
||||
from .libpyomnitrace import finalize
|
||||
from .libpyrocprofsys import finalize
|
||||
|
||||
finalize()
|
||||
+10
-10
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python@_VERSION@
|
||||
# MIT License
|
||||
#
|
||||
# Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
# Copyright (c) 2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,19 +23,19 @@
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
__author__ = "AMD Research"
|
||||
__copyright__ = "Copyright 2022, Advanced Micro Devices, Inc."
|
||||
__author__ = "AMD ROCm"
|
||||
__copyright__ = "Copyright 2024, Advanced Micro Devices, Inc."
|
||||
__license__ = "MIT"
|
||||
__version__ = "@PROJECT_VERSION@"
|
||||
__maintainer__ = "AMD Research"
|
||||
__maintainer__ = "AMD ROCm"
|
||||
__status__ = "Development"
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
from . import libpyomnitrace
|
||||
from .libpyomnitrace.profiler import profiler_init as _profiler_init
|
||||
from .libpyomnitrace.profiler import profiler_finalize as _profiler_fini
|
||||
from . import libpyrocprofsys
|
||||
from .libpyrocprofsys.profiler import profiler_init as _profiler_init
|
||||
from .libpyrocprofsys.profiler import profiler_finalize as _profiler_fini
|
||||
|
||||
|
||||
__all__ = ["exec_", "_file", "_get_argv", "_initialize", "_finalize"]
|
||||
@@ -127,10 +127,10 @@ def _get_argv(init_file, argv=None):
|
||||
|
||||
|
||||
def _initialize(_file):
|
||||
if not libpyomnitrace.is_initialized():
|
||||
libpyomnitrace.initialize(_get_argv(_file))
|
||||
if not libpyrocprofsys.is_initialized():
|
||||
libpyrocprofsys.initialize(_get_argv(_file))
|
||||
|
||||
|
||||
def _finalize():
|
||||
if libpyomnitrace.is_initialized() and not libpyomnitrace.is_finalized():
|
||||
if libpyrocprofsys.is_initialized() and not libpyrocprofsys.is_finalized():
|
||||
_profiler_fini()
|
||||
+15
-15
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python@_VERSION@
|
||||
# MIT License
|
||||
#
|
||||
# Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
# Copyright (c) 2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,11 +23,11 @@
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
__author__ = "AMD Research"
|
||||
__copyright__ = "Copyright 2022, Advanced Micro Devices, Inc."
|
||||
__author__ = "AMD ROCm"
|
||||
__copyright__ = "Copyright 2024, Advanced Micro Devices, Inc."
|
||||
__license__ = "MIT"
|
||||
__version__ = "@PROJECT_VERSION@"
|
||||
__maintainer__ = "AMD Research"
|
||||
__maintainer__ = "AMD ROCm"
|
||||
__status__ = "Development"
|
||||
|
||||
import os
|
||||
@@ -39,15 +39,15 @@ from .common import exec_
|
||||
from .common import _initialize
|
||||
from .common import _file
|
||||
|
||||
from . import libpyomnitrace
|
||||
from .libpyomnitrace.profiler import (
|
||||
from . import libpyrocprofsys
|
||||
from .libpyrocprofsys.profiler import (
|
||||
profiler_function as _profiler_function,
|
||||
)
|
||||
from .libpyomnitrace.profiler import config as _profiler_config
|
||||
from .libpyomnitrace.profiler import profiler_init as _profiler_init
|
||||
from .libpyomnitrace.profiler import profiler_finalize as _profiler_fini
|
||||
from .libpyomnitrace.profiler import profiler_pause as _profiler_pause
|
||||
from .libpyomnitrace.profiler import profiler_resume as _profiler_resume
|
||||
from .libpyrocprofsys.profiler import config as _profiler_config
|
||||
from .libpyrocprofsys.profiler import profiler_init as _profiler_init
|
||||
from .libpyrocprofsys.profiler import profiler_finalize as _profiler_fini
|
||||
from .libpyrocprofsys.profiler import profiler_pause as _profiler_pause
|
||||
from .libpyrocprofsys.profiler import profiler_resume as _profiler_resume
|
||||
|
||||
__all__ = [
|
||||
"profile",
|
||||
@@ -68,7 +68,7 @@ def _default_functor():
|
||||
|
||||
|
||||
class Profiler:
|
||||
"""Provides decorators and context-manager for the omnitrace profilers"""
|
||||
"""Provides decorators and context-manager for the rocprof-sys profilers"""
|
||||
|
||||
global _default_functor
|
||||
|
||||
@@ -100,7 +100,7 @@ class Profiler:
|
||||
self._use = (
|
||||
not _profiler_config._is_running
|
||||
and Profiler.is_enabled() is True
|
||||
and not libpyomnitrace.is_finalized()
|
||||
and not libpyrocprofsys.is_finalized()
|
||||
)
|
||||
self._file = _file()
|
||||
self.debug = kwargs["debug"] if "debug" in kwargs else False
|
||||
@@ -136,7 +136,7 @@ class Profiler:
|
||||
not _profiler_config._is_running
|
||||
and Profiler.is_enabled() is True
|
||||
and sys.getprofile() == self._original_function
|
||||
and not libpyomnitrace.is_finalized()
|
||||
and not libpyrocprofsys.is_finalized()
|
||||
)
|
||||
|
||||
def start(self):
|
||||
@@ -236,7 +236,7 @@ profile = Profiler
|
||||
|
||||
|
||||
class FakeProfiler:
|
||||
"""Provides decorators and context-manager for disabling the omnitrace profiler"""
|
||||
"""Provides decorators and context-manager for disabling the profiling"""
|
||||
|
||||
@staticmethod
|
||||
def condition(functor):
|
||||
+13
-13
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python@_VERSION@
|
||||
# MIT License
|
||||
#
|
||||
# Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
# Copyright (c) 2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,23 +23,23 @@
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
__author__ = "AMD Research"
|
||||
__copyright__ = "Copyright 2022, Advanced Micro Devices, Inc."
|
||||
__author__ = "AMD ROCm"
|
||||
__copyright__ = "Copyright 2024, Advanced Micro Devices, Inc."
|
||||
__license__ = "MIT"
|
||||
__version__ = "@PROJECT_VERSION@"
|
||||
__maintainer__ = "AMD Research"
|
||||
__maintainer__ = "AMD ROCm"
|
||||
__status__ = "Development"
|
||||
|
||||
from functools import wraps
|
||||
|
||||
from . import libpyomnitrace
|
||||
from .libpyomnitrace import user as _libuser
|
||||
from .libpyomnitrace.user import start_trace
|
||||
from .libpyomnitrace.user import start_thread_trace
|
||||
from .libpyomnitrace.user import stop_trace
|
||||
from .libpyomnitrace.user import stop_thread_trace
|
||||
from .libpyomnitrace.user import push_region
|
||||
from .libpyomnitrace.user import pop_region
|
||||
from . import libpyrocprofsys
|
||||
from .libpyrocprofsys import user as _libuser
|
||||
from .libpyrocprofsys.user import start_trace
|
||||
from .libpyrocprofsys.user import start_thread_trace
|
||||
from .libpyrocprofsys.user import stop_trace
|
||||
from .libpyrocprofsys.user import stop_thread_trace
|
||||
from .libpyrocprofsys.user import push_region
|
||||
from .libpyrocprofsys.user import pop_region
|
||||
|
||||
from .common import _initialize
|
||||
from .common import _file
|
||||
@@ -58,7 +58,7 @@ __all__ = [
|
||||
|
||||
|
||||
class Region:
|
||||
"""Provides decorators and context-manager for the omnitrace user-defined regions"""
|
||||
"""Provides decorators and context-manager for the rocprof-sys user-defined regions"""
|
||||
|
||||
# static variable
|
||||
_counter = 0
|
||||
@@ -2,7 +2,7 @@
|
||||
name = @PROJECT_NAME@
|
||||
url = @PROJECT_HOMEPAGE_URL@
|
||||
download_url = @PROJECT_HOMEPAGE_URL@.git
|
||||
maintainer = AMD Research
|
||||
maintainer = AMD ROCm
|
||||
license = MIT
|
||||
description = @PROJECT_DESCRIPTION@
|
||||
keywords =
|
||||
|
||||
@@ -6,7 +6,7 @@ setup(
|
||||
name="@PROJECT_NAME@",
|
||||
version="@PROJECT_VERSION@",
|
||||
description="@PROJECT_DESCRIPTION@",
|
||||
author="AMD Research",
|
||||
author="AMD ROCm",
|
||||
url="@PROJECT_HOMEPAGE_URL@",
|
||||
packages=["@PROJECT_NAME@"],
|
||||
)
|
||||
|
||||
Ссылка в новой задаче
Block a user