diff --git a/.github/workflows/opensuse.yml b/.github/workflows/opensuse.yml index 34022181c..8defc8dad 100644 --- a/.github/workflows/opensuse.yml +++ b/.github/workflows/opensuse.yml @@ -111,20 +111,20 @@ jobs: run: | set -v export OMNITRACE_DEBUG=ON - which omnitrace-avail - ldd $(which omnitrace-avail) - omnitrace-avail --help - omnitrace-avail -a - which omnitrace - ldd $(which omnitrace) - omnitrace-instrument --help - omnitrace-instrument -e -v 1 -o ls.inst --simulate -- ls + which rocprof-sys-avail + ldd $(which rocprof-sys-avail) + rocprof-sys-avail --help + rocprof-sys-avail -a + which rocprof-sys-instrument + ldd $(which rocprof-sys-instrument) + rocprof-sys-instrument --help + rocprof-sys-instrument -e -v 1 -o ls.inst --simulate -- ls for i in $(find omnitrace-ls.inst-output -type f); do echo -e "\n\n --> ${i} \n\n"; cat ${i}; done - omnitrace-instrument -e -v 1 -o ls.inst -- ls - omnitrace-run -- ./ls.inst - omnitrace-instrument -e -v 1 --simulate -- ls + rocprof-sys-instrument -e -v 1 -o ls.inst -- ls + rocprof-sys-run -- ./ls.inst + rocprof-sys-instrument -e -v 1 --simulate -- ls for i in $(find omnitrace-ls-output -type f); do echo -e "\n\n --> ${i} \n\n"; cat ${i}; done - omnitrace-instrument -e -v 1 -- ls + rocprof-sys-instrument -e -v 1 -- ls - name: Test User API timeout-minutes: 10 diff --git a/.github/workflows/redhat.yml b/.github/workflows/redhat.yml index 474dac56a..43917689d 100644 --- a/.github/workflows/redhat.yml +++ b/.github/workflows/redhat.yml @@ -137,8 +137,8 @@ jobs: shell: bash run: | set -v - source /opt/omnitrace/share/omnitrace/setup-env.sh - ./scripts/test-install.sh --test-omnitrace-{instrument,avail,sample,rewrite,runtime,python}=1 + source /opt/omnitrace/share/rocprofsys/setup-env.sh + ./scripts/test-install.sh --test-rocprof-sys-{instrument,avail,sample,rewrite,runtime,python}=1 - name: Test User API timeout-minutes: 10 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 085c884b8..c0d8537d6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -28,7 +28,7 @@ jobs: run: | sudo apt-get update sudo apt-get install -y cmake - cmake -D OUTPUT_DIR=${PWD} -P scripts/write-omnitrace-install.cmake + cmake -D OUTPUT_DIR=${PWD} -P scripts/write-rocprofsys-install.cmake - name: Generate Release uses: softprops/action-gh-release@v1 with: @@ -36,4 +36,4 @@ jobs: generate_release_notes: True fail_on_unmatched_files: True files: | - omnitrace-install.py + rocprof-sys-install.py diff --git a/.github/workflows/ubuntu-focal.yml b/.github/workflows/ubuntu-focal.yml index 5a4d53379..0849787b7 100644 --- a/.github/workflows/ubuntu-focal.yml +++ b/.github/workflows/ubuntu-focal.yml @@ -167,24 +167,24 @@ jobs: source /usr/share/modules/init/$(basename ${SHELL}) module use ./share/modulefiles module avail - module load omnitrace - echo $(which omnitrace) - ldd $(which omnitrace) - omnitrace-instrument --help - omnitrace-avail --help - omnitrace-sample --help + module load rocprofsys + echo $(which rocprof-sys-instrument) + ldd $(which rocprof-sys-instrument) + rocprof-sys-instrument --help + rocprof-sys-avail --help + rocprof-sys-sample --help - name: Test Build-Tree Source Script timeout-minutes: 45 shell: bash run: | cd build - source ./share/omnitrace/setup-env.sh - echo $(which omnitrace) - ldd $(which omnitrace) - omnitrace-instrument --help - omnitrace-avail --help - omnitrace-sample --help + source ./share/rocprofsys/setup-env.sh + echo $(which rocprof-sys-instrument) + ldd $(which rocprof-sys-instrument) + rocprof-sys-instrument --help + rocprof-sys-avail --help + rocprof-sys-sample --help - name: Install timeout-minutes: 10 @@ -198,8 +198,8 @@ jobs: source /usr/share/modules/init/$(basename ${SHELL}) module use /opt/omnitrace/share/modulefiles module avail - module load omnitrace - ./scripts/test-install.sh --test-omnitrace-{instrument,avail,sample,rewrite,runtime}=1 --test-omnitrace-python=${{ matrix.python }} + module load rocprofsys + ./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 @@ -358,8 +358,8 @@ jobs: timeout-minutes: 15 shell: bash run: | - source /opt/omnitrace/share/omnitrace/setup-env.sh - ./scripts/test-install.sh --test-omnitrace-{instrument,avail,sample,python,rewrite,runtime}=1 + source /opt/omnitrace/share/rocprofsys/setup-env.sh + ./scripts/test-install.sh --test-rocprof-sys-{instrument,avail,sample,python,rewrite,runtime}=1 - name: Test User API timeout-minutes: 10 @@ -502,13 +502,13 @@ jobs: source /usr/share/modules/init/$(basename ${SHELL}) module use ${{ github.workspace }}/build/share/modulefiles module avail - module load omnitrace + module load rocprofsys module list env - module unload omnitrace + module unload rocprofsys module list env - source ${{ github.workspace }}/build/share/omnitrace/setup-env.sh + source ${{ github.workspace }}/build/share/rocprofsys/setup-env.sh env - name: Install @@ -522,8 +522,8 @@ jobs: timeout-minutes: 15 run: | set -v - source /opt/omnitrace/share/omnitrace/setup-env.sh - ${{ github.workspace }}/scripts/test-install.sh --test-omnitrace-{instrument,avail,sample,python,rewrite,runtime}=1 + source /opt/omnitrace/share/rocprofsys/setup-env.sh + ${{ github.workspace }}/scripts/test-install.sh --test-rocprof-sys-{instrument,avail,sample,python,rewrite,runtime}=1 - name: Test Install with Modulefile timeout-minutes: 15 @@ -531,8 +531,8 @@ jobs: set -v source /usr/share/modules/init/$(basename ${SHELL}) module use /opt/omnitrace/share/modulefiles - module load omnitrace - ${{ github.workspace }}/scripts/test-install.sh --test-omnitrace-{instrument,avail,sample,python,rewrite,runtime}=1 + module load rocprofsys + ${{ github.workspace }}/scripts/test-install.sh --test-rocprof-sys-{instrument,avail,sample,python,rewrite,runtime}=1 - name: Test User API timeout-minutes: 10 diff --git a/.github/workflows/ubuntu-jammy.yml b/.github/workflows/ubuntu-jammy.yml index edaae62e9..ec8713775 100644 --- a/.github/workflows/ubuntu-jammy.yml +++ b/.github/workflows/ubuntu-jammy.yml @@ -220,7 +220,7 @@ jobs: module use /opt/omnitrace/share/modulefiles module avail module load omnitrace - ./scripts/test-install.sh --test-omnitrace-{instrument,avail,sample,python,rewrite,runtime}=1 + ./scripts/test-install.sh --test-rocprof-sys-{instrument,avail,sample,python,rewrite,runtime}=1 - name: Test User API timeout-minutes: 10 diff --git a/CMakeLists.txt b/CMakeLists.txt index 8d7bf08e2..046055186 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,7 @@ endif() if(NOT UNIX OR APPLE) message( AUTHOR_WARNING - "omnitrace only supports Linux. Configure and/or build is likely to fail") + "rocprof-sys only supports Linux. Configure and/or build is likely to fail") endif() file(READ "${CMAKE_CURRENT_SOURCE_DIR}/VERSION" FULL_VERSION_STRING LIMIT_COUNT 1) @@ -21,11 +21,14 @@ string(REGEX REPLACE "([0-9]+)\.([0-9]+)\.([0-9]+)(.*)" "\\1.\\2.\\3" OMNITRACE_ "${FULL_VERSION_STRING}") project( - omnitrace + rocprofsys LANGUAGES C CXX VERSION ${OMNITRACE_VERSION} DESCRIPTION "CPU/GPU Application tracing with static/dynamic binary instrumentation" - HOMEPAGE_URL "https://github.com/ROCm/omnitrace") + HOMEPAGE_URL "https://github.com/ROCm/rocprofiler-systems") + +set(PACKAGE_NAME "rocprof-sys") +set(PACKAGE_NAME_UNDERSCORE "rocprof_sys") find_package(Git) @@ -369,35 +372,40 @@ if(NOT OMNITRACE_USE_ROCPROFILER) set(OMNITRACE_ROCP_ENV "# ") endif() +configure_file( + ${PROJECT_SOURCE_DIR}/LICENSE + ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/doc/${PACKAGE_NAME}/LICENSE + COPYONLY) + configure_file( ${PROJECT_SOURCE_DIR}/perfetto.cfg - ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/perfetto.cfg + ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/${PACKAGE_NAME}/perfetto.cfg COPYONLY) configure_file( ${PROJECT_SOURCE_DIR}/cmake/Templates/setup-env.sh.in - ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/setup-env.sh @ONLY) + ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/${PACKAGE_NAME}/setup-env.sh @ONLY) configure_file( ${PROJECT_SOURCE_DIR}/cmake/Templates/modulefile.in - ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/modulefiles/${PROJECT_NAME}/${OMNITRACE_VERSION} + ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/modulefiles/${PACKAGE_NAME}/${OMNITRACE_VERSION} @ONLY) install( - FILES ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/setup-env.sh - ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/perfetto.cfg - DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME} + FILES ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/${PACKAGE_NAME}/setup-env.sh + ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/${PACKAGE_NAME}/perfetto.cfg + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PACKAGE_NAME} COMPONENT setup) install( FILES - ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/modulefiles/${PROJECT_NAME}/${OMNITRACE_VERSION} - DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/modulefiles/${PROJECT_NAME} + ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/modulefiles/${PACKAGE_NAME}/${OMNITRACE_VERSION} + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/modulefiles/${PACKAGE_NAME} COMPONENT setup) install( - FILES ${PROJECT_SOURCE_DIR}/LICENSE - DESTINATION ${CMAKE_INSTALL_DOCDIR} + FILES ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/doc/${PACKAGE_NAME}/LICENSE + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/doc/${PACKAGE_NAME} COMPONENT setup) # ------------------------------------------------------------------------------# diff --git a/LICENSE b/LICENSE index 547704905..c92488b41 100644 --- a/LICENSE +++ b/LICENSE @@ -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 diff --git a/cmake/BuildSettings.cmake b/cmake/BuildSettings.cmake index c4a91ad45..449473179 100644 --- a/cmake/BuildSettings.cmake +++ b/cmake/BuildSettings.cmake @@ -33,16 +33,16 @@ omnitrace_add_cache_option( omnitrace_add_cache_option(OMNITRACE_BUILD_NUMBER "Internal CI use" STRING "0" ADVANCED NO_FEATURE) -omnitrace_add_interface_library(omnitrace-static-libgcc +omnitrace_add_interface_library(rocprofsys-static-libgcc "Link to static version of libgcc") -omnitrace_add_interface_library(omnitrace-static-libstdcxx +omnitrace_add_interface_library(rocprofsys-static-libstdcxx "Link to static version of libstdc++") -omnitrace_add_interface_library(omnitrace-static-libgcc-optional +omnitrace_add_interface_library(rocprofsys-static-libgcc-optional "Link to static version of libgcc") -omnitrace_add_interface_library(omnitrace-static-libstdcxx-optional +omnitrace_add_interface_library(rocprofsys-static-libstdcxx-optional "Link to static version of libstdc++") -target_compile_definitions(omnitrace-compile-options INTERFACE $<$:DEBUG>) +target_compile_definitions(rocprofsys-compile-options INTERFACE $<$:DEBUG>) set(OMNITRACE_SANITIZER_TYPE "leak" @@ -78,7 +78,7 @@ find_package_handle_standard_args(rt-library REQUIRED_VARS rt_LIBRARY) # find_package_handle_standard_args(dw-library REQUIRED_VARS dw_LIBRARY) if(dl_LIBRARY) - target_link_libraries(omnitrace-compile-options INTERFACE ${dl_LIBRARY}) + target_link_libraries(rocprofsys-compile-options INTERFACE ${dl_LIBRARY}) endif() # ----------------------------------------------------------------------------------------# @@ -105,57 +105,57 @@ endif() # extra flags for debug information in debug or optimized binaries # omnitrace_add_interface_library( - omnitrace-compile-debuginfo + rocprofsys-compile-debuginfo "Attempts to set best flags for more expressive profiling information in debug or optimized binaries" ) -add_target_flag_if_avail(omnitrace-compile-debuginfo "-g3" "-fno-omit-frame-pointer" +add_target_flag_if_avail(rocprofsys-compile-debuginfo "-g3" "-fno-omit-frame-pointer" "-fno-optimize-sibling-calls") if(CMAKE_CUDA_COMPILER_IS_NVIDIA) - add_target_cuda_flag(omnitrace-compile-debuginfo "-lineinfo") + add_target_cuda_flag(rocprofsys-compile-debuginfo "-lineinfo") endif() target_compile_options( - omnitrace-compile-debuginfo + rocprofsys-compile-debuginfo INTERFACE $<$:$<$:-rdynamic>> $<$:$<$:-rdynamic>>) if(NOT APPLE) - target_link_options(omnitrace-compile-debuginfo INTERFACE + target_link_options(rocprofsys-compile-debuginfo INTERFACE $<$:-rdynamic>) endif() if(CMAKE_CUDA_COMPILER_IS_NVIDIA) target_compile_options( - omnitrace-compile-debuginfo + rocprofsys-compile-debuginfo INTERFACE $<$:$<$:-Xcompiler=-rdynamic>>) endif() if(dl_LIBRARY) - target_link_libraries(omnitrace-compile-debuginfo INTERFACE ${dl_LIBRARY}) + target_link_libraries(rocprofsys-compile-debuginfo INTERFACE ${dl_LIBRARY}) endif() if(rt_LIBRARY) - target_link_libraries(omnitrace-compile-debuginfo INTERFACE ${rt_LIBRARY}) + target_link_libraries(rocprofsys-compile-debuginfo INTERFACE ${rt_LIBRARY}) endif() # ----------------------------------------------------------------------------------------# # non-debug optimizations # -omnitrace_add_interface_library(omnitrace-compile-extra "Extra optimization flags") +omnitrace_add_interface_library(rocprofsys-compile-extra "Extra optimization flags") if(NOT OMNITRACE_BUILD_CODECOV AND OMNITRACE_BUILD_EXTRA_OPTIMIZATIONS) add_target_flag_if_avail( - omnitrace-compile-extra "-finline-functions" "-funroll-loops" "-ftree-vectorize" + rocprofsys-compile-extra "-finline-functions" "-funroll-loops" "-ftree-vectorize" "-ftree-loop-optimize" "-ftree-loop-vectorize") endif() if(NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" AND OMNITRACE_BUILD_EXTRA_OPTIMIZATIONS AND NOT OMNITRACE_BUILD_CODECOV) - target_link_libraries(omnitrace-compile-options - INTERFACE $) + target_link_libraries(rocprofsys-compile-options + INTERFACE $) add_flag_if_avail( "-fno-signaling-nans" "-fno-trapping-math" "-fno-signed-zeros" "-ffinite-math-only" "-fno-math-errno" "-fpredictive-commoning" @@ -168,28 +168,28 @@ endif() # add_cxx_flag_if_avail("-faligned-new") -omnitrace_add_interface_library(omnitrace-lto "Adds link-time-optimization flags") +omnitrace_add_interface_library(rocprofsys-lto "Adds link-time-optimization flags") if(NOT OMNITRACE_BUILD_CODECOV) omnitrace_save_variables(FLTO VARIABLES CMAKE_CXX_FLAGS) set(_CXX_FLAGS "${CMAKE_CXX_FLAGS}") set(CMAKE_CXX_FLAGS "-flto=thin ${_CXX_FLAGS}") - add_target_flag_if_avail(omnitrace-lto "-flto=thin") + add_target_flag_if_avail(rocprofsys-lto "-flto=thin") if(NOT cxx_omnitrace_lto_flto_thin) set(CMAKE_CXX_FLAGS "-flto ${_CXX_FLAGS}") - add_target_flag_if_avail(omnitrace-lto "-flto") + add_target_flag_if_avail(rocprofsys-lto "-flto") if(NOT cxx_omnitrace_lto_flto) set(OMNITRACE_BUILD_LTO OFF) else() - target_link_options(omnitrace-lto INTERFACE -flto) + target_link_options(rocprofsys-lto INTERFACE -flto) endif() - add_target_flag_if_avail(omnitrace-lto "-fno-fat-lto-objects") + add_target_flag_if_avail(rocprofsys-lto "-fno-fat-lto-objects") if(cxx_omnitrace_lto_fno_fat_lto_objects) - target_link_options(omnitrace-lto INTERFACE -fno-fat-lto-objects) + target_link_options(rocprofsys-lto INTERFACE -fno-fat-lto-objects) endif() else() - target_link_options(omnitrace-lto INTERFACE -flto=thin) + target_link_options(rocprofsys-lto INTERFACE -flto=thin) endif() omnitrace_restore_variables(FLTO VARIABLES CMAKE_CXX_FLAGS) @@ -199,31 +199,31 @@ endif() # print compilation timing reports (Clang compiler) # omnitrace_add_interface_library( - omnitrace-compile-timing + rocprofsys-compile-timing "Adds compiler flags which report compilation timing metrics") if(CMAKE_CXX_COMPILER_IS_CLANG) - add_target_flag_if_avail(omnitrace-compile-timing "-ftime-trace") + add_target_flag_if_avail(rocprofsys-compile-timing "-ftime-trace") if(NOT cxx_omnitrace_compile_timing_ftime_trace) - add_target_flag_if_avail(omnitrace-compile-timing "-ftime-report") + add_target_flag_if_avail(rocprofsys-compile-timing "-ftime-report") endif() else() - add_target_flag_if_avail(omnitrace-compile-timing "-ftime-report") + add_target_flag_if_avail(rocprofsys-compile-timing "-ftime-report") endif() if(OMNITRACE_USE_COMPILE_TIMING) - target_link_libraries(omnitrace-compile-options INTERFACE omnitrace-compile-timing) + target_link_libraries(rocprofsys-compile-options INTERFACE rocprofsys-compile-timing) endif() # ----------------------------------------------------------------------------------------# # fstack-protector # -omnitrace_add_interface_library(omnitrace-stack-protector +omnitrace_add_interface_library(rocprofsys-stack-protector "Adds stack-protector compiler flags") -add_target_flag_if_avail(omnitrace-stack-protector "-fstack-protector-strong" +add_target_flag_if_avail(rocprofsys-stack-protector "-fstack-protector-strong" "-Wstack-protector") if(OMNITRACE_BUILD_STACK_PROTECTOR) - target_link_libraries(omnitrace-compile-options INTERFACE omnitrace-stack-protector) + target_link_libraries(rocprofsys-compile-options INTERFACE rocprofsys-stack-protector) endif() # ----------------------------------------------------------------------------------------# @@ -231,17 +231,17 @@ endif() # if(OMNITRACE_BUILD_DEVELOPER) add_target_flag_if_avail( - omnitrace-compile-options "-Werror" "-Wdouble-promotion" "-Wshadow" "-Wextra" + rocprofsys-compile-options "-Werror" "-Wdouble-promotion" "-Wshadow" "-Wextra" "-Wpedantic" "-Wstack-usage=524288" # 512 KB "/showIncludes") if(OMNITRACE_BUILD_NUMBER GREATER 2) - add_target_flag_if_avail(omnitrace-compile-options "-gsplit-dwarf") + add_target_flag_if_avail(rocprofsys-compile-options "-gsplit-dwarf") endif() endif() if(OMNITRACE_BUILD_LINKER) target_link_options( - omnitrace-compile-options INTERFACE + rocprofsys-compile-options INTERFACE $<$:-fuse-ld=${OMNITRACE_BUILD_LINKER}> $<$:-fuse-ld=${OMNITRACE_BUILD_LINKER}>) endif() @@ -251,20 +251,20 @@ endif() # if(OMNITRACE_BUILD_RELEASE AND NOT OMNITRACE_BUILD_DEBUG) add_target_flag_if_avail( - omnitrace-compile-options "-g1" "-feliminate-unused-debug-symbols" + rocprofsys-compile-options "-g1" "-feliminate-unused-debug-symbols" "-gno-column-info" "-gno-variable-location-views" "-gline-tables-only") endif() # ----------------------------------------------------------------------------------------# # visibility build flags # -omnitrace_add_interface_library(omnitrace-default-visibility +omnitrace_add_interface_library(rocprofsys-default-visibility "Adds -fvisibility=default compiler flag") -omnitrace_add_interface_library(omnitrace-hidden-visibility +omnitrace_add_interface_library(rocprofsys-hidden-visibility "Adds -fvisibility=hidden compiler flag") -add_target_flag_if_avail(omnitrace-default-visibility "-fvisibility=default") -add_target_flag_if_avail(omnitrace-hidden-visibility "-fvisibility=hidden" +add_target_flag_if_avail(rocprofsys-default-visibility "-fvisibility=default") +add_target_flag_if_avail(rocprofsys-hidden-visibility "-fvisibility=hidden" "-fvisibility-inlines-hidden") # ----------------------------------------------------------------------------------------# @@ -292,26 +292,26 @@ set(OMNITRACE_SANITIZER_TYPES alignment) set_property(CACHE OMNITRACE_SANITIZER_TYPE PROPERTY STRINGS "${OMNITRACE_SANITIZER_TYPES}") -omnitrace_add_interface_library(omnitrace-sanitizer-compile-options +omnitrace_add_interface_library(rocprofsys-sanitizer-compile-options "Adds compiler flags for sanitizers") omnitrace_add_interface_library( - omnitrace-sanitizer + rocprofsys-sanitizer "Adds compiler flags to enable ${OMNITRACE_SANITIZER_TYPE} sanitizer (-fsanitizer=${OMNITRACE_SANITIZER_TYPE})" ) set(COMMON_SANITIZER_FLAGS "-fno-optimize-sibling-calls" "-fno-omit-frame-pointer" "-fno-inline-functions") -add_target_flag(omnitrace-sanitizer-compile-options ${COMMON_SANITIZER_FLAGS}) +add_target_flag(rocprofsys-sanitizer-compile-options ${COMMON_SANITIZER_FLAGS}) foreach(_TYPE ${OMNITRACE_SANITIZER_TYPES}) set(_FLAG "-fsanitize=${_TYPE}") omnitrace_add_interface_library( - omnitrace-${_TYPE}-sanitizer + rocprofsys-${_TYPE}-sanitizer "Adds compiler flags to enable ${_TYPE} sanitizer (${_FLAG})") - add_target_flag(omnitrace-${_TYPE}-sanitizer ${_FLAG}) - target_link_libraries(omnitrace-${_TYPE}-sanitizer - INTERFACE omnitrace-sanitizer-compile-options) - set_property(TARGET omnitrace-${_TYPE}-sanitizer + add_target_flag(rocprofsys-${_TYPE}-sanitizer ${_FLAG}) + target_link_libraries(rocprofsys-${_TYPE}-sanitizer + INTERFACE rocprofsys-sanitizer-compile-options) + set_property(TARGET rocprofsys-${_TYPE}-sanitizer PROPERTY INTERFACE_LINK_OPTIONS ${_FLAG} ${COMMON_SANITIZER_FLAGS}) endforeach() @@ -320,13 +320,13 @@ unset(COMMON_SANITIZER_FLAGS) if(OMNITRACE_USE_SANITIZER) foreach(_TYPE ${OMNITRACE_SANITIZER_TYPE}) - if(TARGET omnitrace-${_TYPE}-sanitizer) - target_link_libraries(omnitrace-sanitizer - INTERFACE omnitrace-${_TYPE}-sanitizer) + if(TARGET rocprofsys-${_TYPE}-sanitizer) + target_link_libraries(rocprof-sys-sanitizer + INTERFACE rocprofsys-${_TYPE}-sanitizer) else() message( - FATAL_ERROR "Error! Target 'omnitrace-${_TYPE}-sanitizer' does not exist!" - ) + FATAL_ERROR + "Error! Target 'rocprofsys-${_TYPE}-sanitizer' does not exist!") endif() endforeach() else() @@ -337,29 +337,29 @@ endif() # static lib flags # target_compile_options( - omnitrace-static-libgcc + rocprofsys-static-libgcc INTERFACE $<$:$<$:-static-libgcc>> $<$:$<$:-static-libgcc>>) target_link_options( - omnitrace-static-libgcc INTERFACE + rocprofsys-static-libgcc INTERFACE $<$:$<$:-static-libgcc>> $<$:$<$:-static-libgcc>>) target_compile_options( - omnitrace-static-libstdcxx + rocprofsys-static-libstdcxx INTERFACE $<$:$<$:-static-libstdc++>>) target_link_options( - omnitrace-static-libstdcxx INTERFACE + rocprofsys-static-libstdcxx INTERFACE $<$:$<$:-static-libstdc++>>) if(OMNITRACE_BUILD_STATIC_LIBGCC) - target_link_libraries(omnitrace-static-libgcc-optional - INTERFACE omnitrace-static-libgcc) + target_link_libraries(rocprofsys-static-libgcc-optional + INTERFACE rocprofsys-static-libgcc) endif() if(OMNITRACE_BUILD_STATIC_LIBSTDCXX) - target_link_libraries(omnitrace-static-libstdcxx-optional - INTERFACE omnitrace-static-libstdcxx) + target_link_libraries(rocprofsys-static-libstdcxx-optional + INTERFACE rocprofsys-static-libstdcxx) endif() # ----------------------------------------------------------------------------------------# @@ -368,5 +368,5 @@ endif() get_property(LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES) if(NOT APPLE OR "$ENV{CONDA_PYTHON_EXE}" STREQUAL "") - add_user_flags(omnitrace-compile-options "CXX") + add_user_flags(rocprofsys-compile-options "CXX") endif() diff --git a/cmake/ConfigCPack.cmake b/cmake/ConfigCPack.cmake index 82c354b51..d01026f94 100644 --- a/cmake/ConfigCPack.cmake +++ b/cmake/ConfigCPack.cmake @@ -34,7 +34,7 @@ if(NOT _SYSTEM_NAME) endif() # Add packaging directives -set(CPACK_PACKAGE_NAME ${PROJECT_NAME}) +set(CPACK_PACKAGE_NAME ${PACKAGE_NAME}) set(CPACK_PACKAGE_VENDOR "Advanced Micro Devices, Inc.") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Runtime instrumentation and binary rewriting for Perfetto via Dyninst") @@ -42,7 +42,7 @@ set(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}") set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}") set(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}") -set(CPACK_PACKAGE_CONTACT "jonathan.madsen@amd.com") +set(CPACK_PACKAGE_CONTACT "https://github.com/ROCm/rocprofiler-systems") set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE") set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF) set(OMNITRACE_CPACK_SYSTEM_NAME @@ -126,7 +126,7 @@ omnitrace_add_feature(OMNITRACE_PACKAGE_FILE_NAME "CPack filename") # # -------------------------------------------------------------------------------------- # -set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/ROCm/omnitrace") +set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/ROCm/rocprofiler-systems") set(CPACK_DEBIAN_PACKAGE_RELEASE "${OMNITRACE_CPACK_SYSTEM_NAME}${OMNITRACE_CPACK_PACKAGE_SUFFIX}") string(REGEX REPLACE "([a-zA-Z])-([0-9])" "\\1\\2" CPACK_DEBIAN_PACKAGE_RELEASE diff --git a/cmake/ConfigInstall.cmake b/cmake/ConfigInstall.cmake index 691a41014..6be201563 100644 --- a/cmake/ConfigInstall.cmake +++ b/cmake/ConfigInstall.cmake @@ -6,10 +6,10 @@ include(CMakePackageConfigHelpers) set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME config) install( - EXPORT omnitrace-library-targets - FILE omnitrace-library-targets.cmake - NAMESPACE omnitrace:: - DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cmake/omnitrace) + EXPORT rocprofsys-library-targets + FILE rocprofsys-library-targets.cmake + NAMESPACE rocprofsys:: + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PACKAGE_NAME}) # ------------------------------------------------------------------------------# # install tree @@ -21,40 +21,40 @@ set(PROJECT_BUILD_TARGETS user) configure_package_config_file( ${PROJECT_SOURCE_DIR}/cmake/Templates/${PROJECT_NAME}-config.cmake.in - ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PROJECT_NAME}/${PROJECT_NAME}-config.cmake - INSTALL_DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cmake/omnitrace + ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PACKAGE_NAME}/${PROJECT_NAME}-config.cmake + INSTALL_DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PACKAGE_NAME} INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} PATH_VARS PROJECT_INSTALL_DIR INCLUDE_INSTALL_DIR LIB_INSTALL_DIR) write_basic_package_version_file( - ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PROJECT_NAME}/${PROJECT_NAME}-version.cmake + ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PACKAGE_NAME}/${PROJECT_NAME}-version.cmake VERSION ${PROJECT_VERSION} COMPATIBILITY SameMinorVersion) install( FILES - ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PROJECT_NAME}/${PROJECT_NAME}-config.cmake - ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PROJECT_NAME}/${PROJECT_NAME}-version.cmake - DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PROJECT_NAME} + ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PACKAGE_NAME}/${PROJECT_NAME}-config.cmake + ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PACKAGE_NAME}/${PROJECT_NAME}-version.cmake + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PACKAGE_NAME} OPTIONAL) -export(PACKAGE ${PROJECT_NAME}) +export(PACKAGE ${PACKAGE_NAME}) # ------------------------------------------------------------------------------# # install the validate-causal-json python script as a utility # configure_file( ${PROJECT_SOURCE_DIR}/tests/validate-causal-json.py - ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/omnitrace-causal-print COPYONLY) + ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/rocprof-sys-causal-print COPYONLY) -install(PROGRAMS ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/omnitrace-causal-print +install(PROGRAMS ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/rocprof-sys-causal-print DESTINATION ${CMAKE_INSTALL_BINDIR}) # ------------------------------------------------------------------------------# # build tree # set(_BUILDTREE_EXPORT_DIR - "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/cmake/omnitrace") + "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PACKAGE_NAME}") if(NOT EXISTS "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}") file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}") @@ -64,15 +64,15 @@ if(NOT EXISTS "${_BUILDTREE_EXPORT_DIR}") file(MAKE_DIRECTORY "${_BUILDTREE_EXPORT_DIR}") endif() -if(NOT EXISTS "${_BUILDTREE_EXPORT_DIR}/omnitrace-library-targets.cmake") - file(TOUCH "${_BUILDTREE_EXPORT_DIR}/omnitrace-library-targets.cmake") +if(NOT EXISTS "${_BUILDTREE_EXPORT_DIR}/rocprofsys-library-targets.cmake") + file(TOUCH "${_BUILDTREE_EXPORT_DIR}/rocprofsys-library-targets.cmake") endif() export( - EXPORT omnitrace-library-targets - NAMESPACE omnitrace:: - FILE "${_BUILDTREE_EXPORT_DIR}/omnitrace-library-targets.cmake") + EXPORT rocprofsys-library-targets + NAMESPACE rocprofsys:: + FILE "${_BUILDTREE_EXPORT_DIR}/rocprofsys-library-targets.cmake") -set(omnitrace_DIR +set(rocprofsys_DIR "${_BUILDTREE_EXPORT_DIR}" - CACHE PATH "omnitrace" FORCE) + CACHE PATH "${PACKAGE_NAME}" FORCE) diff --git a/cmake/ElfUtils.cmake b/cmake/ElfUtils.cmake index df6a9a99c..8a3c4a8b5 100644 --- a/cmake/ElfUtils.cmake +++ b/cmake/ElfUtils.cmake @@ -1,7 +1,7 @@ # ====================================================================================== # elfutils.cmake # -# Configure elfutils for omnitrace +# Configure elfutils for rocprofsys # # ---------------------------------------- # @@ -100,7 +100,7 @@ set(_eu_build_byproducts "${_eu_root}/lib/libdw${CMAKE_STATIC_LIBRARY_SUFFIX}" "${_eu_root}/lib/libelf${CMAKE_STATIC_LIBRARY_SUFFIX}") externalproject_add( - omnitrace-elfutils-build + rocprofsys-elfutils-build PREFIX ${PROJECT_BINARY_DIR}/external/elfutils URL ${ElfUtils_DOWNLOAD_URL} "https://sourceware.org/elfutils/ftp/${ElfUtils_DOWNLOAD_VERSION}/elfutils-${ElfUtils_DOWNLOAD_VERSION}.tar.bz2" @@ -119,7 +119,7 @@ externalproject_add( # target for re-executing the installation add_custom_target( - omnitrace-elfutils-install + rocprofsys-elfutils-install COMMAND ${MAKE_COMMAND} install -s WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/external/elfutils/src/ElfUtils-External COMMENT "Installing ElfUtils...") diff --git a/cmake/Formatting.cmake b/cmake/Formatting.cmake index 52c17d127..8d74a49d4 100644 --- a/cmake/Formatting.cmake +++ b/cmake/Formatting.cmake @@ -86,18 +86,19 @@ if(OMNITRACE_CLANG_FORMAT_EXE if(OMNITRACE_CLANG_FORMAT_EXE) add_custom_target( - format-omnitrace-source + format-rocprofsys-source ${OMNITRACE_CLANG_FORMAT_EXE} -i ${sources} ${headers} ${examples} ${tests_source} - COMMENT "[omnitrace] Running C++ formatter ${OMNITRACE_CLANG_FORMAT_EXE}...") + COMMENT "[rocprof-sys] Running C++ formatter ${OMNITRACE_CLANG_FORMAT_EXE}..." + ) endif() if(OMNITRACE_BLACK_FORMAT_EXE) add_custom_target( - format-omnitrace-python + format-rocprofsys-python ${OMNITRACE_BLACK_FORMAT_EXE} -q ${PROJECT_SOURCE_DIR} COMMENT - "[omnitrace] Running Python formatter ${OMNITRACE_BLACK_FORMAT_EXE}...") + "[rocprof-sys] Running Python formatter ${OMNITRACE_BLACK_FORMAT_EXE}...") if(NOT TARGET format-python) add_custom_target(format-python) endif() @@ -105,25 +106,25 @@ if(OMNITRACE_CLANG_FORMAT_EXE if(OMNITRACE_CMAKE_FORMAT_EXE) add_custom_target( - format-omnitrace-cmake + format-rocprofsys-cmake ${OMNITRACE_CMAKE_FORMAT_EXE} -i ${cmake_files} - COMMENT "[omnitrace] Running CMake formatter ${OMNITRACE_CMAKE_FORMAT_EXE}..." - ) + COMMENT + "[rocprof-sys] Running CMake formatter ${OMNITRACE_CMAKE_FORMAT_EXE}...") if(NOT TARGET format-cmake) add_custom_target(format-cmake) endif() endif() foreach(_TYPE source python cmake) - if(TARGET format-omnitrace-${_TYPE}) - add_dependencies(format-omnitrace format-omnitrace-${_TYPE}) - add_dependencies(format-${_TYPE} format-omnitrace-${_TYPE}) + if(TARGET format-rocprofsys-${_TYPE}) + add_dependencies(format-omnitrace format-rocprofsys-${_TYPE}) + add_dependencies(format-${_TYPE} format-rocprofsys-${_TYPE}) endif() endforeach() foreach(_TYPE source python) - if(TARGET format-omnitrace-${_TYPE}) - add_dependencies(format format-omnitrace-${_TYPE}) + if(TARGET format-rocprofsys-${_TYPE}) + add_dependencies(format format-rocprofsys-${_TYPE}) endif() endforeach() else() diff --git a/cmake/MacroUtilities.cmake b/cmake/MacroUtilities.cmake index af48a5517..01dbf685a 100644 --- a/cmake/MacroUtilities.cmake +++ b/cmake/MacroUtilities.cmake @@ -17,7 +17,7 @@ include(CMakeParseArguments) # function(OMNITRACE_MESSAGE TYPE) if(NOT OMNITRACE_QUIET_CONFIG) - message(${TYPE} "[omnitrace] ${ARGN}") + message(${TYPE} "[rocprof-sys] ${ARGN}") endif() endfunction() @@ -169,9 +169,9 @@ endfunction() # Creates a target which runs ctest but depends on all the tests being built. # function(ADD_OMNITRACE_TEST_TARGET) - if(NOT TARGET omnitrace-test) + if(NOT TARGET rocprofsys-test) add_custom_target( - omnitrace-test + rocprofsys-test COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR} --target test WORKING_DIRECTORY ${PROJECT_BINARY_DIR} COMMENT "Running tests...") @@ -555,7 +555,7 @@ function(omnitrace_custom_compilation) cmake_parse_arguments(COMP "GLOBAL;PROJECT" "COMPILER" "DIRECTORY;TARGET;SOURCE" ${ARGN}) - # find omnitrace-launch-compiler + # find rocprofsys-launch-compiler find_program( OMNITRACE_COMPILE_LAUNCHER NAMES omnitrace-launch-compiler @@ -570,7 +570,7 @@ function(omnitrace_custom_compilation) if(NOT OMNITRACE_COMPILE_LAUNCHER) message( FATAL_ERROR - "omnitrace could not find 'omnitrace-launch-compiler'. Please set '-DOMNITRACE_COMPILE_LAUNCHER=/path/to/launcher'" + "rocprofsys could not find 'rocprofsys-launch-compiler'. Please set '-DOMNITRACE_COMPILE_LAUNCHER=/path/to/launcher'" ) endif() diff --git a/cmake/PAPI.cmake b/cmake/PAPI.cmake index af8a207e6..b6add21d5 100644 --- a/cmake/PAPI.cmake +++ b/cmake/PAPI.cmake @@ -1,7 +1,7 @@ # ====================================================================================== # PAPI.cmake # -# Configure papi for omnitrace +# Configure papi for rocprofsys # # ====================================================================================== @@ -199,7 +199,7 @@ set(PAPI_C_COMPILER include(ExternalProject) externalproject_add( - omnitrace-papi-build + rocprofsys-papi-build PREFIX ${PROJECT_BINARY_DIR}/external/papi SOURCE_DIR ${OMNITRACE_PAPI_SOURCE_DIR}/src BUILD_IN_SOURCE 1 @@ -218,7 +218,7 @@ externalproject_add( # target for re-executing the installation add_custom_target( - omnitrace-papi-install + rocprofsys-papi-install COMMAND ${CMAKE_COMMAND} -E env CFLAGS=-fPIC\ -O3\ -Wno-stringop-truncation ${OMNITRACE_PAPI_EXTRA_ENV} ${MAKE_EXECUTABLE} static install -s COMMAND ${CMAKE_COMMAND} -E env CFLAGS=-fPIC\ -O3\ -Wno-stringop-truncation @@ -227,7 +227,7 @@ add_custom_target( COMMENT "Installing PAPI...") add_custom_target( - omnitrace-papi-clean + rocprofsys-papi-clean COMMAND ${MAKE_EXECUTABLE} distclean COMMAND ${CMAKE_COMMAND} -E rm -rf ${OMNITRACE_PAPI_INSTALL_DIR}/include/* COMMAND ${CMAKE_COMMAND} -E rm -rf ${OMNITRACE_PAPI_INSTALL_DIR}/lib/* @@ -257,16 +257,16 @@ set(PAPI_pfm_STATIC_LIBRARY ${OMNITRACE_PAPI_INSTALL_DIR}/lib/libpfm.a CACHE FILEPATH "PAPI library" FORCE) -target_include_directories(omnitrace-papi SYSTEM +target_include_directories(rocprofsys-papi SYSTEM INTERFACE $) -target_link_libraries(omnitrace-papi INTERFACE $ - $) +target_link_libraries(rocprofsys-papi INTERFACE $ + $) omnitrace_target_compile_definitions( - omnitrace-papi INTERFACE OMNITRACE_USE_PAPI $) + rocprofsys-papi INTERFACE OMNITRACE_USE_PAPI $) install( DIRECTORY ${OMNITRACE_PAPI_INSTALL_DIR}/lib/ - DESTINATION ${CMAKE_INSTALL_LIBDIR}/omnitrace + DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PACKAGE_NAME} COMPONENT papi FILES_MATCHING PATTERN "*.so*") @@ -289,7 +289,7 @@ foreach( papi_version papi_xml_event_info) - string(REPLACE "_" "-" _UTIL_EXE_INSTALL_NAME "omnitrace-${_UTIL_EXE}") + string(REPLACE "_" "-" _UTIL_EXE_INSTALL_NAME "rocprof-sys-${_UTIL_EXE}") # RPM installer on RedHat/RockyLinux throws error that #!/usr/bin/python should either # be #!/usr/bin/python2 or #!/usr/bin/python3 diff --git a/cmake/Packages.cmake b/cmake/Packages.cmake index a391408b6..49fd7e517 100644 --- a/cmake/Packages.cmake +++ b/cmake/Packages.cmake @@ -8,49 +8,49 @@ include_guard(DIRECTORY) # ######################################################################################## omnitrace_add_interface_library( - omnitrace-headers "Provides minimal set of include flags to compile with omnitrace") -omnitrace_add_interface_library(omnitrace-threading "Enables multithreading support") + rocprofsys-headers "Provides minimal set of include flags to compile with rocprofsys") +omnitrace_add_interface_library(rocprofsys-threading "Enables multithreading support") omnitrace_add_interface_library( - omnitrace-dyninst + rocprofsys-dyninst "Provides flags and libraries for Dyninst (dynamic instrumentation)") -omnitrace_add_interface_library(omnitrace-hip "Provides flags and libraries for HIP") -omnitrace_add_interface_library(omnitrace-roctracer +omnitrace_add_interface_library(rocprofsys-hip "Provides flags and libraries for HIP") +omnitrace_add_interface_library(rocprofsys-roctracer "Provides flags and libraries for roctracer") -omnitrace_add_interface_library(omnitrace-rocprofiler +omnitrace_add_interface_library(rocprofsys-rocprofiler "Provides flags and libraries for rocprofiler") -omnitrace_add_interface_library(omnitrace-rocm-smi +omnitrace_add_interface_library(rocprofsys-rocm-smi "Provides flags and libraries for rocm-smi") omnitrace_add_interface_library( - omnitrace-rccl "Provides flags for ROCm Communication Collectives Library (RCCL)") -omnitrace_add_interface_library(omnitrace-mpi "Provides MPI or MPI headers") -omnitrace_add_interface_library(omnitrace-bfd "Provides Binary File Descriptor (BFD)") -omnitrace_add_interface_library(omnitrace-ptl "Enables PTL support (tasking)") -omnitrace_add_interface_library(omnitrace-papi "Enable PAPI support") -omnitrace_add_interface_library(omnitrace-ompt "Enable OMPT support") -omnitrace_add_interface_library(omnitrace-python "Enables Python support") -omnitrace_add_interface_library(omnitrace-elfutils "Provides ElfUtils") -omnitrace_add_interface_library(omnitrace-perfetto "Enables Perfetto support") -omnitrace_add_interface_library(omnitrace-timemory "Provides timemory libraries") -omnitrace_add_interface_library(omnitrace-timemory-config + rocprofsys-rccl "Provides flags for ROCm Communication Collectives Library (RCCL)") +omnitrace_add_interface_library(rocprofsys-mpi "Provides MPI or MPI headers") +omnitrace_add_interface_library(rocprofsys-bfd "Provides Binary File Descriptor (BFD)") +omnitrace_add_interface_library(rocprofsys-ptl "Enables PTL support (tasking)") +omnitrace_add_interface_library(rocprofsys-papi "Enable PAPI support") +omnitrace_add_interface_library(rocprofsys-ompt "Enable OMPT support") +omnitrace_add_interface_library(rocprofsys-python "Enables Python support") +omnitrace_add_interface_library(rocprofsys-elfutils "Provides ElfUtils") +omnitrace_add_interface_library(rocprofsys-perfetto "Enables Perfetto support") +omnitrace_add_interface_library(rocprofsys-timemory "Provides timemory libraries") +omnitrace_add_interface_library(rocprofsys-timemory-config "CMake interface library applied to all timemory targets") -omnitrace_add_interface_library(omnitrace-compile-definitions "Compile definitions") +omnitrace_add_interface_library(rocprofsys-compile-definitions "Compile definitions") # libraries with relevant compile definitions set(OMNITRACE_EXTENSION_LIBRARIES - omnitrace::omnitrace-hip - omnitrace::omnitrace-roctracer - omnitrace::omnitrace-rocprofiler - omnitrace::omnitrace-rocm-smi - omnitrace::omnitrace-rccl - omnitrace::omnitrace-bfd - omnitrace::omnitrace-mpi - omnitrace::omnitrace-ptl - omnitrace::omnitrace-ompt - omnitrace::omnitrace-papi - omnitrace::omnitrace-perfetto) + rocprofsys::rocprofsys-hip + rocprofsys::rocprofsys-roctracer + rocprofsys::rocprofsys-rocprofiler + rocprofsys::rocprofsys-rocm-smi + rocprofsys::rocprofsys-rccl + rocprofsys::rocprofsys-bfd + rocprofsys::rocprofsys-mpi + rocprofsys::rocprofsys-ptl + rocprofsys::rocprofsys-ompt + rocprofsys::rocprofsys-papi + rocprofsys::rocprofsys-perfetto) target_include_directories( - omnitrace-headers + rocprofsys-headers INTERFACE $ $ $ @@ -59,7 +59,7 @@ target_include_directories( $) # include threading because of rooflines -target_link_libraries(omnitrace-headers INTERFACE omnitrace::omnitrace-threading) +target_link_libraries(rocprofsys-headers INTERFACE rocprofsys::rocprofsys-threading) # ensure the env overrides the appending /opt/rocm later string(REPLACE ":" ";" CMAKE_PREFIX_PATH "$ENV{CMAKE_PREFIX_PATH};${CMAKE_PREFIX_PATH}") @@ -94,11 +94,11 @@ find_library(pthread_LIBRARY NAMES pthread pthreads) find_package_handle_standard_args(pthread-library REQUIRED_VARS pthread_LIBRARY) if(pthread_LIBRARY) - target_link_libraries(omnitrace-threading INTERFACE ${pthread_LIBRARY}) + target_link_libraries(rocprofsys-threading INTERFACE ${pthread_LIBRARY}) else() - find_package(Threads ${omnitrace_FIND_QUIETLY} ${omnitrace_FIND_REQUIREMENT}) + find_package(Threads ${rocprofsys_FIND_QUIETLY} ${rocprofsys_FIND_REQUIREMENT}) if(Threads_FOUND) - target_link_libraries(omnitrace-threading INTERFACE Threads::Threads) + target_link_libraries(rocprofsys-threading INTERFACE Threads::Threads) endif() endif() @@ -106,7 +106,7 @@ foreach(_LIB dl rt) find_library(${_LIB}_LIBRARY NAMES ${_LIB}) find_package_handle_standard_args(${_LIB}-library REQUIRED_VARS ${_LIB}_LIBRARY) if(${_LIB}_LIBRARY) - target_link_libraries(omnitrace-threading INTERFACE ${${_LIB}_LIBRARY}) + target_link_libraries(rocprofsys-threading INTERFACE ${${_LIB}_LIBRARY}) endif() endforeach() @@ -123,7 +123,7 @@ if(OMNITRACE_USE_HIP find_package(ROCmVersion) if(NOT ROCmVersion_FOUND) - find_package(hip ${omnitrace_FIND_QUIETLY} REQUIRED HINTS + find_package(hip ${rocprofsys_FIND_QUIETLY} REQUIRED HINTS ${OMNITRACE_DEFAULT_ROCM_PATH} PATHS ${OMNITRACE_DEFAULT_ROCM_PATH}) if(SPACK_BUILD) find_package(ROCmVersion HINTS ${ROCM_PATH} PATHS ${ROCM_PATH}) @@ -162,7 +162,7 @@ if(OMNITRACE_USE_HIP set(roctracer_kfdwrapper_LIBRARY) endif() - omnitrace_add_feature(OMNITRACE_ROCM_VERSION "ROCm version used by omnitrace") + omnitrace_add_feature(OMNITRACE_ROCM_VERSION "ROCm version used by rocprofsys") else() set(OMNITRACE_HIP_VERSION "0.0.0") set(OMNITRACE_HIP_VERSION_MAJOR 0) @@ -177,9 +177,9 @@ endif() # ----------------------------------------------------------------------------------------# if(OMNITRACE_USE_HIP) - find_package(hip ${omnitrace_FIND_QUIETLY} REQUIRED) - omnitrace_target_compile_definitions(omnitrace-hip INTERFACE OMNITRACE_USE_HIP) - target_link_libraries(omnitrace-hip INTERFACE hip::host) + find_package(hip ${rocprofsys_FIND_QUIETLY} REQUIRED) + omnitrace_target_compile_definitions(rocprofsys-hip INTERFACE OMNITRACE_USE_HIP) + target_link_libraries(rocprofsys-hip INTERFACE hip::host) endif() # ----------------------------------------------------------------------------------------# @@ -189,11 +189,11 @@ endif() # ----------------------------------------------------------------------------------------# if(OMNITRACE_USE_ROCTRACER) - find_package(roctracer ${omnitrace_FIND_QUIETLY} REQUIRED) - omnitrace_target_compile_definitions(omnitrace-roctracer + find_package(roctracer ${rocprofsys_FIND_QUIETLY} REQUIRED) + omnitrace_target_compile_definitions(rocprofsys-roctracer INTERFACE OMNITRACE_USE_ROCTRACER) - target_link_libraries(omnitrace-roctracer INTERFACE roctracer::roctracer - omnitrace::omnitrace-hip) + target_link_libraries(rocprofsys-roctracer INTERFACE roctracer::roctracer + rocprofsys::rocprofsys-hip) endif() # ----------------------------------------------------------------------------------------# @@ -202,10 +202,10 @@ endif() # # ----------------------------------------------------------------------------------------# if(OMNITRACE_USE_ROCPROFILER) - find_package(rocprofiler ${omnitrace_FIND_QUIETLY} REQUIRED) - omnitrace_target_compile_definitions(omnitrace-rocprofiler + find_package(rocprofiler ${rocprofsys_FIND_QUIETLY} REQUIRED) + omnitrace_target_compile_definitions(rocprofsys-rocprofiler INTERFACE OMNITRACE_USE_ROCPROFILER) - target_link_libraries(omnitrace-rocprofiler INTERFACE rocprofiler::rocprofiler) + target_link_libraries(rocprofsys-rocprofiler INTERFACE rocprofiler::rocprofiler) endif() # ----------------------------------------------------------------------------------------# @@ -215,10 +215,10 @@ endif() # ----------------------------------------------------------------------------------------# if(OMNITRACE_USE_ROCM_SMI) - find_package(rocm-smi ${omnitrace_FIND_QUIETLY} REQUIRED) - omnitrace_target_compile_definitions(omnitrace-rocm-smi + find_package(rocm-smi ${rocprofsys_FIND_QUIETLY} REQUIRED) + omnitrace_target_compile_definitions(rocprofsys-rocm-smi INTERFACE OMNITRACE_USE_ROCM_SMI) - target_link_libraries(omnitrace-rocm-smi INTERFACE rocm-smi::rocm-smi) + target_link_libraries(rocprofsys-rocm-smi INTERFACE rocm-smi::rocm-smi) endif() # ----------------------------------------------------------------------------------------# @@ -228,9 +228,9 @@ endif() # ----------------------------------------------------------------------------------------# if(OMNITRACE_USE_RCCL) - find_package(RCCL-Headers ${omnitrace_FIND_QUIETLY} REQUIRED) - target_link_libraries(omnitrace-rccl INTERFACE roc::rccl-headers) - omnitrace_target_compile_definitions(omnitrace-rccl INTERFACE OMNITRACE_USE_RCCL) + find_package(RCCL-Headers ${rocprofsys_FIND_QUIETLY} REQUIRED) + target_link_libraries(rocprofsys-rccl INTERFACE roc::rccl-headers) + omnitrace_target_compile_definitions(rocprofsys-rccl INTERFACE OMNITRACE_USE_RCCL) endif() # ----------------------------------------------------------------------------------------# @@ -243,15 +243,15 @@ endif() set(_OMNITRACE_MPI_HEADERS_ALLOW_MPICH ${MPI_HEADERS_ALLOW_MPICH}) if(OMNITRACE_USE_MPI) - find_package(MPI ${omnitrace_FIND_QUIETLY} REQUIRED) - target_link_libraries(omnitrace-mpi INTERFACE MPI::MPI_C MPI::MPI_CXX) - omnitrace_target_compile_definitions(omnitrace-mpi INTERFACE TIMEMORY_USE_MPI=1 - OMNITRACE_USE_MPI) + find_package(MPI ${rocprofsys_FIND_QUIETLY} REQUIRED) + target_link_libraries(rocprofsys-mpi INTERFACE MPI::MPI_C MPI::MPI_CXX) + omnitrace_target_compile_definitions(rocprofsys-mpi INTERFACE TIMEMORY_USE_MPI=1 + OMNITRACE_USE_MPI) elseif(OMNITRACE_USE_MPI_HEADERS) - find_package(MPI-Headers ${omnitrace_FIND_QUIETLY} REQUIRED) + find_package(MPI-Headers ${rocprofsys_FIND_QUIETLY} REQUIRED) omnitrace_target_compile_definitions( - omnitrace-mpi INTERFACE TIMEMORY_USE_MPI_HEADERS=1 OMNITRACE_USE_MPI_HEADERS) - target_link_libraries(omnitrace-mpi INTERFACE MPI::MPI_HEADERS) + rocprofsys-mpi INTERFACE TIMEMORY_USE_MPI_HEADERS=1 OMNITRACE_USE_MPI_HEADERS) + target_link_libraries(rocprofsys-mpi INTERFACE MPI::MPI_HEADERS) endif() # ----------------------------------------------------------------------------------------# @@ -261,7 +261,7 @@ endif() # ----------------------------------------------------------------------------------------# omnitrace_target_compile_definitions( - omnitrace-ompt INTERFACE OMNITRACE_USE_OMPT=$) + rocprofsys-ompt INTERFACE OMNITRACE_USE_OMPT=$) # ----------------------------------------------------------------------------------------# # @@ -271,10 +271,10 @@ omnitrace_target_compile_definitions( include(ElfUtils) -target_include_directories(omnitrace-elfutils SYSTEM INTERFACE ${ElfUtils_INCLUDE_DIRS}) -target_compile_definitions(omnitrace-elfutils INTERFACE ${ElfUtils_DEFINITIONS}) -target_link_directories(omnitrace-elfutils INTERFACE ${ElfUtils_LIBRARY_DIRS}) -target_link_libraries(omnitrace-elfutils INTERFACE ${ElfUtils_LIBRARIES}) +target_include_directories(rocprofsys-elfutils SYSTEM INTERFACE ${ElfUtils_INCLUDE_DIRS}) +target_compile_definitions(rocprofsys-elfutils INTERFACE ${ElfUtils_DEFINITIONS}) +target_link_directories(rocprofsys-elfutils INTERFACE ${ElfUtils_LIBRARY_DIRS}) +target_link_libraries(rocprofsys-elfutils INTERFACE ${ElfUtils_LIBRARIES}) # ----------------------------------------------------------------------------------------# # @@ -321,13 +321,14 @@ if(OMNITRACE_BUILD_DYNINST) CMAKE_BUILD_RPATH CMAKE_INSTALL_RPATH_USE_LINK_PATH) set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_INSTALL_RPATH_USE_LINK_PATH OFF) - set(CMAKE_BUILD_RPATH "\$ORIGIN:\$ORIGIN/omnitrace") - set(CMAKE_INSTALL_RPATH "\$ORIGIN:\$ORIGIN/omnitrace") + + set(CMAKE_BUILD_RPATH "\$ORIGIN:\$ORIGIN/${PACKAGE_NAME}") + set(CMAKE_INSTALL_RPATH "\$ORIGIN:\$ORIGIN/${PACKAGE_NAME}") set(DYNINST_TPL_INSTALL_PREFIX - "omnitrace" + "${PACKAGE_NAME}" CACHE PATH "Third-party library install-tree install prefix" FORCE) set(DYNINST_TPL_INSTALL_LIB_DIR - "omnitrace" + "${PACKAGE_NAME}" CACHE PATH "Third-party library install-tree install library prefix" FORCE) add_subdirectory(external/dyninst EXCLUDE_FROM_ALL) omnitrace_restore_variables( @@ -354,35 +355,36 @@ if(OMNITRACE_BUILD_DYNINST) if(TARGET ${_LIB}) install( TARGETS ${_LIB} - DESTINATION ${CMAKE_INSTALL_LIBDIR}/omnitrace + DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PACKAGE_NAME} COMPONENT dyninst - PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/omnitrace/dyninst) + PUBLIC_HEADER + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PACKAGE_NAME}/dyninst) endif() endforeach() # for packaging install( DIRECTORY ${DYNINST_TPL_STAGING_PREFIX}/lib/ - DESTINATION ${CMAKE_INSTALL_LIBDIR}/omnitrace + DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PACKAGE_NAME} COMPONENT dyninst FILES_MATCHING PATTERN "*${CMAKE_SHARED_LIBRARY_SUFFIX}*") - target_link_libraries(omnitrace-dyninst INTERFACE Dyninst::Dyninst) + target_link_libraries(rocprofsys-dyninst INTERFACE Dyninst::Dyninst) else() - find_package(Dyninst ${omnitrace_FIND_QUIETLY} REQUIRED + find_package(Dyninst ${rocprofsys_FIND_QUIETLY} REQUIRED COMPONENTS dyninstAPI parseAPI instructionAPI symtabAPI) if(TARGET Dyninst::Dyninst) # updated Dyninst CMake system was found - target_link_libraries(omnitrace-dyninst INTERFACE Dyninst::Dyninst) + target_link_libraries(rocprofsys-dyninst INTERFACE Dyninst::Dyninst) else() # updated Dyninst CMake system was not found set(_BOOST_COMPONENTS atomic system thread date_time) - set(omnitrace_BOOST_COMPONENTS + set(rocprofsys_BOOST_COMPONENTS "${_BOOST_COMPONENTS}" - CACHE STRING "Boost components used by Dyninst in omnitrace") + CACHE STRING "Boost components used by Dyninst in rocprofsys") set(Boost_NO_BOOST_CMAKE ON) - find_package(Boost QUIET REQUIRED COMPONENTS ${omnitrace_BOOST_COMPONENTS}) + find_package(Boost QUIET REQUIRED COMPONENTS ${rocprofsys_BOOST_COMPONENTS}) # some installs of dyninst don't set this properly if(EXISTS "${DYNINST_INCLUDE_DIR}" AND NOT DYNINST_HEADER_DIR) @@ -413,8 +415,8 @@ else() PATH_SUFFIXES include) endif() - target_link_libraries(omnitrace-dyninst INTERFACE ${DYNINST_LIBRARIES} - ${Boost_LIBRARIES}) + target_link_libraries(rocprofsys-dyninst INTERFACE ${DYNINST_LIBRARIES} + ${Boost_LIBRARIES}) foreach( _TARG dyninst @@ -429,17 +431,17 @@ else() date_time TBB) if(TARGET Dyninst::${_TARG}) - target_link_libraries(omnitrace-dyninst INTERFACE Dyninst::${_TARG}) + target_link_libraries(rocprofsys-dyninst INTERFACE Dyninst::${_TARG}) elseif(TARGET Boost::${_TARG}) - target_link_libraries(omnitrace-dyninst INTERFACE Boost::${_TARG}) + target_link_libraries(rocprofsys-dyninst INTERFACE Boost::${_TARG}) elseif(TARGET ${_TARG}) - target_link_libraries(omnitrace-dyninst INTERFACE ${_TARG}) + target_link_libraries(rocprofsys-dyninst INTERFACE ${_TARG}) endif() endforeach() target_include_directories( - omnitrace-dyninst SYSTEM INTERFACE ${TBB_INCLUDE_DIR} ${Boost_INCLUDE_DIRS} - ${DYNINST_HEADER_DIR}) - omnitrace_target_compile_definitions(omnitrace-dyninst + rocprofsys-dyninst SYSTEM INTERFACE ${TBB_INCLUDE_DIR} ${Boost_INCLUDE_DIRS} + ${DYNINST_HEADER_DIR}) + omnitrace_target_compile_definitions(rocprofsys-dyninst INTERFACE OMNITRACE_USE_DYNINST) endif() endif() @@ -521,22 +523,22 @@ endif() # ----------------------------------------------------------------------------------------# target_compile_definitions( - omnitrace-timemory-config + rocprofsys-timemory-config INTERFACE TIMEMORY_PAPI_ARRAY_SIZE=12 TIMEMORY_USE_ROOFLINE=0 TIMEMORY_USE_ERT=0 TIMEMORY_USE_CONTAINERS=0 TIMEMORY_USE_ERT_EXTERN=0 TIMEMORY_USE_CONTAINERS_EXTERN=0) if(OMNITRACE_BUILD_STACK_PROTECTOR) - add_target_flag_if_avail(omnitrace-timemory-config "-fstack-protector-strong" + add_target_flag_if_avail(rocprofsys-timemory-config "-fstack-protector-strong" "-Wstack-protector") endif() if(OMNITRACE_BUILD_DEBUG) - add_target_flag_if_avail(omnitrace-timemory-config "-fno-omit-frame-pointer" "-g3") + add_target_flag_if_avail(rocprofsys-timemory-config "-fno-omit-frame-pointer" "-g3") endif() set(TIMEMORY_EXTERNAL_INTERFACE_LIBRARY - omnitrace-timemory-config + rocprofsys-timemory-config CACHE STRING "timemory configuration interface library") set(TIMEMORY_INSTALL_HEADERS OFF @@ -636,7 +638,7 @@ set(TIMEMORY_SETTINGS_PREFIX "OMNITRACE_" CACHE STRING "Prefix used for settings and environment variables") set(TIMEMORY_PROJECT_NAME - "omnitrace" + "rocprofsys" CACHE STRING "Name for configuration") set(TIMEMORY_CXX_LIBRARY_EXCLUDE "kokkosp.cpp;pthread.cpp;timemory_c.cpp;trace.cpp;weak.cpp;library.cpp" @@ -673,12 +675,12 @@ add_subdirectory(external/timemory EXCLUDE_FROM_ALL) install( TARGETS gotcha - DESTINATION ${CMAKE_INSTALL_LIBDIR}/omnitrace + DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PACKAGE_NAME} COMPONENT gotcha) if(OMNITRACE_BUILD_LIBUNWIND) install( DIRECTORY ${PROJECT_BINARY_DIR}/external/timemory/external/libunwind/install/lib/ - DESTINATION ${CMAKE_INSTALL_LIBDIR}/omnitrace + DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PACKAGE_NAME} COMPONENT libunwind FILES_MATCHING PATTERN "*${CMAKE_SHARED_LIBRARY_SUFFIX}*") @@ -688,30 +690,30 @@ omnitrace_restore_variables( BUILD_CONFIG VARIABLES BUILD_SHARED_LIBS BUILD_STATIC_LIBS CMAKE_POSITION_INDEPENDENT_CODE CMAKE_PREFIX_PATH) -if(TARGET omnitrace-papi-build) +if(TARGET rocprofsys-papi-build) foreach(_TARGET PAPI::papi timemory-core timemory-common timemory-papi-component timemory-cxx) if(TARGET "${_TARGET}") - add_dependencies(${_TARGET} omnitrace-papi-build) + add_dependencies(${_TARGET} rocprofsys-papi-build) endif() foreach(_LINK shared static) if(TARGET "${_TARGET}-${_LINK}") - add_dependencies(${_TARGET}-${_LINK} omnitrace-papi-build) + add_dependencies(${_TARGET}-${_LINK} rocprofsys-papi-build) endif() endforeach() endforeach() endif() target_link_libraries( - omnitrace-timemory + rocprofsys-timemory INTERFACE $ $ $) -target_link_libraries(omnitrace-bfd INTERFACE $) +target_link_libraries(rocprofsys-bfd INTERFACE $) if(OMNITRACE_USE_BFD) - omnitrace_target_compile_definitions(omnitrace-bfd INTERFACE OMNITRACE_USE_BFD) + omnitrace_target_compile_definitions(rocprofsys-bfd INTERFACE OMNITRACE_USE_BFD) endif() # ----------------------------------------------------------------------------------------# @@ -758,11 +760,11 @@ if(NOT TARGET PTL::ptl-shared) CMAKE_VISIBILITY_INLINES_HIDDEN) endif() -target_sources(omnitrace-ptl +target_sources(rocprofsys-ptl INTERFACE $>) target_include_directories( - omnitrace-ptl INTERFACE $ - $) + rocprofsys-ptl INTERFACE $ + $) # ----------------------------------------------------------------------------------------# # @@ -913,10 +915,10 @@ set(CMAKE_INSTALL_PYTHONDIR ${OMNITRACE_INSTALL_PYTHONDIR}) # ----------------------------------------------------------------------------------------# if("${CMAKE_BUILD_TYPE}" MATCHES "Release" AND NOT OMNITRACE_BUILD_DEBUG) - add_target_flag_if_avail(omnitrace-compile-options "-g1") + add_target_flag_if_avail(rocprofsys-compile-options "-g1") endif() -target_compile_definitions(omnitrace-compile-definitions +target_compile_definitions(rocprofsys-compile-definitions INTERFACE OMNITRACE_MAX_THREADS=${OMNITRACE_MAX_THREADS}) foreach(_LIB ${OMNITRACE_EXTENSION_LIBRARIES}) @@ -924,7 +926,7 @@ foreach(_LIB ${OMNITRACE_EXTENSION_LIBRARIES}) if(_COMPILE_DEFS) foreach(_DEF ${_COMPILE_DEFS}) if("${_DEF}" MATCHES "OMNITRACE_") - target_compile_definitions(omnitrace-compile-definitions + target_compile_definitions(rocprofsys-compile-definitions INTERFACE ${_DEF}) endif() endforeach() diff --git a/cmake/Perfetto.cmake b/cmake/Perfetto.cmake index aa1f11f25..237412c4d 100644 --- a/cmake/Perfetto.cmake +++ b/cmake/Perfetto.cmake @@ -1,7 +1,7 @@ # ====================================================================================== # Perfetto.cmake # -# Configure perfetto for omnitrace +# Configure perfetto for rocprofsys # # ====================================================================================== @@ -143,7 +143,7 @@ if(OMNITRACE_INSTALL_PERFETTO_TOOLS) endif() externalproject_add( - omnitrace-perfetto-build + rocprofsys-perfetto-build PREFIX ${PROJECT_BINARY_DIR}/external/perfetto SOURCE_DIR ${OMNITRACE_PERFETTO_SOURCE_DIR} BUILD_IN_SOURCE 1 @@ -156,25 +156,26 @@ if(OMNITRACE_INSTALL_PERFETTO_TOOLS) BUILD_BYPRODUCTS ${OMNITRACE_PERFETTO_BINARY_DIR}/args.gn) add_custom_target( - omnitrace-perfetto-clean + rocprofsys-perfetto-clean COMMAND ${OMNITRACE_NINJA_EXECUTABLE} -t clean - COMMAND ${CMAKE_COMMAND} -E rm -rf - ${PROJECT_BINARY_DIR}/external/perfetto/src/omnitrace-perfetto-build-stamp + COMMAND + ${CMAKE_COMMAND} -E rm -rf + ${PROJECT_BINARY_DIR}/external/perfetto/src/rocprofsys-perfetto-build-stamp WORKING_DIRECTORY ${OMNITRACE_PERFETTO_BINARY_DIR} COMMENT "Cleaning Perfetto...") install( DIRECTORY ${OMNITRACE_PERFETTO_INSTALL_DIR}/ - DESTINATION ${CMAKE_INSTALL_LIBDIR}/omnitrace + DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PACKAGE_NAME} COMPONENT perfetto FILES_MATCHING PATTERN "*libperfetto.so*") foreach(_FILE perfetto traced tracebox traced_probes traced_perf trigger_perfetto) if("${_FILE}" STREQUAL "perfetto") - string(REPLACE "_" "-" _INSTALL_FILE "omnitrace-${_FILE}") + string(REPLACE "_" "-" _INSTALL_FILE "rocprof-sys-${_FILE}") else() - string(REPLACE "_" "-" _INSTALL_FILE "omnitrace-perfetto-${_FILE}") + string(REPLACE "_" "-" _INSTALL_FILE "rocprof-sys-perfetto-${_FILE}") endif() install( PROGRAMS ${OMNITRACE_PERFETTO_INSTALL_DIR}/${_FILE} @@ -191,17 +192,17 @@ endif() # # ---------------------------------------------------------------------------------------# -add_library(omnitrace-perfetto-library STATIC) -add_library(omnitrace::omnitrace-perfetto-library ALIAS omnitrace-perfetto-library) +add_library(rocprofsys-perfetto-library STATIC) +add_library(rocprofsys::rocprofsys-perfetto-library ALIAS rocprofsys-perfetto-library) target_sources( - omnitrace-perfetto-library PRIVATE ${OMNITRACE_PERFETTO_SOURCE_DIR}/sdk/perfetto.cc - ${OMNITRACE_PERFETTO_SOURCE_DIR}/sdk/perfetto.h) + rocprofsys-perfetto-library PRIVATE ${OMNITRACE_PERFETTO_SOURCE_DIR}/sdk/perfetto.cc + ${OMNITRACE_PERFETTO_SOURCE_DIR}/sdk/perfetto.h) target_link_libraries( - omnitrace-perfetto-library - PRIVATE omnitrace::omnitrace-threading omnitrace::omnitrace-static-libgcc - omnitrace::omnitrace-static-libstdcxx) + rocprofsys-perfetto-library + PRIVATE rocprofsys::rocprofsys-threading rocprofsys::rocprofsys-static-libgcc + rocprofsys::rocprofsys-static-libstdcxx) set_target_properties( - omnitrace-perfetto-library + rocprofsys-perfetto-library PROPERTIES OUTPUT_NAME perfetto ARCHIVE_OUTPUT_DIRECTORY ${OMNITRACE_PERFETTO_BINARY_DIR} POSITION_INDEPENDENT_CODE ON @@ -228,9 +229,9 @@ mark_as_advanced(PERFETTO_LIBRARY) # # ---------------------------------------------------------------------------------------# -omnitrace_target_compile_definitions(omnitrace-perfetto INTERFACE OMNITRACE_USE_PERFETTO) -target_include_directories(omnitrace-perfetto SYSTEM +omnitrace_target_compile_definitions(rocprofsys-perfetto INTERFACE OMNITRACE_USE_PERFETTO) +target_include_directories(rocprofsys-perfetto SYSTEM INTERFACE $) target_link_libraries( - omnitrace-perfetto INTERFACE $ - $) + rocprofsys-perfetto INTERFACE $ + $) diff --git a/cmake/Templates/args.gn.in b/cmake/Templates/args.gn.in index 860a10a84..5e306debf 100644 --- a/cmake/Templates/args.gn.in +++ b/cmake/Templates/args.gn.in @@ -25,4 +25,4 @@ enable_perfetto_ui = false extra_cflags = "@OMNITRACE_PERFETTO_C_FLAGS@" extra_cxxflags = "@OMNITRACE_PERFETTO_CXX_FLAGS@" -extra_ldflags = "@OMNITRACE_PERFETTO_LINK_FLAGS@ -Wl,-rpath=\\\$ORIGIN:\\\$ORIGIN/../lib:\\\$ORIGIN/../lib/omnitrace" +extra_ldflags = "@OMNITRACE_PERFETTO_LINK_FLAGS@ -Wl,-rpath=\\\$ORIGIN:\\\$ORIGIN/../lib:\\\$ORIGIN/../lib/rocprof-sys" diff --git a/cmake/Templates/modulefile.in b/cmake/Templates/modulefile.in index 5f138333d..211ce4f93 100644 --- a/cmake/Templates/modulefile.in +++ b/cmake/Templates/modulefile.in @@ -1,20 +1,20 @@ #%Module1.0 -module-whatis "@PROJECT_NAME@ (version @PROJECT_VERSION@)" +module-whatis "@PACKAGE_NAME@ (version @PROJECT_VERSION@)" proc ModulesHelp { } { -puts stderr "Loads @PROJECT_NAME@ v@PROJECT_VERSION@" +puts stderr "Loads @PACKAGE_NAME@ v@PROJECT_VERSION@" } set ROOT [file normalize [file dirname [file normalize ${ModulesCurrentModulefile}]]/../../..] -setenv @PROJECT_NAME@_ROOT "${ROOT}" +setenv @PACKAGE_NAME_UNDERSCORE@_ROOT "${ROOT}" prepend-path CMAKE_PREFIX_PATH "${ROOT}" prepend-path PATH "${ROOT}/bin" prepend-path LD_LIBRARY_PATH "${ROOT}/@CMAKE_INSTALL_LIBDIR@" prepend-path PYTHONPATH "${ROOT}/@CMAKE_INSTALL_PYTHONDIR@" -setenv @PROJECT_NAME@_DIR "${ROOT}/@CMAKE_INSTALL_DATAROOTDIR@/cmake/@PROJECT_NAME@" +setenv @PACKAGE_NAME_UNDERSCORE@_DIR "${ROOT}/@CMAKE_INSTALL_DATAROOTDIR@/cmake/@PACKAGE_NAME@" -# @OMNITRACE_HSA_ENV@setenv HSA_TOOLS_LIB "${ROOT}/@CMAKE_INSTALL_LIBDIR@/@CMAKE_SHARED_LIBRARY_PREFIX@omnitrace@CMAKE_SHARED_LIBRARY_SUFFIX@" +# @OMNITRACE_HSA_ENV@setenv HSA_TOOLS_LIB "${ROOT}/@CMAKE_INSTALL_LIBDIR@/@CMAKE_SHARED_LIBRARY_PREFIX@rocprof-sys@CMAKE_SHARED_LIBRARY_SUFFIX@" # @OMNITRACE_HSA_ENV@setenv HSA_TOOLS_REPORT_LOAD_FAILURE 1 -# @OMNITRACE_ROCP_ENV@setenv ROCP_TOOL_LIB "${ROOT}/@CMAKE_INSTALL_LIBDIR@/@CMAKE_SHARED_LIBRARY_PREFIX@omnitrace@CMAKE_SHARED_LIBRARY_SUFFIX@" +# @OMNITRACE_ROCP_ENV@setenv ROCP_TOOL_LIB "${ROOT}/@CMAKE_INSTALL_LIBDIR@/@CMAKE_SHARED_LIBRARY_PREFIX@rocprof-sys@CMAKE_SHARED_LIBRARY_SUFFIX@" diff --git a/cmake/Templates/omnitrace-config.cmake.in b/cmake/Templates/rocprofsys-config.cmake.in similarity index 100% rename from cmake/Templates/omnitrace-config.cmake.in rename to cmake/Templates/rocprofsys-config.cmake.in diff --git a/cmake/Templates/omnitrace-install.py.in b/cmake/Templates/rocprofsys-install.py.in similarity index 100% rename from cmake/Templates/omnitrace-install.py.in rename to cmake/Templates/rocprofsys-install.py.in diff --git a/cmake/Templates/setup-env.sh.in b/cmake/Templates/setup-env.sh.in index ced7facad..dfdc6235a 100644 --- a/cmake/Templates/setup-env.sh.in +++ b/cmake/Templates/setup-env.sh.in @@ -13,24 +13,24 @@ if [ ! -d "${BASEDIR}" ]; then return 1 fi -@PROJECT_NAME@_ROOT=${BASEDIR} +@PACKAGE_NAME_UNDERSCORE@_ROOT=${BASEDIR} PATH=${BASEDIR}/bin:${PATH} LD_LIBRARY_PATH=${BASEDIR}/@CMAKE_INSTALL_LIBDIR@:${LD_LIBRARY_PATH} PYTHONPATH=${BASEDIR}/@CMAKE_INSTALL_PYTHONDIR@:${PYTHONPATH} CMAKE_PREFIX_PATH=${BASEDIR}:${CMAKE_PREFIX_PATH} -@PROJECT_NAME@_DIR=${BASEDIR}/@CMAKE_INSTALL_DATAROOTDIR@/cmake/@PROJECT_NAME@ +@PACKAGE_NAME_UNDERSCORE@_DIR=${BASEDIR}/@CMAKE_INSTALL_DATAROOTDIR@/cmake/@PACKAGE_NAME@ -export @PROJECT_NAME@_ROOT +export @PACKAGE_NAME_UNDERSCORE@_ROOT export PATH export LD_LIBRARY_PATH export PYTHONPATH export CMAKE_PREFIX_PATH -export @PROJECT_NAME@_DIR +export @PACKAGE_NAME_UNDERSCORE@_DIR # ROCm environment variables -# @OMNITRACE_HSA_ENV@HSA_TOOLS_LIB="${BASEDIR}/@CMAKE_INSTALL_LIBDIR@/@CMAKE_SHARED_LIBRARY_PREFIX@omnitrace-dl@CMAKE_SHARED_LIBRARY_SUFFIX@" +# @OMNITRACE_HSA_ENV@HSA_TOOLS_LIB="${BASEDIR}/@CMAKE_INSTALL_LIBDIR@/@CMAKE_SHARED_LIBRARY_PREFIX@rocprof-sys-dl@CMAKE_SHARED_LIBRARY_SUFFIX@" # @OMNITRACE_HSA_ENV@HSA_TOOLS_REPORT_LOAD_FAILURE=1 -# @OMNITRACE_ROCP_ENV@ROCP_TOOL_LIB="${BASEDIR}/@CMAKE_INSTALL_LIBDIR@/@CMAKE_SHARED_LIBRARY_PREFIX@omnitrace@CMAKE_SHARED_LIBRARY_SUFFIX@" +# @OMNITRACE_ROCP_ENV@ROCP_TOOL_LIB="${BASEDIR}/@CMAKE_INSTALL_LIBDIR@/@CMAKE_SHARED_LIBRARY_PREFIX@rocprof-sys@CMAKE_SHARED_LIBRARY_SUFFIX@" # @OMNITRACE_HSA_ENV@export HSA_TOOLS_LIB # @OMNITRACE_HSA_ENV@export HSA_TOOLS_REPORT_LOAD_FAILURE diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 8c8451e30..65aa207fd 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.16 FATAL_ERROR) -project(omnitrace-examples LANGUAGES C CXX) +project(rocprofsys-examples LANGUAGES C CXX) if("${CMAKE_BUILD_TYPE}" STREQUAL "") set(CMAKE_BUILD_TYPE @@ -23,13 +23,13 @@ endif() option(BUILD_SHARED_LIBS "Build dynamic libraries" ON) -if(CMAKE_PROJECT_NAME STREQUAL "omnitrace") +if(CMAKE_PROJECT_NAME STREQUAL "rocprofsys") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) - omnitrace_add_option(OMNITRACE_INSTALL_EXAMPLES "Install omnitrace examples" OFF) + omnitrace_add_option(OMNITRACE_INSTALL_EXAMPLES "Install rocprofsys examples" OFF) else() - option(OMNITRACE_INSTALL_EXAMPLES "Install omnitrace examples" ON) + option(OMNITRACE_INSTALL_EXAMPLES "Install rocprofsys examples" ON) endif() if(OMNITRACE_INSTALL_EXAMPLES) diff --git a/examples/causal-helpers.cmake b/examples/causal-helpers.cmake index 342d1aa63..38d455d1c 100644 --- a/examples/causal-helpers.cmake +++ b/examples/causal-helpers.cmake @@ -3,8 +3,8 @@ # include_guard(DIRECTORY) -if(NOT TARGET omnitrace::omnitrace-user-library) - find_package(omnitrace REQUIRED COMPONENTS user) +if(NOT TARGET rocprofsys::rocprofsys-user-library) + find_package(rocprofsys REQUIRED COMPONENTS user) endif() if(NOT coz-profiler_FOUND) @@ -40,7 +40,7 @@ function(omnitrace_causal_example_executable _NAME) target_include_directories(${_NAME} PRIVATE ${OMNITRACE_EXAMPLE_ROOT_DIR}/causal ${CAUSAL_INCLUDE_DIRECTORIES}) target_link_libraries( - ${_NAME} PRIVATE ${CAUSAL_LINK_LIBRARIES} omnitrace::omnitrace-user-library + ${_NAME} PRIVATE ${CAUSAL_LINK_LIBRARIES} rocprofsys::rocprofsys-user-library omni-causal-example-lib-debug) add_executable(${_NAME}-omni ${CAUSAL_SOURCES}) @@ -49,8 +49,9 @@ function(omnitrace_causal_example_executable _NAME) target_include_directories(${_NAME}-omni PRIVATE ${OMNITRACE_EXAMPLE_ROOT_DIR}/causal ${CAUSAL_INCLUDE_DIRECTORIES}) target_link_libraries( - ${_NAME}-omni PRIVATE ${CAUSAL_LINK_LIBRARIES} omnitrace::omnitrace-user-library - omni-causal-example-lib-debug) + ${_NAME}-omni + PRIVATE ${CAUSAL_LINK_LIBRARIES} rocprofsys::rocprofsys-user-library + omni-causal-example-lib-debug) add_executable(${_NAME}-ndebug ${CAUSAL_SOURCES}) target_compile_definitions(${_NAME}-ndebug PRIVATE USE_COZ=0 USE_OMNI=0 @@ -60,7 +61,7 @@ function(omnitrace_causal_example_executable _NAME) ${CAUSAL_INCLUDE_DIRECTORIES}) target_link_libraries( ${_NAME}-ndebug - PRIVATE ${CAUSAL_LINK_LIBRARIES} omnitrace::omnitrace-user-library + PRIVATE ${CAUSAL_LINK_LIBRARIES} rocprofsys::rocprofsys-user-library omni-causal-example-lib-no-debug) add_executable(${_NAME}-omni-ndebug ${CAUSAL_SOURCES}) @@ -71,7 +72,7 @@ function(omnitrace_causal_example_executable _NAME) ${CAUSAL_INCLUDE_DIRECTORIES}) target_link_libraries( ${_NAME}-omni-ndebug - PRIVATE ${CAUSAL_LINK_LIBRARIES} omnitrace::omnitrace-user-library + PRIVATE ${CAUSAL_LINK_LIBRARIES} rocprofsys::rocprofsys-user-library omni-causal-example-lib-no-debug) add_dependencies(omni-causal-examples ${_NAME} ${_NAME}-omni ${_NAME}-ndebug @@ -98,7 +99,7 @@ function(omnitrace_causal_example_executable _NAME) install( TARGETS ${_NAME} ${_NAME}-omni ${_NAME}-coz DESTINATION bin - COMPONENT omnitrace-examples + COMPONENT rocprofsys-examples OPTIONAL) endif() endfunction() diff --git a/examples/causal/CMakeLists.txt b/examples/causal/CMakeLists.txt index a3bba08bf..e0fc98f0f 100644 --- a/examples/causal/CMakeLists.txt +++ b/examples/causal/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.16 FATAL_ERROR) -project(omnitrace-causal-example LANGUAGES CXX) +project(rocprofsys-causal-example LANGUAGES CXX) if(OMNITRACE_DISABLE_EXAMPLES) get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME) @@ -13,8 +13,8 @@ endif() set(CMAKE_BUILD_TYPE "Release") find_package(Threads REQUIRED) -if(NOT TARGET omnitrace::omnitrace-user-library) - find_package(omnitrace REQUIRED COMPONENTS user) +if(NOT TARGET rocprofsys::rocprofsys-user-library) + find_package(rocprofsys REQUIRED COMPONENTS user) endif() add_library(causal-interface-library INTERFACE) diff --git a/examples/code-coverage/CMakeLists.txt b/examples/code-coverage/CMakeLists.txt index 94a265a9b..25229f10b 100644 --- a/examples/code-coverage/CMakeLists.txt +++ b/examples/code-coverage/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.15 FATAL_ERROR) -project(omnitrace-code-coverage-example LANGUAGES CXX) +project(rocprofsys-code-coverage-example LANGUAGES CXX) if(OMNITRACE_DISABLE_EXAMPLES) get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME) @@ -23,7 +23,7 @@ if(OMNITRACE_INSTALL_EXAMPLES) install( TARGETS code-coverage DESTINATION bin - COMPONENT omnitrace-examples) + COMPONENT rocprofsys-examples) endif() set(PYTHON_FILES code-coverage.py) @@ -41,7 +41,7 @@ if(Python3_FOUND) install( PROGRAMS ${PROJECT_BINARY_DIR}/${_FILE} DESTINATION bin - COMPONENT omnitrace-examples) + COMPONENT rocprofsys-examples) endif() endforeach() endif() diff --git a/examples/code-coverage/code-coverage.py b/examples/code-coverage/code-coverage.py index efd2f2da9..9dae8beef 100644 --- a/examples/code-coverage/code-coverage.py +++ b/examples/code-coverage/code-coverage.py @@ -1,6 +1,6 @@ #!@PYTHON_EXECUTABLE@ -import omnitrace +import rocprofsys import argparse if __name__ == "__main__": @@ -28,15 +28,15 @@ data = None for itr in args.input: - _summary, _details = omnitrace.coverage.load(itr) + _summary, _details = rocprofsys.coverage.load(itr) if data is None: data = _details else: - data = omnitrace.coverage.concat(data, _details) + data = rocprofsys.coverage.concat(data, _details) - summary = omnitrace.coverage.get_summary(data) - top = omnitrace.coverage.get_top(data) - bottom = omnitrace.coverage.get_bottom(data) + summary = rocprofsys.coverage.get_summary(data) + top = rocprofsys.coverage.get_top(data) + bottom = rocprofsys.coverage.get_bottom(data) print("Top code coverage:") for itr in top: @@ -51,4 +51,4 @@ ) print("\nSaving code coverage") - omnitrace.coverage.save(summary, data, args.output) + rocprofsys.coverage.save(summary, data, args.output) diff --git a/examples/fork/CMakeLists.txt b/examples/fork/CMakeLists.txt index 909b18bbb..02a0686d3 100644 --- a/examples/fork/CMakeLists.txt +++ b/examples/fork/CMakeLists.txt @@ -1,19 +1,19 @@ cmake_minimum_required(VERSION 3.15 FATAL_ERROR) -project(omnitrace-fork LANGUAGES CXX) +project(rocprofsys-fork LANGUAGES CXX) set(CMAKE_BUILD_TYPE "RelWithDebInfo") string(REPLACE " " ";" _FLAGS "${CMAKE_CXX_FLAGS_DEBUG}") find_package(Threads REQUIRED) -find_package(omnitrace REQUIRED COMPONENTS user) +find_package(rocprofsys REQUIRED COMPONENTS user) add_executable(fork-example fork.cpp) -target_link_libraries(fork-example PRIVATE Threads::Threads omnitrace::omnitrace) +target_link_libraries(fork-example PRIVATE Threads::Threads rocprofsys::rocprofsys) target_compile_options(fork-example PRIVATE ${_FLAGS}) if(OMNITRACE_INSTALL_EXAMPLES) install( TARGETS fork-example DESTINATION bin - COMPONENT omnitrace-examples) + COMPONENT rocprofsys-examples) endif() diff --git a/examples/lulesh/CMakeLists.txt b/examples/lulesh/CMakeLists.txt index 8dd45dd28..bcd36a1ff 100644 --- a/examples/lulesh/CMakeLists.txt +++ b/examples/lulesh/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.16 FATAL_ERROR) -project(omnitrace-lulesh-example LANGUAGES C CXX) +project(rocprofsys-lulesh-example LANGUAGES C CXX) if(OMNITRACE_DISABLE_EXAMPLES) get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME) @@ -76,7 +76,7 @@ if(OMNITRACE_INSTALL_EXAMPLES) install( TARGETS kokkoscore kokkoscontainers DESTINATION ${CMAKE_INSTALL_LIBDIR} - COMPONENT omnitrace-examples) + COMPONENT rocprofsys-examples) set_target_properties(lulesh PROPERTIES INSTALL_RPATH "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}") endif() diff --git a/examples/mpi/CMakeLists.txt b/examples/mpi/CMakeLists.txt index 4c9452928..5fb9ca540 100644 --- a/examples/mpi/CMakeLists.txt +++ b/examples/mpi/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.16 FATAL_ERROR) -project(omnitrace-mpi-examples LANGUAGES C CXX) +project(rocprofsys-mpi-examples LANGUAGES C CXX) if(OMNITRACE_DISABLE_EXAMPLES) get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME) @@ -13,12 +13,12 @@ endif() find_package(MPI) if(NOT MPI_FOUND) - if("${CMAKE_PROJECT_NAME}" STREQUAL "omnitrace" AND "$ENV{OMNITRACE_CI}") + if("${CMAKE_PROJECT_NAME}" STREQUAL "rocprofsys" AND "$ENV{OMNITRACE_CI}") set(_MSG_TYPE STATUS) # don't generate warnings during CI else() set(_MSG_TYPE AUTHOR_WARNING) endif() - message(${_MSG_TYPE} "MPI could not be found. Cannot build omnitrace-mpi target") + message(${_MSG_TYPE} "MPI could not be found. Cannot build rocprofsys-mpi target") return() endif() @@ -30,7 +30,7 @@ add_library(mpi-c-interface-library INTERFACE) target_link_libraries( mpi-c-interface-library INTERFACE Threads::Threads MPI::MPI_C - $) + $) target_compile_options(mpi-c-interface-library INTERFACE -Wno-double-promotion) add_executable(mpi-allgather allgather.c) @@ -60,7 +60,7 @@ add_library(mpi-cxx-interface-library INTERFACE) target_link_libraries( mpi-cxx-interface-library INTERFACE Threads::Threads MPI::MPI_CXX - $) + $) add_executable(mpi-example mpi.cpp) target_link_libraries(mpi-example PRIVATE mpi-cxx-interface-library) @@ -70,5 +70,5 @@ if(OMNITRACE_INSTALL_EXAMPLES) TARGETS mpi-example mpi-allgather mpi-bcast mpi-all2all mpi-reduce mpi-scatter-gather mpi-send-recv DESTINATION bin - COMPONENT omnitrace-examples) + COMPONENT rocprofsys-examples) endif() diff --git a/examples/openmp/CMakeLists.txt b/examples/openmp/CMakeLists.txt index f63893aba..0f91f9ad0 100644 --- a/examples/openmp/CMakeLists.txt +++ b/examples/openmp/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.16 FATAL_ERROR) -project(omnitrace-openmp LANGUAGES CXX) +project(rocprofsys-openmp LANGUAGES CXX) file(GLOB common_source ${CMAKE_CURRENT_SOURCE_DIR}/common/*.cpp) add_library(openmp-common OBJECT ${common_source}) @@ -17,7 +17,7 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") target_link_libraries(openmp-common PUBLIC OpenMP::OpenMP_CXX) set(OMNITRACE_OPENMP_USING_LIBOMP_LIBRARY ON - CACHE INTERNAL "Used by omnitrace testing" FORCE) + CACHE INTERNAL "Used by rocprofsys testing" FORCE) else() find_program(CLANGXX_EXECUTABLE NAMES clang++) find_library( @@ -34,13 +34,13 @@ else() omnitrace_custom_compilation(COMPILER ${CLANGXX_EXECUTABLE} TARGET openmp-lu) set(OMNITRACE_OPENMP_USING_LIBOMP_LIBRARY ON - CACHE INTERNAL "Used by omnitrace testing" FORCE) + CACHE INTERNAL "Used by rocprofsys testing" FORCE) else() find_package(OpenMP REQUIRED) target_link_libraries(openmp-common PUBLIC OpenMP::OpenMP_CXX) set(OMNITRACE_OPENMP_USING_LIBOMP_LIBRARY OFF - CACHE INTERNAL "Used by omnitrace testing" FORCE) + CACHE INTERNAL "Used by rocprofsys testing" FORCE) endif() endif() @@ -51,5 +51,5 @@ if(OMNITRACE_INSTALL_EXAMPLES) install( TARGETS openmp-cg openmp-lu DESTINATION bin - COMPONENT omnitrace-examples) + COMPONENT rocprofsys-examples) endif() diff --git a/examples/parallel-overhead/CMakeLists.txt b/examples/parallel-overhead/CMakeLists.txt index 1458e138a..9789a2d19 100644 --- a/examples/parallel-overhead/CMakeLists.txt +++ b/examples/parallel-overhead/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.16 FATAL_ERROR) -project(omnitrace-parallel-overhead-example LANGUAGES CXX) +project(rocprofsys-parallel-overhead-example LANGUAGES CXX) if(OMNITRACE_DISABLE_EXAMPLES) get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME) @@ -30,5 +30,5 @@ if(OMNITRACE_INSTALL_EXAMPLES) install( TARGETS parallel-overhead parallel-overhead-locks DESTINATION bin - COMPONENT omnitrace-examples) + COMPONENT rocprofsys-examples) endif() diff --git a/examples/python/CMakeLists.txt b/examples/python/CMakeLists.txt index 9f810ed3c..1e6271462 100644 --- a/examples/python/CMakeLists.txt +++ b/examples/python/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.16 FATAL_ERROR) -project(omnitrace-python) +project(rocprofsys-python) if(OMNITRACE_DISABLE_EXAMPLES) get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME) @@ -26,7 +26,7 @@ if(Python3_FOUND) install( PROGRAMS ${PROJECT_BINARY_DIR}/${_FILE} DESTINATION bin - COMPONENT omnitrace-examples) + COMPONENT rocprofsys-examples) endif() endforeach() endif() 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/examples/rccl/CMakeLists.txt b/examples/rccl/CMakeLists.txt index 4b0d860d7..d83482382 100644 --- a/examples/rccl/CMakeLists.txt +++ b/examples/rccl/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.16 FATAL_ERROR) -project(omnitrace-rccl-example LANGUAGES CXX) +project(rocprofsys-rccl-example LANGUAGES CXX) if(OMNITRACE_DISABLE_EXAMPLES) get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME) @@ -12,12 +12,12 @@ if(OMNITRACE_DISABLE_EXAMPLES) endif() function(rccl_message _MSG_TYPE) - if("${CMAKE_PROJECT_NAME}" STREQUAL "omnitrace" + if("${CMAKE_PROJECT_NAME}" STREQUAL "rocprofsys" AND "$ENV{OMNITRACE_CI}" AND "${_MSG_TYPE}" MATCHES "WARNING") set(_MSG_TYPE STATUS) # don't generate warnings during CI endif() - if("${CMAKE_PROJECT_NAME}" STREQUAL "omnitrace") + if("${CMAKE_PROJECT_NAME}" STREQUAL "rocprofsys") omnitrace_message(${_MSG_TYPE} ${ARGN}) else() message(${_MSG_TYPE} ${ARGN}) @@ -31,7 +31,7 @@ if(NOT hip_FOUND) return() endif() -if("${CMAKE_PROJECT_NAME}" STREQUAL "omnitrace" +if("${CMAKE_PROJECT_NAME}" STREQUAL "rocprofsys" AND ("$ENV{OMNITRACE_CI}" OR OMNITRACE_CI OR OMNITRACE_BUILD_CI)) @@ -47,8 +47,7 @@ endif() if(hip_FOUND AND rccl_FOUND) include(FetchContent) - fetchcontent_declare( - rccl-tests GIT_REPOSITORY https://github.com/ROCmSoftwarePlatform/rccl-tests.git) + fetchcontent_declare(rccl-tests GIT_REPOSITORY https://github.com/ROCm/rccl-tests.git) # After the following call, the CMake targets defined by googletest and Catch2 will be # available to the rest of the build diff --git a/examples/rewrite-caller/CMakeLists.txt b/examples/rewrite-caller/CMakeLists.txt index 75f60d922..40857483a 100644 --- a/examples/rewrite-caller/CMakeLists.txt +++ b/examples/rewrite-caller/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.15 FATAL_ERROR) -project(omnitrace-rewrite-caller-example LANGUAGES CXX) +project(rocprofsys-rewrite-caller-example LANGUAGES CXX) if(OMNITRACE_DISABLE_EXAMPLES) get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME) @@ -20,5 +20,5 @@ if(OMNITRACE_INSTALL_EXAMPLES) install( TARGETS rewrite-caller DESTINATION bin - COMPONENT omnitrace-examples) + COMPONENT rocprofsys-examples) endif() diff --git a/examples/trace-time-window/CMakeLists.txt b/examples/trace-time-window/CMakeLists.txt index fe68dc16f..b066e64bf 100644 --- a/examples/trace-time-window/CMakeLists.txt +++ b/examples/trace-time-window/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.15 FATAL_ERROR) -project(omnitrace-trace-time-window-example LANGUAGES CXX) +project(rocprofsys-trace-time-window-example LANGUAGES CXX) if(OMNITRACE_DISABLE_EXAMPLES) get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME) @@ -20,5 +20,5 @@ if(OMNITRACE_INSTALL_EXAMPLES) install( TARGETS trace-time-window DESTINATION bin - COMPONENT omnitrace-examples) + COMPONENT rocprofsys-examples) endif() diff --git a/examples/transpose/CMakeLists.txt b/examples/transpose/CMakeLists.txt index 25792c923..83c65ec0a 100644 --- a/examples/transpose/CMakeLists.txt +++ b/examples/transpose/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.16 FATAL_ERROR) -project(omnitrace-transpose-example LANGUAGES CXX) +project(rocprofsys-transpose-example LANGUAGES CXX) if(OMNITRACE_DISABLE_EXAMPLES) get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME) @@ -56,7 +56,7 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT HIPCC_EXECUTABLE) target_link_libraries( transpose - PRIVATE $ + PRIVATE $ $ $) else() target_compile_options(transpose PRIVATE -W -Wall) @@ -80,5 +80,5 @@ if(OMNITRACE_INSTALL_EXAMPLES) install( TARGETS transpose DESTINATION bin - COMPONENT omnitrace-examples) + COMPONENT rocprofsys-examples) endif() diff --git a/examples/user-api/CMakeLists.txt b/examples/user-api/CMakeLists.txt index 754e08eb0..db3008b9f 100644 --- a/examples/user-api/CMakeLists.txt +++ b/examples/user-api/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.16 FATAL_ERROR) -project(omnitrace-user-api-example LANGUAGES CXX) +project(rocprofsys-user-api-example LANGUAGES CXX) if(OMNITRACE_DISABLE_EXAMPLES) get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME) @@ -13,15 +13,16 @@ endif() set(CMAKE_BUILD_TYPE "Debug") find_package(Threads REQUIRED) -if(NOT TARGET omnitrace::omnitrace-user-library) - find_package(omnitrace REQUIRED COMPONENTS user) +if(NOT TARGET rocprofsys::rocprofsys-user-library) + find_package(rocprofsys REQUIRED COMPONENTS user) endif() add_executable(user-api user-api.cpp) -target_link_libraries(user-api PRIVATE Threads::Threads omnitrace::omnitrace-user-library) +target_link_libraries(user-api PRIVATE Threads::Threads + rocprofsys::rocprofsys-user-library) if(OMNITRACE_INSTALL_EXAMPLES) install( TARGETS user-api DESTINATION bin - COMPONENT omnitrace-examples) + COMPONENT rocprofsys-examples) endif() diff --git a/scripts/dl-gen.py b/scripts/dl-gen.py index 60e63cd33..f725ec896 100755 --- a/scripts/dl-gen.py +++ b/scripts/dl-gen.py @@ -6,7 +6,7 @@ """ This script reads in function prototypes can generates the implementation pieces -needed to dlsym the function in libomnitrace +needed to dlsym the function in librocprof-sys. Example input file: diff --git a/scripts/gperftools-cpu-profile.sh b/scripts/gperftools-cpu-profile.sh index fabc56737..e11b6369d 100755 --- a/scripts/gperftools-cpu-profile.sh +++ b/scripts/gperftools-cpu-profile.sh @@ -87,7 +87,7 @@ run-pprof() } # configure pre-loading of profiler library -for i in $(find ${PWD} -type f | egrep 'libomnitrace' | egrep -v '\.a$' | egrep '\.so$') $(ldd ${1} | awk '{print $(NF-1)}') +for i in $(find ${PWD} -type f | egrep 'librocprof-sys' | egrep -v '\.a$' | egrep '\.so$') $(ldd ${1} | awk '{print $(NF-1)}') do if [ -f "${i}" ]; then run-verbose ADD_LIBS "${i}"; fi done diff --git a/scripts/test-install.sh b/scripts/test-install.sh index 943603c08..cb19d35e6 100755 --- a/scripts/test-install.sh +++ b/scripts/test-install.sh @@ -45,15 +45,15 @@ fi usage() { - print_option() { printf " --%-10s %-24s %s (default: %s)\n" "${1}" "${2}" "${3}" "${4}"; } + 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-omnitrace-instrument "0|1" "Enable testing omnitrace-instrument exe" "${ENABLE_OMNITRACE_INSTRUMENT}" - print_option test-omnitrace-avail "0|1" "Enable testing omnitrace-avail" "${ENABLE_OMNITRACE_AVAIL}" - print_option test-omnitrace-sample "0|1" "Enable testing omnitrace-sample" "${ENABLE_OMNITRACE_SAMPLE}" - print_option test-omnitrace-python "0|1" "Enable testing omnitrace-python" "${ENABLE_OMNITRACE_PYTHON}" - print_option test-omnitrace-rewrite "0|1" "Enable testing omnitrace-instrument binary rewrite" "${ENABLE_OMNITRACE_REWRITE}" - print_option test-omnitrace-runtime "0|1" "Enable testing omnitrace-instrument runtime instrumentation" "${ENABLE_OMNITRACE_RUNTIME}" + 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}" + print_option test-rocprof-sys-rewrite "0|1" "Enable testing rocprof-sys-instrument binary rewrite" "${ENABLE_OMNITRACE_REWRITE}" + print_option test-rocprof-sys-runtime "0|1" "Enable testing rocprof-sys-instrument runtime instrumentation" "${ENABLE_OMNITRACE_RUNTIME}" } cat << EOF > ${CONFIG_DIR}/omnitrace.cfg @@ -100,27 +100,27 @@ do fi case "${ARG}" in - --test-omnitrace-instrument) + --test-rocprof-sys-instrument) ENABLE_OMNITRACE_INSTRUMENT=${VAL} continue ;; - --test-omnitrace-avail) + --test-rocprof-sys-avail) ENABLE_OMNITRACE_AVAIL=${VAL} continue ;; - --test-omnitrace-sample) + --test-rocprof-sys-sample) ENABLE_OMNITRACE_SAMPLE=${VAL} continue ;; - --test-omnitrace-python) + --test-rocprof-sys-python) ENABLE_OMNITRACE_PYTHON=${VAL} continue ;; - --test-omnitrace-rewrite) + --test-rocprof-sys-rewrite) ENABLE_OMNITRACE_REWRITE=${VAL} continue ;; - --test-omnitrace-runtime) + --test-rocprof-sys-runtime) ENABLE_OMNITRACE_RUNTIME=${VAL} continue ;; @@ -136,40 +136,40 @@ do esac done -test-omnitrace() +test-rocprof-sys-instrument() { - verbose-run which omnitrace - verbose-run ldd $(which omnitrace) - verbose-run omnitrace-instrument --help + verbose-run which rocprof-sys-instrument + verbose-run ldd $(which rocprof-sys-instrument) + verbose-run rocprof-sys-instrument --help } -test-omnitrace-avail() +test-rocprof-sys-avail() { - verbose-run which omnitrace-avail - verbose-run ldd $(which omnitrace-avail) - verbose-run omnitrace-avail --help - verbose-run omnitrace-avail -a + verbose-run which rocprof-sys-avail + verbose-run ldd $(which rocprof-sys-avail) + verbose-run rocprof-sys-avail --help + verbose-run rocprof-sys-avail -a } -test-omnitrace-sample() +test-rocprof-sys-sample() { - verbose-run which omnitrace-sample - verbose-run ldd $(which omnitrace-sample) - verbose-run omnitrace-sample --help - verbose-run omnitrace-sample --cputime 100 --realtime 50 --hsa-interrupt 0 -TPH -- python3 ${SOURCE_DIR}/examples/python/external.py -n 5 -v 20 + verbose-run which rocprof-sys-sample + verbose-run ldd $(which rocprof-sys-sample) + verbose-run rocprof-sys-sample --help + verbose-run rocprof-sys-sample --cputime 100 --realtime 50 --hsa-interrupt 0 -TPH -- python3 ${SOURCE_DIR}/examples/python/external.py -n 5 -v 20 } -test-omnitrace-python() +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 } -test-omnitrace-rewrite() +test-rocprof-sys-rewrite() { if [ -f /usr/bin/coreutils ]; then local LS_NAME=coreutils @@ -178,13 +178,13 @@ test-omnitrace-rewrite() local LS_NAME=ls local LS_ARGS="" fi - verbose-run omnitrace-instrument -e -v 1 -o ${CONFIG_DIR}/ls.inst --simulate -- ${LS_NAME} + verbose-run rocprof-sys-instrument -e -v 1 -o ${CONFIG_DIR}/ls.inst --simulate -- ${LS_NAME} for i in $(find ${CONFIG_DIR}/omnitrace-tests-output/ls.inst -type f); do verbose-run ls ${i}; done - verbose-run omnitrace-instrument -e -v 1 -o ${CONFIG_DIR}/ls.inst -- ${LS_NAME} - verbose-run omnitrace-run -- ${CONFIG_DIR}/ls.inst ${LS_ARGS} + verbose-run rocprof-sys-instrument -e -v 1 -o ${CONFIG_DIR}/ls.inst -- ${LS_NAME} + verbose-run rocprof-sys-run -- ${CONFIG_DIR}/ls.inst ${LS_ARGS} } -test-omnitrace-runtime() +test-rocprof-sys-runtime() { if [ -f /usr/bin/coreutils ]; then local LS_NAME=coreutils @@ -193,14 +193,14 @@ test-omnitrace-runtime() local LS_NAME=ls local LS_ARGS="" fi - verbose-run omnitrace-instrument -e -v 1 --simulate -- ${LS_NAME} ${LS_ARGS} + verbose-run rocprof-sys-instrument -e -v 1 --simulate -- ${LS_NAME} ${LS_ARGS} for i in $(find ${CONFIG_DIR}/omnitrace-tests-output/$(basename ${LS_NAME}) -type f); do verbose-run ls ${i}; done - verbose-run omnitrace-instrument -e -v 1 -- ${LS_NAME} ${LS_ARGS} + 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_AVAIL}" -ne 0 ]; then verbose-run test-omnitrace-avail; fi -if [ "${ENABLE_OMNITRACE_SAMPLE}" -ne 0 ]; then verbose-run test-omnitrace-sample; fi -if [ "${ENABLE_OMNITRACE_PYTHON}" -ne 0 ]; then verbose-run test-omnitrace-python; fi -if [ "${ENABLE_OMNITRACE_REWRITE}" -ne 0 ]; then verbose-run test-omnitrace-rewrite; fi -if [ "${ENABLE_OMNITRACE_RUNTIME}" -ne 0 ]; then verbose-run test-omnitrace-runtime; 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 +if [ "${ENABLE_OMNITRACE_REWRITE}" -ne 0 ]; then verbose-run test-rocprof-sys-rewrite; fi +if [ "${ENABLE_OMNITRACE_RUNTIME}" -ne 0 ]; then verbose-run test-rocprof-sys-runtime; fi diff --git a/scripts/test-release.sh b/scripts/test-release.sh index d1bb6bbee..3dce5a628 100755 --- a/scripts/test-release.sh +++ b/scripts/test-release.sh @@ -96,10 +96,10 @@ setup-env() test-install() { - verbose-run omnitrace-instrument --help - verbose-run omnitrace-avail --help - verbose-run omnitrace-avail --all - if [ -d "${1}/lib/python/site-packages/omnitrace" ]; then + verbose-run rocprof-sys-instrument --help + verbose-run rocprof-sys-avail --help + verbose-run rocprof-sys-avail --all + if [ -d "${1}/lib/python/site-packages/rocprofsys" ]; then verbose-run omnitrace-python --help fi } diff --git a/scripts/write-omnitrace-install.cmake b/scripts/write-rocprofsys-install.cmake similarity index 67% rename from scripts/write-omnitrace-install.cmake rename to scripts/write-rocprofsys-install.cmake index d823c5700..2671ac317 100644 --- a/scripts/write-omnitrace-install.cmake +++ b/scripts/write-rocprofsys-install.cmake @@ -13,7 +13,8 @@ endif() message( STATUS - "Writing ${OUTPUT_DIR}/omnitrace-install.py for omnitrace v${OMNITRACE_VERSION}") + "Writing ${OUTPUT_DIR}/rocprof-sys-install.py for rocprof-sys v${OMNITRACE_VERSION}" + ) -configure_file(${CMAKE_CURRENT_LIST_DIR}/../cmake/Templates/omnitrace-install.py.in - ${OUTPUT_DIR}/omnitrace-install.py @ONLY) +configure_file(${CMAKE_CURRENT_LIST_DIR}/../cmake/Templates/rocprofsys-install.py.in + ${OUTPUT_DIR}/rocprof-sys-install.py @ONLY) diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index b93a14d8c..5d9e2e63a 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -18,11 +18,11 @@ if(OMNITRACE_USE_PYTHON) endif() if(OMNITRACE_BUILD_DEVELOPER) - add_custom_target(omnitrace-precommit) - foreach(_TARGET format-omnitrace-source format-omnitrace-cmake format-timemory-source - format-timemory-cmake) + add_custom_target(rocprofsys-precommit) + foreach(_TARGET format-rocprofsys-source format-rocprofsys-cmake + format-timemory-source format-timemory-cmake) if(TARGET ${_TARGET}) - add_dependencies(omnitrace-precommit ${_TARGET}) + add_dependencies(rocprofsys-precommit ${_TARGET}) endif() endforeach() endif() diff --git a/source/bin/CMakeLists.txt b/source/bin/CMakeLists.txt index 859b729fc..0a38b5ed4 100644 --- a/source/bin/CMakeLists.txt +++ b/source/bin/CMakeLists.txt @@ -5,11 +5,11 @@ if(OMNITRACE_USE_ROCPROFILER AND ROCmVersion_TRIPLE_VERSION VERSION_LESS 5.2.0 AND NOT CMAKE_INSTALL_RPATH_USE_LINK_PATH) set(OMNITRACE_EXE_INSTALL_RPATH - "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}/omnitrace:${rocprofiler_LIBRARY_DIR}" + "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}/${PACKAGE_NAME}:${rocprofiler_LIBRARY_DIR}" ) else() set(OMNITRACE_EXE_INSTALL_RPATH - "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}/omnitrace" + "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}/${PACKAGE_NAME}" ) endif() @@ -19,9 +19,8 @@ add_subdirectory(omnitrace-causal) add_subdirectory(omnitrace-sample) add_subdirectory(omnitrace-instrument) add_subdirectory(omnitrace-run) -# omnitrace-exe is deprecated -add_subdirectory(omnitrace-exe) +# tests if(OMNITRACE_BUILD_TESTING OR "$ENV{OMNITRACE_CI}" MATCHES "[1-9]+|ON|on|y|yes") add_subdirectory(tests) endif() diff --git a/source/bin/omnitrace-avail/CMakeLists.txt b/source/bin/omnitrace-avail/CMakeLists.txt index 2cec5b5ca..70f013b1f 100644 --- a/source/bin/omnitrace-avail/CMakeLists.txt +++ b/source/bin/omnitrace-avail/CMakeLists.txt @@ -1,13 +1,13 @@ # ------------------------------------------------------------------------------# # -# omnitrace-avail target +# rocprofsys-avail target # # ------------------------------------------------------------------------------# -add_executable(omnitrace-avail) +add_executable(rocprofsys-avail) target_sources( - omnitrace-avail + rocprofsys-avail PRIVATE ${CMAKE_CURRENT_LIST_DIR}/avail.cpp ${CMAKE_CURRENT_LIST_DIR}/avail.hpp ${CMAKE_CURRENT_LIST_DIR}/common.cpp @@ -22,19 +22,21 @@ target_sources( ${CMAKE_CURRENT_LIST_DIR}/info_type.cpp ${CMAKE_CURRENT_LIST_DIR}/info_type.hpp) -target_include_directories(omnitrace-avail PRIVATE ${CMAKE_CURRENT_LIST_DIR}) -target_compile_definitions(omnitrace-avail PRIVATE OMNITRACE_EXTERN_COMPONENTS=0) +target_include_directories(rocprofsys-avail PRIVATE ${CMAKE_CURRENT_LIST_DIR}) +target_compile_definitions(rocprofsys-avail PRIVATE OMNITRACE_EXTERN_COMPONENTS=0) target_link_libraries( - omnitrace-avail - PRIVATE omnitrace::omnitrace-compile-definitions - omnitrace::omnitrace-interface-library omnitrace::libomnitrace-static) + rocprofsys-avail + PRIVATE rocprofsys::rocprofsys-compile-definitions + rocprofsys::rocprofsys-interface-library rocprofsys::librocprofsys-static) set_target_properties( - omnitrace-avail PROPERTIES BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}" - INSTALL_RPATH "${OMNITRACE_EXE_INSTALL_RPATH}") + rocprofsys-avail + PROPERTIES BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}" + INSTALL_RPATH "${OMNITRACE_EXE_INSTALL_RPATH}" + OUTPUT_NAME rocprof-sys-avail) -omnitrace_strip_target(omnitrace-avail) +omnitrace_strip_target(rocprofsys-avail) install( - TARGETS omnitrace-avail + TARGETS rocprofsys-avail DESTINATION ${CMAKE_INSTALL_BINDIR} OPTIONAL) diff --git a/source/bin/omnitrace-avail/avail.cpp b/source/bin/omnitrace-avail/avail.cpp index 5fe5c446f..c1def6c3e 100644 --- a/source/bin/omnitrace-avail/avail.cpp +++ b/source/bin/omnitrace-avail/avail.cpp @@ -118,7 +118,7 @@ write_hw_counter_info(std::ostream&, const array_t& = {}, namespace { -// initialize HIP before main so that libomnitrace is not HSA_TOOLS_LIB +// initialize HIP before main so that librocprof-sys is not HSA_TOOLS_LIB int gpu_count = omnitrace::gpu::hip_device_count(); // statically allocated shared_ptrs to prevent use after free errors @@ -193,7 +193,7 @@ main(int argc, char** argv) std::string file = {}; - parser_t parser("omnitrace-avail"); + parser_t parser("rocprof-sys-avail"); parser.set_help_width(40); auto _cols = std::get<0>(tim::utility::console::get_columns()); @@ -202,7 +202,7 @@ main(int argc, char** argv) std::min(_cols - parser.get_help_width() - 8, 120)); parser.enable_help(); - parser.enable_version("omnitrace-avail", OMNITRACE_ARGPARSE_VERSION_INFO); + parser.enable_version("rocprof-sys-avail", OMNITRACE_ARGPARSE_VERSION_INFO); parser.start_group("DEBUG"); @@ -440,7 +440,7 @@ main(int argc, char** argv) "Dump a configuration to a specified file.") .max_count(1) .dtype("filename") - .set_default(std::string{ "omnitrace-config" }) + .set_default(std::string{ "rocprof-sys-config" }) .action([&_config_file](parser_t& _p) { auto _out = (_p.exists("output")) ? _p.get("output") : std::string{}; @@ -556,7 +556,7 @@ main(int argc, char** argv) generate_config(_config_file, _config_fmts, options); } catch(std::runtime_error& _e) { - std::cerr << "[omnitrace-avail] " << _e.what() << std::endl; + std::cerr << "[rocprof-sys-avail] " << _e.what() << std::endl; return EXIT_FAILURE; } return EXIT_SUCCESS; diff --git a/source/bin/omnitrace-avail/common.cpp b/source/bin/omnitrace-avail/common.cpp index 4c7ea56e5..ba6f8d47c 100644 --- a/source/bin/omnitrace-avail/common.cpp +++ b/source/bin/omnitrace-avail/common.cpp @@ -362,7 +362,7 @@ dump_log() void dump_log_abort(int _v) { - fprintf(stderr, "\n[omnitrace-avail] Exiting with signal %i...\n", _v); + fprintf(stderr, "\n[rocprof-sys-avail] Exiting with signal %i...\n", _v); debug_msg = true; dump_log(); } diff --git a/source/bin/omnitrace-avail/generate_config.cpp b/source/bin/omnitrace-avail/generate_config.cpp index cdb71029a..0956c0098 100644 --- a/source/bin/omnitrace-avail/generate_config.cpp +++ b/source/bin/omnitrace-avail/generate_config.cpp @@ -260,12 +260,12 @@ generate_config(std::string _config_file, const std::set& _config_f if(force_config) { if(settings::verbose() >= 1) - std::cout << "[omnitrace-avail] File '" << _fname + std::cout << "[rocprof-sys-avail] File '" << _fname << "' exists. Overwrite force...\n"; } else { - std::cout << "[omnitrace-avail] File '" << _fname + std::cout << "[rocprof-sys-avail] File '" << _fname << "' exists. Overwrite? " << std::flush; std::string _response = {}; std::cin >> _response; @@ -276,7 +276,7 @@ generate_config(std::string _config_file, const std::set& _config_f if(filepath::open(_ofs, _fname)) { if(settings::verbose() >= 0) - printf("[omnitrace-avail] Outputting %s configuration file '%s'...\n", + printf("[rocprof-sys-avail] Outputting %s configuration file '%s'...\n", _type.c_str(), _fname.c_str()); } else @@ -423,8 +423,9 @@ generate_config(std::string _config_file, const std::set& _config_f true, _output_dir); std::ofstream ofs{}; _open(ofs, _fname, "text") - << "# auto-generated by omnitrace-avail (version " << OMNITRACE_VERSION_STRING - << ") on " << tim::get_local_datetime("%F @ %H:%M", &_time) << "\n\n" + << "# auto-generated by rocprof-sys-avail (version " + << OMNITRACE_VERSION_STRING << ") on " + << tim::get_local_datetime("%F @ %H:%M", &_time) << "\n\n" << _ss.str(); } @@ -440,7 +441,7 @@ update_choices(const std::shared_ptr& _settings) std::vector _info = get_component_info(); if(_settings->get_verbose() >= 2 || _settings->get_debug()) - printf("[omnitrace-avail] # of component found: %zu\n", _info.size()); + printf("[rocprof-sys-avail] # of component found: %zu\n", _info.size()); _info.erase(std::remove_if(_info.begin(), _info.end(), [](const auto& itr) { @@ -463,7 +464,7 @@ update_choices(const std::shared_ptr& _settings) for(const auto& itr : _info) _component_choices.emplace_back(itr.id_type()); if(_settings->get_verbose() >= 2 || _settings->get_debug()) - printf("[omnitrace-avail] # of component choices: %zu\n", + printf("[rocprof-sys-avail] # of component choices: %zu\n", _component_choices.size()); _settings->find("OMNITRACE_TIMEMORY_COMPONENTS") ->second->set_choices(_component_choices); diff --git a/source/bin/omnitrace-causal/CMakeLists.txt b/source/bin/omnitrace-causal/CMakeLists.txt index 0d0ed3763..de871024c 100644 --- a/source/bin/omnitrace-causal/CMakeLists.txt +++ b/source/bin/omnitrace-causal/CMakeLists.txt @@ -1,27 +1,29 @@ # ------------------------------------------------------------------------------# # -# omnitrace-causal target +# rocprofsys-causal target # # ------------------------------------------------------------------------------# add_executable( - omnitrace-causal + rocprofsys-causal ${CMAKE_CURRENT_LIST_DIR}/omnitrace-causal.cpp ${CMAKE_CURRENT_LIST_DIR}/omnitrace-causal.hpp ${CMAKE_CURRENT_LIST_DIR}/impl.cpp) -target_compile_definitions(omnitrace-causal PRIVATE TIMEMORY_CMAKE=1) -target_include_directories(omnitrace-causal PRIVATE ${CMAKE_CURRENT_LIST_DIR}) +target_compile_definitions(rocprofsys-causal PRIVATE TIMEMORY_CMAKE=1) +target_include_directories(rocprofsys-causal PRIVATE ${CMAKE_CURRENT_LIST_DIR}) target_link_libraries( - omnitrace-causal - PRIVATE omnitrace::omnitrace-compile-definitions omnitrace::omnitrace-headers - omnitrace::omnitrace-common-library omnitrace::omnitrace-core) + rocprofsys-causal + PRIVATE rocprofsys::rocprofsys-compile-definitions rocprofsys::rocprofsys-headers + rocprofsys::rocprofsys-common-library rocprofsys::rocprofsys-core) set_target_properties( - omnitrace-causal PROPERTIES BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}" - INSTALL_RPATH "${OMNITRACE_EXE_INSTALL_RPATH}") + rocprofsys-causal + PROPERTIES BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}" + INSTALL_RPATH "${OMNITRACE_EXE_INSTALL_RPATH}" + OUTPUT_NAME "rocprof-sys-causal") -omnitrace_strip_target(omnitrace-causal) +omnitrace_strip_target(rocprofsys-causal) install( - TARGETS omnitrace-causal + TARGETS rocprofsys-causal DESTINATION ${CMAKE_INSTALL_BINDIR} OPTIONAL) diff --git a/source/bin/omnitrace-causal/impl.cpp b/source/bin/omnitrace-causal/impl.cpp index 5e901fa4c..ec3e0e534 100644 --- a/source/bin/omnitrace-causal/impl.cpp +++ b/source/bin/omnitrace-causal/impl.cpp @@ -202,7 +202,7 @@ get_initial_environment() update_env(_env, "OMNITRACE_USE_PROCESS_SAMPLING", false); update_env(_env, "OMNITRACE_THREAD_POOL_SIZE", get_env("OMNITRACE_THREAD_POOL_SIZE", 0)); - update_env(_env, "OMNITRACE_LAUNCHER", "omnitrace-causal"); + update_env(_env, "OMNITRACE_LAUNCHER", "rocprof-sys-causal"); return _env; } @@ -228,7 +228,7 @@ prepare_command_for_run(char* _exe, std::vector& _argv) if(!_injected) { throw std::runtime_error( - join("", "omnitrace-causal was unable to match \"", launcher, + join("", "rocprof-sys-causal was unable to match \"", launcher, "\" to any arguments on the command line: \"", join(array_config{ " ", "", "" }, _argv), "\"")); } @@ -244,7 +244,7 @@ prepare_environment_for_run(std::vector& _env) { update_env(_env, "LD_PRELOAD", join(":", LIBPTHREAD_SO, - get_realpath(get_internal_libpath("libomnitrace-dl.so"))), + get_realpath(get_internal_libpath("librocprof-sys-dl.so"))), true); } } @@ -419,13 +419,13 @@ parse_args(int argc, char** argv, std::vector& _env, This executable is designed to streamline that process. For example (assume all commands end with '-- '): - omnitrace-causal -n 5 -- # runs 5x with causal profiling enabled + rocprof-sys-causal -n 5 -- # runs 5x with causal profiling enabled - omnitrace-causal -s 0 5,10,15,20 # runs 2x with virtual speedups: + rocprof-sys-causal -s 0 5,10,15,20 # runs 2x with virtual speedups: # - 0 # - randomly selected from 5, 10, 15, and 20 - omnitrace-causal -F func_A func_B func_(A|B) # runs 3x with the function scope limited to: + rocprof-sys-causal -F func_A func_B func_(A|B) # runs 3x with the function scope limited to: # 1. func_A # 2. func_B # 3. func_A or func_B @@ -433,10 +433,10 @@ parse_args(int argc, char** argv, std::vector& _env, - Insert progress points at hotspots in your code or use omnitrace's runtime instrumentation - Note: binary rewrite will produce a incompatible new binary - Collect a flat profile via sampling - - E.g., omnitrace-sample -F -- + - E.g., rocprof-sys-sample -F -- - Inspect sampling_wall_clock.txt and sampling_cpu_clock.txt for functions to target - - Run omnitrace-causal in "function" mode first (does not require debug info) - - Run omnitrace-causal in "line" mode when you are targeting one function (requires debug info) + - Run rocprof-sys-causal in "function" mode first (does not require debug info) + - Run rocprof-sys-causal in "line" mode when you are targeting one function (requires debug info) - Preferably, use predictions from the "function" mode to determine which function to target - Limit the virtual speedups to a smaller pool, e.g., 0,5,10,25,50, to get reliable predictions quicker - Make use of the binary, source, and function scope to limit the functions/lines selected for experiments @@ -451,7 +451,7 @@ parse_args(int argc, char** argv, std::vector& _env, }); parser.enable_help(); - parser.enable_version("omnitrace-causal", OMNITRACE_ARGPARSE_VERSION_INFO); + parser.enable_version("rocprof-sys-causal", OMNITRACE_ARGPARSE_VERSION_INFO); auto _cols = std::get<0>(console::get_columns()); if(_cols > parser.get_help_width() + 8) @@ -483,7 +483,7 @@ parse_args(int argc, char** argv, std::vector& _env, }); std::string _config_file = {}; - std::string _config_folder = "omnitrace-causal-config"; + std::string _config_folder = "rocprof-sys-causal-config"; bool _generate_configs = false; bool _add_defaults = true; @@ -498,10 +498,12 @@ parse_args(int argc, char** argv, std::vector& _env, parser .add_argument( { "-l", "--launcher" }, - "When running MPI jobs, omnitrace-causal needs to be *before* the executable " + "When running MPI jobs, rocprof-sys-causal needs to be *before* the " + "executable " "which launches the MPI processes (i.e. before `mpirun`, `srun`, etc.). Pass " "the name of the target executable (or a regex for matching to the name of " - "the target) for causal profiling, e.g., `omnitrace-causal -l foo -- mpirun " + "the target) for causal profiling, e.g., `rocprof-sys-causal -l foo -- " + "mpirun " "-n 4 foo`. This ensures that the omnitrace library is LD_PRELOADed on the " "proper target") .count(1) @@ -511,7 +513,7 @@ parse_args(int argc, char** argv, std::vector& _env, .add_argument({ "-g", "--generate-configs" }, "Generate config files instead of passing environment variables " "directly. If no arguments are provided, the config files will be " - "placed in ${PWD}/omnitrace-causal-config folder") + "placed in ${PWD}/rocprof-sys-causal-config folder") .min_count(0) .max_count(1) .dtype("folder") diff --git a/source/bin/omnitrace-causal/omnitrace-causal.hpp b/source/bin/omnitrace-causal/omnitrace-causal.hpp index 9e0dc529f..3e54e67de 100644 --- a/source/bin/omnitrace-causal/omnitrace-causal.hpp +++ b/source/bin/omnitrace-causal/omnitrace-causal.hpp @@ -22,7 +22,7 @@ #pragma once -#define TIMEMORY_PROJECT_NAME "omnitrace-causal" +#define TIMEMORY_PROJECT_NAME "rocprof-sys-causal" #include #include diff --git a/source/bin/omnitrace-exe/CMakeLists.txt b/source/bin/omnitrace-exe/CMakeLists.txt index 576efbdfe..db97b6a92 100644 --- a/source/bin/omnitrace-exe/CMakeLists.txt +++ b/source/bin/omnitrace-exe/CMakeLists.txt @@ -1,23 +1,24 @@ # ------------------------------------------------------------------------------# # -# omnitrace-exe target (deprecated 'omnitrace' executable, now 'omnitrace-instrument') +# TODO: [DFG] Remove this file after 'rocprofsys' rebranding is complete +# rocprofsys-exe target (deprecated 'omnitrace' executable, now 'rocprofsys-instrument') # # ------------------------------------------------------------------------------# -add_executable(omnitrace-exe ${CMAKE_CURRENT_LIST_DIR}/omnitrace.cpp) +add_executable(rocprofsys-exe ${CMAKE_CURRENT_LIST_DIR}/omnitrace.cpp) -target_link_libraries(omnitrace-exe PRIVATE omnitrace::omnitrace-threading) +target_link_libraries(rocprofsys-exe PRIVATE rocprofsys::rocprofsys-threading) set_target_properties( - omnitrace-exe + rocprofsys-exe PROPERTIES OUTPUT_NAME omnitrace BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}" INSTALL_RPATH "${OMNITRACE_EXE_INSTALL_RPATH}" INSTALL_RPATH_USE_LINK_PATH ON) -omnitrace_strip_target(omnitrace-exe) +omnitrace_strip_target(rocprofsys-exe) install( - TARGETS omnitrace-exe + TARGETS rocprofsys-exe DESTINATION ${CMAKE_INSTALL_BINDIR} OPTIONAL) diff --git a/source/bin/omnitrace-exe/omnitrace.cpp b/source/bin/omnitrace-exe/omnitrace.cpp index 215d5b505..ca2619ca5 100644 --- a/source/bin/omnitrace-exe/omnitrace.cpp +++ b/source/bin/omnitrace-exe/omnitrace.cpp @@ -66,17 +66,17 @@ main(int argc, char** argv) gggggg - OmniTrace has renamed the "omnitrace" executable to "omnitrace-instrument" to reduce confusion. + ROCm Systems Profiler has renamed the "omnitrace" executable to "rocprof-sys-instrument" to reduce confusion. This executable only exists to provide this deprecation warning and maintain backwards compatibility for a few releases. - This executable will soon invoke "omnitrace-instrument" with the arguments you just provided after we've given you + This executable will soon invoke "rocprof-sys-instrument" with the arguments you just provided after we've given you a chance to read this message. If you are running this job interactively, please acknowledge that you've read this message and whether you want to continue. If you are running this job non-interactively, we will resume executing after ~1 minute unless CI or OMNITRACE_CI is defined in the environment, in which case, we will throw an error. - Thanks for using OmniTrace and happy optimizing! + Thanks for using ROCm Systems Profiler and happy optimizing! )warning"; auto _completed = std::promise{}; @@ -96,7 +96,7 @@ main(int argc, char** argv) _emit_warning(); std::cerr << "[" << argv[0] << "] Detected " << _env_var << " environment variable. Exiting to prevent consuming CI resources. " - "Use \"omnitrace-instrument\" executable instead of \"omnitrace\" " + "Use \"rocprof-sys-instrument\" executable instead of \"omnitrace\" " "to prevent this error." << std::endl; std::exit(EXIT_FAILURE); diff --git a/source/bin/omnitrace-instrument/CMakeLists.txt b/source/bin/omnitrace-instrument/CMakeLists.txt index ffed45638..01490b2a0 100644 --- a/source/bin/omnitrace-instrument/CMakeLists.txt +++ b/source/bin/omnitrace-instrument/CMakeLists.txt @@ -1,15 +1,15 @@ # ------------------------------------------------------------------------------# # -# omnitrace-instrument target (formerly omnitrace-exe target prior to 1.8.1) +# rocprofsys-instrument target (formerly rocprofsys-exe target prior to 1.8.1) # # ------------------------------------------------------------------------------# set(CMAKE_INTERPROCEDURAL_OPTIMIZATION OFF) -add_executable(omnitrace-instrument) +add_executable(rocprofsys-instrument) target_sources( - omnitrace-instrument + rocprofsys-instrument PRIVATE ${CMAKE_CURRENT_LIST_DIR}/details.cpp ${CMAKE_CURRENT_LIST_DIR}/function_signature.cpp ${CMAKE_CURRENT_LIST_DIR}/function_signature.hpp @@ -25,36 +25,37 @@ target_sources( ${CMAKE_CURRENT_LIST_DIR}/omnitrace-instrument.hpp) target_link_libraries( - omnitrace-instrument - PRIVATE omnitrace::omnitrace-headers - omnitrace::omnitrace-dyninst - omnitrace::omnitrace-compile-options - omnitrace::omnitrace-compile-definitions - omnitrace::omnitrace-sanitizer + rocprofsys-instrument + PRIVATE rocprofsys::rocprofsys-headers + rocprofsys::rocprofsys-dyninst + rocprofsys::rocprofsys-compile-options + rocprofsys::rocprofsys-compile-definitions + rocprofsys::rocprofsys-sanitizer timemory::timemory-headers timemory::timemory-extensions timemory::timemory-core) set_target_properties( - omnitrace-instrument + rocprofsys-instrument PROPERTIES BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}" INSTALL_RPATH "${OMNITRACE_EXE_INSTALL_RPATH}" - INSTALL_RPATH_USE_LINK_PATH ON) + INSTALL_RPATH_USE_LINK_PATH ON + OUTPUT_NAME "rocprof-sys-instrument") if(OMNITRACE_BUILD_DYNINST) - target_compile_definitions(omnitrace-instrument PRIVATE OMNITRACE_BUILD_DYNINST=1) + target_compile_definitions(rocprofsys-instrument PRIVATE OMNITRACE_BUILD_DYNINST=1) endif() -add_target_flag_if_avail(omnitrace-instrument "-Wno-deprecated-declarations") +add_target_flag_if_avail(rocprofsys-instrument "-Wno-deprecated-declarations") -omnitrace_strip_target(omnitrace-instrument) +omnitrace_strip_target(rocprofsys-instrument) if(CMAKE_BUILD_TYPE MATCHES "^(DEBUG|Debug)") string(REPLACE " " ";" _FLAGS "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") - target_compile_options(omnitrace-instrument PRIVATE ${_FLAGS}) + target_compile_options(rocprofsys-instrument PRIVATE ${_FLAGS}) endif() install( - TARGETS omnitrace-instrument + TARGETS rocprofsys-instrument DESTINATION ${CMAKE_INSTALL_BINDIR} OPTIONAL) diff --git a/source/bin/omnitrace-instrument/internal_libs.cpp b/source/bin/omnitrace-instrument/internal_libs.cpp index b8ebb7d05..1f25f5206 100644 --- a/source/bin/omnitrace-instrument/internal_libs.cpp +++ b/source/bin/omnitrace-instrument/internal_libs.cpp @@ -418,7 +418,7 @@ get_internal_libs_data_impl() for(const auto* itr : { "lib", "lib64" }) { for(const auto* litr : - { "libomnitrace-dl.so", "libomnitrace-user.so", "libomnitrace-rt.so" }) + { "librocprof-sys-dl.so", "librocprof-sys-user.so", "librocprof-sys-rt.so" }) { auto _libpath = join('/', _omnitrace_base_path, itr, litr); if(filepath::exists(_libpath)) diff --git a/source/bin/omnitrace-instrument/module_function.cpp b/source/bin/omnitrace-instrument/module_function.cpp index 5b857c172..fe133abaf 100644 --- a/source/bin/omnitrace-instrument/module_function.cpp +++ b/source/bin/omnitrace-instrument/module_function.cpp @@ -444,12 +444,15 @@ module_function::is_internal_constrained() const auto _module_base = _basename(module_name); auto _module_real = _realpath(module_name); - if(std::regex_search(module_name, std::regex{ "lib(omnitrace|timemory|perfetto)" })) + if(std::regex_search( + module_name, + std::regex{ "lib(rocprof-sys|rocprofsys|omnitrace|timemory|perfetto)" })) return _report("Excluding", "module", "omnitrace", 3); else if(std::regex_match(module_name, std::regex{ ".*/source/lib/" "(core|common|binary|omnitrace|omnitrace-dl|" - "omnitrace-user)/.*/.*\\.(h|c|cpp|hpp)$" })) + "omnitrace-user|rocprofsys|rocprofsys-dl|" + "rocprofsys-user)/.*/.*\\.(h|c|cpp|hpp)$" })) return _report("Excluding", "module", "omnitrace", 3); if(std::regex_search(function_name, std::regex{ "9omnitrace|omnitrace(::|_)" })) @@ -507,7 +510,8 @@ module_function::is_module_constrained() const static std::regex sys_build_regex{ "^(\\.\\./sysdeps/|/build/)", regex_opts }; static std::regex dyninst_regex{ "(dyninst|DYNINST|(^|/)RT[[:graph:]]+\\.c$)", regex_opts }; - static std::regex dependlib_regex{ "^(lib|)(omnitrace|pthread|caliper|gotcha|papi|" + static std::regex dependlib_regex{ "^(lib|)(rocprof-sys|rocprofsys|omnitrace|" + "pthread|caliper|gotcha|papi|" "cupti|TAU|likwid|pfm|nvperf|unwind)", regex_opts }; static std::regex core_cmod_regex{ diff --git a/source/bin/omnitrace-instrument/omnitrace-instrument.cpp b/source/bin/omnitrace-instrument/omnitrace-instrument.cpp index 91844e90a..9b37ab2d1 100644 --- a/source/bin/omnitrace-instrument/omnitrace-instrument.cpp +++ b/source/bin/omnitrace-instrument/omnitrace-instrument.cpp @@ -206,7 +206,7 @@ strvec_t lib_search_paths = tim::delimit( strvec_t bin_search_paths = tim::delimit(tim::get_env("PATH"), ":"); auto _dyn_api_rt_paths = tim::delimit( - JOIN(":", get_internal_libpath(), JOIN("/", get_internal_libpath(), "omnitrace")), + JOIN(":", get_internal_libpath(), JOIN("/", get_internal_libpath(), "rocprofsys")), ":"); std::string @@ -315,13 +315,14 @@ main(int argc, char** argv) if(!_omni_root.empty() && exists(_omni_root)) { bin_search_paths.emplace_back(JOIN('/', _omni_root, "bin")); - bin_search_paths.emplace_back(JOIN('/', _omni_root, "lib", "omnitrace")); - bin_search_paths.emplace_back(JOIN('/', _omni_root, "lib", "omnitrace", "bin")); + bin_search_paths.emplace_back(JOIN('/', _omni_root, "lib", "rocprofsys")); + bin_search_paths.emplace_back(JOIN('/', _omni_root, "lib", "rocprofsys", "bin")); lib_search_paths.emplace_back(JOIN('/', _omni_root, "lib")); - lib_search_paths.emplace_back(JOIN('/', _omni_root, "lib", "omnitrace")); - lib_search_paths.emplace_back(JOIN('/', _omni_root, "lib", "omnitrace", "lib")); - lib_search_paths.emplace_back(JOIN('/', _omni_root, "lib", "omnitrace", "lib64")); - OMNITRACE_ADD_LOG_ENTRY(argv[0], "::", "omnitrace root path: ", _omni_root); + lib_search_paths.emplace_back(JOIN('/', _omni_root, "lib", "rocprofsys")); + lib_search_paths.emplace_back(JOIN('/', _omni_root, "lib", "rocprofsys", "lib")); + lib_search_paths.emplace_back( + JOIN('/', _omni_root, "lib", "rocprofsys", "lib64")); + OMNITRACE_ADD_LOG_ENTRY(argv[0], "::", "rocprofsys root path: ", _omni_root); } auto _omni_exe_path = get_realpath(get_absolute_exe_filepath(argv[0])); @@ -332,19 +333,20 @@ main(int argc, char** argv) auto _omni_lib_path = JOIN('/', filepath::dirname(filepath::dirname(_omni_exe_path)), "lib"); - bin_search_paths.emplace_back(JOIN('/', _omni_lib_path, "omnitrace")); - bin_search_paths.emplace_back(JOIN('/', _omni_lib_path, "omnitrace", "bin")); + bin_search_paths.emplace_back(JOIN('/', _omni_lib_path, "rocprofsys")); + bin_search_paths.emplace_back(JOIN('/', _omni_lib_path, "rocprofsys", "bin")); lib_search_paths.emplace_back(_omni_lib_path); - lib_search_paths.emplace_back(JOIN('/', _omni_lib_path, "omnitrace")); - lib_search_paths.emplace_back(JOIN('/', _omni_lib_path, "omnitrace", "lib")); - lib_search_paths.emplace_back(JOIN('/', _omni_lib_path, "omnitrace", "lib64")); + lib_search_paths.emplace_back(JOIN('/', _omni_lib_path, "rocprofsys")); + lib_search_paths.emplace_back(JOIN('/', _omni_lib_path, "rocprofsys", "lib")); + lib_search_paths.emplace_back(JOIN('/', _omni_lib_path, "rocprofsys", "lib64")); - OMNITRACE_ADD_LOG_ENTRY(argv[0], "::", "omnitrace bin path: ", _omni_exe_path); - OMNITRACE_ADD_LOG_ENTRY(argv[0], "::", "omnitrace lib path: ", _omni_lib_path); + OMNITRACE_ADD_LOG_ENTRY(argv[0], "::", "rocprofsys bin path: ", _omni_exe_path); + OMNITRACE_ADD_LOG_ENTRY(argv[0], "::", "rocprofsys lib path: ", _omni_lib_path); for(const auto& itr : omnitrace_get_link_map(nullptr)) { - if(itr.find("omnitrace") != std::string::npos || + if(itr.find("rocprofsys") != std::string::npos || + itr.find("rocprof-sys") != std::string::npos || std::regex_search( itr, std::regex{ "lib(dyninstAPI|stackwalk|pcontrol|patchAPI|parseAPI|" "instructionAPI|symtabAPI|dynDwarf|common|dynElf|tbb|" @@ -376,7 +378,7 @@ main(int argc, char** argv) string_t mutname = {}; string_t outfile = {}; string_t logfile = {}; - std::vector inputlib = { "libomnitrace-dl" }; + std::vector inputlib = { "librocprof-sys-dl" }; std::vector libname = {}; std::vector sharedlibname = {}; std::vector staticlibname = {}; @@ -465,11 +467,11 @@ main(int argc, char** argv) // it is unrecognized, then set the errflag to report an error. When we come to a // non '-' charcter, then we must be at the application name. using parser_t = tim::argparse::argument_parser; - parser_t parser("omnitrace-instrument"); + parser_t parser("rocprof-sys-instrument"); string_t extra_help = "-- "; parser.enable_help(); - parser.enable_version("omnitrace-instrument", OMNITRACE_ARGPARSE_VERSION_INFO); + parser.enable_version("rocprof-sys-instrument", OMNITRACE_ARGPARSE_VERSION_INFO); parser.add_argument({ "" }, ""); parser.add_argument({ "[DEBUG OPTIONS]" }, ""); @@ -1163,10 +1165,10 @@ main(int argc, char** argv) { fflush(stdout); std::stringstream _separator{}; - // 18 is approximate length of '[omnitrace][exe] ' + // 20 is approximate length of '[rocprof-sys][exe] ' // 32 is approximate length of 'Warning! "" is not executable!' size_t _width = - std::min(std::get<0>(tim::utility::console::get_columns()) - 18, + std::min(std::get<0>(tim::utility::console::get_columns()) - 20, strlen(_cmdv[0]) + 32); _separator.fill('='); _separator << "#" << std::setw(_width - 2) << "" @@ -1225,12 +1227,12 @@ main(int argc, char** argv) { auto* _save = _cmdv[0]; _cmdv[0] = const_cast(outfile.c_str()); - tim::timemory_init(_cmdc, _cmdv, "omnitrace-"); + tim::timemory_init(_cmdc, _cmdv, "rocprofsys-"); _cmdv[0] = _save; } else { - tim::timemory_init(_cmdc, _cmdv, "omnitrace-"); + tim::timemory_init(_cmdc, _cmdv, "rocprofsys-"); } if(!logfile.empty()) @@ -1757,9 +1759,9 @@ main(int argc, char** argv) if(_pos != npos_v) _name = _name.substr(_pos + 1); _pos = _name.find('.'); if(_pos != npos_v) _name = _name.substr(0, _pos); - _pos = _name.find("libomnitrace-"); + _pos = _name.find("librocprof-sys-"); if(_pos != npos_v) - _name = _name.erase(_pos, std::string("libomnitrace-").length()); + _name = _name.erase(_pos, std::string("librocprof-sys-").length()); _pos = _name.find("lib"); if(_pos == 0) _name = _name.substr(_pos + std::string("lib").length()); while((_pos = _name.find('-')) != npos_v) @@ -1768,7 +1770,7 @@ main(int argc, char** argv) verbprintf(2, "Supplemental instrumentation library '%s' is named '%s' after " "removing everything before last '/', everything after first '.', and " - "'libomnitrace-'...\n", + "'librocprof-sys-'...\n", itr.c_str(), _name.c_str()); use_stubs[_name] = false; @@ -1927,7 +1929,7 @@ main(int argc, char** argv) { if(_libname.empty()) _libname = get_absolute_lib_filepath(itr); } - if(_libname.empty()) _libname = "libomnitrace-dl.so"; + if(_libname.empty()) _libname = "librocprof-sys-dl.so"; if(!binary_rewrite && !is_attached) env_vars.clear(); @@ -2076,7 +2078,7 @@ main(int argc, char** argv) size_t _ninits = 0; for(auto* itr : _objs) { - if(itr->name().find("libomnitrace") != std::string::npos) continue; + if(itr->name().find("librocprof-sys") != std::string::npos) continue; try { verbprintf(2, "Adding main init callbacks (via %s)...\n", @@ -2815,7 +2817,7 @@ find_dyn_api_rt() { #if defined(OMNITRACE_BUILD_DYNINST) std::string _dyn_api_rt_base = - (binary_rewrite) ? "libomnitrace-rt" : "libdyninstAPI_RT"; + (binary_rewrite) ? "librocprof-sys-rt" : "libdyninstAPI_RT"; #else std::string _dyn_api_rt_base = "libdyninstAPI_RT"; #endif diff --git a/source/bin/omnitrace-run/CMakeLists.txt b/source/bin/omnitrace-run/CMakeLists.txt index 63054bcc8..441c03860 100644 --- a/source/bin/omnitrace-run/CMakeLists.txt +++ b/source/bin/omnitrace-run/CMakeLists.txt @@ -1,28 +1,30 @@ # ------------------------------------------------------------------------------# # -# omnitrace-run target +# rocprofsys-run target # # ------------------------------------------------------------------------------# add_executable( - omnitrace-run + rocprofsys-run ${CMAKE_CURRENT_LIST_DIR}/omnitrace-run.cpp ${CMAKE_CURRENT_LIST_DIR}/omnitrace-run.hpp ${CMAKE_CURRENT_LIST_DIR}/impl.cpp) -target_compile_definitions(omnitrace-run PRIVATE TIMEMORY_CMAKE=1) -target_include_directories(omnitrace-run PRIVATE ${CMAKE_CURRENT_LIST_DIR}) +target_compile_definitions(rocprofsys-run PRIVATE TIMEMORY_CMAKE=1) +target_include_directories(rocprofsys-run PRIVATE ${CMAKE_CURRENT_LIST_DIR}) target_link_libraries( - omnitrace-run - PRIVATE omnitrace::omnitrace-compile-definitions omnitrace::omnitrace-headers - omnitrace::omnitrace-common-library omnitrace::omnitrace-core - omnitrace::omnitrace-sanitizer) + rocprofsys-run + PRIVATE rocprofsys::rocprofsys-compile-definitions rocprofsys::rocprofsys-headers + rocprofsys::rocprofsys-common-library rocprofsys::rocprofsys-core + rocprofsys::rocprofsys-sanitizer) set_target_properties( - omnitrace-run PROPERTIES BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}" - INSTALL_RPATH "${OMNITRACE_EXE_INSTALL_RPATH}") + rocprofsys-run + PROPERTIES BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}" + INSTALL_RPATH "${OMNITRACE_EXE_INSTALL_RPATH}" + OUTPUT_NAME "rocprof-sys-run") -omnitrace_strip_target(omnitrace-run) +omnitrace_strip_target(rocprofsys-run) install( - TARGETS omnitrace-run + TARGETS rocprofsys-run DESTINATION ${CMAKE_INSTALL_BINDIR} OPTIONAL) diff --git a/source/bin/omnitrace-run/impl.cpp b/source/bin/omnitrace-run/impl.cpp index ae3f486c2..1232e76f5 100644 --- a/source/bin/omnitrace-run/impl.cpp +++ b/source/bin/omnitrace-run/impl.cpp @@ -176,7 +176,7 @@ prepare_command_for_run(char* _exe, parser_data_t& _data) if(!_injected) { throw std::runtime_error( - join("", "omnitrace-run was unable to match \"", _data.launcher, + join("", "rocprof-sys-run was unable to match \"", _data.launcher, "\" to any arguments on the command line: \"", join(array_config{ " ", "", "" }, _data.command), "\"")); } @@ -292,8 +292,8 @@ parse_args(int argc, char** argv, parser_data_t& _parser_data, bool& _fork_exec) exit(EXIT_FAILURE); }); - parser.enable_help("", "Usage: omnitrace-run -- "); - parser.enable_version("omnitrace-run", OMNITRACE_ARGPARSE_VERSION_INFO); + parser.enable_help("", "Usage: rocprof-sys-run -- "); + parser.enable_version("rocprof-sys-run", OMNITRACE_ARGPARSE_VERSION_INFO); auto _cols = std::get<0>(console::get_columns()); if(_cols > parser.get_help_width() + 8) diff --git a/source/bin/omnitrace-sample/CMakeLists.txt b/source/bin/omnitrace-sample/CMakeLists.txt index 8fe6e61dd..208393018 100644 --- a/source/bin/omnitrace-sample/CMakeLists.txt +++ b/source/bin/omnitrace-sample/CMakeLists.txt @@ -1,25 +1,27 @@ # ------------------------------------------------------------------------------# # -# omnitrace-sample target +# rocprofsys-sample target # # ------------------------------------------------------------------------------# -add_executable(omnitrace-sample ${CMAKE_CURRENT_LIST_DIR}/omnitrace-sample.cpp - ${CMAKE_CURRENT_LIST_DIR}/impl.cpp) +add_executable(rocprofsys-sample ${CMAKE_CURRENT_LIST_DIR}/omnitrace-sample.cpp + ${CMAKE_CURRENT_LIST_DIR}/impl.cpp) -target_compile_definitions(omnitrace-sample PRIVATE TIMEMORY_CMAKE=1) -target_include_directories(omnitrace-sample PRIVATE ${CMAKE_CURRENT_LIST_DIR}) +target_compile_definitions(rocprofsys-sample PRIVATE TIMEMORY_CMAKE=1) +target_include_directories(rocprofsys-sample PRIVATE ${CMAKE_CURRENT_LIST_DIR}) target_link_libraries( - omnitrace-sample - PRIVATE omnitrace::omnitrace-compile-definitions omnitrace::omnitrace-headers - omnitrace::omnitrace-common-library) + rocprofsys-sample + PRIVATE rocprofsys::rocprofsys-compile-definitions rocprofsys::rocprofsys-headers + rocprofsys::rocprofsys-common-library) set_target_properties( - omnitrace-sample PROPERTIES BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}" - INSTALL_RPATH "${OMNITRACE_EXE_INSTALL_RPATH}") + rocprofsys-sample + PROPERTIES BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}" + INSTALL_RPATH "${OMNITRACE_EXE_INSTALL_RPATH}" + OUTPUT_NAME "rocprof-sys-sample") -omnitrace_strip_target(omnitrace-sample) +omnitrace_strip_target(rocprofsys-sample) install( - TARGETS omnitrace-sample + TARGETS rocprofsys-sample DESTINATION ${CMAKE_INSTALL_BINDIR} OPTIONAL) diff --git a/source/bin/omnitrace-sample/impl.cpp b/source/bin/omnitrace-sample/impl.cpp index 4833f9b56..797179f2e 100644 --- a/source/bin/omnitrace-sample/impl.cpp +++ b/source/bin/omnitrace-sample/impl.cpp @@ -130,8 +130,8 @@ get_initial_environment() } } - auto _dl_libpath = get_realpath(get_internal_libpath("libomnitrace-dl.so")); - auto _omni_libpath = get_realpath(get_internal_libpath("libomnitrace.so")); + auto _dl_libpath = get_realpath(get_internal_libpath("librocprof-sys-dl.so")); + auto _omni_libpath = get_realpath(get_internal_libpath("librocprof-sys.so")); update_env(_env, "LD_PRELOAD", _dl_libpath, UPD_APPEND); update_env(_env, "LD_LIBRARY_PATH", tim::filepath::dirname(_dl_libpath), UPD_APPEND); @@ -315,9 +315,9 @@ parse_args(int argc, char** argv, std::vector& _env) }; auto* _dl_libpath = - realpath(get_internal_libpath("libomnitrace-dl.so").c_str(), nullptr); + realpath(get_internal_libpath("librocprof-sys-dl.so").c_str(), nullptr); auto* _omni_libpath = - realpath(get_internal_libpath("libomnitrace.so").c_str(), nullptr); + realpath(get_internal_libpath("librocprof-sys.so").c_str(), nullptr); auto parser = parser_t(argv[0]); @@ -372,7 +372,7 @@ parse_args(int argc, char** argv, std::vector& _env) parser.set_use_color(true); parser.enable_help(); - parser.enable_version("omnitrace-sample", OMNITRACE_ARGPARSE_VERSION_INFO); + parser.enable_version("rocprof-sys-sample", OMNITRACE_ARGPARSE_VERSION_INFO); auto _cols = std::get<0>(tim::utility::console::get_columns()); if(_cols > parser.get_help_width() + 8) @@ -837,11 +837,11 @@ parse_args(int argc, char** argv, std::vector& _env) remove_env(_env, "KOKKOS_PROFILE_LIBRARY"); }); - parser.start_group("HARDWARE COUNTER OPTIONS", "See also: omnitrace-avail -H"); + parser.start_group("HARDWARE COUNTER OPTIONS", "See also: rocprof-sys-avail -H"); parser .add_argument({ "-C", "--cpu-events" }, "Set the CPU hardware counter events to record (ref: " - "`omnitrace-avail -H -c CPU`)") + "`rocprof-sys-avail -H -c CPU`)") .action([&](parser_t& p) { auto _events = join(array_config{ "," }, p.get>("cpu-events")); @@ -852,7 +852,7 @@ parse_args(int argc, char** argv, std::vector& _env) parser .add_argument({ "-G", "--gpu-events" }, "Set the GPU hardware counter events to record (ref: " - "`omnitrace-avail -H -c GPU`)") + "`rocprof-sys-avail -H -c GPU`)") .action([&](parser_t& p) { auto _events = join(array_config{ "," }, p.get>("gpu-events")); diff --git a/source/bin/tests/CMakeLists.txt b/source/bin/tests/CMakeLists.txt index bb1123ac8..fd9f371f2 100644 --- a/source/bin/tests/CMakeLists.txt +++ b/source/bin/tests/CMakeLists.txt @@ -34,7 +34,7 @@ function(OMNITRACE_ADD_BIN_TEST) "OMNITRACE_CI=ON" "OMNITRACE_CI_TIMEOUT=${TEST_TIMEOUT}" "OMNITRACE_CONFIG_FILE=" - "OMNITRACE_OUTPUT_PATH=${PROJECT_BINARY_DIR}/omnitrace-tests-output" + "OMNITRACE_OUTPUT_PATH=${PROJECT_BINARY_DIR}/rocprofsys-tests-output" "TWD=${TEST_WORKING_DIRECTORY}") # copy for inverse set(TEST_ENVIRONMENT_INV "${TEST_ENVIRONMENT}") @@ -74,7 +74,7 @@ function(OMNITRACE_ADD_BIN_TEST) DEPENDS "${TEST_DEPENDS}" LABELS - "omnitrace-bin;${TEST_LABELS}" + "rocprofsys-bin;${TEST_LABELS}" PASS_REGULAR_EXPRESSION "${TEST_PASS_REGEX}" FAIL_REGULAR_EXPRESSION @@ -97,7 +97,7 @@ function(OMNITRACE_ADD_BIN_TEST) DEPENDS "${TEST_DEPENDS}" LABELS - "omnitrace-bin;${TEST_LABELS}" + "rocprofsys-bin;${TEST_LABELS}" PASS_REGULAR_EXPRESSION "${TEST_PASS_REGEX}" FAIL_REGULAR_EXPRESSION @@ -111,13 +111,13 @@ function(OMNITRACE_ADD_BIN_TEST) endfunction() omnitrace_add_bin_test( - NAME omnitrace-instrument-help - TARGET omnitrace-instrument + NAME rocprofsys-instrument-help + TARGET rocprofsys-instrument ARGS --help - LABELS omnitrace-instrument + LABELS rocprofsys-instrument TIMEOUT 45 PASS_REGEX - ".*\\\[omnitrace-instrument\\\] Usage:.*\\\[DEBUG OPTIONS\\\].*\\\[MODE OPTIONS\\\].*\\\[LIBRARY OPTIONS\\\].*\\\[SYMBOL SELECTION OPTIONS\\\].*\\\[RUNTIME OPTIONS\\\].*\\\[GRANULARITY OPTIONS\\\].*\\\[DYNINST OPTIONS\\\].*" + ".*\\\[rocprof-sys-instrument\\\] Usage:.*\\\[DEBUG OPTIONS\\\].*\\\[MODE OPTIONS\\\].*\\\[LIBRARY OPTIONS\\\].*\\\[SYMBOL SELECTION OPTIONS\\\].*\\\[RUNTIME OPTIONS\\\].*\\\[GRANULARITY OPTIONS\\\].*\\\[DYNINST OPTIONS\\\].*" ) # on RedHat, /usr/bin/ls is a script for `coreutils --coreutils-prog=ls` @@ -130,8 +130,8 @@ else() endif() omnitrace_add_bin_test( - NAME omnitrace-instrument-simulate-ls - TARGET omnitrace-instrument + NAME rocprofsys-instrument-simulate-ls + TARGET rocprofsys-instrument ARGS --simulate --print-format json @@ -147,44 +147,44 @@ omnitrace_add_bin_test( TIMEOUT 240) omnitrace_add_bin_test( - NAME omnitrace-instrument-simulate-ls-check - DEPENDS omnitrace-instrument-simulate-ls - COMMAND ls omnitrace-tests-output/omnitrace-instrument-simulate-ls/instrumentation + NAME rocprofsys-instrument-simulate-ls-check + DEPENDS rocprofsys-instrument-simulate-ls + COMMAND ls rocprofsys-tests-output/rocprofsys-instrument-simulate-ls/instrumentation TIMEOUT 60 PASS_REGEX ".*available.json.*available.txt.*available.xml.*excluded.json.*excluded.txt.*excluded.xml.*instrumented.json.*instrumented.txt.*instrumented.xml.*overlapping.json.*overlapping.txt.*overlapping.xml.*" FAIL_REGEX "No such file or directory|not found|OMNITRACE_ABORT_FAIL_REGEX") omnitrace_add_bin_test( - NAME omnitrace-instrument-simulate-lib - TARGET omnitrace-instrument - ARGS --print-available functions -v 2 -- $ + NAME rocprofsys-instrument-simulate-lib + TARGET rocprofsys-instrument + ARGS --print-available functions -v 2 -- $ LABELS "simulate" TIMEOUT 120 PASS_REGEX "\\\[omnitrace\\\]\\\[exe\\\] Runtime instrumentation is not possible!(.*)\n(.*)\\\[omnitrace\\\]\\\[exe\\\] Switching to binary rewrite mode and assuming '--simulate --all-functions'" ) -file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/omnitrace-tests-output/tmp) +file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/rocprofsys-tests-output/tmp) omnitrace_add_bin_test( - NAME omnitrace-instrument-simulate-lib-basename - TARGET omnitrace-instrument + NAME rocprofsys-instrument-simulate-lib-basename + TARGET rocprofsys-instrument ARGS --print-available functions -v 2 -o - ${PROJECT_BINARY_DIR}/omnitrace-tests-output/omnitrace-instrument-simulate-lib-basename/${CMAKE_SHARED_LIBRARY_PREFIX}$${CMAKE_SHARED_LIBRARY_SUFFIX} + ${PROJECT_BINARY_DIR}/rocprofsys-tests-output/rocprofsys-instrument-simulate-lib-basename/${CMAKE_SHARED_LIBRARY_PREFIX}$${CMAKE_SHARED_LIBRARY_SUFFIX} -- - ${CMAKE_SHARED_LIBRARY_PREFIX}$${CMAKE_SHARED_LIBRARY_SUFFIX} + ${CMAKE_SHARED_LIBRARY_PREFIX}$${CMAKE_SHARED_LIBRARY_SUFFIX} LABELS "simulate" TIMEOUT 120 - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/omnitrace-tests-output/tmp) + WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/rocprofsys-tests-output/tmp) omnitrace_add_bin_test( - NAME omnitrace-instrument-write-log - TARGET omnitrace-instrument + NAME rocprofsys-instrument-write-log + TARGET rocprofsys-instrument ARGS --print-instrumented functions -v @@ -199,76 +199,77 @@ omnitrace_add_bin_test( PASS_REGEX "Opening .*/instrumentation/user.log") omnitrace_add_bin_test( - NAME omnitrace-instrument-write-log-check - DEPENDS omnitrace-instrument-write-log - COMMAND ls - omnitrace-tests-output/omnitrace-instrument-write-log/instrumentation/user.log + NAME rocprofsys-instrument-write-log-check + DEPENDS rocprofsys-instrument-write-log + COMMAND + ls + rocprofsys-tests-output/rocprofsys-instrument-write-log/instrumentation/user.log LABELS "log" TIMEOUT 60 PASS_REGEX "user.log" FAIL_REGEX "No such file or directory|not found|OMNITRACE_ABORT_FAIL_REGEX") omnitrace_add_bin_test( - NAME omnitrace-avail-help - TARGET omnitrace-avail + NAME rocprofsys-avail-help + TARGET rocprofsys-avail ARGS --help - LABELS "omnitrace-avail" + LABELS "rocprofsys-avail" TIMEOUT 45 PASS_REGEX - ".*\\\[omnitrace-avail\\\] Usage:.*\\\[DEBUG OPTIONS\\\].*\\\[INFO OPTIONS\\\].*\\\[FILTER OPTIONS\\\].*\\\[COLUMN OPTIONS\\\].*\\\[DISPLAY OPTIONS\\\].*\\\[OUTPUT OPTIONS\\\].*" + ".*\\\[rocprof-sys-avail\\\] Usage:.*\\\[DEBUG OPTIONS\\\].*\\\[INFO OPTIONS\\\].*\\\[FILTER OPTIONS\\\].*\\\[COLUMN OPTIONS\\\].*\\\[DISPLAY OPTIONS\\\].*\\\[OUTPUT OPTIONS\\\].*" ) omnitrace_add_bin_test( - NAME omnitrace-avail-all - TARGET omnitrace-avail + NAME rocprofsys-avail-all + TARGET rocprofsys-avail ARGS --all - LABELS "omnitrace-avail" + LABELS "rocprofsys-avail" TIMEOUT 45) omnitrace_add_bin_test( - NAME omnitrace-avail-all-expand-keys - TARGET omnitrace-avail + NAME rocprofsys-avail-all-expand-keys + TARGET rocprofsys-avail ARGS --all --expand-keys - LABELS "omnitrace-avail" + LABELS "rocprofsys-avail" TIMEOUT 45 FAIL_REGEX "%[a-zA-Z_]%|OMNITRACE_ABORT_FAIL_REGEX") omnitrace_add_bin_test( - NAME omnitrace-avail-all-only-available-alphabetical - TARGET omnitrace-avail + NAME rocprofsys-avail-all-only-available-alphabetical + TARGET rocprofsys-avail ARGS --all --available --alphabetical --debug --output - ${CMAKE_CURRENT_BINARY_DIR}/omnitrace-avail-all-only-available-alphabetical.log - LABELS "omnitrace-avail" + ${CMAKE_CURRENT_BINARY_DIR}/rocprofsys-avail-all-only-available-alphabetical.log + LABELS "rocprofsys-avail" TIMEOUT 45 PROPERTIES ATTACHED_FILES - ${CMAKE_CURRENT_BINARY_DIR}/omnitrace-avail-all-only-available-alphabetical.log) + ${CMAKE_CURRENT_BINARY_DIR}/rocprofsys-avail-all-only-available-alphabetical.log) omnitrace_add_bin_test( - NAME omnitrace-avail-all-csv - TARGET omnitrace-avail + NAME rocprofsys-avail-all-csv + TARGET rocprofsys-avail ARGS --all --csv --csv-separator "#" - LABELS "omnitrace-avail" + LABELS "rocprofsys-avail" TIMEOUT 45 PASS_REGEX "COMPONENT#AVAILABLE#VALUE_TYPE#STRING_IDS#FILENAME#DESCRIPTION#CATEGORY#.*ENVIRONMENT VARIABLE#VALUE#DATA TYPE#DESCRIPTION#CATEGORIES#.*HARDWARE COUNTER#DEVICE#AVAILABLE#DESCRIPTION#" ) omnitrace_add_bin_test( - NAME omnitrace-avail-filter-wall-clock-available - TARGET omnitrace-avail + NAME rocprofsys-avail-filter-wall-clock-available + TARGET rocprofsys-avail ARGS -r wall_clock -C --available - LABELS "omnitrace-avail" + LABELS "rocprofsys-avail" TIMEOUT 45 PASS_REGEX "\\\|[-]+\\\|\n\\\|[ ]+COMPONENT[ ]+\\\|\n\\\|[-]+\\\|\n\\\| (wall_clock)[ ]+\\\|\n\\\|[-]+\\\|" ) omnitrace_add_bin_test( - NAME omnitrace-avail-category-filter-omnitrace - TARGET omnitrace-avail + NAME rocprofsys-avail-category-filter-rocprofsys + TARGET rocprofsys-avail ARGS --categories settings::omnitrace --brief - LABELS "omnitrace-avail" + LABELS "rocprofsys-avail" TIMEOUT 45 PASS_REGEX "OMNITRACE_(SETTINGS_DESC|OUTPUT_FILE|OUTPUT_PREFIX)" FAIL_REGEX @@ -276,18 +277,18 @@ omnitrace_add_bin_test( ) omnitrace_add_bin_test( - NAME omnitrace-avail-category-filter-timemory - TARGET omnitrace-avail + NAME rocprofsys-avail-category-filter-timemory + TARGET rocprofsys-avail ARGS --categories settings::timemory --brief --advanced - LABELS "omnitrace-avail" + LABELS "rocprofsys-avail" TIMEOUT 45 PASS_REGEX "OMNITRACE_(ADD_SECONDARY|SCIENTIFIC|PRECISION|MEMORY_PRECISION|TIMING_PRECISION)" FAIL_REGEX "OMNITRACE_(SETTINGS_DESC|OUTPUT_FILE)|OMNITRACE_ABORT_FAIL_REGEX") omnitrace_add_bin_test( - NAME omnitrace-avail-regex-negation - TARGET omnitrace-avail + NAME rocprofsys-avail-regex-negation + TARGET rocprofsys-avail ARGS -R omnitrace ~timemory @@ -299,20 +300,21 @@ omnitrace_add_bin_test( --csv --brief --advanced - LABELS "omnitrace-avail" + LABELS "rocprofsys-avail" TIMEOUT 45 PASS_REGEX "ENVIRONMENT VARIABLE,[ \n]+OMNITRACE_THREAD_POOL_SIZE,[ \n]+OMNITRACE_USE_PID,[ \n]+" FAIL_REGEX "OMNITRACE_TRACE|OMNITRACE_ABORT_FAIL_REGEX") -string(REPLACE "+" "\\\+" _AVAIL_CFG_PATH - "${PROJECT_BINARY_DIR}/omnitrace-tests-output/omnitrace-avail/omnitrace-") +string( + REPLACE "+" "\\\+" _AVAIL_CFG_PATH + "${PROJECT_BINARY_DIR}/rocprofsys-tests-output/rocprofsys-avail/rocprofsys-") # use of TWD == Test Working Directory (added by function) omnitrace_add_bin_test( - NAME omnitrace-avail-write-config - TARGET omnitrace-avail + NAME rocprofsys-avail-write-config + TARGET rocprofsys-avail ARGS -G - %env{TWD}%/omnitrace-tests-output/omnitrace-avail/omnitrace-test.cfg + %env{TWD}%/rocprofsys-tests-output/rocprofsys-avail/rocprofsys-test.cfg -F txt json @@ -322,67 +324,67 @@ omnitrace_add_bin_test( -c omnitrace TIMEOUT 45 - LABELS "omnitrace-avail" + LABELS "rocprofsys-avail" PASS_REGEX "Outputting JSON configuration file '${_AVAIL_CFG_PATH}test\\\.json'(.*)Outputting XML configuration file '${_AVAIL_CFG_PATH}test\\\.xml'(.*)Outputting text configuration file '${_AVAIL_CFG_PATH}test\\\.cfg'(.*)" ) omnitrace_add_bin_test( - NAME omnitrace-avail-write-config-tweak - TARGET omnitrace-avail - ARGS -G %env{TWD}%/omnitrace-tests-output/omnitrace-avail/omnitrace-tweak.cfg -F txt - json xml --force + NAME rocprofsys-avail-write-config-tweak + TARGET rocprofsys-avail + ARGS -G %env{TWD}%/rocprofsys-tests-output/rocprofsys-avail/rocprofsys-tweak.cfg -F + txt json xml --force TIMEOUT 45 - LABELS "omnitrace-avail" + LABELS "rocprofsys-avail" ENVIRONMENT "OMNITRACE_TRACE=OFF;OMNITRACE_PROFILE=ON" PASS_REGEX "Outputting JSON configuration file '${_AVAIL_CFG_PATH}tweak\\\.json'(.*)Outputting XML configuration file '${_AVAIL_CFG_PATH}tweak\\\.xml'(.*)Outputting text configuration file '${_AVAIL_CFG_PATH}tweak\\\.cfg'(.*)" ) omnitrace_add_bin_test( - NAME omnitrace-avail-list-keys - TARGET omnitrace-avail + NAME rocprofsys-avail-list-keys + TARGET rocprofsys-avail ARGS --list-keys --expand-keys TIMEOUT 45 - LABELS "omnitrace-avail" + LABELS "rocprofsys-avail" PASS_REGEX "Output Keys:\n(.*)%argv%(.*)%argv_hash%") omnitrace_add_bin_test( - NAME omnitrace-avail-list-keys-markdown - TARGET omnitrace-avail + NAME rocprofsys-avail-list-keys-markdown + TARGET rocprofsys-avail ARGS --list-keys --expand-keys --markdown TIMEOUT 45 - LABELS "omnitrace-avail;markdown" + LABELS "rocprofsys-avail;markdown" PASS_REGEX "(.*)`%argv%`(.*)`%argv_hash%`") omnitrace_add_bin_test( - NAME omnitrace-avail-list-categories - TARGET omnitrace-avail + NAME rocprofsys-avail-list-categories + TARGET rocprofsys-avail ARGS --list-categories TIMEOUT 45 - LABELS "omnitrace-avail" + LABELS "rocprofsys-avail" PASS_REGEX " component::(.*) hw_counters::(.*) settings::") omnitrace_add_bin_test( - NAME omnitrace-avail-core-categories - TARGET omnitrace-avail + NAME rocprofsys-avail-core-categories + TARGET rocprofsys-avail ARGS -c core TIMEOUT 45 - LABELS "omnitrace-avail" + LABELS "rocprofsys-avail" PASS_REGEX "OMNITRACE_CONFIG_FILE(.*)OMNITRACE_ENABLED(.*)OMNITRACE_SUPPRESS_CONFIG(.*)OMNITRACE_SUPPRESS_PARSING(.*)OMNITRACE_VERBOSE" ) omnitrace_add_bin_test( - NAME omnitrace-run-help - TARGET omnitrace-run + NAME rocprofsys-run-help + TARGET rocprofsys-run ARGS --help TIMEOUT 45 - LABELS "omnitrace-run") + LABELS "rocprofsys-run") -file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/omnitrace-tests-config") +file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/rocprofsys-tests-config") file( - WRITE "${PROJECT_BINARY_DIR}/omnitrace-tests-config/empty.cfg" + WRITE "${PROJECT_BINARY_DIR}/rocprofsys-tests-config/empty.cfg" " # # empty config file @@ -395,17 +397,17 @@ set_target_properties( ${PROJECT_BINARY_DIR}/bin/testing) omnitrace_add_bin_test( - NAME omnitrace-run-args - TARGET omnitrace-run + NAME rocprofsys-run-args + TARGET rocprofsys-run ARGS --monochrome --debug=false -v 1 -c - %env{TWD}%/omnitrace-tests-config/empty.cfg + %env{TWD}%/rocprofsys-tests-config/empty.cfg -o - omnitrace-tests-output - omnitrace-run-args-output/ + rocprofsys-tests-output + rocprofsys-run-args-output/ -TPHD -S cputime @@ -469,7 +471,7 @@ omnitrace_add_bin_test( --kokkosp-name-length-max=1024 --kokkosp-prefix="[kokkos]" --tmpdir - ${CMAKE_BINARY_DIR}/omnitrace-tests-config/tmpdir + ${CMAKE_BINARY_DIR}/rocprofsys-tests-config/tmpdir --perfetto-backend inprocess --use-pid @@ -488,4 +490,4 @@ omnitrace_add_bin_test( $ 5 TIMEOUT 45 - LABELS "omnitrace-run") + LABELS "rocprofsys-run") diff --git a/source/lib/CMakeLists.txt b/source/lib/CMakeLists.txt index e1a5d06fb..701801375 100644 --- a/source/lib/CMakeLists.txt +++ b/source/lib/CMakeLists.txt @@ -1,10 +1,10 @@ # ----------------------------------------------------------------------------- # # -# omnitrace: contains all instrumentation functionality +# rocprofsys: contains all instrumentation functionality # -# omnitrace-dl: contains minimal symbols and dlopen's omnitrace +# rocprofsys-dl: contains minimal symbols and dlopen's rocprofsys # -# omnitrace-user: contains symbols for user API +# rocprofsys-user: contains symbols for user API # # ----------------------------------------------------------------------------- # @@ -17,51 +17,52 @@ if(OMNITRACE_USE_ROCPROFILER AND ROCmVersion_TRIPLE_VERSION VERSION_LESS 5.2.0 AND NOT CMAKE_INSTALL_RPATH_USE_LINK_PATH) set(OMNITRACE_LIB_INSTALL_RPATH - "\$ORIGIN:\$ORIGIN/omnitrace:${rocprofiler_LIBRARY_DIR}") + "\$ORIGIN:\$ORIGIN/${PACKAGE_NAME}:${rocprofiler_LIBRARY_DIR}") else() - set(OMNITRACE_LIB_INSTALL_RPATH "\$ORIGIN:\$ORIGIN/omnitrace") + set(OMNITRACE_LIB_INSTALL_RPATH "\$ORIGIN:\$ORIGIN/${PACKAGE_NAME}") endif() # ------------------------------------------------------------------------------# # -# omnitrace interface library +# rocprofsys interface library # # ------------------------------------------------------------------------------# -add_library(omnitrace-interface-library INTERFACE) -add_library(omnitrace::omnitrace-interface-library ALIAS omnitrace-interface-library) +add_library(rocprofsys-interface-library INTERFACE) +add_library(rocprofsys::rocprofsys-interface-library ALIAS rocprofsys-interface-library) target_include_directories( - omnitrace-interface-library INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/omnitrace) + rocprofsys-interface-library INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/omnitrace) target_link_libraries( - omnitrace-interface-library + rocprofsys-interface-library INTERFACE - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $,omnitrace::omnitrace-lto,>>) + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $,rocprofsys::rocprofsys-lto,>> + ) # ------------------------------------------------------------------------------# # -# omnitrace internal libraries +# rocprofsys internal libraries # # ------------------------------------------------------------------------------# @@ -71,7 +72,7 @@ add_subdirectory(binary) # ------------------------------------------------------------------------------# # -# omnitrace exported libraries +# rocprofsys exported libraries # # ------------------------------------------------------------------------------# diff --git a/source/lib/binary/CMakeLists.txt b/source/lib/binary/CMakeLists.txt index 8eefb0a44..930b233cf 100644 --- a/source/lib/binary/CMakeLists.txt +++ b/source/lib/binary/CMakeLists.txt @@ -16,13 +16,13 @@ set(binary_headers ${CMAKE_CURRENT_LIST_DIR}/scope_filter.hpp ${CMAKE_CURRENT_LIST_DIR}/symbol.hpp) -add_library(omnitrace-binary-library STATIC) -add_library(omnitrace::omnitrace-binary ALIAS omnitrace-binary-library) +add_library(rocprofsys-binary-library STATIC) +add_library(rocprofsys::rocprofsys-binary ALIAS rocprofsys-binary-library) -target_sources(omnitrace-binary-library PRIVATE ${binary_sources} ${binary_headers}) +target_sources(rocprofsys-binary-library PRIVATE ${binary_sources} ${binary_headers}) target_link_libraries( - omnitrace-binary-library PRIVATE omnitrace::omnitrace-interface-library - omnitrace::omnitrace-core) + rocprofsys-binary-library PRIVATE rocprofsys::rocprofsys-interface-library + rocprofsys::rocprofsys-core) -set_target_properties(omnitrace-binary-library PROPERTIES OUTPUT_NAME omnitrace-binary) +set_target_properties(rocprofsys-binary-library PROPERTIES OUTPUT_NAME rocprof-sys-binary) diff --git a/source/lib/binary/analysis.cpp b/source/lib/binary/analysis.cpp index bdc4204c2..c88b3de2a 100644 --- a/source/lib/binary/analysis.cpp +++ b/source/lib/binary/analysis.cpp @@ -237,10 +237,10 @@ lookup_ipaddr_entry(uintptr_t _addr, unw_context_t* _context_p, } }; - for(const auto& itr : binary::get_link_map("libomnitrace.so", "", "")) + for(const auto& itr : binary::get_link_map("librocprof-sys.so", "", "")) _insert_exclude_range(itr.real()); - for(const auto& itr : binary::get_link_map("libomnitrace-dl.so", "", "")) + for(const auto& itr : binary::get_link_map("librocprof-sys-dl.so", "", "")) _insert_exclude_range(itr.real()); return _exclude_range_v; diff --git a/source/lib/binary/link_map.hpp b/source/lib/binary/link_map.hpp index 2faee5917..328c8f378 100644 --- a/source/lib/binary/link_map.hpp +++ b/source/lib/binary/link_map.hpp @@ -54,11 +54,11 @@ std::optional get_linked_path(const char*, open_modes_vec_t&& = {}); // default parameters: get the linked binaries for the exe but exclude the linked binaries -// from libomnitrace +// from librocprof-sys std::set get_link_map(const char* _lib = nullptr, - const std::string& _exclude_linked_by = "libomnitrace.so", - const std::string& _exclude_re = "libomnitrace-([a-zA-Z]+)\\.so", + const std::string& _exclude_linked_by = "librocprof-sys.so", + const std::string& _exclude_re = "librocprof-sys-([a-zA-Z]+)\\.so", open_modes_vec_t&& _open_modes = {}); } // namespace binary } // namespace omnitrace diff --git a/source/lib/common/CMakeLists.txt b/source/lib/common/CMakeLists.txt index 74b7b6437..9294ff66b 100644 --- a/source/lib/common/CMakeLists.txt +++ b/source/lib/common/CMakeLists.txt @@ -1,18 +1,18 @@ # ------------------------------------------------------------------------------# # -# omnitrace common headers +# rocprofsys common headers # # ------------------------------------------------------------------------------# -add_library(omnitrace-common-library INTERFACE) -add_library(omnitrace::common-library ALIAS omnitrace-common-library) -add_library(omnitrace::omnitrace-common-library ALIAS omnitrace-common-library) +add_library(rocprofsys-common-library INTERFACE) +add_library(rocprofsys::common-library ALIAS rocprofsys-common-library) +add_library(rocprofsys::rocprofsys-common-library ALIAS rocprofsys-common-library) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/defines.h.in ${CMAKE_CURRENT_BINARY_DIR}/defines.h @ONLY) target_sources( - omnitrace-common-library + rocprofsys-common-library INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/defines.h ${CMAKE_CURRENT_SOURCE_DIR}/delimit.hpp ${CMAKE_CURRENT_SOURCE_DIR}/environment.hpp @@ -24,11 +24,11 @@ get_filename_component(COMMON_SOURCE_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" D get_filename_component(COMMON_BINARY_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}" DIRECTORY) target_include_directories( - omnitrace-common-library + rocprofsys-common-library INTERFACE $ $ $ $) -target_compile_definitions(omnitrace-common-library +target_compile_definitions(rocprofsys-common-library INTERFACE $) diff --git a/source/lib/common/setup.hpp b/source/lib/common/setup.hpp index 08546e529..225a92ea1 100644 --- a/source/lib/common/setup.hpp +++ b/source/lib/common/setup.hpp @@ -87,8 +87,8 @@ inline namespace common { inline std::vector get_environ(int _verbose, std::string _search_paths = {}, - std::string _omnilib = "libomnitrace.so", - std::string _omnilib_dl = "libomnitrace-dl.so") + std::string _omnilib = "librocprof-sys.so", + std::string _omnilib_dl = "librocprof-sys-dl.so") { auto _data = std::vector{}; auto _omnilib_path = path::get_origin(_omnilib); @@ -274,8 +274,8 @@ get_environ(int _verbose, std::string _search_paths = {}, inline void setup_environ(int _verbose, const std::string& _search_paths = {}, - std::string _omnilib = "libomnitrace.so", - std::string _omnilib_dl = "libomnitrace-dl.so") + std::string _omnilib = "librocprof-sys.so", + std::string _omnilib_dl = "librocprof-sys-dl.so") { auto _data = get_environ(_verbose, _search_paths, std::move(_omnilib), std::move(_omnilib_dl)); diff --git a/source/lib/core/CMakeLists.txt b/source/lib/core/CMakeLists.txt index bef6228c1..c1cb39a47 100644 --- a/source/lib/core/CMakeLists.txt +++ b/source/lib/core/CMakeLists.txt @@ -40,36 +40,37 @@ set(core_headers ${CMAKE_CURRENT_LIST_DIR}/timemory.hpp ${CMAKE_CURRENT_LIST_DIR}/utility.hpp) -add_library(omnitrace-core-library STATIC) -add_library(omnitrace::omnitrace-core ALIAS omnitrace-core-library) +add_library(rocprofsys-core-library STATIC) +add_library(rocprofsys::rocprofsys-core ALIAS rocprofsys-core-library) -target_sources(omnitrace-core-library PRIVATE ${core_sources} ${core_headers} - ${CMAKE_CURRENT_BINARY_DIR}/defines.hpp) +target_sources(rocprofsys-core-library PRIVATE ${core_sources} ${core_headers} + ${CMAKE_CURRENT_BINARY_DIR}/defines.hpp) add_subdirectory(binary) add_subdirectory(components) add_subdirectory(containers) -target_include_directories(omnitrace-core-library BEFORE +target_include_directories(rocprofsys-core-library BEFORE PRIVATE ${CMAKE_CURRENT_LIST_DIR}) -target_link_libraries(omnitrace-core-library - PRIVATE omnitrace::omnitrace-interface-library) +target_link_libraries(rocprofsys-core-library + PRIVATE rocprofsys::rocprofsys-interface-library) target_link_libraries( - omnitrace-core-library + rocprofsys-core-library PRIVATE - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $,omnitrace::omnitrace-lto,>>) + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $,rocprofsys::rocprofsys-lto,>> + ) -set_target_properties(omnitrace-core-library PROPERTIES OUTPUT_NAME omnitrace-core) +set_target_properties(rocprofsys-core-library PROPERTIES OUTPUT_NAME rocprof-sys-core) diff --git a/source/lib/core/argparse.cpp b/source/lib/core/argparse.cpp index c91ad674b..72db8b399 100644 --- a/source/lib/core/argparse.cpp +++ b/source/lib/core/argparse.cpp @@ -219,8 +219,8 @@ init_parser(parser_data& _data) } } - _data.dl_libpath = get_realpath(get_internal_libpath("libomnitrace-dl.so").c_str()); - _data.omni_libpath = get_realpath(get_internal_libpath("libomnitrace.so").c_str()); + _data.dl_libpath = get_realpath(get_internal_libpath("librocprof-sys-dl.so").c_str()); + _data.omni_libpath = get_realpath(get_internal_libpath("librocprof-sys.so").c_str()); #if defined(OMNITRACE_USE_ROCTRACER) || defined(OMNITRACE_USE_ROCPROFILER) update_env(_data, "HSA_TOOLS_LIB", _data.dl_libpath); @@ -1191,14 +1191,14 @@ add_core_arguments(parser_t& _parser, parser_data& _data) add_group_arguments(_parser, "sampling", _data); - _parser.start_group("HARDWARE COUNTER OPTIONS", "See also: omnitrace-avail -H"); + _parser.start_group("HARDWARE COUNTER OPTIONS", "See also: rocprof-sys-avail -H"); if(_data.environ_filter("cpu_events", _data)) { _parser .add_argument({ "-C", "--cpu-events" }, "Set the CPU hardware counter events to record (ref: " - "`omnitrace-avail -H -c CPU`)") + "`rocprof-sys-avail -H -c CPU`)") .min_count(1) .dtype("[EVENT ...]") .action([&](parser_t& p) { @@ -1216,7 +1216,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data) _parser .add_argument({ "-G", "--gpu-events" }, "Set the GPU hardware counter events to record (ref: " - "`omnitrace-avail -H -c GPU`)") + "`rocprof-sys-avail -H -c GPU`)") .min_count(1) .dtype("[EVENT ...]") .action([&](parser_t& p) { @@ -1353,7 +1353,7 @@ add_group_arguments(parser_t& _parser, const std::string& _group_name, parser_da }), _choices.end()); _choices.emplace_back( - "... run `omnitrace-avail -H -c CPU` for full list ..."); + "... run `rocprof-sys-avail -H -c CPU` for full list ..."); itr.second->set_choices(_choices); } } @@ -1414,7 +1414,7 @@ add_extended_arguments(parser_t& _parser, parser_data& _data) }), _choices.end()); _choices.emplace_back( - "... run `omnitrace-avail -H -c CPU` for full list ..."); + "... run `rocprof-sys-avail -H -c CPU` for full list ..."); itr.second->set_choices(_choices); } diff --git a/source/lib/core/binary/CMakeLists.txt b/source/lib/core/binary/CMakeLists.txt index 085125f31..1a1803164 100644 --- a/source/lib/core/binary/CMakeLists.txt +++ b/source/lib/core/binary/CMakeLists.txt @@ -4,4 +4,4 @@ set(binary_sources ${CMAKE_CURRENT_LIST_DIR}/address_range.cpp) set(binary_headers ${CMAKE_CURRENT_LIST_DIR}/address_range.hpp ${CMAKE_CURRENT_LIST_DIR}/fwd.hpp) -target_sources(omnitrace-core-library PRIVATE ${binary_sources} ${binary_headers}) +target_sources(rocprofsys-core-library PRIVATE ${binary_sources} ${binary_headers}) diff --git a/source/lib/core/components/CMakeLists.txt b/source/lib/core/components/CMakeLists.txt index 52774a7c6..76370ed83 100644 --- a/source/lib/core/components/CMakeLists.txt +++ b/source/lib/core/components/CMakeLists.txt @@ -3,4 +3,4 @@ set(component_sources) set(component_headers ${CMAKE_CURRENT_LIST_DIR}/fwd.hpp) -target_sources(omnitrace-core-library PRIVATE ${component_sources} ${component_headers}) +target_sources(rocprofsys-core-library PRIVATE ${component_sources} ${component_headers}) diff --git a/source/lib/core/config.cpp b/source/lib/core/config.cpp index d7bb5d959..114b17e0c 100644 --- a/source/lib/core/config.cpp +++ b/source/lib/core/config.cpp @@ -97,7 +97,7 @@ get_config() std::string get_setting_name(std::string _v) { - static const auto _prefix = tim::string_view_t{ "omnitrace_" }; + static const auto _prefix = tim::string_view_t{ "rocprofsys_" }; for(auto& itr : _v) itr = tolower(itr); auto _pos = _v.find(_prefix); @@ -121,7 +121,7 @@ using utility::parse_numeric_range; [&]() { \ auto _ret = _config->insert( \ ENV_NAME, get_setting_name(ENV_NAME), DESCRIPTION, TYPE{ INITIAL_VALUE }, \ - std::set{ "custom", "omnitrace", "libomnitrace", \ + std::set{ "custom", "rocprofsys", "librocprof-sys", \ __VA_ARGS__ }); \ if(!_ret.second) \ { \ @@ -131,12 +131,12 @@ using utility::parse_numeric_range; return _config->find(ENV_NAME)->second; \ }() -// below does not include "libomnitrace" +// below does not include "librocprof-sys" #define OMNITRACE_CONFIG_EXT_SETTING(TYPE, ENV_NAME, DESCRIPTION, INITIAL_VALUE, ...) \ [&]() { \ auto _ret = _config->insert( \ ENV_NAME, get_setting_name(ENV_NAME), DESCRIPTION, TYPE{ INITIAL_VALUE }, \ - std::set{ "custom", "omnitrace", __VA_ARGS__ }); \ + std::set{ "custom", "rocprofsys", __VA_ARGS__ }); \ if(!_ret.second) \ { \ OMNITRACE_PRINT("Warning! Duplicate setting: %s / %s\n", \ @@ -151,7 +151,8 @@ using utility::parse_numeric_range; [&]() { \ auto _ret = _config->insert( \ ENV_NAME, get_setting_name(ENV_NAME), DESCRIPTION, TYPE{ INITIAL_VALUE }, \ - std::set{ "custom", "omnitrace", "libomnitrace", __VA_ARGS__ }, \ + std::set{ "custom", "rocprofsys", "librocprof-sys", \ + __VA_ARGS__ }, \ std::vector{ CMD_LINE }); \ if(!_ret.second) \ { \ @@ -255,7 +256,7 @@ configure_settings(bool _init) OMNITRACE_CONFIG_EXT_SETTING(int, "OMNITRACE_DL_VERBOSE", "Verbosity within the omnitrace-dl library", 0, - "debugging", "libomnitrace-dl", "advanced"); + "debugging", "librocprof-sys-dl", "advanced"); OMNITRACE_CONFIG_SETTING( size_t, "OMNITRACE_NUM_THREADS_HINT", @@ -715,7 +716,7 @@ configure_settings(bool _init) OMNITRACE_CONFIG_SETTING( std::string, "OMNITRACE_TIMEMORY_COMPONENTS", - "List of components to collect via timemory (see `omnitrace-avail -C`)", + "List of components to collect via timemory (see `rocprof-sys-avail -C`)", "wall_clock", "timemory", "component"); OMNITRACE_CONFIG_SETTING(std::string, "OMNITRACE_OUTPUT_FILE", @@ -864,7 +865,7 @@ configure_settings(bool _init) { auto _categories = itr->second->get_categories(); _categories.emplace("omnitrace"); - _categories.emplace("libomnitrace"); + _categories.emplace("librocprof-sys"); itr->second->set_categories(_categories); } }; @@ -1039,7 +1040,7 @@ configure_settings(bool _init) { using argparser_t = tim::argparse::argument_parser; argparser_t _parser{ _exe }; - tim::timemory_init(_cmd, _parser, "omnitrace-"); + tim::timemory_init(_cmd, _parser, "rocprofsys-"); } #if !defined(OMNITRACE_USE_MPI) && !defined(OMNITRACE_USE_MPI_HEADERS) @@ -1163,8 +1164,8 @@ configure_mode_settings(const std::shared_ptr& _config) if(_config->get("OMNITRACE_USE_KOKKOSP")) { auto _current_kokkosp_lib = tim::get_env("KOKKOS_PROFILE_LIBRARY"); - if(_current_kokkosp_lib.find("libomnitrace-dl.so") == std::string::npos && - _current_kokkosp_lib.find("libomnitrace.so") == std::string::npos) + if(_current_kokkosp_lib.find("librocprof-sys-dl.so") == std::string::npos && + _current_kokkosp_lib.find("librocprof-sys.so") == std::string::npos) { auto _force = 0; std::string _message = {}; @@ -1175,8 +1176,8 @@ configure_mode_settings(const std::shared_ptr& _config) JOIN("", " (forced. Previous value: '", _current_kokkosp_lib, "')"); } OMNITRACE_BASIC_VERBOSE_F(1, "Setting KOKKOS_PROFILE_LIBRARY=%s%s\n", - "libomnitrace.so", _message.c_str()); - tim::set_env("KOKKOS_PROFILE_LIBRARY", "libomnitrace.so", _force); + "librocprof-sys.so", _message.c_str()); + tim::set_env("KOKKOS_PROFILE_LIBRARY", "librocprof-sys.so", _force); } } diff --git a/source/lib/core/config.hpp b/source/lib/core/config.hpp index dac62fc3f..89d7e11e0 100644 --- a/source/lib/core/config.hpp +++ b/source/lib/core/config.hpp @@ -278,7 +278,7 @@ get_trace_hsa_api_types(); std::string& get_perfetto_backend(); -// make this visible so omnitrace-avail can call it +// make this visible so rocprof-sys-avail can call it std::string get_perfetto_output_filename(); diff --git a/source/lib/core/containers/CMakeLists.txt b/source/lib/core/containers/CMakeLists.txt index 57a361eaa..1f586cb72 100644 --- a/source/lib/core/containers/CMakeLists.txt +++ b/source/lib/core/containers/CMakeLists.txt @@ -8,4 +8,5 @@ set(containers_headers ${CMAKE_CURRENT_LIST_DIR}/stable_vector.hpp ${CMAKE_CURRENT_LIST_DIR}/static_vector.hpp) -target_sources(omnitrace-core-library PRIVATE ${containers_sources} ${containers_headers}) +target_sources(rocprofsys-core-library PRIVATE ${containers_sources} + ${containers_headers}) diff --git a/source/lib/omnitrace-dl/CMakeLists.txt b/source/lib/omnitrace-dl/CMakeLists.txt index f2f35f76f..43923ba76 100644 --- a/source/lib/omnitrace-dl/CMakeLists.txt +++ b/source/lib/omnitrace-dl/CMakeLists.txt @@ -1,6 +1,6 @@ # ------------------------------------------------------------------------------# # -# omnitrace dl library +# rocprofsys dl library # # ------------------------------------------------------------------------------# @@ -12,39 +12,39 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) find_package(Threads REQUIRED) -add_library(omnitrace-dl-library SHARED) -add_library(omnitrace::omnitrace-dl-library ALIAS omnitrace-dl-library) +add_library(rocprofsys-dl-library SHARED) +add_library(rocprofsys::rocprofsys-dl-library ALIAS rocprofsys-dl-library) target_sources( - omnitrace-dl-library + rocprofsys-dl-library PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/dl.cpp ${CMAKE_CURRENT_SOURCE_DIR}/main.c ${CMAKE_CURRENT_SOURCE_DIR}/dl/dl.hpp) target_include_directories( - omnitrace-dl-library + rocprofsys-dl-library PUBLIC $ $ $ $) target_link_libraries( - omnitrace-dl-library - PUBLIC $ $ - $ + rocprofsys-dl-library + PUBLIC $ $ + $ $) -add_target_cxx_flag_if_avail(omnitrace-dl-library "-ftls-model=global-dynamic") -add_target_cxx_flag_if_avail(omnitrace-dl-library "-g3") +add_target_cxx_flag_if_avail(rocprofsys-dl-library "-ftls-model=global-dynamic") +add_target_cxx_flag_if_avail(rocprofsys-dl-library "-g3") set_target_properties( - omnitrace-dl-library - PROPERTIES OUTPUT_NAME omnitrace-dl + rocprofsys-dl-library + PROPERTIES OUTPUT_NAME rocprof-sys-dl VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} BUILD_RPATH "\$ORIGIN" INSTALL_RPATH "\$ORIGIN") -omnitrace_strip_target(omnitrace-dl-library) +omnitrace_strip_target(rocprofsys-dl-library) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/dl/dl.hpp - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/omnitrace/dl) + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PACKAGE_NAME}/dl) -install(TARGETS omnitrace-dl-library DESTINATION ${CMAKE_INSTALL_LIBDIR}) +install(TARGETS rocprofsys-dl-library DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/source/lib/omnitrace-dl/dl.cpp b/source/lib/omnitrace-dl/dl.cpp index 0181df2d6..014e40121 100644 --- a/source/lib/omnitrace-dl/dl.cpp +++ b/source/lib/omnitrace-dl/dl.cpp @@ -1,1448 +1,1451 @@ -// MIT License -// -// Copyright (c) 2022 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 -// 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. - -#if !defined(OMNITRACE_DL_SOURCE) -# define OMNITRACE_DL_SOURCE 1 -#endif - -#define OMNITRACE_COMMON_LIBRARY_NAME "dl" - -#include - -#define OMNITRACE_COMMON_LIBRARY_LOG_START \ - fprintf(stderr, "%s", ::tim::log::color::info()); -#define OMNITRACE_COMMON_LIBRARY_LOG_END fprintf(stderr, "%s", ::tim::log::color::end()); - -#include "common/defines.h" -#include "common/delimit.hpp" -#include "common/environment.hpp" -#include "common/invoke.hpp" -#include "common/join.hpp" -#include "common/setup.hpp" -#include "dl/dl.hpp" -#include "omnitrace/categories.h" -#include "omnitrace/types.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//--------------------------------------------------------------------------------------// - -#define OMNITRACE_DLSYM(VARNAME, HANDLE, FUNCNAME) \ - if(HANDLE) \ - { \ - *(void**) (&VARNAME) = dlsym(HANDLE, FUNCNAME); \ - if(VARNAME == nullptr && _omnitrace_dl_verbose >= _warn_verbose) \ - { \ - OMNITRACE_COMMON_LIBRARY_LOG_START \ - fprintf(stderr, "[omnitrace][dl][pid=%i]> %s :: %s\n", getpid(), FUNCNAME, \ - dlerror()); \ - OMNITRACE_COMMON_LIBRARY_LOG_END \ - } \ - else if(_omnitrace_dl_verbose > _info_verbose) \ - { \ - OMNITRACE_COMMON_LIBRARY_LOG_START \ - fprintf(stderr, "[omnitrace][dl][pid=%i]> %s :: success\n", getpid(), \ - FUNCNAME); \ - OMNITRACE_COMMON_LIBRARY_LOG_END \ - } \ - } - -//--------------------------------------------------------------------------------------// - -using main_func_t = int (*)(int, char**, char**); - -std::ostream& -operator<<(std::ostream& _os, const SpaceHandle& _handle) -{ - _os << _handle.name; - return _os; -} - -namespace omnitrace -{ -namespace dl -{ -namespace -{ -inline int -get_omnitrace_env() -{ - auto&& _debug = get_env("OMNITRACE_DEBUG", false); - return get_env("OMNITRACE_VERBOSE", (_debug) ? 100 : 0); -} - -inline int -get_omnitrace_dl_env() -{ - return get_env("OMNITRACE_DL_DEBUG", false) - ? 100 - : get_env("OMNITRACE_DL_VERBOSE", get_omnitrace_env()); -} - -inline bool& -get_omnitrace_is_preloaded() -{ - static bool _v = []() { - auto&& _preload_libs = get_env("LD_PRELOAD", std::string{}); - return (_preload_libs.find("libomnitrace-dl.so") != std::string::npos); - }(); - return _v; -} - -inline bool -get_omnitrace_preload() -{ - static bool _v = []() { - auto&& _preload = get_env("OMNITRACE_PRELOAD", true); - auto&& _preload_libs = get_env("LD_PRELOAD", std::string{}); - return (_preload && - _preload_libs.find("libomnitrace-dl.so") != std::string::npos); - }(); - return _v; -} - -inline void -reset_omnitrace_preload() -{ - auto&& _preload_libs = get_env("LD_PRELOAD", std::string{}); - if(_preload_libs.find("libomnitrace-dl.so") != std::string::npos) - { - (void) get_omnitrace_is_preloaded(); - (void) get_omnitrace_preload(); - auto _modified_preload = std::string{}; - for(const auto& itr : delimit(_preload_libs, ":")) - { - if(itr.find("libomnitrace") != std::string::npos) continue; - _modified_preload += common::join("", ":", itr); - } - if(!_modified_preload.empty() && _modified_preload.find(':') == 0) - _modified_preload = _modified_preload.substr(1); - - setenv("LD_PRELOAD", _modified_preload.c_str(), 1); - } -} - -inline pid_t -get_omnitrace_root_pid() -{ - auto _pid = getpid(); - setenv("OMNITRACE_ROOT_PROCESS", std::to_string(_pid).c_str(), 0); - return get_env("OMNITRACE_ROOT_PROCESS", _pid); -} - -void -omnitrace_preinit() OMNITRACE_INTERNAL_API; - -void -omnitrace_postinit(std::string exe = {}) OMNITRACE_INTERNAL_API; - -pid_t _omnitrace_root_pid = get_omnitrace_root_pid(); - -// environment priority: -// - OMNITRACE_DL_DEBUG -// - OMNITRACE_DL_VERBOSE -// - OMNITRACE_DEBUG -// - OMNITRACE_VERBOSE -int _omnitrace_dl_verbose = get_omnitrace_dl_env(); - -// The docs for dlopen suggest that the combination of RTLD_LOCAL + RTLD_DEEPBIND -// (when available) helps ensure that the symbols in the instrumentation library -// libomnitrace.so will use it's own symbols... not symbols that are potentially -// instrumented. However, this only applies to the symbols in libomnitrace.so, -// which is NOT self-contained, i.e. symbols in timemory and the libs it links to -// (such as libpapi.so) are not protected by the deep-bind option. Additionally, -// it should be noted that DynInst does *NOT* add instrumentation by manipulating the -// dynamic linker (otherwise it would only be limited to shared libs) -- it manipulates -// the instructions in the binary so that a call to a function such as "main" actually -// calls "main_dyninst", which executes the instrumentation snippets around the actual -// "main" (this is the reason you need the dyninstAPI_RT library). -// -// UPDATE: -// Use of RTLD_DEEPBIND has been removed because it causes the dyninst -// ProcControlAPI to segfault within pthread_cond_wait on certain executables. -// -// Here are the docs on the dlopen options used: -// -// RTLD_LAZY -// Perform lazy binding. Only resolve symbols as the code that references them is -// executed. If the symbol is never referenced, then it is never resolved. (Lazy -// binding is only performed for function references; references to variables are -// always immediately bound when the library is loaded.) -// -// RTLD_LOCAL -// This is the converse of RTLD_GLOBAL, and the default if neither flag is specified. -// Symbols defined in this library are not made available to resolve references in -// subsequently loaded libraries. -// -// RTLD_DEEPBIND (since glibc 2.3.4) -// Place the lookup scope of the symbols in this library ahead of the global scope. -// This means that a self-contained library will use its own symbols in preference to -// global symbols with the same name contained in libraries that have already been -// loaded. This flag is not specified in POSIX.1-2001. -// -#if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 4 -auto _omnitrace_dl_dlopen_flags = RTLD_LAZY | RTLD_LOCAL; -const char* _omnitrace_dl_dlopen_descr = "RTLD_LAZY | RTLD_LOCAL"; -#else -auto _omnitrace_dl_dlopen_flags = RTLD_LAZY | RTLD_LOCAL; -const char* _omnitrace_dl_dlopen_descr = "RTLD_LAZY | RTLD_LOCAL"; -#endif - -/// This class contains function pointers for omnitrace's instrumentation functions -struct OMNITRACE_INTERNAL_API indirect -{ - OMNITRACE_INLINE indirect(const std::string& _omnilib, const std::string& _userlib, - const std::string& _dllib) - : m_omnilib{ common::path::find_path(_omnilib, _omnitrace_dl_verbose) } - , m_dllib{ common::path::find_path(_dllib, _omnitrace_dl_verbose) } - , m_userlib{ common::path::find_path(_userlib, _omnitrace_dl_verbose) } - { - if(_omnitrace_dl_verbose >= 1) - { - OMNITRACE_COMMON_LIBRARY_LOG_START - fprintf(stderr, "[omnitrace][dl][pid=%i] %s resolved to '%s'\n", getpid(), - ::basename(_omnilib.c_str()), m_omnilib.c_str()); - fprintf(stderr, "[omnitrace][dl][pid=%i] %s resolved to '%s'\n", getpid(), - ::basename(_dllib.c_str()), m_dllib.c_str()); - fprintf(stderr, "[omnitrace][dl][pid=%i] %s resolved to '%s'\n", getpid(), - ::basename(_userlib.c_str()), m_userlib.c_str()); - OMNITRACE_COMMON_LIBRARY_LOG_END - } - - auto _search_paths = common::join(':', common::path::dirname(_omnilib), - common::path::dirname(_dllib)); - common::setup_environ(_omnitrace_dl_verbose, _search_paths, _omnilib, _dllib); - - m_omnihandle = open(m_omnilib); - m_userhandle = open(m_userlib); - init(); - } - - OMNITRACE_INLINE ~indirect() { dlclose(m_omnihandle); } - - static OMNITRACE_INLINE void* open(const std::string& _lib) - { - auto* libhandle = dlopen(_lib.c_str(), _omnitrace_dl_dlopen_flags); - - if(libhandle) - { - if(_omnitrace_dl_verbose >= 2) - { - OMNITRACE_COMMON_LIBRARY_LOG_START - fprintf(stderr, "[omnitrace][dl][pid=%i] dlopen(\"%s\", %s) :: success\n", - getpid(), _lib.c_str(), _omnitrace_dl_dlopen_descr); - OMNITRACE_COMMON_LIBRARY_LOG_END - } - } - else - { - if(_omnitrace_dl_verbose >= 0) - { - perror("dlopen"); - OMNITRACE_COMMON_LIBRARY_LOG_START - fprintf(stderr, "[omnitrace][dl][pid=%i] dlopen(\"%s\", %s) :: %s\n", - getpid(), _lib.c_str(), _omnitrace_dl_dlopen_descr, dlerror()); - OMNITRACE_COMMON_LIBRARY_LOG_END - } - } - - dlerror(); // Clear any existing error - - return libhandle; - } - - OMNITRACE_INLINE void init() - { - if(!m_omnihandle) m_omnihandle = open(m_omnilib); - - int _warn_verbose = 0; - int _info_verbose = 2; - // Initialize all pointers - OMNITRACE_DLSYM(omnitrace_init_library_f, m_omnihandle, "omnitrace_init_library"); - OMNITRACE_DLSYM(omnitrace_init_tooling_f, m_omnihandle, "omnitrace_init_tooling"); - OMNITRACE_DLSYM(omnitrace_init_f, m_omnihandle, "omnitrace_init"); - OMNITRACE_DLSYM(omnitrace_finalize_f, m_omnihandle, "omnitrace_finalize"); - OMNITRACE_DLSYM(omnitrace_set_env_f, m_omnihandle, "omnitrace_set_env"); - OMNITRACE_DLSYM(omnitrace_set_mpi_f, m_omnihandle, "omnitrace_set_mpi"); - OMNITRACE_DLSYM(omnitrace_push_trace_f, m_omnihandle, "omnitrace_push_trace"); - OMNITRACE_DLSYM(omnitrace_pop_trace_f, m_omnihandle, "omnitrace_pop_trace"); - OMNITRACE_DLSYM(omnitrace_push_region_f, m_omnihandle, "omnitrace_push_region"); - OMNITRACE_DLSYM(omnitrace_pop_region_f, m_omnihandle, "omnitrace_pop_region"); - OMNITRACE_DLSYM(omnitrace_push_category_region_f, m_omnihandle, - "omnitrace_push_category_region"); - OMNITRACE_DLSYM(omnitrace_pop_category_region_f, m_omnihandle, - "omnitrace_pop_category_region"); - OMNITRACE_DLSYM(omnitrace_register_source_f, m_omnihandle, - "omnitrace_register_source"); - OMNITRACE_DLSYM(omnitrace_register_coverage_f, m_omnihandle, - "omnitrace_register_coverage"); - OMNITRACE_DLSYM(omnitrace_progress_f, m_omnihandle, "omnitrace_progress"); - OMNITRACE_DLSYM(omnitrace_annotated_progress_f, m_omnihandle, - "omnitrace_annotated_progress"); - - OMNITRACE_DLSYM(kokkosp_print_help_f, m_omnihandle, "kokkosp_print_help"); - OMNITRACE_DLSYM(kokkosp_parse_args_f, m_omnihandle, "kokkosp_parse_args"); - OMNITRACE_DLSYM(kokkosp_declare_metadata_f, m_omnihandle, - "kokkosp_declare_metadata"); - OMNITRACE_DLSYM(kokkosp_request_tool_settings_f, m_omnihandle, - "kokkosp_request_tool_settings"); - OMNITRACE_DLSYM(kokkosp_init_library_f, m_omnihandle, "kokkosp_init_library"); - OMNITRACE_DLSYM(kokkosp_finalize_library_f, m_omnihandle, - "kokkosp_finalize_library"); - OMNITRACE_DLSYM(kokkosp_begin_parallel_for_f, m_omnihandle, - "kokkosp_begin_parallel_for"); - OMNITRACE_DLSYM(kokkosp_end_parallel_for_f, m_omnihandle, - "kokkosp_end_parallel_for"); - OMNITRACE_DLSYM(kokkosp_begin_parallel_reduce_f, m_omnihandle, - "kokkosp_begin_parallel_reduce"); - OMNITRACE_DLSYM(kokkosp_end_parallel_reduce_f, m_omnihandle, - "kokkosp_end_parallel_reduce"); - OMNITRACE_DLSYM(kokkosp_begin_parallel_scan_f, m_omnihandle, - "kokkosp_begin_parallel_scan"); - OMNITRACE_DLSYM(kokkosp_end_parallel_scan_f, m_omnihandle, - "kokkosp_end_parallel_scan"); - OMNITRACE_DLSYM(kokkosp_begin_fence_f, m_omnihandle, "kokkosp_begin_fence"); - OMNITRACE_DLSYM(kokkosp_end_fence_f, m_omnihandle, "kokkosp_end_fence"); - OMNITRACE_DLSYM(kokkosp_push_profile_region_f, m_omnihandle, - "kokkosp_push_profile_region"); - OMNITRACE_DLSYM(kokkosp_pop_profile_region_f, m_omnihandle, - "kokkosp_pop_profile_region"); - OMNITRACE_DLSYM(kokkosp_create_profile_section_f, m_omnihandle, - "kokkosp_create_profile_section"); - OMNITRACE_DLSYM(kokkosp_destroy_profile_section_f, m_omnihandle, - "kokkosp_destroy_profile_section"); - OMNITRACE_DLSYM(kokkosp_start_profile_section_f, m_omnihandle, - "kokkosp_start_profile_section"); - OMNITRACE_DLSYM(kokkosp_stop_profile_section_f, m_omnihandle, - "kokkosp_stop_profile_section"); - OMNITRACE_DLSYM(kokkosp_allocate_data_f, m_omnihandle, "kokkosp_allocate_data"); - OMNITRACE_DLSYM(kokkosp_deallocate_data_f, m_omnihandle, - "kokkosp_deallocate_data"); - OMNITRACE_DLSYM(kokkosp_begin_deep_copy_f, m_omnihandle, - "kokkosp_begin_deep_copy"); - OMNITRACE_DLSYM(kokkosp_end_deep_copy_f, m_omnihandle, "kokkosp_end_deep_copy"); - OMNITRACE_DLSYM(kokkosp_profile_event_f, m_omnihandle, "kokkosp_profile_event"); - OMNITRACE_DLSYM(kokkosp_dual_view_sync_f, m_omnihandle, "kokkosp_dual_view_sync"); - OMNITRACE_DLSYM(kokkosp_dual_view_modify_f, m_omnihandle, - "kokkosp_dual_view_modify"); - -#if OMNITRACE_USE_ROCTRACER > 0 - OMNITRACE_DLSYM(hsa_on_load_f, m_omnihandle, "OnLoad"); - OMNITRACE_DLSYM(hsa_on_unload_f, m_omnihandle, "OnUnload"); -#endif - -#if OMNITRACE_USE_ROCPROFILER > 0 - OMNITRACE_DLSYM(rocp_on_load_tool_prop_f, m_omnihandle, "OnLoadToolProp"); - OMNITRACE_DLSYM(rocp_on_unload_tool_f, m_omnihandle, "OnUnloadTool"); -#endif - -#if OMNITRACE_USE_OMPT == 0 - _warn_verbose = 5; -#else - OMNITRACE_DLSYM(ompt_start_tool_f, m_omnihandle, "ompt_start_tool"); -#endif - - if(!m_userhandle) m_userhandle = open(m_userlib); - _warn_verbose = 0; - OMNITRACE_DLSYM(omnitrace_user_configure_f, m_userhandle, - "omnitrace_user_configure"); - - if(omnitrace_user_configure_f) - { - omnitrace_user_callbacks_t _cb = {}; - _cb.start_trace = &omnitrace_user_start_trace_dl; - _cb.stop_trace = &omnitrace_user_stop_trace_dl; - _cb.start_thread_trace = &omnitrace_user_start_thread_trace_dl; - _cb.stop_thread_trace = &omnitrace_user_stop_thread_trace_dl; - _cb.push_region = &omnitrace_user_push_region_dl; - _cb.pop_region = &omnitrace_user_pop_region_dl; - _cb.progress = &omnitrace_user_progress_dl; - _cb.push_annotated_region = &omnitrace_user_push_annotated_region_dl; - _cb.pop_annotated_region = &omnitrace_user_pop_annotated_region_dl; - _cb.annotated_progress = &omnitrace_user_annotated_progress_dl; - (*omnitrace_user_configure_f)(OMNITRACE_USER_REPLACE_CONFIG, _cb, nullptr); - } - } - -public: - using user_cb_t = omnitrace_user_callbacks_t; - - // libomnitrace functions - void (*omnitrace_init_library_f)(void) = nullptr; - void (*omnitrace_init_tooling_f)(void) = nullptr; - void (*omnitrace_init_f)(const char*, bool, const char*) = nullptr; - void (*omnitrace_finalize_f)(void) = nullptr; - void (*omnitrace_set_env_f)(const char*, const char*) = nullptr; - void (*omnitrace_set_mpi_f)(bool, bool) = nullptr; - void (*omnitrace_register_source_f)(const char*, const char*, size_t, size_t, - const char*) = nullptr; - void (*omnitrace_register_coverage_f)(const char*, const char*, size_t) = nullptr; - void (*omnitrace_push_trace_f)(const char*) = nullptr; - void (*omnitrace_pop_trace_f)(const char*) = nullptr; - int (*omnitrace_push_region_f)(const char*) = nullptr; - int (*omnitrace_pop_region_f)(const char*) = nullptr; - int (*omnitrace_push_category_region_f)(omnitrace_category_t, const char*, - omnitrace_annotation_t*, size_t) = nullptr; - int (*omnitrace_pop_category_region_f)(omnitrace_category_t, const char*, - omnitrace_annotation_t*, size_t) = nullptr; - void (*omnitrace_progress_f)(const char*) = nullptr; - void (*omnitrace_annotated_progress_f)(const char*, omnitrace_annotation_t*, - size_t) = nullptr; - - // libomnitrace-user functions - int (*omnitrace_user_configure_f)(int, user_cb_t, user_cb_t*) = nullptr; - - // KokkosP functions - void (*kokkosp_print_help_f)(char*) = nullptr; - void (*kokkosp_parse_args_f)(int, char**) = nullptr; - void (*kokkosp_declare_metadata_f)(const char*, const char*) = nullptr; - void (*kokkosp_request_tool_settings_f)(const uint32_t, - Kokkos_Tools_ToolSettings*) = nullptr; - void (*kokkosp_init_library_f)(const int, const uint64_t, const uint32_t, - void*) = nullptr; - void (*kokkosp_finalize_library_f)() = nullptr; - void (*kokkosp_begin_parallel_for_f)(const char*, uint32_t, uint64_t*) = nullptr; - void (*kokkosp_end_parallel_for_f)(uint64_t) = nullptr; - void (*kokkosp_begin_parallel_reduce_f)(const char*, uint32_t, uint64_t*) = nullptr; - void (*kokkosp_end_parallel_reduce_f)(uint64_t) = nullptr; - void (*kokkosp_begin_parallel_scan_f)(const char*, uint32_t, uint64_t*) = nullptr; - void (*kokkosp_end_parallel_scan_f)(uint64_t) = nullptr; - void (*kokkosp_begin_fence_f)(const char*, uint32_t, uint64_t*) = nullptr; - void (*kokkosp_end_fence_f)(uint64_t) = nullptr; - void (*kokkosp_push_profile_region_f)(const char*) = nullptr; - void (*kokkosp_pop_profile_region_f)() = nullptr; - void (*kokkosp_create_profile_section_f)(const char*, uint32_t*) = nullptr; - void (*kokkosp_destroy_profile_section_f)(uint32_t) = nullptr; - void (*kokkosp_start_profile_section_f)(uint32_t) = nullptr; - void (*kokkosp_stop_profile_section_f)(uint32_t) = nullptr; - void (*kokkosp_allocate_data_f)(const SpaceHandle, const char*, const void* const, - const uint64_t) = nullptr; - void (*kokkosp_deallocate_data_f)(const SpaceHandle, const char*, const void* const, - const uint64_t) = nullptr; - void (*kokkosp_begin_deep_copy_f)(SpaceHandle, const char*, const void*, SpaceHandle, - const char*, const void*, uint64_t) = nullptr; - void (*kokkosp_end_deep_copy_f)() = nullptr; - void (*kokkosp_profile_event_f)(const char*) = nullptr; - void (*kokkosp_dual_view_sync_f)(const char*, const void* const, bool) = nullptr; - void (*kokkosp_dual_view_modify_f)(const char*, const void* const, bool) = nullptr; - - // HSA functions -#if OMNITRACE_USE_ROCTRACER > 0 - bool (*hsa_on_load_f)(HsaApiTable*, uint64_t, uint64_t, const char* const*) = nullptr; - void (*hsa_on_unload_f)() = nullptr; -#endif - - // ROCP functions -#if OMNITRACE_USE_ROCPROFILER > 0 - void (*rocp_on_load_tool_prop_f)(void* settings) = nullptr; - void (*rocp_on_unload_tool_f)() = nullptr; -#endif - - // OpenMP functions -#if defined(OMNITRACE_USE_OMPT) && OMNITRACE_USE_OMPT > 0 - ompt_start_tool_result_t* (*ompt_start_tool_f)(unsigned int, const char*); -#endif - - auto get_omni_library() const { return m_omnilib; } - auto get_user_library() const { return m_userlib; } - auto get_dl_library() const { return m_dllib; } - -private: - void* m_omnihandle = nullptr; - void* m_userhandle = nullptr; - std::string m_omnilib = {}; - std::string m_dllib = {}; - std::string m_userlib = {}; -}; - -inline indirect& -get_indirect() OMNITRACE_INTERNAL_API; - -indirect& -get_indirect() -{ - omnitrace_preinit_library(); - - static auto _libomni = get_env("OMNITRACE_LIBRARY", "libomnitrace.so"); - static auto _libuser = get_env("OMNITRACE_USER_LIBRARY", "libomnitrace-user.so"); - static auto _libdlib = get_env("OMNITRACE_DL_LIBRARY", "libomnitrace-dl.so"); - static auto* _v = new indirect{ _libomni, _libuser, _libdlib }; - return *_v; -} - -auto& -get_inited() -{ - static bool* _v = new bool{ false }; - return *_v; -} - -auto& -get_finied() -{ - static bool* _v = new bool{ false }; - return *_v; -} - -auto& -get_active() -{ - static bool* _v = new bool{ false }; - return *_v; -} - -auto& -get_enabled() -{ - static auto* _v = new std::atomic{ get_env("OMNITRACE_INIT_ENABLED", true) }; - return *_v; -} - -auto& -get_thread_enabled() -{ - static thread_local bool _v = get_enabled(); - return _v; -} - -auto& -get_thread_count() -{ - static thread_local int64_t _v = 0; - return _v; -} - -auto& -get_thread_status() -{ - static thread_local bool _v = false; - return _v; -} - -InstrumentMode& -get_instrumented() -{ - static auto _v = get_env("OMNITRACE_INSTRUMENT_MODE", InstrumentMode::None); - return _v; -} - -// ensure finalization is called -bool _omnitrace_dl_fini = (std::atexit([]() { - if(get_active()) omnitrace_finalize(); - }), - true); -} // namespace -} // namespace dl -} // namespace omnitrace - -//--------------------------------------------------------------------------------------// - -#define OMNITRACE_DL_INVOKE(...) \ - ::omnitrace::common::invoke(__FUNCTION__, ::omnitrace::dl::_omnitrace_dl_verbose, \ - (::omnitrace::dl::get_thread_status() = false), \ - __VA_ARGS__) - -#define OMNITRACE_DL_IGNORE(...) \ - ::omnitrace::common::ignore(__FUNCTION__, ::omnitrace::dl::_omnitrace_dl_verbose, \ - __VA_ARGS__) - -#define OMNITRACE_DL_INVOKE_STATUS(STATUS, ...) \ - ::omnitrace::common::invoke(__FUNCTION__, ::omnitrace::dl::_omnitrace_dl_verbose, \ - STATUS, __VA_ARGS__) - -#define OMNITRACE_DL_LOG(LEVEL, ...) \ - if(::omnitrace::dl::_omnitrace_dl_verbose >= LEVEL) \ - { \ - fflush(stderr); \ - OMNITRACE_COMMON_LIBRARY_LOG_START \ - fprintf(stderr, "[omnitrace][" OMNITRACE_COMMON_LIBRARY_NAME "][%i] ", \ - getpid()); \ - fprintf(stderr, __VA_ARGS__); \ - OMNITRACE_COMMON_LIBRARY_LOG_END \ - fflush(stderr); \ - } - -using omnitrace::dl::get_indirect; -namespace dl = omnitrace::dl; - -extern "C" -{ - void omnitrace_preinit_library(void) - { - if(omnitrace::common::get_env("OMNITRACE_MONOCHROME", tim::log::monochrome())) - tim::log::monochrome() = true; - } - - int omnitrace_preload_library(void) - { - return (::omnitrace::dl::get_omnitrace_preload()) ? 1 : 0; - } - - void omnitrace_init_library(void) - { - OMNITRACE_DL_INVOKE(get_indirect().omnitrace_init_library_f); - } - - void omnitrace_init_tooling(void) - { - OMNITRACE_DL_INVOKE(get_indirect().omnitrace_init_tooling_f); - } - - void omnitrace_init(const char* a, bool b, const char* c) - { - if(dl::get_inited() && dl::get_finied()) - { - OMNITRACE_DL_LOG( - 2, "%s(%s) ignored :: already initialized and finalized\n", __FUNCTION__, - ::omnitrace::join(::omnitrace::QuoteStrings{}, ", ", a, b, c).c_str()); - return; - } - else if(dl::get_inited() && dl::get_active()) - { - OMNITRACE_DL_LOG( - 2, "%s(%s) ignored :: already initialized and active\n", __FUNCTION__, - ::omnitrace::join(::omnitrace::QuoteStrings{}, ", ", a, b, c).c_str()); - return; - } - - if(dl::get_instrumented() < dl::InstrumentMode::PythonProfile) - dl::omnitrace_preinit(); - - bool _invoked = false; - OMNITRACE_DL_INVOKE_STATUS(_invoked, get_indirect().omnitrace_init_f, a, b, c); - if(_invoked) - { - dl::get_active() = true; - dl::get_inited() = true; - dl::_omnitrace_dl_verbose = dl::get_omnitrace_dl_env(); - if(dl::get_instrumented() < dl::InstrumentMode::PythonProfile) - dl::omnitrace_postinit((c) ? std::string{ c } : std::string{}); - } - } - - void omnitrace_finalize(void) - { - if(dl::get_inited() && dl::get_finied()) - { - OMNITRACE_DL_LOG(2, "%s() ignored :: already initialized and finalized\n", - __FUNCTION__); - return; - } - else if(dl::get_finied() && !dl::get_active()) - { - OMNITRACE_DL_LOG(2, "%s() ignored :: already finalized but not active\n", - __FUNCTION__); - return; - } - - bool _invoked = false; - OMNITRACE_DL_INVOKE_STATUS(_invoked, get_indirect().omnitrace_finalize_f); - if(_invoked) - { - dl::get_active() = false; - dl::get_finied() = true; - } - } - - void omnitrace_push_trace(const char* name) - { - if(!dl::get_active()) return; - if(dl::get_thread_enabled()) - { - OMNITRACE_DL_INVOKE(get_indirect().omnitrace_push_trace_f, name); - } - else - { - ++dl::get_thread_count(); - } - } - - void omnitrace_pop_trace(const char* name) - { - if(!dl::get_active()) return; - if(dl::get_thread_enabled()) - { - OMNITRACE_DL_INVOKE(get_indirect().omnitrace_pop_trace_f, name); - } - else - { - if(dl::get_thread_count()-- == 0) omnitrace_user_start_thread_trace_dl(); - } - } - - int omnitrace_push_region(const char* name) - { - if(!dl::get_active()) return 0; - if(dl::get_thread_enabled()) - { - return OMNITRACE_DL_INVOKE(get_indirect().omnitrace_push_region_f, name); - } - else - { - ++dl::get_thread_count(); - } - return 0; - } - - int omnitrace_pop_region(const char* name) - { - if(!dl::get_active()) return 0; - if(dl::get_thread_enabled()) - { - return OMNITRACE_DL_INVOKE(get_indirect().omnitrace_pop_region_f, name); - } - else - { - if(dl::get_thread_count()-- == 0) omnitrace_user_start_thread_trace_dl(); - } - return 0; - } - - int omnitrace_push_category_region(omnitrace_category_t _category, const char* name, - omnitrace_annotation_t* _annotations, - size_t _annotation_count) - { - if(!dl::get_active()) return 0; - if(dl::get_thread_enabled()) - { - return OMNITRACE_DL_INVOKE(get_indirect().omnitrace_push_category_region_f, - _category, name, _annotations, _annotation_count); - } - else - { - ++dl::get_thread_count(); - } - return 0; - } - - int omnitrace_pop_category_region(omnitrace_category_t _category, const char* name, - omnitrace_annotation_t* _annotations, - size_t _annotation_count) - { - if(!dl::get_active()) return 0; - if(dl::get_thread_enabled()) - { - return OMNITRACE_DL_INVOKE(get_indirect().omnitrace_pop_category_region_f, - _category, name, _annotations, _annotation_count); - } - else - { - ++dl::get_thread_count(); - } - return 0; - } - - void omnitrace_set_env(const char* a, const char* b) - { - if(dl::get_inited() && dl::get_active()) - { - OMNITRACE_DL_IGNORE(2, "already initialized and active", a, b); - return; - } - OMNITRACE_DL_LOG(2, "%s(%s, %s)\n", __FUNCTION__, a, b); - setenv(a, b, 0); - // OMNITRACE_DL_INVOKE(get_indirect().omnitrace_set_env_f, a, b); - } - - void omnitrace_set_mpi(bool a, bool b) - { - if(dl::get_inited() && dl::get_active()) - { - OMNITRACE_DL_IGNORE(2, "already initialized and active", a, b); - return; - } - OMNITRACE_DL_INVOKE(get_indirect().omnitrace_set_mpi_f, a, b); - } - - void omnitrace_register_source(const char* file, const char* func, size_t line, - size_t address, const char* source) - { - OMNITRACE_DL_LOG(3, "%s(\"%s\", \"%s\", %zu, %zu, \"%s\")\n", __FUNCTION__, file, - func, line, address, source); - OMNITRACE_DL_INVOKE(get_indirect().omnitrace_register_source_f, file, func, line, - address, source); - } - - void omnitrace_register_coverage(const char* file, const char* func, size_t address) - { - OMNITRACE_DL_INVOKE(get_indirect().omnitrace_register_coverage_f, file, func, - address); - } - - int omnitrace_user_start_trace_dl(void) - { - dl::get_enabled().store(true); - return omnitrace_user_start_thread_trace_dl(); - } - - int omnitrace_user_stop_trace_dl(void) - { - dl::get_enabled().store(false); - return omnitrace_user_stop_thread_trace_dl(); - } - - int omnitrace_user_start_thread_trace_dl(void) - { - dl::get_thread_enabled() = true; - return 0; - } - - int omnitrace_user_stop_thread_trace_dl(void) - { - dl::get_thread_enabled() = false; - return 0; - } - - int omnitrace_user_push_region_dl(const char* name) - { - if(!dl::get_active()) return 0; - return OMNITRACE_DL_INVOKE(get_indirect().omnitrace_push_region_f, name); - } - - int omnitrace_user_pop_region_dl(const char* name) - { - if(!dl::get_active()) return 0; - return OMNITRACE_DL_INVOKE(get_indirect().omnitrace_pop_region_f, name); - } - - int omnitrace_user_progress_dl(const char* name) - { - OMNITRACE_DL_INVOKE(get_indirect().omnitrace_progress_f, name); - return 0; - } - - int omnitrace_user_push_annotated_region_dl(const char* name, - omnitrace_annotation_t* _annotations, - size_t _annotation_count) - { - if(!dl::get_active()) return 0; - return OMNITRACE_DL_INVOKE(get_indirect().omnitrace_push_category_region_f, - OMNITRACE_CATEGORY_USER, name, _annotations, - _annotation_count); - } - - int omnitrace_user_pop_annotated_region_dl(const char* name, - omnitrace_annotation_t* _annotations, - size_t _annotation_count) - { - if(!dl::get_active()) return 0; - return OMNITRACE_DL_INVOKE(get_indirect().omnitrace_pop_category_region_f, - OMNITRACE_CATEGORY_USER, name, _annotations, - _annotation_count); - } - - int omnitrace_user_annotated_progress_dl(const char* name, - omnitrace_annotation_t* _annotations, - size_t _annotation_count) - { - OMNITRACE_DL_INVOKE(get_indirect().omnitrace_annotated_progress_f, name, - _annotations, _annotation_count); - return 0; - } - - void omnitrace_progress(const char* _name) - { - return OMNITRACE_DL_INVOKE(get_indirect().omnitrace_progress_f, _name); - } - - void omnitrace_annotated_progress(const char* _name, - omnitrace_annotation_t* _annotations, - size_t _annotation_count) - { - return OMNITRACE_DL_INVOKE(get_indirect().omnitrace_annotated_progress_f, _name, - _annotations, _annotation_count); - } - - void omnitrace_set_instrumented(int _mode) - { - OMNITRACE_DL_LOG(2, "%s(%i)\n", __FUNCTION__, _mode); - auto _mode_v = static_cast(_mode); - if(_mode_v < dl::InstrumentMode::None || _mode_v >= dl::InstrumentMode::Last) - { - OMNITRACE_DL_LOG(-127, - "%s(mode=%i) invoked with invalid instrumentation mode. " - "mode should be %i >= mode < %i\n", - __FUNCTION__, _mode, - static_cast(dl::InstrumentMode::None), - static_cast(dl::InstrumentMode::Last)); - } - dl::get_instrumented() = _mode_v; - } - - //----------------------------------------------------------------------------------// - // - // KokkosP - // - //----------------------------------------------------------------------------------// - - void kokkosp_print_help(char* argv0) - { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_print_help_f, argv0); - } - - void kokkosp_parse_args(int argc, char** argv) - { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_parse_args_f, argc, argv); - } - - void kokkosp_declare_metadata(const char* key, const char* value) - { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_declare_metadata_f, key, value); - } - - void kokkosp_request_tool_settings(const uint32_t version, - Kokkos_Tools_ToolSettings* settings) - { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_request_tool_settings_f, - version, settings); - } - - void kokkosp_init_library(const int loadSeq, const uint64_t interfaceVer, - const uint32_t devInfoCount, void* deviceInfo) - { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_init_library_f, loadSeq, - interfaceVer, devInfoCount, deviceInfo); - } - - void kokkosp_finalize_library() - { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_finalize_library_f); - } - - void kokkosp_begin_parallel_for(const char* name, uint32_t devid, uint64_t* kernid) - { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_begin_parallel_for_f, name, - devid, kernid); - } - - void kokkosp_end_parallel_for(uint64_t kernid) - { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_end_parallel_for_f, kernid); - } - - void kokkosp_begin_parallel_reduce(const char* name, uint32_t devid, uint64_t* kernid) - { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_begin_parallel_reduce_f, name, - devid, kernid); - } - - void kokkosp_end_parallel_reduce(uint64_t kernid) - { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_end_parallel_reduce_f, kernid); - } - - void kokkosp_begin_parallel_scan(const char* name, uint32_t devid, uint64_t* kernid) - { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_begin_parallel_scan_f, name, - devid, kernid); - } - - void kokkosp_end_parallel_scan(uint64_t kernid) - { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_end_parallel_scan_f, kernid); - } - - void kokkosp_begin_fence(const char* name, uint32_t devid, uint64_t* kernid) - { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_begin_fence_f, name, devid, - kernid); - } - - void kokkosp_end_fence(uint64_t kernid) - { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_end_fence_f, kernid); - } - - void kokkosp_push_profile_region(const char* name) - { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_push_profile_region_f, name); - } - - void kokkosp_pop_profile_region() - { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_pop_profile_region_f); - } - - void kokkosp_create_profile_section(const char* name, uint32_t* secid) - { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_create_profile_section_f, name, - secid); - } - - void kokkosp_destroy_profile_section(uint32_t secid) - { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_destroy_profile_section_f, - secid); - } - - void kokkosp_start_profile_section(uint32_t secid) - { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_start_profile_section_f, secid); - } - - void kokkosp_stop_profile_section(uint32_t secid) - { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_stop_profile_section_f, secid); - } - - void kokkosp_allocate_data(const SpaceHandle space, const char* label, - const void* const ptr, const uint64_t size) - { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_allocate_data_f, space, label, - ptr, size); - } - - void kokkosp_deallocate_data(const SpaceHandle space, const char* label, - const void* const ptr, const uint64_t size) - { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_deallocate_data_f, space, label, - ptr, size); - } - - void kokkosp_begin_deep_copy(SpaceHandle dst_handle, const char* dst_name, - const void* dst_ptr, SpaceHandle src_handle, - const char* src_name, const void* src_ptr, uint64_t size) - { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_begin_deep_copy_f, dst_handle, - dst_name, dst_ptr, src_handle, src_name, src_ptr, - size); - } - - void kokkosp_end_deep_copy() - { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_end_deep_copy_f); - } - - void kokkosp_profile_event(const char* name) - { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_profile_event_f, name); - } - - void kokkosp_dual_view_sync(const char* label, const void* const data, bool is_device) - { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_dual_view_sync_f, label, data, - is_device); - } - - void kokkosp_dual_view_modify(const char* label, const void* const data, - bool is_device) - { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_dual_view_modify_f, label, data, - is_device); - } - - //----------------------------------------------------------------------------------// - // - // HSA - // - //----------------------------------------------------------------------------------// - -#if OMNITRACE_USE_ROCTRACER > 0 - bool OnLoad(HsaApiTable* table, uint64_t runtime_version, uint64_t failed_tool_count, - const char* const* failed_tool_names) - { - return OMNITRACE_DL_INVOKE(get_indirect().hsa_on_load_f, table, runtime_version, - failed_tool_count, failed_tool_names); - } - - void OnUnload() { return OMNITRACE_DL_INVOKE(get_indirect().hsa_on_unload_f); } -#endif - - //----------------------------------------------------------------------------------// - // - // ROCP - // - //----------------------------------------------------------------------------------// - -#if OMNITRACE_USE_ROCPROFILER > 0 - void OnLoadToolProp(void* settings) - { - OMNITRACE_DL_LOG(-16, - "invoking %s(rocprofiler_settings_t*) within omnitrace-dl.so " - "will cause a silent failure for rocprofiler. ROCP_TOOL_LIB " - "should be set to libomnitrace.so\n", - __FUNCTION__); - abort(); - return OMNITRACE_DL_INVOKE(get_indirect().rocp_on_load_tool_prop_f, settings); - } - - void OnUnloadTool() - { - return OMNITRACE_DL_INVOKE(get_indirect().rocp_on_unload_tool_f); - } -#endif - - //----------------------------------------------------------------------------------// - // - // OMPT - // - //----------------------------------------------------------------------------------// -#if OMNITRACE_USE_OMPT > 0 - ompt_start_tool_result_t* ompt_start_tool(unsigned int omp_version, - const char* runtime_version) - { - return OMNITRACE_DL_INVOKE(get_indirect().ompt_start_tool_f, omp_version, - runtime_version); - } -#endif -} - -namespace omnitrace -{ -namespace dl -{ -namespace -{ -bool -omnitrace_preload() OMNITRACE_INTERNAL_API; - -std::vector -get_link_map(const char*, - std::vector&& = { (RTLD_LAZY | RTLD_NOLOAD) }) OMNITRACE_INTERNAL_API; - -const char* -get_default_mode() OMNITRACE_INTERNAL_API; - -void -verify_instrumented_preloaded() OMNITRACE_INTERNAL_API; - -std::vector -get_link_map(const char* _name, std::vector&& _open_modes) -{ - void* _handle = nullptr; - bool _noload = false; - for(auto _mode : _open_modes) - { - _handle = dlopen(_name, _mode); - _noload = (_mode & RTLD_NOLOAD) == RTLD_NOLOAD; - if(_handle) break; - } - - auto _chain = std::vector{}; - if(_handle) - { - struct link_map* _link_map = nullptr; - dlinfo(_handle, RTLD_DI_LINKMAP, &_link_map); - struct link_map* _next = _link_map->l_next; - while(_next) - { - if(_next->l_name != nullptr && !std::string_view{ _next->l_name }.empty()) - { - _chain.emplace_back(_next->l_name); - } - _next = _next->l_next; - } - - if(_noload == false) dlclose(_handle); - } - return _chain; -} - -const char* -get_default_mode() -{ - if(get_env("OMNITRACE_USE_CAUSAL", false)) return "causal"; - - auto _link_map = get_link_map(nullptr); - for(const auto& itr : _link_map) - { - if(itr.find("libomnitrace-rt.so") != std::string::npos || - itr.find("libdyninstAPI_RT.so") != std::string::npos) - return "trace"; - } - - return "sampling"; -} - -void -omnitrace_preinit() -{ - switch(get_instrumented()) - { - case InstrumentMode::None: - case InstrumentMode::BinaryRewrite: - case InstrumentMode::ProcessCreate: - case InstrumentMode::ProcessAttach: - { - auto _use_mpip = get_env("OMNITRACE_USE_MPIP", false); - auto _use_mpi = get_env("OMNITRACE_USE_MPI", _use_mpip); - auto _causal = get_env("OMNITRACE_USE_CAUSAL", false); - auto _mode = get_env("OMNITRACE_MODE", get_default_mode()); - - if(_use_mpi && !(_causal && _mode == "causal")) - { - // only make this call if true bc otherwise, if - // false, it will disable the MPIP component and - // we may intercept the MPI init call later. - // If _use_mpi defaults to true above, calling this - // will override can current env or config value for - // OMNITRACE_USE_PID. - omnitrace_set_mpi(_use_mpi, dl::get_instrumented() == - dl::InstrumentMode::ProcessAttach); - } - break; - } - case InstrumentMode::PythonProfile: - case InstrumentMode::Last: break; - } -} - -void -omnitrace_postinit(std::string _exe) -{ - switch(get_instrumented()) - { - case InstrumentMode::None: - case InstrumentMode::BinaryRewrite: - case InstrumentMode::ProcessCreate: - case InstrumentMode::ProcessAttach: - { - if(_exe.empty()) - _exe = tim::filepath::readlink(join('/', "/proc", getpid(), "exe")); - - omnitrace_init_tooling(); - if(_exe.empty()) - omnitrace_push_trace("main"); - else - omnitrace_push_trace(basename(_exe.c_str())); - break; - } - case InstrumentMode::PythonProfile: - { - omnitrace_init_tooling(); - break; - } - case InstrumentMode::Last: break; - } -} - -bool -omnitrace_preload() -{ - auto _preload = get_omnitrace_is_preloaded() && get_omnitrace_preload() && - get_env("OMNITRACE_ENABLED", true); - - auto _link_map = get_link_map(nullptr); - auto _instr_mode = - get_env("OMNITRACE_INSTRUMENT_MODE", dl::InstrumentMode::BinaryRewrite); - for(const auto& itr : _link_map) - { - if(itr.find("libomnitrace-rt.so") != std::string::npos || - itr.find("libdyninstAPI_RT.so") != std::string::npos) - { - omnitrace_set_instrumented(static_cast(_instr_mode)); - break; - } - } - - verify_instrumented_preloaded(); - - static bool _once = false; - if(_once) return _preload; - _once = true; - - if(_preload) - { - reset_omnitrace_preload(); - omnitrace_preinit_library(); - } - - return _preload; -} - -void -verify_instrumented_preloaded() -{ - // if preloaded then we are fine - if(get_omnitrace_is_preloaded()) return; - - // value returned by get_instrumented is set by either: - // - the search of the linked libraries - // - via the instrumenter - // if binary rewrite or runtime instrumentation, there is an opportunity for - // LD_PRELOAD - switch(dl::get_instrumented()) - { - case dl::InstrumentMode::None: - case dl::InstrumentMode::ProcessAttach: - case dl::InstrumentMode::ProcessCreate: - case dl::InstrumentMode::PythonProfile: - { - return; - } - case dl::InstrumentMode::BinaryRewrite: - { - break; - } - case dl::InstrumentMode::Last: - { - throw std::runtime_error( - "Invalid instrumentation type: InstrumentMode::Last"); - } - } - - static const char* _notice = R"notice( - - NNNNNNNN NNNNNNNN OOOOOOOOO TTTTTTTTTTTTTTTTTTTTTTTIIIIIIIIII CCCCCCCCCCCCCEEEEEEEEEEEEEEEEEEEEEE - N:::::::N N::::::N OO:::::::::OO T:::::::::::::::::::::TI::::::::I CCC::::::::::::CE::::::::::::::::::::E - N::::::::N N::::::N OO:::::::::::::OO T:::::::::::::::::::::TI::::::::I CC:::::::::::::::CE::::::::::::::::::::E - N:::::::::N N::::::NO:::::::OOO:::::::OT:::::TT:::::::TT:::::TII::::::IIC:::::CCCCCCCC::::CEE::::::EEEEEEEEE::::E - N::::::::::N N::::::NO::::::O O::::::OTTTTTT T:::::T TTTTTT I::::I C:::::C CCCCCC E:::::E EEEEEE - N:::::::::::N N::::::NO:::::O O:::::O T:::::T I::::IC:::::C E:::::E - N:::::::N::::N N::::::NO:::::O O:::::O T:::::T I::::IC:::::C E::::::EEEEEEEEEE - N::::::N N::::N N::::::NO:::::O O:::::O T:::::T I::::IC:::::C E:::::::::::::::E - N::::::N N::::N:::::::NO:::::O O:::::O T:::::T I::::IC:::::C E:::::::::::::::E - N::::::N N:::::::::::NO:::::O O:::::O T:::::T I::::IC:::::C E::::::EEEEEEEEEE - N::::::N N::::::::::NO:::::O O:::::O T:::::T I::::IC:::::C E:::::E - N::::::N N:::::::::NO::::::O O::::::O T:::::T I::::I C:::::C CCCCCC E:::::E EEEEEE - N::::::N N::::::::NO:::::::OOO:::::::O TT:::::::TT II::::::IIC:::::CCCCCCCC::::CEE::::::EEEEEEEE:::::E - N::::::N N:::::::N OO:::::::::::::OO T:::::::::T I::::::::I CC:::::::::::::::CE::::::::::::::::::::E - N::::::N N::::::N OO:::::::::OO T:::::::::T I::::::::I CCC::::::::::::CE::::::::::::::::::::E - NNNNNNNN NNNNNNN OOOOOOOOO TTTTTTTTTTT IIIIIIIIII CCCCCCCCCCCCCEEEEEEEEEEEEEEEEEEEEEE - - _ _ _____ ______ - | | | |/ ____| ____| - | | | | (___ | |__ - | | | |\___ \| __| - | |__| |____) | |____ - \____/|_____/|______| - - ____ __ __ _ _ _____ _______ _____ _____ ______ _____ _ _ _ _ - / __ \| \/ | \ | |_ _|__ __| __ \ /\ / ____| ____| | __ \| | | | \ | | - | | | | \ / | \| | | | | | | |__) | / \ | | | |__ ______| |__) | | | | \| | - | | | | |\/| | . ` | | | | | | _ / / /\ \| | | __|______| _ /| | | | . ` | - | |__| | | | | |\ |_| |_ | | | | \ \ / ____ \ |____| |____ | | \ \| |__| | |\ | - \____/|_| |_|_| \_|_____| |_| |_| \_\/_/ \_\_____|______| |_| \_\\____/|_| \_| - - - Due to a variety of edge cases we've encountered, OmniTrace now requires that binary rewritten executables and libraries be launched - with the 'omnitrace-run' executable. - - In order to launch the executable with 'omnitrace-run', prefix the current command with 'omnitrace-run' and a standalone double hyphen ('--'). - For MPI applications, place 'omnitrace-run --' after the MPI command. - E.g.: - - - mpirun -n 2 - - should be: - - omnitrace-run -- - mpirun -n 2 omnitrace-run -- - - Note: the command-line arguments passed to 'omnitrace-run' (which are specified before the double hyphen) will override configuration variables - and/or any configuration values specified to 'omnitrace-instrument' via the '--config' or '--env' options. - E.g.: - - $ omnitrace-instrument -o ./sleep.inst --env OMNITRACE_SAMPLING_DELAY=5.0 -- sleep - $ echo "OMNITRACE_SAMPLING_FREQ = 500" > omnitrace.cfg - $ export OMNITRACE_CONFIG_FILE=omnitrace.cfg - $ omnitrace-run --sampling-freq=100 --sampling-delay=1.0 -- ./sleep.inst 10 - - In the first command, a default sampling delay of 5 seconds in embedded into the instrumented 'sleep.inst'. - In the second command, the sampling frequency will be set to 500 interrupts per second when OmniTrace reads the config file - In the fourth command, the sampling frequency and sampling delay are overridden to 100 interrupts per second and 1 second, respectively, when sleep.inst runs - - Thanks for using OmniTrace and happy optimizing! - )notice"; - - // emit notice - std::cerr << _notice << std::endl; - - std::quick_exit(EXIT_FAILURE); -} - -bool _handle_preload = omnitrace_preload(); -main_func_t main_real = nullptr; -} // namespace -} // namespace dl -} // namespace omnitrace - -extern "C" -{ - int omnitrace_main(int argc, char** argv, char** envp) OMNITRACE_INTERNAL_API; - void omnitrace_set_main(main_func_t) OMNITRACE_INTERNAL_API; - - void omnitrace_set_main(main_func_t _main_real) - { - ::omnitrace::dl::main_real = _main_real; - } - - int omnitrace_main(int argc, char** argv, char** envp) - { - OMNITRACE_DL_LOG(0, "%s\n", __FUNCTION__); - using ::omnitrace::common::get_env; - using ::omnitrace::dl::get_default_mode; - - // prevent re-entry - static int _reentry = 0; - if(_reentry > 0) return -1; - _reentry = 1; - - if(!::omnitrace::dl::main_real) - throw std::runtime_error("[omnitrace][dl] Unsuccessful wrapping of main: " - "nullptr to real main function"); - - if(envp) - { - size_t _idx = 0; - while(envp[_idx] != nullptr) - { - auto _env_v = std::string_view{ envp[_idx++] }; - if(_env_v.find("OMNITRACE") != 0 && - _env_v.find("libomnitrace") == std::string_view::npos) - continue; - auto _pos = _env_v.find('='); - if(_pos < _env_v.length()) - { - auto _var = std::string{ _env_v }.substr(0, _pos); - auto _val = std::string{ _env_v }.substr(_pos + 1); - OMNITRACE_DL_LOG(1, "%s(%s, %s)\n", "omnitrace_set_env", _var.c_str(), - _val.c_str()); - setenv(_var.c_str(), _val.c_str(), 0); - } - } - } - - auto _mode = get_env("OMNITRACE_MODE", get_default_mode()); - omnitrace_init(_mode.c_str(), - dl::get_instrumented() == dl::InstrumentMode::BinaryRewrite, - argv[0]); - - int ret = (*::omnitrace::dl::main_real)(argc, argv, envp); - - omnitrace_pop_trace(basename(argv[0])); - omnitrace_finalize(); - - return ret; - } -} +// MIT License +// +// Copyright (c) 2022 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 +// 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. + +#if !defined(OMNITRACE_DL_SOURCE) +# define OMNITRACE_DL_SOURCE 1 +#endif + +#define OMNITRACE_COMMON_LIBRARY_NAME "dl" + +#include + +#define OMNITRACE_COMMON_LIBRARY_LOG_START \ + fprintf(stderr, "%s", ::tim::log::color::info()); +#define OMNITRACE_COMMON_LIBRARY_LOG_END fprintf(stderr, "%s", ::tim::log::color::end()); + +#include "common/defines.h" +#include "common/delimit.hpp" +#include "common/environment.hpp" +#include "common/invoke.hpp" +#include "common/join.hpp" +#include "common/setup.hpp" +#include "dl/dl.hpp" +#include "omnitrace/categories.h" +#include "omnitrace/types.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//--------------------------------------------------------------------------------------// + +#define OMNITRACE_DLSYM(VARNAME, HANDLE, FUNCNAME) \ + if(HANDLE) \ + { \ + *(void**) (&VARNAME) = dlsym(HANDLE, FUNCNAME); \ + if(VARNAME == nullptr && _omnitrace_dl_verbose >= _warn_verbose) \ + { \ + OMNITRACE_COMMON_LIBRARY_LOG_START \ + fprintf(stderr, "[omnitrace][dl][pid=%i]> %s :: %s\n", getpid(), FUNCNAME, \ + dlerror()); \ + OMNITRACE_COMMON_LIBRARY_LOG_END \ + } \ + else if(_omnitrace_dl_verbose > _info_verbose) \ + { \ + OMNITRACE_COMMON_LIBRARY_LOG_START \ + fprintf(stderr, "[omnitrace][dl][pid=%i]> %s :: success\n", getpid(), \ + FUNCNAME); \ + OMNITRACE_COMMON_LIBRARY_LOG_END \ + } \ + } + +//--------------------------------------------------------------------------------------// + +using main_func_t = int (*)(int, char**, char**); + +std::ostream& +operator<<(std::ostream& _os, const SpaceHandle& _handle) +{ + _os << _handle.name; + return _os; +} + +namespace omnitrace +{ +namespace dl +{ +namespace +{ +inline int +get_omnitrace_env() +{ + auto&& _debug = get_env("OMNITRACE_DEBUG", false); + return get_env("OMNITRACE_VERBOSE", (_debug) ? 100 : 0); +} + +inline int +get_omnitrace_dl_env() +{ + return get_env("OMNITRACE_DL_DEBUG", false) + ? 100 + : get_env("OMNITRACE_DL_VERBOSE", get_omnitrace_env()); +} + +inline bool& +get_omnitrace_is_preloaded() +{ + static bool _v = []() { + auto&& _preload_libs = get_env("LD_PRELOAD", std::string{}); + return (_preload_libs.find("librocprof-sys-dl.so") != std::string::npos); + }(); + return _v; +} + +inline bool +get_omnitrace_preload() +{ + static bool _v = []() { + auto&& _preload = get_env("OMNITRACE_PRELOAD", true); + auto&& _preload_libs = get_env("LD_PRELOAD", std::string{}); + return (_preload && + _preload_libs.find("librocprof-sys-dl.so") != std::string::npos); + }(); + return _v; +} + +inline void +reset_omnitrace_preload() +{ + auto&& _preload_libs = get_env("LD_PRELOAD", std::string{}); + if(_preload_libs.find("librocprof-sys-dl.so") != std::string::npos) + { + (void) get_omnitrace_is_preloaded(); + (void) get_omnitrace_preload(); + auto _modified_preload = std::string{}; + for(const auto& itr : delimit(_preload_libs, ":")) + { + if(itr.find("librocprof-sys") != std::string::npos) continue; + _modified_preload += common::join("", ":", itr); + } + if(!_modified_preload.empty() && _modified_preload.find(':') == 0) + _modified_preload = _modified_preload.substr(1); + + setenv("LD_PRELOAD", _modified_preload.c_str(), 1); + } +} + +inline pid_t +get_omnitrace_root_pid() +{ + auto _pid = getpid(); + setenv("OMNITRACE_ROOT_PROCESS", std::to_string(_pid).c_str(), 0); + return get_env("OMNITRACE_ROOT_PROCESS", _pid); +} + +void +omnitrace_preinit() OMNITRACE_INTERNAL_API; + +void +omnitrace_postinit(std::string exe = {}) OMNITRACE_INTERNAL_API; + +pid_t _omnitrace_root_pid = get_omnitrace_root_pid(); + +// environment priority: +// - OMNITRACE_DL_DEBUG +// - OMNITRACE_DL_VERBOSE +// - OMNITRACE_DEBUG +// - OMNITRACE_VERBOSE +int _omnitrace_dl_verbose = get_omnitrace_dl_env(); + +// The docs for dlopen suggest that the combination of RTLD_LOCAL + RTLD_DEEPBIND +// (when available) helps ensure that the symbols in the instrumentation library +// librocprof-sys.so will use it's own symbols... not symbols that are potentially +// instrumented. However, this only applies to the symbols in librocprof-sys.so, +// which is NOT self-contained, i.e. symbols in timemory and the libs it links to +// (such as libpapi.so) are not protected by the deep-bind option. Additionally, +// it should be noted that DynInst does *NOT* add instrumentation by manipulating the +// dynamic linker (otherwise it would only be limited to shared libs) -- it manipulates +// the instructions in the binary so that a call to a function such as "main" actually +// calls "main_dyninst", which executes the instrumentation snippets around the actual +// "main" (this is the reason you need the dyninstAPI_RT library). +// +// UPDATE: +// Use of RTLD_DEEPBIND has been removed because it causes the dyninst +// ProcControlAPI to segfault within pthread_cond_wait on certain executables. +// +// Here are the docs on the dlopen options used: +// +// RTLD_LAZY +// Perform lazy binding. Only resolve symbols as the code that references them is +// executed. If the symbol is never referenced, then it is never resolved. (Lazy +// binding is only performed for function references; references to variables are +// always immediately bound when the library is loaded.) +// +// RTLD_LOCAL +// This is the converse of RTLD_GLOBAL, and the default if neither flag is specified. +// Symbols defined in this library are not made available to resolve references in +// subsequently loaded libraries. +// +// RTLD_DEEPBIND (since glibc 2.3.4) +// Place the lookup scope of the symbols in this library ahead of the global scope. +// This means that a self-contained library will use its own symbols in preference to +// global symbols with the same name contained in libraries that have already been +// loaded. This flag is not specified in POSIX.1-2001. +// +#if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 4 +auto _omnitrace_dl_dlopen_flags = RTLD_LAZY | RTLD_LOCAL; +const char* _omnitrace_dl_dlopen_descr = "RTLD_LAZY | RTLD_LOCAL"; +#else +auto _omnitrace_dl_dlopen_flags = RTLD_LAZY | RTLD_LOCAL; +const char* _omnitrace_dl_dlopen_descr = "RTLD_LAZY | RTLD_LOCAL"; +#endif + +/// This class contains function pointers for omnitrace's instrumentation functions +struct OMNITRACE_INTERNAL_API indirect +{ + OMNITRACE_INLINE indirect(const std::string& _omnilib, const std::string& _userlib, + const std::string& _dllib) + : m_omnilib{ common::path::find_path(_omnilib, _omnitrace_dl_verbose) } + , m_dllib{ common::path::find_path(_dllib, _omnitrace_dl_verbose) } + , m_userlib{ common::path::find_path(_userlib, _omnitrace_dl_verbose) } + { + if(_omnitrace_dl_verbose >= 1) + { + OMNITRACE_COMMON_LIBRARY_LOG_START + fprintf(stderr, "[omnitrace][dl][pid=%i] %s resolved to '%s'\n", getpid(), + ::basename(_omnilib.c_str()), m_omnilib.c_str()); + fprintf(stderr, "[omnitrace][dl][pid=%i] %s resolved to '%s'\n", getpid(), + ::basename(_dllib.c_str()), m_dllib.c_str()); + fprintf(stderr, "[omnitrace][dl][pid=%i] %s resolved to '%s'\n", getpid(), + ::basename(_userlib.c_str()), m_userlib.c_str()); + OMNITRACE_COMMON_LIBRARY_LOG_END + } + + auto _search_paths = common::join(':', common::path::dirname(_omnilib), + common::path::dirname(_dllib)); + common::setup_environ(_omnitrace_dl_verbose, _search_paths, _omnilib, _dllib); + + m_omnihandle = open(m_omnilib); + m_userhandle = open(m_userlib); + init(); + } + + OMNITRACE_INLINE ~indirect() { dlclose(m_omnihandle); } + + static OMNITRACE_INLINE void* open(const std::string& _lib) + { + auto* libhandle = dlopen(_lib.c_str(), _omnitrace_dl_dlopen_flags); + + if(libhandle) + { + if(_omnitrace_dl_verbose >= 2) + { + OMNITRACE_COMMON_LIBRARY_LOG_START + fprintf(stderr, "[omnitrace][dl][pid=%i] dlopen(\"%s\", %s) :: success\n", + getpid(), _lib.c_str(), _omnitrace_dl_dlopen_descr); + OMNITRACE_COMMON_LIBRARY_LOG_END + } + } + else + { + if(_omnitrace_dl_verbose >= 0) + { + perror("dlopen"); + OMNITRACE_COMMON_LIBRARY_LOG_START + fprintf(stderr, "[omnitrace][dl][pid=%i] dlopen(\"%s\", %s) :: %s\n", + getpid(), _lib.c_str(), _omnitrace_dl_dlopen_descr, dlerror()); + OMNITRACE_COMMON_LIBRARY_LOG_END + } + } + + dlerror(); // Clear any existing error + + return libhandle; + } + + OMNITRACE_INLINE void init() + { + if(!m_omnihandle) m_omnihandle = open(m_omnilib); + + int _warn_verbose = 0; + int _info_verbose = 2; + // Initialize all pointers + OMNITRACE_DLSYM(omnitrace_init_library_f, m_omnihandle, "omnitrace_init_library"); + OMNITRACE_DLSYM(omnitrace_init_tooling_f, m_omnihandle, "omnitrace_init_tooling"); + OMNITRACE_DLSYM(omnitrace_init_f, m_omnihandle, "omnitrace_init"); + OMNITRACE_DLSYM(omnitrace_finalize_f, m_omnihandle, "omnitrace_finalize"); + OMNITRACE_DLSYM(omnitrace_set_env_f, m_omnihandle, "omnitrace_set_env"); + OMNITRACE_DLSYM(omnitrace_set_mpi_f, m_omnihandle, "omnitrace_set_mpi"); + OMNITRACE_DLSYM(omnitrace_push_trace_f, m_omnihandle, "omnitrace_push_trace"); + OMNITRACE_DLSYM(omnitrace_pop_trace_f, m_omnihandle, "omnitrace_pop_trace"); + OMNITRACE_DLSYM(omnitrace_push_region_f, m_omnihandle, "omnitrace_push_region"); + OMNITRACE_DLSYM(omnitrace_pop_region_f, m_omnihandle, "omnitrace_pop_region"); + OMNITRACE_DLSYM(omnitrace_push_category_region_f, m_omnihandle, + "omnitrace_push_category_region"); + OMNITRACE_DLSYM(omnitrace_pop_category_region_f, m_omnihandle, + "omnitrace_pop_category_region"); + OMNITRACE_DLSYM(omnitrace_register_source_f, m_omnihandle, + "omnitrace_register_source"); + OMNITRACE_DLSYM(omnitrace_register_coverage_f, m_omnihandle, + "omnitrace_register_coverage"); + OMNITRACE_DLSYM(omnitrace_progress_f, m_omnihandle, "omnitrace_progress"); + OMNITRACE_DLSYM(omnitrace_annotated_progress_f, m_omnihandle, + "omnitrace_annotated_progress"); + + OMNITRACE_DLSYM(kokkosp_print_help_f, m_omnihandle, "kokkosp_print_help"); + OMNITRACE_DLSYM(kokkosp_parse_args_f, m_omnihandle, "kokkosp_parse_args"); + OMNITRACE_DLSYM(kokkosp_declare_metadata_f, m_omnihandle, + "kokkosp_declare_metadata"); + OMNITRACE_DLSYM(kokkosp_request_tool_settings_f, m_omnihandle, + "kokkosp_request_tool_settings"); + OMNITRACE_DLSYM(kokkosp_init_library_f, m_omnihandle, "kokkosp_init_library"); + OMNITRACE_DLSYM(kokkosp_finalize_library_f, m_omnihandle, + "kokkosp_finalize_library"); + OMNITRACE_DLSYM(kokkosp_begin_parallel_for_f, m_omnihandle, + "kokkosp_begin_parallel_for"); + OMNITRACE_DLSYM(kokkosp_end_parallel_for_f, m_omnihandle, + "kokkosp_end_parallel_for"); + OMNITRACE_DLSYM(kokkosp_begin_parallel_reduce_f, m_omnihandle, + "kokkosp_begin_parallel_reduce"); + OMNITRACE_DLSYM(kokkosp_end_parallel_reduce_f, m_omnihandle, + "kokkosp_end_parallel_reduce"); + OMNITRACE_DLSYM(kokkosp_begin_parallel_scan_f, m_omnihandle, + "kokkosp_begin_parallel_scan"); + OMNITRACE_DLSYM(kokkosp_end_parallel_scan_f, m_omnihandle, + "kokkosp_end_parallel_scan"); + OMNITRACE_DLSYM(kokkosp_begin_fence_f, m_omnihandle, "kokkosp_begin_fence"); + OMNITRACE_DLSYM(kokkosp_end_fence_f, m_omnihandle, "kokkosp_end_fence"); + OMNITRACE_DLSYM(kokkosp_push_profile_region_f, m_omnihandle, + "kokkosp_push_profile_region"); + OMNITRACE_DLSYM(kokkosp_pop_profile_region_f, m_omnihandle, + "kokkosp_pop_profile_region"); + OMNITRACE_DLSYM(kokkosp_create_profile_section_f, m_omnihandle, + "kokkosp_create_profile_section"); + OMNITRACE_DLSYM(kokkosp_destroy_profile_section_f, m_omnihandle, + "kokkosp_destroy_profile_section"); + OMNITRACE_DLSYM(kokkosp_start_profile_section_f, m_omnihandle, + "kokkosp_start_profile_section"); + OMNITRACE_DLSYM(kokkosp_stop_profile_section_f, m_omnihandle, + "kokkosp_stop_profile_section"); + OMNITRACE_DLSYM(kokkosp_allocate_data_f, m_omnihandle, "kokkosp_allocate_data"); + OMNITRACE_DLSYM(kokkosp_deallocate_data_f, m_omnihandle, + "kokkosp_deallocate_data"); + OMNITRACE_DLSYM(kokkosp_begin_deep_copy_f, m_omnihandle, + "kokkosp_begin_deep_copy"); + OMNITRACE_DLSYM(kokkosp_end_deep_copy_f, m_omnihandle, "kokkosp_end_deep_copy"); + OMNITRACE_DLSYM(kokkosp_profile_event_f, m_omnihandle, "kokkosp_profile_event"); + OMNITRACE_DLSYM(kokkosp_dual_view_sync_f, m_omnihandle, "kokkosp_dual_view_sync"); + OMNITRACE_DLSYM(kokkosp_dual_view_modify_f, m_omnihandle, + "kokkosp_dual_view_modify"); + +#if OMNITRACE_USE_ROCTRACER > 0 + OMNITRACE_DLSYM(hsa_on_load_f, m_omnihandle, "OnLoad"); + OMNITRACE_DLSYM(hsa_on_unload_f, m_omnihandle, "OnUnload"); +#endif + +#if OMNITRACE_USE_ROCPROFILER > 0 + OMNITRACE_DLSYM(rocp_on_load_tool_prop_f, m_omnihandle, "OnLoadToolProp"); + OMNITRACE_DLSYM(rocp_on_unload_tool_f, m_omnihandle, "OnUnloadTool"); +#endif + +#if OMNITRACE_USE_OMPT == 0 + _warn_verbose = 5; +#else + OMNITRACE_DLSYM(ompt_start_tool_f, m_omnihandle, "ompt_start_tool"); +#endif + + if(!m_userhandle) m_userhandle = open(m_userlib); + _warn_verbose = 0; + OMNITRACE_DLSYM(omnitrace_user_configure_f, m_userhandle, + "omnitrace_user_configure"); + + if(omnitrace_user_configure_f) + { + omnitrace_user_callbacks_t _cb = {}; + _cb.start_trace = &omnitrace_user_start_trace_dl; + _cb.stop_trace = &omnitrace_user_stop_trace_dl; + _cb.start_thread_trace = &omnitrace_user_start_thread_trace_dl; + _cb.stop_thread_trace = &omnitrace_user_stop_thread_trace_dl; + _cb.push_region = &omnitrace_user_push_region_dl; + _cb.pop_region = &omnitrace_user_pop_region_dl; + _cb.progress = &omnitrace_user_progress_dl; + _cb.push_annotated_region = &omnitrace_user_push_annotated_region_dl; + _cb.pop_annotated_region = &omnitrace_user_pop_annotated_region_dl; + _cb.annotated_progress = &omnitrace_user_annotated_progress_dl; + (*omnitrace_user_configure_f)(OMNITRACE_USER_REPLACE_CONFIG, _cb, nullptr); + } + } + +public: + using user_cb_t = omnitrace_user_callbacks_t; + + // librocprof-sys functions + void (*omnitrace_init_library_f)(void) = nullptr; + void (*omnitrace_init_tooling_f)(void) = nullptr; + void (*omnitrace_init_f)(const char*, bool, const char*) = nullptr; + void (*omnitrace_finalize_f)(void) = nullptr; + void (*omnitrace_set_env_f)(const char*, const char*) = nullptr; + void (*omnitrace_set_mpi_f)(bool, bool) = nullptr; + void (*omnitrace_register_source_f)(const char*, const char*, size_t, size_t, + const char*) = nullptr; + void (*omnitrace_register_coverage_f)(const char*, const char*, size_t) = nullptr; + void (*omnitrace_push_trace_f)(const char*) = nullptr; + void (*omnitrace_pop_trace_f)(const char*) = nullptr; + int (*omnitrace_push_region_f)(const char*) = nullptr; + int (*omnitrace_pop_region_f)(const char*) = nullptr; + int (*omnitrace_push_category_region_f)(omnitrace_category_t, const char*, + omnitrace_annotation_t*, size_t) = nullptr; + int (*omnitrace_pop_category_region_f)(omnitrace_category_t, const char*, + omnitrace_annotation_t*, size_t) = nullptr; + void (*omnitrace_progress_f)(const char*) = nullptr; + void (*omnitrace_annotated_progress_f)(const char*, omnitrace_annotation_t*, + size_t) = nullptr; + + // librocprof-sys-user functions + int (*omnitrace_user_configure_f)(int, user_cb_t, user_cb_t*) = nullptr; + + // KokkosP functions + void (*kokkosp_print_help_f)(char*) = nullptr; + void (*kokkosp_parse_args_f)(int, char**) = nullptr; + void (*kokkosp_declare_metadata_f)(const char*, const char*) = nullptr; + void (*kokkosp_request_tool_settings_f)(const uint32_t, + Kokkos_Tools_ToolSettings*) = nullptr; + void (*kokkosp_init_library_f)(const int, const uint64_t, const uint32_t, + void*) = nullptr; + void (*kokkosp_finalize_library_f)() = nullptr; + void (*kokkosp_begin_parallel_for_f)(const char*, uint32_t, uint64_t*) = nullptr; + void (*kokkosp_end_parallel_for_f)(uint64_t) = nullptr; + void (*kokkosp_begin_parallel_reduce_f)(const char*, uint32_t, uint64_t*) = nullptr; + void (*kokkosp_end_parallel_reduce_f)(uint64_t) = nullptr; + void (*kokkosp_begin_parallel_scan_f)(const char*, uint32_t, uint64_t*) = nullptr; + void (*kokkosp_end_parallel_scan_f)(uint64_t) = nullptr; + void (*kokkosp_begin_fence_f)(const char*, uint32_t, uint64_t*) = nullptr; + void (*kokkosp_end_fence_f)(uint64_t) = nullptr; + void (*kokkosp_push_profile_region_f)(const char*) = nullptr; + void (*kokkosp_pop_profile_region_f)() = nullptr; + void (*kokkosp_create_profile_section_f)(const char*, uint32_t*) = nullptr; + void (*kokkosp_destroy_profile_section_f)(uint32_t) = nullptr; + void (*kokkosp_start_profile_section_f)(uint32_t) = nullptr; + void (*kokkosp_stop_profile_section_f)(uint32_t) = nullptr; + void (*kokkosp_allocate_data_f)(const SpaceHandle, const char*, const void* const, + const uint64_t) = nullptr; + void (*kokkosp_deallocate_data_f)(const SpaceHandle, const char*, const void* const, + const uint64_t) = nullptr; + void (*kokkosp_begin_deep_copy_f)(SpaceHandle, const char*, const void*, SpaceHandle, + const char*, const void*, uint64_t) = nullptr; + void (*kokkosp_end_deep_copy_f)() = nullptr; + void (*kokkosp_profile_event_f)(const char*) = nullptr; + void (*kokkosp_dual_view_sync_f)(const char*, const void* const, bool) = nullptr; + void (*kokkosp_dual_view_modify_f)(const char*, const void* const, bool) = nullptr; + + // HSA functions +#if OMNITRACE_USE_ROCTRACER > 0 + bool (*hsa_on_load_f)(HsaApiTable*, uint64_t, uint64_t, const char* const*) = nullptr; + void (*hsa_on_unload_f)() = nullptr; +#endif + + // ROCP functions +#if OMNITRACE_USE_ROCPROFILER > 0 + void (*rocp_on_load_tool_prop_f)(void* settings) = nullptr; + void (*rocp_on_unload_tool_f)() = nullptr; +#endif + + // OpenMP functions +#if defined(OMNITRACE_USE_OMPT) && OMNITRACE_USE_OMPT > 0 + ompt_start_tool_result_t* (*ompt_start_tool_f)(unsigned int, const char*); +#endif + + auto get_omni_library() const { return m_omnilib; } + auto get_user_library() const { return m_userlib; } + auto get_dl_library() const { return m_dllib; } + +private: + void* m_omnihandle = nullptr; + void* m_userhandle = nullptr; + std::string m_omnilib = {}; + std::string m_dllib = {}; + std::string m_userlib = {}; +}; + +inline indirect& +get_indirect() OMNITRACE_INTERNAL_API; + +indirect& +get_indirect() +{ + omnitrace_preinit_library(); + + static auto _libomni = get_env("OMNITRACE_LIBRARY", "librocprof-sys.so"); + static auto _libuser = get_env("OMNITRACE_USER_LIBRARY", "librocprof-sys-user.so"); + static auto _libdlib = get_env("OMNITRACE_DL_LIBRARY", "librocprof-sys-dl.so"); + static auto* _v = new indirect{ _libomni, _libuser, _libdlib }; + return *_v; +} + +auto& +get_inited() +{ + static bool* _v = new bool{ false }; + return *_v; +} + +auto& +get_finied() +{ + static bool* _v = new bool{ false }; + return *_v; +} + +auto& +get_active() +{ + static bool* _v = new bool{ false }; + return *_v; +} + +auto& +get_enabled() +{ + static auto* _v = new std::atomic{ get_env("OMNITRACE_INIT_ENABLED", true) }; + return *_v; +} + +auto& +get_thread_enabled() +{ + static thread_local bool _v = get_enabled(); + return _v; +} + +auto& +get_thread_count() +{ + static thread_local int64_t _v = 0; + return _v; +} + +auto& +get_thread_status() +{ + static thread_local bool _v = false; + return _v; +} + +InstrumentMode& +get_instrumented() +{ + static auto _v = get_env("OMNITRACE_INSTRUMENT_MODE", InstrumentMode::None); + return _v; +} + +// ensure finalization is called +bool _omnitrace_dl_fini = (std::atexit([]() { + if(get_active()) omnitrace_finalize(); + }), + true); +} // namespace +} // namespace dl +} // namespace omnitrace + +//--------------------------------------------------------------------------------------// + +#define OMNITRACE_DL_INVOKE(...) \ + ::omnitrace::common::invoke(__FUNCTION__, ::omnitrace::dl::_omnitrace_dl_verbose, \ + (::omnitrace::dl::get_thread_status() = false), \ + __VA_ARGS__) + +#define OMNITRACE_DL_IGNORE(...) \ + ::omnitrace::common::ignore(__FUNCTION__, ::omnitrace::dl::_omnitrace_dl_verbose, \ + __VA_ARGS__) + +#define OMNITRACE_DL_INVOKE_STATUS(STATUS, ...) \ + ::omnitrace::common::invoke(__FUNCTION__, ::omnitrace::dl::_omnitrace_dl_verbose, \ + STATUS, __VA_ARGS__) + +#define OMNITRACE_DL_LOG(LEVEL, ...) \ + if(::omnitrace::dl::_omnitrace_dl_verbose >= LEVEL) \ + { \ + fflush(stderr); \ + OMNITRACE_COMMON_LIBRARY_LOG_START \ + fprintf(stderr, "[omnitrace][" OMNITRACE_COMMON_LIBRARY_NAME "][%i] ", \ + getpid()); \ + fprintf(stderr, __VA_ARGS__); \ + OMNITRACE_COMMON_LIBRARY_LOG_END \ + fflush(stderr); \ + } + +using omnitrace::dl::get_indirect; +namespace dl = omnitrace::dl; + +extern "C" +{ + void omnitrace_preinit_library(void) + { + if(omnitrace::common::get_env("OMNITRACE_MONOCHROME", tim::log::monochrome())) + tim::log::monochrome() = true; + } + + int omnitrace_preload_library(void) + { + return (::omnitrace::dl::get_omnitrace_preload()) ? 1 : 0; + } + + void omnitrace_init_library(void) + { + OMNITRACE_DL_INVOKE(get_indirect().omnitrace_init_library_f); + } + + void omnitrace_init_tooling(void) + { + OMNITRACE_DL_INVOKE(get_indirect().omnitrace_init_tooling_f); + } + + void omnitrace_init(const char* a, bool b, const char* c) + { + if(dl::get_inited() && dl::get_finied()) + { + OMNITRACE_DL_LOG( + 2, "%s(%s) ignored :: already initialized and finalized\n", __FUNCTION__, + ::omnitrace::join(::omnitrace::QuoteStrings{}, ", ", a, b, c).c_str()); + return; + } + else if(dl::get_inited() && dl::get_active()) + { + OMNITRACE_DL_LOG( + 2, "%s(%s) ignored :: already initialized and active\n", __FUNCTION__, + ::omnitrace::join(::omnitrace::QuoteStrings{}, ", ", a, b, c).c_str()); + return; + } + + if(dl::get_instrumented() < dl::InstrumentMode::PythonProfile) + dl::omnitrace_preinit(); + + bool _invoked = false; + OMNITRACE_DL_INVOKE_STATUS(_invoked, get_indirect().omnitrace_init_f, a, b, c); + if(_invoked) + { + dl::get_active() = true; + dl::get_inited() = true; + dl::_omnitrace_dl_verbose = dl::get_omnitrace_dl_env(); + if(dl::get_instrumented() < dl::InstrumentMode::PythonProfile) + dl::omnitrace_postinit((c) ? std::string{ c } : std::string{}); + } + } + + void omnitrace_finalize(void) + { + if(dl::get_inited() && dl::get_finied()) + { + OMNITRACE_DL_LOG(2, "%s() ignored :: already initialized and finalized\n", + __FUNCTION__); + return; + } + else if(dl::get_finied() && !dl::get_active()) + { + OMNITRACE_DL_LOG(2, "%s() ignored :: already finalized but not active\n", + __FUNCTION__); + return; + } + + bool _invoked = false; + OMNITRACE_DL_INVOKE_STATUS(_invoked, get_indirect().omnitrace_finalize_f); + if(_invoked) + { + dl::get_active() = false; + dl::get_finied() = true; + } + } + + void omnitrace_push_trace(const char* name) + { + if(!dl::get_active()) return; + if(dl::get_thread_enabled()) + { + OMNITRACE_DL_INVOKE(get_indirect().omnitrace_push_trace_f, name); + } + else + { + ++dl::get_thread_count(); + } + } + + void omnitrace_pop_trace(const char* name) + { + if(!dl::get_active()) return; + if(dl::get_thread_enabled()) + { + OMNITRACE_DL_INVOKE(get_indirect().omnitrace_pop_trace_f, name); + } + else + { + if(dl::get_thread_count()-- == 0) omnitrace_user_start_thread_trace_dl(); + } + } + + int omnitrace_push_region(const char* name) + { + if(!dl::get_active()) return 0; + if(dl::get_thread_enabled()) + { + return OMNITRACE_DL_INVOKE(get_indirect().omnitrace_push_region_f, name); + } + else + { + ++dl::get_thread_count(); + } + return 0; + } + + int omnitrace_pop_region(const char* name) + { + if(!dl::get_active()) return 0; + if(dl::get_thread_enabled()) + { + return OMNITRACE_DL_INVOKE(get_indirect().omnitrace_pop_region_f, name); + } + else + { + if(dl::get_thread_count()-- == 0) omnitrace_user_start_thread_trace_dl(); + } + return 0; + } + + int omnitrace_push_category_region(omnitrace_category_t _category, const char* name, + omnitrace_annotation_t* _annotations, + size_t _annotation_count) + { + if(!dl::get_active()) return 0; + if(dl::get_thread_enabled()) + { + return OMNITRACE_DL_INVOKE(get_indirect().omnitrace_push_category_region_f, + _category, name, _annotations, _annotation_count); + } + else + { + ++dl::get_thread_count(); + } + return 0; + } + + int omnitrace_pop_category_region(omnitrace_category_t _category, const char* name, + omnitrace_annotation_t* _annotations, + size_t _annotation_count) + { + if(!dl::get_active()) return 0; + if(dl::get_thread_enabled()) + { + return OMNITRACE_DL_INVOKE(get_indirect().omnitrace_pop_category_region_f, + _category, name, _annotations, _annotation_count); + } + else + { + ++dl::get_thread_count(); + } + return 0; + } + + void omnitrace_set_env(const char* a, const char* b) + { + if(dl::get_inited() && dl::get_active()) + { + OMNITRACE_DL_IGNORE(2, "already initialized and active", a, b); + return; + } + OMNITRACE_DL_LOG(2, "%s(%s, %s)\n", __FUNCTION__, a, b); + setenv(a, b, 0); + // OMNITRACE_DL_INVOKE(get_indirect().omnitrace_set_env_f, a, b); + } + + void omnitrace_set_mpi(bool a, bool b) + { + if(dl::get_inited() && dl::get_active()) + { + OMNITRACE_DL_IGNORE(2, "already initialized and active", a, b); + return; + } + OMNITRACE_DL_INVOKE(get_indirect().omnitrace_set_mpi_f, a, b); + } + + void omnitrace_register_source(const char* file, const char* func, size_t line, + size_t address, const char* source) + { + OMNITRACE_DL_LOG(3, "%s(\"%s\", \"%s\", %zu, %zu, \"%s\")\n", __FUNCTION__, file, + func, line, address, source); + OMNITRACE_DL_INVOKE(get_indirect().omnitrace_register_source_f, file, func, line, + address, source); + } + + void omnitrace_register_coverage(const char* file, const char* func, size_t address) + { + OMNITRACE_DL_INVOKE(get_indirect().omnitrace_register_coverage_f, file, func, + address); + } + + int omnitrace_user_start_trace_dl(void) + { + dl::get_enabled().store(true); + return omnitrace_user_start_thread_trace_dl(); + } + + int omnitrace_user_stop_trace_dl(void) + { + dl::get_enabled().store(false); + return omnitrace_user_stop_thread_trace_dl(); + } + + int omnitrace_user_start_thread_trace_dl(void) + { + dl::get_thread_enabled() = true; + return 0; + } + + int omnitrace_user_stop_thread_trace_dl(void) + { + dl::get_thread_enabled() = false; + return 0; + } + + int omnitrace_user_push_region_dl(const char* name) + { + if(!dl::get_active()) return 0; + return OMNITRACE_DL_INVOKE(get_indirect().omnitrace_push_region_f, name); + } + + int omnitrace_user_pop_region_dl(const char* name) + { + if(!dl::get_active()) return 0; + return OMNITRACE_DL_INVOKE(get_indirect().omnitrace_pop_region_f, name); + } + + int omnitrace_user_progress_dl(const char* name) + { + OMNITRACE_DL_INVOKE(get_indirect().omnitrace_progress_f, name); + return 0; + } + + int omnitrace_user_push_annotated_region_dl(const char* name, + omnitrace_annotation_t* _annotations, + size_t _annotation_count) + { + if(!dl::get_active()) return 0; + return OMNITRACE_DL_INVOKE(get_indirect().omnitrace_push_category_region_f, + OMNITRACE_CATEGORY_USER, name, _annotations, + _annotation_count); + } + + int omnitrace_user_pop_annotated_region_dl(const char* name, + omnitrace_annotation_t* _annotations, + size_t _annotation_count) + { + if(!dl::get_active()) return 0; + return OMNITRACE_DL_INVOKE(get_indirect().omnitrace_pop_category_region_f, + OMNITRACE_CATEGORY_USER, name, _annotations, + _annotation_count); + } + + int omnitrace_user_annotated_progress_dl(const char* name, + omnitrace_annotation_t* _annotations, + size_t _annotation_count) + { + OMNITRACE_DL_INVOKE(get_indirect().omnitrace_annotated_progress_f, name, + _annotations, _annotation_count); + return 0; + } + + void omnitrace_progress(const char* _name) + { + return OMNITRACE_DL_INVOKE(get_indirect().omnitrace_progress_f, _name); + } + + void omnitrace_annotated_progress(const char* _name, + omnitrace_annotation_t* _annotations, + size_t _annotation_count) + { + return OMNITRACE_DL_INVOKE(get_indirect().omnitrace_annotated_progress_f, _name, + _annotations, _annotation_count); + } + + void omnitrace_set_instrumented(int _mode) + { + OMNITRACE_DL_LOG(2, "%s(%i)\n", __FUNCTION__, _mode); + auto _mode_v = static_cast(_mode); + if(_mode_v < dl::InstrumentMode::None || _mode_v >= dl::InstrumentMode::Last) + { + OMNITRACE_DL_LOG(-127, + "%s(mode=%i) invoked with invalid instrumentation mode. " + "mode should be %i >= mode < %i\n", + __FUNCTION__, _mode, + static_cast(dl::InstrumentMode::None), + static_cast(dl::InstrumentMode::Last)); + } + dl::get_instrumented() = _mode_v; + } + + //----------------------------------------------------------------------------------// + // + // KokkosP + // + //----------------------------------------------------------------------------------// + + void kokkosp_print_help(char* argv0) + { + return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_print_help_f, argv0); + } + + void kokkosp_parse_args(int argc, char** argv) + { + return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_parse_args_f, argc, argv); + } + + void kokkosp_declare_metadata(const char* key, const char* value) + { + return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_declare_metadata_f, key, value); + } + + void kokkosp_request_tool_settings(const uint32_t version, + Kokkos_Tools_ToolSettings* settings) + { + return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_request_tool_settings_f, + version, settings); + } + + void kokkosp_init_library(const int loadSeq, const uint64_t interfaceVer, + const uint32_t devInfoCount, void* deviceInfo) + { + return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_init_library_f, loadSeq, + interfaceVer, devInfoCount, deviceInfo); + } + + void kokkosp_finalize_library() + { + return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_finalize_library_f); + } + + void kokkosp_begin_parallel_for(const char* name, uint32_t devid, uint64_t* kernid) + { + return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_begin_parallel_for_f, name, + devid, kernid); + } + + void kokkosp_end_parallel_for(uint64_t kernid) + { + return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_end_parallel_for_f, kernid); + } + + void kokkosp_begin_parallel_reduce(const char* name, uint32_t devid, uint64_t* kernid) + { + return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_begin_parallel_reduce_f, name, + devid, kernid); + } + + void kokkosp_end_parallel_reduce(uint64_t kernid) + { + return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_end_parallel_reduce_f, kernid); + } + + void kokkosp_begin_parallel_scan(const char* name, uint32_t devid, uint64_t* kernid) + { + return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_begin_parallel_scan_f, name, + devid, kernid); + } + + void kokkosp_end_parallel_scan(uint64_t kernid) + { + return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_end_parallel_scan_f, kernid); + } + + void kokkosp_begin_fence(const char* name, uint32_t devid, uint64_t* kernid) + { + return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_begin_fence_f, name, devid, + kernid); + } + + void kokkosp_end_fence(uint64_t kernid) + { + return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_end_fence_f, kernid); + } + + void kokkosp_push_profile_region(const char* name) + { + return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_push_profile_region_f, name); + } + + void kokkosp_pop_profile_region() + { + return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_pop_profile_region_f); + } + + void kokkosp_create_profile_section(const char* name, uint32_t* secid) + { + return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_create_profile_section_f, name, + secid); + } + + void kokkosp_destroy_profile_section(uint32_t secid) + { + return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_destroy_profile_section_f, + secid); + } + + void kokkosp_start_profile_section(uint32_t secid) + { + return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_start_profile_section_f, secid); + } + + void kokkosp_stop_profile_section(uint32_t secid) + { + return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_stop_profile_section_f, secid); + } + + void kokkosp_allocate_data(const SpaceHandle space, const char* label, + const void* const ptr, const uint64_t size) + { + return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_allocate_data_f, space, label, + ptr, size); + } + + void kokkosp_deallocate_data(const SpaceHandle space, const char* label, + const void* const ptr, const uint64_t size) + { + return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_deallocate_data_f, space, label, + ptr, size); + } + + void kokkosp_begin_deep_copy(SpaceHandle dst_handle, const char* dst_name, + const void* dst_ptr, SpaceHandle src_handle, + const char* src_name, const void* src_ptr, uint64_t size) + { + return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_begin_deep_copy_f, dst_handle, + dst_name, dst_ptr, src_handle, src_name, src_ptr, + size); + } + + void kokkosp_end_deep_copy() + { + return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_end_deep_copy_f); + } + + void kokkosp_profile_event(const char* name) + { + return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_profile_event_f, name); + } + + void kokkosp_dual_view_sync(const char* label, const void* const data, bool is_device) + { + return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_dual_view_sync_f, label, data, + is_device); + } + + void kokkosp_dual_view_modify(const char* label, const void* const data, + bool is_device) + { + return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_dual_view_modify_f, label, data, + is_device); + } + + //----------------------------------------------------------------------------------// + // + // HSA + // + //----------------------------------------------------------------------------------// + +#if OMNITRACE_USE_ROCTRACER > 0 + bool OnLoad(HsaApiTable* table, uint64_t runtime_version, uint64_t failed_tool_count, + const char* const* failed_tool_names) + { + return OMNITRACE_DL_INVOKE(get_indirect().hsa_on_load_f, table, runtime_version, + failed_tool_count, failed_tool_names); + } + + void OnUnload() { return OMNITRACE_DL_INVOKE(get_indirect().hsa_on_unload_f); } +#endif + + //----------------------------------------------------------------------------------// + // + // ROCP + // + //----------------------------------------------------------------------------------// + +#if OMNITRACE_USE_ROCPROFILER > 0 + void OnLoadToolProp(void* settings) + { + OMNITRACE_DL_LOG( + -16, + "invoking %s(rocprofiler_settings_t*) within librocprof-sys-dl.so " + "will cause a silent failure for rocprofiler. ROCP_TOOL_LIB " + "should be set to librocprof-sys.so\n", + __FUNCTION__); + abort(); + return OMNITRACE_DL_INVOKE(get_indirect().rocp_on_load_tool_prop_f, settings); + } + + void OnUnloadTool() + { + return OMNITRACE_DL_INVOKE(get_indirect().rocp_on_unload_tool_f); + } +#endif + + //----------------------------------------------------------------------------------// + // + // OMPT + // + //----------------------------------------------------------------------------------// +#if OMNITRACE_USE_OMPT > 0 + ompt_start_tool_result_t* ompt_start_tool(unsigned int omp_version, + const char* runtime_version) + { + return OMNITRACE_DL_INVOKE(get_indirect().ompt_start_tool_f, omp_version, + runtime_version); + } +#endif +} + +namespace omnitrace +{ +namespace dl +{ +namespace +{ +bool +omnitrace_preload() OMNITRACE_INTERNAL_API; + +std::vector +get_link_map(const char*, + std::vector&& = { (RTLD_LAZY | RTLD_NOLOAD) }) OMNITRACE_INTERNAL_API; + +const char* +get_default_mode() OMNITRACE_INTERNAL_API; + +void +verify_instrumented_preloaded() OMNITRACE_INTERNAL_API; + +std::vector +get_link_map(const char* _name, std::vector&& _open_modes) +{ + void* _handle = nullptr; + bool _noload = false; + for(auto _mode : _open_modes) + { + _handle = dlopen(_name, _mode); + _noload = (_mode & RTLD_NOLOAD) == RTLD_NOLOAD; + if(_handle) break; + } + + auto _chain = std::vector{}; + if(_handle) + { + struct link_map* _link_map = nullptr; + dlinfo(_handle, RTLD_DI_LINKMAP, &_link_map); + struct link_map* _next = _link_map->l_next; + while(_next) + { + if(_next->l_name != nullptr && !std::string_view{ _next->l_name }.empty()) + { + _chain.emplace_back(_next->l_name); + } + _next = _next->l_next; + } + + if(_noload == false) dlclose(_handle); + } + return _chain; +} + +const char* +get_default_mode() +{ + if(get_env("OMNITRACE_USE_CAUSAL", false)) return "causal"; + + auto _link_map = get_link_map(nullptr); + for(const auto& itr : _link_map) + { + if(itr.find("librocprof-sys-rt.so") != std::string::npos || + itr.find("libdyninstAPI_RT.so") != std::string::npos) + return "trace"; + } + + return "sampling"; +} + +void +omnitrace_preinit() +{ + switch(get_instrumented()) + { + case InstrumentMode::None: + case InstrumentMode::BinaryRewrite: + case InstrumentMode::ProcessCreate: + case InstrumentMode::ProcessAttach: + { + auto _use_mpip = get_env("OMNITRACE_USE_MPIP", false); + auto _use_mpi = get_env("OMNITRACE_USE_MPI", _use_mpip); + auto _causal = get_env("OMNITRACE_USE_CAUSAL", false); + auto _mode = get_env("OMNITRACE_MODE", get_default_mode()); + + if(_use_mpi && !(_causal && _mode == "causal")) + { + // only make this call if true bc otherwise, if + // false, it will disable the MPIP component and + // we may intercept the MPI init call later. + // If _use_mpi defaults to true above, calling this + // will override can current env or config value for + // OMNITRACE_USE_PID. + omnitrace_set_mpi(_use_mpi, dl::get_instrumented() == + dl::InstrumentMode::ProcessAttach); + } + break; + } + case InstrumentMode::PythonProfile: + case InstrumentMode::Last: break; + } +} + +void +omnitrace_postinit(std::string _exe) +{ + switch(get_instrumented()) + { + case InstrumentMode::None: + case InstrumentMode::BinaryRewrite: + case InstrumentMode::ProcessCreate: + case InstrumentMode::ProcessAttach: + { + if(_exe.empty()) + _exe = tim::filepath::readlink(join('/', "/proc", getpid(), "exe")); + + omnitrace_init_tooling(); + if(_exe.empty()) + omnitrace_push_trace("main"); + else + omnitrace_push_trace(basename(_exe.c_str())); + break; + } + case InstrumentMode::PythonProfile: + { + omnitrace_init_tooling(); + break; + } + case InstrumentMode::Last: break; + } +} + +bool +omnitrace_preload() +{ + auto _preload = get_omnitrace_is_preloaded() && get_omnitrace_preload() && + get_env("OMNITRACE_ENABLED", true); + + auto _link_map = get_link_map(nullptr); + auto _instr_mode = + get_env("OMNITRACE_INSTRUMENT_MODE", dl::InstrumentMode::BinaryRewrite); + for(const auto& itr : _link_map) + { + if(itr.find("librocprof-sys-rt.so") != std::string::npos || + itr.find("libdyninstAPI_RT.so") != std::string::npos) + { + omnitrace_set_instrumented(static_cast(_instr_mode)); + break; + } + } + + verify_instrumented_preloaded(); + + static bool _once = false; + if(_once) return _preload; + _once = true; + + if(_preload) + { + reset_omnitrace_preload(); + omnitrace_preinit_library(); + } + + return _preload; +} + +void +verify_instrumented_preloaded() +{ + // if preloaded then we are fine + if(get_omnitrace_is_preloaded()) return; + + // value returned by get_instrumented is set by either: + // - the search of the linked libraries + // - via the instrumenter + // if binary rewrite or runtime instrumentation, there is an opportunity for + // LD_PRELOAD + switch(dl::get_instrumented()) + { + case dl::InstrumentMode::None: + case dl::InstrumentMode::ProcessAttach: + case dl::InstrumentMode::ProcessCreate: + case dl::InstrumentMode::PythonProfile: + { + return; + } + case dl::InstrumentMode::BinaryRewrite: + { + break; + } + case dl::InstrumentMode::Last: + { + throw std::runtime_error( + "Invalid instrumentation type: InstrumentMode::Last"); + } + } + + static const char* _notice = R"notice( + + NNNNNNNN NNNNNNNN OOOOOOOOO TTTTTTTTTTTTTTTTTTTTTTTIIIIIIIIII CCCCCCCCCCCCCEEEEEEEEEEEEEEEEEEEEEE + N:::::::N N::::::N OO:::::::::OO T:::::::::::::::::::::TI::::::::I CCC::::::::::::CE::::::::::::::::::::E + N::::::::N N::::::N OO:::::::::::::OO T:::::::::::::::::::::TI::::::::I CC:::::::::::::::CE::::::::::::::::::::E + N:::::::::N N::::::NO:::::::OOO:::::::OT:::::TT:::::::TT:::::TII::::::IIC:::::CCCCCCCC::::CEE::::::EEEEEEEEE::::E + N::::::::::N N::::::NO::::::O O::::::OTTTTTT T:::::T TTTTTT I::::I C:::::C CCCCCC E:::::E EEEEEE + N:::::::::::N N::::::NO:::::O O:::::O T:::::T I::::IC:::::C E:::::E + N:::::::N::::N N::::::NO:::::O O:::::O T:::::T I::::IC:::::C E::::::EEEEEEEEEE + N::::::N N::::N N::::::NO:::::O O:::::O T:::::T I::::IC:::::C E:::::::::::::::E + N::::::N N::::N:::::::NO:::::O O:::::O T:::::T I::::IC:::::C E:::::::::::::::E + N::::::N N:::::::::::NO:::::O O:::::O T:::::T I::::IC:::::C E::::::EEEEEEEEEE + N::::::N N::::::::::NO:::::O O:::::O T:::::T I::::IC:::::C E:::::E + N::::::N N:::::::::NO::::::O O::::::O T:::::T I::::I C:::::C CCCCCC E:::::E EEEEEE + N::::::N N::::::::NO:::::::OOO:::::::O TT:::::::TT II::::::IIC:::::CCCCCCCC::::CEE::::::EEEEEEEE:::::E + N::::::N N:::::::N OO:::::::::::::OO T:::::::::T I::::::::I CC:::::::::::::::CE::::::::::::::::::::E + N::::::N N::::::N OO:::::::::OO T:::::::::T I::::::::I CCC::::::::::::CE::::::::::::::::::::E + NNNNNNNN NNNNNNN OOOOOOOOO TTTTTTTTTTT IIIIIIIIII CCCCCCCCCCCCCEEEEEEEEEEEEEEEEEEEEEE + + _ _ _____ ______ + | | | |/ ____| ____| + | | | | (___ | |__ + | | | |\___ \| __| + | |__| |____) | |____ + \____/|_____/|______| + + ____ __ __ _ _ _____ _______ _____ _____ ______ _____ _ _ _ _ + / __ \| \/ | \ | |_ _|__ __| __ \ /\ / ____| ____| | __ \| | | | \ | | + | | | | \ / | \| | | | | | | |__) | / \ | | | |__ ______| |__) | | | | \| | + | | | | |\/| | . ` | | | | | | _ / / /\ \| | | __|______| _ /| | | | . ` | + | |__| | | | | |\ |_| |_ | | | | \ \ / ____ \ |____| |____ | | \ \| |__| | |\ | + \____/|_| |_|_| \_|_____| |_| |_| \_\/_/ \_\_____|______| |_| \_\\____/|_| \_| + + + Due to a variety of edge cases we've encountered, ROCm Systems Profiller now requires that binary rewritten + executables and libraries be launched with the 'rocprof-sys-run' executable. + + In order to launch the executable with 'rocprof-sys-run', prefix the current command with 'rocprof-sys-run' + and a standalone double hyphen ('--'). + + For MPI applications, place 'rocprof-sys-run --' after the MPI command. + E.g.: + + + mpirun -n 2 + + should be: + + rocprof-sys-run -- + mpirun -n 2 rocprof-sys-run -- + + Note: the command-line arguments passed to 'rocprof-sys-run' (which are specified before the double hyphen) will override configuration variables + and/or any configuration values specified to 'rocprof-sys-instrument' via the '--config' or '--env' options. + E.g.: + + $ rocprof-sys-instrument -o ./sleep.inst --env OMNITRACE_SAMPLING_DELAY=5.0 -- sleep + $ echo "OMNITRACE_SAMPLING_FREQ = 500" > omnitrace.cfg + $ export OMNITRACE_CONFIG_FILE=omnitrace.cfg + $ rocprof-sys-run --sampling-freq=100 --sampling-delay=1.0 -- ./sleep.inst 10 + + In the first command, a default sampling delay of 5 seconds in embedded into the instrumented 'sleep.inst'. + In the second command, the sampling frequency will be set to 500 interrupts per second when ROCm Systems Profiller reads the config file + In the fourth command, the sampling frequency and sampling delay are overridden to 100 interrupts per second and 1 second, respectively, when sleep.inst runs + + Thanks for using ROCm Systems Profiler and happy optimizing! + )notice"; + + // emit notice + std::cerr << _notice << std::endl; + + std::quick_exit(EXIT_FAILURE); +} + +bool _handle_preload = omnitrace_preload(); +main_func_t main_real = nullptr; +} // namespace +} // namespace dl +} // namespace omnitrace + +extern "C" +{ + int omnitrace_main(int argc, char** argv, char** envp) OMNITRACE_INTERNAL_API; + void omnitrace_set_main(main_func_t) OMNITRACE_INTERNAL_API; + + void omnitrace_set_main(main_func_t _main_real) + { + ::omnitrace::dl::main_real = _main_real; + } + + int omnitrace_main(int argc, char** argv, char** envp) + { + OMNITRACE_DL_LOG(0, "%s\n", __FUNCTION__); + using ::omnitrace::common::get_env; + using ::omnitrace::dl::get_default_mode; + + // prevent re-entry + static int _reentry = 0; + if(_reentry > 0) return -1; + _reentry = 1; + + if(!::omnitrace::dl::main_real) + throw std::runtime_error("[omnitrace][dl] Unsuccessful wrapping of main: " + "nullptr to real main function"); + + if(envp) + { + size_t _idx = 0; + while(envp[_idx] != nullptr) + { + auto _env_v = std::string_view{ envp[_idx++] }; + if(_env_v.find("OMNITRACE") != 0 && + _env_v.find("librocprof-sys") == std::string_view::npos) + continue; + auto _pos = _env_v.find('='); + if(_pos < _env_v.length()) + { + auto _var = std::string{ _env_v }.substr(0, _pos); + auto _val = std::string{ _env_v }.substr(_pos + 1); + OMNITRACE_DL_LOG(1, "%s(%s, %s)\n", "omnitrace_set_env", _var.c_str(), + _val.c_str()); + setenv(_var.c_str(), _val.c_str(), 0); + } + } + } + + auto _mode = get_env("OMNITRACE_MODE", get_default_mode()); + omnitrace_init(_mode.c_str(), + dl::get_instrumented() == dl::InstrumentMode::BinaryRewrite, + argv[0]); + + int ret = (*::omnitrace::dl::main_real)(argc, argv, envp); + + omnitrace_pop_trace(basename(argv[0])); + omnitrace_finalize(); + + return ret; + } +} diff --git a/source/lib/omnitrace-rt/CMakeLists.txt b/source/lib/omnitrace-rt/CMakeLists.txt index c189d4d29..2481a12af 100644 --- a/source/lib/omnitrace-rt/CMakeLists.txt +++ b/source/lib/omnitrace-rt/CMakeLists.txt @@ -91,48 +91,48 @@ if(UNIX) endif() endif() -add_library(omnitrace-rt-library SHARED) -add_library(omnitrace::omnitrace-rt-library ALIAS omnitrace-rt-library) +add_library(rocprofsys-rt-library SHARED) +add_library(rocprofsys::rocprofsys-rt-library ALIAS rocprofsys-rt-library) -target_sources(omnitrace-rt-library PRIVATE ${SRC_LIST}) +target_sources(rocprofsys-rt-library PRIVATE ${SRC_LIST}) target_include_directories( - omnitrace-rt-library PRIVATE $ - $) -target_compile_definitions(omnitrace-rt-library PRIVATE ${UNIFIED_DEFINES}) + rocprofsys-rt-library PRIVATE $ + $) +target_compile_definitions(rocprofsys-rt-library PRIVATE ${UNIFIED_DEFINES}) target_link_libraries( - omnitrace-rt-library + rocprofsys-rt-library PUBLIC $ - PRIVATE omnitrace::omnitrace-threading) + PRIVATE rocprofsys::rocprofsys-threading) -add_target_cxx_flag_if_avail(omnitrace-rt-library "-g3") +add_target_cxx_flag_if_avail(rocprofsys-rt-library "-g3") set_target_properties( - omnitrace-rt-library - PROPERTIES OUTPUT_NAME omnitrace-rt + rocprofsys-rt-library + PROPERTIES OUTPUT_NAME rocprof-sys-rt VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} BUILD_RPATH "\$ORIGIN" INSTALL_RPATH "\$ORIGIN") -omnitrace_strip_target(omnitrace-rt-library) +omnitrace_strip_target(rocprofsys-rt-library) -install(TARGETS omnitrace-rt-library DESTINATION ${CMAKE_INSTALL_LIBDIR}) +install(TARGETS rocprofsys-rt-library DESTINATION ${CMAKE_INSTALL_LIBDIR}) if(NOT EXISTS ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}) file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}) endif() add_custom_target( - omnitrace-rt-library-dyninstAPI_RT-symlink ALL - ${CMAKE_COMMAND} -E create_symlink ../$ + rocprofsys-rt-library-dyninstAPI_RT-symlink ALL + ${CMAKE_COMMAND} -E create_symlink ../$ ${CMAKE_SHARED_LIBRARY_PREFIX}dyninstAPI_RT${CMAKE_SHARED_LIBRARY_SUFFIX} WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME} - DEPENDS omnitrace-rt-library + DEPENDS rocprofsys-rt-library COMMENT - "Creating ${CMAKE_SHARED_LIBRARY_PREFIX}dyninstAPI_RT${CMAKE_SHARED_LIBRARY_SUFFIX} to omnitrace-rt..." + "Creating ${CMAKE_SHARED_LIBRARY_PREFIX}dyninstAPI_RT${CMAKE_SHARED_LIBRARY_SUFFIX} to rocprofsys-rt..." ) install( FILES ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}/${CMAKE_SHARED_LIBRARY_PREFIX}dyninstAPI_RT${CMAKE_SHARED_LIBRARY_SUFFIX} - DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}) + DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PACKAGE_NAME}) diff --git a/source/lib/omnitrace-user/CMakeLists.txt b/source/lib/omnitrace-user/CMakeLists.txt index 112f756ee..04f47aefb 100644 --- a/source/lib/omnitrace-user/CMakeLists.txt +++ b/source/lib/omnitrace-user/CMakeLists.txt @@ -1,6 +1,6 @@ # ------------------------------------------------------------------------------# # -# omnitrace user library +# rocprofsys user library # # ------------------------------------------------------------------------------# @@ -10,8 +10,8 @@ set(BUILD_RPATH_USE_ORIGIN ON) set(CMAKE_CXX_VISIBILITY_PRESET "hidden") set(CMAKE_VISIBILITY_INLINES_HIDDEN ON) -add_library(omnitrace-user-library SHARED) -add_library(omnitrace::omnitrace-user-library ALIAS omnitrace-user-library) +add_library(rocprofsys-user-library SHARED) +add_library(rocprofsys::rocprofsys-user-library ALIAS rocprofsys-user-library) set(_user_headers ${CMAKE_CURRENT_SOURCE_DIR}/omnitrace/user.h @@ -21,34 +21,37 @@ set(_user_headers set(_user_sources ${CMAKE_CURRENT_SOURCE_DIR}/user.cpp) -target_sources(omnitrace-user-library PRIVATE ${_user_sources} ${_user_headers}) +target_sources(rocprofsys-user-library PRIVATE ${_user_sources} ${_user_headers}) target_include_directories( - omnitrace-user-library PUBLIC $ - $) -target_link_libraries(omnitrace-user-library - PRIVATE $) + rocprofsys-user-library PUBLIC $ + $) +target_link_libraries( + rocprofsys-user-library + PRIVATE $) set_target_properties( - omnitrace-user-library - PROPERTIES OUTPUT_NAME omnitrace-user + rocprofsys-user-library + PROPERTIES OUTPUT_NAME rocprof-sys-user VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} POSITION_INDEPENDENT_CODE ON BUILD_RPATH "\$ORIGIN" INSTALL_RPATH "\$ORIGIN") -omnitrace_strip_target(omnitrace-user-library) +omnitrace_strip_target(rocprofsys-user-library) foreach(_HEADER ${_user_headers}) + string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/omnitrace/" + "${CMAKE_CURRENT_SOURCE_DIR}/${PACKAGE_NAME}/" _DEST ${_HEADER}) string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" - "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/" _DEST - "${_HEADER}") + "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/" _DEST "${_DEST}") + configure_file(${_HEADER} ${_DEST} COPYONLY) endforeach() -install(FILES ${_user_headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/omnitrace) +install(FILES ${_user_headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PACKAGE_NAME}) install( - TARGETS omnitrace-user-library - EXPORT omnitrace-library-targets + TARGETS rocprofsys-user-library + EXPORT rocprofsys-library-targets DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/source/lib/omnitrace-user/omnitrace/types.h b/source/lib/omnitrace-user/omnitrace/types.h index 1a8498fe9..839e1caf9 100644 --- a/source/lib/omnitrace-user/omnitrace/types.h +++ b/source/lib/omnitrace-user/omnitrace/types.h @@ -99,7 +99,7 @@ extern "C" OMNITRACE_USER_ERROR_NO_BINDING, ///< Function pointer was not assigned OMNITRACE_USER_ERROR_BAD_VALUE, ///< Provided value was invalid OMNITRACE_USER_ERROR_INVALID_CATEGORY, ///< Invalid user binding category - OMNITRACE_USER_ERROR_INTERNAL, ///< Internal error occurred within libomnitrace + OMNITRACE_USER_ERROR_INTERNAL, ///< Internal error occurred within librocprof-sys OMNITRACE_USER_ERROR_LAST } omnitrace_user_error_t; diff --git a/source/lib/omnitrace/CMakeLists.txt b/source/lib/omnitrace/CMakeLists.txt index 4928a85e7..420bf897e 100644 --- a/source/lib/omnitrace/CMakeLists.txt +++ b/source/lib/omnitrace/CMakeLists.txt @@ -1,64 +1,64 @@ # ------------------------------------------------------------------------------# # -# omnitrace object library +# rocprofsys object library # # ------------------------------------------------------------------------------# -add_library(omnitrace-object-library OBJECT) -add_library(omnitrace::omnitrace-object-library ALIAS omnitrace-object-library) +add_library(rocprofsys-object-library OBJECT) +add_library(rocprofsys::rocprofsys-object-library ALIAS rocprofsys-object-library) target_sources( - omnitrace-object-library + rocprofsys-object-library PRIVATE ${CMAKE_CURRENT_LIST_DIR}/library.cpp ${CMAKE_CURRENT_LIST_DIR}/regions.cpp ${CMAKE_CURRENT_LIST_DIR}/progress.cpp ${CMAKE_CURRENT_LIST_DIR}/api.cpp ${CMAKE_CURRENT_LIST_DIR}/timeout.cpp ${CMAKE_CURRENT_LIST_DIR}/api.hpp) add_subdirectory(library) -target_link_libraries(omnitrace-object-library - PRIVATE omnitrace::omnitrace-interface-library) +target_link_libraries(rocprofsys-object-library + PRIVATE rocprofsys::rocprofsys-interface-library) # ------------------------------------------------------------------------------# # -# omnitrace static library +# rocprofsys static library # # ------------------------------------------------------------------------------# -add_library(omnitrace-static-library STATIC $) -add_library(omnitrace::libomnitrace-static ALIAS omnitrace-static-library) +add_library(rocprofsys-static-library STATIC $) +add_library(rocprofsys::librocprofsys-static ALIAS rocprofsys-static-library) target_link_libraries( - omnitrace-static-library - PRIVATE omnitrace::omnitrace-interface-library omnitrace::omnitrace-core - omnitrace::omnitrace-binary) + rocprofsys-static-library + PRIVATE rocprofsys::rocprofsys-interface-library rocprofsys::rocprofsys-core + rocprofsys::rocprofsys-binary) -set_target_properties(omnitrace-static-library PROPERTIES OUTPUT_NAME omnitrace) +set_target_properties(rocprofsys-static-library PROPERTIES OUTPUT_NAME rocprof-sys) # ------------------------------------------------------------------------------# # -# omnitrace shared library +# rocprofsys shared library # # ------------------------------------------------------------------------------# -add_library(omnitrace-shared-library SHARED $) -add_library(omnitrace::libomnitrace-shared ALIAS omnitrace-shared-library) -add_library(omnitrace::omnitrace-library ALIAS omnitrace-shared-library) +add_library(rocprofsys-shared-library SHARED $) +add_library(rocprofsys::librocprofsys-shared ALIAS rocprofsys-shared-library) +add_library(rocprofsys::rocprofsys-library ALIAS rocprofsys-shared-library) target_link_libraries( - omnitrace-shared-library - PRIVATE omnitrace::omnitrace-interface-library omnitrace::omnitrace-core - omnitrace::omnitrace-binary) + rocprofsys-shared-library + PRIVATE rocprofsys::rocprofsys-interface-library rocprofsys::rocprofsys-core + rocprofsys::rocprofsys-binary) set_target_properties( - omnitrace-shared-library - PROPERTIES OUTPUT_NAME omnitrace + rocprofsys-shared-library + PROPERTIES OUTPUT_NAME rocprof-sys VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} INSTALL_RPATH "${OMNITRACE_LIB_INSTALL_RPATH}") -omnitrace_strip_target(omnitrace-shared-library) +omnitrace_strip_target(rocprofsys-shared-library) install( - TARGETS omnitrace-shared-library + TARGETS rocprofsys-shared-library DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL) diff --git a/source/lib/omnitrace/api.hpp b/source/lib/omnitrace/api.hpp index 4cb8debf5..e5a2d70bd 100644 --- a/source/lib/omnitrace/api.hpp +++ b/source/lib/omnitrace/api.hpp @@ -44,7 +44,7 @@ extern "C" /// shuts down all tooling and generates output void omnitrace_finalize(void) OMNITRACE_PUBLIC_API; - /// remove libomnitrace from LD_PRELOAD + /// remove librocprof-sys from LD_PRELOAD void omnitrace_reset_preload(void) OMNITRACE_PUBLIC_API; /// sets an environment variable diff --git a/source/lib/omnitrace/library.cpp b/source/lib/omnitrace/library.cpp index 1086989c0..e4f410412 100644 --- a/source/lib/omnitrace/library.cpp +++ b/source/lib/omnitrace/library.cpp @@ -647,12 +647,12 @@ omnitrace_reset_preload_hidden(void) { tim::set_env("OMNITRACE_PRELOAD", "0", 1); auto&& _preload_libs = common::get_env("LD_PRELOAD", std::string{}); - if(_preload_libs.find("libomnitrace") != std::string::npos) + if(_preload_libs.find("librocprof-sys") != std::string::npos) { auto _modified_preload = std::string{}; for(const auto& itr : delimit(_preload_libs, ":")) { - if(itr.find("libomnitrace") != std::string::npos) continue; + if(itr.find("librocprof-sys") != std::string::npos) continue; _modified_preload += common::join("", ":", itr); } if(!_modified_preload.empty() && _modified_preload.find(':') == 0) diff --git a/source/lib/omnitrace/library/CMakeLists.txt b/source/lib/omnitrace/library/CMakeLists.txt index 60f6b4f61..aa4d2f8a8 100644 --- a/source/lib/omnitrace/library/CMakeLists.txt +++ b/source/lib/omnitrace/library/CMakeLists.txt @@ -32,29 +32,29 @@ set(library_headers ${CMAKE_CURRENT_LIST_DIR}/thread_info.hpp ${CMAKE_CURRENT_LIST_DIR}/tracing.hpp) -target_sources(omnitrace-object-library PRIVATE ${library_sources} ${library_headers}) +target_sources(rocprofsys-object-library PRIVATE ${library_sources} ${library_headers}) if(OMNITRACE_USE_ROCTRACER OR OMNITRACE_USE_ROCPROFILER) - target_sources(omnitrace-object-library PRIVATE ${CMAKE_CURRENT_LIST_DIR}/rocm.cpp) + target_sources(rocprofsys-object-library PRIVATE ${CMAKE_CURRENT_LIST_DIR}/rocm.cpp) endif() if(OMNITRACE_USE_ROCTRACER) - target_sources(omnitrace-object-library + target_sources(rocprofsys-object-library PRIVATE ${CMAKE_CURRENT_LIST_DIR}/roctracer.cpp) endif() if(OMNITRACE_USE_RCCL) - target_sources(omnitrace-object-library PRIVATE ${CMAKE_CURRENT_LIST_DIR}/rcclp.cpp) + target_sources(rocprofsys-object-library PRIVATE ${CMAKE_CURRENT_LIST_DIR}/rcclp.cpp) endif() if(OMNITRACE_USE_ROCPROFILER) target_sources( - omnitrace-object-library PRIVATE ${CMAKE_CURRENT_LIST_DIR}/rocprofiler.cpp - ${CMAKE_CURRENT_LIST_DIR}/rocprofiler.hpp) + rocprofsys-object-library PRIVATE ${CMAKE_CURRENT_LIST_DIR}/rocprofiler.cpp + ${CMAKE_CURRENT_LIST_DIR}/rocprofiler.hpp) endif() if(OMNITRACE_USE_ROCM_SMI) - target_sources(omnitrace-object-library + target_sources(rocprofsys-object-library PRIVATE ${CMAKE_CURRENT_LIST_DIR}/rocm_smi.cpp) endif() diff --git a/source/lib/omnitrace/library/causal/CMakeLists.txt b/source/lib/omnitrace/library/causal/CMakeLists.txt index d00fe85fc..b8d4b5d71 100644 --- a/source/lib/omnitrace/library/causal/CMakeLists.txt +++ b/source/lib/omnitrace/library/causal/CMakeLists.txt @@ -9,6 +9,6 @@ set(causal_headers ${CMAKE_CURRENT_LIST_DIR}/experiment.hpp ${CMAKE_CURRENT_LIST_DIR}/sample_data.hpp ${CMAKE_CURRENT_LIST_DIR}/sampling.hpp ${CMAKE_CURRENT_LIST_DIR}/selected_entry.hpp) -target_sources(omnitrace-object-library PRIVATE ${causal_sources} ${causal_headers}) +target_sources(rocprofsys-object-library PRIVATE ${causal_sources} ${causal_headers}) add_subdirectory(components) diff --git a/source/lib/omnitrace/library/causal/components/CMakeLists.txt b/source/lib/omnitrace/library/causal/components/CMakeLists.txt index ef71d103c..17f154892 100644 --- a/source/lib/omnitrace/library/causal/components/CMakeLists.txt +++ b/source/lib/omnitrace/library/causal/components/CMakeLists.txt @@ -13,4 +13,5 @@ set(component_headers ${CMAKE_CURRENT_LIST_DIR}/progress_point.hpp ${CMAKE_CURRENT_LIST_DIR}/unblocking_gotcha.hpp) -target_sources(omnitrace-object-library PRIVATE ${component_sources} ${component_headers}) +target_sources(rocprofsys-object-library PRIVATE ${component_sources} + ${component_headers}) diff --git a/source/lib/omnitrace/library/causal/data.cpp b/source/lib/omnitrace/library/causal/data.cpp index b614add65..25dbeebb5 100644 --- a/source/lib/omnitrace/library/causal/data.cpp +++ b/source/lib/omnitrace/library/causal/data.cpp @@ -260,7 +260,7 @@ std::pair& get_cached_binary_info() { static auto _v = []() { - // get the linked binaries for the exe (excluding ones from libomnitrace) + // get the linked binaries for the exe (excluding ones from librocprof-sys) auto _link_map = binary::get_link_map(); auto _files = std::vector{}; _files.reserve(_link_map.size()); @@ -634,11 +634,11 @@ perform_experiment_impl(std::shared_ptr> _started) // NOLINT } std::cerr << std::flush; - // if launched via omnitrace-causal, allow end-to-end runs that do not + // if launched via rocprof-sys-causal, allow end-to-end runs that do not // start experiments auto _omni_causal_launcher = get_env("OMNITRACE_LAUNCHER", "", false) == - "omnitrace-causal"; + "rocprof-sys-causal"; if(!(get_causal_end_to_end() && _omni_causal_launcher)) { diff --git a/source/lib/omnitrace/library/components/CMakeLists.txt b/source/lib/omnitrace/library/components/CMakeLists.txt index efc8915e8..4d1e3efd7 100644 --- a/source/lib/omnitrace/library/components/CMakeLists.txt +++ b/source/lib/omnitrace/library/components/CMakeLists.txt @@ -34,18 +34,19 @@ set(component_headers ${CMAKE_CURRENT_LIST_DIR}/pthread_create_gotcha.hpp ${CMAKE_CURRENT_LIST_DIR}/pthread_mutex_gotcha.hpp) -target_sources(omnitrace-object-library PRIVATE ${component_sources} ${component_headers}) +target_sources(rocprofsys-object-library PRIVATE ${component_sources} + ${component_headers}) if(OMNITRACE_USE_ROCPROFILER) - target_sources(omnitrace-object-library + target_sources(rocprofsys-object-library PRIVATE ${CMAKE_CURRENT_LIST_DIR}/rocprofiler.cpp) endif() if(OMNITRACE_USE_ROCTRACER) - target_sources(omnitrace-object-library + target_sources(rocprofsys-object-library PRIVATE ${CMAKE_CURRENT_LIST_DIR}/roctracer.cpp) endif() if(OMNITRACE_USE_RCCL) - target_sources(omnitrace-object-library PRIVATE ${CMAKE_CURRENT_LIST_DIR}/rcclp.cpp) + target_sources(rocprofsys-object-library PRIVATE ${CMAKE_CURRENT_LIST_DIR}/rcclp.cpp) endif() diff --git a/source/lib/omnitrace/library/coverage/CMakeLists.txt b/source/lib/omnitrace/library/coverage/CMakeLists.txt index bd8a386cb..294f7f669 100644 --- a/source/lib/omnitrace/library/coverage/CMakeLists.txt +++ b/source/lib/omnitrace/library/coverage/CMakeLists.txt @@ -2,4 +2,4 @@ set(coverage_sources) set(coverage_headers ${CMAKE_CURRENT_LIST_DIR}/impl.hpp) -target_sources(omnitrace-object-library PRIVATE ${coverage_sources} ${coverage_headers}) +target_sources(rocprofsys-object-library PRIVATE ${coverage_sources} ${coverage_headers}) diff --git a/source/lib/omnitrace/library/kokkosp.cpp b/source/lib/omnitrace/library/kokkosp.cpp index df19b5991..6b084460d 100644 --- a/source/lib/omnitrace/library/kokkosp.cpp +++ b/source/lib/omnitrace/library/kokkosp.cpp @@ -216,7 +216,7 @@ extern "C" { auto _kokkos_profile_lib = tim::get_env("KOKKOS_PROFILE_LIBRARY"); - if(_kokkos_profile_lib.find("libomnitrace.so") != std::string::npos) + if(_kokkos_profile_lib.find("librocprof-sys.so") != std::string::npos) { auto _maps = tim::procfs::read_maps(tim::process::get_id()); auto _libs = std::set{}; @@ -229,17 +229,17 @@ extern "C" } for(const auto& itr : _libs) { - if(itr.find("libomnitrace-dl.so") != std::string::npos) + if(itr.find("librocprof-sys-dl.so") != std::string::npos) { std::stringstream _libs_str{}; for(const auto& litr : _libs) _libs_str << " " << litr << "\n"; OMNITRACE_ABORT( - "%s was invoked with libomnitrace.so as the " + "%s was invoked with librocprof-sys.so as the " "KOKKOS_PROFILE_LIBRARY.\n" - "However, libomnitrace-dl.so has already been loaded by the " - "process.\nTo avoid duplicate collections culminating is an " - "error, please set KOKKOS_PROFILE_LIBRARY=%s.\nLoaded " + "However, librocprof-sys-dl.so has already been loaded by " + "the process.\nTo avoid duplicate collections culminating " + "is an error, please set KOKKOS_PROFILE_LIBRARY=%s.\nLoaded " "libraries:\n%s", __FUNCTION__, itr.c_str(), _libs_str.str().c_str()); } diff --git a/source/lib/omnitrace/library/rocm/CMakeLists.txt b/source/lib/omnitrace/library/rocm/CMakeLists.txt index 357ca9383..b47eabebf 100644 --- a/source/lib/omnitrace/library/rocm/CMakeLists.txt +++ b/source/lib/omnitrace/library/rocm/CMakeLists.txt @@ -1,6 +1,6 @@ # if(OMNITRACE_USE_ROCPROFILER OR OMNITRACE_USE_ROCTRACER) target_sources( - omnitrace-object-library PRIVATE ${CMAKE_CURRENT_LIST_DIR}/hsa_rsrc_factory.hpp - ${CMAKE_CURRENT_LIST_DIR}/hsa_rsrc_factory.cpp) + rocprofsys-object-library PRIVATE ${CMAKE_CURRENT_LIST_DIR}/hsa_rsrc_factory.hpp + ${CMAKE_CURRENT_LIST_DIR}/hsa_rsrc_factory.cpp) endif() diff --git a/source/lib/omnitrace/library/tracing/CMakeLists.txt b/source/lib/omnitrace/library/tracing/CMakeLists.txt index b9c38d055..0a3a98ebf 100644 --- a/source/lib/omnitrace/library/tracing/CMakeLists.txt +++ b/source/lib/omnitrace/library/tracing/CMakeLists.txt @@ -2,4 +2,4 @@ set(tracing_sources ${CMAKE_CURRENT_LIST_DIR}/annotation.cpp) set(tracing_headers ${CMAKE_CURRENT_LIST_DIR}/annotation.hpp) -target_sources(omnitrace-object-library PRIVATE ${tracing_sources} ${tracing_headers}) +target_sources(rocprofsys-object-library PRIVATE ${tracing_sources} ${tracing_headers}) diff --git a/source/python/CMakeLists.txt b/source/python/CMakeLists.txt index eaad46f97..59fba76eb 100644 --- a/source/python/CMakeLists.txt +++ b/source/python/CMakeLists.txt @@ -1,6 +1,6 @@ # ######################################################################################## # -# omnitrace (Python) +# rocprofsys (Python) # # ######################################################################################## @@ -19,25 +19,25 @@ set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME python) function(OMNITRACE_CONFIGURE_PYTARGET _TARGET _VERSION) - add_library(omnitrace::${_TARGET} ALIAS ${_TARGET}) - target_link_libraries(${_TARGET} PRIVATE libpyomnitrace-interface) - add_dependencies(libpyomnitrace ${_TARGET}) + add_library(rocprofsys::${_TARGET} ALIAS ${_TARGET}) + target_link_libraries(${_TARGET} PRIVATE libpyrocprofsys-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,71 @@ 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(rocprofsys-python-compile-options INTERFACE) +add_library(rocprofsys::rocprofsys-python-compile-options ALIAS + rocprofsys-python-compile-options) add_target_cxx_flag_if_avail( - omnitrace-python-compile-options "-Wno-unused-value" "-Wno-range-loop-analysis" + rocprofsys-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(libpyrocprofsys-interface INTERFACE) target_link_libraries( - libpyomnitrace-interface + libpyrocprofsys-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) - -omnitrace_target_compile_definitions(libpyomnitrace-interface + rocprofsys::rocprofsys-headers + rocprofsys::rocprofsys-compile-options + rocprofsys::rocprofsys-static-libgcc-optional + rocprofsys::rocprofsys-lto + rocprofsys::rocprofsys-dl-library + rocprofsys::rocprofsys-user-library + rocprofsys::rocprofsys-python + rocprofsys::rocprofsys-python-compile-options) + +omnitrace_target_compile_definitions(libpyrocprofsys-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/cmake/ConfigPython.cmake b/source/python/cmake/ConfigPython.cmake index 06bcc64e9..824995424 100644 --- a/source/python/cmake/ConfigPython.cmake +++ b/source/python/cmake/ConfigPython.cmake @@ -54,14 +54,14 @@ 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) +omnitrace_add_feature(OMNITRACE_PYTHON_VERSIONS "Python version for rocprofsys" DOC) option(PYBIND11_INSTALL "Enable Pybind11 installation" OFF) diff --git a/source/python/gui/README.md b/source/python/gui/README.md index 0851fb127..369f3bdc0 100644 --- a/source/python/gui/README.md +++ b/source/python/gui/README.md @@ -13,13 +13,13 @@ python -m pip install . #### Console Script ```console -omnitrace-causal-plot +rocprof-sys-causal-plot ``` #### Module ```console -python -m omnitrace_causal_viewer +python -m rocprof-sys_causal_viewer ``` ### From source tree diff --git a/source/python/gui/setup.cfg b/source/python/gui/setup.cfg index b4d1b3f00..eb115be50 100644 --- a/source/python/gui/setup.cfg +++ b/source/python/gui/setup.cfg @@ -1,5 +1,5 @@ [metadata] -name = omnitrace-causal-viewer +name = rocprof-sys-causal-viewer url = https://github.com/ROCm/omnitrace download_url = https://github.com/ROCm/omnitrace.git maintainer = AMD Research @@ -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 diff --git a/source/python/gui/setup.py b/source/python/gui/setup.py index e35d58260..c85667acd 100644 --- a/source/python/gui/setup.py +++ b/source/python/gui/setup.py @@ -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 @@ def parse_requirements(fname="requirements.txt"): 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" + ] }, ) diff --git a/source/python/gui/source/__main__.py b/source/python/gui/source/__main__.py index fa17d6e51..89d1f8d84 100644 --- a/source/python/gui/source/__main__.py +++ b/source/python/gui/source/__main__.py @@ -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: @@ -150,11 +150,11 @@ def main(): 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( diff --git a/source/python/libpyomnitrace.cpp b/source/python/libpyrocprofsys.cpp similarity index 96% rename from source/python/libpyomnitrace.cpp rename to source/python/libpyrocprofsys.cpp index 798038622..75971fc0a 100644 --- a/source/python/libpyomnitrace.cpp +++ b/source/python/libpyrocprofsys.cpp @@ -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,17 +73,17 @@ 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"); + 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,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,42 +140,42 @@ 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); pyuser::generate(omni); auto _python_path = tim::get_env("OMNITRACE_PATH", std::string{}, false); - auto _libpath = std::string{ "libomnitrace-dl.so" }; + 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); // 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 { @@ -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 95% rename from source/python/libpyomnitrace.hpp rename to source/python/libpyrocprofsys.hpp index 353a0695b..421311c3b 100644 --- a/source/python/libpyomnitrace.hpp +++ b/source/python/libpyrocprofsys.hpp @@ -21,6 +21,7 @@ // SOFTWARE. #pragma once +#define PYBIND11_DETAILED_ERROR_MESSAGES #include #include @@ -48,9 +49,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 --