diff --git a/projects/rocprofiler-systems/.cmake-format.yaml b/projects/rocprofiler-systems/.cmake-format.yaml index 67c19c1513..9aa254aec7 100644 --- a/projects/rocprofiler-systems/.cmake-format.yaml +++ b/projects/rocprofiler-systems/.cmake-format.yaml @@ -1,6 +1,6 @@ parse: additional_commands: - hosttrace_checkout_git_submodule: + omnitrace_checkout_git_submodule: flags: - RECURSIVE kwargs: @@ -10,11 +10,11 @@ parse: REPO_URL: '*' REPO_BRANCH: '*' ADDITIONAL_COMMANDS: '*' - hosttrace_save_variables: + omnitrace_save_variables: kwargs: VARIABLES: '*' CONDITION: '*' - hosttrace_restore_variables: + omnitrace_restore_variables: kwargs: VARIABLES: '*' CONDITION: '*' diff --git a/projects/rocprofiler-systems/.github/workflows/linux-ci.yml b/projects/rocprofiler-systems/.github/workflows/linux-ci.yml index f40b95240f..c7f89e2232 100644 --- a/projects/rocprofiler-systems/.github/workflows/linux-ci.yml +++ b/projects/rocprofiler-systems/.github/workflows/linux-ci.yml @@ -32,8 +32,8 @@ jobs: run: echo "CC=$(echo '${{ matrix.compiler }}' | sed 's/+/c/g')" >> $GITHUB_ENV && echo "CXX=${{ matrix.compiler }}" >> $GITHUB_ENV && - echo "/opt/hosttrace/bin:${HOME}/.local/bin" >> $GITHUB_PATH && - echo "LD_LIBRARY_PATH=/opt/hosttrace/lib:${LD_LIBRARY_PATH}" >> $GITHUB_ENV + echo "/opt/omnitrace/bin:${HOME}/.local/bin" >> $GITHUB_PATH && + echo "LD_LIBRARY_PATH=/opt/omnitrace/lib:${LD_LIBRARY_PATH}" >> $GITHUB_ENV - name: Configure CMake run: @@ -43,10 +43,10 @@ jobs: -DCMAKE_C_COMPILER=$(echo '${{ matrix.compiler }}' | sed 's/+/c/g') -DCMAKE_CXX_COMPILER=${{ matrix.compiler }} -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} - -DCMAKE_INSTALL_PREFIX=/opt/hosttrace - -DHOSTTRACE_USE_MPI=${USE_MPI} - -DHOSTTRACE_USE_ROCTRACER=OFF - -DHOSTTRACE_BUILD_DYNINST=ON + -DCMAKE_INSTALL_PREFIX=/opt/omnitrace + -DOMNITRACE_USE_MPI=${USE_MPI} + -DOMNITRACE_USE_ROCTRACER=OFF + -DOMNITRACE_BUILD_DYNINST=ON -DDYNINST_BUILD_ELFUTILS=ON -DDYNINST_BUILD_LIBIBERTY=ON -DDYNINST_BUILD_SHARED_LIBS=ON @@ -63,13 +63,13 @@ jobs: - name: Test working-directory: ${{ github.workspace }}/build run: - ctest -V --output-log ${{ github.workspace }}/build/hosttrace-ctest-ubuntu-focal.log + ctest -V --output-log ${{ github.workspace }}/build/omnitrace-ctest-ubuntu-focal.log - name: Test Install run: - hosttrace --help && - hosttrace -- sleep 1 && - hosttrace -o sleep.inst -- sleep && + omnitrace --help && + omnitrace -- sleep 1 && + omnitrace -o sleep.inst -- sleep && ./sleep.inst 1 && rm ./sleep.inst @@ -78,7 +78,7 @@ jobs: with: name: ctest-log path: | - ${{ github.workspace }}/build/hosttrace-ctest-ubuntu-focal.log + ${{ github.workspace }}/build/omnitrace-ctest-ubuntu-focal.log ubuntu-bionic: runs-on: ubuntu-18.04 @@ -101,8 +101,8 @@ jobs: run: echo "CC=$(echo '${{ matrix.compiler }}' | sed 's/+/c/g')" >> $GITHUB_ENV && echo "CXX=${{ matrix.compiler }}" >> $GITHUB_ENV && - echo "/opt/hosttrace/bin:${HOME}/.local/bin" >> $GITHUB_PATH && - echo "LD_LIBRARY_PATH=/opt/hosttrace/lib:${LD_LIBRARY_PATH}" >> $GITHUB_ENV + echo "/opt/omnitrace/bin:${HOME}/.local/bin" >> $GITHUB_PATH && + echo "LD_LIBRARY_PATH=/opt/omnitrace/lib:${LD_LIBRARY_PATH}" >> $GITHUB_ENV - name: Configure CMake run: @@ -112,10 +112,10 @@ jobs: -DCMAKE_C_COMPILER=$(echo '${{ matrix.compiler }}' | sed 's/+/c/g') -DCMAKE_CXX_COMPILER=${{ matrix.compiler }} -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} - -DCMAKE_INSTALL_PREFIX=/opt/hosttrace - -DHOSTTRACE_USE_MPI=${USE_MPI} - -DHOSTTRACE_USE_ROCTRACER=OFF - -DHOSTTRACE_BUILD_DYNINST=ON + -DCMAKE_INSTALL_PREFIX=/opt/omnitrace + -DOMNITRACE_USE_MPI=${USE_MPI} + -DOMNITRACE_USE_ROCTRACER=OFF + -DOMNITRACE_BUILD_DYNINST=ON -DDYNINST_BUILD_TBB=ON -DDYNINST_BUILD_BOOST=ON -DDYNINST_BUILD_ELFUTILS=ON @@ -132,13 +132,13 @@ jobs: - name: Test working-directory: ${{ github.workspace }}/build run: - ctest -V --output-log ${{ github.workspace }}/build/hosttrace-ctest-ubuntu-bionic.log + ctest -V --output-log ${{ github.workspace }}/build/omnitrace-ctest-ubuntu-bionic.log - name: Test Install run: - hosttrace --help && - hosttrace -- sleep 1 && - hosttrace -o sleep.inst -- sleep && + omnitrace --help && + omnitrace -- sleep 1 && + omnitrace -o sleep.inst -- sleep && ./sleep.inst 1 && rm ./sleep.inst @@ -147,7 +147,7 @@ jobs: with: name: ctest-log path: | - ${{ github.workspace }}/build/hosttrace-ctest-ubuntu-bionic.log + ${{ github.workspace }}/build/omnitrace-ctest-ubuntu-bionic.log ubuntu-focal-external: runs-on: ubuntu-20.04 @@ -170,8 +170,8 @@ jobs: echo "CC=$(echo '${{ matrix.compiler }}' | sed 's/+/c/g')" >> $GITHUB_ENV && echo "CXX=${{ matrix.compiler }}" >> $GITHUB_ENV && echo "CMAKE_PREFIX_PATH=/opt/opt/dyninst:/opt/elfutils:${CMAKE_PREFIX_PATH}" >> $GITHUB_ENV && - echo "/opt/hosttrace/bin:/opt/dyninst/bin:/opt/elfutils/bin:${HOME}/.local/bin" >> $GITHUB_PATH && - echo "LD_LIBRARY_PATH=/opt/hosttrace/lib:/opt/dyninst/lib:/opt/elfutils/lib:${LD_LIBRARY_PATH}" >> $GITHUB_ENV + echo "/opt/omnitrace/bin:/opt/dyninst/bin:/opt/elfutils/bin:${HOME}/.local/bin" >> $GITHUB_PATH && + echo "LD_LIBRARY_PATH=/opt/omnitrace/lib:/opt/dyninst/lib:/opt/elfutils/lib:${LD_LIBRARY_PATH}" >> $GITHUB_ENV - name: Install ElfUtils run: @@ -206,9 +206,9 @@ jobs: -DCMAKE_C_COMPILER=$(echo '${{ matrix.compiler }}' | sed 's/+/c/g') -DCMAKE_CXX_COMPILER=${{ matrix.compiler }} -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} - -DCMAKE_INSTALL_PREFIX=/opt/hosttrace - -DHOSTTRACE_USE_MPI=OFF - -DHOSTTRACE_USE_ROCTRACER=OFF + -DCMAKE_INSTALL_PREFIX=/opt/omnitrace + -DOMNITRACE_USE_MPI=OFF + -DOMNITRACE_USE_ROCTRACER=OFF - name: Build run: @@ -221,16 +221,16 @@ jobs: - name: Test working-directory: ${{ github.workspace }}/build run: - ldd ./hosttrace && - ./hosttrace --help && - ctest -V --output-log ${{ github.workspace }}/build/hosttrace-ctest-ubuntu-focal-external.log + ldd ./omnitrace && + ./omnitrace --help && + ctest -V --output-log ${{ github.workspace }}/build/omnitrace-ctest-ubuntu-focal-external.log - name: Test Install run: - ldd $(which hosttrace) && - hosttrace --help && - hosttrace -- sleep 1 && - hosttrace -o sleep.inst -- sleep && + ldd $(which omnitrace) && + omnitrace --help && + omnitrace -- sleep 1 && + omnitrace -o sleep.inst -- sleep && ./sleep.inst 1 && rm ./sleep.inst @@ -239,7 +239,7 @@ jobs: with: name: ctest-log path: | - ${{ github.workspace }}/build/hosttrace-ctest-ubuntu-focal-external.log + ${{ github.workspace }}/build/omnitrace-ctest-ubuntu-focal-external.log ubuntu-focal-dyninst-package: runs-on: ubuntu-20.04 @@ -262,8 +262,8 @@ jobs: echo "CC=$(echo '${{ matrix.compiler }}' | sed 's/+/c/g')" >> $GITHUB_ENV && echo "CXX=${{ matrix.compiler }}" >> $GITHUB_ENV && echo "CMAKE_PREFIX_PATH=/opt/opt/dyninst:${CMAKE_PREFIX_PATH}" >> $GITHUB_ENV && - echo "/opt/hosttrace/bin:/opt/dyninst/bin:${HOME}/.local/bin" >> $GITHUB_PATH && - echo "LD_LIBRARY_PATH=/opt/hosttrace/lib:/opt/dyninst/lib:${LD_LIBRARY_PATH}" >> $GITHUB_ENV + echo "/opt/omnitrace/bin:/opt/dyninst/bin:${HOME}/.local/bin" >> $GITHUB_PATH && + echo "LD_LIBRARY_PATH=/opt/omnitrace/lib:/opt/dyninst/lib:${LD_LIBRARY_PATH}" >> $GITHUB_ENV - name: Install Dyninst run: @@ -291,9 +291,9 @@ jobs: -DCMAKE_C_COMPILER=$(echo '${{ matrix.compiler }}' | sed 's/+/c/g') -DCMAKE_CXX_COMPILER=${{ matrix.compiler }} -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} - -DCMAKE_INSTALL_PREFIX=/opt/hosttrace - -DHOSTTRACE_USE_MPI=OFF - -DHOSTTRACE_USE_ROCTRACER=OFF + -DCMAKE_INSTALL_PREFIX=/opt/omnitrace + -DOMNITRACE_USE_MPI=OFF + -DOMNITRACE_USE_ROCTRACER=OFF - name: Build run: @@ -306,16 +306,16 @@ jobs: - name: Test working-directory: ${{ github.workspace }}/build run: - ldd ./hosttrace && - ./hosttrace --help && - ctest -V --output-log ${{ github.workspace }}/build/hosttrace-ctest-ubuntu-focal-dyninst-package.log + ldd ./omnitrace && + ./omnitrace --help && + ctest -V --output-log ${{ github.workspace }}/build/omnitrace-ctest-ubuntu-focal-dyninst-package.log - name: Test Install run: - ldd $(which hosttrace) && - hosttrace --help && - hosttrace -- sleep 1 && - hosttrace -o sleep.inst -- sleep && + ldd $(which omnitrace) && + omnitrace --help && + omnitrace -- sleep 1 && + omnitrace -o sleep.inst -- sleep && ./sleep.inst 1 && rm ./sleep.inst @@ -324,4 +324,4 @@ jobs: with: name: ctest-log path: | - ${{ github.workspace }}/build/hosttrace-ctest-ubuntu-focal-dyninst-package.log + ${{ github.workspace }}/build/omnitrace-ctest-ubuntu-focal-dyninst-package.log diff --git a/projects/rocprofiler-systems/.gitignore b/projects/rocprofiler-systems/.gitignore index d50c065282..12f6880bfb 100644 --- a/projects/rocprofiler-systems/.gitignore +++ b/projects/rocprofiler-systems/.gitignore @@ -1,3 +1,6 @@ +# Edit files +*~ + # Prerequisites *.d diff --git a/projects/rocprofiler-systems/CMakeLists.txt b/projects/rocprofiler-systems/CMakeLists.txt index 1b1456ea8b..d5be7366e9 100644 --- a/projects/rocprofiler-systems/CMakeLists.txt +++ b/projects/rocprofiler-systems/CMakeLists.txt @@ -12,13 +12,20 @@ endif() if(NOT UNIX OR APPLE) message( AUTHOR_WARNING - "hosttrace only supports Linux. Configure and/or build is likely to fail") + "omnitrace 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) +string(REGEX REPLACE "(\n|\r)" "" FULL_VERSION_STRING "${FULL_VERSION_STRING}") +string(REGEX REPLACE "([0-9]+)\.([0-9]+)\.([0-9]+)(.*)" "\\1.\\2.\\3" OMNITRACE_VERSION + "${FULL_VERSION_STRING}") + project( - hosttrace + omnitrace LANGUAGES C CXX - VERSION 0.0.3) + VERSION ${OMNITRACE_VERSION} + DESCRIPTION "CPU/GPU Application tracing with static/dynamic binary instrumentation" + HOMEPAGE_URL "https://github.com/AARInternal/omnitrace") message( STATUS @@ -50,36 +57,36 @@ include(BuildSettings) # compiler flags set(CMAKE_CXX_STANDARD 17 CACHE STRING "CXX language standard") -hosttrace_add_feature(CMAKE_CXX_STANDARD "CXX language standard") -hosttrace_add_option(CMAKE_CXX_STANDARD_REQUIRED "Require C++ language standard" ON) -hosttrace_add_option(CMAKE_CXX_EXTENSIONS "Compiler specific language extensions" OFF) -hosttrace_add_option(CMAKE_INSTALL_RPATH_USE_LINK_PATH "Enable rpath to linked libraries" +omnitrace_add_feature(CMAKE_CXX_STANDARD "CXX language standard") +omnitrace_add_option(CMAKE_CXX_STANDARD_REQUIRED "Require C++ language standard" ON) +omnitrace_add_option(CMAKE_CXX_EXTENSIONS "Compiler specific language extensions" OFF) +omnitrace_add_option(CMAKE_INSTALL_RPATH_USE_LINK_PATH "Enable rpath to linked libraries" ON) -hosttrace_add_option(HOSTTRACE_USE_CLANG_TIDY "Enable clang-tidy" OFF) -hosttrace_add_option(HOSTTRACE_USE_MPI "Enable MPI support" OFF) -hosttrace_add_option(HOSTTRACE_CUSTOM_DATA_SOURCE "Enable custom data source" OFF) -hosttrace_add_option(HOSTTRACE_USE_ROCTRACER "Enable roctracer support" ON) -hosttrace_add_option(HOSTTRACE_BUILD_DYNINST "Build dyninst from submodule" OFF) -hosttrace_add_option(HOSTTRACE_USE_MPI_HEADERS +omnitrace_add_option(OMNITRACE_USE_CLANG_TIDY "Enable clang-tidy" OFF) +omnitrace_add_option(OMNITRACE_USE_MPI "Enable MPI support" OFF) +omnitrace_add_option(OMNITRACE_CUSTOM_DATA_SOURCE "Enable custom data source" OFF) +omnitrace_add_option(OMNITRACE_USE_ROCTRACER "Enable roctracer support" ON) +omnitrace_add_option(OMNITRACE_BUILD_DYNINST "Build dyninst from submodule" OFF) +omnitrace_add_option(OMNITRACE_USE_MPI_HEADERS "Enable wrapping MPI functions w/o enabling MPI dependency" OFF) include(ProcessorCount) -processorcount(HOSTTRACE_PROCESSOR_COUNT) -math(EXPR HOSTTRACE_THREAD_COUNT "8 * ${HOSTTRACE_PROCESSOR_COUNT}") -set(HOSTTRACE_MAX_THREADS - "${HOSTTRACE_THREAD_COUNT}" +processorcount(OMNITRACE_PROCESSOR_COUNT) +math(EXPR OMNITRACE_THREAD_COUNT "8 * ${OMNITRACE_PROCESSOR_COUNT}") +set(OMNITRACE_MAX_THREADS + "${OMNITRACE_THREAD_COUNT}" CACHE STRING "Maximum number of threads in the host application. Likely only needs to be increased if host app does not use thread-pool but creates many threads" ) -hosttrace_add_feature( - HOSTTRACE_MAX_THREADS +omnitrace_add_feature( + OMNITRACE_MAX_THREADS "Maximum number of total threads supported in the host application (default: 8 * nproc)" ) # ensure synced set(TIMEMORY_USE_MPI - ${HOSTTRACE_USE_MPI} + ${OMNITRACE_USE_MPI} CACHE BOOL "Enable MPI support" FORCE) # default visibility settings @@ -91,7 +98,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) include(Formatting) # format target include(Packages) # finds third-party libraries -if(HOSTTRACE_USE_ROCTRACER) +if(OMNITRACE_USE_ROCTRACER) find_package(HIP QUIET) if(HIP_VERSION_MAJOR GREATER_EQUAL 4 AND HIP_VERSION_MINOR GREATER 3) set(roctracer_kfdwrapper_LIBRARY) @@ -106,20 +113,20 @@ endif() configure_file(${PROJECT_SOURCE_DIR}/include/library/defines.hpp.in ${PROJECT_BINARY_DIR}/include/library/defines.hpp @ONLY) -hosttrace_activate_clang_tidy() +omnitrace_activate_clang_tidy() # custom visibility settings set(CMAKE_C_VISIBILITY_PRESET "hidden") set(CMAKE_CXX_VISIBILITY_PRESET "hidden") set(CMAKE_VISIBILITY_INLINES_HIDDEN ON) -if(HOSTTRACE_BUILD_LTO) +if(OMNITRACE_BUILD_LTO) set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON) endif() # ------------------------------------------------------------------------------# # -# hosttrace-library target +# omnitrace-library target # # ------------------------------------------------------------------------------# @@ -128,7 +135,7 @@ set(library_sources ${CMAKE_CURRENT_LIST_DIR}/src/library/config.cpp ${CMAKE_CURRENT_LIST_DIR}/src/library/critical_trace.cpp ${CMAKE_CURRENT_LIST_DIR}/src/library/fork_gotcha.cpp - ${CMAKE_CURRENT_LIST_DIR}/src/library/hosttrace_component.cpp + ${CMAKE_CURRENT_LIST_DIR}/src/library/omnitrace_component.cpp ${CMAKE_CURRENT_LIST_DIR}/src/library/mpi_gotcha.cpp ${CMAKE_CURRENT_LIST_DIR}/src/library/perfetto.cpp ${CMAKE_CURRENT_LIST_DIR}/src/library/ptl.cpp @@ -144,7 +151,7 @@ set(library_headers ${CMAKE_CURRENT_LIST_DIR}/include/library/critical_trace.hpp ${CMAKE_CURRENT_LIST_DIR}/include/library/debug.hpp ${CMAKE_CURRENT_LIST_DIR}/include/library/fork_gotcha.hpp - ${CMAKE_CURRENT_LIST_DIR}/include/library/hosttrace_component.hpp + ${CMAKE_CURRENT_LIST_DIR}/include/library/omnitrace_component.hpp ${CMAKE_CURRENT_LIST_DIR}/include/library/mpi_gotcha.hpp ${CMAKE_CURRENT_LIST_DIR}/include/library/perfetto.hpp ${CMAKE_CURRENT_LIST_DIR}/include/library/ptl.hpp @@ -157,86 +164,86 @@ if(NOT TIMEMORY_USE_PERFETTO) endif() -add_library(hosttrace-library SHARED ${library_sources} ${library_headers}) +add_library(omnitrace-library SHARED ${library_sources} ${library_headers}) -if(HOSTTRACE_USE_ROCTRACER) +if(OMNITRACE_USE_ROCTRACER) target_sources( - hosttrace-library + omnitrace-library PRIVATE ${CMAKE_CURRENT_LIST_DIR}/include/library/roctracer.hpp ${CMAKE_CURRENT_LIST_DIR}/src/library/roctracer.cpp ${CMAKE_CURRENT_LIST_DIR}/include/library/roctracer_callbacks.hpp ${CMAKE_CURRENT_LIST_DIR}/src/library/roctracer_callbacks.cpp) endif() -target_include_directories(hosttrace-library SYSTEM PRIVATE ${perfetto_DIR}/sdk) +target_include_directories(omnitrace-library SYSTEM PRIVATE ${perfetto_DIR}/sdk) target_compile_definitions( - hosttrace-library - PRIVATE $,CUSTOM_DATA_SOURCE,>) + omnitrace-library + PRIVATE $,CUSTOM_DATA_SOURCE,>) target_link_libraries( - hosttrace-library - PRIVATE hosttrace::hosttrace-headers - hosttrace::hosttrace-threading - hosttrace::hosttrace-compile-options - hosttrace::hosttrace-roctracer - hosttrace::hosttrace-mpi - hosttrace::hosttrace-ptl + omnitrace-library + PRIVATE omnitrace::omnitrace-headers + omnitrace::omnitrace-threading + omnitrace::omnitrace-compile-options + omnitrace::omnitrace-roctracer + omnitrace::omnitrace-mpi + omnitrace::omnitrace-ptl $ $ $ - $,hosttrace::hosttrace-sanitizer,>) + $,omnitrace::omnitrace-sanitizer,>) -if(HOSTTRACE_DYNINST_API_RT) - get_filename_component(HOSTTRACE_DYNINST_API_RT_DIR "${HOSTTRACE_DYNINST_API_RT}" +if(OMNITRACE_DYNINST_API_RT) + get_filename_component(OMNITRACE_DYNINST_API_RT_DIR "${OMNITRACE_DYNINST_API_RT}" DIRECTORY) endif() set_target_properties( - hosttrace-library PROPERTIES OUTPUT_NAME hosttrace + omnitrace-library PROPERTIES OUTPUT_NAME omnitrace INSTALL_RPATH "\$ORIGIN:\$ORIGIN/dyninst-tpls/libs") install( - TARGETS hosttrace-library + TARGETS omnitrace-library DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL) # ------------------------------------------------------------------------------# # -# hosttrace-exe target +# omnitrace-exe target # # ------------------------------------------------------------------------------# add_executable( - hosttrace-exe - ${_EXCLUDE} ${CMAKE_CURRENT_LIST_DIR}/src/hosttrace.cpp - ${CMAKE_CURRENT_LIST_DIR}/include/hosttrace.hpp - ${CMAKE_CURRENT_LIST_DIR}/src/hosttrace/details.cpp) + omnitrace-exe + ${_EXCLUDE} ${CMAKE_CURRENT_LIST_DIR}/src/omnitrace.cpp + ${CMAKE_CURRENT_LIST_DIR}/include/omnitrace.hpp + ${CMAKE_CURRENT_LIST_DIR}/src/omnitrace/details.cpp) target_link_libraries( - hosttrace-exe - PRIVATE hosttrace::hosttrace-headers - hosttrace::hosttrace-dyninst - hosttrace::hosttrace-compile-options + omnitrace-exe + PRIVATE omnitrace::omnitrace-headers + omnitrace::omnitrace-dyninst + omnitrace::omnitrace-compile-options $ - $,hosttrace::hosttrace-sanitizer,>) + $,omnitrace::omnitrace-sanitizer,>) set_target_properties( - hosttrace-exe + omnitrace-exe PROPERTIES - OUTPUT_NAME hosttrace + OUTPUT_NAME omnitrace INSTALL_RPATH_USE_LINK_PATH ON INSTALL_RPATH "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}/dyninst-tpls/lib" ) install( - TARGETS hosttrace-exe + TARGETS omnitrace-exe DESTINATION ${CMAKE_INSTALL_BINDIR} OPTIONAL) # build the timemory-avail exe -add_dependencies(hosttrace-exe timemory-avail) +add_dependencies(omnitrace-exe timemory-avail) # ------------------------------------------------------------------------------# # @@ -248,7 +255,7 @@ configure_file(${PROJECT_SOURCE_DIR}/scripts/setup-env.sh.in ${PROJECT_BINARY_DIR}/scripts/setup-env.sh @ONLY) install( - PROGRAMS ${PROJECT_SOURCE_DIR}/scripts/hosttrace-merge.jl + PROGRAMS ${PROJECT_SOURCE_DIR}/scripts/omnitrace-merge.jl DESTINATION ${CMAKE_INSTALL_BINDIR} OPTIONAL) @@ -295,4 +302,4 @@ include(ConfigCPack) # # ------------------------------------------------------------------------------# -hosttrace_print_features() +omnitrace_print_features() diff --git a/projects/rocprofiler-systems/README.md b/projects/rocprofiler-systems/README.md index e57c4bfa5d..679e0002fa 100755 --- a/projects/rocprofiler-systems/README.md +++ b/projects/rocprofiler-systems/README.md @@ -1,4 +1,4 @@ -# hosttrace: application tracing with static/dynamic binary instrumentation +# omnitrace: application tracing with static/dynamic binary instrumentation ## Dependencies @@ -32,49 +32,49 @@ Once Julia is installed, install the necessary packages (this operation only nee julia -e 'using Pkg; for name in ["JSON", "DataFrames", "Dates", "CSV", "Chain", "PrettyTables"]; Pkg.add(name); end' ``` -## Installing hosttrace +## Installing omnitrace ```shell -HOSTTRACE_ROOT=${HOME}/sw/hosttrace -git clone https://github.com/AARInternal/hosttrace-dyninst.git -cmake -B build-hosttrace -DHOSTTRACE_USE_MPI=ON -DCMAKE_INSTALL_PREFIX=${HOSTTRACE_ROOT} hosttrace-dyninst -cmake --build build-hosttrace --target all --parallel 8 -cmake --build build-hosttrace --target install -export PATH=${HOSTTRACE_ROOT}/bin:${PATH} -export LD_LIBRARY_PATH=${HOSTTRACE_ROOT}/lib64:${HOSTTRACE_ROOT}/lib:${LD_LIBRARY_PATH} +OMNITRACE_ROOT=${HOME}/sw/omnitrace +git clone https://github.com/AARInternal/omnitrace-dyninst.git +cmake -B build-omnitrace -DOMNITRACE_USE_MPI=ON -DCMAKE_INSTALL_PREFIX=${OMNITRACE_ROOT} omnitrace-dyninst +cmake --build build-omnitrace --target all --parallel 8 +cmake --build build-omnitrace --target install +export PATH=${OMNITRACE_ROOT}/bin:${PATH} +export LD_LIBRARY_PATH=${OMNITRACE_ROOT}/lib64:${OMNITRACE_ROOT}/lib:${LD_LIBRARY_PATH} ``` -## Using Hosttrace Executable +## Using Omnitrace Executable ```shell -hosttrace --help -hosttrace -- +omnitrace --help +omnitrace -- ``` -## Hosttrace Library Environment Settings +## Omnitrace Library Environment Settings | Environment Variable | Default Value | Description | |-----------------------------|-------------------------------|----------------------------------------------------------------------------------| -| `HOSTTRACE_DEBUG` | `false` | Enable debugging statements | -| `HOSTTRACE_USE_PERFETTO` | `true` | Collect profiling data via perfetto | -| `HOSTTRACE_USE_TIMEMORY` | `false` | Collection profiling data via timemory | -| `HOSTTRACE_SAMPLE_RATE` | `1` | Invoke perfetto and/or timemory once every N function calls | -| `HOSTTRACE_USE_MPI` | `true` | Label perfetto output files via rank instead of PID | -| `HOSTTRACE_OUTPUT_FILE` | `perfetto-trace.%rank%.proto` | Output file for perfetto (may use `%pid`) | -| `HOSTTRACE_BACKEND` | `"inprocess"` | Configure perfetto to use either "inprocess" data management, "system", or "all" | -| `HOSTTRACE_COMPONENTS` | `"wall_clock"` | Timemory components to activate when enabled | -| `HOSTTRACE_SHMEM_SIZE_HINT` | `40960` | Hint for perfetto shared memory buffer | -| `HOSTTRACE_BUFFER_SIZE_KB` | `1024000` | Maximum amount of memory perfetto will use to collect data in-process | +| `OMNITRACE_DEBUG` | `false` | Enable debugging statements | +| `OMNITRACE_USE_PERFETTO` | `true` | Collect profiling data via perfetto | +| `OMNITRACE_USE_TIMEMORY` | `false` | Collection profiling data via timemory | +| `OMNITRACE_SAMPLE_RATE` | `1` | Invoke perfetto and/or timemory once every N function calls | +| `OMNITRACE_USE_MPI` | `true` | Label perfetto output files via rank instead of PID | +| `OMNITRACE_OUTPUT_FILE` | `perfetto-trace.%rank%.proto` | Output file for perfetto (may use `%pid`) | +| `OMNITRACE_BACKEND` | `"inprocess"` | Configure perfetto to use either "inprocess" data management, "system", or "all" | +| `OMNITRACE_COMPONENTS` | `"wall_clock"` | Timemory components to activate when enabled | +| `OMNITRACE_SHMEM_SIZE_HINT` | `40960` | Hint for perfetto shared memory buffer | +| `OMNITRACE_BUFFER_SIZE_KB` | `1024000` | Maximum amount of memory perfetto will use to collect data in-process | | `TIMEMORY_TIME_OUTPUT` | `true` | Create unique output subdirectory with date and launch time | -### Example Hosttrace Instrumentation +### Example Omnitrace Instrumentation #### Binary Rewrite Rewrite the text section of an executable or library with instrumentation: ```shell -hosttrace -o app.inst -- /path/to/app +omnitrace -o app.inst -- /path/to/app ``` In binary rewrite mode, if you also want instrumentation in the linked libraries, you must also rewrite those libraries. @@ -82,7 +82,7 @@ Example of rewriting the functions starting with `"hip"` with instrumentation in ```shell mkdir -p ./lib -hosttrace -R '^hip' -o ./lib/libamdhip64.so.4 -- /opt/rocm/lib/libamdhip64.so.4 +omnitrace -R '^hip' -o ./lib/libamdhip64.so.4 -- /opt/rocm/lib/libamdhip64.so.4 export LD_LIBRARY_PATH=${PWD}/lib:${LD_LIBRARY_PATH} ``` @@ -96,27 +96,27 @@ or exectuable which loads the instrumented libraries normally, e.g.: ./app.inst ``` -If you want to re-define certain settings to new default in a binary rewrite, use the `--env` option. This `hosttrace` option -will set the environment variable to the given value but will not override it. E.g. the default value of `HOSTTRACE_BUFFER_SIZE_KB` +If you want to re-define certain settings to new default in a binary rewrite, use the `--env` option. This `omnitrace` option +will set the environment variable to the given value but will not override it. E.g. the default value of `OMNITRACE_BUFFER_SIZE_KB` is 1024000 KB (1 GiB): ```shell # buffer size defaults to 1024000 -hosttrace -o app.inst -- /path/to/app +omnitrace -o app.inst -- /path/to/app ./app.inst ``` -Passing `--env HOSTTRACE_BUFFER_SIZE_KB=5120000` will change the default value in `app.inst` to 5120000 KiB (5 GiB): +Passing `--env OMNITRACE_BUFFER_SIZE_KB=5120000` will change the default value in `app.inst` to 5120000 KiB (5 GiB): ```shell # defaults to 5 GiB buffer size -hosttrace -o app.inst --env HOSTTRACE_BUFFER_SIZE_KB=5120000 -- /path/to/app +omnitrace -o app.inst --env OMNITRACE_BUFFER_SIZE_KB=5120000 -- /path/to/app ./app.inst ``` ```shell # override default 5 GiB buffer size to 200 MB -export HOSTTRACE_BUFFER_SIZE_KB=200000 +export OMNITRACE_BUFFER_SIZE_KB=200000 ./app.inst ``` @@ -126,56 +126,56 @@ Runtime instrumentation will not only instrument the text section of the executa linked libraries. Thus, it may be useful to exclude those libraries via the `-ME` (module exclude) regex option. ```shell -hosttrace -- /path/to/app -hosttrace -ME '^(libhsa-runtime64|libz\\.so)' -- /path/to/app -hosttrace -E 'rocr::atomic|rocr::core|rocr::HSA' -- /path/to/app +omnitrace -- /path/to/app +omnitrace -ME '^(libhsa-runtime64|libz\\.so)' -- /path/to/app +omnitrace -E 'rocr::atomic|rocr::core|rocr::HSA' -- /path/to/app ``` ## Miscellaneous Features and Caveats - You may need to increase the default perfetto buffer size (1 GiB) to capture all the information - - E.g. `export HOSTTRACE_BUFFER_SIZE_KB=10240000` increases the buffer size to 10 GiB -- The hosttrace library has various setting which can be configured via environment variables, you can - configure these settings to custom defaults with the hosttrace command-line tool via the `--env` option - - E.g. to default to a buffer size of 5 GB, use `--env HOSTTRACE_BUFFER_SIZE_KB=5120000` + - E.g. `export OMNITRACE_BUFFER_SIZE_KB=10240000` increases the buffer size to 10 GiB +- The omnitrace library has various setting which can be configured via environment variables, you can + configure these settings to custom defaults with the omnitrace command-line tool via the `--env` option + - E.g. to default to a buffer size of 5 GB, use `--env OMNITRACE_BUFFER_SIZE_KB=5120000` - This is particularly useful in binary rewrite mode - Perfetto tooling is enabled by default - Timemory tooling is disabled by default - Enabling/disabling one of the aformentioned tools but not specifying enabling/disable the other will assume the inverse of the other's enabled state, e.g. - - `HOSTTRACE_USE_PERFETTO=OFF` yields the same result `HOSTTRACE_USE_TIMEMORY=ON` - - `HOSTTRACE_USE_PERFETTO=ON` yields the same result as `HOSTTRACE_USE_TIMEMORY=OFF` - - In order to enable _both_ timemory and perfetto, set both `HOSTTRACE_USE_TIMEMORY=ON` and `HOSTTRACE_USE_PERFETTO=ON` - - Setting `HOSTTRACE_USE_TIMEMORY=OFF` and `HOSTTRACE_USE_PERFETTO=OFF` will disable all instrumentation + - `OMNITRACE_USE_PERFETTO=OFF` yields the same result `OMNITRACE_USE_TIMEMORY=ON` + - `OMNITRACE_USE_PERFETTO=ON` yields the same result as `OMNITRACE_USE_TIMEMORY=OFF` + - In order to enable _both_ timemory and perfetto, set both `OMNITRACE_USE_TIMEMORY=ON` and `OMNITRACE_USE_PERFETTO=ON` + - Setting `OMNITRACE_USE_TIMEMORY=OFF` and `OMNITRACE_USE_PERFETTO=OFF` will disable all instrumentation - Use `timemory-avail -S` to view the various settings for timemory -- Set `HOSTTRACE_COMPONENTS=""` to control which components timemory collects +- Set `OMNITRACE_COMPONENTS=""` to control which components timemory collects - The list of components and their descriptions can be viewed via `timemory-avail -Cd` - The list of components and their string identifiers can be view via `timemory-avail -Cbs` - You can filter any `timemory-avail` results via `-r -hl` -## Hosttrace Output +## Omnitrace Output -`hosttrace` will create an output directory named `hosttrace--output`, e.g. if your executable -is named `app.inst`, the output directory will be `hosttrace-app.inst-output`. Depending on whether +`omnitrace` will create an output directory named `omnitrace--output`, e.g. if your executable +is named `app.inst`, the output directory will be `omnitrace-app.inst-output`. Depending on whether `TIMEMORY_TIME_OUTPUT=ON` (the default when perfetto is enabled), there will be a subdirectory with the date and time, e.g. `2021-09-02_01.03_PM`. Within this directory, all perfetto files will be named `perfetto-trace..proto` or -when `HOSTTRACE_USE_MPI=ON`, `perfetto-trace..proto` (assuming hosttrace was built with MPI support). +when `OMNITRACE_USE_MPI=ON`, `perfetto-trace..proto` (assuming omnitrace was built with MPI support). -You can explicitly control the output path and naming scheme of the files via the `HOSTTRACE_OUTPUT_FILE` environment +You can explicitly control the output path and naming scheme of the files via the `OMNITRACE_OUTPUT_FILE` environment variable. The special character sequences `%pid%` and `%rank%` will be replaced with the PID or MPI rank, respectively. -## Merging the traces from rocprof and hosttrace +## Merging the traces from rocprof and omnitrace > NOTE: Using `rocprof` externally is deprecated. The current version has built-in support for > recording the GPU activity and HIP API calls. If you want to use an external rocprof, either -> configure CMake with `-DHOSTTRACE_USE_ROCTRACER=OFF` or explicitly set `TIMEMORY_ROCTRACER_ENABLED=OFF` in the +> configure CMake with `-DOMNITRACE_USE_ROCTRACER=OFF` or explicitly set `TIMEMORY_ROCTRACER_ENABLED=OFF` in the > environment. -Use the `hosttrace-merge.jl` Julia script to merge rocprof and perfetto traces. +Use the `omnitrace-merge.jl` Julia script to merge rocprof and perfetto traces. ```shell export TIMEMORY_ROCTRACER_ENABLED=OFF rocprof --hip-trace --roctx-trace --stats ./app.inst -hosttrace-merge.jl results.json hosttrace-app.inst-output/2021-09-02_01.03_PM/*.proto +omnitrace-merge.jl results.json omnitrace-app.inst-output/2021-09-02_01.03_PM/*.proto ``` ## Use Perfetto tracing with System Backend @@ -185,17 +185,17 @@ In a separate window run: ```shell pkill traced traced --background -perfetto --out ./htrace.out --txt -c ${HOSTTRACE_ROOT}/share/roctrace.cfg +perfetto --out ./htrace.out --txt -c ${OMNITRACE_ROOT}/share/roctrace.cfg ``` -then in the window running the application, configure the hosttrace instrumentation to use the system backend: +then in the window running the application, configure the omnitrace instrumentation to use the system backend: ```shell -export HOSTTRACE_BACKEND_SYSTEM=1 +export OMNITRACE_BACKEND_SYSTEM=1 ``` for the merge use the `htrace.out`: ```shell -hosttrace-merge.jl results.json htrace.out +omnitrace-merge.jl results.json htrace.out ``` diff --git a/projects/rocprofiler-systems/VERSION b/projects/rocprofiler-systems/VERSION new file mode 100644 index 0000000000..81340c7e72 --- /dev/null +++ b/projects/rocprofiler-systems/VERSION @@ -0,0 +1 @@ +0.0.4 diff --git a/projects/rocprofiler-systems/cmake/BuildSettings.cmake b/projects/rocprofiler-systems/cmake/BuildSettings.cmake index f3e59323cc..96da507d60 100644 --- a/projects/rocprofiler-systems/cmake/BuildSettings.cmake +++ b/projects/rocprofiler-systems/cmake/BuildSettings.cmake @@ -12,16 +12,16 @@ include(Compilers) include(FindPackageHandleStandardArgs) include(MacroUtilities) -option(HOSTTRACE_BUILD_DEVELOPER "Extra build flags for development like -Werror" OFF) -option(HOSTTRACE_BUILD_EXTRA_OPTIMIZATIONS "Extra optimization flags" OFF) -option(HOSTTRACE_BUILD_LTO "Build with link-time optimization" OFF) -option(HOSTTRACE_USE_COMPILE_TIMING "" OFF) -option(HOSTTRACE_USE_COVERAGE "" OFF) -option(HOSTTRACE_USE_SANITIZER "" OFF) +option(OMNITRACE_BUILD_DEVELOPER "Extra build flags for development like -Werror" OFF) +option(OMNITRACE_BUILD_EXTRA_OPTIMIZATIONS "Extra optimization flags" OFF) +option(OMNITRACE_BUILD_LTO "Build with link-time optimization" OFF) +option(OMNITRACE_USE_COMPILE_TIMING "" OFF) +option(OMNITRACE_USE_COVERAGE "" OFF) +option(OMNITRACE_USE_SANITIZER "" OFF) -target_compile_definitions(hosttrace-compile-options INTERFACE $<$:DEBUG>) +target_compile_definitions(omnitrace-compile-options INTERFACE $<$:DEBUG>) -set(HOSTTRACE_SANITIZER_TYPE +set(OMNITRACE_SANITIZER_TYPE "leak" CACHE STRING "Sanitizer type") @@ -46,7 +46,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(hosttrace-compile-options INTERFACE ${dl_LIBRARY}) + target_link_libraries(omnitrace-compile-options INTERFACE ${dl_LIBRARY}) endif() # ----------------------------------------------------------------------------------------# @@ -68,56 +68,56 @@ endif() # ----------------------------------------------------------------------------------------# # extra flags for debug information in debug or optimized binaries # -hosttrace_add_interface_library( - hosttrace-compile-debuginfo +omnitrace_add_interface_library( + omnitrace-compile-debuginfo "Attempts to set best flags for more expressive profiling information in debug or optimized binaries" ) -add_target_flag_if_avail(hosttrace-compile-debuginfo "-g" "-fno-omit-frame-pointer" +add_target_flag_if_avail(omnitrace-compile-debuginfo "-g" "-fno-omit-frame-pointer" "-fno-optimize-sibling-calls") if(CMAKE_CUDA_COMPILER_IS_NVIDIA) - add_target_cuda_flag(hosttrace-compile-debuginfo "-lineinfo") + add_target_cuda_flag(omnitrace-compile-debuginfo "-lineinfo") endif() target_compile_options( - hosttrace-compile-debuginfo + omnitrace-compile-debuginfo INTERFACE $<$:$<$:-rdynamic>> $<$:$<$:-rdynamic>>) if(NOT APPLE) - target_link_options(hosttrace-compile-debuginfo INTERFACE + target_link_options(omnitrace-compile-debuginfo INTERFACE $<$:-rdynamic>) endif() if(CMAKE_CUDA_COMPILER_IS_NVIDIA) target_compile_options( - hosttrace-compile-debuginfo + omnitrace-compile-debuginfo INTERFACE $<$:$<$:-Xcompiler=-rdynamic>>) endif() if(dl_LIBRARY) - target_link_libraries(hosttrace-compile-debuginfo INTERFACE ${dl_LIBRARY}) + target_link_libraries(omnitrace-compile-debuginfo INTERFACE ${dl_LIBRARY}) endif() if(rt_LIBRARY) - target_link_libraries(hosttrace-compile-debuginfo INTERFACE ${rt_LIBRARY}) + target_link_libraries(omnitrace-compile-debuginfo INTERFACE ${rt_LIBRARY}) endif() # ----------------------------------------------------------------------------------------# # non-debug optimizations # -hosttrace_add_interface_library(hosttrace-compile-extra "Extra optimization flags") -if(NOT HOSTTRACE_USE_COVERAGE) +omnitrace_add_interface_library(omnitrace-compile-extra "Extra optimization flags") +if(NOT OMNITRACE_USE_COVERAGE) add_target_flag_if_avail( - hosttrace-compile-extra "-finline-functions" "-funroll-loops" "-ftree-vectorize" + omnitrace-compile-extra "-finline-functions" "-funroll-loops" "-ftree-vectorize" "-ftree-loop-optimize" "-ftree-loop-vectorize") endif() -if(NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" AND HOSTTRACE_BUILD_EXTRA_OPTIMIZATIONS) - target_link_libraries(hosttrace-compile-options - INTERFACE $) +if(NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" AND OMNITRACE_BUILD_EXTRA_OPTIMIZATIONS) + target_link_libraries(omnitrace-compile-options + INTERFACE $) add_flag_if_avail( "-fno-signaling-nans" "-fno-trapping-math" "-fno-signed-zeros" "-ffinite-math-only" "-fno-math-errno" "-fpredictive-commoning" @@ -130,55 +130,55 @@ endif() # add_cxx_flag_if_avail("-faligned-new") -hosttrace_save_variables(FLTO VARIABLES CMAKE_CXX_FLAGS) +omnitrace_save_variables(FLTO VARIABLES CMAKE_CXX_FLAGS) set(CMAKE_CXX_FLAGS "-flto=thin ${CMAKE_CXX_FLAGS}") -hosttrace_add_interface_library(hosttrace-lto "Adds link-time-optimization flags") -add_target_flag_if_avail(hosttrace-lto "-flto=thin") -if(NOT cxx_hosttrace_lto_flto_thin) +omnitrace_add_interface_library(omnitrace-lto "Adds link-time-optimization flags") +add_target_flag_if_avail(omnitrace-lto "-flto=thin") +if(NOT cxx_omnitrace_lto_flto_thin) set(CMAKE_CXX_FLAGS "-flto ${CMAKE_CXX_FLAGS}") - add_target_flag_if_avail(hosttrace-lto "-flto") - if(NOT cxx_hosttrace_lto_flto) - set(HOSTTRACE_BUILD_LTO OFF) + add_target_flag_if_avail(omnitrace-lto "-flto") + if(NOT cxx_omnitrace_lto_flto) + set(OMNITRACE_BUILD_LTO OFF) else() - target_link_options(hosttrace-lto INTERFACE -flto) + target_link_options(omnitrace-lto INTERFACE -flto) endif() else() - target_link_options(hosttrace-lto INTERFACE -flto=thin) + target_link_options(omnitrace-lto INTERFACE -flto=thin) endif() -if(HOSTTRACE_BUILD_LTO) - target_link_libraries(hosttrace-compile-options INTERFACE hosttrace::hosttrace-lto) +if(OMNITRACE_BUILD_LTO) + target_link_libraries(omnitrace-compile-options INTERFACE omnitrace::omnitrace-lto) endif() -hosttrace_restore_variables(FLTO VARIABLES CMAKE_CXX_FLAGS) +omnitrace_restore_variables(FLTO VARIABLES CMAKE_CXX_FLAGS) # ----------------------------------------------------------------------------------------# # print compilation timing reports (Clang compiler) # -hosttrace_add_interface_library( - hosttrace-compile-timing +omnitrace_add_interface_library( + omnitrace-compile-timing "Adds compiler flags which report compilation timing metrics") if(CMAKE_CXX_COMPILER_IS_CLANG) - add_target_flag_if_avail(hosttrace-compile-timing "-ftime-trace") - if(NOT cxx_hosttrace_compile_timing_ftime_trace) - add_target_flag_if_avail(hosttrace-compile-timing "-ftime-report") + add_target_flag_if_avail(omnitrace-compile-timing "-ftime-trace") + if(NOT cxx_omnitrace_compile_timing_ftime_trace) + add_target_flag_if_avail(omnitrace-compile-timing "-ftime-report") endif() else() - add_target_flag_if_avail(hosttrace-compile-timing "-ftime-report") + add_target_flag_if_avail(omnitrace-compile-timing "-ftime-report") endif() -if(HOSTTRACE_USE_COMPILE_TIMING) - target_link_libraries(hosttrace-compile-options INTERFACE hosttrace-compile-timing) +if(OMNITRACE_USE_COMPILE_TIMING) + target_link_libraries(omnitrace-compile-options INTERFACE omnitrace-compile-timing) endif() # ----------------------------------------------------------------------------------------# # developer build flags # -hosttrace_add_interface_library(hosttrace-develop-options "Adds developer compiler flags") -if(HOSTTRACE_BUILD_DEVELOPER) +omnitrace_add_interface_library(omnitrace-develop-options "Adds developer compiler flags") +if(OMNITRACE_BUILD_DEVELOPER) add_target_flag_if_avail( - hosttrace-develop-options + omnitrace-develop-options # "-Wabi" "-Wdouble-promotion" "-Wshadow" "-Wextra" "-Wpedantic" "-Werror" "/showIncludes") endif() @@ -186,13 +186,13 @@ endif() # ----------------------------------------------------------------------------------------# # visibility build flags # -hosttrace_add_interface_library(hosttrace-default-visibility +omnitrace_add_interface_library(omnitrace-default-visibility "Adds -fvisibility=default compiler flag") -hosttrace_add_interface_library(hosttrace-hidden-visibility +omnitrace_add_interface_library(omnitrace-hidden-visibility "Adds -fvisibility=hidden compiler flag") -add_target_flag_if_avail(hosttrace-default-visibility "-fvisibility=default") -add_target_flag_if_avail(hosttrace-hidden-visibility "-fvisibility=hidden" +add_target_flag_if_avail(omnitrace-default-visibility "-fvisibility=default") +add_target_flag_if_avail(omnitrace-hidden-visibility "-fvisibility=hidden" "-fvisibility-inlines-hidden") # ----------------------------------------------------------------------------------------# @@ -208,7 +208,7 @@ endif() # ----------------------------------------------------------------------------------------# # sanitizer # -set(HOSTTRACE_SANITIZER_TYPES +set(OMNITRACE_SANITIZER_TYPES address memory thread @@ -218,47 +218,47 @@ set(HOSTTRACE_SANITIZER_TYPES null bounds alignment) -set_property(CACHE HOSTTRACE_SANITIZER_TYPE PROPERTY STRINGS - "${HOSTTRACE_SANITIZER_TYPES}") -hosttrace_add_interface_library(hosttrace-sanitizer-compile-options +set_property(CACHE OMNITRACE_SANITIZER_TYPE PROPERTY STRINGS + "${OMNITRACE_SANITIZER_TYPES}") +omnitrace_add_interface_library(omnitrace-sanitizer-compile-options "Adds compiler flags for sanitizers") -hosttrace_add_interface_library( - hosttrace-sanitizer - "Adds compiler flags to enable ${HOSTTRACE_SANITIZER_TYPE} sanitizer (-fsanitizer=${HOSTTRACE_SANITIZER_TYPE})" +omnitrace_add_interface_library( + omnitrace-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(hosttrace-sanitizer-compile-options ${COMMON_SANITIZER_FLAGS}) +add_target_flag(omnitrace-sanitizer-compile-options ${COMMON_SANITIZER_FLAGS}) -foreach(_TYPE ${HOSTTRACE_SANITIZER_TYPES}) +foreach(_TYPE ${OMNITRACE_SANITIZER_TYPES}) set(_FLAG "-fsanitize=${_TYPE}") - hosttrace_add_interface_library( - hosttrace-${_TYPE}-sanitizer + omnitrace_add_interface_library( + omnitrace-${_TYPE}-sanitizer "Adds compiler flags to enable ${_TYPE} sanitizer (${_FLAG})") - add_target_flag(hosttrace-${_TYPE}-sanitizer ${_FLAG}) - target_link_libraries(hosttrace-${_TYPE}-sanitizer - INTERFACE hosttrace-sanitizer-compile-options) - set_property(TARGET hosttrace-${_TYPE}-sanitizer + add_target_flag(omnitrace-${_TYPE}-sanitizer ${_FLAG}) + target_link_libraries(omnitrace-${_TYPE}-sanitizer + INTERFACE omnitrace-sanitizer-compile-options) + set_property(TARGET omnitrace-${_TYPE}-sanitizer PROPERTY INTERFACE_LINK_OPTIONS ${_FLAG} ${COMMON_SANITIZER_FLAGS}) endforeach() unset(_FLAG) unset(COMMON_SANITIZER_FLAGS) -if(HOSTTRACE_USE_SANITIZER) - foreach(_TYPE ${HOSTTRACE_SANITIZER_TYPE}) - if(TARGET hosttrace-${_TYPE}-sanitizer) - target_link_libraries(hosttrace-sanitizer - INTERFACE hosttrace-${_TYPE}-sanitizer) +if(OMNITRACE_USE_SANITIZER) + foreach(_TYPE ${OMNITRACE_SANITIZER_TYPE}) + if(TARGET omnitrace-${_TYPE}-sanitizer) + target_link_libraries(omnitrace-sanitizer + INTERFACE omnitrace-${_TYPE}-sanitizer) else() message( - FATAL_ERROR "Error! Target 'hosttrace-${_TYPE}-sanitizer' does not exist!" + FATAL_ERROR "Error! Target 'omnitrace-${_TYPE}-sanitizer' does not exist!" ) endif() endforeach() else() - set(HOSTTRACE_USE_SANITIZER OFF) + set(OMNITRACE_USE_SANITIZER OFF) endif() if(MSVC) @@ -274,5 +274,5 @@ endif() get_property(LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES) if(NOT APPLE OR "$ENV{CONDA_PYTHON_EXE}" STREQUAL "") - add_user_flags(hosttrace-compile-options "CXX") + add_user_flags(omnitrace-compile-options "CXX") endif() diff --git a/projects/rocprofiler-systems/cmake/Compilers.cmake b/projects/rocprofiler-systems/cmake/Compilers.cmake index 129c0555a6..54262d87b3 100644 --- a/projects/rocprofiler-systems/cmake/Compilers.cmake +++ b/projects/rocprofiler-systems/cmake/Compilers.cmake @@ -31,7 +31,7 @@ if("${LIBNAME}" STREQUAL "") string(TOLOWER "${PROJECT_NAME}" LIBNAME) endif() -hosttrace_add_interface_library( +omnitrace_add_interface_library( ${LIBNAME}-compile-options "Adds the standard set of compiler flags used by timemory") # ----------------------------------------------------------------------------------------# @@ -87,12 +87,12 @@ endmacro(set_no_duplicates _VAR) # ----------------------------------------------------------------------------------------# # call before running check_{c,cxx}_compiler_flag # ----------------------------------------------------------------------------------------# -macro(hosttrace_begin_flag_check) - if(HOSTTRACE_QUIET_CONFIG) +macro(omnitrace_begin_flag_check) + if(OMNITRACE_QUIET_CONFIG) if(NOT DEFINED CMAKE_REQUIRED_QUIET) set(CMAKE_REQUIRED_QUIET OFF) endif() - hosttrace_save_variables(FLAG_CHECK VARIABLES CMAKE_REQUIRED_QUIET) + omnitrace_save_variables(FLAG_CHECK VARIABLES CMAKE_REQUIRED_QUIET) set(CMAKE_REQUIRED_QUIET ON) endif() endmacro() @@ -100,9 +100,9 @@ endmacro() # ----------------------------------------------------------------------------------------# # call after running check_{c,cxx}_compiler_flag # ----------------------------------------------------------------------------------------# -macro(hosttrace_end_flag_check) - if(HOSTTRACE_QUIET_CONFIG) - hosttrace_restore_variables(FLAG_CHECK VARIABLES CMAKE_REQUIRED_QUIET) +macro(omnitrace_end_flag_check) + if(OMNITRACE_QUIET_CONFIG) + omnitrace_restore_variables(FLAG_CHECK VARIABLES CMAKE_REQUIRED_QUIET) endif() endmacro() @@ -117,7 +117,7 @@ endmacro() # ----------------------------------------------------------------------------------------# macro(ADD_TARGET_C_FLAG _TARG) string(REPLACE "-" "_" _MAKE_TARG "${_TARG}") - list(APPEND HOSTTRACE_MAKE_TARGETS ${_MAKE_TARG}) + list(APPEND OMNITRACE_MAKE_TARGETS ${_MAKE_TARG}) target_compile_options(${_TARG} INTERFACE $<$:${ARGN}>) list(APPEND ${_MAKE_TARG}_C_FLAGS ${ARGN}) @@ -151,7 +151,7 @@ endmacro() # ----------------------------------------------------------------------------------------# macro(ADD_C_FLAG_IF_AVAIL FLAG) set(_ENABLE ON) - if(DEFINED HOSTTRACE_BUILD_C AND NOT HOSTTRACE_BUILD_C) + if(DEFINED OMNITRACE_BUILD_C AND NOT OMNITRACE_BUILD_C) set(_ENABLE OFF) endif() set(_TARG) @@ -166,17 +166,17 @@ macro(ADD_C_FLAG_IF_AVAIL FLAG) string(REPLACE "-" "_" FLAG_NAME "${FLAG_NAME}") string(REPLACE " " "_" FLAG_NAME "${FLAG_NAME}") string(REPLACE "=" "_" FLAG_NAME "${FLAG_NAME}") - if(NOT HOSTTRACE_BUILD_C) + if(NOT OMNITRACE_BUILD_C) set(${FLAG_NAME} ON) else() - hosttrace_begin_flag_check() + omnitrace_begin_flag_check() check_c_compiler_flag("-Werror" c_werror) if(c_werror) check_c_compiler_flag("${FLAG} -Werror" ${FLAG_NAME}) else() check_c_compiler_flag("${FLAG}" ${FLAG_NAME}) endif() - hosttrace_end_flag_check() + omnitrace_end_flag_check() if(${FLAG_NAME}) if("${_LTARG}" STREQUAL "") list(APPEND ${PROJECT_NAME}_C_FLAGS "${FLAG}") @@ -212,7 +212,7 @@ endmacro() # ----------------------------------------------------------------------------------------# macro(ADD_TARGET_CXX_FLAG _TARG) string(REPLACE "-" "_" _MAKE_TARG "${_TARG}") - list(APPEND HOSTTRACE_MAKE_TARGETS ${_MAKE_TARG}) + list(APPEND OMNITRACE_MAKE_TARGETS ${_MAKE_TARG}) target_compile_options(${_TARG} INTERFACE $<$:${ARGN}>) list(APPEND ${_MAKE_TARG}_CXX_FLAGS ${ARGN}) @@ -267,14 +267,14 @@ macro(ADD_CXX_FLAG_IF_AVAIL FLAG) string(REPLACE " " "_" FLAG_NAME "${FLAG_NAME}") string(REPLACE "=" "_" FLAG_NAME "${FLAG_NAME}") string(REPLACE "/" "_" FLAG_NAME "${FLAG_NAME}") - hosttrace_begin_flag_check() + omnitrace_begin_flag_check() check_cxx_compiler_flag("-Werror" cxx_werror) if(cxx_werror) check_cxx_compiler_flag("${FLAG} -Werror" ${FLAG_NAME}) else() check_cxx_compiler_flag("${FLAG}" ${FLAG_NAME}) endif() - hosttrace_end_flag_check() + omnitrace_end_flag_check() if(${FLAG_NAME}) if("${_LTARG}" STREQUAL "") list(APPEND ${PROJECT_NAME}_CXX_FLAGS "${FLAG}") @@ -347,7 +347,7 @@ endmacro() # ----------------------------------------------------------------------------------------# # check flag # ----------------------------------------------------------------------------------------# -function(HOSTTRACE_TARGET_FLAG _TARG_TARGET) +function(OMNITRACE_TARGET_FLAG _TARG_TARGET) cmake_parse_arguments(_TARG "IF_AVAIL" "MODE" "FLAGS;LANGUAGES" ${ARGN}) if(NOT _TARG_MODE) @@ -376,14 +376,14 @@ function(HOSTTRACE_TARGET_FLAG _TARG_TARGET) string(REPLACE "-" "_" FLAG_NAME "${FLAG_NAME}") string(REPLACE " " "_" FLAG_NAME "${FLAG_NAME}") string(REPLACE "=" "_" FLAG_NAME "${FLAG_NAME}") - hosttrace_begin_flag_check() + omnitrace_begin_flag_check() check_c_compiler_flag("-Werror" c_werror) if(c_werror) check_c_compiler_flag("${FLAG} -Werror" ${FLAG_NAME}) else() check_c_compiler_flag("${FLAG}" ${FLAG_NAME}) endif() - hosttrace_end_flag_check() + omnitrace_end_flag_check() if(${FLAG_NAME}) target_compile_options(${_TARG_TARGET} ${_TARG_MODE} $<$:${_FLAG}>) @@ -394,14 +394,14 @@ function(HOSTTRACE_TARGET_FLAG _TARG_TARGET) string(REPLACE "-" "_" FLAG_NAME "${FLAG_NAME}") string(REPLACE " " "_" FLAG_NAME "${FLAG_NAME}") string(REPLACE "=" "_" FLAG_NAME "${FLAG_NAME}") - hosttrace_begin_flag_check() + omnitrace_begin_flag_check() check_cxx_compiler_flag("-Werror" cxx_werror) if(cxx_werror) check_cxx_compiler_flag("${FLAG} -Werror" ${FLAG_NAME}) else() check_cxx_compiler_flag("${FLAG}" ${FLAG_NAME}) endif() - hosttrace_end_flag_check() + omnitrace_end_flag_check() if(${FLAG_NAME}) target_compile_options(${_TARG_TARGET} ${_TARG_MODE} $<$:${_FLAG}>) @@ -424,7 +424,7 @@ endfunction() # ----------------------------------------------------------------------------------------# macro(ADD_TARGET_CUDA_FLAG _TARG) string(REPLACE "-" "_" _MAKE_TARG "${_TARG}") - list(APPEND HOSTTRACE_MAKE_TARGETS ${_MAKE_TARG}) + list(APPEND OMNITRACE_MAKE_TARGETS ${_MAKE_TARG}) target_compile_options(${_TARG} INTERFACE $<$:${ARGN}>) list(APPEND ${_MAKE_TARG}_CUDA_FLAGS ${ARGN}) @@ -455,7 +455,7 @@ endfunction() # ----------------------------------------------------------------------------------------# # add compiler definition # ----------------------------------------------------------------------------------------# -function(HOSTTRACE_TARGET_COMPILE_DEFINITIONS _TARG _VIS) +function(OMNITRACE_TARGET_COMPILE_DEFINITIONS _TARG _VIS) foreach(_DEF ${ARGN}) target_compile_definitions(${_TARG} ${_VIS} $<$:${_DEF}>) if(CMAKE_CUDA_COMPILER_IS_NVIDIA) diff --git a/projects/rocprofiler-systems/cmake/ConfigCPack.cmake b/projects/rocprofiler-systems/cmake/ConfigCPack.cmake index eecf9b5f7c..6b3c31dbee 100644 --- a/projects/rocprofiler-systems/cmake/ConfigCPack.cmake +++ b/projects/rocprofiler-systems/cmake/ConfigCPack.cmake @@ -25,7 +25,7 @@ if(DYNINST_BUILD_ELFUTILS) endif() # Debian package specific variables -set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/AARInternal/hosttrace-dyninst") +set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/AARInternal/omnitrace-dyninst") if(DEFINED ENV{CPACK_DEBIAN_PACKAGE_RELEASE}) set(CPACK_DEBIAN_PACKAGE_RELEASE $ENV{CPACK_DEBIAN_PACKAGE_RELEASE}) else() diff --git a/projects/rocprofiler-systems/cmake/Formatting.cmake b/projects/rocprofiler-systems/cmake/Formatting.cmake index 1e14794d66..f35118b6de 100644 --- a/projects/rocprofiler-systems/cmake/Formatting.cmake +++ b/projects/rocprofiler-systems/cmake/Formatting.cmake @@ -7,14 +7,14 @@ include_guard(DIRECTORY) # ----------------------------------------------------------------------------------------# # clang-tidy -macro(HOSTTRACE_ACTIVATE_CLANG_TIDY) - if(HOSTTRACE_USE_CLANG_TIDY) +macro(OMNITRACE_ACTIVATE_CLANG_TIDY) + if(OMNITRACE_USE_CLANG_TIDY) find_program(CLANG_TIDY_COMMAND NAMES clang-tidy) - hosttrace_add_feature(CLANG_TIDY_COMMAND "Path to clang-tidy command") + omnitrace_add_feature(CLANG_TIDY_COMMAND "Path to clang-tidy command") if(NOT CLANG_TIDY_COMMAND) timemory_message( - WARNING "HOSTTRACE_USE_CLANG_TIDY is ON but clang-tidy is not found!") - set(HOSTTRACE_USE_CLANG_TIDY OFF) + WARNING "OMNITRACE_USE_CLANG_TIDY is ON but clang-tidy is not found!") + set(OMNITRACE_USE_CLANG_TIDY OFF) else() set(CMAKE_CXX_CLANG_TIDY ${CLANG_TIDY_COMMAND}) @@ -37,22 +37,22 @@ endmacro() # # ------------------------------------------------------------------------------# -find_program(HOSTTRACE_CLANG_FORMAT_EXE NAMES clang-format-11 clang-format-mp-11 +find_program(OMNITRACE_CLANG_FORMAT_EXE NAMES clang-format-11 clang-format-mp-11 clang-format) -if(HOSTTRACE_CLANG_FORMAT_EXE) +if(OMNITRACE_CLANG_FORMAT_EXE) file(GLOB_RECURSE sources ${PROJECT_SOURCE_DIR}/src/*.cpp) file(GLOB_RECURSE headers ${PROJECT_SOURCE_DIR}/include/*.hpp) file(GLOB_RECURSE examples ${PROJECT_SOURCE_DIR}/examples/*.cpp ${PROJECT_SOURCE_DIR}/examples/*.hpp) add_custom_target( - format-hosttrace - ${HOSTTRACE_CLANG_FORMAT_EXE} -i ${sources} ${headers} ${examples} - COMMENT "Running C++ formatter ${HOSTTRACE_CLANG_FORMAT_EXE}...") + format-omnitrace + ${OMNITRACE_CLANG_FORMAT_EXE} -i ${sources} ${headers} ${examples} + COMMENT "Running C++ formatter ${OMNITRACE_CLANG_FORMAT_EXE}...") if(NOT TARGET format) add_custom_target(format) endif() - add_dependencies(format format-hosttrace) + add_dependencies(format format-omnitrace) else() message( AUTHOR_WARNING diff --git a/projects/rocprofiler-systems/cmake/MacroUtilities.cmake b/projects/rocprofiler-systems/cmake/MacroUtilities.cmake index 33a2a7acb7..9cf92cd573 100644 --- a/projects/rocprofiler-systems/cmake/MacroUtilities.cmake +++ b/projects/rocprofiler-systems/cmake/MacroUtilities.cmake @@ -12,19 +12,19 @@ include(CMakeDependentOption) include(CMakeParseArguments) # ----------------------------------------------------------------------- -# message which handles HOSTTRACE_QUIET_CONFIG settings +# message which handles OMNITRACE_QUIET_CONFIG settings # ----------------------------------------------------------------------- # -function(HOSTTRACE_MESSAGE TYPE) - if(NOT HOSTTRACE_QUIET_CONFIG) - message(${TYPE} "[hosttrace] ${ARGN}") +function(OMNITRACE_MESSAGE TYPE) + if(NOT OMNITRACE_QUIET_CONFIG) + message(${TYPE} "[omnitrace] ${ARGN}") endif() endfunction() # ----------------------------------------------------------------------- # Save a set of variables with the given prefix # ----------------------------------------------------------------------- -macro(HOSTTRACE_SAVE_VARIABLES _PREFIX) +macro(OMNITRACE_SAVE_VARIABLES _PREFIX) # parse args cmake_parse_arguments( SAVE @@ -58,7 +58,7 @@ endmacro() # ----------------------------------------------------------------------- # Restore a set of variables with the given prefix # ----------------------------------------------------------------------- -macro(HOSTTRACE_RESTORE_VARIABLES _PREFIX) +macro(OMNITRACE_RESTORE_VARIABLES _PREFIX) # parse args cmake_parse_arguments( RESTORE @@ -92,10 +92,10 @@ macro(HOSTTRACE_RESTORE_VARIABLES _PREFIX) endmacro() # ----------------------------------------------------------------------- -# function - hosttrace_capitalize - make a string capitalized (first letter is capital) +# function - omnitrace_capitalize - make a string capitalized (first letter is capital) # usage: capitalize("SHARED" CShared) message(STATUS "-- CShared is \"${CShared}\"") $ -- # CShared is "Shared" -function(HOSTTRACE_CAPITALIZE str var) +function(OMNITRACE_CAPITALIZE str var) # make string lower string(TOLOWER "${str}" str) string(SUBSTRING "${str}" 0 1 _first) @@ -108,14 +108,14 @@ function(HOSTTRACE_CAPITALIZE str var) endfunction() # ------------------------------------------------------------------------------# -# function add_hosttrace_test_target() +# function add_omnitrace_test_target() # # Creates a target which runs ctest but depends on all the tests being built. # -function(ADD_HOSTTRACE_TEST_TARGET) - if(NOT TARGET hosttrace-test) +function(ADD_OMNITRACE_TEST_TARGET) + if(NOT TARGET omnitrace-test) add_custom_target( - hosttrace-test + omnitrace-test COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR} --target test WORKING_DIRECTORY ${PROJECT_BINARY_DIR} COMMENT "Running tests...") @@ -123,7 +123,7 @@ function(ADD_HOSTTRACE_TEST_TARGET) endfunction() # ----------------------------------------------------------------------------------------# -# macro hosttrace_checkout_git_submodule() +# macro omnitrace_checkout_git_submodule() # # Run "git submodule update" if a file in a submodule does not exist # @@ -132,7 +132,7 @@ endfunction() # value) -- (default: PROJECT_SOURCE_DIR) TEST_FILE (one value) -- file to check for # (default: CMakeLists.txt) ADDITIONAL_CMDS (many value) -- any addition commands to pass # -function(HOSTTRACE_CHECKOUT_GIT_SUBMODULE) +function(OMNITRACE_CHECKOUT_GIT_SUBMODULE) # parse args cmake_parse_arguments( CHECKOUT "RECURSIVE" @@ -201,7 +201,7 @@ function(HOSTTRACE_CHECKOUT_GIT_SUBMODULE) if(RET GREATER 0) set(_CMD "${GIT_EXECUTABLE} submodule update --init ${_RECURSE} ${CHECKOUT_ADDITIONAL_CMDS} ${CHECKOUT_RELATIVE_PATH}") - message(STATUS "function(hosttrace_checkout_git_submodule) failed.") + message(STATUS "function(omnitrace_checkout_git_submodule) failed.") message(FATAL_ERROR "Command: \"${_CMD}\"") else() set(_TEST_FILE_EXISTS ON) @@ -241,7 +241,7 @@ function(HOSTTRACE_CHECKOUT_GIT_SUBMODULE) "${GIT_EXECUTABLE} clone -b ${CHECKOUT_REPO_BRANCH} ${CHECKOUT_ADDITIONAL_CMDS} ${CHECKOUT_REPO_URL} ${CHECKOUT_RELATIVE_PATH}" ) - message(STATUS "function(hosttrace_checkout_git_submodule) failed.") + message(STATUS "function(omnitrace_checkout_git_submodule) failed.") message(FATAL_ERROR "Command: \"${_CMD}\"") else() set(_TEST_FILE_EXISTS ON) @@ -259,7 +259,7 @@ endfunction() # ----------------------------------------------------------------------------------------# # try to find a package quietly # -function(HOSTTRACE_TEST_FIND_PACKAGE PACKAGE_NAME OUTPUT_VAR) +function(OMNITRACE_TEST_FIND_PACKAGE PACKAGE_NAME OUTPUT_VAR) cmake_parse_arguments(PACKAGE "" "" "UNSET" ${ARGN}) find_package(${PACKAGE_NAME} QUIET ${PACKAGE_UNPARSED_ARGUMENTS}) if(NOT ${PACKAGE_NAME}_FOUND) @@ -279,7 +279,7 @@ endfunction() # ----------------------------------------------------------------------------------------# # macro to add an interface lib # -macro(HOSTTRACE_ADD_INTERFACE_LIBRARY _TARGET) +macro(OMNITRACE_ADD_INTERFACE_LIBRARY _TARGET) add_library(${_TARGET} INTERFACE) add_library(${PROJECT_NAME}::${_TARGET} ALIAS ${_TARGET}) install( @@ -293,7 +293,7 @@ macro(HOSTTRACE_ADD_INTERFACE_LIBRARY _TARGET) endif() endmacro() -function(HOSTTRACE_ADD_RPATH) +function(OMNITRACE_ADD_RPATH) set(_DIRS) foreach(_ARG ${ARGN}) if(EXISTS "${_ARG}" AND IS_DIRECTORY "${_ARG}") @@ -319,7 +319,7 @@ endfunction() # specified by the existence of the variable , to the list of enabled/disabled # features, plus a docstring describing the feature # -function(HOSTTRACE_ADD_FEATURE _var _description) +function(OMNITRACE_ADD_FEATURE _var _description) set(EXTRA_DESC "") foreach(currentArg ${ARGN}) if(NOT "${currentArg}" STREQUAL "${_var}" @@ -336,12 +336,12 @@ function(HOSTTRACE_ADD_FEATURE _var _description) if("CMAKE_DEFINE" IN_LIST ARGN) set_property(GLOBAL APPEND PROPERTY ${PROJECT_NAME}_CMAKE_DEFINES "${_var} @${_var}@") - if(HOSTTRACE_BUILD_DOCS) + if(OMNITRACE_BUILD_DOCS) set_property( GLOBAL APPEND PROPERTY ${PROJECT_NAME}_CMAKE_OPTIONS_DOC "${_var}` | ${_description}${EXTRA_DESC} |") endif() - elseif("DOC" IN_LIST ARGN AND HOSTTRACE_BUILD_DOCS) + elseif("DOC" IN_LIST ARGN AND OMNITRACE_BUILD_DOCS) set_property(GLOBAL APPEND PROPERTY ${PROJECT_NAME}_CMAKE_OPTIONS_DOC "${_var}` | ${_description}${EXTRA_DESC} |") endif() @@ -351,13 +351,13 @@ endfunction() # function add_option( [NO_FEATURE]) Add an # option and add as a feature if NO_FEATURE is not provided # -function(HOSTTRACE_ADD_OPTION _NAME _MESSAGE _DEFAULT) +function(OMNITRACE_ADD_OPTION _NAME _MESSAGE _DEFAULT) option(${_NAME} "${_MESSAGE}" ${_DEFAULT}) if("NO_FEATURE" IN_LIST ARGN) mark_as_advanced(${_NAME}) else() - hosttrace_add_feature(${_NAME} "${_MESSAGE}") - if(HOSTTRACE_BUILD_DOCS) + omnitrace_add_feature(${_NAME} "${_MESSAGE}") + if(OMNITRACE_BUILD_DOCS) set_property(GLOBAL APPEND PROPERTY ${PROJECT_NAME}_CMAKE_OPTIONS_DOC "${_NAME}` | ${_MESSAGE} |") endif() @@ -373,7 +373,7 @@ endfunction() # ----------------------------------------------------------------------------------------# # function print_enabled_features() Print enabled features plus their docstrings. # -function(HOSTTRACE_PRINT_ENABLED_FEATURES) +function(OMNITRACE_PRINT_ENABLED_FEATURES) set(_basemsg "The following features are defined/enabled (+):") set(_currentFeatureText "${_basemsg}") get_property(_features GLOBAL PROPERTY ${PROJECT_NAME}_FEATURES) @@ -397,7 +397,7 @@ function(HOSTTRACE_PRINT_ENABLED_FEATURES) string(REGEX REPLACE "^${PROJECT_NAME}_USE_" "" _feature_tmp "${_feature}") string(TOLOWER "${_feature_tmp}" _feature_tmp_l) - hosttrace_capitalize("${_feature_tmp}" _feature_tmp_c) + omnitrace_capitalize("${_feature_tmp}" _feature_tmp_c) foreach(_var _feature _feature_tmp _feature_tmp_l _feature_tmp_c) set(_ver "${${${_var}}_VERSION}") if(NOT "${_ver}" STREQUAL "") @@ -421,7 +421,7 @@ endfunction() # ----------------------------------------------------------------------------------------# # function print_disabled_features() Print disabled features plus their docstrings. # -function(HOSTTRACE_PRINT_DISABLED_FEATURES) +function(OMNITRACE_PRINT_DISABLED_FEATURES) set(_basemsg "The following features are NOT defined/enabled (-):") set(_currentFeatureText "${_basemsg}") get_property(_features GLOBAL PROPERTY ${PROJECT_NAME}_FEATURES) @@ -450,9 +450,9 @@ endfunction() # ----------------------------------------------------------------------------------------# # function print_features() Print all features plus their docstrings. # -function(HOSTTRACE_PRINT_FEATURES) - hosttrace_print_enabled_features() - hosttrace_print_disabled_features() +function(OMNITRACE_PRINT_FEATURES) + omnitrace_print_enabled_features() + omnitrace_print_disabled_features() endfunction() # ----------------------------------------------------------------------------------------# @@ -462,26 +462,26 @@ endfunction() # source files DIRECTORY --> all files in directory PROJECT --> all files/targets in # a project/subproject # -function(hosttrace_custom_compilation) +function(omnitrace_custom_compilation) cmake_parse_arguments(COMP "GLOBAL;PROJECT" "COMPILER" "DIRECTORY;TARGET;SOURCE" ${ARGN}) - # find hosttrace_launch_compiler + # find omnitrace_launch_compiler find_program( - HOSTTRACE_COMPILE_LAUNCHER - NAMES hosttrace_launch_compiler + OMNITRACE_COMPILE_LAUNCHER + NAMES omnitrace_launch_compiler HINTS ${PROJECT_SOURCE_DIR} ${CMAKE_SOURCE_DIR} PATHS ${PROJECT_SOURCE_DIR} ${CMAKE_SOURCE_DIR} PATH_SUFFIXES scripts bin) if(NOT COMP_COMPILER) - message(FATAL_ERROR "hosttrace_custom_compilation not provided COMPILER argument") + message(FATAL_ERROR "omnitrace_custom_compilation not provided COMPILER argument") endif() - if(NOT HOSTTRACE_COMPILE_LAUNCHER) + if(NOT OMNITRACE_COMPILE_LAUNCHER) message( FATAL_ERROR - "hosttrace could not find 'hosttrace_launch_compiler'. Please set '-DHOSTTRACE_COMPILE_LAUNCHER=/path/to/launcher'" + "omnitrace could not find 'omnitrace_launch_compiler'. Please set '-DOMNITRACE_COMPILE_LAUNCHER=/path/to/launcher'" ) endif() @@ -491,16 +491,16 @@ function(hosttrace_custom_compilation) GLOBAL PROPERTY RULE_LAUNCH_COMPILE - "${HOSTTRACE_COMPILE_LAUNCHER} ${COMP_COMPILER} ${CMAKE_CXX_COMPILER}") + "${OMNITRACE_COMPILE_LAUNCHER} ${COMP_COMPILER} ${CMAKE_CXX_COMPILER}") set_property( GLOBAL PROPERTY RULE_LAUNCH_LINK - "${HOSTTRACE_COMPILE_LAUNCHER} ${COMP_COMPILER} ${CMAKE_CXX_COMPILER}") + "${OMNITRACE_COMPILE_LAUNCHER} ${COMP_COMPILER} ${CMAKE_CXX_COMPILER}") else() foreach(_TYPE PROJECT DIRECTORY TARGET SOURCE) # make project/subproject scoping easy, e.g. - # hosttrace_custom_compilation(PROJECT) after project(...) + # omnitrace_custom_compilation(PROJECT) after project(...) if("${_TYPE}" STREQUAL "PROJECT" AND COMP_${_TYPE}) list(APPEND COMP_DIRECTORY ${PROJECT_SOURCE_DIR}) unset(COMP_${_TYPE}) @@ -512,13 +512,13 @@ function(hosttrace_custom_compilation) ${_TYPE} ${_VAL} PROPERTY RULE_LAUNCH_COMPILE - "${HOSTTRACE_COMPILE_LAUNCHER} ${COMP_COMPILER} ${CMAKE_CXX_COMPILER}" + "${OMNITRACE_COMPILE_LAUNCHER} ${COMP_COMPILER} ${CMAKE_CXX_COMPILER}" ) set_property( ${_TYPE} ${_VAL} PROPERTY RULE_LAUNCH_LINK - "${HOSTTRACE_COMPILE_LAUNCHER} ${COMP_COMPILER} ${CMAKE_CXX_COMPILER}" + "${OMNITRACE_COMPILE_LAUNCHER} ${COMP_COMPILER} ${CMAKE_CXX_COMPILER}" ) endforeach() endif() diff --git a/projects/rocprofiler-systems/cmake/Packages.cmake b/projects/rocprofiler-systems/cmake/Packages.cmake index 4bb6b73dbe..2661b1bf99 100644 --- a/projects/rocprofiler-systems/cmake/Packages.cmake +++ b/projects/rocprofiler-systems/cmake/Packages.cmake @@ -7,22 +7,22 @@ include_guard(DIRECTORY) # # ######################################################################################## -hosttrace_add_interface_library( - hosttrace-headers "Provides minimal set of include flags to compile with hosttrace") -hosttrace_add_interface_library(hosttrace-threading "Enables multithreading support") -hosttrace_add_interface_library( - hosttrace-dyninst +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") +omnitrace_add_interface_library( + omnitrace-dyninst "Provides flags and libraries for Dyninst (dynamic instrumentation)") -hosttrace_add_interface_library(hosttrace-roctracer +omnitrace_add_interface_library(omnitrace-roctracer "Provides flags and libraries for roctracer") -hosttrace_add_interface_library(hosttrace-mpi "Provides MPI or MPI headers") -hosttrace_add_interface_library(hosttrace-ptl "Enables PTL support (tasking)") +omnitrace_add_interface_library(omnitrace-mpi "Provides MPI or MPI headers") +omnitrace_add_interface_library(omnitrace-ptl "Enables PTL support (tasking)") -target_include_directories(hosttrace-headers INTERFACE ${PROJECT_SOURCE_DIR}/include +target_include_directories(omnitrace-headers INTERFACE ${PROJECT_SOURCE_DIR}/include ${PROJECT_BINARY_DIR}/include) # include threading because of rooflines -target_link_libraries(hosttrace-headers INTERFACE hosttrace-threading) +target_link_libraries(omnitrace-headers INTERFACE omnitrace-threading) # ----------------------------------------------------------------------------------------# # @@ -37,14 +37,14 @@ endif() find_library(pthread_LIBRARY NAMES pthread pthreads) find_package_handle_standard_args(pthread-library REQUIRED_VARS pthread_LIBRARY) -find_package(Threads ${hosttrace_FIND_QUIETLY} ${hosttrace_FIND_REQUIREMENT}) +find_package(Threads ${omnitrace_FIND_QUIETLY} ${omnitrace_FIND_REQUIREMENT}) if(Threads_FOUND) - target_link_libraries(hosttrace-threading INTERFACE ${CMAKE_THREAD_LIBS_INIT}) + target_link_libraries(omnitrace-threading INTERFACE ${CMAKE_THREAD_LIBS_INIT}) endif() if(pthread_LIBRARY AND NOT WIN32) - target_link_libraries(hosttrace-threading INTERFACE ${pthread_LIBRARY}) + target_link_libraries(omnitrace-threading INTERFACE ${pthread_LIBRARY}) endif() # ----------------------------------------------------------------------------------------# @@ -53,12 +53,12 @@ endif() # # ----------------------------------------------------------------------------------------# -if(HOSTTRACE_USE_ROCTRACER) +if(OMNITRACE_USE_ROCTRACER) list(APPEND CMAKE_PREFIX_PATH /opt/rocm) - find_package(roctracer ${hosttrace_FIND_QUIETLY} REQUIRED) - find_package(hip ${hosttrace_FIND_QUIETLY} REQUIRED) - target_compile_definitions(hosttrace-roctracer INTERFACE HOSTTRACE_USE_ROCTRACER) - target_link_libraries(hosttrace-roctracer INTERFACE hip::host roctracer::roctracer) + find_package(roctracer ${omnitrace_FIND_QUIETLY} REQUIRED) + find_package(hip ${omnitrace_FIND_QUIETLY} REQUIRED) + target_compile_definitions(omnitrace-roctracer INTERFACE OMNITRACE_USE_ROCTRACER) + target_link_libraries(omnitrace-roctracer INTERFACE hip::host roctracer::roctracer) set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH}:${roctracer_LIBRARY_DIRS}") endif() @@ -68,14 +68,14 @@ endif() # # ----------------------------------------------------------------------------------------# -if(HOSTTRACE_USE_MPI) - find_package(MPI ${hosttrace_FIND_QUIETLY} REQUIRED) - target_link_libraries(hosttrace-mpi INTERFACE MPI::MPI_C MPI::MPI_CXX) -elseif(HOSTTRACE_USE_MPI_HEADERS) - find_package(MPI-Headers ${hosttrace_FIND_QUIETLY} REQUIRED) - target_compile_definitions(hosttrace-mpi INTERFACE TIMEMORY_USE_MPI_HEADERS - HOSTTRACE_USE_MPI_HEADERS) - target_link_libraries(hosttrace-mpi INTERFACE MPI::MPI_HEADERS) +if(OMNITRACE_USE_MPI) + find_package(MPI ${omnitrace_FIND_QUIETLY} REQUIRED) + target_link_libraries(omnitrace-mpi INTERFACE MPI::MPI_C MPI::MPI_CXX) +elseif(OMNITRACE_USE_MPI_HEADERS) + find_package(MPI-Headers ${omnitrace_FIND_QUIETLY} REQUIRED) + target_compile_definitions(omnitrace-mpi INTERFACE TIMEMORY_USE_MPI_HEADERS + OMNITRACE_USE_MPI_HEADERS) + target_link_libraries(omnitrace-mpi INTERFACE MPI::MPI_HEADERS) endif() # ----------------------------------------------------------------------------------------# @@ -84,8 +84,8 @@ endif() # # ----------------------------------------------------------------------------------------# -if(HOSTTRACE_BUILD_DYNINST) - hosttrace_checkout_git_submodule( +if(OMNITRACE_BUILD_DYNINST) + omnitrace_checkout_git_submodule( RELATIVE_PATH external/dyninst WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} REPO_URL https://github.com/jrmadsen/dyninst.git @@ -109,56 +109,56 @@ if(HOSTTRACE_BUILD_DYNINST) OFF CACHE BOOL "Enable LTO for dyninst libraries") - hosttrace_save_variables(PIC VARIABLES CMAKE_POSITION_INDEPENDENT_CODE) + omnitrace_save_variables(PIC VARIABLES CMAKE_POSITION_INDEPENDENT_CODE) set(CMAKE_POSITION_INDEPENDENT_CODE ON) add_subdirectory(external/dyninst) - hosttrace_restore_variables(PIC VARIABLES CMAKE_POSITION_INDEPENDENT_CODE) + omnitrace_restore_variables(PIC VARIABLES CMAKE_POSITION_INDEPENDENT_CODE) add_library(Dyninst::Dyninst INTERFACE IMPORTED) foreach(_LIB common dyninstAPI parseAPI instructionAPI symtabAPI stackwalk Boost TBB) target_link_libraries(Dyninst::Dyninst INTERFACE Dyninst::${_LIB}) endforeach() - target_link_libraries(hosttrace-dyninst INTERFACE Dyninst::Dyninst) + target_link_libraries(omnitrace-dyninst INTERFACE Dyninst::Dyninst) - set(HOSTTRACE_DYNINST_API_RT + set(OMNITRACE_DYNINST_API_RT ${PROJECT_BINARY_DIR}/external/dyninst/dyninstAPI_RT/libdyninstAPI_RT${CMAKE_SHARED_LIBRARY_SUFFIX} ) - if(HOSTTRACE_DYNINST_API_RT) + if(OMNITRACE_DYNINST_API_RT) target_compile_definitions( - hosttrace-dyninst + omnitrace-dyninst INTERFACE DYNINST_API_RT="${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}:$:${CMAKE_INSTALL_PREFIX}/lib/$:$" ) endif() else() - find_package(Dyninst ${hosttrace_FIND_QUIETLY} REQUIRED + find_package(Dyninst ${omnitrace_FIND_QUIETLY} REQUIRED COMPONENTS dyninstAPI parseAPI instructionAPI symtabAPI) if(TARGET Dyninst::Dyninst) # updated Dyninst CMake system was found # useful for defining the location of the runtime API find_library( - HOSTTRACE_DYNINST_API_RT dyninstAPI_RT + OMNITRACE_DYNINST_API_RT dyninstAPI_RT HINTS ${Dyninst_ROOT_DIR} ${Dyninst_DIR} PATHS ${Dyninst_ROOT_DIR} ${Dyninst_DIR} PATH_SUFFIXES lib) - if(HOSTTRACE_DYNINST_API_RT) + if(OMNITRACE_DYNINST_API_RT) target_compile_definitions( - hosttrace-dyninst INTERFACE DYNINST_API_RT="${HOSTTRACE_DYNINST_API_RT}") + omnitrace-dyninst INTERFACE DYNINST_API_RT="${OMNITRACE_DYNINST_API_RT}") endif() - hosttrace_add_rpath(${Dyninst_LIBRARIES}) - target_link_libraries(hosttrace-dyninst INTERFACE Dyninst::Dyninst) + omnitrace_add_rpath(${Dyninst_LIBRARIES}) + target_link_libraries(omnitrace-dyninst INTERFACE Dyninst::Dyninst) else() # updated Dyninst CMake system was not found set(_BOOST_COMPONENTS atomic system thread date_time) - set(hosttrace_BOOST_COMPONENTS + set(omnitrace_BOOST_COMPONENTS "${_BOOST_COMPONENTS}" - CACHE STRING "Boost components used by Dyninst in hosttrace") + CACHE STRING "Boost components used by Dyninst in omnitrace") set(Boost_NO_BOOST_CMAKE ON) - find_package(Boost QUIET REQUIRED COMPONENTS ${hosttrace_BOOST_COMPONENTS}) + find_package(Boost QUIET REQUIRED COMPONENTS ${omnitrace_BOOST_COMPONENTS}) # some installs of dyninst don't set this properly if(EXISTS "${DYNINST_INCLUDE_DIR}" AND NOT DYNINST_HEADER_DIR) @@ -175,7 +175,7 @@ else() # useful for defining the location of the runtime API find_library( - HOSTTRACE_DYNINST_API_RT dyninstAPI_RT + OMNITRACE_DYNINST_API_RT dyninstAPI_RT HINTS ${Dyninst_ROOT_DIR} ${Dyninst_DIR} PATHS ${Dyninst_ROOT_DIR} ${Dyninst_DIR} PATH_SUFFIXES lib) @@ -196,9 +196,9 @@ else() PATH_SUFFIXES include) endif() - if(HOSTTRACE_DYNINST_API_RT) + if(OMNITRACE_DYNINST_API_RT) target_compile_definitions( - hosttrace-dyninst INTERFACE DYNINST_API_RT="${HOSTTRACE_DYNINST_API_RT}") + omnitrace-dyninst INTERFACE DYNINST_API_RT="${OMNITRACE_DYNINST_API_RT}") endif() if(Boost_DIR) @@ -209,8 +209,8 @@ else() endif() endif() - hosttrace_add_rpath(${DYNINST_LIBRARIES} ${Boost_LIBRARIES}) - target_link_libraries(hosttrace-dyninst INTERFACE ${DYNINST_LIBRARIES} + omnitrace_add_rpath(${DYNINST_LIBRARIES} ${Boost_LIBRARIES}) + target_link_libraries(omnitrace-dyninst INTERFACE ${DYNINST_LIBRARIES} ${Boost_LIBRARIES}) foreach( _TARG @@ -226,17 +226,17 @@ else() date_time TBB) if(TARGET Dyninst::${_TARG}) - target_link_libraries(hosttrace-dyninst INTERFACE Dyninst::${_TARG}) + target_link_libraries(omnitrace-dyninst INTERFACE Dyninst::${_TARG}) elseif(TARGET Boost::${_TARG}) - target_link_libraries(hosttrace-dyninst INTERFACE Boost::${_TARG}) + target_link_libraries(omnitrace-dyninst INTERFACE Boost::${_TARG}) elseif(TARGET ${_TARG}) - target_link_libraries(hosttrace-dyninst INTERFACE ${_TARG}) + target_link_libraries(omnitrace-dyninst INTERFACE ${_TARG}) endif() endforeach() target_include_directories( - hosttrace-dyninst SYSTEM INTERFACE ${TBB_INCLUDE_DIR} ${Boost_INCLUDE_DIRS} + omnitrace-dyninst SYSTEM INTERFACE ${TBB_INCLUDE_DIR} ${Boost_INCLUDE_DIRS} ${DYNINST_HEADER_DIR}) - target_compile_definitions(hosttrace-dyninst INTERFACE hosttrace_USE_DYNINST) + target_compile_definitions(omnitrace-dyninst INTERFACE omnitrace_USE_DYNINST) endif() endif() @@ -247,7 +247,7 @@ endif() # ----------------------------------------------------------------------------------------# set(perfetto_DIR ${PROJECT_SOURCE_DIR}/external/perfetto) -hosttrace_checkout_git_submodule( +omnitrace_checkout_git_submodule( RELATIVE_PATH external/perfetto WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} REPO_URL https://android.googlesource.com/platform/external/perfetto @@ -260,8 +260,8 @@ hosttrace_checkout_git_submodule( # # ----------------------------------------------------------------------------------------# -if(HOSTTRACE_BUILD_DEVICETRACE) - hosttrace_checkout_git_submodule( +if(OMNITRACE_BUILD_DEVICETRACE) + omnitrace_checkout_git_submodule( RELATIVE_PATH external/elfio WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} REPO_URL https://github.com/jrmadsen/ELFIO.git @@ -317,13 +317,13 @@ set(TIMEMORY_TLS_MODEL "global-dynamic" CACHE STRING "Thread-local static model" FORCE) -hosttrace_checkout_git_submodule( +omnitrace_checkout_git_submodule( RELATIVE_PATH external/timemory WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} REPO_URL https://github.com/NERSC/timemory.git REPO_BRANCH gpu-kernel-instrumentation) -hosttrace_save_variables(BUILD_CONFIG VARIABLES BUILD_SHARED_LIBS BUILD_STATIC_LIBS +omnitrace_save_variables(BUILD_CONFIG VARIABLES BUILD_SHARED_LIBS BUILD_STATIC_LIBS CMAKE_POSITION_INDEPENDENT_CODE) # ensure timemory builds PIC static libs so that we don't have to install timemory shared @@ -334,7 +334,7 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) add_subdirectory(external/timemory) -hosttrace_restore_variables(BUILD_CONFIG VARIABLES BUILD_SHARED_LIBS BUILD_STATIC_LIBS +omnitrace_restore_variables(BUILD_CONFIG VARIABLES BUILD_SHARED_LIBS BUILD_STATIC_LIBS CMAKE_POSITION_INDEPENDENT_CODE) # ----------------------------------------------------------------------------------------# @@ -345,7 +345,7 @@ hosttrace_restore_variables(BUILD_CONFIG VARIABLES BUILD_SHARED_LIBS BUILD_STATI # timemory might provide PTL::ptl-shared if(NOT TARGET PTL::ptl-shared) - hosttrace_checkout_git_submodule( + omnitrace_checkout_git_submodule( RELATIVE_PATH external/PTL WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} REPO_URL https://github.com/jrmadsen/PTL.git @@ -356,7 +356,7 @@ if(NOT TARGET PTL::ptl-shared) set(PTL_USE_GPU OFF) set(PTL_DEVELOPER_INSTALL OFF) - hosttrace_save_variables( + omnitrace_save_variables( BUILD_CONFIG VARIABLES BUILD_SHARED_LIBS BUILD_STATIC_LIBS CMAKE_POSITION_INDEPENDENT_CODE CMAKE_CXX_VISIBILITY_PRESET CMAKE_VISIBILITY_INLINES_HIDDEN) @@ -367,10 +367,10 @@ if(NOT TARGET PTL::ptl-shared) set(CMAKE_VISIBILITY_INLINES_HIDDEN ON) add_subdirectory(external/PTL) - hosttrace_restore_variables( + omnitrace_restore_variables( BUILD_CONFIG VARIABLES BUILD_SHARED_LIBS BUILD_STATIC_LIBS CMAKE_POSITION_INDEPENDENT_CODE CMAKE_CXX_VISIBILITY_PRESET CMAKE_VISIBILITY_INLINES_HIDDEN) endif() -target_link_libraries(hosttrace-ptl INTERFACE PTL::ptl-shared) +target_link_libraries(omnitrace-ptl INTERFACE PTL::ptl-shared) diff --git a/projects/rocprofiler-systems/examples/CMakeLists.txt b/projects/rocprofiler-systems/examples/CMakeLists.txt index 1c704b7cb6..bcd71d34c5 100644 --- a/projects/rocprofiler-systems/examples/CMakeLists.txt +++ b/projects/rocprofiler-systems/examples/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.15 FATAL_ERROR) -project(hosttrace-dyninst-examples LANGUAGES CXX) +project(omnitrace-dyninst-examples LANGUAGES CXX) set(CMAKE_VISIBILITY_INLINES_HIDDEN OFF) set(CMAKE_CXX_VISIBILITY_PRESET "default") diff --git a/projects/rocprofiler-systems/examples/parallel-overhead/CMakeLists.txt b/projects/rocprofiler-systems/examples/parallel-overhead/CMakeLists.txt index 27bc2a6077..67381a4f51 100644 --- a/projects/rocprofiler-systems/examples/parallel-overhead/CMakeLists.txt +++ b/projects/rocprofiler-systems/examples/parallel-overhead/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.13 FATAL_ERROR) -project(hosttrace-parallel-overhead LANGUAGES CXX) +project(omnitrace-parallel-overhead LANGUAGES CXX) set(CMAKE_BUILD_TYPE "Release") find_package(Threads REQUIRED) diff --git a/projects/rocprofiler-systems/examples/transpose/CMakeLists.txt b/projects/rocprofiler-systems/examples/transpose/CMakeLists.txt index 3393afe178..c031d1be15 100644 --- a/projects/rocprofiler-systems/examples/transpose/CMakeLists.txt +++ b/projects/rocprofiler-systems/examples/transpose/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.13 FATAL_ERROR) -project(hosttrace-transpose LANGUAGES CXX) +project(omnitrace-transpose LANGUAGES CXX) find_program(HIPCC_EXECUTABLE NAMES hipcc) @@ -17,8 +17,8 @@ endif() add_executable(transpose transpose.cpp) -if(CMAKE_CXX_COMPILER_IS_CLANG AND TARGET hosttrace::hosttrace-compile-options) - target_link_libraries(transpose PRIVATE hosttrace::hosttrace-compile-options) +if(CMAKE_CXX_COMPILER_IS_CLANG AND TARGET omnitrace::omnitrace-compile-options) + target_link_libraries(transpose PRIVATE omnitrace::omnitrace-compile-options) else() target_compile_options(transpose PRIVATE -W -Wall) endif() @@ -34,6 +34,6 @@ if(NOT CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) if(NOT CMAKE_CXX_COMPILER_IS_HIPCC AND HIPCC_EXECUTABLE) # defined in MacroUtilities.cmake - hosttrace_custom_compilation(COMPILER ${HIPCC_EXECUTABLE} TARGET transpose) + omnitrace_custom_compilation(COMPILER ${HIPCC_EXECUTABLE} TARGET transpose) endif() endif() diff --git a/projects/rocprofiler-systems/examples/transpose/transpose.cpp b/projects/rocprofiler-systems/examples/transpose/transpose.cpp index 3946732de1..abf043c030 100644 --- a/projects/rocprofiler-systems/examples/transpose/transpose.cpp +++ b/projects/rocprofiler-systems/examples/transpose/transpose.cpp @@ -172,14 +172,16 @@ int main(int argc, char** argv) { int rank = 0; + int size = 1; int nthreads = 2; if(argc > 1) nthreads = atoi(argv[1]); #if defined(USE_MPI) MPI_Init(&argc, &argv); MPI_Comm_rank(MPI_COMM_WORLD, &rank); + MPI_Comm_size(MPI_COMM_WORLD, &size); #endif - // this is a temporary workaround in hosttrace when HIP + MPI is enabled + // this is a temporary workaround in omnitrace when HIP + MPI is enabled int ndevice = 0; int devid = rank; HIP_API_CALL(hipGetDeviceCount(&ndevice)); diff --git a/projects/rocprofiler-systems/include/library.hpp b/projects/rocprofiler-systems/include/library.hpp index 184c8b91a1..202ced1ff3 100644 --- a/projects/rocprofiler-systems/include/library.hpp +++ b/projects/rocprofiler-systems/include/library.hpp @@ -74,7 +74,7 @@ add_critical_trace(int64_t _tid, size_t _cpu_cid, size_t _gpu_cid, size_t _paren if constexpr(PhaseID != critical_trace::Phase::NONE) { // unique lock per thread - auto& _mtx = type_mutex(_tid); + auto& _mtx = type_mutex(_tid); auto_lock_t _lk{ _mtx }; auto& _critical_trace = critical_trace::get(_tid); @@ -86,7 +86,7 @@ add_critical_trace(int64_t _tid, size_t _cpu_cid, size_t _gpu_cid, size_t _paren if constexpr(UpdateStack) { // unique lock per thread - auto& _mtx = type_mutex(_tid); + auto& _mtx = type_mutex(_tid); if constexpr(PhaseID == critical_trace::Phase::NONE) { diff --git a/projects/rocprofiler-systems/include/library/api.hpp b/projects/rocprofiler-systems/include/library/api.hpp index 1b2040e807..6787f9cefb 100644 --- a/projects/rocprofiler-systems/include/library/api.hpp +++ b/projects/rocprofiler-systems/include/library/api.hpp @@ -33,12 +33,12 @@ // forward decl of the API extern "C" { - void hosttrace_push_trace(const char* name) TIMEMORY_VISIBILITY("default"); - void hosttrace_pop_trace(const char* name) TIMEMORY_VISIBILITY("default"); - void hosttrace_trace_init(const char*, bool, const char*) + void omnitrace_push_trace(const char* name) TIMEMORY_VISIBILITY("default"); + void omnitrace_pop_trace(const char* name) TIMEMORY_VISIBILITY("default"); + void omnitrace_trace_init(const char*, bool, const char*) TIMEMORY_VISIBILITY("default"); - void hosttrace_trace_finalize(void) TIMEMORY_VISIBILITY("default"); - void hosttrace_trace_set_env(const char* env_name, const char* env_val) + void omnitrace_trace_finalize(void) TIMEMORY_VISIBILITY("default"); + void omnitrace_trace_set_env(const char* env_name, const char* env_val) TIMEMORY_VISIBILITY("default"); - void hosttrace_trace_set_mpi(bool use, bool attached) TIMEMORY_VISIBILITY("default"); + void omnitrace_trace_set_mpi(bool use, bool attached) TIMEMORY_VISIBILITY("default"); } diff --git a/projects/rocprofiler-systems/include/library/common.hpp b/projects/rocprofiler-systems/include/library/common.hpp index bea928be6a..8b6e711027 100644 --- a/projects/rocprofiler-systems/include/library/common.hpp +++ b/projects/rocprofiler-systems/include/library/common.hpp @@ -46,5 +46,5 @@ #include // timemory api struct -struct hosttrace : tim::concepts::api +struct omnitrace : tim::concepts::api {}; diff --git a/projects/rocprofiler-systems/include/library/config.hpp b/projects/rocprofiler-systems/include/library/config.hpp index f744782fbc..8b67261fa3 100644 --- a/projects/rocprofiler-systems/include/library/config.hpp +++ b/projects/rocprofiler-systems/include/library/config.hpp @@ -40,7 +40,7 @@ #include -// bundle of components around hosttrace_init and hosttrace_finalize +// bundle of components around omnitrace_init and omnitrace_finalize using main_bundle_t = tim::lightweight_tuple; + tim::component_bundle; // allocator for instrumentation_bundle_t using bundle_allocator_t = tim::data::ring_buffer_allocator; // bundle of components around each thread -using hosttrace_thread_bundle_t = +using omnitrace_thread_bundle_t = tim::lightweight_tuple 0 diff --git a/projects/rocprofiler-systems/include/library/debug.hpp b/projects/rocprofiler-systems/include/library/debug.hpp index c639471c97..360bf33c30 100644 --- a/projects/rocprofiler-systems/include/library/debug.hpp +++ b/projects/rocprofiler-systems/include/library/debug.hpp @@ -41,40 +41,40 @@ bool get_critical_trace_debug(); #if defined(TIMEMORY_USE_MPI) -# define HOSTTRACE_CONDITIONAL_PRINT(COND, ...) \ +# define OMNITRACE_CONDITIONAL_PRINT(COND, ...) \ if(COND) \ { \ fflush(stderr); \ tim::auto_lock_t _lk{ tim::type_mutex() }; \ - fprintf(stderr, "[hosttrace][%i][%li] ", static_cast(tim::dmp::rank()), \ + fprintf(stderr, "[omnitrace][%i][%li] ", static_cast(tim::dmp::rank()), \ tim::threading::get_id()); \ fprintf(stderr, __VA_ARGS__); \ fflush(stderr); \ } #else -# define HOSTTRACE_CONDITIONAL_PRINT(COND, ...) \ +# define OMNITRACE_CONDITIONAL_PRINT(COND, ...) \ if(COND) \ { \ fflush(stderr); \ tim::auto_lock_t _lk{ tim::type_mutex() }; \ - fprintf(stderr, "[hosttrace][%i][%li] ", \ + fprintf(stderr, "[omnitrace][%i][%li] ", \ static_cast(tim::process::get_id()), tim::threading::get_id()); \ fprintf(stderr, __VA_ARGS__); \ fflush(stderr); \ } #endif -#define HOSTTRACE_CONDITIONAL_BASIC_PRINT(COND, ...) \ +#define OMNITRACE_CONDITIONAL_BASIC_PRINT(COND, ...) \ if(COND) \ { \ fflush(stderr); \ tim::auto_lock_t _lk{ tim::type_mutex() }; \ - fprintf(stderr, "[hosttrace] "); \ + fprintf(stderr, "[omnitrace] "); \ fprintf(stderr, __VA_ARGS__); \ fflush(stderr); \ } -#define HOSTTRACE_DEBUG(...) HOSTTRACE_CONDITIONAL_PRINT(get_debug(), __VA_ARGS__) -#define HOSTTRACE_PRINT(...) HOSTTRACE_CONDITIONAL_PRINT(true, __VA_ARGS__) -#define HOSTTRACE_CT_DEBUG(...) \ - HOSTTRACE_CONDITIONAL_PRINT(get_critical_trace_debug(), __VA_ARGS__) +#define OMNITRACE_DEBUG(...) OMNITRACE_CONDITIONAL_PRINT(get_debug(), __VA_ARGS__) +#define OMNITRACE_PRINT(...) OMNITRACE_CONDITIONAL_PRINT(true, __VA_ARGS__) +#define OMNITRACE_CT_DEBUG(...) \ + OMNITRACE_CONDITIONAL_PRINT(get_critical_trace_debug(), __VA_ARGS__) diff --git a/projects/rocprofiler-systems/include/library/defines.hpp.in b/projects/rocprofiler-systems/include/library/defines.hpp.in index 86fdc4bf62..450e482e4f 100644 --- a/projects/rocprofiler-systems/include/library/defines.hpp.in +++ b/projects/rocprofiler-systems/include/library/defines.hpp.in @@ -29,14 +29,14 @@ #pragma once // clang-format off -#define HOSTTRACE_HIP_VERSION_STRING "@HIP_VERSION@" -#define HOSTTRACE_HIP_VERSION_MAJOR @HIP_VERSION_MAJOR@ -#define HOSTTRACE_HIP_VERSION_MINOR @HIP_VERSION_MINOR@ -#define HOSTTRACE_HIP_VERSION_PATCH @HIP_VERSION_PATCH@ +#define OMNITRACE_HIP_VERSION_STRING "@HIP_VERSION@" +#define OMNITRACE_HIP_VERSION_MAJOR @HIP_VERSION_MAJOR@ +#define OMNITRACE_HIP_VERSION_MINOR @HIP_VERSION_MINOR@ +#define OMNITRACE_HIP_VERSION_PATCH @HIP_VERSION_PATCH@ // clang-format on -#if defined(HOSTTRACE_USE_ROCTRACER) -# define HOSTTRACE_ROCTRACER_LIBKFDWRAPPER "@roctracer_kfdwrapper_LIBRARY@" +#if defined(OMNITRACE_USE_ROCTRACER) +# define OMNITRACE_ROCTRACER_LIBKFDWRAPPER "@roctracer_kfdwrapper_LIBRARY@" #else -# define HOSTTRACE_ROCTRACER_LIBKFDWRAPPER "/opt/rocm/roctracer/lib/libkfdwrapper64.so" +# define OMNITRACE_ROCTRACER_LIBKFDWRAPPER "/opt/rocm/roctracer/lib/libkfdwrapper64.so" #endif diff --git a/projects/rocprofiler-systems/include/library/dynamic_library.hpp b/projects/rocprofiler-systems/include/library/dynamic_library.hpp index 758b704eec..1b0c6afd82 100644 --- a/projects/rocprofiler-systems/include/library/dynamic_library.hpp +++ b/projects/rocprofiler-systems/include/library/dynamic_library.hpp @@ -53,7 +53,7 @@ struct dynamic_library handle = dlopen(filename.c_str(), flags); if(!handle) { - HOSTTRACE_DEBUG("%s\n", dlerror()); + OMNITRACE_DEBUG("%s\n", dlerror()); } dlerror(); // Clear any existing error } diff --git a/projects/rocprofiler-systems/include/library/fork_gotcha.hpp b/projects/rocprofiler-systems/include/library/fork_gotcha.hpp index 427399e549..8b3894f285 100644 --- a/projects/rocprofiler-systems/include/library/fork_gotcha.hpp +++ b/projects/rocprofiler-systems/include/library/fork_gotcha.hpp @@ -45,4 +45,4 @@ struct fork_gotcha : comp::base void audit(const gotcha_data_t& _data, audit::outgoing, pid_t _pid); }; -using fork_gotcha_t = comp::gotcha<4, tim::component_tuple, hosttrace>; +using fork_gotcha_t = comp::gotcha<4, tim::component_tuple, omnitrace>; diff --git a/projects/rocprofiler-systems/include/library/mpi_gotcha.hpp b/projects/rocprofiler-systems/include/library/mpi_gotcha.hpp index f2d53404c5..73cd49188a 100644 --- a/projects/rocprofiler-systems/include/library/mpi_gotcha.hpp +++ b/projects/rocprofiler-systems/include/library/mpi_gotcha.hpp @@ -34,21 +34,31 @@ // this is used to wrap MPI_Init and MPI_Init_thread struct mpi_gotcha : comp::base { + using comm_t = tim::mpi::comm_t; using gotcha_data_t = comp::gotcha_data; TIMEMORY_DEFAULT_OBJECT(mpi_gotcha) - // this will get called right before MPI_Init with that functions arguments - void audit(const gotcha_data_t& _data, audit::incoming, int*, char***); + // called right before MPI_Init with that functions arguments + static void audit(const gotcha_data_t& _data, audit::incoming, int*, char***); - // this will get called right before MPI_Init_thread with that functions arguments - void audit(const gotcha_data_t& _data, audit::incoming, int*, char***, int, int*); + // called right before MPI_Init_thread with that functions arguments + static void audit(const gotcha_data_t& _data, audit::incoming, int*, char***, int, + int*); - // this will get called right after MPI_Init and MPI_Init_thread with the return value + // called right before MPI_Finalize + static void audit(const gotcha_data_t& _data, audit::incoming); + + // called right before MPI_Comm_{rank,size} with that functions arguments + void audit(const gotcha_data_t& _data, audit::incoming, comm_t, int*); + + // called right after MPI_{Init,Init_thread,Comm_rank,Comm_size} with the return value void audit(const gotcha_data_t& _data, audit::outgoing, int _retval); - // this will get called right before MPI_Finalize - void audit(const gotcha_data_t& _data, audit::incoming); +private: + comm_t m_comm = tim::mpi::comm_world_v; + int* m_rank = nullptr; + int* m_size = nullptr; }; -using mpi_gotcha_t = comp::gotcha<4, tim::component_tuple, hosttrace>; +using mpi_gotcha_t = comp::gotcha<5, tim::component_tuple, omnitrace>; diff --git a/projects/rocprofiler-systems/include/library/hosttrace_component.hpp b/projects/rocprofiler-systems/include/library/omnitrace_component.hpp similarity index 93% rename from projects/rocprofiler-systems/include/library/hosttrace_component.hpp rename to projects/rocprofiler-systems/include/library/omnitrace_component.hpp index 4fcc854375..0dfd05704a 100644 --- a/projects/rocprofiler-systems/include/library/hosttrace_component.hpp +++ b/projects/rocprofiler-systems/include/library/omnitrace_component.hpp @@ -30,9 +30,9 @@ #include "library/timemory.hpp" -// timemory component which calls hosttrace functions +// timemory component which calls omnitrace functions // (used in gotcha wrappers) -struct hosttrace_component : comp::base +struct omnitrace_component : comp::base { void start(); void stop(); diff --git a/projects/rocprofiler-systems/include/library/roctracer.hpp b/projects/rocprofiler-systems/include/library/roctracer.hpp index 0a5b841802..b3847c6056 100644 --- a/projects/rocprofiler-systems/include/library/roctracer.hpp +++ b/projects/rocprofiler-systems/include/library/roctracer.hpp @@ -39,7 +39,7 @@ TIMEMORY_DECLARE_COMPONENT(roctracer) -#if !defined(HOSTTRACE_USE_ROCTRACER) +#if !defined(OMNITRACE_USE_ROCTRACER) TIMEMORY_DEFINE_CONCRETE_TRAIT(is_available, component::roctracer, false_type) #endif diff --git a/projects/rocprofiler-systems/include/library/roctracer_callbacks.hpp b/projects/rocprofiler-systems/include/library/roctracer_callbacks.hpp index 407d1a62dc..e1e7ee92cb 100644 --- a/projects/rocprofiler-systems/include/library/roctracer_callbacks.hpp +++ b/projects/rocprofiler-systems/include/library/roctracer_callbacks.hpp @@ -60,9 +60,9 @@ using hsa_timer_t = hsa_rt_utils::Timer; using timestamp_t = hsa_timer_t::timestamp_t; -using roctracer_bundle_t = tim::component_bundle; -using roctracer_hsa_bundle_t = tim::component_bundle; +using roctracer_hsa_bundle_t = tim::component_bundle; using roctracer_functions_t = std::vector>>; std::unique_ptr& diff --git a/projects/rocprofiler-systems/include/library/state.hpp b/projects/rocprofiler-systems/include/library/state.hpp index 9dad91df18..2577b04638 100644 --- a/projects/rocprofiler-systems/include/library/state.hpp +++ b/projects/rocprofiler-systems/include/library/state.hpp @@ -28,7 +28,7 @@ #pragma once -// used for specifying the state of hosttrace +// used for specifying the state of omnitrace enum class State : unsigned short { DelayedInit = 0, diff --git a/projects/rocprofiler-systems/include/library/thread_data.hpp b/projects/rocprofiler-systems/include/library/thread_data.hpp index ff5af56211..d5284f4743 100644 --- a/projects/rocprofiler-systems/include/library/thread_data.hpp +++ b/projects/rocprofiler-systems/include/library/thread_data.hpp @@ -36,14 +36,14 @@ #include #include -#if !defined(HOSTTRACE_MAX_THREADS) -# define HOSTTRACE_MAX_THREADS 1024 +#if !defined(OMNITRACE_MAX_THREADS) +# define OMNITRACE_MAX_THREADS 1024 #endif -static constexpr size_t max_supported_threads = HOSTTRACE_MAX_THREADS; +static constexpr size_t max_supported_threads = OMNITRACE_MAX_THREADS; template -struct hosttrace_thread_data +struct omnitrace_thread_data { using instance_array_t = std::array, MaxThreads>; using construct_on_init = std::true_type; @@ -61,7 +61,7 @@ struct hosttrace_thread_data template template void -hosttrace_thread_data::construct(Args&&... _args) +omnitrace_thread_data::construct(Args&&... _args) { static thread_local bool _v = [&_args...]() { instances().at(threading::get_id()) = @@ -73,14 +73,14 @@ hosttrace_thread_data::construct(Args&&... _args) template std::unique_ptr& -hosttrace_thread_data::instance() +omnitrace_thread_data::instance() { return instances().at(threading::get_id()); } template -typename hosttrace_thread_data::instance_array_t& -hosttrace_thread_data::instances() +typename omnitrace_thread_data::instance_array_t& +omnitrace_thread_data::instances() { static auto _v = instance_array_t{}; return _v; @@ -89,7 +89,7 @@ hosttrace_thread_data::instances() template template std::unique_ptr& -hosttrace_thread_data::instance(construct_on_init, Args&&... _args) +omnitrace_thread_data::instance(construct_on_init, Args&&... _args) { construct(std::forward(_args)...); return instances().at(threading::get_id()); @@ -97,8 +97,8 @@ hosttrace_thread_data::instance(construct_on_init, Args&&.. template template -typename hosttrace_thread_data::instance_array_t& -hosttrace_thread_data::instances(construct_on_init, Args&&... _args) +typename omnitrace_thread_data::instance_array_t& +omnitrace_thread_data::instances(construct_on_init, Args&&... _args) { static auto _v = [&]() { auto _internal = instance_array_t{}; diff --git a/projects/rocprofiler-systems/include/hosttrace.hpp b/projects/rocprofiler-systems/include/omnitrace.hpp similarity index 95% rename from projects/rocprofiler-systems/include/hosttrace.hpp rename to projects/rocprofiler-systems/include/omnitrace.hpp index 0ed8d60b81..9d83528b5f 100644 --- a/projects/rocprofiler-systems/include/hosttrace.hpp +++ b/projects/rocprofiler-systems/include/omnitrace.hpp @@ -111,7 +111,7 @@ using basic_loop_vec_t = bpvector_t; using snippet_pointer_vec_t = std::vector; void -hosttrace_prefork_callback(thread_t* parent, thread_t* child); +omnitrace_prefork_callback(thread_t* parent, thread_t* child); //======================================================================================// // @@ -526,12 +526,12 @@ get_snippets(Args&&... args) // //======================================================================================// // -struct hosttrace_call_expr +struct omnitrace_call_expr { using snippet_pointer_t = std::shared_ptr; template - hosttrace_call_expr(Args&&... args) + omnitrace_call_expr(Args&&... args) : m_params(get_snippets(std::forward(args)...)) {} @@ -555,15 +555,15 @@ private: // //======================================================================================// // -struct hosttrace_snippet_vec +struct omnitrace_snippet_vec { - using entry_type = std::vector; + using entry_type = std::vector; using value_type = std::vector; template void generate(procedure_t* func, Args&&... args) { - auto _expr = hosttrace_call_expr(std::forward(args)...); + auto _expr = omnitrace_call_expr(std::forward(args)...); auto _call = _expr.get(func); if(_call) { @@ -587,7 +587,7 @@ private: //======================================================================================// // static inline address_space_t* -hosttrace_get_address_space(patch_pointer_t _bpatch, int _cmdc, char** _cmdv, +omnitrace_get_address_space(patch_pointer_t _bpatch, int _cmdc, char** _cmdv, bool _rewrite, int _pid = -1, string_t _name = {}) { address_space_t* mutatee = nullptr; @@ -599,7 +599,7 @@ hosttrace_get_address_space(patch_pointer_t _bpatch, int _cmdc, char** _cmdv, if(!_name.empty()) mutatee = _bpatch->openBinary(_name.c_str(), false); if(!mutatee) { - fprintf(stderr, "[hosttrace]> Failed to open binary '%s'\n", _name.c_str()); + fprintf(stderr, "[omnitrace]> Failed to open binary '%s'\n", _name.c_str()); throw std::runtime_error("Failed to open binary"); } verbprintf(1, "Done\n"); @@ -612,7 +612,7 @@ hosttrace_get_address_space(patch_pointer_t _bpatch, int _cmdc, char** _cmdv, mutatee = _bpatch->processAttach(_cmdv0, _pid); if(!mutatee) { - fprintf(stderr, "[hosttrace]> Failed to connect to process %i\n", (int) _pid); + fprintf(stderr, "[omnitrace]> Failed to connect to process %i\n", (int) _pid); throw std::runtime_error("Failed to attach to process"); } verbprintf(1, "Done\n"); @@ -630,7 +630,7 @@ hosttrace_get_address_space(patch_pointer_t _bpatch, int _cmdc, char** _cmdv, if(!_cmdv[i]) continue; ss << _cmdv[i] << " "; } - fprintf(stderr, "[hosttrace]> Failed to create process: '%s'\n", + fprintf(stderr, "[omnitrace]> Failed to create process: '%s'\n", ss.str().c_str()); throw std::runtime_error("Failed to create process"); } @@ -643,7 +643,7 @@ hosttrace_get_address_space(patch_pointer_t _bpatch, int _cmdc, char** _cmdv, //======================================================================================// // TIMEMORY_NOINLINE inline void -hosttrace_thread_exit(thread_t* thread, BPatch_exitType exit_type) +omnitrace_thread_exit(thread_t* thread, BPatch_exitType exit_type) { if(!thread) return; @@ -651,7 +651,7 @@ hosttrace_thread_exit(thread_t* thread, BPatch_exitType exit_type) if(!terminate_expr) { - fprintf(stderr, "[hosttrace]> continuing execution\n"); + fprintf(stderr, "[omnitrace]> continuing execution\n"); app->continueExecution(); return; } @@ -660,18 +660,18 @@ hosttrace_thread_exit(thread_t* thread, BPatch_exitType exit_type) { case ExitedNormally: { - fprintf(stderr, "[hosttrace]> Thread exited normally\n"); + fprintf(stderr, "[omnitrace]> Thread exited normally\n"); break; } case ExitedViaSignal: { - fprintf(stderr, "[hosttrace]> Thread terminated unexpectedly\n"); + fprintf(stderr, "[omnitrace]> Thread terminated unexpectedly\n"); break; } case NoExit: default: { - fprintf(stderr, "[hosttrace]> %s invoked with NoExit\n", __FUNCTION__); + fprintf(stderr, "[omnitrace]> %s invoked with NoExit\n", __FUNCTION__); break; } } @@ -679,14 +679,14 @@ hosttrace_thread_exit(thread_t* thread, BPatch_exitType exit_type) // terminate_expr = nullptr; thread->oneTimeCode(*terminate_expr); - fprintf(stderr, "[hosttrace]> continuing execution\n"); + fprintf(stderr, "[omnitrace]> continuing execution\n"); app->continueExecution(); } // //======================================================================================// // TIMEMORY_NOINLINE inline void -hosttrace_fork_callback(thread_t* parent, thread_t* child) +omnitrace_fork_callback(thread_t* parent, thread_t* child) { if(child) { diff --git a/projects/rocprofiler-systems/roctrace.cfg b/projects/rocprofiler-systems/roctrace.cfg index 13acb467c8..3a6dbe4501 100644 --- a/projects/rocprofiler-systems/roctrace.cfg +++ b/projects/rocprofiler-systems/roctrace.cfg @@ -16,8 +16,7 @@ data_sources { config { name: "track_event" track_event_config { - enabled_categories: "kernels,hosttrace" + enabled_categories: "kernels,omnitrace" } } } - diff --git a/projects/rocprofiler-systems/scripts/build-release.sh b/projects/rocprofiler-systems/scripts/build-release.sh index 624f758fa1..d7837863c3 100755 --- a/projects/rocprofiler-systems/scripts/build-release.sh +++ b/projects/rocprofiler-systems/scripts/build-release.sh @@ -1,14 +1,15 @@ #!/bin/bash -VERSION=0.0.3 -ROCM_VERSION=4.3.0 +: ${VERSION:=0.0.3} +: ${ROCM_VERSION:=4.3.0} +: ${NJOBS:=8} -STANDARD_ARGS="-DCPACK_GENERATOR=STGZ -DCMAKE_BUILD_TYPE=Release -DHOSTTRACE_BUILD_DYNINST=ON -DTIMEMORY_BUILD_PORTABLE=ON" +STANDARD_ARGS="-DCPACK_GENERATOR=STGZ -DCMAKE_BUILD_TYPE=Release -DOMNITRACE_BUILD_DYNINST=ON -DTIMEMORY_BUILD_PORTABLE=ON" -cmake -B build-release/core ${STANDARD_ARGS} -DDYNINST_BUILD_{TBB,BOOST,ELFUTILS,LIBIBERTY}=ON -DDYNINST_USE_OpenMP=OFF -DHOSTTRACE_USE_MPI_HEADERS=ON -DHOSTTRACE_USE_ROCTRACER=OFF . +cmake -B build-release/core ${STANDARD_ARGS} -DDYNINST_BUILD_{TBB,BOOST,ELFUTILS,LIBIBERTY}=ON -DDYNINST_USE_OpenMP=OFF -DOMNITRACE_USE_MPI_HEADERS=ON -DOMNITRACE_USE_ROCTRACER=OFF -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=OFF -DOMNITRACE_MAX_THREADS=2048 . cmake --build build-release/core --target package --parallel 8 -cp build-release/core/hosttrace-${VERSION}-Linux.sh build-release/hosttrace-${VERSION}-Linux.sh +cp build-release/core/omnitrace-${VERSION}-Linux.sh build-release/omnitrace-${VERSION}-Linux.sh -cmake -B build-release/rocm-mpi ${STANDARD_ARGS} -DDYNINST_BUILD_{TBB,BOOST,ELFUTILS,LIBIBERTY}=ON -DDYNINST_USE_OpenMP=ON -DHOSTTRACE_USE_MPI_HEADERS=ON -DHOSTTRACE_USE_ROCTRACER=ON . +cmake -B build-release/rocm-mpi ${STANDARD_ARGS} -DDYNINST_BUILD_{TBB,BOOST,ELFUTILS,LIBIBERTY}=ON -DDYNINST_USE_OpenMP=ON -DOMNITRACE_USE_MPI_HEADERS=ON -DOMNITRACE_USE_ROCTRACER=ON -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=OFF -DOMNITRACE_MAX_THREADS=2048 . cmake --build build-release/rocm-mpi --target package --parallel 8 -cp build-release/rocm-mpi/hosttrace-${VERSION}-Linux.sh build-release/hosttrace-${VERSION}-Linux-ROCm-${ROCM_VERSION}.sh +cp build-release/rocm-mpi/omnitrace-${VERSION}-Linux.sh build-release/omnitrace-${VERSION}-Linux-ROCm-${ROCM_VERSION}.sh diff --git a/projects/rocprofiler-systems/scripts/hosttrace-merge.jl b/projects/rocprofiler-systems/scripts/omnitrace-merge.jl similarity index 100% rename from projects/rocprofiler-systems/scripts/hosttrace-merge.jl rename to projects/rocprofiler-systems/scripts/omnitrace-merge.jl diff --git a/projects/rocprofiler-systems/scripts/hosttrace_launch_compiler b/projects/rocprofiler-systems/scripts/omnitrace_launch_compiler similarity index 67% rename from projects/rocprofiler-systems/scripts/hosttrace_launch_compiler rename to projects/rocprofiler-systems/scripts/omnitrace_launch_compiler index 7d09296370..9e6abf3459 100755 --- a/projects/rocprofiler-systems/scripts/hosttrace_launch_compiler +++ b/projects/rocprofiler-systems/scripts/omnitrace_launch_compiler @@ -1,7 +1,7 @@ #!/bin/bash -e # # This script allows CMAKE_CXX_COMPILER to be a standard -# C++ compiler and hosttrace sets RULE_LAUNCH_COMPILE and +# C++ compiler and omnitrace sets RULE_LAUNCH_COMPILE and # RULE_LAUNCH_LINK in CMake so that all compiler and link # commands are prefixed with this script followed by the # C++ compiler. Thus if $1 == $2 then we know the command @@ -15,24 +15,24 @@ # emit a message about the underlying command executed : ${DEBUG:=0} -: ${HOSTTRACE_DEBUG_LAUNCH_COMPILER:=${DEBUG}} +: ${OMNITRACE_DEBUG_LAUNCH_COMPILER:=${DEBUG}} debug-message() { - if [ "${HOSTTRACE_DEBUG_LAUNCH_COMPILER}" -ne 0 ]; then + if [ "${OMNITRACE_DEBUG_LAUNCH_COMPILER}" -ne 0 ]; then echo -e "##### $(basename ${BASH_SOURCE[0]}) executing: \"$@\"... #####" fi } -# if hosttrace compiler is not passed, someone is probably trying to invoke it directly +# if omnitrace compiler is not passed, someone is probably trying to invoke it directly if [ -z "${1}" ]; then - echo -e "\n${BASH_SOURCE[0]} was invoked without the hosttrace compiler as the first argument." + echo -e "\n${BASH_SOURCE[0]} was invoked without the omnitrace compiler as the first argument." echo "This script is not indended to be directly invoked by any mechanism other" echo -e "than through a RULE_LAUNCH_COMPILE or RULE_LAUNCH_LINK property set in CMake.\n" exit 1 fi -# if hosttrace compiler is not passed, someone is probably trying to invoke it directly +# if omnitrace compiler is not passed, someone is probably trying to invoke it directly if [ -z "${2}" ]; then echo -e "\n${BASH_SOURCE[0]} was invoked without the C++ compiler as the second argument." echo "This script is not indended to be directly invoked by any mechanism other" @@ -43,10 +43,10 @@ fi # if there aren't two args, this isn't necessarily invalid, just a bit strange if [ -z "${3}" ]; then exit 0; fi -# store the hosttrace compiler -HOSTTRACE_COMPILER=${1} +# store the omnitrace compiler +OMNITRACE_COMPILER=${1} -# remove the hosttrace compiler from the arguments +# remove the omnitrace compiler from the arguments shift # store the expected C++ compiler @@ -57,19 +57,19 @@ shift if [[ "${CXX_COMPILER}" != "${1}" ]]; then debug-message $@ - # the command does not depend on hosttrace so just execute the command w/o re-directing to ${HOSTTRACE_COMPILER} + # the command does not depend on omnitrace so just execute the command w/o re-directing to ${OMNITRACE_COMPILER} eval $@ else - # the executable is the C++ compiler, so we need to re-direct to ${HOSTTRACE_COMPILER} - if [ ! -f "${HOSTTRACE_COMPILER}" ]; then - echo -e "\nError: the compiler redirect for hosttrace was not found at ${HOSTTRACE_COMPILER}\n" + # the executable is the C++ compiler, so we need to re-direct to ${OMNITRACE_COMPILER} + if [ ! -f "${OMNITRACE_COMPILER}" ]; then + echo -e "\nError: the compiler redirect for omnitrace was not found at ${OMNITRACE_COMPILER}\n" exit 1 fi # discard the compiler from the command shift - debug-message ${HOSTTRACE_COMPILER} $@ - # execute ${HOSTTRACE_COMPILER} (again, usually nvcc_wrapper) - ${HOSTTRACE_COMPILER} $@ + debug-message ${OMNITRACE_COMPILER} $@ + # execute ${OMNITRACE_COMPILER} (again, usually nvcc_wrapper) + ${OMNITRACE_COMPILER} $@ fi diff --git a/projects/rocprofiler-systems/src/library.cpp b/projects/rocprofiler-systems/src/library.cpp index 789562a171..c76f442d25 100644 --- a/projects/rocprofiler-systems/src/library.cpp +++ b/projects/rocprofiler-systems/src/library.cpp @@ -48,7 +48,7 @@ setup_gotchas() if(_initialized) return; _initialized = true; - HOSTTRACE_DEBUG( + OMNITRACE_DEBUG( "[%s] Configuring gotcha wrapper around fork, MPI_Init, and MPI_Init_thread\n", __FUNCTION__); @@ -60,7 +60,11 @@ setup_gotchas() mpi_gotcha_t::template configure<0, int, int*, char***>("MPI_Init"); mpi_gotcha_t::template configure<1, int, int*, char***, int, int*>( "MPI_Init_thread"); - mpi_gotcha_t::template configure<3, int>("MPI_Finalize"); + mpi_gotcha_t::template configure<2, int>("MPI_Finalize"); + // mpi_gotcha_t::template configure<3, int, tim::mpi::comm_t, + // int*>("MPI_Comm_rank"); + // mpi_gotcha_t::template configure<4, int, tim::mpi::comm_t, + // int*>("MPI_Comm_size"); }; } @@ -69,9 +73,9 @@ ensure_finalization(bool _static_init = false) { if(!_static_init) { - HOSTTRACE_DEBUG("[%s]\n", __FUNCTION__); + OMNITRACE_DEBUG("[%s]\n", __FUNCTION__); } - return scope::destructor{ []() { hosttrace_trace_finalize(); } }; + return scope::destructor{ []() { omnitrace_trace_finalize(); } }; } auto& @@ -117,18 +121,18 @@ using Device = critical_trace::Device; using Phase = critical_trace::Phase; bool -hosttrace_init_tooling() +omnitrace_init_tooling() { static bool _once = false; if(get_state() != State::PreInit || _once) return false; _once = true; - HOSTTRACE_DEBUG("[%s]\n", __FUNCTION__); + OMNITRACE_DEBUG("[%s]\n", __FUNCTION__); if(!get_use_timemory() && !get_use_perfetto()) { get_state() = State::Finalized; - HOSTTRACE_DEBUG("[%s] Both perfetto and timemory are disabled. Setting the state " + OMNITRACE_DEBUG("[%s] Both perfetto and timemory are disabled. Setting the state " "to finalized\n", __FUNCTION__); return false; @@ -174,7 +178,7 @@ hosttrace_init_tooling() } else { - tim::trait::runtime_enabled::set(false); + tim::trait::runtime_enabled::set(false); } } @@ -182,7 +186,7 @@ hosttrace_init_tooling() auto& _main_bundle = get_main_bundle(); _main_bundle->start(); assert(_main_bundle->get()->get_is_running()); -#if defined(HOSTTRACE_USE_ROCTRACER) +#if defined(OMNITRACE_USE_ROCTRACER) assert(_main_bundle->get() != nullptr); assert(_main_bundle->get()->get_is_running()); #endif @@ -220,11 +224,11 @@ hosttrace_init_tooling() auto _exe = get_exe_name(); static auto _thread_init = [_exe]() { - hosttrace_thread_data::construct( + omnitrace_thread_data::construct( TIMEMORY_JOIN("", _exe, "/thread-", threading::get_id()), quirk::config{}); static thread_local auto _dtor = scope::destructor{ []() { - hosttrace_thread_data::instance()->stop(); + omnitrace_thread_data::instance()->stop(); } }; (void) _dtor; }; @@ -258,8 +262,8 @@ hosttrace_init_tooling() auto& _data = get_instrumentation_bundles(); if(_data.bundles.empty()) { - HOSTTRACE_DEBUG("[%s] skipped %s :: empty bundle stack\n", - "hosttrace_pop_trace", name); + OMNITRACE_DEBUG("[%s] skipped %s :: empty bundle stack\n", + "omnitrace_pop_trace", name); return; } _data.bundles.back()->stop(); @@ -303,21 +307,21 @@ hosttrace_init_tooling() if(dmp::rank() == 0) { // generic filter for filtering relevant options - auto _is_hosttrace_option = [](const auto& _v) { -#if !defined(HOSTTRACE_USE_ROCTRACER) - if(_v.find("HOSTTRACE_ROCTRACER_") == 0) return false; + auto _is_omnitrace_option = [](const auto& _v) { +#if !defined(OMNITRACE_USE_ROCTRACER) + if(_v.find("OMNITRACE_ROCTRACER_") == 0) return false; #endif - if(!get_use_critical_trace() && _v.find("HOSTTRACE_CRITICAL_TRACE_") == 0) + if(!get_use_critical_trace() && _v.find("OMNITRACE_CRITICAL_TRACE_") == 0) return false; - return (_v.find("HOSTTRACE_") == 0) || + return (_v.find("OMNITRACE_") == 0) || ((_v.find("TIMEMORY_") != 0) && (_v.find("SIGNAL_") != 0)); }; - tim::print_env(std::cerr, [_is_hosttrace_option](const std::string& _v) { - return _is_hosttrace_option(_v); + tim::print_env(std::cerr, [_is_omnitrace_option](const std::string& _v) { + return _is_omnitrace_option(_v); }); - print_config_settings(std::cerr, _is_hosttrace_option); + print_config_settings(std::cerr, _is_omnitrace_option); } if(get_use_perfetto() && !is_system_backend()) @@ -358,20 +362,20 @@ hosttrace_init_tooling() extern "C" { - void hosttrace_push_trace(const char* name) + void omnitrace_push_trace(const char* name) { // return if not active if(get_state() == State::Finalized) return; - if(get_state() != State::Active && !hosttrace_init_tooling()) + if(get_state() != State::Active && !omnitrace_init_tooling()) { - HOSTTRACE_DEBUG("[%s] %s :: not active and perfetto not initialized\n", + OMNITRACE_DEBUG("[%s] %s :: not active and perfetto not initialized\n", __FUNCTION__, name); return; } else { - HOSTTRACE_DEBUG("[%s] %s\n", __FUNCTION__, name); + OMNITRACE_DEBUG("[%s] %s\n", __FUNCTION__, name); } static auto _sample_rate = std::max(get_sample_rate(), 1); @@ -396,11 +400,11 @@ extern "C" } } - void hosttrace_pop_trace(const char* name) + void omnitrace_pop_trace(const char* name) { if(get_state() == State::Active) { - HOSTTRACE_DEBUG("[%s] %s\n", __FUNCTION__, name); + OMNITRACE_DEBUG("[%s] %s\n", __FUNCTION__, name); auto& _sample_data = get_sample_data(); if(!_sample_data.empty()) { @@ -424,34 +428,34 @@ extern "C" } else { - HOSTTRACE_DEBUG("[%s] %s :: not active\n", __FUNCTION__, name); + OMNITRACE_DEBUG("[%s] %s :: not active\n", __FUNCTION__, name); } } - void hosttrace_trace_init(const char*, bool, const char*) + void omnitrace_trace_init(const char*, bool, const char*) { - HOSTTRACE_DEBUG("[%s]\n", __FUNCTION__); - hosttrace_init_tooling(); + OMNITRACE_DEBUG("[%s]\n", __FUNCTION__); + omnitrace_init_tooling(); } - void hosttrace_trace_finalize(void) + void omnitrace_trace_finalize(void) { // return if not active if(get_state() != State::Active) return; - HOSTTRACE_DEBUG("[%s]\n", __FUNCTION__); + OMNITRACE_DEBUG("[%s]\n", __FUNCTION__); if(dmp::rank() == 0) puts(""); get_state() = State::Finalized; -#if defined(HOSTTRACE_USE_ROCTRACER) +#if defined(OMNITRACE_USE_ROCTRACER) // ensure that threads running roctracer callbacks shutdown comp::roctracer::tear_down(); #endif // join extra thread(s) used by roctracer - HOSTTRACE_DEBUG("[%s] waiting for all roctracer tasks to complete...\n", + OMNITRACE_DEBUG("[%s] waiting for all roctracer tasks to complete...\n", __FUNCTION__); tasking::get_roctracer_task_group().join(); @@ -462,7 +466,7 @@ extern "C" std::string _msg = JOIN("", *get_main_bundle()); auto _pos = _msg.find(">>> "); if(_pos != std::string::npos) _msg = _msg.substr(_pos + 5); - HOSTTRACE_PRINT("%s\n", _msg.c_str()); + OMNITRACE_PRINT("%s\n", _msg.c_str()); get_main_bundle().reset(); } @@ -470,7 +474,7 @@ extern "C" // if they are still running (e.g. thread-pool still alive), the // thread-specific data will be wrong if try to stop them from // the main thread. - for(auto& itr : hosttrace_thread_data::instances()) + for(auto& itr : omnitrace_thread_data::instances()) { if(itr && itr->get() && !itr->get()->get_is_running()) @@ -478,7 +482,7 @@ extern "C" std::string _msg = JOIN("", *itr); auto _pos = _msg.find(">>> "); if(_pos != std::string::npos) _msg = _msg.substr(_pos + 5); - HOSTTRACE_PRINT("%s\n", _msg.c_str()); + OMNITRACE_PRINT("%s\n", _msg.c_str()); } } @@ -504,7 +508,7 @@ extern "C" for(size_t i = 0; i < max_supported_threads; ++i) { using critical_trace_hash_data = - hosttrace_thread_data; + omnitrace_thread_data; if(critical_trace_hash_data::instances().at(i)) critical_trace::add_hash_id( @@ -514,19 +518,19 @@ extern "C" for(size_t i = 0; i < max_supported_threads; ++i) { using critical_trace_chain_data = - hosttrace_thread_data; + omnitrace_thread_data; if(critical_trace_chain_data::instances().at(i)) critical_trace::update(i); // launch update task } // make sure outstanding hash tasks completed before compute - HOSTTRACE_PRINT("[%s] waiting for all critical trace tasks to complete...\n", + OMNITRACE_PRINT("[%s] waiting for all critical trace tasks to complete...\n", __FUNCTION__); tasking::get_critical_trace_task_group().join(); // launch compute task - HOSTTRACE_PRINT("[%s] launching critical trace compute task...\n", + OMNITRACE_PRINT("[%s] launching critical trace compute task...\n", __FUNCTION__); critical_trace::compute(); } @@ -578,24 +582,24 @@ extern "C" tasking::get_roctracer_thread_pool().destroy_threadpool(); tasking::get_critical_trace_thread_pool().destroy_threadpool(); - HOSTTRACE_DEBUG("Finalizing timemory...\n"); + OMNITRACE_DEBUG("Finalizing timemory...\n"); tim::timemory_finalize(); - HOSTTRACE_DEBUG("Finalizing timemory... Done\n"); + OMNITRACE_DEBUG("Finalizing timemory... Done\n"); if(_perfetto_output_error) throw std::runtime_error("Unable to create perfetto output file"); } - void hosttrace_trace_set_env(const char* env_name, const char* env_val) + void omnitrace_trace_set_env(const char* env_name, const char* env_val) { - HOSTTRACE_DEBUG("[%s] Setting env: %s=%s\n", __FUNCTION__, env_name, env_val); + OMNITRACE_DEBUG("[%s] Setting env: %s=%s\n", __FUNCTION__, env_name, env_val); tim::set_env(env_name, env_val, 0); } - void hosttrace_trace_set_mpi(bool use, bool attached) + void omnitrace_trace_set_mpi(bool use, bool attached) { - HOSTTRACE_DEBUG("[%s] use: %s, attached: %s\n", __FUNCTION__, (use) ? "y" : "n", + OMNITRACE_DEBUG("[%s] use: %s, attached: %s\n", __FUNCTION__, (use) ? "y" : "n", (attached) ? "y" : "n"); if(use && !attached) { @@ -612,7 +616,7 @@ get_main_bundle() { static auto _v = (setup_gotchas(), std::make_unique( - "hosttrace", quirk::config{})); + "omnitrace", quirk::config{})); return _v; } @@ -620,6 +624,6 @@ namespace { // if static objects are destroyed randomly (relatively uncommon behavior) // this might call finalization before perfetto ends the tracing session -// but static variable in hosttrace_init_tooling is more likely +// but static variable in omnitrace_init_tooling is more likely auto _ensure_finalization = ensure_finalization(true); } // namespace diff --git a/projects/rocprofiler-systems/src/library/config.cpp b/projects/rocprofiler-systems/src/library/config.cpp index fa33eca6aa..6a15901cc1 100644 --- a/projects/rocprofiler-systems/src/library/config.cpp +++ b/projects/rocprofiler-systems/src/library/config.cpp @@ -55,7 +55,7 @@ get_config() (void) _once; } -#define HOSTTRACE_CONFIG_SETTING(TYPE, ENV_NAME, DESCRIPTION, INITIAL_VALUE) \ +#define OMNITRACE_CONFIG_SETTING(TYPE, ENV_NAME, DESCRIPTION, INITIAL_VALUE) \ _config->insert(ENV_NAME, ENV_NAME, DESCRIPTION, INITIAL_VALUE, \ std::vector{}) } // namespace @@ -72,112 +72,112 @@ configure_settings() // if using timemory, default to perfetto being off auto _default_perfetto_v = - !tim::get_env("HOSTTRACE_USE_TIMEMORY", false, false); + !tim::get_env("OMNITRACE_USE_TIMEMORY", false, false); auto _default_config_file = - JOIN("/", tim::get_env("HOME", "."), "hosttrace.cfg"); + JOIN("/", tim::get_env("HOME", "."), "omnitrace.cfg"); - auto _system_backend = tim::get_env("HOSTTRACE_BACKEND_SYSTEM", false, false); + auto _system_backend = tim::get_env("OMNITRACE_BACKEND_SYSTEM", false, false); - HOSTTRACE_CONFIG_SETTING(std::string, "HOSTTRACE_CONFIG_FILE", - "Configuration file of hosttrace and timemory settings", + OMNITRACE_CONFIG_SETTING(std::string, "OMNITRACE_CONFIG_FILE", + "Configuration file of omnitrace and timemory settings", _default_config_file); - HOSTTRACE_CONFIG_SETTING(bool, "HOSTTRACE_DEBUG", "Enable debugging output", + OMNITRACE_CONFIG_SETTING(bool, "OMNITRACE_DEBUG", "Enable debugging output", _config->get_debug()); - auto _hosttrace_debug = _config->get("HOSTTRACE_DEBUG"); - if(_hosttrace_debug) tim::set_env("TIMEMORY_DEBUG_SETTINGS", "1", 0); + auto _omnitrace_debug = _config->get("OMNITRACE_DEBUG"); + if(_omnitrace_debug) tim::set_env("TIMEMORY_DEBUG_SETTINGS", "1", 0); - HOSTTRACE_CONFIG_SETTING(bool, "HOSTTRACE_USE_PERFETTO", "Enable perfetto backend", + OMNITRACE_CONFIG_SETTING(bool, "OMNITRACE_USE_PERFETTO", "Enable perfetto backend", _default_perfetto_v); - HOSTTRACE_CONFIG_SETTING(bool, "HOSTTRACE_USE_TIMEMORY", "Enable timemory backend", - !_config->get("HOSTTRACE_USE_PERFETTO")); + OMNITRACE_CONFIG_SETTING(bool, "OMNITRACE_USE_TIMEMORY", "Enable timemory backend", + !_config->get("OMNITRACE_USE_PERFETTO")); - HOSTTRACE_CONFIG_SETTING( - bool, "HOSTTRACE_USE_PID", + OMNITRACE_CONFIG_SETTING( + bool, "OMNITRACE_USE_PID", "Enable tagging filenames with process identifier (either MPI rank or pid)", true); - HOSTTRACE_CONFIG_SETTING( - size_t, "HOSTTRACE_SAMPLE_RATE", + OMNITRACE_CONFIG_SETTING( + size_t, "OMNITRACE_SAMPLE_RATE", "Counts every function call (N), only record function if (N % == 0)", 1); auto _backend = tim::get_env_choice( - "HOSTTRACE_BACKEND", + "OMNITRACE_BACKEND", (_system_backend) - ? "system" // if HOSTTRACE_BACKEND_SYSTEM is true, default to system. + ? "system" // if OMNITRACE_BACKEND_SYSTEM is true, default to system. : "inprocess", // Otherwise, default to inprocess { "inprocess", "system", "all" }, false); - HOSTTRACE_CONFIG_SETTING(std::string, "HOSTTRACE_BACKEND", + OMNITRACE_CONFIG_SETTING(std::string, "OMNITRACE_BACKEND", "Specify the perfetto backend to activate. Options are: " "'inprocess', 'system', or 'all'", _backend); - HOSTTRACE_CONFIG_SETTING(bool, "HOSTTRACE_CRITICAL_TRACE", + OMNITRACE_CONFIG_SETTING(bool, "OMNITRACE_CRITICAL_TRACE", "Enable generation of the critical trace", false); - HOSTTRACE_CONFIG_SETTING( - bool, "HOSTTRACE_ROCTRACER_TIMELINE_PROFILE", + OMNITRACE_CONFIG_SETTING( + bool, "OMNITRACE_ROCTRACER_TIMELINE_PROFILE", "Create unique entries for every kernel with timemory backend", _config->get_timeline_profile()); - HOSTTRACE_CONFIG_SETTING( - bool, "HOSTTRACE_ROCTRACER_FLAT_PROFILE", + OMNITRACE_CONFIG_SETTING( + bool, "OMNITRACE_ROCTRACER_FLAT_PROFILE", "Ignore hierarchy in all kernels entries with timemory backend", _config->get_flat_profile()); - HOSTTRACE_CONFIG_SETTING(bool, "HOSTTRACE_ROCTRACER_HSA_ACTIVITY", + OMNITRACE_CONFIG_SETTING(bool, "OMNITRACE_ROCTRACER_HSA_ACTIVITY", "Enable HSA activity tracing support", false); - HOSTTRACE_CONFIG_SETTING(bool, "HOSTTRACE_ROCTRACER_HSA_API", + OMNITRACE_CONFIG_SETTING(bool, "OMNITRACE_ROCTRACER_HSA_API", "Enable HSA API tracing support", false); - HOSTTRACE_CONFIG_SETTING(std::string, "HOSTTRACE_ROCTRACER_HSA_API_TYPES", + OMNITRACE_CONFIG_SETTING(std::string, "OMNITRACE_ROCTRACER_HSA_API_TYPES", "HSA API type to collect", ""); - HOSTTRACE_CONFIG_SETTING(bool, "HOSTTRACE_CRITICAL_TRACE_DEBUG", - "Enable debugging for critical trace", _hosttrace_debug); + OMNITRACE_CONFIG_SETTING(bool, "OMNITRACE_CRITICAL_TRACE_DEBUG", + "Enable debugging for critical trace", _omnitrace_debug); - HOSTTRACE_CONFIG_SETTING( - bool, "HOSTTRACE_CRITICAL_TRACE_SERIALIZE_NAMES", + OMNITRACE_CONFIG_SETTING( + bool, "OMNITRACE_CRITICAL_TRACE_SERIALIZE_NAMES", "Include names in serialization of critical trace (mainly for debugging)", - _hosttrace_debug); + _omnitrace_debug); - HOSTTRACE_CONFIG_SETTING(size_t, "HOSTTRACE_SHMEM_SIZE_HINT_KB", + OMNITRACE_CONFIG_SETTING(size_t, "OMNITRACE_SHMEM_SIZE_HINT_KB", "Hint for shared-memory buffer size in perfetto (in KB)", 40960); - HOSTTRACE_CONFIG_SETTING(size_t, "HOSTTRACE_BUFFER_SIZE_KB", + OMNITRACE_CONFIG_SETTING(size_t, "OMNITRACE_BUFFER_SIZE_KB", "Size of perfetto buffer (in KB)", 1024000); - HOSTTRACE_CONFIG_SETTING(int64_t, "HOSTTRACE_CRITICAL_TRACE_COUNT", + OMNITRACE_CONFIG_SETTING(int64_t, "OMNITRACE_CRITICAL_TRACE_COUNT", "Number of critical trace to export (0 == all)", 0); - HOSTTRACE_CONFIG_SETTING(uint64_t, "HOSTTRACE_CRITICAL_TRACE_BUFFER_COUNT", + OMNITRACE_CONFIG_SETTING(uint64_t, "OMNITRACE_CRITICAL_TRACE_BUFFER_COUNT", "Number of critical trace records to store in thread-local " "memory before submitting to shared buffer", 2000); - HOSTTRACE_CONFIG_SETTING( - uint64_t, "HOSTTRACE_CRITICAL_TRACE_NUM_THREADS", + OMNITRACE_CONFIG_SETTING( + uint64_t, "OMNITRACE_CRITICAL_TRACE_NUM_THREADS", "Number of threads to use when generating the critical trace", std::min(8, std::thread::hardware_concurrency())); - HOSTTRACE_CONFIG_SETTING( - int64_t, "HOSTTRACE_CRITICAL_TRACE_PER_ROW", + OMNITRACE_CONFIG_SETTING( + int64_t, "OMNITRACE_CRITICAL_TRACE_PER_ROW", "How many critical traces per row in perfetto (0 == all in one row)", 0); - HOSTTRACE_CONFIG_SETTING( - std::string, "HOSTTRACE_COMPONENTS", + OMNITRACE_CONFIG_SETTING( + std::string, "OMNITRACE_COMPONENTS", "List of components to collect via timemory (see timemory-avail)", "wall_clock"); - HOSTTRACE_CONFIG_SETTING(std::string, "HOSTTRACE_OUTPUT_FILE", "Perfetto filename", + OMNITRACE_CONFIG_SETTING(std::string, "OMNITRACE_OUTPUT_FILE", "Perfetto filename", ""); - HOSTTRACE_CONFIG_SETTING(bool, "HOSTTRACE_SETTINGS_DESC", + OMNITRACE_CONFIG_SETTING(bool, "OMNITRACE_SETTINGS_DESC", "Provide descriptions when printing settings", false); _config->get_flamegraph_output() = false; @@ -193,13 +193,13 @@ configure_settings() _config->get_timing_precision() = 6; for(auto&& itr : - tim::delimit(_config->get("HOSTTRACE_CONFIG_FILE"), ";:")) + tim::delimit(_config->get("OMNITRACE_CONFIG_FILE"), ";:")) { - HOSTTRACE_CONDITIONAL_BASIC_PRINT(true, "Reading config file %s\n", itr.c_str()); + OMNITRACE_CONDITIONAL_BASIC_PRINT(true, "Reading config file %s\n", itr.c_str()); _config->read(itr); } - _config->get_global_components() = _config->get("HOSTTRACE_COMPONENTS"); + _config->get_global_components() = _config->get("OMNITRACE_COMPONENTS"); // always initialize timemory because gotcha wrappers are always used auto _cmd = tim::read_command_line(process::get_id()); @@ -220,11 +220,11 @@ configure_settings() using argparser_t = tim::argparse::argument_parser; argparser_t _parser{ _exe }; - tim::timemory_init(_cmd, _parser, "hosttrace-"); + tim::timemory_init(_cmd, _parser, "omnitrace-"); settings::suppress_parsing() = true; settings::suppress_config() = true; - settings::use_output_suffix() = _config->get("HOSTTRACE_USE_PID"); + settings::use_output_suffix() = _config->get("OMNITRACE_USE_PID"); } void @@ -253,12 +253,12 @@ print_config_settings(std::ostream& _os, std::sort(_data.begin(), _data.end(), [](const auto& lhs, const auto& rhs) { auto _npos = std::string::npos; - // HOSTTRACE_CONFIG_FILE always first - if(lhs.at(0).find("HOSTTRACE_CONFIG") != _npos) return true; - if(rhs.at(0).find("HOSTTRACE_CONFIG") != _npos) return false; - // HOSTTRACE_USE_* prioritized - auto _lhs_use = lhs.at(0).find("HOSTTRACE_USE_"); - auto _rhs_use = rhs.at(0).find("HOSTTRACE_USE_"); + // OMNITRACE_CONFIG_FILE always first + if(lhs.at(0).find("OMNITRACE_CONFIG") != _npos) return true; + if(rhs.at(0).find("OMNITRACE_CONFIG") != _npos) return false; + // OMNITRACE_USE_* prioritized + auto _lhs_use = lhs.at(0).find("OMNITRACE_USE_"); + auto _rhs_use = rhs.at(0).find("OMNITRACE_USE_"); if(_lhs_use != _rhs_use && _lhs_use < _rhs_use) return true; if(_lhs_use != _rhs_use && _lhs_use > _rhs_use) return false; // length sort followed by alphabetical sort @@ -267,7 +267,7 @@ print_config_settings(std::ostream& _os, : (lhs.at(0).length() < rhs.at(0).length()); }); - bool _print_desc = get_debug() || get_config()->get("HOSTTRACE_SETTINGS_DESC"); + bool _print_desc = get_debug() || get_config()->get("OMNITRACE_SETTINGS_DESC"); auto tot_width = std::accumulate(_widths.begin(), _widths.end(), 0); if(!_print_desc) tot_width -= _widths.back() + 4; @@ -277,7 +277,7 @@ print_config_settings(std::ostream& _os, _spacer << "#" << std::setw(tot_width + 11) << "" << "#"; _os << _spacer.str() << "\n"; - // _os << "# Hosttrace settings:" << std::setw(tot_width - 8) << "#" << "\n"; + // _os << "# Omnitrace settings:" << std::setw(tot_width - 8) << "#" << "\n"; for(const auto& itr : _data) { _os << "# "; @@ -315,112 +315,112 @@ get_exe_name() std::string get_config_file() { - static auto _v = get_config()->find("HOSTTRACE_CONFIG_FILE"); + static auto _v = get_config()->find("OMNITRACE_CONFIG_FILE"); return static_cast&>(*_v->second).get(); } bool get_debug() { - static auto _v = get_config()->find("HOSTTRACE_DEBUG"); + static auto _v = get_config()->find("OMNITRACE_DEBUG"); return static_cast&>(*_v->second).get(); } bool get_use_perfetto() { - static auto _v = get_config()->find("HOSTTRACE_USE_PERFETTO"); + static auto _v = get_config()->find("OMNITRACE_USE_PERFETTO"); return static_cast&>(*_v->second).get(); } bool get_use_timemory() { - static auto _v = get_config()->find("HOSTTRACE_USE_TIMEMORY"); + static auto _v = get_config()->find("OMNITRACE_USE_TIMEMORY"); return static_cast&>(*_v->second).get(); } bool& get_use_pid() { - static auto _v = get_config()->find("HOSTTRACE_USE_PID"); + static auto _v = get_config()->find("OMNITRACE_USE_PID"); return static_cast&>(*_v->second).get(); } bool get_use_mpip() { - static bool _v = tim::get_env("HOSTTRACE_USE_MPIP", false, false); + static bool _v = tim::get_env("OMNITRACE_USE_MPIP", false, false); return _v; } bool get_use_critical_trace() { - static auto _v = get_config()->find("HOSTTRACE_CRITICAL_TRACE"); + static auto _v = get_config()->find("OMNITRACE_CRITICAL_TRACE"); return static_cast&>(*_v->second).get(); } bool get_critical_trace_debug() { - static auto _v = get_config()->find("HOSTTRACE_CRITICAL_TRACE_DEBUG"); + static auto _v = get_config()->find("OMNITRACE_CRITICAL_TRACE_DEBUG"); return static_cast&>(*_v->second).get(); } bool get_critical_trace_serialize_names() { - static auto _v = get_config()->find("HOSTTRACE_CRITICAL_TRACE_SERIALIZE_NAMES"); + static auto _v = get_config()->find("OMNITRACE_CRITICAL_TRACE_SERIALIZE_NAMES"); return static_cast&>(*_v->second).get(); } bool get_roctracer_timeline_profile() { - static auto _v = get_config()->find("HOSTTRACE_ROCTRACER_TIMELINE_PROFILE"); + static auto _v = get_config()->find("OMNITRACE_ROCTRACER_TIMELINE_PROFILE"); return static_cast&>(*_v->second).get(); } bool get_roctracer_flat_profile() { - static auto _v = get_config()->find("HOSTTRACE_ROCTRACER_FLAT_PROFILE"); + static auto _v = get_config()->find("OMNITRACE_ROCTRACER_FLAT_PROFILE"); return static_cast&>(*_v->second).get(); } bool get_trace_hsa_api() { - static auto _v = get_config()->find("HOSTTRACE_ROCTRACER_HSA_API"); + static auto _v = get_config()->find("OMNITRACE_ROCTRACER_HSA_API"); return static_cast&>(*_v->second).get(); } bool get_trace_hsa_activity() { - static auto _v = get_config()->find("HOSTTRACE_ROCTRACER_HSA_ACTIVITY"); + static auto _v = get_config()->find("OMNITRACE_ROCTRACER_HSA_ACTIVITY"); return static_cast&>(*_v->second).get(); } int64_t get_critical_trace_per_row() { - static auto _v = get_config()->find("HOSTTRACE_CRITICAL_TRACE_PER_ROW"); + static auto _v = get_config()->find("OMNITRACE_CRITICAL_TRACE_PER_ROW"); return static_cast&>(*_v->second).get(); } size_t get_perfetto_shmem_size_hint() { - static auto _v = get_config()->find("HOSTTRACE_SHMEM_SIZE_HINT_KB"); + static auto _v = get_config()->find("OMNITRACE_SHMEM_SIZE_HINT_KB"); return static_cast&>(*_v->second).get(); } size_t get_perfetto_buffer_size() { - static auto _v = get_config()->find("HOSTTRACE_BUFFER_SIZE_KB"); + static auto _v = get_config()->find("OMNITRACE_BUFFER_SIZE_KB"); return static_cast&>(*_v->second).get(); } @@ -428,7 +428,7 @@ uint64_t get_critical_trace_update_freq() { static uint64_t _v = - get_config()->get("HOSTTRACE_CRITICAL_TRACE_BUFFER_COUNT"); + get_config()->get("OMNITRACE_CRITICAL_TRACE_BUFFER_COUNT"); return _v; } @@ -436,7 +436,7 @@ uint64_t get_critical_trace_num_threads() { static uint64_t _v = - get_config()->get("HOSTTRACE_CRITICAL_TRACE_NUM_THREADS"); + get_config()->get("OMNITRACE_CRITICAL_TRACE_NUM_THREADS"); return _v; } @@ -444,7 +444,7 @@ std::string get_trace_hsa_api_types() { static std::string _v = - get_config()->get("HOSTTRACE_ROCTRACER_HSA_API_TYPES"); + get_config()->get("OMNITRACE_ROCTRACER_HSA_API_TYPES"); return _v; } @@ -452,14 +452,14 @@ std::string& get_backend() { // select inprocess, system, or both (i.e. all) - static auto _v = get_config()->find("HOSTTRACE_BACKEND"); + static auto _v = get_config()->find("OMNITRACE_BACKEND"); return static_cast&>(*_v->second).get(); } std::string get_perfetto_output_filename() { - static auto _v = get_config()->find("HOSTTRACE_OUTPUT_FILE"); + static auto _v = get_config()->find("OMNITRACE_OUTPUT_FILE"); static auto& _t = static_cast&>(*_v->second); if(_t.get().empty()) { @@ -475,7 +475,7 @@ get_perfetto_output_filename() _default_fname.replace(_dpos, _pid_patch.length(), "/perfetto-trace"); // have the default display the full path to the output file _t.set(tim::get_env( - "HOSTTRACE_OUTPUT_FILE", + "OMNITRACE_OUTPUT_FILE", JOIN('/', tim::get_env("PWD", ".", false), _default_fname), false)); } @@ -485,14 +485,14 @@ get_perfetto_output_filename() size_t& get_sample_rate() { - static auto _v = get_config()->find("HOSTTRACE_SAMPLE_RATE"); + static auto _v = get_config()->find("OMNITRACE_SAMPLE_RATE"); return static_cast&>(*_v->second).get(); } int64_t get_critical_trace_count() { - static auto _v = get_config()->find("HOSTTRACE_CRITICAL_TRACE_COUNT"); + static auto _v = get_config()->find("OMNITRACE_CRITICAL_TRACE_COUNT"); return static_cast&>(*_v->second).get(); } @@ -513,10 +513,10 @@ get_cpu_cid() std::unique_ptr>& get_cpu_cid_stack(int64_t _tid) { - struct hosttrace_cpu_cid_stack + struct omnitrace_cpu_cid_stack {}; using thread_data_t = - hosttrace_thread_data, hosttrace_cpu_cid_stack>; + omnitrace_thread_data, omnitrace_cpu_cid_stack>; static auto& _v = thread_data_t::instances(); static thread_local auto _v_check = [_tid]() { thread_data_t::construct((_tid > 0) ? *thread_data_t::instances().at(0) diff --git a/projects/rocprofiler-systems/src/library/critical_trace.cpp b/projects/rocprofiler-systems/src/library/critical_trace.cpp index 0436b242d7..79d9005396 100644 --- a/projects/rocprofiler-systems/src/library/critical_trace.cpp +++ b/projects/rocprofiler-systems/src/library/critical_trace.cpp @@ -178,7 +178,7 @@ entry::operator+=(const entry& rhs) } else { - HOSTTRACE_PRINT( + OMNITRACE_PRINT( "Warning! Incorrect phase. entry::operator+=(entry) is only valid for " "Phase::BEGIN += Phase::END\n"); } @@ -231,7 +231,7 @@ entry::get_overlap(const entry& rhs) const return (rhs.end_ns - begin_ns); else { - HOSTTRACE_PRINT("Warning! entry::get_overlap(entry, tid) " + OMNITRACE_PRINT("Warning! entry::get_overlap(entry, tid) " "could not determine the overlap :: %s\n", JOIN("", *this).c_str()); } @@ -265,7 +265,7 @@ entry::get_independent(const entry& rhs) const return (end_ns - rhs.end_ns); else { - HOSTTRACE_PRINT("Warning! entry::get_independent(entry, tid) " + OMNITRACE_PRINT("Warning! entry::get_independent(entry, tid) " "could not determine the overlap :: %s\n", JOIN("", *this).c_str()); } @@ -335,7 +335,7 @@ entry::is_delta(const entry& _v, const std::string_view& _ctx) { if(_v.phase != Phase::DELTA) { - HOSTTRACE_CT_DEBUG( + OMNITRACE_CT_DEBUG( "Warning! Invalid phase for entry. entry::%s requires Phase::DELTA :: %s\n", _ctx.data(), JOIN("", _v).c_str()); return true; @@ -487,7 +487,7 @@ get_update_frequency() std::unique_ptr& get(int64_t _tid) { - static auto& _v = hosttrace_thread_data::instances(); + static auto& _v = omnitrace_thread_data::instances(); static thread_local auto _once = [_tid]() { if(!_v.at(0)) _v.at(0) = std::make_unique(); if(!_v.at(_tid)) _v.at(_tid) = std::make_unique(); @@ -517,7 +517,7 @@ size_t add_hash_id(const std::string& _label) { using critical_trace_hash_data = - hosttrace_thread_data; + omnitrace_thread_data; auto _hash = tim::hash::add_hash_id(_label); if(get_use_critical_trace()) @@ -575,7 +575,7 @@ save_call_graph(const std::string& _fname, const std::string& _label, const call_graph_t& _call_graph, bool _msg = false, std::string _func = {}) { - HOSTTRACE_CT_DEBUG("[%s]\n", __FUNCTION__); + OMNITRACE_CT_DEBUG("[%s]\n", __FUNCTION__); using perfstats_t = tim::lightweight_tuple; @@ -590,7 +590,7 @@ save_call_graph(const std::string& _fname, const std::string& _label, auto _hash_map = *tim::hash::get_hash_ids(); for(auto& itr : _hash_map) itr.second = tim::demangle(itr.second); - ar->setNextName("hosttrace"); + ar->setNextName("omnitrace"); ar->startNode(); (*ar)(cereal::make_nvp("hash_map", _hash_map)); ar->setNextName(_label.c_str()); @@ -606,7 +606,7 @@ save_call_graph(const std::string& _fname, const std::string& _label, if(_msg) { if(_func.empty()) _func = __FUNCTION__; - HOSTTRACE_PRINT("[%s] Outputting '%s'...\n", _func.c_str(), _fname.c_str()); + OMNITRACE_PRINT("[%s] Outputting '%s'...\n", _func.c_str(), _fname.c_str()); } ofs << oss.str() << std::endl; } @@ -614,7 +614,7 @@ save_call_graph(const std::string& _fname, const std::string& _label, _perf.stop(); if(_msg) { - HOSTTRACE_CT_DEBUG("%s\n", JOIN("", _perf).c_str()); + OMNITRACE_CT_DEBUG("%s\n", JOIN("", _perf).c_str()); } } @@ -623,7 +623,7 @@ save_critical_trace(const std::string& _fname, const std::string& _label, const std::vector& _cchain, bool _msg = false, std::string _func = {}) { - HOSTTRACE_CT_DEBUG("[%s]\n", __FUNCTION__); + OMNITRACE_CT_DEBUG("[%s]\n", __FUNCTION__); using perfstats_t = tim::lightweight_tuple; @@ -637,7 +637,7 @@ save_critical_trace(const std::string& _fname, const std::string& _label, auto _hash_map = *tim::hash::get_hash_ids(); for(auto& itr : _hash_map) itr.second = tim::demangle(itr.second); - ar->setNextName("hosttrace"); + ar->setNextName("omnitrace"); ar->startNode(); (*ar)(cereal::make_nvp("hash_map", _hash_map), cereal::make_nvp(_label.c_str(), _cchain)); @@ -650,7 +650,7 @@ save_critical_trace(const std::string& _fname, const std::string& _label, if(_msg) { if(_func.empty()) _func = __FUNCTION__; - HOSTTRACE_PRINT("[%s] Outputting '%s'...\n", _func.c_str(), _fname.c_str()); + OMNITRACE_PRINT("[%s] Outputting '%s'...\n", _func.c_str(), _fname.c_str()); } std::stringstream oss{}; if(_cchain.size() > 1000) @@ -667,7 +667,7 @@ save_critical_trace(const std::string& _fname, const std::string& _label, _perf.stop(); if(_msg) { - HOSTTRACE_CT_DEBUG("%s\n", JOIN("", _perf).c_str()); + OMNITRACE_CT_DEBUG("%s\n", JOIN("", _perf).c_str()); } } @@ -675,7 +675,7 @@ void save_call_chain_text(const std::string& _fname, const call_chain& _call_chain, bool _msg = false, std::string _func = {}) { - HOSTTRACE_CT_DEBUG("[%s]\n", __FUNCTION__); + OMNITRACE_CT_DEBUG("[%s]\n", __FUNCTION__); using perfstats_t = tim::lightweight_tuple; @@ -688,7 +688,7 @@ save_call_chain_text(const std::string& _fname, const call_chain& _call_chain, if(_msg) { if(_func.empty()) _func = __FUNCTION__; - HOSTTRACE_PRINT("[%s] Outputting '%s'...\n", _func.c_str(), _fname.c_str()); + OMNITRACE_PRINT("[%s] Outputting '%s'...\n", _func.c_str(), _fname.c_str()); } ofs << _call_chain << "\n"; } @@ -696,7 +696,7 @@ save_call_chain_text(const std::string& _fname, const call_chain& _call_chain, _perf.stop(); if(_msg) { - HOSTTRACE_CT_DEBUG("%s\n", JOIN("", _perf).c_str()); + OMNITRACE_CT_DEBUG("%s\n", JOIN("", _perf).c_str()); } } @@ -705,7 +705,7 @@ save_call_chain_json(const std::string& _fname, const std::string& _label, const call_chain& _call_chain, bool _msg = false, std::string _func = {}) { - HOSTTRACE_CT_DEBUG("[%s]\n", __FUNCTION__); + OMNITRACE_CT_DEBUG("[%s]\n", __FUNCTION__); using perfstats_t = tim::lightweight_tuple; @@ -719,7 +719,7 @@ save_call_chain_json(const std::string& _fname, const std::string& _label, auto _hash_map = *tim::hash::get_hash_ids(); for(auto& itr : _hash_map) itr.second = tim::demangle(itr.second); - ar->setNextName("hosttrace"); + ar->setNextName("omnitrace"); ar->startNode(); (*ar)(cereal::make_nvp("hash_map", _hash_map), cereal::make_nvp(_label.c_str(), _call_chain)); @@ -732,7 +732,7 @@ save_call_chain_json(const std::string& _fname, const std::string& _label, if(_msg) { if(_func.empty()) _func = __FUNCTION__; - HOSTTRACE_PRINT("[%s] Outputting '%s'...\n", _func.c_str(), _fname.c_str()); + OMNITRACE_PRINT("[%s] Outputting '%s'...\n", _func.c_str(), _fname.c_str()); } std::stringstream oss{}; if(_call_chain.size() > 100000) @@ -749,7 +749,7 @@ save_call_chain_json(const std::string& _fname, const std::string& _label, _perf.stop(); if(_msg) { - HOSTTRACE_CT_DEBUG("%s\n", JOIN("", _perf).c_str()); + OMNITRACE_CT_DEBUG("%s\n", JOIN("", _perf).c_str()); } } @@ -764,7 +764,7 @@ load_call_chain(const std::string& _fname, const std::string& _label, namespace cereal = tim::cereal; auto ar = tim::policy::input_archive::get(ifs); - ar->setNextName("hosttrace"); + ar->setNextName("omnitrace"); ar->startNode(); (*ar)(cereal::make_nvp(_label.c_str(), _call_chain)); ar->finishNode(); @@ -798,7 +798,7 @@ find( void squash_critical_path(call_chain& _targ) { - HOSTTRACE_CT_DEBUG("[%s]\n", __FUNCTION__); + OMNITRACE_CT_DEBUG("[%s]\n", __FUNCTION__); static auto _strict_equal = [](const entry& _lhs, const entry& _rhs) { auto _same_phase = (_lhs.phase == _rhs.phase); bool _phase_check = true; @@ -836,7 +836,7 @@ squash_critical_path(call_chain& _targ) void combine_critical_path(call_chain& _targ, call_chain _chain) { - HOSTTRACE_CT_DEBUG("[%s]\n", __FUNCTION__); + OMNITRACE_CT_DEBUG("[%s]\n", __FUNCTION__); call_chain _delta{}; call_chain _begin{}; call_chain _end{}; @@ -876,7 +876,7 @@ combine_critical_path(call_chain& _targ, call_chain _chain) auto get_indexed(const call_chain& _chain) { - HOSTTRACE_CT_DEBUG("[%s]\n", __FUNCTION__); + OMNITRACE_CT_DEBUG("[%s]\n", __FUNCTION__); std::map> _indexed = {}; // allocate for all cpu correlation ids @@ -906,7 +906,7 @@ get_indexed(const call_chain& _chain) void find_children(PTL::ThreadPool& _tp, call_graph_t& _graph, const call_chain& _chain) { - HOSTTRACE_CT_DEBUG("[%s]\n", __FUNCTION__); + OMNITRACE_CT_DEBUG("[%s]\n", __FUNCTION__); using iterator_t = call_graph_sibling_itr_t; using itr_entry_vec_t = std::vector>; @@ -916,20 +916,20 @@ find_children(PTL::ThreadPool& _tp, call_graph_t& _graph, const call_chain& _cha std::map> _entry_map{}; // allocate all entries - HOSTTRACE_CT_DEBUG("[%s] Allocating...\n", __FUNCTION__); + OMNITRACE_CT_DEBUG("[%s] Allocating...\n", __FUNCTION__); for(const auto& itr : _chain) { auto _ins = _entry_map.emplace(itr, std::vector{}); if(!_ins.second) { auto _existing = _ins.first->first; - HOSTTRACE_PRINT("Warning! Duplicate entry for [%s] :: [%s]\n", + OMNITRACE_PRINT("Warning! Duplicate entry for [%s] :: [%s]\n", JOIN("", _existing).c_str(), JOIN("", itr).c_str()); } } task_group_t _tg{ &_tp }; - HOSTTRACE_CT_DEBUG("[%s] Parallel mapping...\n", __FUNCTION__); + OMNITRACE_CT_DEBUG("[%s] Parallel mapping...\n", __FUNCTION__); for(const auto& itr : _chain) { _tg.run([&]() { _entry_map[itr] = _indexed.at(itr.cpu_cid); }); @@ -972,12 +972,12 @@ find_children(PTL::ThreadPool& _tp, call_graph_t& _graph, const call_chain& _cha if(!_indexed.at(-1).empty()) { - HOSTTRACE_CT_DEBUG("[%s] Setting root (line %i)...\n", __FUNCTION__, __LINE__); + OMNITRACE_CT_DEBUG("[%s] Setting root (line %i)...\n", __FUNCTION__, __LINE__); _graph.set_head(_indexed.at(-1).front()); } else { - HOSTTRACE_CT_DEBUG("[%s] Setting root (line %i)...\n", __FUNCTION__, __LINE__); + OMNITRACE_CT_DEBUG("[%s] Setting root (line %i)...\n", __FUNCTION__, __LINE__); auto _depth = static_cast(-1); entry _root{ 0, Device::NONE, Phase::NONE, _depth, 0, 0, 0, 0, 0, 0, 0 }; _graph.set_head(_root); @@ -988,7 +988,7 @@ find_children(PTL::ThreadPool& _tp, call_graph_t& _graph, const call_chain& _cha { if(itr.first.depth == _root->depth + 1) { - HOSTTRACE_CT_DEBUG("[%s] Generating call-graph...\n", __FUNCTION__); + OMNITRACE_CT_DEBUG("[%s] Generating call-graph...\n", __FUNCTION__); // _recursive_func(_root, itr.first); itr_entry_vec_t _data = _func(_root, itr.first); while(_loop_func(_data)) @@ -1001,7 +1001,7 @@ void find_sequences(PTL::ThreadPool& _tp, call_graph_t& _graph, std::vector& _chain) { - HOSTTRACE_CT_DEBUG("[%s]\n", __FUNCTION__); + OMNITRACE_CT_DEBUG("[%s]\n", __FUNCTION__); using iterator_t = call_graph_preorder_itr_t; std::vector _end_nodes{}; size_t _n = 0; @@ -1010,13 +1010,13 @@ find_sequences(PTL::ThreadPool& _tp, call_graph_t& _graph, auto _nchild = _graph.number_of_children(itr); if(_nchild > 0) { - HOSTTRACE_CT_DEBUG("Skipping node #%zu with %u children :: %s\n", _n, _nchild, + OMNITRACE_CT_DEBUG("Skipping node #%zu with %u children :: %s\n", _n, _nchild, JOIN("", *itr).c_str()); continue; } _end_nodes.emplace_back(itr); } - HOSTTRACE_CT_DEBUG("Number of end nodes: %zu\n", _end_nodes.size()); + OMNITRACE_CT_DEBUG("Number of end nodes: %zu\n", _end_nodes.size()); _chain.resize(_end_nodes.size()); auto _construct = [&](size_t i) { @@ -1044,7 +1044,7 @@ template void serialize_graph(ArchiveT& ar, const tim::graph& t) { - HOSTTRACE_CT_DEBUG("[%s]\n", __FUNCTION__); + OMNITRACE_CT_DEBUG("[%s]\n", __FUNCTION__); namespace cereal = tim::cereal; using iterator_t = typename tim::graph::sibling_iterator; @@ -1084,7 +1084,7 @@ serialize_subgraph(ArchiveT& ar, const tim::graph& _graph, void update_critical_path(call_chain _chain, int64_t _tid) { - HOSTTRACE_CT_DEBUG("[%s]\n", __FUNCTION__); + OMNITRACE_CT_DEBUG("[%s]\n", __FUNCTION__); try { // remove any data not @@ -1103,7 +1103,7 @@ template std::vector get_top(const std::vector& _chain, size_t _count) { - HOSTTRACE_CT_DEBUG("[%s]\n", __FUNCTION__); + OMNITRACE_CT_DEBUG("[%s]\n", __FUNCTION__); std::vector _data{}; _data.reserve(_count); for(const auto& itr : _chain) @@ -1121,7 +1121,7 @@ template void generate_perfetto(const std::vector& _data) { - HOSTTRACE_CT_DEBUG("[%s]\n", __FUNCTION__); + OMNITRACE_CT_DEBUG("[%s]\n", __FUNCTION__); auto _func = [&](size_t _beg, size_t _end) { // ensure all hash ids exist copy_hash_ids(); @@ -1151,7 +1151,7 @@ compute_critical_trace() if(_computed) return; - HOSTTRACE_CT_DEBUG("[%s] Generating critical trace...\n", __FUNCTION__); + OMNITRACE_CT_DEBUG("[%s] Generating critical trace...\n", __FUNCTION__); // ensure all hash ids exist copy_hash_ids(); @@ -1169,7 +1169,7 @@ compute_critical_trace() _tp.set_verbose(-1); PTL::TaskGroup _tg{ &_tp }; - HOSTTRACE_CT_DEBUG("[%s] initial call chain: %zu entries\n", __FUNCTION__, + OMNITRACE_CT_DEBUG("[%s] initial call chain: %zu entries\n", __FUNCTION__, complete_call_chain.size()); perfstats_t _perf{ get_perf_name(__FUNCTION__) }; @@ -1178,17 +1178,17 @@ compute_critical_trace() std::sort(complete_call_chain.begin(), complete_call_chain.end()); _perf.stop().rekey("Sorting critical trace"); - HOSTTRACE_CT_DEBUG("%s\n", JOIN("", _perf).c_str()); + OMNITRACE_CT_DEBUG("%s\n", JOIN("", _perf).c_str()); _perf.start(); squash_critical_path(complete_call_chain); - HOSTTRACE_CT_DEBUG("[%s] complete call chain: %zu entries\n", __FUNCTION__, + OMNITRACE_CT_DEBUG("[%s] complete call chain: %zu entries\n", __FUNCTION__, complete_call_chain.size()); _perf.stop().rekey("Squash critical path"); - HOSTTRACE_CT_DEBUG("%s\n", JOIN("", _perf).c_str()); + OMNITRACE_CT_DEBUG("%s\n", JOIN("", _perf).c_str()); _tg.run( [](call_chain _chain, std::string _func) { @@ -1203,15 +1203,15 @@ compute_critical_trace() _perf.reset().start(); - HOSTTRACE_CT_DEBUG("[%s] Finding children...\n", __FUNCTION__); + OMNITRACE_CT_DEBUG("[%s] Finding children...\n", __FUNCTION__); call_graph_t _graph{}; find_children(_tp, _graph, complete_call_chain); - HOSTTRACE_CT_DEBUG("[%s] complete call graph: %zu entries\n", __FUNCTION__, + OMNITRACE_CT_DEBUG("[%s] complete call graph: %zu entries\n", __FUNCTION__, _graph.size() - 1); _perf.stop().rekey("Finding children"); - HOSTTRACE_CT_DEBUG("%s\n", JOIN("", _perf).c_str()); + OMNITRACE_CT_DEBUG("%s\n", JOIN("", _perf).c_str()); _tg.run( [&](std::string _func) { @@ -1227,17 +1227,17 @@ compute_critical_trace() _perf.reset().start(); - HOSTTRACE_CT_DEBUG("[%s] Finding sequences...\n", __FUNCTION__); + OMNITRACE_CT_DEBUG("[%s] Finding sequences...\n", __FUNCTION__); // find the sequences std::vector _top{}; find_sequences(_tp, _graph, _top); _perf.stop().rekey("Finding sequences"); - HOSTTRACE_CT_DEBUG("%s\n", JOIN("", _perf).c_str()); + OMNITRACE_CT_DEBUG("%s\n", JOIN("", _perf).c_str()); if(get_critical_trace_count() == 0) { - HOSTTRACE_CT_DEBUG("[%s] Saving critical trace...\n", __FUNCTION__); + OMNITRACE_CT_DEBUG("[%s] Saving critical trace...\n", __FUNCTION__); save_critical_trace( tim::settings::compose_output_filename( "critical-trace", ".json", get_use_pid(), @@ -1246,15 +1246,15 @@ compute_critical_trace() } else { - HOSTTRACE_CT_DEBUG("[%s] Getting top CPU functions...\n", __FUNCTION__); + OMNITRACE_CT_DEBUG("[%s] Getting top CPU functions...\n", __FUNCTION__); // get the top CPU critical traces auto _top_cpu = get_top(_top, get_critical_trace_count()); if(!_top_cpu.empty()) { - HOSTTRACE_CT_DEBUG("[%s] Generating perfetto CPU critical traces...\n", + OMNITRACE_CT_DEBUG("[%s] Generating perfetto CPU critical traces...\n", __FUNCTION__); generate_perfetto(_top_cpu); - HOSTTRACE_CT_DEBUG("[%s] Saving CPU critical traces...\n", __FUNCTION__); + OMNITRACE_CT_DEBUG("[%s] Saving CPU critical traces...\n", __FUNCTION__); save_critical_trace(tim::settings::compose_output_filename( "critical-trace-cpu", ".json", get_use_pid(), (tim::dmp::is_initialized()) ? tim::dmp::rank() @@ -1262,15 +1262,15 @@ compute_critical_trace() "critical_trace", _top_cpu, true, __FUNCTION__); } - HOSTTRACE_CT_DEBUG("[%s] Getting top GPU functions...\n", __FUNCTION__); + OMNITRACE_CT_DEBUG("[%s] Getting top GPU functions...\n", __FUNCTION__); // get the top GPU critical traces auto _top_gpu = get_top(_top, get_critical_trace_count()); if(!_top_gpu.empty()) { - HOSTTRACE_CT_DEBUG("[%s] Generating perfetto GPU critical traces...\n", + OMNITRACE_CT_DEBUG("[%s] Generating perfetto GPU critical traces...\n", __FUNCTION__); generate_perfetto(_top_gpu); - HOSTTRACE_CT_DEBUG("[%s] Saving GPU critical traces...\n", __FUNCTION__); + OMNITRACE_CT_DEBUG("[%s] Saving GPU critical traces...\n", __FUNCTION__); save_critical_trace(tim::settings::compose_output_filename( "critical-trace-gpu", ".json", get_use_pid(), (tim::dmp::is_initialized()) ? tim::dmp::rank() @@ -1285,7 +1285,7 @@ compute_critical_trace() } catch(const std::exception& e) { - HOSTTRACE_PRINT("Thread exited '%s' with exception: %s\n", __FUNCTION__, + OMNITRACE_PRINT("Thread exited '%s' with exception: %s\n", __FUNCTION__, e.what()); TIMEMORY_CONDITIONAL_DEMANGLED_BACKTRACE(true, 32); } @@ -1294,7 +1294,7 @@ compute_critical_trace() auto _ct_msg = JOIN("", _ct_perf); auto _ct_pos = _ct_msg.find(">>> "); if(_ct_pos != std::string::npos) _ct_msg = _ct_msg.substr(_ct_pos + 5); - HOSTTRACE_PRINT("%s\n", _ct_msg.c_str()); + OMNITRACE_PRINT("%s\n", _ct_msg.c_str()); } } // namespace } // namespace critical_trace diff --git a/projects/rocprofiler-systems/src/library/fork_gotcha.cpp b/projects/rocprofiler-systems/src/library/fork_gotcha.cpp index 612859bed3..abbe308cba 100644 --- a/projects/rocprofiler-systems/src/library/fork_gotcha.cpp +++ b/projects/rocprofiler-systems/src/library/fork_gotcha.cpp @@ -33,7 +33,7 @@ void fork_gotcha::audit(const gotcha_data_t&, audit::incoming) { - HOSTTRACE_DEBUG( + OMNITRACE_DEBUG( "Warning! Calling fork() within an OpenMPI application using libfabric " "may result is segmentation fault\n"); TIMEMORY_CONDITIONAL_DEMANGLED_BACKTRACE(get_debug(), 16); @@ -42,5 +42,5 @@ fork_gotcha::audit(const gotcha_data_t&, audit::incoming) void fork_gotcha::audit(const gotcha_data_t& _data, audit::outgoing, pid_t _pid) { - HOSTTRACE_DEBUG("%s() return PID %i\n", _data.tool_id.c_str(), (int) _pid); + OMNITRACE_DEBUG("%s() return PID %i\n", _data.tool_id.c_str(), (int) _pid); } diff --git a/projects/rocprofiler-systems/src/library/mpi_gotcha.cpp b/projects/rocprofiler-systems/src/library/mpi_gotcha.cpp index 6e86e7ae52..c0e60fe686 100644 --- a/projects/rocprofiler-systems/src/library/mpi_gotcha.cpp +++ b/projects/rocprofiler-systems/src/library/mpi_gotcha.cpp @@ -29,29 +29,29 @@ #include "library/mpi_gotcha.hpp" #include "library/config.hpp" #include "library/debug.hpp" -#include "library/hosttrace_component.hpp" +#include "library/omnitrace_component.hpp" namespace { uint64_t mpip_index = std::numeric_limits::max(); std::string mpi_init_string = {}; -// this ensures hosttrace_trace_finalize is called before MPI_Finalize +// this ensures omnitrace_trace_finalize is called before MPI_Finalize void -hosttrace_mpi_set_attr() +omnitrace_mpi_set_attr() { #if defined(TIMEMORY_USE_MPI) static auto _mpi_copy = [](MPI_Comm, int, void*, void*, void*, int*) { return MPI_SUCCESS; }; static auto _mpi_fini = [](MPI_Comm, int, void*, void*) { - HOSTTRACE_DEBUG("MPI Comm attribute finalize\n"); + OMNITRACE_DEBUG("MPI Comm attribute finalize\n"); if(mpip_index != std::numeric_limits::max()) - comp::deactivate_mpip, hosttrace>( + comp::deactivate_mpip, omnitrace>( mpip_index); - if(!mpi_init_string.empty()) hosttrace_pop_trace(mpi_init_string.c_str()); + if(!mpi_init_string.empty()) omnitrace_pop_trace(mpi_init_string.c_str()); mpi_init_string = {}; - hosttrace_trace_finalize(); + omnitrace_trace_finalize(); return MPI_SUCCESS; }; using copy_func_t = int (*)(MPI_Comm, int, void*, void*, void*, int*); @@ -68,7 +68,7 @@ hosttrace_mpi_set_attr() void mpi_gotcha::audit(const gotcha_data_t& _data, audit::incoming, int*, char***) { - HOSTTRACE_DEBUG("[%s] %s(int*, char***)\n", __FUNCTION__, _data.tool_id.c_str()); + OMNITRACE_DEBUG("[%s] %s(int*, char***)\n", __FUNCTION__, _data.tool_id.c_str()); if(get_state() == ::State::DelayedInit) { get_state() = ::State::PreInit; @@ -79,7 +79,7 @@ mpi_gotcha::audit(const gotcha_data_t& _data, audit::incoming, int*, char***) void mpi_gotcha::audit(const gotcha_data_t& _data, audit::incoming, int*, char***, int, int*) { - HOSTTRACE_DEBUG("[%s] %s(int*, char***, int, int*)\n", __FUNCTION__, + OMNITRACE_DEBUG("[%s] %s(int*, char***, int, int*)\n", __FUNCTION__, _data.tool_id.c_str()); if(get_state() == ::State::DelayedInit) { @@ -88,40 +88,89 @@ mpi_gotcha::audit(const gotcha_data_t& _data, audit::incoming, int*, char***, in } } +void +mpi_gotcha::audit(const gotcha_data_t& _data, audit::incoming) +{ + OMNITRACE_DEBUG("[%s] %s()\n", __FUNCTION__, _data.tool_id.c_str()); + if(mpip_index != std::numeric_limits::max()) + comp::deactivate_mpip, omnitrace>( + mpip_index); + if(!mpi_init_string.empty()) omnitrace_pop_trace(mpi_init_string.c_str()); + mpi_init_string = {}; + omnitrace_trace_finalize(); +} + +void +mpi_gotcha::audit(const gotcha_data_t& _data, audit::incoming, comm_t _comm, int* _val) +{ + OMNITRACE_DEBUG("[%s] %s()\n", __FUNCTION__, _data.tool_id.c_str()); + m_comm = _comm; + if(_data.tool_id == "MPI_Comm_rank") + { + m_rank = _val; + } + else if(_data.tool_id == "MPI_Comm_size") + { + m_size = _val; + } + else + { + OMNITRACE_PRINT("[%s] %s(, %p) :: unexpected function wrapper\n", + __FUNCTION__, _data.tool_id.c_str(), _val); + } +} + void mpi_gotcha::audit(const gotcha_data_t& _data, audit::outgoing, int _retval) { - HOSTTRACE_DEBUG("[%s] %s() returned %i\n", __FUNCTION__, _data.tool_id.c_str(), + OMNITRACE_DEBUG("[%s] %s() returned %i\n", __FUNCTION__, _data.tool_id.c_str(), (int) _retval); - if(_retval == tim::mpi::success_v && get_state() == ::State::PreInit) + if(_retval == tim::mpi::success_v && get_state() == ::State::PreInit && + _data.tool_id.find("MPI_Init") == 0) { - hosttrace_mpi_set_attr(); - // hosttrace will set this environement variable to true in binary rewrite mode + omnitrace_mpi_set_attr(); + // omnitrace will set this environement variable to true in binary rewrite mode // when it detects MPI. Hides this env variable from the user to avoid this // being activated unwaringly during runtime instrumentation because that // will result in double instrumenting the MPI functions (unless the MPI functions // were excluded via a regex expression) if(get_use_mpip()) { - HOSTTRACE_DEBUG("[%s] Activating MPI wrappers...\n", __FUNCTION__); - comp::configure_mpip, hosttrace>(); - mpip_index = comp::activate_mpip, - hosttrace>(); + OMNITRACE_DEBUG("[%s] Activating MPI wrappers...\n", __FUNCTION__); + comp::configure_mpip, omnitrace>(); + mpip_index = comp::activate_mpip, + omnitrace>(); } - hosttrace_push_trace(_data.tool_id.c_str()); + omnitrace_push_trace(_data.tool_id.c_str()); + } + else if(_retval == tim::mpi::success_v && _data.tool_id.find("MPI_Comm_") == 0) + { + /*if(_data.tool_id == "MPI_Comm_rank") + { + if(m_rank) + tim::mpi::set_rank(*m_rank, m_comm); + else + { + OMNITRACE_PRINT("[%s] %s() returned %i :: nullptr to rank\n", + __FUNCTION__, _data.tool_id.c_str(), (int) _retval); + } + } + else if(_data.tool_id == "MPI_Comm_size") + { + if(m_size) + tim::mpi::set_size(*m_size, m_comm); + else + { + OMNITRACE_PRINT("[%s] %s() returned %i :: nullptr to size\n", + __FUNCTION__, _data.tool_id.c_str(), (int) _retval); + } + } + else + { + OMNITRACE_PRINT("[%s] %s() returned %i :: unexpected function wrapper\n", + __FUNCTION__, _data.tool_id.c_str(), (int) _retval); + }*/ } } -void -mpi_gotcha::audit(const gotcha_data_t& _data, audit::incoming) -{ - HOSTTRACE_DEBUG("[%s] %s()\n", __FUNCTION__, _data.tool_id.c_str()); - if(mpip_index != std::numeric_limits::max()) - comp::deactivate_mpip, hosttrace>( - mpip_index); - if(!mpi_init_string.empty()) hosttrace_pop_trace(mpi_init_string.c_str()); - mpi_init_string = {}; - hosttrace_trace_finalize(); -} - TIMEMORY_INITIALIZE_STORAGE(mpi_gotcha) diff --git a/projects/rocprofiler-systems/src/library/hosttrace_component.cpp b/projects/rocprofiler-systems/src/library/omnitrace_component.cpp similarity index 84% rename from projects/rocprofiler-systems/src/library/hosttrace_component.cpp rename to projects/rocprofiler-systems/src/library/omnitrace_component.cpp index 8c460348dc..b921fda7a5 100644 --- a/projects/rocprofiler-systems/src/library/hosttrace_component.cpp +++ b/projects/rocprofiler-systems/src/library/omnitrace_component.cpp @@ -26,25 +26,25 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH // THE SOFTWARE. -#include "library/hosttrace_component.hpp" +#include "library/omnitrace_component.hpp" #include "library/api.hpp" void -hosttrace_component::start() +omnitrace_component::start() { - if(m_prefix) hosttrace_push_trace(m_prefix); + if(m_prefix) omnitrace_push_trace(m_prefix); } void -hosttrace_component::stop() +omnitrace_component::stop() { - if(m_prefix) hosttrace_pop_trace(m_prefix); + if(m_prefix) omnitrace_pop_trace(m_prefix); } void -hosttrace_component::set_prefix(const char* _prefix) +omnitrace_component::set_prefix(const char* _prefix) { m_prefix = _prefix; } -TIMEMORY_INITIALIZE_STORAGE(hosttrace_component) +TIMEMORY_INITIALIZE_STORAGE(omnitrace_component) diff --git a/projects/rocprofiler-systems/src/library/roctracer.cpp b/projects/rocprofiler-systems/src/library/roctracer.cpp index 6088cd46de..9060f9bf15 100644 --- a/projects/rocprofiler-systems/src/library/roctracer.cpp +++ b/projects/rocprofiler-systems/src/library/roctracer.cpp @@ -39,7 +39,7 @@ namespace component void roctracer::preinit() { - HOSTTRACE_DEBUG("[%s]\n", __FUNCTION__); + OMNITRACE_DEBUG("[%s]\n", __FUNCTION__); roctracer_data::label() = "roctracer"; roctracer_data::description() = "ROCm tracer (activity API)"; } @@ -98,12 +98,12 @@ roctracer::setup() auto_lock_t _lk{ type_mutex() }; if(roctracer_is_setup()) return; roctracer_is_setup() = true; - HOSTTRACE_DEBUG("[%s]\n", __FUNCTION__); + OMNITRACE_DEBUG("[%s]\n", __FUNCTION__); - tim::set_env("HSA_TOOLS_LIB", "libhosttrace.so", 0); + tim::set_env("HSA_TOOLS_LIB", "libomnitrace.so", 0); - auto _kfdwrapper = dynamic_library{ "HOSTTRACE_ROCTRACER_LIBKFDWRAPPER", - HOSTTRACE_ROCTRACER_LIBKFDWRAPPER }; + auto _kfdwrapper = dynamic_library{ "OMNITRACE_ROCTRACER_LIBKFDWRAPPER", + OMNITRACE_ROCTRACER_LIBKFDWRAPPER }; ROCTRACER_CALL(roctracer_set_properties(ACTIVITY_DOMAIN_HIP_API, nullptr)); @@ -134,7 +134,7 @@ roctracer::tear_down() auto_lock_t _lk{ type_mutex() }; if(!roctracer_is_setup()) return; roctracer_is_setup() = false; - HOSTTRACE_DEBUG("[%s]\n", __FUNCTION__); + OMNITRACE_DEBUG("[%s]\n", __FUNCTION__); // flush all the activity if(roctracer_default_pool() != nullptr) @@ -185,7 +185,7 @@ extern "C" bool OnLoad(HsaApiTable* table, uint64_t runtime_version, uint64_t failed_tool_count, const char* const* failed_tool_names) { - HOSTTRACE_DEBUG("[%s]\n", __FUNCTION__); + OMNITRACE_DEBUG("[%s]\n", __FUNCTION__); tim::consume_parameters(table, runtime_version, failed_tool_count, failed_tool_names); @@ -218,7 +218,7 @@ extern "C" // initialize HSA tracing roctracer_set_properties(ACTIVITY_DOMAIN_HSA_API, (void*) table); - HOSTTRACE_DEBUG(" HSA-trace("); + OMNITRACE_DEBUG(" HSA-trace("); if(!hsa_api_vec.empty()) { for(const auto& itr : hsa_api_vec) @@ -230,7 +230,7 @@ extern "C" ROCTRACER_CALL(roctracer_enable_op_callback( ACTIVITY_DOMAIN_HSA_API, cid, hsa_api_callback, nullptr)); - HOSTTRACE_DEBUG(" %s", api); + OMNITRACE_DEBUG(" %s", api); } } else @@ -238,7 +238,7 @@ extern "C" ROCTRACER_CALL(roctracer_enable_domain_callback( ACTIVITY_DOMAIN_HSA_API, hsa_api_callback, nullptr)); } - HOSTTRACE_DEBUG("\n"); + OMNITRACE_DEBUG("\n"); } bool trace_hsa_activity = get_trace_hsa_activity(); @@ -253,7 +253,7 @@ extern "C" }; roctracer_set_properties(ACTIVITY_DOMAIN_HSA_OPS, &ops_properties); - HOSTTRACE_DEBUG(" HSA-activity-trace()\n"); + OMNITRACE_DEBUG(" HSA-activity-trace()\n"); ROCTRACER_CALL(roctracer_enable_op_activity(ACTIVITY_DOMAIN_HSA_OPS, HSA_OP_ID_COPY)); } @@ -277,7 +277,7 @@ extern "C" // HSA-runtime on-unload method void OnUnload() { - HOSTTRACE_DEBUG("[%s]\n", __FUNCTION__); + OMNITRACE_DEBUG("[%s]\n", __FUNCTION__); // ONLOAD_TRACE(""); } } diff --git a/projects/rocprofiler-systems/src/library/roctracer_callbacks.cpp b/projects/rocprofiler-systems/src/library/roctracer_callbacks.cpp index fb857f9620..dfed7d1254 100644 --- a/projects/rocprofiler-systems/src/library/roctracer_callbacks.cpp +++ b/projects/rocprofiler-systems/src/library/roctracer_callbacks.cpp @@ -49,7 +49,7 @@ auto& get_roctracer_hip_data(int64_t _tid = threading::get_id()) { using data_t = std::unordered_map; - using thread_data_t = hosttrace_thread_data; + using thread_data_t = omnitrace_thread_data; static auto& _v = thread_data_t::instances(thread_data_t::construct_on_init{}); return _v.at(_tid); } @@ -80,7 +80,7 @@ auto& get_hip_activity_callbacks(int64_t _tid = threading::get_id()) { using thread_data_t = - hosttrace_thread_data>, api::roctracer>; + omnitrace_thread_data>, api::roctracer>; static auto& _v = thread_data_t::instances(thread_data_t::construct_on_init{}); return _v.at(_tid); } @@ -113,7 +113,7 @@ hsa_api_callback(uint32_t domain, uint32_t cid, const void* callback_data, void* (void) arg; const hsa_api_data_t* data = reinterpret_cast(callback_data); - HOSTTRACE_DEBUG("<%-30s id(%u)\tcorrelation_id(%lu) %s>\n", + OMNITRACE_DEBUG("<%-30s id(%u)\tcorrelation_id(%lu) %s>\n", roctracer_op_string(domain, cid, 0), cid, data->correlation_id, (data->phase == ACTIVITY_API_PHASE_ENTER) ? "on-enter" : "on-exit"); @@ -295,7 +295,7 @@ hip_api_callback(uint32_t domain, uint32_t cid, const void* callback_data, void* if(op_name == nullptr) return; const hip_api_data_t* data = reinterpret_cast(callback_data); - HOSTTRACE_DEBUG("<%-30s id(%u)\tcorrelation_id(%lu) %s>\n", op_name, cid, + OMNITRACE_DEBUG("<%-30s id(%u)\tcorrelation_id(%lu) %s>\n", op_name, cid, data->correlation_id, (data->phase == ACTIVITY_API_PHASE_ENTER) ? "on-enter" : "on-exit"); @@ -450,7 +450,7 @@ hip_activity_callback(const char* begin, const char* end, void*) const roctracer_record_t* end_record = reinterpret_cast(end); - HOSTTRACE_DEBUG("Activity records:\n"); + OMNITRACE_DEBUG("Activity records:\n"); while(record < end_record) { @@ -460,7 +460,7 @@ hip_activity_callback(const char* begin, const char* end, void*) if(op_name != nullptr) { - HOSTTRACE_DEBUG("\t%-30s\tcorrelation_id(%6lu) time_ns(%12lu:%12lu) " + OMNITRACE_DEBUG("\t%-30s\tcorrelation_id(%6lu) time_ns(%12lu:%12lu) " "delta_ns(%12lu) device_id(%d) " "stream_id(%lu)\n", op_name, record->correlation_id, record->begin_ns, diff --git a/projects/rocprofiler-systems/src/hosttrace.cpp b/projects/rocprofiler-systems/src/omnitrace.cpp similarity index 94% rename from projects/rocprofiler-systems/src/hosttrace.cpp rename to projects/rocprofiler-systems/src/omnitrace.cpp index 44773d0750..f792fcbd14 100644 --- a/projects/rocprofiler-systems/src/hosttrace.cpp +++ b/projects/rocprofiler-systems/src/omnitrace.cpp @@ -26,7 +26,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH // THE SOFTWARE. -#include "hosttrace.hpp" +#include "omnitrace.hpp" #include #include @@ -52,10 +52,10 @@ static std::map beg_expr = {}; static std::map end_expr = {}; static const auto npos_v = string_t::npos; static string_t instr_mode = "trace"; -static string_t instr_push_func = "hosttrace_push_trace"; -static string_t instr_pop_func = "hosttrace_pop_trace"; -static string_t instr_push_hash = "hosttrace_push_trace_hash"; -static string_t instr_pop_hash = "hosttrace_pop_trace_hash"; +static string_t instr_push_func = "omnitrace_push_trace"; +static string_t instr_pop_func = "omnitrace_pop_trace"; +static string_t instr_push_hash = "omnitrace_push_trace_hash"; +static string_t instr_pop_hash = "omnitrace_pop_trace_hash"; static string_t print_instrumented = {}; static string_t print_available = {}; static string_t print_overlapping = {}; @@ -100,7 +100,7 @@ main(int argc, char** argv) tim::set_env("DYNINSTAPI_RT_LIB", TIMEMORY_JOIN('/', itr, "libdyninstAPI_RT.a"), 0); } - verbprintf(0, "[hosttrace] DYNINST_API_RT: %s\n", + verbprintf(0, "[omnitrace] DYNINST_API_RT: %s\n", tim::get_env("DYNINSTAPI_RT_LIB", "").c_str()); argv0 = argv[0]; @@ -184,19 +184,19 @@ main(int argc, char** argv) if(verbose_level > 1) { - std::cout << "[hosttrace][original]: " << cmd_string(argc, argv) << std::endl; - std::cout << "[hosttrace][cfg-args]: " << cmd_string(_argc, _argv) << std::endl; + std::cout << "[omnitrace][original]: " << cmd_string(argc, argv) << std::endl; + std::cout << "[omnitrace][cfg-args]: " << cmd_string(_argc, _argv) << std::endl; } if(_cmdc > 0) - std::cout << "\n[hosttrace][command]: " << cmd_string(_cmdc, _cmdv) << "\n\n"; + std::cout << "\n[omnitrace][command]: " << cmd_string(_cmdc, _cmdv) << "\n\n"; if(_cmdc > 0) cmdv0 = _cmdv[0]; std::stringstream jump_description; jump_description - << "Instrument with function pointers in HOSTTRACE_JUMP_LIBRARY (default: " - << tim::get_env("HOSTTRACE_JUMP_LIBRARY", "jump/libhosttrace.so") + << "Instrument with function pointers in OMNITRACE_JUMP_LIBRARY (default: " + << tim::get_env("OMNITRACE_JUMP_LIBRARY", "jump/libomnitrace.so") << ")"; // now can loop through the options. If the first character is '-', then we know @@ -204,7 +204,7 @@ 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("hosttrace"); + parser_t parser("omnitrace"); parser.enable_help(); parser.add_argument() @@ -251,7 +251,7 @@ main(int argc, char** argv) parser.add_argument() .names({ "-L", "--library" }) .description( - "Libraries with instrumentation routines (default: \"libhosttrace\")"); + "Libraries with instrumentation routines (default: \"libomnitrace\")"); parser.add_argument() .names({ "-S", "--stdlib" }) .description("Enable instrumentation of C++ standard library functions.") @@ -267,17 +267,17 @@ main(int argc, char** argv) parser.add_argument() .names({ "-d", "--default-components" }) .description("Default components to instrument (only useful when timemory is " - "enabled in hosttrace library)"); + "enabled in omnitrace library)"); parser.add_argument() .names({ "-M", "--mode" }) .description("Instrumentation mode. 'trace' mode is immutable, 'region' mode is " - "mutable by hosttrace library interface") + "mutable by omnitrace library interface") .choices({ "trace", "region" }) .count(1); parser.add_argument() .names({ "--env" }) .description("Environment variables to add to the runtime in form " - "VARIABLE=VALUE. E.g. use '--env HOSTTRACE_USE_TIMEMORY=ON' to " + "VARIABLE=VALUE. E.g. use '--env OMNITRACE_USE_TIMEMORY=ON' to " "default to using timemory instead of perfetto"); parser.add_argument() .names({ "--prefer" }) @@ -289,7 +289,7 @@ main(int argc, char** argv) .action([](auto&) { is_driver = true; }); parser .add_argument({ "--mpi" }, - "Enable MPI support (requires hosttrace built w/ MPI and GOTCHA " + "Enable MPI support (requires omnitrace built w/ MPI and GOTCHA " "support). NOTE: this will automatically be activated if " "MPI_Init/MPI_Init_thread and MPI_Finalize are found in the symbol " "table of target") @@ -489,7 +489,7 @@ main(int argc, char** argv) if(!parser.exists("L")) { for(auto& itr : inputlib) - itr += "libhosttrace"; + itr += "libomnitrace"; if(parser.exists("s")) { @@ -540,10 +540,10 @@ main(int argc, char** argv) if(parser.exists("M")) { instr_mode = parser.get("M"); - instr_push_func = "hosttrace_push_" + instr_mode; - instr_push_hash = "hosttrace_push_" + instr_mode + "_hash"; - instr_pop_func = "hosttrace_pop_" + instr_mode; - instr_pop_hash = "hosttrace_pop_" + instr_mode + "_hash"; + instr_push_func = "omnitrace_push_" + instr_mode; + instr_push_hash = "omnitrace_push_" + instr_mode + "_hash"; + instr_pop_func = "omnitrace_pop_" + instr_mode; + instr_pop_hash = "omnitrace_pop_" + instr_mode + "_hash"; } if(parser.exists("prefer")) prefer_library = parser.get("prefer"); @@ -584,7 +584,7 @@ main(int argc, char** argv) auto _pos = _exe_base.find_last_of('/'); if(_pos != std::string::npos && _pos + 1 < _exe_base.length()) _exe_base = _exe_base.substr(_pos + 1); - modfunc_dump_dir = TIMEMORY_JOIN("-", "hosttrace", _exe_base, "output"); + modfunc_dump_dir = TIMEMORY_JOIN("-", "omnitrace", _exe_base, "output"); } if(verbose_level >= 0) tim::makedir(modfunc_dump_dir); @@ -601,8 +601,8 @@ main(int argc, char** argv) if(!regex_expr.empty()) regex_array.push_back(std::regex(regex_expr, regex_opts)); }; - add_regex(func_include, tim::get_env("HOSTTRACE_REGEX_INCLUDE", "")); - add_regex(func_exclude, tim::get_env("HOSTTRACE_REGEX_EXCLUDE", "")); + add_regex(func_include, tim::get_env("OMNITRACE_REGEX_INCLUDE", "")); + add_regex(func_exclude, tim::get_env("OMNITRACE_REGEX_EXCLUDE", "")); if(parser.exists("R")) { @@ -672,8 +672,8 @@ main(int argc, char** argv) { parser.print_help(extra_help); fprintf(stderr, "\nError! No command for dynamic instrumentation. Use " - "\n\thosttrace -- \nE.g. " - "\n\thosttrace -o foo.inst -- ./foo\nwill output an " + "\n\tomnitrace -- \nE.g. " + "\n\tomnitrace -o foo.inst -- ./foo\nwill output an " "instrumented version of 'foo' executable to 'foo.inst'\n"); return EXIT_FAILURE; } @@ -705,11 +705,11 @@ main(int argc, char** argv) //----------------------------------------------------------------------------------// addr_space = - hosttrace_get_address_space(bpatch, _cmdc, _cmdv, binary_rewrite, _pid, mutname); + omnitrace_get_address_space(bpatch, _cmdc, _cmdv, binary_rewrite, _pid, mutname); if(!addr_space) { - fprintf(stderr, "[hosttrace]> Error! address space for dynamic " + fprintf(stderr, "[omnitrace]> Error! address space for dynamic " "instrumentation was not created\n"); exit(EXIT_FAILURE); } @@ -928,11 +928,11 @@ main(int argc, char** argv) auto* exit_trace = find_function(app_image, instr_pop_func.c_str()); auto* entr_hash = find_function(app_image, instr_push_hash.c_str()); auto* exit_hash = find_function(app_image, instr_pop_hash.c_str()); - auto* init_func = find_function(app_image, "hosttrace_trace_init"); - auto* fini_func = find_function(app_image, "hosttrace_trace_finalize"); - auto* env_func = find_function(app_image, "hosttrace_trace_set_env"); - auto* mpi_func = find_function(app_image, "hosttrace_trace_set_mpi"); - auto* hash_func = find_function(app_image, "hosttrace_add_hash_id"); + auto* init_func = find_function(app_image, "omnitrace_trace_init"); + auto* fini_func = find_function(app_image, "omnitrace_trace_finalize"); + auto* env_func = find_function(app_image, "omnitrace_trace_set_env"); + auto* mpi_func = find_function(app_image, "omnitrace_trace_set_mpi"); + auto* hash_func = find_function(app_image, "omnitrace_add_hash_id"); auto* mpi_init_func = find_function(app_image, "MPI_Init", { "MPI_Init_thread" }); auto* mpi_fini_func = find_function(app_image, "MPI_Finalize"); @@ -986,9 +986,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("libhosttrace-"); + _pos = _name.find("libomnitrace-"); if(_pos != npos_v) - _name = _name.erase(_pos, std::string("libhosttrace-").length()); + _name = _name.erase(_pos, std::string("libomnitrace-").length()); _pos = _name.find("lib"); if(_pos == 0) _name = _name.substr(_pos + std::string("lib").length()); while((_pos = _name.find('-')) != npos_v) @@ -997,7 +997,7 @@ main(int argc, char** argv) verbprintf(2, "Supplemental instrumentation library '%s' is named '%s' after " "removing everything before last '/', everything after first '.', and " - "'libhosttrace-'...\n", + "'libomnitrace-'...\n", itr.c_str(), _name.c_str()); use_stubs[_name] = false; @@ -1043,8 +1043,8 @@ main(int argc, char** argv) } // check standard function signature if no user-specified matches - if(add_instr_library(_name, TIMEMORY_JOIN("", "hosttrace_register_" + _name), - TIMEMORY_JOIN("", "hosttrace_deregister_" + _name))) + if(add_instr_library(_name, TIMEMORY_JOIN("", "omnitrace_register_" + _name), + TIMEMORY_JOIN("", "omnitrace_deregister_" + _name))) continue; found_instr_functions: @@ -1059,16 +1059,16 @@ main(int argc, char** argv) if(!main_func && is_driver) { - fprintf(stderr, "[hosttrace]> Couldn't find '%s'\n", main_fname.c_str()); + fprintf(stderr, "[omnitrace]> Couldn't find '%s'\n", main_fname.c_str()); if(!_mutatee_init || !_mutatee_fini) { - fprintf(stderr, "[hosttrace]> Couldn't find '%s' or '%s', aborting\n", + fprintf(stderr, "[omnitrace]> Couldn't find '%s' or '%s', aborting\n", "_init", "_fini"); throw std::runtime_error("Could not find main function"); } else { - fprintf(stderr, "[hosttrace]> using '%s' and '%s' in lieu of '%s'...", + fprintf(stderr, "[omnitrace]> using '%s' and '%s' in lieu of '%s'...", "_init", "_fini", main_fname.c_str()); } } @@ -1081,23 +1081,23 @@ main(int argc, char** argv) for(const auto& itr : { pair_t(main_func, main_fname), pair_t(entr_trace, instr_push_func), - pair_t(exit_trace, instr_pop_func), pair_t(init_func, "hosttrace_trace_init"), - pair_t(fini_func, "hosttrace_trace_finalize"), - pair_t(env_func, "hosttrace_trace_set_env") }) + pair_t(exit_trace, instr_pop_func), pair_t(init_func, "omnitrace_trace_init"), + pair_t(fini_func, "omnitrace_trace_finalize"), + pair_t(env_func, "omnitrace_trace_set_env") }) { if(itr.first == main_func && !is_driver) continue; if(!itr.first) { stringstream_t ss; ss << "Error! Couldn't find '" << itr.second.c_str() << "' function"; - fprintf(stderr, "[hosttrace]> %s\n", ss.str().c_str()); + fprintf(stderr, "[omnitrace]> %s\n", ss.str().c_str()); throw std::runtime_error(ss.str()); } } if(use_mpi && !(mpi_func || (mpi_init_func && mpi_fini_func))) { - throw std::runtime_error("MPI support was requested but hosttrace was not built " + throw std::runtime_error("MPI support was requested but omnitrace was not built " "with MPI and GOTCHA support"); } @@ -1176,20 +1176,20 @@ main(int argc, char** argv) verbprintf(2, "Getting call expressions... "); - auto main_call_args = hosttrace_call_expr(main_sign.get()); - auto init_call_args = hosttrace_call_expr(default_components, binary_rewrite, cmdv0); - auto fini_call_args = hosttrace_call_expr(); - auto umpi_call_args = hosttrace_call_expr(use_mpi, is_attached); + auto main_call_args = omnitrace_call_expr(main_sign.get()); + auto init_call_args = omnitrace_call_expr(default_components, binary_rewrite, cmdv0); + auto fini_call_args = omnitrace_call_expr(); + auto umpi_call_args = omnitrace_call_expr(use_mpi, is_attached); auto mode_call_args = - hosttrace_call_expr("HOSTTRACE_INSTRUMENTATION_MODE", instr_mode); - auto mpie_init_args = hosttrace_call_expr("HOSTTRACE_MPI_INIT", "OFF"); - auto mpie_fini_args = hosttrace_call_expr("HOSTTRACE_MPI_FINALIZE", "OFF"); + omnitrace_call_expr("OMNITRACE_INSTRUMENTATION_MODE", instr_mode); + auto mpie_init_args = omnitrace_call_expr("OMNITRACE_MPI_INIT", "OFF"); + auto mpie_fini_args = omnitrace_call_expr("OMNITRACE_MPI_FINALIZE", "OFF"); auto trace_call_args = - hosttrace_call_expr("HOSTTRACE_COMPONENTS", default_components); - auto use_mpi_call_args = hosttrace_call_expr("HOSTTRACE_USE_PID", "ON"); - auto use_mpip_call_args = hosttrace_call_expr( - "HOSTTRACE_USE_MPIP", (binary_rewrite && use_mpi && use_mpip) ? "ON" : "OFF"); - auto none_call_args = hosttrace_call_expr(); + omnitrace_call_expr("OMNITRACE_COMPONENTS", default_components); + auto use_mpi_call_args = omnitrace_call_expr("OMNITRACE_USE_PID", "ON"); + auto use_mpip_call_args = omnitrace_call_expr( + "OMNITRACE_USE_MPIP", (binary_rewrite && use_mpi && use_mpip) ? "ON" : "OFF"); + auto none_call_args = omnitrace_call_expr(); verbprintf(2, "Done\n"); verbprintf(2, "Getting call snippets... "); @@ -1228,7 +1228,7 @@ main(int argc, char** argv) << " not in form VARIABLE=VALUE\n"; throw std::runtime_error("Bad format"); } - auto _expr = hosttrace_call_expr(p.at(0), p.at(1)); + auto _expr = omnitrace_call_expr(p.at(0), p.at(1)); env_variables.push_back(_expr.get(env_func)); } @@ -1474,10 +1474,10 @@ main(int argc, char** argv) name.m_name.c_str()); auto _name = name.get(); auto _hash = std::hash()(_name); - auto _trace_entr = (entr_hash) ? hosttrace_call_expr(_hash) - : hosttrace_call_expr(_name.c_str()); - auto _trace_exit = (exit_hash) ? hosttrace_call_expr(_hash) - : hosttrace_call_expr(_name.c_str()); + auto _trace_entr = (entr_hash) ? omnitrace_call_expr(_hash) + : omnitrace_call_expr(_name.c_str()); + auto _trace_exit = (exit_hash) ? omnitrace_call_expr(_hash) + : omnitrace_call_expr(_name.c_str()); auto _entr = _trace_entr.get((entr_hash) ? entr_hash : entr_trace); auto _exit = _trace_exit.get((exit_hash) ? exit_hash : exit_trace); @@ -1527,11 +1527,11 @@ main(int argc, char** argv) hash_ids.emplace_back(_lhash, _lname); auto _lf = [=]() { auto _ltrace_entr = (entr_hash) - ? hosttrace_call_expr(_lhash) - : hosttrace_call_expr(_lname.c_str()); + ? omnitrace_call_expr(_lhash) + : omnitrace_call_expr(_lname.c_str()); auto _ltrace_exit = (exit_hash) - ? hosttrace_call_expr(_lhash) - : hosttrace_call_expr(_lname.c_str()); + ? omnitrace_call_expr(_lhash) + : omnitrace_call_expr(_lname.c_str()); auto _lentr = _ltrace_entr.get((entr_hash) ? entr_hash : entr_trace); auto _lexit = @@ -1580,7 +1580,7 @@ main(int argc, char** argv) // //----------------------------------------------------------------------------------// - hosttrace_snippet_vec hash_snippet_vec; + omnitrace_snippet_vec hash_snippet_vec; // generate a call expression for each hash + key for(auto& itr : hash_ids) hash_snippet_vec.generate(hash_func, itr.first, itr.second.c_str()); @@ -1792,8 +1792,8 @@ main(int argc, char** argv) if(main_func) { - printf("[hosttrace]> Getting linked libraries for %s...\n", cmdv0.c_str()); - printf("[hosttrace]> Consider instrumenting the relevant libraries...\n\n"); + printf("[omnitrace]> Getting linked libraries for %s...\n", cmdv0.c_str()); + printf("[omnitrace]> Consider instrumenting the relevant libraries...\n\n"); using TIMEMORY_PIPE = tim::popen::TIMEMORY_PIPE; @@ -1804,7 +1804,7 @@ main(int argc, char** argv) strvec_t linked_libraries = tim::popen::read_fork(ldd); auto perr = tim::popen::pclose(ldd); - if(perr != 0) perror("Error in hosttrace_fork"); + if(perr != 0) perror("Error in omnitrace_fork"); for(const auto& itr : linked_libraries) printf("\t%s\n", itr.c_str()); @@ -1824,8 +1824,8 @@ main(int argc, char** argv) // addr_space->beginInsertionSet(); verbprintf(4, "Registering fork callbacks...\n"); - auto _prefork = bpatch->registerPreForkCallback(&hosttrace_fork_callback); - auto _postfork = bpatch->registerPostForkCallback(&hosttrace_fork_callback); + auto _prefork = bpatch->registerPreForkCallback(&omnitrace_fork_callback); + auto _postfork = bpatch->registerPostForkCallback(&omnitrace_fork_callback); auto _wait_exec = [&]() { while(!app_thread->isTerminated()) @@ -1854,7 +1854,7 @@ main(int argc, char** argv) if(app_thread->terminationStatus() == ExitedNormally) { if(app_thread->isTerminated()) - printf("\nEnd of hosttrace\n"); + printf("\nEnd of omnitrace\n"); else _wait_exec(); } @@ -1925,7 +1925,7 @@ instrument_module(const string_t& file_name) static std::regex ext_regex(ext_str, regex_opts); static std::regex sys_regex("^(s|k|e|w)_[A-Za-z_0-9\\-]+\\.(c|C)$", regex_opts); static std::regex userlib_regex( - "^(lib|)(hosttrace|caliper|gotcha|papi|cupti|TAU|likwid|" + "^(lib|)(omnitrace|caliper|gotcha|papi|cupti|TAU|likwid|" "profiler|tcmalloc|dyninst|pfm|nvtx|upcxx|pthread|nvperf|hsa|\\.\\./sysdeps/|/" "build/)", regex_opts); @@ -2028,7 +2028,7 @@ instrument_entity(const string_t& function_name) } static std::regex exclude( - "(hosttrace|tim::|cereal|N3tim|MPI_Init|MPI_Finalize|::__[A-Za-z]|" + "(omnitrace|tim::|cereal|N3tim|MPI_Init|MPI_Finalize|::__[A-Za-z]|" "dyninst|tm_clones|malloc$|calloc$|free$|realloc$|std::addressof)", regex_opts); static std::regex exclude_cxx("(std::_Sp_counted_base|std::use_facet)", regex_opts); @@ -2223,8 +2223,8 @@ module_constraint(char* fname) // fname is the name of module/file string_t _fname = fname; - // never instrumentat any module matching hosttrace - if(_fname.find("hosttrace") != string_t::npos) return true; + // never instrumentat any module matching omnitrace + if(_fname.find("omnitrace") != string_t::npos) return true; // always instrument these modules if(_fname == "DEFAULT_MODULE" || _fname == "LIBRARY_MODULE") return false; @@ -2242,7 +2242,7 @@ bool routine_constraint(const char* fname) { string_t _fname = fname; - if(_fname.find("hosttrace") != string_t::npos) return true; + if(_fname.find("omnitrace") != string_t::npos) return true; auto npos = std::string::npos; if(_fname.find("FunctionInfo") != npos || _fname.find("_L_lock") != npos || @@ -2283,7 +2283,7 @@ get_absolute_exe_filepath(std::string exe_name) if(file_exists(TIMEMORY_JOIN('/', pitr, exe_name))) { exe_name = TIMEMORY_JOIN('/', pitr, exe_name); - verbprintf(0, "[hosttrace] Resolved '%s' to '%s'...\n", _exe_orig.c_str(), + verbprintf(0, "[omnitrace] Resolved '%s' to '%s'...\n", _exe_orig.c_str(), exe_name.c_str()); break; } @@ -2318,7 +2318,7 @@ get_absolute_lib_filepath(std::string lib_name) if(file_exists(TIMEMORY_JOIN('/', pitr, lib_name))) { lib_name = TIMEMORY_JOIN('/', pitr, lib_name); - verbprintf(0, "[hosttrace] Resolved '%s' to '%s'...\n", _lib_orig.c_str(), + verbprintf(0, "[omnitrace] Resolved '%s' to '%s'...\n", _lib_orig.c_str(), lib_name.c_str()); break; } diff --git a/projects/rocprofiler-systems/src/hosttrace/details.cpp b/projects/rocprofiler-systems/src/omnitrace/details.cpp similarity index 99% rename from projects/rocprofiler-systems/src/hosttrace/details.cpp rename to projects/rocprofiler-systems/src/omnitrace/details.cpp index 96bb5b81b1..3c166018f8 100644 --- a/projects/rocprofiler-systems/src/hosttrace/details.cpp +++ b/projects/rocprofiler-systems/src/omnitrace/details.cpp @@ -26,7 +26,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH // THE SOFTWARE. -#include "hosttrace.hpp" +#include "omnitrace.hpp" //======================================================================================// // @@ -258,7 +258,7 @@ find_function(image_t* app_image, const std::string& _name, strset_t _extra) ++itr; } - if(!_func) verbprintf(2, "hosttrace: Unable to find function %s\n", _name.c_str()); + if(!_func) verbprintf(2, "omnitrace: Unable to find function %s\n", _name.c_str()); return _func; } diff --git a/projects/rocprofiler-systems/tests/CMakeLists.txt b/projects/rocprofiler-systems/tests/CMakeLists.txt index e80334d3e3..877efc7abd 100644 --- a/projects/rocprofiler-systems/tests/CMakeLists.txt +++ b/projects/rocprofiler-systems/tests/CMakeLists.txt @@ -1,5 +1,5 @@ -if(NOT HOSTTRACE_DYNINST_API_RT_DIR AND HOSTTRACE_DYNINST_API_RT) - get_filename_component(HOSTTRACE_DYNINST_API_RT_DIR "${HOSTTRACE_DYNINST_API_RT}" +if(NOT OMNITRACE_DYNINST_API_RT_DIR AND OMNITRACE_DYNINST_API_RT) + get_filename_component(OMNITRACE_DYNINST_API_RT_DIR "${OMNITRACE_DYNINST_API_RT}" DIRECTORY) endif() @@ -7,16 +7,16 @@ if(NOT DEFINED NUM_PROCS) set(NUM_PROCS 2) endif() -if(HOSTTRACE_BUILD_DYNINST) - set(HOSTTRACE_DYNINST_API_RT_DIR +if(OMNITRACE_BUILD_DYNINST) + set(OMNITRACE_DYNINST_API_RT_DIR "${PROJECT_BINARY_DIR}/external/dyninst/dyninstAPI_RT:${PROJECT_BINARY_DIR}/external/dyninst/dyninstAPI" ) endif() set(_test_environment - "HOSTTRACE_USE_PERFETTO=ON" - "HOSTTRACE_USE_TIMEMORY=ON" - "LD_LIBRARY_PATH=${PROJECT_BINARY_DIR}:${HOSTTRACE_DYNINST_API_RT_DIR}:$ENV{LD_LIBRARY_PATH}" + "OMNITRACE_USE_PERFETTO=ON" + "OMNITRACE_USE_TIMEMORY=ON" + "LD_LIBRARY_PATH=${PROJECT_BINARY_DIR}:${OMNITRACE_DYNINST_API_RT_DIR}:$ENV{LD_LIBRARY_PATH}" ) if(TARGET transpose) @@ -27,7 +27,7 @@ if(TARGET transpose) add_test( NAME transpose-binary-rewrite COMMAND - $ -o $/transpose.inst -v + $ -o $/transpose.inst -v 1 -- $ WORKING_DIRECTORY ${PROJECT_BINARY_DIR}) @@ -38,7 +38,7 @@ if(TARGET transpose) add_test( NAME transpose-runtime-instrument - COMMAND $ -v 1 --label file line return args -- + COMMAND $ -v 1 --label file line return args -- $ WORKING_DIRECTORY ${PROJECT_BINARY_DIR}) @@ -54,7 +54,7 @@ if(TARGET parallel-overhead) add_test( NAME parallel-overhead-binary-rewrite COMMAND - $ -o + $ -o $/parallel-overhead.inst -v 1 --min-address-range-loop=72 --label file line return args -- $ @@ -67,7 +67,7 @@ if(TARGET parallel-overhead) add_test( NAME parallel-overhead-runtime-instrument - COMMAND $ -v 1 -- $ + COMMAND $ -v 1 -- $ WORKING_DIRECTORY ${PROJECT_BINARY_DIR}) set_tests_properties(parallel-overhead-binary-rewrite-run