diff --git a/.github/workflows/ubuntu-focal.yml b/.github/workflows/ubuntu-focal.yml index db8fcdff9..7b24c97d7 100644 --- a/.github/workflows/ubuntu-focal.yml +++ b/.github/workflows/ubuntu-focal.yml @@ -199,7 +199,7 @@ jobs: module use /opt/omnitrace/share/modulefiles module avail module load omnitrace - ./scripts/test-install.sh --test-rocprof-sys-{instrument,avail,sample,rewrite,runtime}=1 --test-omnitrace-python=${{ matrix.python }} + ./scripts/test-install.sh --test-rocprof-sys-{instrument,avail,sample,rewrite,runtime}=1 --test-rocprof-sys-python=${{ matrix.python }} - name: Test User API timeout-minutes: 10 diff --git a/examples/python/fill.py b/examples/python/fill.py index 373e3f34f..c1d5de1bb 100755 --- a/examples/python/fill.py +++ b/examples/python/fill.py @@ -3,9 +3,9 @@ import os import sys import time -import omnitrace -from omnitrace.user import region as omni_user_region -from omnitrace.profiler import config as omni_config +import rocprofsys +from rocprofsys.user import region as omni_user_region +from rocprofsys.profiler import config as omni_config _prefix = "" @@ -14,7 +14,7 @@ def loop(n): pass -@omnitrace.profile() +@rocprofsys.profile() def run(i, n, v): for l in range(n * n): loop(v + l) diff --git a/examples/python/source-numpy.py b/examples/python/source-numpy.py index 2979ae26c..c00874924 100755 --- a/examples/python/source-numpy.py +++ b/examples/python/source-numpy.py @@ -3,8 +3,8 @@ import os import sys import time -import omnitrace -from omnitrace.user import region as omni_user_region +import rocprofsys +from rocprofsys.user import region as omni_user_region _prefix = "" @@ -50,7 +50,7 @@ def inefficient(n): return _ret -@omnitrace.profile() +@rocprofsys.profile() def run(n): _ret = 0 _ret += fib(n) @@ -78,6 +78,6 @@ def run(n): for i in range(args.num_iterations): with omni_user_region(f"main_loop"): if args.stop_profile > 0 and i == args.stop_profile: - omnitrace.user.stop_trace() + rocprofsys.user.stop_trace() ans = run(args.value) print(f"[{_prefix}] [{i}] result of run({args.value}) = {ans}\n") diff --git a/examples/python/source.py b/examples/python/source.py index 44efbe484..3ec7b9445 100755 --- a/examples/python/source.py +++ b/examples/python/source.py @@ -3,8 +3,8 @@ import os import sys import time -import omnitrace -from omnitrace.user import region as omni_user_region +import rocprofsys +from rocprofsys.user import region as omni_user_region import random _prefix = "" @@ -33,7 +33,7 @@ def inefficient(n): return _ret -@omnitrace.profile() +@rocprofsys.profile() def run(n): _ret = 0 _ret += fib(n) @@ -61,6 +61,6 @@ def run(n): for i in range(args.num_iterations): with omni_user_region(f"main_loop"): if args.stop_profile > 0 and i == args.stop_profile: - omnitrace.user.stop_trace() + rocprofsys.user.stop_trace() ans = run(args.value) print(f"[{_prefix}] [{i}] result of run({args.value}) = {ans}\n") diff --git a/scripts/test-install.sh b/scripts/test-install.sh index c759bfd97..cb19d35e6 100755 --- a/scripts/test-install.sh +++ b/scripts/test-install.sh @@ -48,7 +48,7 @@ usage() print_option() { printf " --%-10s %-30s %s (default: %s)\n" "${1}" "${2}" "${3}" "${4}"; } echo "Options:" print_option source-dir "" "Location of source directory" "${SOURCE_DIR}" - print_option test-rocprof-sys-instrument "0|1" "Enable testing rocprof-sys-instrument exe" "${ENABLE_OMNITRACE_INSTRUMENT}" + print_option test-rocprof-sys-instrument "0|1" "Enable testing rocprof-sys-instrument" "${ENABLE_OMNITRACE_INSTRUMENT}" print_option test-rocprof-sys-avail "0|1" "Enable testing rocprof-sys-avail" "${ENABLE_OMNITRACE_AVAIL}" print_option test-rocprof-sys-sample "0|1" "Enable testing rocprof-sys-sample" "${ENABLE_OMNITRACE_SAMPLE}" print_option test-rocprof-sys-python "0|1" "Enable testing rocprof-sys-python" "${ENABLE_OMNITRACE_PYTHON}" @@ -136,10 +136,10 @@ do esac done -test-omnitrace() +test-rocprof-sys-instrument() { - verbose-run which omnitrace - verbose-run ldd $(which omnitrace) + verbose-run which rocprof-sys-instrument + verbose-run ldd $(which rocprof-sys-instrument) verbose-run rocprof-sys-instrument --help } @@ -161,11 +161,11 @@ test-rocprof-sys-sample() test-rocprof-sys-python() { - verbose-run which omnitrace-python - verbose-run omnitrace-python --help - verbose-run omnitrace-python -b -- ${SOURCE_DIR}/examples/python/builtin.py -n 5 -v 5 - verbose-run omnitrace-python -b -- ${SOURCE_DIR}/examples/python/noprofile.py -n 5 -v 5 - verbose-run omnitrace-python -- ${SOURCE_DIR}/examples/python/external.py -n 5 -v 5 + verbose-run which rocprof-sys-python + verbose-run rocprof-sys-python --help + verbose-run rocprof-sys-python -b -- ${SOURCE_DIR}/examples/python/builtin.py -n 5 -v 5 + verbose-run rocprof-sys-python -b -- ${SOURCE_DIR}/examples/python/noprofile.py -n 5 -v 5 + verbose-run rocprof-sys-python -- ${SOURCE_DIR}/examples/python/external.py -n 5 -v 5 verbose-run python3 ${SOURCE_DIR}/examples/python/source.py -n 5 -v 5 } @@ -198,7 +198,7 @@ test-rocprof-sys-runtime() verbose-run rocprof-sys-instrument -e -v 1 -- ${LS_NAME} ${LS_ARGS} } -if [ "${ENABLE_OMNITRACE_INSTRUMENT}" -ne 0 ]; then verbose-run test-omnitrace; fi +if [ "${ENABLE_OMNITRACE_INSTRUMENT}" -ne 0 ]; then verbose-run test-rocprof-sys-instrument; fi if [ "${ENABLE_OMNITRACE_AVAIL}" -ne 0 ]; then verbose-run test-rocprof-sys-avail; fi if [ "${ENABLE_OMNITRACE_SAMPLE}" -ne 0 ]; then verbose-run test-rocprof-sys-sample; fi if [ "${ENABLE_OMNITRACE_PYTHON}" -ne 0 ]; then verbose-run test-rocprof-sys-python; fi diff --git a/source/python/CMakeLists.txt b/source/python/CMakeLists.txt index eaad46f97..f28dcdaa5 100644 --- a/source/python/CMakeLists.txt +++ b/source/python/CMakeLists.txt @@ -21,23 +21,23 @@ function(OMNITRACE_CONFIGURE_PYTARGET _TARGET _VERSION) add_library(omnitrace::${_TARGET} ALIAS ${_TARGET}) target_link_libraries(${_TARGET} PRIVATE libpyomnitrace-interface) - add_dependencies(libpyomnitrace ${_TARGET}) + 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,7 +54,7 @@ function(OMNITRACE_CONFIGURE_PYTARGET _TARGET _VERSION) install( TARGETS ${_TARGET} - DESTINATION ${CMAKE_INSTALL_PYTHONDIR}/omnitrace + DESTINATION ${CMAKE_INSTALL_PYTHONDIR}/rocprofsys OPTIONAL) endfunction() @@ -68,8 +68,8 @@ add_target_cxx_flag_if_avail( "-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) @@ -90,35 +90,35 @@ target_link_libraries( omnitrace_target_compile_definitions(libpyomnitrace-interface INTERFACE OMNITRACE_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") +omnitrace_python_console_script("rocprof-sys-python" "rocprofsys") set(_INDEX 0) foreach(_VERSION ${OMNITRACE_PYTHON_VERSIONS}) - # add_library(libpyomnitrace MODULE ${pysources} ${pyheaders}) + # add_library(libpyrocprofsys MODULE ${pysources} ${pyheaders}) list(GET OMNITRACE_PYTHON_ROOT_DIRS ${_INDEX} Python3_ROOT_DIR) omnitrace_pybind11_add_module( - libpyomnitrace-${_VERSION} MODULE + libpyrocprofsys-${_VERSION} MODULE PYTHON_VERSION ${_VERSION} VISIBILITY "hidden" ${pysources} ${pyheaders}) - omnitrace_configure_pytarget(libpyomnitrace-${_VERSION} ${_VERSION}) + omnitrace_configure_pytarget(libpyrocprofsys-${_VERSION} ${_VERSION}) if(OMNITRACE_USE_PYTHON) omnitrace_python_console_script( - "omnitrace-python" "omnitrace" + "rocprof-sys-python" "rocprofsys" VERSION ${_VERSION} ROOT_DIR "${Python3_ROOT_DIR}") endif() diff --git a/source/python/libpyomnitrace.cpp b/source/python/libpyrocprofsys.cpp similarity index 97% rename from source/python/libpyomnitrace.cpp rename to source/python/libpyrocprofsys.cpp index 66832e405..f2c7d66dc 100644 --- a/source/python/libpyomnitrace.cpp +++ b/source/python/libpyrocprofsys.cpp @@ -1,6 +1,6 @@ // 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 @@ -20,7 +20,7 @@ // 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" @@ -56,7 +56,7 @@ #define OMNITRACE_PYTHON_VERSION \ ((10000 * PY_MAJOR_VERSION) + (100 * PY_MINOR_VERSION) + PY_MICRO_VERSION) -namespace pyomnitrace +namespace pyrocprofsys { namespace pyprofile { @@ -73,14 +73,14 @@ namespace pyuser py::module generate(py::module& _pymod); } -} // namespace pyomnitrace +} // namespace pyrocprofsys template using uomap_t = std::unordered_map; -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"); @@ -110,18 +110,18 @@ 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()); }, - "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(omnitrace::dl::InstrumentMode::PythonProfile)); @@ -140,17 +140,17 @@ PYBIND11_MODULE(libpyomnitrace, omni) } omnitrace_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(); }, - "Finalize omnitrace"); + "Finalize rocprofsys"); pyprofile::generate(omni); pycoverage::generate(omni); @@ -168,14 +168,14 @@ PYBIND11_MODULE(libpyomnitrace, omni) 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 { @@ -556,7 +556,7 @@ generate(py::module& _pymod) try { auto _file = - py::module::import("omnitrace").attr("__file__").cast(); + py::module::import("rocprofsys").attr("__file__").cast(); if(_file.find('/') != std::string::npos) _file = _file.substr(0, _file.find_last_of('/')); get_config().base_module_path = _file; @@ -774,7 +774,7 @@ generate(py::module& _pymod) try { - ar->setNextName("omnitrace"); + ar->setNextName("rocprofsys"); ar->startNode(); ar->setNextName("coverage"); ar->startNode(); @@ -798,7 +798,7 @@ generate(py::module& _pymod) auto ar = tim::policy::output_archive::get(oss); - ar->setNextName("omnitrace"); + ar->setNextName("rocprofsys"); ar->startNode(); ar->setNextName("coverage"); ar->startNode(); @@ -949,6 +949,6 @@ generate(py::module& _pymod) return _pyuser; } } // namespace pyuser -} // namespace pyomnitrace +} // namespace pyrocprofsys // //======================================================================================// diff --git a/source/python/libpyomnitrace.hpp b/source/python/libpyrocprofsys.hpp similarity index 93% rename from source/python/libpyomnitrace.hpp rename to source/python/libpyrocprofsys.hpp index 353a0695b..29aaa7651 100644 --- a/source/python/libpyomnitrace.hpp +++ b/source/python/libpyrocprofsys.hpp @@ -1,6 +1,6 @@ // 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 @@ -48,9 +48,9 @@ #include #include -namespace pyomnitrace +namespace pyrocprofsys { namespace py = pybind11; using namespace std::placeholders; // for _1, _2, _3... using namespace py::literals; -} // namespace pyomnitrace +} // namespace pyrocprofsys diff --git a/source/python/omnitrace/__init__.py b/source/python/rocprofsys/__init__.py similarity index 81% rename from source/python/omnitrace/__init__.py rename to source/python/rocprofsys/__init__.py index 0773cbbeb..a3f769ede 100644 --- a/source/python/omnitrace/__init__.py +++ b/source/python/rocprofsys/__init__.py @@ -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" """ @@ -41,19 +41,19 @@ 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 diff --git a/source/python/omnitrace/__main__.py b/source/python/rocprofsys/__main__.py similarity index 94% rename from source/python/omnitrace/__main__.py rename to source/python/rocprofsys/__main__.py index a4f43ec4e..3b644121d 100644 --- a/source/python/omnitrace/__main__.py +++ b/source/python/rocprofsys/__main__.py @@ -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 @@ -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 str2bool(v): _default_label.append("line") parser = argparse.ArgumentParser( - "omnitrace", + "rocprofsys", add_help=True, - epilog="usage: {} -m omnitrace --