diff --git a/.cmake-format.yaml b/.cmake-format.yaml index 7d99a627..f1ec2ffc 100644 --- a/.cmake-format.yaml +++ b/.cmake-format.yaml @@ -1,6 +1,6 @@ parse: additional_commands: - omnitrace_checkout_git_submodule: + rocprofsys_checkout_git_submodule: flags: - RECURSIVE kwargs: @@ -10,15 +10,15 @@ parse: REPO_URL: '*' REPO_BRANCH: '*' ADDITIONAL_COMMANDS: '*' - omnitrace_save_variables: + rocprofsys_save_variables: kwargs: VARIABLES: '*' CONDITION: '*' - omnitrace_restore_variables: + rocprofsys_restore_variables: kwargs: VARIABLES: '*' CONDITION: '*' - omnitrace_add_test: + rocprofsys_add_test: flags: - SKIP_BASELINE - SKIP_SAMPLING @@ -50,7 +50,7 @@ parse: BASELINE_FAIL_REGEX: '*' REWRITE_RUN_PASS_REGEX: '*' REWRITE_RUN_FAIL_REGEX: '*' - omnitrace_add_causal_test: + rocprofsys_add_causal_test: flags: - SKIP_BASELINE kwargs: @@ -72,12 +72,12 @@ parse: BASELINE_FAIL_REGEX: '*' CAUSAL_VALIDATE_PASS_REGEX: '*' CAUSAL_VALIDATE_FAIL_REGEX: '*' - omnitrace_target_compile_definitions: + rocprofsys_target_compile_definitions: kwargs: PUBLIC: '*' PRIVATE: '*' INTERFACE: '*' - omnitrace_add_bin_test: + rocprofsys_add_bin_test: flags: - WILL_FAIL kwargs: @@ -94,7 +94,7 @@ parse: PASS_REGEX: '*' FAIL_REGEX: '*' SKIP_REGEX: '*' - omnitrace_add_python_test: + rocprofsys_add_python_test: flags: - STANDALONE kwargs: @@ -113,7 +113,7 @@ parse: PASS_REGEX: '*' FAIL_REGEX: '*' SKIP_REGEX: '*' - omnitrace_add_python_validation_test: + rocprofsys_add_python_validation_test: kwargs: NAME: '*' ARGS: '*' @@ -128,7 +128,7 @@ parse: - SEND_ERROR - FATAL_ERROR - AUTHOR_WARNING - omnitrace_find_python: + rocprofsys_find_python: flags: - REQUIRED - QUIET @@ -136,11 +136,11 @@ parse: VERSION: '*' ROOT_DIR: '*' COMPONENTS: '*' - omnitrace_python_console_script: + rocprofsys_python_console_script: kwargs: VERSION: '*' ROOT_DIR: '*' - omnitrace_pybind11_add_module: + rocprofsys_pybind11_add_module: flags: - MODULE - SHARED @@ -153,7 +153,7 @@ parse: PYTHON_VERSION: '*' CXX_STANDARD: '*' VISIBILITY: '*' - omnitrace_directory: + rocprofsys_directory: flags: - MKDIR - FAIL @@ -162,14 +162,14 @@ parse: OUTPUT_VARIABLE: '*' WORKING_DIRECTORY: '*' PATHS: '*' - omnitrace_check_python_dirs_and_versions: + rocprofsys_check_python_dirs_and_versions: flags: - UNSET - FAIL kwargs: RESULT_VARIABLE: '*' OUTPUT_VARIABLE: '*' - omnitrace_find_static_library: + rocprofsys_find_static_library: flags: - NO_CACHE - REQUIRED @@ -188,7 +188,7 @@ parse: PATHS: '*' PATH_SUFFIXES: '*' DOC: '*' - omnitrace_find_shared_library: + rocprofsys_find_shared_library: flags: - NO_CACHE - REQUIRED @@ -207,14 +207,14 @@ parse: PATHS: '*' PATH_SUFFIXES: '*' DOC: '*' - omnitrace_causal_example_executable: + rocprofsys_causal_example_executable: kwargs: TAG: '*' SOURCES: '*' DEFINITIONS: '*' LINK_LIBRARIES: '*' INCLUDE_DIRECTORIES: '*' - omnitrace_add_validation_test: + rocprofsys_add_validation_test: kwargs: NAME: '*' ARGS: '*' diff --git a/.github/workflows/opensuse.yml b/.github/workflows/opensuse.yml index a2b721c0..04908847 100644 --- a/.github/workflows/opensuse.yml +++ b/.github/workflows/opensuse.yml @@ -32,8 +32,8 @@ concurrency: cancel-in-progress: true env: - OMNITRACE_CI: ON - OMNITRACE_TMPDIR: "%env{PWD}%/testing-tmp" + ROCPROFSYS_CI: ON + ROCPROFSYS_TMPDIR: "%env{PWD}%/testing-tmp" jobs: opensuse: @@ -87,19 +87,19 @@ jobs: -DCMAKE_CXX_COMPILER=${{ matrix.compiler }} -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -DCMAKE_INSTALL_PREFIX=/opt/rocprof-sys - -DOMNITRACE_BUILD_TESTING=ON - -DOMNITRACE_USE_MPI=OFF - -DOMNITRACE_USE_HIP=OFF - -DOMNITRACE_USE_OMPT=OFF - -DOMNITRACE_USE_PYTHON=ON - -DOMNITRACE_INSTALL_PERFETTO_TOOLS=OFF - -DOMNITRACE_USE_MPI_HEADERS=ON - -DOMNITRACE_PYTHON_PREFIX=/opt/conda/envs - -DOMNITRACE_PYTHON_ENVS="py3.6;py3.7;py3.8;py3.9;py3.10;py3.11" - -DOMNITRACE_CI_MPI_RUN_AS_ROOT=ON - -DOMNITRACE_MAX_THREADS=64 - -DOMNITRACE_DISABLE_EXAMPLES="transpose;rccl" - -DOMNITRACE_BUILD_NUMBER=${{ github.run_attempt }} + -DROCPROFSYS_BUILD_TESTING=ON + -DROCPROFSYS_USE_MPI=OFF + -DROCPROFSYS_USE_HIP=OFF + -DROCPROFSYS_USE_OMPT=OFF + -DROCPROFSYS_USE_PYTHON=ON + -DROCPROFSYS_INSTALL_PERFETTO_TOOLS=OFF + -DROCPROFSYS_USE_MPI_HEADERS=ON + -DROCPROFSYS_PYTHON_PREFIX=/opt/conda/envs + -DROCPROFSYS_PYTHON_ENVS="py3.6;py3.7;py3.8;py3.9;py3.10;py3.11" + -DROCPROFSYS_CI_MPI_RUN_AS_ROOT=ON + -DROCPROFSYS_MAX_THREADS=64 + -DROCPROFSYS_DISABLE_EXAMPLES="transpose;rccl" + -DROCPROFSYS_BUILD_NUMBER=${{ github.run_attempt }} - name: Install timeout-minutes: 10 @@ -110,7 +110,7 @@ jobs: timeout-minutes: 10 run: | set -v - export OMNITRACE_DEBUG=ON + export ROCPROFSYS_DEBUG=ON which rocprof-sys-avail ldd $(which rocprof-sys-avail) rocprof-sys-avail --help diff --git a/.github/workflows/redhat.yml b/.github/workflows/redhat.yml index 33f42178..0a05ce7e 100644 --- a/.github/workflows/redhat.yml +++ b/.github/workflows/redhat.yml @@ -32,8 +32,8 @@ concurrency: cancel-in-progress: true env: - OMNITRACE_CI: ON - OMNITRACE_TMPDIR: "%env{PWD}%/testing-tmp" + ROCPROFSYS_CI: ON + ROCPROFSYS_TMPDIR: "%env{PWD}%/testing-tmp" jobs: rhel: @@ -111,19 +111,19 @@ jobs: -DCMAKE_CXX_COMPILER=${{ matrix.compiler }} -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -DCMAKE_INSTALL_PREFIX=/opt/rocprof-sys - -DOMNITRACE_BUILD_TESTING=ON - -DOMNITRACE_USE_MPI=OFF - -DOMNITRACE_USE_HIP=${USE_HIP} - -DOMNITRACE_USE_OMPT=OFF - -DOMNITRACE_USE_PYTHON=ON - -DOMNITRACE_USE_MPI_HEADERS=ON - -DOMNITRACE_CI_MPI_RUN_AS_ROOT=ON - -DOMNITRACE_MAX_THREADS=64 - -DOMNITRACE_INSTALL_PERFETTO_TOOLS=OFF - -DOMNITRACE_PYTHON_PREFIX=/opt/conda/envs - -DOMNITRACE_PYTHON_ENVS="py3.6;py3.7;py3.8;py3.9;py3.10;py3.11" - -DOMNITRACE_DISABLE_EXAMPLES="transpose;rccl" - -DOMNITRACE_BUILD_NUMBER=${{ github.run_attempt }} + -DROCPROFSYS_BUILD_TESTING=ON + -DROCPROFSYS_USE_MPI=OFF + -DROCPROFSYS_USE_HIP=${USE_HIP} + -DROCPROFSYS_USE_OMPT=OFF + -DROCPROFSYS_USE_PYTHON=ON + -DROCPROFSYS_USE_MPI_HEADERS=ON + -DROCPROFSYS_CI_MPI_RUN_AS_ROOT=ON + -DROCPROFSYS_MAX_THREADS=64 + -DROCPROFSYS_INSTALL_PERFETTO_TOOLS=OFF + -DROCPROFSYS_PYTHON_PREFIX=/opt/conda/envs + -DROCPROFSYS_PYTHON_ENVS="py3.6;py3.7;py3.8;py3.9;py3.10;py3.11" + -DROCPROFSYS_DISABLE_EXAMPLES="transpose;rccl" + -DROCPROFSYS_BUILD_NUMBER=${{ github.run_attempt }} -- -LE "transpose|rccl" @@ -137,7 +137,7 @@ jobs: shell: bash run: | set -v - source /opt/rocprof-sys/share/rocprofsys/setup-env.sh + source /opt/rocprof-sys/share/rocprof-sys/setup-env.sh ./scripts/test-install.sh --test-rocprof-sys-{instrument,avail,sample,rewrite,runtime,python}=1 - name: Test User API diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c0d8537d..1574256b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -28,7 +28,7 @@ jobs: run: | sudo apt-get update sudo apt-get install -y cmake - cmake -D OUTPUT_DIR=${PWD} -P scripts/write-rocprofsys-install.cmake + cmake -D OUTPUT_DIR=${PWD} -P scripts/write-rocprof-sys-install.cmake - name: Generate Release uses: softprops/action-gh-release@v1 with: diff --git a/.github/workflows/ubuntu-focal.yml b/.github/workflows/ubuntu-focal.yml index 394f6c36..0b91d1d3 100644 --- a/.github/workflows/ubuntu-focal.yml +++ b/.github/workflows/ubuntu-focal.yml @@ -32,8 +32,8 @@ concurrency: cancel-in-progress: true env: - OMNITRACE_CI: ON - OMNITRACE_TMPDIR: "%env{PWD}%/testing-tmp" + ROCPROFSYS_CI: ON + ROCPROFSYS_TMPDIR: "%env{PWD}%/testing-tmp" jobs: ubuntu-focal-external: @@ -141,22 +141,22 @@ jobs: -DCMAKE_CXX_COMPILER=${{ matrix.compiler }} -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -DCMAKE_INSTALL_PREFIX=/opt/rocprof-sys - -DOMNITRACE_BUILD_TESTING=ON - -DOMNITRACE_USE_MPI=OFF - -DOMNITRACE_USE_HIP=OFF - -DOMNITRACE_USE_OMPT=OFF - -DOMNITRACE_USE_PAPI=OFF - -DOMNITRACE_USE_PYTHON=${{ matrix.python }} - -DOMNITRACE_USE_MPI_HEADERS=${{ matrix.mpi-headers }} - -DOMNITRACE_STRIP_LIBRARIES=${{ matrix.strip }} - -DOMNITRACE_BUILD_LTO=${{ matrix.lto }} - -DOMNITRACE_BUILD_STATIC_LIBGCC=${{ matrix.static-libgcc }} - -DOMNITRACE_BUILD_STATIC_LIBSTDCXX=${{ matrix.static-libstdcxx }} - -DOMNITRACE_PYTHON_PREFIX=/opt/conda/envs - -DOMNITRACE_PYTHON_ENVS="py3.6;py3.7;py3.8;py3.9;py3.10;py3.11" - -DOMNITRACE_MAX_THREADS=64 - -DOMNITRACE_DISABLE_EXAMPLES="transpose;rccl" - -DOMNITRACE_BUILD_NUMBER=${{ github.run_attempt }} + -DROCPROFSYS_BUILD_TESTING=ON + -DROCPROFSYS_USE_MPI=OFF + -DROCPROFSYS_USE_HIP=OFF + -DROCPROFSYS_USE_OMPT=OFF + -DROCPROFSYS_USE_PAPI=OFF + -DROCPROFSYS_USE_PYTHON=${{ matrix.python }} + -DROCPROFSYS_USE_MPI_HEADERS=${{ matrix.mpi-headers }} + -DROCPROFSYS_STRIP_LIBRARIES=${{ matrix.strip }} + -DROCPROFSYS_BUILD_LTO=${{ matrix.lto }} + -DROCPROFSYS_BUILD_STATIC_LIBGCC=${{ matrix.static-libgcc }} + -DROCPROFSYS_BUILD_STATIC_LIBSTDCXX=${{ matrix.static-libstdcxx }} + -DROCPROFSYS_PYTHON_PREFIX=/opt/conda/envs + -DROCPROFSYS_PYTHON_ENVS="py3.6;py3.7;py3.8;py3.9;py3.10;py3.11" + -DROCPROFSYS_MAX_THREADS=64 + -DROCPROFSYS_DISABLE_EXAMPLES="transpose;rccl" + -DROCPROFSYS_BUILD_NUMBER=${{ github.run_attempt }} -DMPI_HEADERS_ALLOW_MPICH=OFF - name: Test Build-Tree Module @@ -167,7 +167,7 @@ jobs: source /usr/share/modules/init/$(basename ${SHELL}) module use ./share/modulefiles module avail - module load rocprofsys + module load rocprof-sys echo $(which rocprof-sys-instrument) ldd $(which rocprof-sys-instrument) rocprof-sys-instrument --help @@ -179,7 +179,7 @@ jobs: shell: bash run: | cd build - source ./share/rocprofsys/setup-env.sh + source ./share/rocprof-sys/setup-env.sh echo $(which rocprof-sys-instrument) ldd $(which rocprof-sys-instrument) rocprof-sys-instrument --help @@ -198,7 +198,7 @@ jobs: source /usr/share/modules/init/$(basename ${SHELL}) module use /opt/rocprof-sys/share/modulefiles module avail - module load rocprofsys + module load rocprof-sys ./scripts/test-install.sh --test-rocprof-sys-{instrument,avail,sample,rewrite,runtime}=1 --test-rocprof-sys-python=${{ matrix.python }} - name: Test User API @@ -329,24 +329,24 @@ jobs: -DCMAKE_CXX_COMPILER=${{ matrix.compiler }} -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DCMAKE_INSTALL_PREFIX=/opt/rocprof-sys - -DOMNITRACE_BUILD_TESTING=ON - -DOMNITRACE_BUILD_DEVELOPER=ON - -DOMNITRACE_BUILD_EXTRA_OPTIMIZATIONS=OFF - -DOMNITRACE_BUILD_LTO=OFF - -DOMNITRACE_USE_MPI=OFF - -DOMNITRACE_USE_HIP=ON - -DOMNITRACE_MAX_THREADS=64 - -DOMNITRACE_USE_PAPI=OFF - -DOMNITRACE_USE_OMPT=OFF - -DOMNITRACE_USE_PYTHON=ON - -DOMNITRACE_USE_MPI_HEADERS=${{ matrix.mpi-headers }} - -DOMNITRACE_USE_SANITIZER=OFF - -DOMNITRACE_PYTHON_PREFIX=/opt/conda/envs - -DOMNITRACE_PYTHON_ENVS="py3.6;py3.7;py3.8;py3.9;py3.10;py3.11" - -DOMNITRACE_CI_MPI_RUN_AS_ROOT=${{ matrix.mpi-headers }} - -DOMNITRACE_CI_GPU=OFF + -DROCPROFSYS_BUILD_TESTING=ON + -DROCPROFSYS_BUILD_DEVELOPER=ON + -DROCPROFSYS_BUILD_EXTRA_OPTIMIZATIONS=OFF + -DROCPROFSYS_BUILD_LTO=OFF + -DROCPROFSYS_USE_MPI=OFF + -DROCPROFSYS_USE_HIP=ON + -DROCPROFSYS_MAX_THREADS=64 + -DROCPROFSYS_USE_PAPI=OFF + -DROCPROFSYS_USE_OMPT=OFF + -DROCPROFSYS_USE_PYTHON=ON + -DROCPROFSYS_USE_MPI_HEADERS=${{ matrix.mpi-headers }} + -DROCPROFSYS_USE_SANITIZER=OFF + -DROCPROFSYS_PYTHON_PREFIX=/opt/conda/envs + -DROCPROFSYS_PYTHON_ENVS="py3.6;py3.7;py3.8;py3.9;py3.10;py3.11" + -DROCPROFSYS_CI_MPI_RUN_AS_ROOT=${{ matrix.mpi-headers }} + -DROCPROFSYS_CI_GPU=OFF -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=OFF - -DOMNITRACE_BUILD_NUMBER=${{ github.run_attempt }} + -DROCPROFSYS_BUILD_NUMBER=${{ github.run_attempt }} -- ${{ matrix.ctest-exclude }} @@ -358,7 +358,7 @@ jobs: timeout-minutes: 15 shell: bash run: | - source /opt/rocprof-sys/share/rocprofsys/setup-env.sh + source /opt/rocprof-sys/share/rocprof-sys/setup-env.sh ./scripts/test-install.sh --test-rocprof-sys-{instrument,avail,sample,python,rewrite,runtime}=1 - name: Test User API @@ -477,13 +477,13 @@ jobs: -DCMAKE_CXX_COMPILER=${{ matrix.compiler }} -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -DCMAKE_INSTALL_PREFIX=/opt/rocprof-sys - -DOMNITRACE_BUILD_TESTING=ON - -DOMNITRACE_BUILD_DYNINST=ON - -DOMNITRACE_USE_MPI=${USE_MPI} - -DOMNITRACE_USE_HIP=OFF - -DOMNITRACE_USE_PYTHON=${{ matrix.python }} - -DOMNITRACE_USE_OMPT=${{ matrix.ompt }} - -DOMNITRACE_USE_PAPI=${{ matrix.papi }} + -DROCPROFSYS_BUILD_TESTING=ON + -DROCPROFSYS_BUILD_DYNINST=ON + -DROCPROFSYS_USE_MPI=${USE_MPI} + -DROCPROFSYS_USE_HIP=OFF + -DROCPROFSYS_USE_PYTHON=${{ matrix.python }} + -DROCPROFSYS_USE_OMPT=${{ matrix.ompt }} + -DROCPROFSYS_USE_PAPI=${{ matrix.papi }} -DDYNINST_BUILD_ELFUTILS=ON -DDYNINST_BUILD_LIBIBERTY=ON -DDYNINST_BUILD_TBB=${{ matrix.tbb }} @@ -491,9 +491,9 @@ jobs: -DDYNINST_BUILD_SHARED_LIBS=ON -DDYNINST_BUILD_STATIC_LIBS=OFF -DDYNINST_ELFUTILS_DOWNLOAD_VERSION=${{ env.ELFUTILS_DOWNLOAD_VERSION }} - -DOMNITRACE_MAX_THREADS=64 - -DOMNITRACE_DISABLE_EXAMPLES="transpose;rccl" - -DOMNITRACE_BUILD_NUMBER=${{ github.run_attempt }} + -DROCPROFSYS_MAX_THREADS=64 + -DROCPROFSYS_DISABLE_EXAMPLES="transpose;rccl" + -DROCPROFSYS_BUILD_NUMBER=${{ github.run_attempt }} -DMPI_HEADERS_ALLOW_MPICH=ON - name: Test Build-Tree Env @@ -502,13 +502,13 @@ jobs: source /usr/share/modules/init/$(basename ${SHELL}) module use ${{ github.workspace }}/build/share/modulefiles module avail - module load rocprofsys + module load rocprof-sys module list env - module unload rocprofsys + module unload rocprof-sys module list env - source ${{ github.workspace }}/build/share/rocprofsys/setup-env.sh + source ${{ github.workspace }}/build/share/rocprof-sys/setup-env.sh env - name: Install @@ -516,13 +516,13 @@ jobs: run: | cpack -G STGZ mkdir -p /opt/rocprof-sys - ./rocprofsys-*.sh --prefix=/opt/rocprof-sys --exclude-subdir --skip-license + ./rocprof-sys-*.sh --prefix=/opt/rocprof-sys --exclude-subdir --skip-license - name: Test Install with setup-env.sh timeout-minutes: 15 run: | set -v - source /opt/rocprof-sys/share/rocprofsys/setup-env.sh + source /opt/rocprof-sys/share/rocprof-sys/setup-env.sh ${{ github.workspace }}/scripts/test-install.sh --test-rocprof-sys-{instrument,avail,sample,python,rewrite,runtime}=1 - name: Test Install with Modulefile @@ -531,7 +531,7 @@ jobs: set -v source /usr/share/modules/init/$(basename ${SHELL}) module use /opt/rocprof-sys/share/modulefiles - module load rocprofsys + module load rocprof-sys ${{ github.workspace }}/scripts/test-install.sh --test-rocprof-sys-{instrument,avail,sample,python,rewrite,runtime}=1 - name: Test User API @@ -576,8 +576,8 @@ jobs: options: --cap-add CAP_SYS_ADMIN env: - OMNITRACE_VERBOSE: 2 - OMNITRACE_CAUSAL_BACKEND: perf + ROCPROFSYS_VERBOSE: 2 + ROCPROFSYS_CAUSAL_BACKEND: perf steps: - uses: actions/checkout@v4 @@ -619,17 +619,17 @@ jobs: --coverage -- -DCMAKE_INSTALL_PREFIX=/opt/rocprof-sys - -DOMNITRACE_BUILD_CI=OFF - -DOMNITRACE_BUILD_TESTING=ON - -DOMNITRACE_BUILD_DYNINST=OFF - -DOMNITRACE_BUILD_DEBUG=OFF - -DOMNITRACE_BUILD_HIDDEN_VISIBILITY=OFF - -DOMNITRACE_USE_MPI=ON - -DOMNITRACE_USE_PYTHON=ON - -DOMNITRACE_USE_OMPT=ON - -DOMNITRACE_USE_PAPI=ON - -DOMNITRACE_USE_HIP=OFF - -DOMNITRACE_USE_RCCL=OFF - -DOMNITRACE_MAX_THREADS=64 - -DOMNITRACE_DISABLE_EXAMPLES="transpose;rccl" - -DOMNITRACE_BUILD_NUMBER=${{ github.run_attempt }} + -DROCPROFSYS_BUILD_CI=OFF + -DROCPROFSYS_BUILD_TESTING=ON + -DROCPROFSYS_BUILD_DYNINST=OFF + -DROCPROFSYS_BUILD_DEBUG=OFF + -DROCPROFSYS_BUILD_HIDDEN_VISIBILITY=OFF + -DROCPROFSYS_USE_MPI=ON + -DROCPROFSYS_USE_PYTHON=ON + -DROCPROFSYS_USE_OMPT=ON + -DROCPROFSYS_USE_PAPI=ON + -DROCPROFSYS_USE_HIP=OFF + -DROCPROFSYS_USE_RCCL=OFF + -DROCPROFSYS_MAX_THREADS=64 + -DROCPROFSYS_DISABLE_EXAMPLES="transpose;rccl" + -DROCPROFSYS_BUILD_NUMBER=${{ github.run_attempt }} diff --git a/.github/workflows/ubuntu-jammy.yml b/.github/workflows/ubuntu-jammy.yml index a5c86733..8372fc49 100644 --- a/.github/workflows/ubuntu-jammy.yml +++ b/.github/workflows/ubuntu-jammy.yml @@ -32,8 +32,8 @@ concurrency: cancel-in-progress: true env: - OMNITRACE_CI: ON - OMNITRACE_TMPDIR: "%env{PWD}%/testing-tmp" + ROCPROFSYS_CI: ON + ROCPROFSYS_TMPDIR: "%env{PWD}%/testing-tmp" jobs: ubuntu-jammy-external: @@ -93,7 +93,7 @@ jobs: env: OMPI_ALLOW_RUN_AS_ROOT: 1 OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1 - OMNITRACE_CI: 'ON' + ROCPROFSYS_CI: 'ON' steps: - uses: actions/checkout@v4 @@ -179,24 +179,24 @@ jobs: -DCMAKE_CXX_COMPILER=${{ matrix.compiler }} -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -DCMAKE_INSTALL_PREFIX=/opt/rocprof-sys-dev - -DOMNITRACE_BUILD_TESTING=ON - -DOMNITRACE_USE_MPI=${{ matrix.mpi }} - -DOMNITRACE_USE_HIP=${{ matrix.hip }} - -DOMNITRACE_USE_OMPT=${{ matrix.ompt }} - -DOMNITRACE_USE_PAPI=${{ matrix.papi }} - -DOMNITRACE_USE_PYTHON=${{ matrix.python }} - -DOMNITRACE_USE_MPI_HEADERS=${{ matrix.mpi-headers }} - -DOMNITRACE_BUILD_LTO=${{ matrix.lto }} - -DOMNITRACE_BUILD_DYNINST=${{ matrix.build-dyninst }} - -DOMNITRACE_BUILD_HIDDEN_VISIBILITY=${{ matrix.hidden }} - -DOMNITRACE_BUILD_STATIC_LIBGCC=${{ matrix.static-libgcc }} - -DOMNITRACE_BUILD_STATIC_LIBSTDCXX=${{ matrix.static-libstdcxx }} - -DOMNITRACE_PYTHON_PREFIX=/opt/conda/envs - -DOMNITRACE_PYTHON_ENVS="py3.7;py3.8;py3.9;py3.10;py3.11" - -DOMNITRACE_STRIP_LIBRARIES=${{ matrix.strip }} - -DOMNITRACE_MAX_THREADS=64 - -DOMNITRACE_DISABLE_EXAMPLES="transpose;rccl" - -DOMNITRACE_BUILD_NUMBER=${{ github.run_attempt }} + -DROCPROFSYS_BUILD_TESTING=ON + -DROCPROFSYS_USE_MPI=${{ matrix.mpi }} + -DROCPROFSYS_USE_HIP=${{ matrix.hip }} + -DROCPROFSYS_USE_OMPT=${{ matrix.ompt }} + -DROCPROFSYS_USE_PAPI=${{ matrix.papi }} + -DROCPROFSYS_USE_PYTHON=${{ matrix.python }} + -DROCPROFSYS_USE_MPI_HEADERS=${{ matrix.mpi-headers }} + -DROCPROFSYS_BUILD_LTO=${{ matrix.lto }} + -DROCPROFSYS_BUILD_DYNINST=${{ matrix.build-dyninst }} + -DROCPROFSYS_BUILD_HIDDEN_VISIBILITY=${{ matrix.hidden }} + -DROCPROFSYS_BUILD_STATIC_LIBGCC=${{ matrix.static-libgcc }} + -DROCPROFSYS_BUILD_STATIC_LIBSTDCXX=${{ matrix.static-libstdcxx }} + -DROCPROFSYS_PYTHON_PREFIX=/opt/conda/envs + -DROCPROFSYS_PYTHON_ENVS="py3.7;py3.8;py3.9;py3.10;py3.11" + -DROCPROFSYS_STRIP_LIBRARIES=${{ matrix.strip }} + -DROCPROFSYS_MAX_THREADS=64 + -DROCPROFSYS_DISABLE_EXAMPLES="transpose;rccl" + -DROCPROFSYS_BUILD_NUMBER=${{ github.run_attempt }} -DUSE_CLANG_OMP=OFF - name: Install diff --git a/CMakeLists.txt b/CMakeLists.txt index f053dc92..cfadd47f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,13 +17,13 @@ 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 +string(REGEX REPLACE "([0-9]+)\.([0-9]+)\.([0-9]+)(.*)" "\\1.\\2.\\3" ROCPROFSYS_VERSION "${FULL_VERSION_STRING}") project( rocprofsys LANGUAGES C CXX - VERSION ${OMNITRACE_VERSION} + VERSION ${ROCPROFSYS_VERSION} DESCRIPTION "CPU/GPU Application tracing with static/dynamic binary instrumentation" HOMEPAGE_URL "https://github.com/ROCm/rocprofiler-systems") @@ -35,33 +35,33 @@ find_package(Git) if(Git_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git") execute_process( COMMAND ${GIT_EXECUTABLE} describe --tags - OUTPUT_VARIABLE OMNITRACE_GIT_DESCRIBE + OUTPUT_VARIABLE ROCPROFSYS_GIT_DESCRIBE OUTPUT_STRIP_TRAILING_WHITESPACE RESULT_VARIABLE _GIT_DESCRIBE_RESULT ERROR_QUIET) if(NOT _GIT_DESCRIBE_RESULT EQUAL 0) execute_process( COMMAND ${GIT_EXECUTABLE} describe - OUTPUT_VARIABLE OMNITRACE_GIT_DESCRIBE + OUTPUT_VARIABLE ROCPROFSYS_GIT_DESCRIBE OUTPUT_STRIP_TRAILING_WHITESPACE RESULT_VARIABLE _GIT_DESCRIBE_RESULT ERROR_QUIET) endif() execute_process( COMMAND ${GIT_EXECUTABLE} rev-parse HEAD - OUTPUT_VARIABLE OMNITRACE_GIT_REVISION + OUTPUT_VARIABLE ROCPROFSYS_GIT_REVISION OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET) else() - set(OMNITRACE_GIT_DESCRIBE "v${OMNITRACE_VERSION}") - set(OMNITRACE_GIT_REVISION "") + set(ROCPROFSYS_GIT_DESCRIBE "v${ROCPROFSYS_VERSION}") + set(ROCPROFSYS_GIT_REVISION "") endif() message( STATUS "[${PROJECT_NAME}] version ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH} (${FULL_VERSION_STRING})" ) -message(STATUS "[${PROJECT_NAME}] git revision: ${OMNITRACE_GIT_REVISION}") -message(STATUS "[${PROJECT_NAME}] git describe: ${OMNITRACE_GIT_DESCRIBE}") +message(STATUS "[${PROJECT_NAME}] git revision: ${ROCPROFSYS_GIT_REVISION}") +message(STATUS "[${PROJECT_NAME}] git describe: ${ROCPROFSYS_GIT_DESCRIBE}") set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake ${PROJECT_SOURCE_DIR}/cmake/Modules ${PROJECT_SOURCE_DIR}/source/python/cmake ${CMAKE_MODULE_PATH}) set(BUILD_SHARED_LIBS @@ -117,29 +117,29 @@ include(GNUInstallDirs) # install directories include(MacroUtilities) # various functions and macros if(CI_BUILD) - omnitrace_add_option(OMNITRACE_BUILD_CI "Enable internal asserts, etc." ON ADVANCED + rocprofsys_add_option(ROCPROFSYS_BUILD_CI "Enable internal asserts, etc." ON ADVANCED NO_FEATURE) - omnitrace_add_option(OMNITRACE_BUILD_TESTING "Enable building the testing suite" ON + rocprofsys_add_option(ROCPROFSYS_BUILD_TESTING "Enable building the testing suite" ON ADVANCED) - omnitrace_add_option(OMNITRACE_BUILD_DEBUG + rocprofsys_add_option(ROCPROFSYS_BUILD_DEBUG "Enable building with extensive debug symbols" OFF ADVANCED) - omnitrace_add_option( - OMNITRACE_BUILD_HIDDEN_VISIBILITY + rocprofsys_add_option( + ROCPROFSYS_BUILD_HIDDEN_VISIBILITY "Build with hidden visibility (disable for Debug builds)" OFF ADVANCED) - omnitrace_add_option(OMNITRACE_STRIP_LIBRARIES "Strip the libraries" OFF ADVANCED) + rocprofsys_add_option(ROCPROFSYS_STRIP_LIBRARIES "Strip the libraries" OFF ADVANCED) else() - omnitrace_add_option(OMNITRACE_BUILD_CI "Enable internal asserts, etc." OFF ADVANCED + rocprofsys_add_option(ROCPROFSYS_BUILD_CI "Enable internal asserts, etc." OFF ADVANCED NO_FEATURE) - omnitrace_add_option(OMNITRACE_BUILD_EXAMPLES "Enable building the examples" OFF + rocprofsys_add_option(ROCPROFSYS_BUILD_EXAMPLES "Enable building the examples" OFF ADVANCED) - omnitrace_add_option(OMNITRACE_BUILD_TESTING "Enable building the testing suite" OFF + rocprofsys_add_option(ROCPROFSYS_BUILD_TESTING "Enable building the testing suite" OFF ADVANCED) - omnitrace_add_option(OMNITRACE_BUILD_DEBUG + rocprofsys_add_option(ROCPROFSYS_BUILD_DEBUG "Enable building with extensive debug symbols" OFF ADVANCED) - omnitrace_add_option( - OMNITRACE_BUILD_HIDDEN_VISIBILITY + rocprofsys_add_option( + ROCPROFSYS_BUILD_HIDDEN_VISIBILITY "Build with hidden visibility (disable for Debug builds)" ON ADVANCED) - omnitrace_add_option(OMNITRACE_STRIP_LIBRARIES "Strip the libraries" + rocprofsys_add_option(ROCPROFSYS_STRIP_LIBRARIES "Strip the libraries" ${_STRIP_LIBRARIES_DEFAULT} ADVANCED) endif() @@ -153,139 +153,139 @@ set(CMAKE_CXX_STANDARD 17 CACHE STRING "CXX language standard") -omnitrace_add_feature(CMAKE_BUILD_TYPE "Build optimization level") -omnitrace_add_feature(CMAKE_INSTALL_PREFIX "Installation prefix") -omnitrace_add_feature(CMAKE_CXX_COMPILER "C++ compiler") -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" +rocprofsys_add_feature(CMAKE_BUILD_TYPE "Build optimization level") +rocprofsys_add_feature(CMAKE_INSTALL_PREFIX "Installation prefix") +rocprofsys_add_feature(CMAKE_CXX_COMPILER "C++ compiler") +rocprofsys_add_feature(CMAKE_CXX_STANDARD "CXX language standard") +rocprofsys_add_option(CMAKE_CXX_STANDARD_REQUIRED "Require C++ language standard" ON) +rocprofsys_add_option(CMAKE_CXX_EXTENSIONS "Compiler specific language extensions" OFF) +rocprofsys_add_option(CMAKE_INSTALL_RPATH_USE_LINK_PATH "Enable rpath to linked libraries" ON) set(CMAKE_INSTALL_MESSAGE "LAZY" CACHE STRING "Installation message") mark_as_advanced(CMAKE_INSTALL_MESSAGE) -omnitrace_add_option(OMNITRACE_USE_CLANG_TIDY "Enable clang-tidy" OFF) -omnitrace_add_option(OMNITRACE_USE_BFD +rocprofsys_add_option(ROCPROFSYS_USE_CLANG_TIDY "Enable clang-tidy" OFF) +rocprofsys_add_option(ROCPROFSYS_USE_BFD "Enable BFD support (map call-stack samples to LOC)" ON) -omnitrace_add_option(OMNITRACE_USE_MPI "Enable MPI support" OFF) -omnitrace_add_option(OMNITRACE_USE_HIP "Enable HIP support" ON) -omnitrace_add_option(OMNITRACE_USE_PAPI "Enable HW counter support via PAPI" ON) -omnitrace_add_option(OMNITRACE_USE_ROCTRACER "Enable roctracer support" - ${OMNITRACE_USE_HIP}) -omnitrace_add_option(OMNITRACE_USE_ROCPROFILER "Enable rocprofiler support" - ${OMNITRACE_USE_HIP}) -omnitrace_add_option( - OMNITRACE_USE_ROCM_SMI "Enable rocm-smi support for power/temp/etc. sampling" - ${OMNITRACE_USE_HIP}) -omnitrace_add_option(OMNITRACE_USE_RCCL "Enable RCCL support" ${OMNITRACE_USE_HIP}) -omnitrace_add_option(OMNITRACE_USE_MPI_HEADERS +rocprofsys_add_option(ROCPROFSYS_USE_MPI "Enable MPI support" OFF) +rocprofsys_add_option(ROCPROFSYS_USE_HIP "Enable HIP support" ON) +rocprofsys_add_option(ROCPROFSYS_USE_PAPI "Enable HW counter support via PAPI" ON) +rocprofsys_add_option(ROCPROFSYS_USE_ROCTRACER "Enable roctracer support" + ${ROCPROFSYS_USE_HIP}) +rocprofsys_add_option(ROCPROFSYS_USE_ROCPROFILER "Enable rocprofiler support" + ${ROCPROFSYS_USE_HIP}) +rocprofsys_add_option( + ROCPROFSYS_USE_ROCM_SMI "Enable rocm-smi support for power/temp/etc. sampling" + ${ROCPROFSYS_USE_HIP}) +rocprofsys_add_option(ROCPROFSYS_USE_RCCL "Enable RCCL support" ${ROCPROFSYS_USE_HIP}) +rocprofsys_add_option(ROCPROFSYS_USE_MPI_HEADERS "Enable wrapping MPI functions w/o enabling MPI dependency" ON) -omnitrace_add_option(OMNITRACE_USE_OMPT "Enable OpenMP tools support" ON) -omnitrace_add_option(OMNITRACE_USE_PYTHON "Enable Python support" OFF) -omnitrace_add_option(OMNITRACE_BUILD_DYNINST "Build dyninst from submodule" OFF) -omnitrace_add_option(OMNITRACE_BUILD_LIBUNWIND "Build libunwind from submodule" ON) -omnitrace_add_option(OMNITRACE_BUILD_CODECOV "Build for code coverage" OFF) -omnitrace_add_option(OMNITRACE_INSTALL_PERFETTO_TOOLS +rocprofsys_add_option(ROCPROFSYS_USE_OMPT "Enable OpenMP tools support" ON) +rocprofsys_add_option(ROCPROFSYS_USE_PYTHON "Enable Python support" OFF) +rocprofsys_add_option(ROCPROFSYS_BUILD_DYNINST "Build dyninst from submodule" OFF) +rocprofsys_add_option(ROCPROFSYS_BUILD_LIBUNWIND "Build libunwind from submodule" ON) +rocprofsys_add_option(ROCPROFSYS_BUILD_CODECOV "Build for code coverage" OFF) +rocprofsys_add_option(ROCPROFSYS_INSTALL_PERFETTO_TOOLS "Install perfetto tools (i.e. traced, perfetto, etc.)" OFF) -if(OMNITRACE_USE_PAPI) - omnitrace_add_option(OMNITRACE_BUILD_PAPI "Build PAPI from submodule" ON) +if(ROCPROFSYS_USE_PAPI) + rocprofsys_add_option(ROCPROFSYS_BUILD_PAPI "Build PAPI from submodule" ON) endif() -if(OMNITRACE_USE_PYTHON) - omnitrace_add_option(OMNITRACE_BUILD_PYTHON +if(ROCPROFSYS_USE_PYTHON) + rocprofsys_add_option(ROCPROFSYS_BUILD_PYTHON "Build python bindings with internal pybind11" ON) elseif("$ENV{ROCPROFSYS_CI}") # quiet warnings in dashboard - if(OMNITRACE_PYTHON_ENVS OR OMNITRACE_PYTHON_PREFIX) - omnitrace_message( + if(ROCPROFSYS_PYTHON_ENVS OR ROCPROFSYS_PYTHON_PREFIX) + rocprofsys_message( STATUS - "Ignoring values of OMNITRACE_PYTHON_ENVS and/or OMNITRACE_PYTHON_PREFIX") + "Ignoring values of ROCPROFSYS_PYTHON_ENVS and/or ROCPROFSYS_PYTHON_PREFIX") endif() endif() -if(NOT OMNITRACE_USE_HIP) - set(OMNITRACE_USE_ROCTRACER +if(NOT ROCPROFSYS_USE_HIP) + set(ROCPROFSYS_USE_ROCTRACER OFF - CACHE BOOL "Disabled via OMNITRACE_USE_HIP=OFF" FORCE) - set(OMNITRACE_USE_ROCPROFILER + CACHE BOOL "Disabled via ROCPROFSYS_USE_HIP=OFF" FORCE) + set(ROCPROFSYS_USE_ROCPROFILER OFF - CACHE BOOL "Disabled via OMNITRACE_USE_HIP=OFF" FORCE) - set(OMNITRACE_USE_ROCM_SMI + CACHE BOOL "Disabled via ROCPROFSYS_USE_HIP=OFF" FORCE) + set(ROCPROFSYS_USE_ROCM_SMI OFF - CACHE BOOL "Disabled via OMNITRACE_USE_HIP=OFF" FORCE) - set(OMNITRACE_USE_RCCL + CACHE BOOL "Disabled via ROCPROFSYS_USE_HIP=OFF" FORCE) + set(ROCPROFSYS_USE_RCCL OFF - CACHE BOOL "Disabled via OMNITRACE_USE_HIP=OFF" FORCE) + CACHE BOOL "Disabled via ROCPROFSYS_USE_HIP=OFF" FORCE) elseif( - OMNITRACE_USE_HIP - AND NOT OMNITRACE_USE_ROCTRACER - AND NOT OMNITRACE_USE_ROCPROFILER - AND NOT OMNITRACE_USE_ROCM_SMI - AND NOT OMNITRACE_USE_RCCL) - omnitrace_message( + ROCPROFSYS_USE_HIP + AND NOT ROCPROFSYS_USE_ROCTRACER + AND NOT ROCPROFSYS_USE_ROCPROFILER + AND NOT ROCPROFSYS_USE_ROCM_SMI + AND NOT ROCPROFSYS_USE_RCCL) + rocprofsys_message( AUTHOR_WARNING - "Setting OMNITRACE_USE_HIP=OFF because roctracer, rocprofiler, rccl, and rocm-smi options are disabled" + "Setting ROCPROFSYS_USE_HIP=OFF because roctracer, rocprofiler, rccl, and rocm-smi options are disabled" ) - set(OMNITRACE_USE_HIP OFF) + set(ROCPROFSYS_USE_HIP OFF) endif() -if(OMNITRACE_BUILD_TESTING) - set(OMNITRACE_BUILD_EXAMPLES +if(ROCPROFSYS_BUILD_TESTING) + set(ROCPROFSYS_BUILD_EXAMPLES ON CACHE BOOL "Enable building the examples" FORCE) endif() include(ProcessorCount) -processorcount(OMNITRACE_PROCESSOR_COUNT) +processorcount(ROCPROFSYS_PROCESSOR_COUNT) -if(OMNITRACE_PROCESSOR_COUNT LESS 8) - set(OMNITRACE_THREAD_COUNT 128) +if(ROCPROFSYS_PROCESSOR_COUNT LESS 8) + set(ROCPROFSYS_THREAD_COUNT 128) else() - math(EXPR OMNITRACE_THREAD_COUNT "16 * ${OMNITRACE_PROCESSOR_COUNT}") - compute_pow2_ceil(OMNITRACE_THREAD_COUNT "16 * ${OMNITRACE_PROCESSOR_COUNT}") + math(EXPR ROCPROFSYS_THREAD_COUNT "16 * ${ROCPROFSYS_PROCESSOR_COUNT}") + compute_pow2_ceil(ROCPROFSYS_THREAD_COUNT "16 * ${ROCPROFSYS_PROCESSOR_COUNT}") # set the default to 2048 if it could not be calculated - if(OMNITRACE_THREAD_COUNT LESS 2) - set(OMNITRACE_THREAD_COUNT 2048) + if(ROCPROFSYS_THREAD_COUNT LESS 2) + set(ROCPROFSYS_THREAD_COUNT 2048) endif() endif() -set(OMNITRACE_MAX_THREADS - "${OMNITRACE_THREAD_COUNT}" +set(ROCPROFSYS_MAX_THREADS + "${ROCPROFSYS_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" ) -omnitrace_add_feature( - OMNITRACE_MAX_THREADS +rocprofsys_add_feature( + ROCPROFSYS_MAX_THREADS "Maximum number of total threads supported in the host application (default: max of 128 or 16 * nproc)" ) -compute_pow2_ceil(_MAX_THREADS "${OMNITRACE_MAX_THREADS}") +compute_pow2_ceil(_MAX_THREADS "${ROCPROFSYS_MAX_THREADS}") -if(_MAX_THREADS GREATER 0 AND NOT OMNITRACE_MAX_THREADS EQUAL _MAX_THREADS) - omnitrace_message( +if(_MAX_THREADS GREATER 0 AND NOT ROCPROFSYS_MAX_THREADS EQUAL _MAX_THREADS) + rocprofsys_message( FATAL_ERROR - "Error! OMNITRACE_MAX_THREADS must be a power of 2. Recommendation: ${_MAX_THREADS}" + "Error! ROCPROFSYS_MAX_THREADS must be a power of 2. Recommendation: ${_MAX_THREADS}" ) -elseif(NOT OMNITRACE_MAX_THREADS EQUAL _MAX_THREADS) - omnitrace_message( +elseif(NOT ROCPROFSYS_MAX_THREADS EQUAL _MAX_THREADS) + rocprofsys_message( AUTHOR_WARNING - "OMNITRACE_MAX_THREADS (=${OMNITRACE_MAX_THREADS}) must be a power of 2. We were unable to verify it so we are emitting this warning instead. Estimate resulted in: ${_MAX_THREADS}" + "ROCPROFSYS_MAX_THREADS (=${ROCPROFSYS_MAX_THREADS}) must be a power of 2. We were unable to verify it so we are emitting this warning instead. Estimate resulted in: ${_MAX_THREADS}" ) endif() -set(OMNITRACE_MAX_UNWIND_DEPTH +set(ROCPROFSYS_MAX_UNWIND_DEPTH "64" CACHE STRING "Maximum call-stack depth to search during call-stack unwinding. Decreasing this value will result in sampling consuming less memory" ) -omnitrace_add_feature( - OMNITRACE_MAX_UNWIND_DEPTH +rocprofsys_add_feature( + ROCPROFSYS_MAX_UNWIND_DEPTH "Maximum call-stack depth to search during call-stack unwinding. Decreasing this value will result in sampling consuming less memory" ) @@ -304,16 +304,16 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) include(Formatting) # format target include(Packages) # finds third-party libraries -omnitrace_activate_clang_tidy() +rocprofsys_activate_clang_tidy() # custom visibility settings -if(OMNITRACE_BUILD_HIDDEN_VISIBILITY) +if(ROCPROFSYS_BUILD_HIDDEN_VISIBILITY) set(CMAKE_C_VISIBILITY_PRESET "internal") set(CMAKE_CXX_VISIBILITY_PRESET "internal") set(CMAKE_VISIBILITY_INLINES_HIDDEN ON) endif() -if(OMNITRACE_BUILD_TESTING OR "$ENV{ROCPROFSYS_CI}" MATCHES "[1-9]+|ON|on|y|yes") +if(ROCPROFSYS_BUILD_TESTING OR "$ENV{ROCPROFSYS_CI}" MATCHES "[1-9]+|ON|on|y|yes") enable_testing() include(CTest) endif() @@ -326,10 +326,10 @@ endif() set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME core) -if(OMNITRACE_BUILD_CODECOV) - omnitrace_save_variables(CODECOV_FLAGS VARIABLES CMAKE_C_FLAGS CMAKE_CXX_FLAGS) +if(ROCPROFSYS_BUILD_CODECOV) + rocprofsys_save_variables(CODECOV_FLAGS VARIABLES CMAKE_C_FLAGS CMAKE_CXX_FLAGS) foreach(_BUILD_TYPE DEBUG MINSIZEREL RELWITHDEBINFO RELEASE) - omnitrace_save_variables(CODECOV_FLAGS VARIABLES CMAKE_C_FLAGS_${_BUILD_TYPE} + rocprofsys_save_variables(CODECOV_FLAGS VARIABLES CMAKE_C_FLAGS_${_BUILD_TYPE} CMAKE_CXX_FLAGS_${_BUILD_TYPE}) endforeach() @@ -348,11 +348,11 @@ endif() add_subdirectory(source) -if(OMNITRACE_BUILD_CODECOV) - omnitrace_restore_variables(CODECOV_FLAGS VARIABLES CMAKE_C_FLAGS CMAKE_CXX_FLAGS) +if(ROCPROFSYS_BUILD_CODECOV) + rocprofsys_restore_variables(CODECOV_FLAGS VARIABLES CMAKE_C_FLAGS CMAKE_CXX_FLAGS) foreach(_BUILD_TYPE DEBUG MINSIZEREL RELWITHDEBINFO RELEASE) - omnitrace_restore_variables( + rocprofsys_restore_variables( CODECOV_FLAGS VARIABLES CMAKE_C_FLAGS_${_BUILD_TYPE} CMAKE_CXX_FLAGS_${_BUILD_TYPE}) endforeach() @@ -364,12 +364,12 @@ endif() # # ------------------------------------------------------------------------------# -if(NOT OMNITRACE_USE_ROCTRACER AND NOT OMNITRACE_USE_ROCPROFILER) - set(OMNITRACE_HSA_ENV "# ") +if(NOT ROCPROFSYS_USE_ROCTRACER AND NOT ROCPROFSYS_USE_ROCPROFILER) + set(ROCPROFSYS_HSA_ENV "# ") endif() -if(NOT OMNITRACE_USE_ROCPROFILER) - set(OMNITRACE_ROCP_ENV "# ") +if(NOT ROCPROFSYS_USE_ROCPROFILER) + set(ROCPROFSYS_ROCP_ENV "# ") endif() configure_file( @@ -388,7 +388,7 @@ configure_file( configure_file( ${PROJECT_SOURCE_DIR}/cmake/Templates/modulefile.in - ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/modulefiles/${PACKAGE_NAME}/${OMNITRACE_VERSION} + ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/modulefiles/${PACKAGE_NAME}/${ROCPROFSYS_VERSION} @ONLY) install( @@ -399,7 +399,7 @@ install( install( FILES - ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/modulefiles/${PACKAGE_NAME}/${OMNITRACE_VERSION} + ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/modulefiles/${PACKAGE_NAME}/${ROCPROFSYS_VERSION} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/modulefiles/${PACKAGE_NAME} COMPONENT setup) @@ -423,7 +423,7 @@ include(ConfigInstall) # # ------------------------------------------------------------------------------# -if(OMNITRACE_BUILD_EXAMPLES) +if(ROCPROFSYS_BUILD_EXAMPLES) set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME examples) add_subdirectory(examples) endif() @@ -434,7 +434,7 @@ endif() # # ------------------------------------------------------------------------------# -if(OMNITRACE_BUILD_TESTING) +if(ROCPROFSYS_BUILD_TESTING) set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME testing) add_subdirectory(tests) endif() @@ -454,4 +454,4 @@ include(ConfigCPack) # # ------------------------------------------------------------------------------# -omnitrace_print_features() +rocprofsys_print_features() diff --git a/README.md b/README.md index 34c643a3..483cb086 100755 --- a/README.md +++ b/README.md @@ -141,19 +141,19 @@ and tweak some sampling default values: ```console # ... -OMNITRACE_TRACE = true -OMNITRACE_PROFILE = true -OMNITRACE_USE_SAMPLING = true -OMNITRACE_USE_PROCESS_SAMPLING = true +ROCPROFSYS_TRACE = true +ROCPROFSYS_PROFILE = true +ROCPROFSYS_USE_SAMPLING = true +ROCPROFSYS_USE_PROCESS_SAMPLING = true # ... -OMNITRACE_SAMPLING_FREQ = 50 -OMNITRACE_SAMPLING_CPUS = all -OMNITRACE_SAMPLING_GPUS = $env:HIP_VISIBLE_DEVICES +ROCPROFSYS_SAMPLING_FREQ = 50 +ROCPROFSYS_SAMPLING_CPUS = all +ROCPROFSYS_SAMPLING_GPUS = $env:HIP_VISIBLE_DEVICES ``` -Once the configuration file is adjusted to your preferences, either export the path to this file via `OMNITRACE_CONFIG_FILE=/path/to/rocprof-sys.cfg` +Once the configuration file is adjusted to your preferences, either export the path to this file via `ROCPROFSYS_CONFIG_FILE=/path/to/rocprof-sys.cfg` or place this file in `${HOME}/.rocprof-sys.cfg` to ensure these values are always read as the default. If you wish to change any of these settings, -you can override them via environment variables or by specifying an alternative `OMNITRACE_CONFIG_FILE`. +you can override them via environment variables or by specifying an alternative `ROCPROFSYS_CONFIG_FILE`. ### Call-Stack Sampling @@ -169,7 +169,7 @@ rocprof-sys-sample -f 1000 -- ls -la ### Binary Instrumentation The `rocprof-sys-instrument` executable is used to instrument an existing binary. Call-stack sampling can be enabled alongside -the execution an instrumented binary, to help "fill in the gaps" between the instrumentation via setting the `OMNITRACE_USE_SAMPLING` +the execution an instrumented binary, to help "fill in the gaps" between the instrumentation via setting the `ROCPROFSYS_USE_SAMPLING` configuration variable to `ON`. Similar to `rocprof-sys-sample`, use a double-hypen (`--`) to separate the command-line arguments for `rocprof-sys-instrument` from the target application and it's arguments. @@ -206,7 +206,7 @@ rocprof-sys-run -- ./app.inst ``` If you want to re-define certain settings to new default in a binary rewrite, use the `--env` option. This `rocprof-sys` option -will set the environment variable to the given value but will not override it. E.g. the default value of `OMNITRACE_PERFETTO_BUFFER_SIZE_KB` +will set the environment variable to the given value but will not override it. E.g. the default value of `ROCPROFSYS_PERFETTO_BUFFER_SIZE_KB` is 1024000 KB (1 GiB): ```shell @@ -215,11 +215,11 @@ rocprof-sys-instrument -o app.inst -- /path/to/app rocprof-sys-run -- ./app.inst ``` -Passing `--env OMNITRACE_PERFETTO_BUFFER_SIZE_KB=5120000` will change the default value in `app.inst` to 5120000 KiB (5 GiB): +Passing `--env ROCPROFSYS_PERFETTO_BUFFER_SIZE_KB=5120000` will change the default value in `app.inst` to 5120000 KiB (5 GiB): ```shell # defaults to 5 GiB buffer size -rocprof-sys-instrument -o app.inst --env OMNITRACE_PERFETTO_BUFFER_SIZE_KB=5120000 -- /path/to/app +rocprof-sys-instrument -o app.inst --env ROCPROFSYS_PERFETTO_BUFFER_SIZE_KB=5120000 -- /path/to/app rocprof-sys-run -- ./app.inst ``` @@ -227,7 +227,7 @@ rocprof-sys-run -- ./app.inst # override default 5 GiB buffer size to 200 MB via command-line rocprof-sys-run --trace-buffer-size=200000 -- ./app.inst # override default 5 GiB buffer size to 200 MB via environment -export OMNITRACE_PERFETTO_BUFFER_SIZE_KB=200000 +export ROCPROFSYS_PERFETTO_BUFFER_SIZE_KB=200000 rocprof-sys-run -- ./app.inst ``` @@ -309,7 +309,7 @@ Perfetto tracing with the system backend supports multiple processes writing to output file. Thus, it is a useful technique if rocprof-sys is built with partial MPI support because all the perfetto output will be coalesced into a single file. The installation docs for perfetto can be found [here](https://perfetto.dev/docs/contributing/build-instructions). -If you are building rocprof-sys from source, you can configure CMake with `OMNITRACE_INSTALL_PERFETTO_TOOLS=ON` +If you are building rocprof-sys from source, you can configure CMake with `ROCPROFSYS_INSTALL_PERFETTO_TOOLS=ON` and the `perfetto` and `traced` applications will be installed as part of the build process. However, it should be noted that to prevent this option from accidentally overwriting an existing perfetto install, all the perfetto executables installed by omnitrace are prefixed with `rocprof-sys-perfetto-`, except for the `perfetto` @@ -320,7 +320,7 @@ Enable `traced` and `perfetto` in the background: ```shell pkill traced traced --background -perfetto --out ./rocprof-sys-perfetto.proto --txt -c ${OMNITRACE_ROOT}/share/perfetto.cfg --background +perfetto --out ./rocprof-sys-perfetto.proto --txt -c ${ROCPROFSYS_ROOT}/share/perfetto.cfg --background ``` > ***NOTE: if the perfetto tools were installed by rocprof-sys, replace `traced` with `rocprof-sys-perfetto-traced` and*** @@ -339,5 +339,5 @@ rocprof-sys-run --trace --perfetto-backend=system -- ./myapp.inst or via the `--env` option of `rocprof-sys-instrument` + runtime instrumentation: ```shell -rocprof-sys-instrument --env OMNITRACE_PERFETTO_BACKEND=system -- ./myapp +rocprof-sys-instrument --env ROCPROFSYS_PERFETTO_BACKEND=system -- ./myapp ``` diff --git a/cmake/BuildSettings.cmake b/cmake/BuildSettings.cmake index 44947317..731123b8 100644 --- a/cmake/BuildSettings.cmake +++ b/cmake/BuildSettings.cmake @@ -12,49 +12,49 @@ include(Compilers) include(FindPackageHandleStandardArgs) include(MacroUtilities) -omnitrace_add_option( - OMNITRACE_BUILD_DEVELOPER "Extra build flags for development like -Werror" - ${OMNITRACE_BUILD_CI}) -omnitrace_add_option(OMNITRACE_BUILD_RELEASE "Build with minimal debug line info" OFF) -omnitrace_add_option(OMNITRACE_BUILD_EXTRA_OPTIMIZATIONS "Extra optimization flags" OFF) -omnitrace_add_option(OMNITRACE_BUILD_LTO "Build with link-time optimization" OFF) -omnitrace_add_option(OMNITRACE_USE_COMPILE_TIMING +rocprofsys_add_option( + ROCPROFSYS_BUILD_DEVELOPER "Extra build flags for development like -Werror" + ${ROCPROFSYS_BUILD_CI}) +rocprofsys_add_option(ROCPROFSYS_BUILD_RELEASE "Build with minimal debug line info" OFF) +rocprofsys_add_option(ROCPROFSYS_BUILD_EXTRA_OPTIMIZATIONS "Extra optimization flags" OFF) +rocprofsys_add_option(ROCPROFSYS_BUILD_LTO "Build with link-time optimization" OFF) +rocprofsys_add_option(ROCPROFSYS_USE_COMPILE_TIMING "Build with timing metrics for compilation" OFF) -omnitrace_add_option(OMNITRACE_USE_SANITIZER - "Build with -fsanitze=\${OMNITRACE_SANITIZER_TYPE}" OFF) -omnitrace_add_option(OMNITRACE_BUILD_STATIC_LIBGCC +rocprofsys_add_option(ROCPROFSYS_USE_SANITIZER + "Build with -fsanitze=\${ROCPROFSYS_SANITIZER_TYPE}" OFF) +rocprofsys_add_option(ROCPROFSYS_BUILD_STATIC_LIBGCC "Build with -static-libgcc if possible" OFF) -omnitrace_add_option(OMNITRACE_BUILD_STATIC_LIBSTDCXX +rocprofsys_add_option(ROCPROFSYS_BUILD_STATIC_LIBSTDCXX "Build with -static-libstdc++ if possible" OFF) -omnitrace_add_option(OMNITRACE_BUILD_STACK_PROTECTOR "Build with -fstack-protector" ON) -omnitrace_add_cache_option( - OMNITRACE_BUILD_LINKER - "If set to a non-empty value, pass -fuse-ld=\${OMNITRACE_BUILD_LINKER}" STRING "bfd") -omnitrace_add_cache_option(OMNITRACE_BUILD_NUMBER "Internal CI use" STRING "0" ADVANCED +rocprofsys_add_option(ROCPROFSYS_BUILD_STACK_PROTECTOR "Build with -fstack-protector" ON) +rocprofsys_add_cache_option( + ROCPROFSYS_BUILD_LINKER + "If set to a non-empty value, pass -fuse-ld=\${ROCPROFSYS_BUILD_LINKER}" STRING "bfd") +rocprofsys_add_cache_option(ROCPROFSYS_BUILD_NUMBER "Internal CI use" STRING "0" ADVANCED NO_FEATURE) -omnitrace_add_interface_library(rocprofsys-static-libgcc +rocprofsys_add_interface_library(rocprofsys-static-libgcc "Link to static version of libgcc") -omnitrace_add_interface_library(rocprofsys-static-libstdcxx +rocprofsys_add_interface_library(rocprofsys-static-libstdcxx "Link to static version of libstdc++") -omnitrace_add_interface_library(rocprofsys-static-libgcc-optional +rocprofsys_add_interface_library(rocprofsys-static-libgcc-optional "Link to static version of libgcc") -omnitrace_add_interface_library(rocprofsys-static-libstdcxx-optional +rocprofsys_add_interface_library(rocprofsys-static-libstdcxx-optional "Link to static version of libstdc++") target_compile_definitions(rocprofsys-compile-options INTERFACE $<$:DEBUG>) -set(OMNITRACE_SANITIZER_TYPE +set(ROCPROFSYS_SANITIZER_TYPE "leak" CACHE STRING "Sanitizer type") -if(OMNITRACE_USE_SANITIZER) - omnitrace_add_feature(OMNITRACE_SANITIZER_TYPE +if(ROCPROFSYS_USE_SANITIZER) + rocprofsys_add_feature(ROCPROFSYS_SANITIZER_TYPE "Sanitizer type, e.g. leak, thread, address, memory, etc.") endif() -if(OMNITRACE_BUILD_CI) - omnitrace_target_compile_definitions(${LIBNAME}-compile-options - INTERFACE OMNITRACE_CI) +if(ROCPROFSYS_BUILD_CI) + rocprofsys_target_compile_definitions(${LIBNAME}-compile-options + INTERFACE ROCPROFSYS_CI) endif() # ----------------------------------------------------------------------------------------# @@ -88,7 +88,7 @@ add_flag_if_avail( "-W" "-Wall" "-Wno-unknown-pragmas" "-Wno-unused-function" "-Wno-ignored-attributes" "-Wno-attributes" "-Wno-missing-field-initializers" "-Wno-interference-size") -if(OMNITRACE_BUILD_DEBUG) +if(ROCPROFSYS_BUILD_DEBUG) add_flag_if_avail("-g3" "-fno-omit-frame-pointer") endif() @@ -104,7 +104,7 @@ endif() # ----------------------------------------------------------------------------------------# # extra flags for debug information in debug or optimized binaries # -omnitrace_add_interface_library( +rocprofsys_add_interface_library( rocprofsys-compile-debuginfo "Attempts to set best flags for more expressive profiling information in debug or optimized binaries" ) @@ -144,16 +144,16 @@ endif() # ----------------------------------------------------------------------------------------# # non-debug optimizations # -omnitrace_add_interface_library(rocprofsys-compile-extra "Extra optimization flags") -if(NOT OMNITRACE_BUILD_CODECOV AND OMNITRACE_BUILD_EXTRA_OPTIMIZATIONS) +rocprofsys_add_interface_library(rocprofsys-compile-extra "Extra optimization flags") +if(NOT ROCPROFSYS_BUILD_CODECOV AND ROCPROFSYS_BUILD_EXTRA_OPTIMIZATIONS) add_target_flag_if_avail( rocprofsys-compile-extra "-finline-functions" "-funroll-loops" "-ftree-vectorize" "-ftree-loop-optimize" "-ftree-loop-vectorize") endif() if(NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" - AND OMNITRACE_BUILD_EXTRA_OPTIMIZATIONS - AND NOT OMNITRACE_BUILD_CODECOV) + AND ROCPROFSYS_BUILD_EXTRA_OPTIMIZATIONS + AND NOT ROCPROFSYS_BUILD_CODECOV) target_link_libraries(rocprofsys-compile-options INTERFACE $) add_flag_if_avail( @@ -168,88 +168,88 @@ endif() # add_cxx_flag_if_avail("-faligned-new") -omnitrace_add_interface_library(rocprofsys-lto "Adds link-time-optimization flags") +rocprofsys_add_interface_library(rocprofsys-lto "Adds link-time-optimization flags") -if(NOT OMNITRACE_BUILD_CODECOV) - omnitrace_save_variables(FLTO VARIABLES CMAKE_CXX_FLAGS) +if(NOT ROCPROFSYS_BUILD_CODECOV) + rocprofsys_save_variables(FLTO VARIABLES CMAKE_CXX_FLAGS) set(_CXX_FLAGS "${CMAKE_CXX_FLAGS}") set(CMAKE_CXX_FLAGS "-flto=thin ${_CXX_FLAGS}") add_target_flag_if_avail(rocprofsys-lto "-flto=thin") - if(NOT cxx_omnitrace_lto_flto_thin) + if(NOT cxx_rocprofsys_lto_flto_thin) set(CMAKE_CXX_FLAGS "-flto ${_CXX_FLAGS}") add_target_flag_if_avail(rocprofsys-lto "-flto") - if(NOT cxx_omnitrace_lto_flto) - set(OMNITRACE_BUILD_LTO OFF) + if(NOT cxx_rocprofsys_lto_flto) + set(ROCPROFSYS_BUILD_LTO OFF) else() target_link_options(rocprofsys-lto INTERFACE -flto) endif() add_target_flag_if_avail(rocprofsys-lto "-fno-fat-lto-objects") - if(cxx_omnitrace_lto_fno_fat_lto_objects) + if(cxx_rocprofsys_lto_fno_fat_lto_objects) target_link_options(rocprofsys-lto INTERFACE -fno-fat-lto-objects) endif() else() target_link_options(rocprofsys-lto INTERFACE -flto=thin) endif() - omnitrace_restore_variables(FLTO VARIABLES CMAKE_CXX_FLAGS) + rocprofsys_restore_variables(FLTO VARIABLES CMAKE_CXX_FLAGS) endif() # ----------------------------------------------------------------------------------------# # print compilation timing reports (Clang compiler) # -omnitrace_add_interface_library( +rocprofsys_add_interface_library( rocprofsys-compile-timing "Adds compiler flags which report compilation timing metrics") if(CMAKE_CXX_COMPILER_IS_CLANG) add_target_flag_if_avail(rocprofsys-compile-timing "-ftime-trace") - if(NOT cxx_omnitrace_compile_timing_ftime_trace) + if(NOT cxx_rocprofsys_compile_timing_ftime_trace) add_target_flag_if_avail(rocprofsys-compile-timing "-ftime-report") endif() else() add_target_flag_if_avail(rocprofsys-compile-timing "-ftime-report") endif() -if(OMNITRACE_USE_COMPILE_TIMING) +if(ROCPROFSYS_USE_COMPILE_TIMING) target_link_libraries(rocprofsys-compile-options INTERFACE rocprofsys-compile-timing) endif() # ----------------------------------------------------------------------------------------# # fstack-protector # -omnitrace_add_interface_library(rocprofsys-stack-protector +rocprofsys_add_interface_library(rocprofsys-stack-protector "Adds stack-protector compiler flags") add_target_flag_if_avail(rocprofsys-stack-protector "-fstack-protector-strong" "-Wstack-protector") -if(OMNITRACE_BUILD_STACK_PROTECTOR) +if(ROCPROFSYS_BUILD_STACK_PROTECTOR) target_link_libraries(rocprofsys-compile-options INTERFACE rocprofsys-stack-protector) endif() # ----------------------------------------------------------------------------------------# # developer build flags # -if(OMNITRACE_BUILD_DEVELOPER) +if(ROCPROFSYS_BUILD_DEVELOPER) add_target_flag_if_avail( rocprofsys-compile-options "-Werror" "-Wdouble-promotion" "-Wshadow" "-Wextra" "-Wpedantic" "-Wstack-usage=524288" # 512 KB "/showIncludes") - if(OMNITRACE_BUILD_NUMBER GREATER 2) + if(ROCPROFSYS_BUILD_NUMBER GREATER 2) add_target_flag_if_avail(rocprofsys-compile-options "-gsplit-dwarf") endif() endif() -if(OMNITRACE_BUILD_LINKER) +if(ROCPROFSYS_BUILD_LINKER) target_link_options( rocprofsys-compile-options INTERFACE - $<$:-fuse-ld=${OMNITRACE_BUILD_LINKER}> - $<$:-fuse-ld=${OMNITRACE_BUILD_LINKER}>) + $<$:-fuse-ld=${ROCPROFSYS_BUILD_LINKER}> + $<$:-fuse-ld=${ROCPROFSYS_BUILD_LINKER}>) endif() # ----------------------------------------------------------------------------------------# # release build flags # -if(OMNITRACE_BUILD_RELEASE AND NOT OMNITRACE_BUILD_DEBUG) +if(ROCPROFSYS_BUILD_RELEASE AND NOT ROCPROFSYS_BUILD_DEBUG) add_target_flag_if_avail( rocprofsys-compile-options "-g1" "-feliminate-unused-debug-symbols" "-gno-column-info" "-gno-variable-location-views" "-gline-tables-only") @@ -258,9 +258,9 @@ endif() # ----------------------------------------------------------------------------------------# # visibility build flags # -omnitrace_add_interface_library(rocprofsys-default-visibility +rocprofsys_add_interface_library(rocprofsys-default-visibility "Adds -fvisibility=default compiler flag") -omnitrace_add_interface_library(rocprofsys-hidden-visibility +rocprofsys_add_interface_library(rocprofsys-hidden-visibility "Adds -fvisibility=hidden compiler flag") add_target_flag_if_avail(rocprofsys-default-visibility "-fvisibility=default") @@ -280,7 +280,7 @@ endif() # ----------------------------------------------------------------------------------------# # sanitizer # -set(OMNITRACE_SANITIZER_TYPES +set(ROCPROFSYS_SANITIZER_TYPES address memory thread @@ -290,22 +290,22 @@ set(OMNITRACE_SANITIZER_TYPES null bounds alignment) -set_property(CACHE OMNITRACE_SANITIZER_TYPE PROPERTY STRINGS - "${OMNITRACE_SANITIZER_TYPES}") -omnitrace_add_interface_library(rocprofsys-sanitizer-compile-options +set_property(CACHE ROCPROFSYS_SANITIZER_TYPE PROPERTY STRINGS + "${ROCPROFSYS_SANITIZER_TYPES}") +rocprofsys_add_interface_library(rocprofsys-sanitizer-compile-options "Adds compiler flags for sanitizers") -omnitrace_add_interface_library( +rocprofsys_add_interface_library( rocprofsys-sanitizer - "Adds compiler flags to enable ${OMNITRACE_SANITIZER_TYPE} sanitizer (-fsanitizer=${OMNITRACE_SANITIZER_TYPE})" + "Adds compiler flags to enable ${ROCPROFSYS_SANITIZER_TYPE} sanitizer (-fsanitizer=${ROCPROFSYS_SANITIZER_TYPE})" ) set(COMMON_SANITIZER_FLAGS "-fno-optimize-sibling-calls" "-fno-omit-frame-pointer" "-fno-inline-functions") add_target_flag(rocprofsys-sanitizer-compile-options ${COMMON_SANITIZER_FLAGS}) -foreach(_TYPE ${OMNITRACE_SANITIZER_TYPES}) +foreach(_TYPE ${ROCPROFSYS_SANITIZER_TYPES}) set(_FLAG "-fsanitize=${_TYPE}") - omnitrace_add_interface_library( + rocprofsys_add_interface_library( rocprofsys-${_TYPE}-sanitizer "Adds compiler flags to enable ${_TYPE} sanitizer (${_FLAG})") add_target_flag(rocprofsys-${_TYPE}-sanitizer ${_FLAG}) @@ -318,8 +318,8 @@ endforeach() unset(_FLAG) unset(COMMON_SANITIZER_FLAGS) -if(OMNITRACE_USE_SANITIZER) - foreach(_TYPE ${OMNITRACE_SANITIZER_TYPE}) +if(ROCPROFSYS_USE_SANITIZER) + foreach(_TYPE ${ROCPROFSYS_SANITIZER_TYPE}) if(TARGET rocprofsys-${_TYPE}-sanitizer) target_link_libraries(rocprof-sys-sanitizer INTERFACE rocprofsys-${_TYPE}-sanitizer) @@ -330,7 +330,7 @@ if(OMNITRACE_USE_SANITIZER) endif() endforeach() else() - set(OMNITRACE_USE_SANITIZER OFF) + set(ROCPROFSYS_USE_SANITIZER OFF) endif() # ----------------------------------------------------------------------------------------# @@ -352,12 +352,12 @@ target_link_options( rocprofsys-static-libstdcxx INTERFACE $<$:$<$:-static-libstdc++>>) -if(OMNITRACE_BUILD_STATIC_LIBGCC) +if(ROCPROFSYS_BUILD_STATIC_LIBGCC) target_link_libraries(rocprofsys-static-libgcc-optional INTERFACE rocprofsys-static-libgcc) endif() -if(OMNITRACE_BUILD_STATIC_LIBSTDCXX) +if(ROCPROFSYS_BUILD_STATIC_LIBSTDCXX) target_link_libraries(rocprofsys-static-libstdcxx-optional INTERFACE rocprofsys-static-libstdcxx) endif() diff --git a/cmake/Compilers.cmake b/cmake/Compilers.cmake index b1507b0e..a2ba2881 100644 --- a/cmake/Compilers.cmake +++ b/cmake/Compilers.cmake @@ -30,7 +30,7 @@ if("${LIBNAME}" STREQUAL "") endif() if(NOT TARGET ${LIBNAME}-compile-options) - omnitrace_add_interface_library( + rocprofsys_add_interface_library( ${LIBNAME}-compile-options "Adds the standard set of compiler flags used by timemory") endif() @@ -88,12 +88,12 @@ endmacro(set_no_duplicates _VAR) # ----------------------------------------------------------------------------------------# # call before running check_{c,cxx}_compiler_flag # ----------------------------------------------------------------------------------------# -macro(omnitrace_begin_flag_check) - if(OMNITRACE_QUIET_CONFIG) +macro(rocprofsys_begin_flag_check) + if(ROCPROFSYS_QUIET_CONFIG) if(NOT DEFINED CMAKE_REQUIRED_QUIET) set(CMAKE_REQUIRED_QUIET OFF) endif() - omnitrace_save_variables(FLAG_CHECK VARIABLES CMAKE_REQUIRED_QUIET) + rocprofsys_save_variables(FLAG_CHECK VARIABLES CMAKE_REQUIRED_QUIET) set(CMAKE_REQUIRED_QUIET ON) endif() endmacro() @@ -101,9 +101,9 @@ endmacro() # ----------------------------------------------------------------------------------------# # call after running check_{c,cxx}_compiler_flag # ----------------------------------------------------------------------------------------# -macro(omnitrace_end_flag_check) - if(OMNITRACE_QUIET_CONFIG) - omnitrace_restore_variables(FLAG_CHECK VARIABLES CMAKE_REQUIRED_QUIET) +macro(rocprofsys_end_flag_check) + if(ROCPROFSYS_QUIET_CONFIG) + rocprofsys_restore_variables(FLAG_CHECK VARIABLES CMAKE_REQUIRED_QUIET) endif() endmacro() @@ -125,7 +125,7 @@ macro(ADD_TARGET_C_FLAG _TARG) endif() string(REPLACE "-" "_" _MAKE_TARG "${_TARG}") - list(APPEND OMNITRACE_MAKE_TARGETS ${_MAKE_TARG}) + list(APPEND ROCPROFSYS_MAKE_TARGETS ${_MAKE_TARG}) target_compile_options(${_TARG} ${_SCOPE} $<$:${ARGN}>) list(APPEND ${_MAKE_TARG}_C_FLAGS ${ARGN}) @@ -159,7 +159,7 @@ endmacro() # ----------------------------------------------------------------------------------------# macro(ADD_C_FLAG_IF_AVAIL FLAG) set(_ENABLE ON) - if(DEFINED OMNITRACE_BUILD_C AND NOT OMNITRACE_BUILD_C) + if(DEFINED ROCPROFSYS_BUILD_C AND NOT ROCPROFSYS_BUILD_C) set(_ENABLE OFF) endif() set(_TARG) @@ -174,17 +174,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 OMNITRACE_BUILD_C) + if(NOT ROCPROFSYS_BUILD_C) set(${FLAG_NAME} ON) else() - omnitrace_begin_flag_check() + rocprofsys_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() - omnitrace_end_flag_check() + rocprofsys_end_flag_check() if(${FLAG_NAME}) if("${_LTARG}" STREQUAL "") list(APPEND ${PROJECT_NAME}_C_FLAGS "${FLAG}") @@ -227,7 +227,7 @@ macro(ADD_TARGET_CXX_FLAG _TARG) endif() string(REPLACE "-" "_" _MAKE_TARG "${_TARG}") - list(APPEND OMNITRACE_MAKE_TARGETS ${_MAKE_TARG}) + list(APPEND ROCPROFSYS_MAKE_TARGETS ${_MAKE_TARG}) target_compile_options(${_TARG} ${_SCOPE} $<$:${ARGN}>) list(APPEND ${_MAKE_TARG}_CXX_FLAGS ${ARGN}) @@ -282,14 +282,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}") - omnitrace_begin_flag_check() + rocprofsys_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() - omnitrace_end_flag_check() + rocprofsys_end_flag_check() if(${FLAG_NAME}) if("${_LTARG}" STREQUAL "") list(APPEND ${PROJECT_NAME}_CXX_FLAGS "${FLAG}") @@ -362,7 +362,7 @@ endmacro() # ----------------------------------------------------------------------------------------# # check flag # ----------------------------------------------------------------------------------------# -function(OMNITRACE_TARGET_FLAG _TARG_TARGET) +function(ROCPROFSYS_TARGET_FLAG _TARG_TARGET) cmake_parse_arguments(_TARG "IF_AVAIL" "MODE" "FLAGS;LANGUAGES" ${ARGN}) if(NOT _TARG_MODE) @@ -391,14 +391,14 @@ function(OMNITRACE_TARGET_FLAG _TARG_TARGET) string(REPLACE "-" "_" FLAG_NAME "${FLAG_NAME}") string(REPLACE " " "_" FLAG_NAME "${FLAG_NAME}") string(REPLACE "=" "_" FLAG_NAME "${FLAG_NAME}") - omnitrace_begin_flag_check() + rocprofsys_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() - omnitrace_end_flag_check() + rocprofsys_end_flag_check() if(${FLAG_NAME}) target_compile_options(${_TARG_TARGET} ${_TARG_MODE} $<$:${_FLAG}>) @@ -409,14 +409,14 @@ function(OMNITRACE_TARGET_FLAG _TARG_TARGET) string(REPLACE "-" "_" FLAG_NAME "${FLAG_NAME}") string(REPLACE " " "_" FLAG_NAME "${FLAG_NAME}") string(REPLACE "=" "_" FLAG_NAME "${FLAG_NAME}") - omnitrace_begin_flag_check() + rocprofsys_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() - omnitrace_end_flag_check() + rocprofsys_end_flag_check() if(${FLAG_NAME}) target_compile_options(${_TARG_TARGET} ${_TARG_MODE} $<$:${_FLAG}>) @@ -439,7 +439,7 @@ endfunction() # ----------------------------------------------------------------------------------------# macro(ADD_TARGET_CUDA_FLAG _TARG) string(REPLACE "-" "_" _MAKE_TARG "${_TARG}") - list(APPEND OMNITRACE_MAKE_TARGETS ${_MAKE_TARG}) + list(APPEND ROCPROFSYS_MAKE_TARGETS ${_MAKE_TARG}) target_compile_options(${_TARG} INTERFACE $<$:${ARGN}>) list(APPEND ${_MAKE_TARG}_CUDA_FLAGS ${ARGN}) @@ -470,9 +470,9 @@ endfunction() # ----------------------------------------------------------------------------------------# # add compiler definition # ----------------------------------------------------------------------------------------# -function(OMNITRACE_TARGET_COMPILE_DEFINITIONS _TARG _VIS) +function(ROCPROFSYS_TARGET_COMPILE_DEFINITIONS _TARG _VIS) foreach(_DEF ${ARGN}) - if(NOT "${_DEF}" MATCHES "[A-Za-z_]+=.*" AND "${_DEF}" MATCHES "^OMNITRACE_") + if(NOT "${_DEF}" MATCHES "[A-Za-z_]+=.*" AND "${_DEF}" MATCHES "^ROCPROFSYS_") set(_DEF "${_DEF}=1") endif() target_compile_definitions(${_TARG} ${_VIS} $<$:${_DEF}>) diff --git a/cmake/ConfigCPack.cmake b/cmake/ConfigCPack.cmake index d01026f9..a0d19314 100644 --- a/cmake/ConfigCPack.cmake +++ b/cmake/ConfigCPack.cmake @@ -1,6 +1,6 @@ # configure packaging -function(omnitrace_parse_release) +function(rocprofsys_parse_release) if(EXISTS /etc/lsb-release AND NOT IS_DIRECTORY /etc/lsb-release) file(READ /etc/lsb-release _LSB_RELEASE) if(_LSB_RELEASE) @@ -27,7 +27,7 @@ function(omnitrace_parse_release) endfunction() # parse either /etc/lsb-release or /etc/os-release -omnitrace_parse_release() +rocprofsys_parse_release() if(NOT _SYSTEM_NAME) set(_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}") @@ -45,80 +45,80 @@ set(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}") set(CPACK_PACKAGE_CONTACT "https://github.com/ROCm/rocprofiler-systems") set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE") set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF) -set(OMNITRACE_CPACK_SYSTEM_NAME +set(ROCPROFSYS_CPACK_SYSTEM_NAME "${_SYSTEM_NAME}" CACHE STRING "System name, e.g. Linux or Ubuntu-20.04") -set(OMNITRACE_CPACK_PACKAGE_SUFFIX "") +set(ROCPROFSYS_CPACK_PACKAGE_SUFFIX "") -if(OMNITRACE_USE_HIP - OR OMNITRACE_USE_ROCTRACER - OR OMNITRACE_USE_ROCM_SMI) - set(OMNITRACE_CPACK_PACKAGE_SUFFIX - "${OMNITRACE_CPACK_PACKAGE_SUFFIX}-ROCm-${ROCmVersion_NUMERIC_VERSION}") +if(ROCPROFSYS_USE_HIP + OR ROCPROFSYS_USE_ROCTRACER + OR ROCPROFSYS_USE_ROCM_SMI) + set(ROCPROFSYS_CPACK_PACKAGE_SUFFIX + "${ROCPROFSYS_CPACK_PACKAGE_SUFFIX}-ROCm-${ROCmVersion_NUMERIC_VERSION}") endif() -if(OMNITRACE_USE_PAPI) - set(OMNITRACE_CPACK_PACKAGE_SUFFIX "${OMNITRACE_CPACK_PACKAGE_SUFFIX}-PAPI") +if(ROCPROFSYS_USE_PAPI) + set(ROCPROFSYS_CPACK_PACKAGE_SUFFIX "${ROCPROFSYS_CPACK_PACKAGE_SUFFIX}-PAPI") endif() -if(OMNITRACE_USE_OMPT) - set(OMNITRACE_CPACK_PACKAGE_SUFFIX "${OMNITRACE_CPACK_PACKAGE_SUFFIX}-OMPT") +if(ROCPROFSYS_USE_OMPT) + set(ROCPROFSYS_CPACK_PACKAGE_SUFFIX "${ROCPROFSYS_CPACK_PACKAGE_SUFFIX}-OMPT") endif() -if(OMNITRACE_USE_MPI) +if(ROCPROFSYS_USE_MPI) set(VALID_MPI_IMPLS "mpich" "openmpi") if("${MPI_C_COMPILER_INCLUDE_DIRS};${MPI_C_HEADER_DIR}" MATCHES "openmpi") - set(OMNITRACE_MPI_IMPL "openmpi") + set(ROCPROFSYS_MPI_IMPL "openmpi") elseif("${MPI_C_COMPILER_INCLUDE_DIRS};${MPI_C_HEADER_DIR}" MATCHES "mpich") - set(OMNITRACE_MPI_IMPL "mpich") + set(ROCPROFSYS_MPI_IMPL "mpich") else() message( WARNING - "MPI implementation could not be determined. Please set OMNITRACE_MPI_IMPL to one of the following for CPack: ${VALID_MPI_IMPLS}" + "MPI implementation could not be determined. Please set ROCPROFSYS_MPI_IMPL to one of the following for CPack: ${VALID_MPI_IMPLS}" ) endif() - if(OMNITRACE_MPI_IMPL AND NOT "${OMNITRACE_MPI_IMPL}" IN_LIST VALID_MPI_IMPLS) + if(ROCPROFSYS_MPI_IMPL AND NOT "${ROCPROFSYS_MPI_IMPL}" IN_LIST VALID_MPI_IMPLS) message( SEND_ERROR - "Invalid OMNITRACE_MPI_IMPL (${OMNITRACE_MPI_IMPL}). Should be one of: ${VALID_MPI_IMPLS}" + "Invalid ROCPROFSYS_MPI_IMPL (${ROCPROFSYS_MPI_IMPL}). Should be one of: ${VALID_MPI_IMPLS}" ) else() - omnitrace_add_feature(OMNITRACE_MPI_IMPL + rocprofsys_add_feature(ROCPROFSYS_MPI_IMPL "MPI implementation for CPack DEBIAN depends") endif() - if("${OMNITRACE_MPI_IMPL}" STREQUAL "openmpi") - set(OMNITRACE_MPI_IMPL_UPPER "OpenMPI") - elseif("${OMNITRACE_MPI_IMPL}" STREQUAL "mpich") - set(OMNITRACE_MPI_IMPL_UPPER "MPICH") + if("${ROCPROFSYS_MPI_IMPL}" STREQUAL "openmpi") + set(ROCPROFSYS_MPI_IMPL_UPPER "OpenMPI") + elseif("${ROCPROFSYS_MPI_IMPL}" STREQUAL "mpich") + set(ROCPROFSYS_MPI_IMPL_UPPER "MPICH") else() - set(OMNITRACE_MPI_IMPL_UPPER "MPI") + set(ROCPROFSYS_MPI_IMPL_UPPER "MPI") endif() - set(OMNITRACE_CPACK_PACKAGE_SUFFIX - "${OMNITRACE_CPACK_PACKAGE_SUFFIX}-${OMNITRACE_MPI_IMPL_UPPER}") + set(ROCPROFSYS_CPACK_PACKAGE_SUFFIX + "${ROCPROFSYS_CPACK_PACKAGE_SUFFIX}-${ROCPROFSYS_MPI_IMPL_UPPER}") endif() -if(OMNITRACE_USE_PYTHON) - set(_OMNITRACE_PYTHON_NAME "Python3") - foreach(_VER ${OMNITRACE_PYTHON_VERSIONS}) +if(ROCPROFSYS_USE_PYTHON) + set(_ROCPROFSYS_PYTHON_NAME "Python3") + foreach(_VER ${ROCPROFSYS_PYTHON_VERSIONS}) if("${_VER}" VERSION_LESS 3.0.0) - set(_OMNITRACE_PYTHON_NAME "Python") + set(_ROCPROFSYS_PYTHON_NAME "Python") endif() endforeach() - set(OMNITRACE_CPACK_PACKAGE_SUFFIX "${OMNITRACE_CPACK_PACKAGE_SUFFIX}-Python3") + set(ROCPROFSYS_CPACK_PACKAGE_SUFFIX "${ROCPROFSYS_CPACK_PACKAGE_SUFFIX}-Python3") endif() set(CPACK_PACKAGE_FILE_NAME - "${CPACK_PACKAGE_NAME}-${OMNITRACE_VERSION}-${OMNITRACE_CPACK_SYSTEM_NAME}${OMNITRACE_CPACK_PACKAGE_SUFFIX}" + "${CPACK_PACKAGE_NAME}-${ROCPROFSYS_VERSION}-${ROCPROFSYS_CPACK_SYSTEM_NAME}${ROCPROFSYS_CPACK_PACKAGE_SUFFIX}" ) if(DEFINED ENV{CPACK_PACKAGE_FILE_NAME}) set(CPACK_PACKAGE_FILE_NAME $ENV{CPACK_PACKAGE_FILE_NAME}) endif() -set(OMNITRACE_PACKAGE_FILE_NAME - ${CPACK_PACKAGE_NAME}-${OMNITRACE_VERSION}-${OMNITRACE_CPACK_SYSTEM_NAME}${OMNITRACE_CPACK_PACKAGE_SUFFIX} +set(ROCPROFSYS_PACKAGE_FILE_NAME + ${CPACK_PACKAGE_NAME}-${ROCPROFSYS_VERSION}-${ROCPROFSYS_CPACK_SYSTEM_NAME}${ROCPROFSYS_CPACK_PACKAGE_SUFFIX} ) -omnitrace_add_feature(OMNITRACE_PACKAGE_FILE_NAME "CPack filename") +rocprofsys_add_feature(ROCPROFSYS_PACKAGE_FILE_NAME "CPack filename") # -------------------------------------------------------------------------------------- # # @@ -128,7 +128,7 @@ omnitrace_add_feature(OMNITRACE_PACKAGE_FILE_NAME "CPack filename") set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/ROCm/rocprofiler-systems") set(CPACK_DEBIAN_PACKAGE_RELEASE - "${OMNITRACE_CPACK_SYSTEM_NAME}${OMNITRACE_CPACK_PACKAGE_SUFFIX}") + "${ROCPROFSYS_CPACK_SYSTEM_NAME}${ROCPROFSYS_CPACK_PACKAGE_SUFFIX}") string(REGEX REPLACE "([a-zA-Z])-([0-9])" "\\1\\2" CPACK_DEBIAN_PACKAGE_RELEASE "${CPACK_DEBIAN_PACKAGE_RELEASE}") string(REPLACE "-" "~" CPACK_DEBIAN_PACKAGE_RELEASE "${CPACK_DEBIAN_PACKAGE_RELEASE}") @@ -137,10 +137,10 @@ set(_DEBIAN_PACKAGE_DEPENDS "") if(DYNINST_USE_OpenMP) list(APPEND _DEBIAN_PACKAGE_DEPENDS libgomp1) endif() -if(OMNITRACE_USE_PAPI AND NOT OMNITRACE_BUILD_PAPI) +if(ROCPROFSYS_USE_PAPI AND NOT ROCPROFSYS_BUILD_PAPI) list(APPEND _DEBIAN_PACKAGE_DEPENDS libpapi-dev libpfm4) endif() -if(NOT OMNITRACE_BUILD_DYNINST) +if(NOT ROCPROFSYS_BUILD_DYNINST) if(NOT DYNINST_BUILD_BOOST) foreach(_BOOST_COMPONENT atomic system thread date-time filesystem timer) list(APPEND _DEBIAN_PACKAGE_DEPENDS @@ -160,19 +160,19 @@ if(ROCmVersion_FOUND) set(_ROCM_SMI_SUFFIX " (>= ${ROCmVersion_MAJOR_VERSION}.0.0.${ROCmVersion_NUMERIC_VERSION})") endif() -if(OMNITRACE_USE_ROCM_SMI) +if(ROCPROFSYS_USE_ROCM_SMI) list(APPEND _DEBIAN_PACKAGE_DEPENDS "rocm-smi-lib${_ROCM_SMI_SUFFIX}") endif() -if(OMNITRACE_USE_ROCTRACER) +if(ROCPROFSYS_USE_ROCTRACER) list(APPEND _DEBIAN_PACKAGE_DEPENDS "roctracer-dev${_ROCTRACER_SUFFIX}") endif() -if(OMNITRACE_USE_ROCPROFILER) +if(ROCPROFSYS_USE_ROCPROFILER) list(APPEND _DEBIAN_PACKAGE_DEPENDS "rocprofiler-dev${_ROCPROFILER_SUFFIX}") endif() -if(OMNITRACE_USE_MPI) - if("${OMNITRACE_MPI_IMPL}" STREQUAL "openmpi") +if(ROCPROFSYS_USE_MPI) + if("${ROCPROFSYS_MPI_IMPL}" STREQUAL "openmpi") list(APPEND _DEBIAN_PACKAGE_DEPENDS "libopenmpi-dev") - elseif("${OMNITRACE_MPI_IMPL}" STREQUAL "mpich") + elseif("${ROCPROFSYS_MPI_IMPL}" STREQUAL "mpich") list(APPEND _DEBIAN_PACKAGE_DEPENDS "libmpich-dev") endif() endif() @@ -195,14 +195,14 @@ if(DEFINED CPACK_PACKAGING_INSTALL_PREFIX) endif() set(CPACK_RPM_PACKAGE_RELEASE - "${OMNITRACE_CPACK_SYSTEM_NAME}${OMNITRACE_CPACK_PACKAGE_SUFFIX}") + "${ROCPROFSYS_CPACK_SYSTEM_NAME}${ROCPROFSYS_CPACK_PACKAGE_SUFFIX}") string(REGEX REPLACE "([a-zA-Z])-([0-9])" "\\1\\2" CPACK_RPM_PACKAGE_RELEASE "${CPACK_RPM_PACKAGE_RELEASE}") string(REPLACE "-" "~" CPACK_RPM_PACKAGE_RELEASE "${CPACK_RPM_PACKAGE_RELEASE}") set(_RPM_PACKAGE_PROVIDES "") -if(OMNITRACE_BUILD_LIBUNWIND) +if(ROCPROFSYS_BUILD_LIBUNWIND) list(APPEND _RPM_PACKAGE_PROVIDES "libunwind.so.99()(64bit)") list(APPEND _RPM_PACKAGE_PROVIDES "libunwind-x86_64.so.99()(64bit)") list(APPEND _RPM_PACKAGE_PROVIDES "libunwind-setjmp.so.0()(64bit)") @@ -241,22 +241,22 @@ if(DEFINED ENV{CPACK_RPM_PACKAGE_RELEASE}) set(CPACK_RPM_PACKAGE_RELEASE $ENV{CPACK_RPM_PACKAGE_RELEASE}) endif() -omnitrace_add_feature(CPACK_PACKAGE_NAME "Package name") -omnitrace_add_feature(CPACK_PACKAGE_VERSION "Package version") -omnitrace_add_feature(CPACK_PACKAGING_INSTALL_PREFIX "Package installation prefix") +rocprofsys_add_feature(CPACK_PACKAGE_NAME "Package name") +rocprofsys_add_feature(CPACK_PACKAGE_VERSION "Package version") +rocprofsys_add_feature(CPACK_PACKAGING_INSTALL_PREFIX "Package installation prefix") -omnitrace_add_feature(CPACK_DEBIAN_FILE_NAME "Debian file name") -omnitrace_add_feature(CPACK_DEBIAN_PACKAGE_RELEASE "Debian package release version") -omnitrace_add_feature(CPACK_DEBIAN_PACKAGE_DEPENDS "Debian package dependencies") -omnitrace_add_feature(CPACK_DEBIAN_PACKAGE_SHLIBDEPS +rocprofsys_add_feature(CPACK_DEBIAN_FILE_NAME "Debian file name") +rocprofsys_add_feature(CPACK_DEBIAN_PACKAGE_RELEASE "Debian package release version") +rocprofsys_add_feature(CPACK_DEBIAN_PACKAGE_DEPENDS "Debian package dependencies") +rocprofsys_add_feature(CPACK_DEBIAN_PACKAGE_SHLIBDEPS "Debian package shared library dependencies") -omnitrace_add_feature(CPACK_RPM_FILE_NAME "RPM file name") -omnitrace_add_feature(CPACK_RPM_PACKAGE_RELEASE "RPM package release version") -omnitrace_add_feature(CPACK_RPM_PACKAGE_REQUIRES "RPM package dependencies") -omnitrace_add_feature(CPACK_RPM_PACKAGE_AUTOREQPROV +rocprofsys_add_feature(CPACK_RPM_FILE_NAME "RPM file name") +rocprofsys_add_feature(CPACK_RPM_PACKAGE_RELEASE "RPM package release version") +rocprofsys_add_feature(CPACK_RPM_PACKAGE_REQUIRES "RPM package dependencies") +rocprofsys_add_feature(CPACK_RPM_PACKAGE_AUTOREQPROV "RPM package auto generate requires and provides") -omnitrace_add_feature(CPACK_RPM_PACKAGE_REQUIRES "RPM package requires") -omnitrace_add_feature(CPACK_RPM_PACKAGE_PROVIDES "RPM package provides") +rocprofsys_add_feature(CPACK_RPM_PACKAGE_REQUIRES "RPM package requires") +rocprofsys_add_feature(CPACK_RPM_PACKAGE_PROVIDES "RPM package provides") include(CPack) diff --git a/cmake/ConfigInstall.cmake b/cmake/ConfigInstall.cmake index 6be20156..594c6ec1 100644 --- a/cmake/ConfigInstall.cmake +++ b/cmake/ConfigInstall.cmake @@ -20,21 +20,21 @@ set(LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}) set(PROJECT_BUILD_TARGETS user) configure_package_config_file( - ${PROJECT_SOURCE_DIR}/cmake/Templates/${PROJECT_NAME}-config.cmake.in - ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PACKAGE_NAME}/${PROJECT_NAME}-config.cmake + ${PROJECT_SOURCE_DIR}/cmake/Templates/${PACKAGE_NAME}-config.cmake.in + ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PACKAGE_NAME}/${PACKAGE_NAME}-config.cmake INSTALL_DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PACKAGE_NAME} INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} PATH_VARS PROJECT_INSTALL_DIR INCLUDE_INSTALL_DIR LIB_INSTALL_DIR) write_basic_package_version_file( - ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PACKAGE_NAME}/${PROJECT_NAME}-version.cmake + ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PACKAGE_NAME}/${PACKAGE_NAME}-version.cmake VERSION ${PROJECT_VERSION} COMPATIBILITY SameMinorVersion) install( FILES - ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PACKAGE_NAME}/${PROJECT_NAME}-config.cmake - ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PACKAGE_NAME}/${PROJECT_NAME}-version.cmake + ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PACKAGE_NAME}/${PACKAGE_NAME}-config.cmake + ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PACKAGE_NAME}/${PACKAGE_NAME}-version.cmake DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PACKAGE_NAME} OPTIONAL) diff --git a/cmake/ElfUtils.cmake b/cmake/ElfUtils.cmake index 8a3c4a8b..bbe27156 100644 --- a/cmake/ElfUtils.cmake +++ b/cmake/ElfUtils.cmake @@ -38,7 +38,7 @@ set(ElfUtils_MIN_VERSION CACHE STRING "Minimum acceptable elfutils version") if(${ElfUtils_MIN_VERSION} VERSION_LESS ${_min_version}) - omnitrace_message( + rocprofsys_message( FATAL_ERROR "Requested version ${ElfUtils_MIN_VERSION} is less than minimum supported version (${_min_version})" ) @@ -51,7 +51,7 @@ set(ElfUtils_DOWNLOAD_VERSION # make sure we are not downloading a version less than minimum if(${ElfUtils_DOWNLOAD_VERSION} VERSION_LESS ${ElfUtils_MIN_VERSION}) - omnitrace_message( + rocprofsys_message( FATAL_ERROR "elfutils download version is set to ${ElfUtils_DOWNLOAD_VERSION} but elfutils minimum version is set to ${ElfUtils_MIN_VERSION}" ) @@ -85,7 +85,7 @@ find_program( PATH_SUFFIXES bin) if(NOT ElfUtils_C_COMPILER OR NOT ElfUtils_CXX_COMPILER) - omnitrace_message( + rocprofsys_message( FATAL_ERROR "ElfUtils requires the GNU C and C++ compilers. ElfUtils_C_COMPILER: ${ElfUtils_C_COMPILER}, ElfUtils_CXX_COMPILER: ${ElfUtils_CXX_COMPILER}" ) diff --git a/cmake/Formatting.cmake b/cmake/Formatting.cmake index 8d74a49d..e5387481 100644 --- a/cmake/Formatting.cmake +++ b/cmake/Formatting.cmake @@ -7,14 +7,14 @@ include_guard(DIRECTORY) # ----------------------------------------------------------------------------------------# # clang-tidy -macro(OMNITRACE_ACTIVATE_CLANG_TIDY) - if(OMNITRACE_USE_CLANG_TIDY) +macro(ROCPROFSYS_ACTIVATE_CLANG_TIDY) + if(ROCPROFSYS_USE_CLANG_TIDY) find_program(CLANG_TIDY_COMMAND NAMES clang-tidy) - omnitrace_add_feature(CLANG_TIDY_COMMAND "Path to clang-tidy command") + rocprofsys_add_feature(CLANG_TIDY_COMMAND "Path to clang-tidy command") if(NOT CLANG_TIDY_COMMAND) timemory_message( - WARNING "OMNITRACE_USE_CLANG_TIDY is ON but clang-tidy is not found!") - set(OMNITRACE_USE_CLANG_TIDY OFF) + WARNING "ROCPROFSYS_USE_CLANG_TIDY is ON but clang-tidy is not found!") + set(ROCPROFSYS_USE_CLANG_TIDY OFF) else() set(CMAKE_CXX_CLANG_TIDY ${CLANG_TIDY_COMMAND}) @@ -37,13 +37,13 @@ endmacro() # # ------------------------------------------------------------------------------# -find_program(OMNITRACE_CLANG_FORMAT_EXE NAMES clang-format-11 clang-format-mp-11 +find_program(ROCPROFSYS_CLANG_FORMAT_EXE NAMES clang-format-11 clang-format-mp-11 clang-format) -find_program(OMNITRACE_CMAKE_FORMAT_EXE NAMES cmake-format) -find_program(OMNITRACE_BLACK_FORMAT_EXE NAMES black) +find_program(ROCPROFSYS_CMAKE_FORMAT_EXE NAMES cmake-format) +find_program(ROCPROFSYS_BLACK_FORMAT_EXE NAMES black) -add_custom_target(format-omnitrace) +add_custom_target(format-rocprofsys) if(NOT TARGET format) add_custom_target(format) endif() @@ -53,9 +53,9 @@ foreach(_TYPE source python cmake) endif() endforeach() -if(OMNITRACE_CLANG_FORMAT_EXE - OR OMNITRACE_BLACK_FORMAT_EXE - OR OMNITRACE_CMAKE_FORMAT_EXE) +if(ROCPROFSYS_CLANG_FORMAT_EXE + OR ROCPROFSYS_BLACK_FORMAT_EXE + OR ROCPROFSYS_CMAKE_FORMAT_EXE) file(GLOB_RECURSE sources ${PROJECT_SOURCE_DIR}/source/*.cpp ${PROJECT_SOURCE_DIR}/source/*.c) file(GLOB_RECURSE headers ${PROJECT_SOURCE_DIR}/source/*.hpp @@ -84,32 +84,32 @@ if(OMNITRACE_CLANG_FORMAT_EXE list(REMOVE_ITEM cmake_files ${external}) endif() - if(OMNITRACE_CLANG_FORMAT_EXE) + if(ROCPROFSYS_CLANG_FORMAT_EXE) add_custom_target( format-rocprofsys-source - ${OMNITRACE_CLANG_FORMAT_EXE} -i ${sources} ${headers} ${examples} + ${ROCPROFSYS_CLANG_FORMAT_EXE} -i ${sources} ${headers} ${examples} ${tests_source} - COMMENT "[rocprof-sys] Running C++ formatter ${OMNITRACE_CLANG_FORMAT_EXE}..." + COMMENT "[rocprof-sys] Running C++ formatter ${ROCPROFSYS_CLANG_FORMAT_EXE}..." ) endif() - if(OMNITRACE_BLACK_FORMAT_EXE) + if(ROCPROFSYS_BLACK_FORMAT_EXE) add_custom_target( format-rocprofsys-python - ${OMNITRACE_BLACK_FORMAT_EXE} -q ${PROJECT_SOURCE_DIR} + ${ROCPROFSYS_BLACK_FORMAT_EXE} -q ${PROJECT_SOURCE_DIR} COMMENT - "[rocprof-sys] Running Python formatter ${OMNITRACE_BLACK_FORMAT_EXE}...") + "[rocprof-sys] Running Python formatter ${ROCPROFSYS_BLACK_FORMAT_EXE}...") if(NOT TARGET format-python) add_custom_target(format-python) endif() endif() - if(OMNITRACE_CMAKE_FORMAT_EXE) + if(ROCPROFSYS_CMAKE_FORMAT_EXE) add_custom_target( format-rocprofsys-cmake - ${OMNITRACE_CMAKE_FORMAT_EXE} -i ${cmake_files} + ${ROCPROFSYS_CMAKE_FORMAT_EXE} -i ${cmake_files} COMMENT - "[rocprof-sys] Running CMake formatter ${OMNITRACE_CMAKE_FORMAT_EXE}...") + "[rocprof-sys] Running CMake formatter ${ROCPROFSYS_CMAKE_FORMAT_EXE}...") if(NOT TARGET format-cmake) add_custom_target(format-cmake) endif() @@ -117,7 +117,7 @@ if(OMNITRACE_CLANG_FORMAT_EXE foreach(_TYPE source python cmake) if(TARGET format-rocprofsys-${_TYPE}) - add_dependencies(format-omnitrace format-rocprofsys-${_TYPE}) + add_dependencies(format-rocprofsys format-rocprofsys-${_TYPE}) add_dependencies(format-${_TYPE} format-rocprofsys-${_TYPE}) endif() endforeach() diff --git a/cmake/MacroUtilities.cmake b/cmake/MacroUtilities.cmake index 01dbf685..672f0432 100644 --- a/cmake/MacroUtilities.cmake +++ b/cmake/MacroUtilities.cmake @@ -12,11 +12,11 @@ include(CMakeDependentOption) include(CMakeParseArguments) # ----------------------------------------------------------------------- -# message which handles OMNITRACE_QUIET_CONFIG settings +# message which handles ROCPROFSYS_QUIET_CONFIG settings # ----------------------------------------------------------------------- # -function(OMNITRACE_MESSAGE TYPE) - if(NOT OMNITRACE_QUIET_CONFIG) +function(ROCPROFSYS_MESSAGE TYPE) + if(NOT ROCPROFSYS_QUIET_CONFIG) message(${TYPE} "[rocprof-sys] ${ARGN}") endif() endfunction() @@ -24,7 +24,7 @@ endfunction() # ----------------------------------------------------------------------- # Save a set of variables with the given prefix # ----------------------------------------------------------------------- -macro(OMNITRACE_SAVE_VARIABLES _PREFIX) +macro(ROCPROFSYS_SAVE_VARIABLES _PREFIX) # parse args cmake_parse_arguments( SAVE @@ -58,7 +58,7 @@ endmacro() # ----------------------------------------------------------------------- # Restore a set of variables with the given prefix # ----------------------------------------------------------------------- -macro(OMNITRACE_RESTORE_VARIABLES _PREFIX) +macro(ROCPROFSYS_RESTORE_VARIABLES _PREFIX) # parse args cmake_parse_arguments( RESTORE @@ -92,10 +92,10 @@ macro(OMNITRACE_RESTORE_VARIABLES _PREFIX) endmacro() # ----------------------------------------------------------------------- -# function - omnitrace_capitalize - make a string capitalized (first letter is capital) +# function - rocprofsys_capitalize - make a string capitalized (first letter is capital) # usage: capitalize("SHARED" CShared) message(STATUS "-- CShared is \"${CShared}\"") $ -- # CShared is "Shared" -function(OMNITRACE_CAPITALIZE str var) +function(ROCPROFSYS_CAPITALIZE str var) # make string lower string(TOLOWER "${str}" str) string(SUBSTRING "${str}" 0 1 _first) @@ -108,11 +108,11 @@ function(OMNITRACE_CAPITALIZE str var) endfunction() # ------------------------------------------------------------------------------# -# function omnitrace_strip_target( [FORCE] [EXPLICIT]) +# function rocprofsys_strip_target( [FORCE] [EXPLICIT]) # # Creates a post-build command which strips a binary. FORCE flag will override # -function(OMNITRACE_STRIP_TARGET) +function(ROCPROFSYS_STRIP_TARGET) cmake_parse_arguments(STRIP "FORCE;EXPLICIT" "" "ARGS" ${ARGN}) list(LENGTH STRIP_UNPARSED_ARGUMENTS NUM_UNPARSED) @@ -120,17 +120,17 @@ function(OMNITRACE_STRIP_TARGET) if(NUM_UNPARSED EQUAL 1) set(_TARGET "${STRIP_UNPARSED_ARGUMENTS}") else() - omnitrace_message(FATAL_ERROR - "omnitrace_strip_target cannot deduce target from \"${ARGN}\"") + rocprofsys_message(FATAL_ERROR + "rocprofsys_strip_target cannot deduce target from \"${ARGN}\"") endif() if(NOT TARGET "${_TARGET}") - omnitrace_message( + rocprofsys_message( FATAL_ERROR - "omnitrace_strip_target not provided valid target: \"${_TARGET}\"") + "rocprofsys_strip_target not provided valid target: \"${_TARGET}\"") endif() - if(CMAKE_STRIP AND (STRIP_FORCE OR OMNITRACE_STRIP_LIBRARIES)) + if(CMAKE_STRIP AND (STRIP_FORCE OR ROCPROFSYS_STRIP_LIBRARIES)) if(STRIP_EXPLICIT) add_custom_command( TARGET ${_TARGET} @@ -168,7 +168,7 @@ endfunction() # # Creates a target which runs ctest but depends on all the tests being built. # -function(ADD_OMNITRACE_TEST_TARGET) +function(ADD_ROCPROFSYS_TEST_TARGET) if(NOT TARGET rocprofsys-test) add_custom_target( rocprofsys-test @@ -179,7 +179,7 @@ function(ADD_OMNITRACE_TEST_TARGET) endfunction() # ----------------------------------------------------------------------------------------# -# macro omnitrace_checkout_git_submodule() +# macro rocprofsys_checkout_git_submodule() # # Run "git submodule update" if a file in a submodule does not exist # @@ -188,7 +188,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(OMNITRACE_CHECKOUT_GIT_SUBMODULE) +function(ROCPROFSYS_CHECKOUT_GIT_SUBMODULE) # parse args cmake_parse_arguments( CHECKOUT "RECURSIVE" @@ -257,7 +257,7 @@ function(OMNITRACE_CHECKOUT_GIT_SUBMODULE) if(RET GREATER 0) set(_CMD "${GIT_EXECUTABLE} submodule update --init ${_RECURSE} ${CHECKOUT_ADDITIONAL_CMDS} ${CHECKOUT_RELATIVE_PATH}") - message(STATUS "function(omnitrace_checkout_git_submodule) failed.") + message(STATUS "function(rocprofsys_checkout_git_submodule) failed.") message(FATAL_ERROR "Command: \"${_CMD}\"") else() set(_TEST_FILE_EXISTS ON) @@ -297,7 +297,7 @@ function(OMNITRACE_CHECKOUT_GIT_SUBMODULE) "${GIT_EXECUTABLE} clone -b ${CHECKOUT_REPO_BRANCH} ${CHECKOUT_ADDITIONAL_CMDS} ${CHECKOUT_REPO_URL} ${CHECKOUT_RELATIVE_PATH}" ) - message(STATUS "function(omnitrace_checkout_git_submodule) failed.") + message(STATUS "function(rocprofsys_checkout_git_submodule) failed.") message(FATAL_ERROR "Command: \"${_CMD}\"") else() set(_TEST_FILE_EXISTS ON) @@ -315,7 +315,7 @@ endfunction() # ----------------------------------------------------------------------------------------# # try to find a package quietly # -function(OMNITRACE_TEST_FIND_PACKAGE PACKAGE_NAME OUTPUT_VAR) +function(ROCPROFSYS_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) @@ -335,7 +335,7 @@ endfunction() # ----------------------------------------------------------------------------------------# # macro to add an interface lib # -macro(OMNITRACE_ADD_INTERFACE_LIBRARY _TARGET) +macro(ROCPROFSYS_ADD_INTERFACE_LIBRARY _TARGET) add_library(${_TARGET} INTERFACE) add_library(${PROJECT_NAME}::${_TARGET} ALIAS ${_TARGET}) install( @@ -355,7 +355,7 @@ endmacro() # specified by the existence of the variable , to the list of enabled/disabled # features, plus a docstring describing the feature # -function(OMNITRACE_ADD_FEATURE _var _description) +function(ROCPROFSYS_ADD_FEATURE _var _description) set(EXTRA_DESC "") foreach(currentArg ${ARGN}) if(NOT "${currentArg}" STREQUAL "${_var}" @@ -372,12 +372,12 @@ function(OMNITRACE_ADD_FEATURE _var _description) if("CMAKE_DEFINE" IN_LIST ARGN) set_property(GLOBAL APPEND PROPERTY ${PROJECT_NAME}_CMAKE_DEFINES "${_var} @${_var}@") - if(OMNITRACE_BUILD_DOCS) + if(ROCPROFSYS_BUILD_DOCS) set_property( GLOBAL APPEND PROPERTY ${PROJECT_NAME}_CMAKE_OPTIONS_DOC "${_var}` | ${_description}${EXTRA_DESC} |") endif() - elseif("DOC" IN_LIST ARGN AND OMNITRACE_BUILD_DOCS) + elseif("DOC" IN_LIST ARGN AND ROCPROFSYS_BUILD_DOCS) set_property(GLOBAL APPEND PROPERTY ${PROJECT_NAME}_CMAKE_OPTIONS_DOC "${_var}` | ${_description}${EXTRA_DESC} |") endif() @@ -387,13 +387,13 @@ endfunction() # function add_option( [NO_FEATURE]) Add an # option and add as a feature if NO_FEATURE is not provided # -function(OMNITRACE_ADD_OPTION _NAME _MESSAGE _DEFAULT) +function(ROCPROFSYS_ADD_OPTION _NAME _MESSAGE _DEFAULT) option(${_NAME} "${_MESSAGE}" ${_DEFAULT}) if("NO_FEATURE" IN_LIST ARGN) mark_as_advanced(${_NAME}) else() - omnitrace_add_feature(${_NAME} "${_MESSAGE}") - if(OMNITRACE_BUILD_DOCS) + rocprofsys_add_feature(${_NAME} "${_MESSAGE}") + if(ROCPROFSYS_BUILD_DOCS) set_property(GLOBAL APPEND PROPERTY ${PROJECT_NAME}_CMAKE_OPTIONS_DOC "${_NAME}` | ${_MESSAGE} |") endif() @@ -407,10 +407,10 @@ function(OMNITRACE_ADD_OPTION _NAME _MESSAGE _DEFAULT) endfunction() # ----------------------------------------------------------------------------------------# -# function omnitrace_add_cache_option( +# function rocprofsys_add_cache_option( # [NO_FEATURE] [ADVANCED] [CMAKE_DEFINE]) # -function(OMNITRACE_ADD_CACHE_OPTION _NAME _MESSAGE _TYPE _DEFAULT) +function(ROCPROFSYS_ADD_CACHE_OPTION _NAME _MESSAGE _TYPE _DEFAULT) set(_FORCE) if("FORCE" IN_LIST ARGN) set(_FORCE FORCE) @@ -423,9 +423,9 @@ function(OMNITRACE_ADD_CACHE_OPTION _NAME _MESSAGE _TYPE _DEFAULT) if("NO_FEATURE" IN_LIST ARGN) mark_as_advanced(${_NAME}) else() - omnitrace_add_feature(${_NAME} "${_MESSAGE}") + rocprofsys_add_feature(${_NAME} "${_MESSAGE}") - if(OMNITRACE_BUILD_DOCS) + if(ROCPROFSYS_BUILD_DOCS) set_property(GLOBAL APPEND PROPERTY ${PROJECT_NAME}_CMAKE_OPTIONS_DOC "${_NAME}` | ${_MESSAGE} |") endif() @@ -441,9 +441,9 @@ function(OMNITRACE_ADD_CACHE_OPTION _NAME _MESSAGE _TYPE _DEFAULT) endfunction() # ----------------------------------------------------------------------------------------# -# function omnitrace_report_feature_changes() :: print changes in features +# function rocprofsys_report_feature_changes() :: print changes in features # -function(OMNITRACE_REPORT_FEATURE_CHANGES) +function(ROCPROFSYS_REPORT_FEATURE_CHANGES) get_property(_features GLOBAL PROPERTY ${PROJECT_NAME}_FEATURES) if(NOT "${_features}" STREQUAL "") list(REMOVE_DUPLICATES _features) @@ -451,9 +451,9 @@ function(OMNITRACE_REPORT_FEATURE_CHANGES) endif() foreach(_feature ${_features}) if("${ARGN}" STREQUAL "") - omnitrace_watch_for_change(${_feature}) + rocprofsys_watch_for_change(${_feature}) elseif("${_feature}" IN_LIST ARGN) - omnitrace_watch_for_change(${_feature}) + rocprofsys_watch_for_change(${_feature}) endif() endforeach() endfunction() @@ -461,7 +461,7 @@ endfunction() # ----------------------------------------------------------------------------------------# # function print_enabled_features() Print enabled features plus their docstrings. # -function(OMNITRACE_PRINT_ENABLED_FEATURES) +function(ROCPROFSYS_PRINT_ENABLED_FEATURES) set(_basemsg "The following features are defined/enabled (+):") set(_currentFeatureText "${_basemsg}") get_property(_features GLOBAL PROPERTY ${PROJECT_NAME}_FEATURES) @@ -485,7 +485,7 @@ function(OMNITRACE_PRINT_ENABLED_FEATURES) string(REGEX REPLACE "^${PROJECT_NAME}_USE_" "" _feature_tmp "${_feature}") string(TOLOWER "${_feature_tmp}" _feature_tmp_l) - omnitrace_capitalize("${_feature_tmp}" _feature_tmp_c) + rocprofsys_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 "") @@ -509,7 +509,7 @@ endfunction() # ----------------------------------------------------------------------------------------# # function print_disabled_features() Print disabled features plus their docstrings. # -function(OMNITRACE_PRINT_DISABLED_FEATURES) +function(ROCPROFSYS_PRINT_DISABLED_FEATURES) set(_basemsg "The following features are NOT defined/enabled (-):") set(_currentFeatureText "${_basemsg}") get_property(_features GLOBAL PROPERTY ${PROJECT_NAME}_FEATURES) @@ -538,10 +538,10 @@ endfunction() # ----------------------------------------------------------------------------------------# # function print_features() Print all features plus their docstrings. # -function(OMNITRACE_PRINT_FEATURES) - omnitrace_report_feature_changes() - omnitrace_print_enabled_features() - omnitrace_print_disabled_features() +function(ROCPROFSYS_PRINT_FEATURES) + rocprofsys_report_feature_changes() + rocprofsys_print_enabled_features() + rocprofsys_print_disabled_features() endfunction() # ----------------------------------------------------------------------------------------# @@ -551,26 +551,26 @@ endfunction() # source files DIRECTORY --> all files in directory PROJECT --> all files/targets in # a project/subproject # -function(omnitrace_custom_compilation) +function(rocprofsys_custom_compilation) cmake_parse_arguments(COMP "GLOBAL;PROJECT" "COMPILER" "DIRECTORY;TARGET;SOURCE" ${ARGN}) # find rocprofsys-launch-compiler find_program( - OMNITRACE_COMPILE_LAUNCHER - NAMES omnitrace-launch-compiler + ROCPROFSYS_COMPILE_LAUNCHER + NAMES rocprofsys-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 "omnitrace_custom_compilation not provided COMPILER argument") + message(FATAL_ERROR "rocprofsys_custom_compilation not provided COMPILER argument") endif() - if(NOT OMNITRACE_COMPILE_LAUNCHER) + if(NOT ROCPROFSYS_COMPILE_LAUNCHER) message( FATAL_ERROR - "rocprofsys could not find 'rocprofsys-launch-compiler'. Please set '-DOMNITRACE_COMPILE_LAUNCHER=/path/to/launcher'" + "rocprofsys could not find 'rocprofsys-launch-compiler'. Please set '-DROCPROFSYS_COMPILE_LAUNCHER=/path/to/launcher'" ) endif() @@ -580,16 +580,16 @@ function(omnitrace_custom_compilation) GLOBAL PROPERTY RULE_LAUNCH_COMPILE - "${OMNITRACE_COMPILE_LAUNCHER} ${COMP_COMPILER} ${CMAKE_CXX_COMPILER}") + "${ROCPROFSYS_COMPILE_LAUNCHER} ${COMP_COMPILER} ${CMAKE_CXX_COMPILER}") set_property( GLOBAL PROPERTY RULE_LAUNCH_LINK - "${OMNITRACE_COMPILE_LAUNCHER} ${COMP_COMPILER} ${CMAKE_CXX_COMPILER}") + "${ROCPROFSYS_COMPILE_LAUNCHER} ${COMP_COMPILER} ${CMAKE_CXX_COMPILER}") else() foreach(_TYPE PROJECT DIRECTORY TARGET SOURCE) # make project/subproject scoping easy, e.g. - # omnitrace_custom_compilation(PROJECT) after project(...) + # rocprofsys_custom_compilation(PROJECT) after project(...) if("${_TYPE}" STREQUAL "PROJECT" AND COMP_${_TYPE}) list(APPEND COMP_DIRECTORY ${PROJECT_SOURCE_DIR}) unset(COMP_${_TYPE}) @@ -601,13 +601,13 @@ function(omnitrace_custom_compilation) ${_TYPE} ${_VAL} PROPERTY RULE_LAUNCH_COMPILE - "${OMNITRACE_COMPILE_LAUNCHER} ${COMP_COMPILER} ${CMAKE_CXX_COMPILER}" + "${ROCPROFSYS_COMPILE_LAUNCHER} ${COMP_COMPILER} ${CMAKE_CXX_COMPILER}" ) set_property( ${_TYPE} ${_VAL} PROPERTY RULE_LAUNCH_LINK - "${OMNITRACE_COMPILE_LAUNCHER} ${COMP_COMPILER} ${CMAKE_CXX_COMPILER}" + "${ROCPROFSYS_COMPILE_LAUNCHER} ${COMP_COMPILER} ${CMAKE_CXX_COMPILER}" ) endforeach() endif() @@ -615,7 +615,7 @@ function(omnitrace_custom_compilation) endif() endfunction() -function(OMNITRACE_WATCH_FOR_CHANGE _var) +function(ROCPROFSYS_WATCH_FOR_CHANGE _var) list(LENGTH ARGN _NUM_EXTRA_ARGS) if(_NUM_EXTRA_ARGS EQUAL 1) set(_VAR ${ARGN}) @@ -633,42 +633,42 @@ function(OMNITRACE_WATCH_FOR_CHANGE _var) update_var(OFF) - set(_omnitrace_watch_var_name OMNITRACE_WATCH_VALUE_${_var}) - if(DEFINED ${_omnitrace_watch_var_name}) - if("${${_var}}" STREQUAL "${${_omnitrace_watch_var_name}}") + set(_rocprofsys_watch_var_name ROCPROFSYS_WATCH_VALUE_${_var}) + if(DEFINED ${_rocprofsys_watch_var_name}) + if("${${_var}}" STREQUAL "${${_rocprofsys_watch_var_name}}") return() else() - omnitrace_message( + rocprofsys_message( STATUS - "${_var} changed :: ${${_omnitrace_watch_var_name}} --> ${${_var}}") + "${_var} changed :: ${${_rocprofsys_watch_var_name}} --> ${${_var}}") update_var(ON) endif() else() if(NOT "${${_var}}" STREQUAL "") - omnitrace_message(STATUS "${_var} :: ${${_var}}") + rocprofsys_message(STATUS "${_var} :: ${${_var}}") update_var(ON) endif() endif() # store the value for the next run - set(${_omnitrace_watch_var_name} + set(${_rocprofsys_watch_var_name} "${${_var}}" CACHE INTERNAL "Last value of ${_var}" FORCE) endfunction() -function(OMNITRACE_DIRECTORY) +function(ROCPROFSYS_DIRECTORY) cmake_parse_arguments(F "MKDIR;FAIL;FORCE" "PREFIX;OUTPUT_VARIABLE;WORKING_DIRECTORY" "PATHS" ${ARGN}) if(F_PREFIX AND NOT IS_ABSOLUTE "${F_PREFIX}") if(F_WORKING_DIRECTORY) - omnitrace_message( + rocprofsys_message( STATUS "PREFIX was specified as a relative path, using working directory + prefix :: '${F_WORKING_DIRECTORY}/${F_PREFIX}'..." ) set(F_PREFIX ${F_WORKING_DIRECTORY}/${F_PREFIX}) else() - omnitrace_message( + rocprofsys_message( FATAL_ERROR "PREFIX was specified but it is not an absolute path: ${F_PREFIX}") endif() @@ -690,9 +690,9 @@ function(OMNITRACE_DIRECTORY) endif() if(NOT EXISTS "${_PATH}" AND F_FAIL) - omnitrace_message(FATAL_ERROR "Directory '${_PATH}' does not exist") + rocprofsys_message(FATAL_ERROR "Directory '${_PATH}' does not exist") elseif(NOT IS_DIRECTORY "${_PATH}" AND F_FAIL) - omnitrace_message(FATAL_ERROR "'${_PATH}' exists but is not a directory") + rocprofsys_message(FATAL_ERROR "'${_PATH}' exists but is not a directory") elseif(NOT EXISTS "${_PATH}" AND F_MKDIR) execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${_PATH} WORKING_DIRECTORY ${F_WORKING_DIRECTORY}) @@ -716,11 +716,11 @@ function(OMNITRACE_DIRECTORY) endif() endfunction() -function(OMNITRACE_CHECK_PYTHON_DIRS_AND_VERSIONS) +function(ROCPROFSYS_CHECK_PYTHON_DIRS_AND_VERSIONS) cmake_parse_arguments(F "FAIL;UNSET" "RESULT_VARIABLE;OUTPUT_VARIABLE" "" ${ARGN}) - list(LENGTH OMNITRACE_PYTHON_VERSIONS _NUM_PYTHON_VERSIONS) - list(LENGTH OMNITRACE_PYTHON_ROOT_DIRS _NUM_PYTHON_ROOT_DIRS) + list(LENGTH ROCPROFSYS_PYTHON_VERSIONS _NUM_PYTHON_VERSIONS) + list(LENGTH ROCPROFSYS_PYTHON_ROOT_DIRS _NUM_PYTHON_ROOT_DIRS) if(NOT _NUM_PYTHON_VERSIONS EQUAL _NUM_PYTHON_ROOT_DIRS) set(_RET 1) @@ -741,20 +741,20 @@ function(OMNITRACE_CHECK_PYTHON_DIRS_AND_VERSIONS) if(NOT ${_RET} EQUAL 0) if(F_FAIL) - omnitrace_message( + rocprofsys_message( WARNING - "Error! Number of python versions : ${_NUM_PYTHON_VERSIONS}. VERSIONS :: ${OMNITRACE_PYTHON_VERSIONS}" + "Error! Number of python versions : ${_NUM_PYTHON_VERSIONS}. VERSIONS :: ${ROCPROFSYS_PYTHON_VERSIONS}" ) - omnitrace_message( + rocprofsys_message( WARNING - "Error! Number of python root directories : ${_NUM_PYTHON_ROOT_DIRS}. ROOT DIRS :: ${OMNITRACE_PYTHON_ROOT_DIRS}" + "Error! Number of python root directories : ${_NUM_PYTHON_ROOT_DIRS}. ROOT DIRS :: ${ROCPROFSYS_PYTHON_ROOT_DIRS}" ) - omnitrace_message( + rocprofsys_message( FATAL_ERROR "Error! Number of python versions != number of python root directories") elseif(F_UNSET) - unset(OMNITRACE_PYTHON_VERSIONS CACHE) - unset(OMNITRACE_PYTHON_ROOT_DIRS CACHE) + unset(ROCPROFSYS_PYTHON_VERSIONS CACHE) + unset(ROCPROFSYS_PYTHON_ROOT_DIRS CACHE) if(F_OUTPUT_VARIABLE) set(${F_OUTPUT_VARIABLE} 0) endif() @@ -765,7 +765,7 @@ endfunction() # ---------------------------------------------------------------------------- # Console scripts # -function(OMNITRACE_PYTHON_CONSOLE_SCRIPT SCRIPT_NAME SCRIPT_SUBMODULE) +function(ROCPROFSYS_PYTHON_CONSOLE_SCRIPT SCRIPT_NAME SCRIPT_SUBMODULE) set(options) set(args VERSION ROOT_DIR) set(kwargs) @@ -786,7 +786,7 @@ function(OMNITRACE_PYTHON_CONSOLE_SCRIPT SCRIPT_NAME SCRIPT_SUBMODULE) OPTIONAL) endif() - if(OMNITRACE_BUILD_TESTING OR OMNITRACE_BUILD_PYTHON) + if(ROCPROFSYS_BUILD_TESTING OR ROCPROFSYS_BUILD_PYTHON) add_test( NAME ${SCRIPT_NAME}-console-script-test-${ARG_VERSION} COMMAND ${PROJECT_BINARY_DIR}/bin/${SCRIPT_NAME}-${ARG_VERSION} --help @@ -819,17 +819,17 @@ function(OMNITRACE_PYTHON_CONSOLE_SCRIPT SCRIPT_NAME SCRIPT_SUBMODULE) endif() endfunction() -function(OMNITRACE_FIND_STATIC_LIBRARY) +function(ROCPROFSYS_FIND_STATIC_LIBRARY) set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX}) find_library(${ARGN}) endfunction() -function(OMNITRACE_FIND_SHARED_LIBRARY) +function(ROCPROFSYS_FIND_SHARED_LIBRARY) set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_SHARED_LIBRARY_SUFFIX}) find_library(${ARGN}) endfunction() -function(OMNITRACE_BUILDTREE_TPL _TPL_TARGET _NEW_NAME _BUILD_TREE_DIR) +function(ROCPROFSYS_BUILDTREE_TPL _TPL_TARGET _NEW_NAME _BUILD_TREE_DIR) get_target_property(_TPL_VERSION ${_TPL_TARGET} VERSION) get_target_property(_TPL_SOVERSION ${_TPL_TARGET} SOVERSION) get_target_property(_TPL_NAME ${_TPL_TARGET} OUTPUT_NAME) @@ -862,7 +862,7 @@ function(OMNITRACE_BUILDTREE_TPL _TPL_TARGET _NEW_NAME _BUILD_TREE_DIR) COMMENT "Creating ${_NEW_NAME} from ${_TPL_TARGET}...") endfunction() -function(OMNITRACE_INSTALL_TPL _TPL_TARGET _NEW_NAME _BUILD_TREE_DIR _COMPONENT) +function(ROCPROFSYS_INSTALL_TPL _TPL_TARGET _NEW_NAME _BUILD_TREE_DIR _COMPONENT) get_target_property(_TPL_VERSION ${_TPL_TARGET} VERSION) get_target_property(_TPL_SOVERSION ${_TPL_TARGET} SOVERSION) get_target_property(_TPL_NAME ${_TPL_TARGET} OUTPUT_NAME) @@ -876,7 +876,7 @@ function(OMNITRACE_INSTALL_TPL _TPL_TARGET _NEW_NAME _BUILD_TREE_DIR _COMPONENT) endforeach() # build tree symbolic links - omnitrace_buildtree_tpl("${_TPL_TARGET}" "${_NEW_NAME}" "${_BUILD_TREE_DIR}" ${ARGN}) + rocprofsys_buildtree_tpl("${_TPL_TARGET}" "${_NEW_NAME}" "${_BUILD_TREE_DIR}" ${ARGN}) install( FILES $ diff --git a/cmake/Modules/FindRCCL-Headers.cmake b/cmake/Modules/FindRCCL-Headers.cmake index f7087683..e691b869 100644 --- a/cmake/Modules/FindRCCL-Headers.cmake +++ b/cmake/Modules/FindRCCL-Headers.cmake @@ -60,7 +60,7 @@ else() endif() if(NOT EXISTS "${RCCL-Headers_INCLUDE_DIR}/${_RCCL-Headers_FILE}") - omnitrace_message( + rocprofsys_message( AUTHOR_WARNING "RCCL header (${RCCL-Headers_INCLUDE_DIR}/${_RCCL-Headers_FILE}) does not exist! Setting RCCL-Headers_INCLUDE_DIR to internal RCCL include directory: ${RCCL-Headers_INCLUDE_DIR_INTERNAL}" ) diff --git a/cmake/Modules/FindROCmVersion.cmake b/cmake/Modules/FindROCmVersion.cmake index 18e6fcde..0d792b73 100644 --- a/cmake/Modules/FindROCmVersion.cmake +++ b/cmake/Modules/FindROCmVersion.cmake @@ -226,7 +226,7 @@ function(ROCM_VERSION_PARSE_VERSION_FILES) # convert env to cache if not defined foreach(_PATH ROCmVersion_DIR ROCmVersion_ROOT ROCmVersion_ROOT_DIR - OMNITRACE_DEFAULT_ROCM_PATH ROCM_PATH) + ROCPROFSYS_DEFAULT_ROCM_PATH ROCM_PATH) if(NOT DEFINED ${_PATH} AND DEFINED ENV{${_PATH}}) set(_VAL "$ENV{${_PATH}}") get_filename_component(_VAL "${_VAL}" REALPATH) @@ -243,7 +243,7 @@ function(ROCM_VERSION_PARSE_VERSION_FILES) foreach( _DIR ${ROCmVersion_DIR} ${ROCmVersion_ROOT} ${ROCmVersion_ROOT_DIR} - $ENV{CMAKE_PREFIX_PATH} ${CMAKE_PREFIX_PATH} ${OMNITRACE_DEFAULT_ROCM_PATH} + $ENV{CMAKE_PREFIX_PATH} ${CMAKE_PREFIX_PATH} ${ROCPROFSYS_DEFAULT_ROCM_PATH} ${ROCM_PATH} /opt/rocm) if(EXISTS ${_DIR}) get_filename_component(_ABS_DIR "${_DIR}" REALPATH) diff --git a/cmake/PAPI.cmake b/cmake/PAPI.cmake index b6add21d..f0303edb 100644 --- a/cmake/PAPI.cmake +++ b/cmake/PAPI.cmake @@ -7,7 +7,7 @@ include_guard(GLOBAL) -omnitrace_checkout_git_submodule( +rocprofsys_checkout_git_submodule( RELATIVE_PATH external/papi WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} REPO_URL https://bitbucket.org/icl/papi.git @@ -18,38 +18,38 @@ set(PAPI_LIBPFM_SOVERSION "4.11.1" CACHE STRING "libpfm.so version") -set(OMNITRACE_PAPI_SOURCE_DIR ${PROJECT_BINARY_DIR}/external/papi/source) -set(OMNITRACE_PAPI_INSTALL_DIR ${PROJECT_BINARY_DIR}/external/papi/install) +set(ROCPROFSYS_PAPI_SOURCE_DIR ${PROJECT_BINARY_DIR}/external/papi/source) +set(ROCPROFSYS_PAPI_INSTALL_DIR ${PROJECT_BINARY_DIR}/external/papi/install) -if(NOT EXISTS "${OMNITRACE_PAPI_SOURCE_DIR}") +if(NOT EXISTS "${ROCPROFSYS_PAPI_SOURCE_DIR}") execute_process( COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/external/papi - ${OMNITRACE_PAPI_SOURCE_DIR}) + ${ROCPROFSYS_PAPI_SOURCE_DIR}) endif() -if(NOT EXISTS "${OMNITRACE_PAPI_INSTALL_DIR}") +if(NOT EXISTS "${ROCPROFSYS_PAPI_INSTALL_DIR}") execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory - ${OMNITRACE_PAPI_INSTALL_DIR}) + ${ROCPROFSYS_PAPI_INSTALL_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory - ${OMNITRACE_PAPI_INSTALL_DIR}/include) + ${ROCPROFSYS_PAPI_INSTALL_DIR}/include) execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory - ${OMNITRACE_PAPI_INSTALL_DIR}/lib) + ${ROCPROFSYS_PAPI_INSTALL_DIR}/lib) execute_process( COMMAND - ${CMAKE_COMMAND} -E touch ${OMNITRACE_PAPI_INSTALL_DIR}/lib/libpapi.a - ${OMNITRACE_PAPI_INSTALL_DIR}/lib/libpfm.a - ${OMNITRACE_PAPI_INSTALL_DIR}/lib/libpfm.so) - set(_OMNITRACE_PAPI_BUILD_BYPRODUCTS - ${OMNITRACE_PAPI_INSTALL_DIR}/lib/libpapi.a - ${OMNITRACE_PAPI_INSTALL_DIR}/lib/libpfm.a - ${OMNITRACE_PAPI_INSTALL_DIR}/lib/libpfm.so) + ${CMAKE_COMMAND} -E touch ${ROCPROFSYS_PAPI_INSTALL_DIR}/lib/libpapi.a + ${ROCPROFSYS_PAPI_INSTALL_DIR}/lib/libpfm.a + ${ROCPROFSYS_PAPI_INSTALL_DIR}/lib/libpfm.so) + set(_ROCPROFSYS_PAPI_BUILD_BYPRODUCTS + ${ROCPROFSYS_PAPI_INSTALL_DIR}/lib/libpapi.a + ${ROCPROFSYS_PAPI_INSTALL_DIR}/lib/libpfm.a + ${ROCPROFSYS_PAPI_INSTALL_DIR}/lib/libpfm.so) endif() -omnitrace_add_option(OMNITRACE_PAPI_AUTO_COMPONENTS "Automatically enable components" OFF) +rocprofsys_add_option(ROCPROFSYS_PAPI_AUTO_COMPONENTS "Automatically enable components" OFF) # -------------- PACKAGES ----------------------------------------------------- -set(_OMNITRACE_VALID_PAPI_COMPONENTS +set(_ROCPROFSYS_VALID_PAPI_COMPONENTS appio bgpm coretemp @@ -86,13 +86,13 @@ set(_OMNITRACE_VALID_PAPI_COMPONENTS stealtime sysdetect vmware) -set(OMNITRACE_VALID_PAPI_COMPONENTS - "${_OMNITRACE_VALID_PAPI_COMPONENTS}" +set(ROCPROFSYS_VALID_PAPI_COMPONENTS + "${_ROCPROFSYS_VALID_PAPI_COMPONENTS}" CACHE STRING "Valid PAPI components") -mark_as_advanced(OMNITRACE_VALID_PAPI_COMPONENTS) +mark_as_advanced(ROCPROFSYS_VALID_PAPI_COMPONENTS) # default components which do not require 3rd-party headers or libraries -set(_OMNITRACE_PAPI_COMPONENTS +set(_ROCPROFSYS_PAPI_COMPONENTS appio coretemp io @@ -104,73 +104,73 @@ set(_OMNITRACE_PAPI_COMPONENTS # rapl stealtime ) -if(OMNITRACE_PAPI_AUTO_COMPONENTS) +if(ROCPROFSYS_PAPI_AUTO_COMPONENTS) # rocm - if(OMNITRACE_USE_HIP - OR OMNITRACE_USE_ROCTRACER - OR OMNITRACE_USE_ROCM_SMI) - list(APPEND _OMNITRACE_PAPI_COMPONENTS rocm) + if(ROCPROFSYS_USE_HIP + OR ROCPROFSYS_USE_ROCTRACER + OR ROCPROFSYS_USE_ROCM_SMI) + list(APPEND _ROCPROFSYS_PAPI_COMPONENTS rocm) endif() # lmsensors - find_path(OMNITRACE_PAPI_LMSENSORS_ROOT_DIR NAMES include/sensors/sensors.h + find_path(ROCPROFSYS_PAPI_LMSENSORS_ROOT_DIR NAMES include/sensors/sensors.h include/sensors.h) - if(OMNITRACE_PAPI_LMSENSORS_ROOT_DIR) - list(APPEND _OMNITRACE_PAPI_COMPONENTS lmsensors) + if(ROCPROFSYS_PAPI_LMSENSORS_ROOT_DIR) + list(APPEND _ROCPROFSYS_PAPI_COMPONENTS lmsensors) endif() # pcp - find_path(OMNITRACE_PAPI_PCP_ROOT_DIR NAMES include/pcp/impl.h) + find_path(ROCPROFSYS_PAPI_PCP_ROOT_DIR NAMES include/pcp/impl.h) find_library( - OMNITRACE_PAPI_PCP_LIBRARY + ROCPROFSYS_PAPI_PCP_LIBRARY NAMES pcp PATH_SUFFIXES lib lib64) - if(OMNITRACE_PAPI_PCP_ROOT_DIR AND OMNITRACE_PAPI_PCP_LIBRARY) - list(APPEND _OMNITRACE_PAPI_COMPONENTS pcp) + if(ROCPROFSYS_PAPI_PCP_ROOT_DIR AND ROCPROFSYS_PAPI_PCP_LIBRARY) + list(APPEND _ROCPROFSYS_PAPI_COMPONENTS pcp) endif() endif() -# set the OMNITRACE_PAPI_COMPONENTS cache variable -set(OMNITRACE_PAPI_COMPONENTS - "${_OMNITRACE_PAPI_COMPONENTS}" +# set the ROCPROFSYS_PAPI_COMPONENTS cache variable +set(ROCPROFSYS_PAPI_COMPONENTS + "${_ROCPROFSYS_PAPI_COMPONENTS}" CACHE STRING "PAPI components") -omnitrace_add_feature(OMNITRACE_PAPI_COMPONENTS "PAPI components") -string(REPLACE ";" "\ " _OMNITRACE_PAPI_COMPONENTS "${OMNITRACE_PAPI_COMPONENTS}") -set(OMNITRACE_PAPI_EXTRA_ENV) - -foreach(_COMP ${OMNITRACE_PAPI_COMPONENTS}) - string(REPLACE ";" ", " _OMNITRACE_VALID_PAPI_COMPONENTS_MSG - "${OMNITRACE_VALID_PAPI_COMPONENTS}") - if(NOT "${_COMP}" IN_LIST OMNITRACE_VALID_PAPI_COMPONENTS) - omnitrace_message( +rocprofsys_add_feature(ROCPROFSYS_PAPI_COMPONENTS "PAPI components") +string(REPLACE ";" "\ " _ROCPROFSYS_PAPI_COMPONENTS "${ROCPROFSYS_PAPI_COMPONENTS}") +set(ROCPROFSYS_PAPI_EXTRA_ENV) + +foreach(_COMP ${ROCPROFSYS_PAPI_COMPONENTS}) + string(REPLACE ";" ", " _ROCPROFSYS_VALID_PAPI_COMPONENTS_MSG + "${ROCPROFSYS_VALID_PAPI_COMPONENTS}") + if(NOT "${_COMP}" IN_LIST ROCPROFSYS_VALID_PAPI_COMPONENTS) + rocprofsys_message( AUTHOR_WARNING - "OMNITRACE_PAPI_COMPONENTS contains an unknown component '${_COMP}'. Known components: ${_OMNITRACE_VALID_PAPI_COMPONENTS_MSG}" + "ROCPROFSYS_PAPI_COMPONENTS contains an unknown component '${_COMP}'. Known components: ${_ROCPROFSYS_VALID_PAPI_COMPONENTS_MSG}" ) endif() - unset(_OMNITRACE_VALID_PAPI_COMPONENTS_MSG) + unset(_ROCPROFSYS_VALID_PAPI_COMPONENTS_MSG) endforeach() -if("rocm" IN_LIST OMNITRACE_PAPI_COMPONENTS) +if("rocm" IN_LIST ROCPROFSYS_PAPI_COMPONENTS) find_package(ROCmVersion REQUIRED) - list(APPEND OMNITRACE_PAPI_EXTRA_ENV PAPI_ROCM_ROOT=${ROCmVersion_DIR}) + list(APPEND ROCPROFSYS_PAPI_EXTRA_ENV PAPI_ROCM_ROOT=${ROCmVersion_DIR}) endif() -if("lmsensors" IN_LIST OMNITRACE_PAPI_COMPONENTS AND OMNITRACE_PAPI_LMSENSORS_ROOT_DIR) - list(APPEND OMNITRACE_PAPI_EXTRA_ENV - PAPI_LMSENSORS_ROOT=${OMNITRACE_PAPI_LMSENSORS_ROOT_DIR}) +if("lmsensors" IN_LIST ROCPROFSYS_PAPI_COMPONENTS AND ROCPROFSYS_PAPI_LMSENSORS_ROOT_DIR) + list(APPEND ROCPROFSYS_PAPI_EXTRA_ENV + PAPI_LMSENSORS_ROOT=${ROCPROFSYS_PAPI_LMSENSORS_ROOT_DIR}) endif() -if("pcp" IN_LIST OMNITRACE_PAPI_COMPONENTS AND OMNITRACE_PAPI_PCP_ROOT_DIR) - list(APPEND OMNITRACE_PAPI_EXTRA_ENV PAPI_PCP_ROOT=${OMNITRACE_PAPI_PCP_ROOT_DIR}) +if("pcp" IN_LIST ROCPROFSYS_PAPI_COMPONENTS AND ROCPROFSYS_PAPI_PCP_ROOT_DIR) + list(APPEND ROCPROFSYS_PAPI_EXTRA_ENV PAPI_PCP_ROOT=${ROCPROFSYS_PAPI_PCP_ROOT_DIR}) endif() -if("perf_event_uncore" IN_LIST OMNITRACE_PAPI_COMPONENTS AND NOT "perf_event" IN_LIST - OMNITRACE_PAPI_COMPONENTS) - omnitrace_message( +if("perf_event_uncore" IN_LIST ROCPROFSYS_PAPI_COMPONENTS AND NOT "perf_event" IN_LIST + ROCPROFSYS_PAPI_COMPONENTS) + rocprofsys_message( FATAL_ERROR - "OMNITRACE_PAPI_COMPONENTS :: 'perf_event_uncore' requires 'perf_event' component" + "ROCPROFSYS_PAPI_COMPONENTS :: 'perf_event_uncore' requires 'perf_event' component" ) endif() @@ -180,7 +180,7 @@ find_program( PATH_SUFFIXES bin) if(NOT MAKE_EXECUTABLE) - omnitrace_message( + rocprofsys_message( FATAL_ERROR "make/gmake executable not found. Please re-run with -DMAKE_EXECUTABLE=/path/to/make" ) @@ -188,9 +188,9 @@ endif() set(_PAPI_C_COMPILER ${CMAKE_C_COMPILER}) if(CMAKE_C_COMPILER_IS_CLANG) - find_program(OMNITRACE_GNU_C_COMPILER NAMES gcc) - if(OMNITRACE_GNU_C_COMPILER) - set(_PAPI_C_COMPILER ${OMNITRACE_GNU_C_COMPILER}) + find_program(ROCPROFSYS_GNU_C_COMPILER NAMES gcc) + if(ROCPROFSYS_GNU_C_COMPILER) + set(_PAPI_C_COMPILER ${ROCPROFSYS_GNU_C_COMPILER}) endif() endif() set(PAPI_C_COMPILER @@ -201,71 +201,71 @@ include(ExternalProject) externalproject_add( rocprofsys-papi-build PREFIX ${PROJECT_BINARY_DIR}/external/papi - SOURCE_DIR ${OMNITRACE_PAPI_SOURCE_DIR}/src + SOURCE_DIR ${ROCPROFSYS_PAPI_SOURCE_DIR}/src BUILD_IN_SOURCE 1 PATCH_COMMAND ${CMAKE_COMMAND} -E env CC=${PAPI_C_COMPILER} CFLAGS=-fPIC\ -O3\ -Wno-stringop-truncation LIBS=-lrt LDFLAGS=-lrt - ${OMNITRACE_PAPI_EXTRA_ENV} /configure --quiet - --prefix=${OMNITRACE_PAPI_INSTALL_DIR} --with-static-lib=yes --with-shared-lib=no - --with-perf-events --with-tests=no --with-components=${_OMNITRACE_PAPI_COMPONENTS} + ${ROCPROFSYS_PAPI_EXTRA_ENV} /configure --quiet + --prefix=${ROCPROFSYS_PAPI_INSTALL_DIR} --with-static-lib=yes --with-shared-lib=no + --with-perf-events --with-tests=no --with-components=${_ROCPROFSYS_PAPI_COMPONENTS} CONFIGURE_COMMAND ${CMAKE_COMMAND} -E env CFLAGS=-fPIC\ -O3\ -Wno-stringop-truncation - ${OMNITRACE_PAPI_EXTRA_ENV} ${MAKE_EXECUTABLE} static install -s + ${ROCPROFSYS_PAPI_EXTRA_ENV} ${MAKE_EXECUTABLE} static install -s BUILD_COMMAND ${CMAKE_COMMAND} -E env CFLAGS=-fPIC\ -O3\ -Wno-stringop-truncation - ${OMNITRACE_PAPI_EXTRA_ENV} ${MAKE_EXECUTABLE} utils install-utils -s + ${ROCPROFSYS_PAPI_EXTRA_ENV} ${MAKE_EXECUTABLE} utils install-utils -s INSTALL_COMMAND "" - BUILD_BYPRODUCTS "${_OMNITRACE_PAPI_BUILD_BYPRODUCTS}") + BUILD_BYPRODUCTS "${_ROCPROFSYS_PAPI_BUILD_BYPRODUCTS}") # target for re-executing the installation add_custom_target( rocprofsys-papi-install COMMAND ${CMAKE_COMMAND} -E env CFLAGS=-fPIC\ -O3\ -Wno-stringop-truncation - ${OMNITRACE_PAPI_EXTRA_ENV} ${MAKE_EXECUTABLE} static install -s + ${ROCPROFSYS_PAPI_EXTRA_ENV} ${MAKE_EXECUTABLE} static install -s COMMAND ${CMAKE_COMMAND} -E env CFLAGS=-fPIC\ -O3\ -Wno-stringop-truncation - ${OMNITRACE_PAPI_EXTRA_ENV} ${MAKE_EXECUTABLE} utils install-utils -s - WORKING_DIRECTORY ${OMNITRACE_PAPI_SOURCE_DIR}/src + ${ROCPROFSYS_PAPI_EXTRA_ENV} ${MAKE_EXECUTABLE} utils install-utils -s + WORKING_DIRECTORY ${ROCPROFSYS_PAPI_SOURCE_DIR}/src COMMENT "Installing PAPI...") add_custom_target( rocprofsys-papi-clean COMMAND ${MAKE_EXECUTABLE} distclean - COMMAND ${CMAKE_COMMAND} -E rm -rf ${OMNITRACE_PAPI_INSTALL_DIR}/include/* - COMMAND ${CMAKE_COMMAND} -E rm -rf ${OMNITRACE_PAPI_INSTALL_DIR}/lib/* + COMMAND ${CMAKE_COMMAND} -E rm -rf ${ROCPROFSYS_PAPI_INSTALL_DIR}/include/* + COMMAND ${CMAKE_COMMAND} -E rm -rf ${ROCPROFSYS_PAPI_INSTALL_DIR}/lib/* COMMAND - ${CMAKE_COMMAND} -E touch ${OMNITRACE_PAPI_INSTALL_DIR}/lib/libpapi.a - ${OMNITRACE_PAPI_INSTALL_DIR}/lib/libpfm.a - ${OMNITRACE_PAPI_INSTALL_DIR}/lib/libpfm.so - WORKING_DIRECTORY ${OMNITRACE_PAPI_SOURCE_DIR}/src + ${CMAKE_COMMAND} -E touch ${ROCPROFSYS_PAPI_INSTALL_DIR}/lib/libpapi.a + ${ROCPROFSYS_PAPI_INSTALL_DIR}/lib/libpfm.a + ${ROCPROFSYS_PAPI_INSTALL_DIR}/lib/libpfm.so + WORKING_DIRECTORY ${ROCPROFSYS_PAPI_SOURCE_DIR}/src COMMENT "Cleaning PAPI...") set(PAPI_ROOT_DIR - ${OMNITRACE_PAPI_INSTALL_DIR} + ${ROCPROFSYS_PAPI_INSTALL_DIR} CACHE PATH "Root PAPI installation" FORCE) set(PAPI_INCLUDE_DIR - ${OMNITRACE_PAPI_INSTALL_DIR}/include + ${ROCPROFSYS_PAPI_INSTALL_DIR}/include CACHE PATH "PAPI include folder" FORCE) set(PAPI_LIBRARY - ${OMNITRACE_PAPI_INSTALL_DIR}/lib/libpapi.a + ${ROCPROFSYS_PAPI_INSTALL_DIR}/lib/libpapi.a CACHE FILEPATH "PAPI library" FORCE) set(PAPI_pfm_LIBRARY - ${OMNITRACE_PAPI_INSTALL_DIR}/lib/libpfm.so + ${ROCPROFSYS_PAPI_INSTALL_DIR}/lib/libpfm.so CACHE FILEPATH "PAPI library" FORCE) set(PAPI_STATIC_LIBRARY - ${OMNITRACE_PAPI_INSTALL_DIR}/lib/libpapi.a + ${ROCPROFSYS_PAPI_INSTALL_DIR}/lib/libpapi.a CACHE FILEPATH "PAPI library" FORCE) set(PAPI_pfm_STATIC_LIBRARY - ${OMNITRACE_PAPI_INSTALL_DIR}/lib/libpfm.a + ${ROCPROFSYS_PAPI_INSTALL_DIR}/lib/libpfm.a CACHE FILEPATH "PAPI library" FORCE) target_include_directories(rocprofsys-papi SYSTEM INTERFACE $) target_link_libraries(rocprofsys-papi INTERFACE $ $) -omnitrace_target_compile_definitions( - rocprofsys-papi INTERFACE OMNITRACE_USE_PAPI $) +rocprofsys_target_compile_definitions( + rocprofsys-papi INTERFACE ROCPROFSYS_USE_PAPI $) install( - DIRECTORY ${OMNITRACE_PAPI_INSTALL_DIR}/lib/ + DIRECTORY ${ROCPROFSYS_PAPI_INSTALL_DIR}/lib/ DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PACKAGE_NAME} COMPONENT papi FILES_MATCHING @@ -300,14 +300,14 @@ foreach( _HL_OUTPUT_WRITER) string(REPLACE "#!/usr/bin/python\n" "#!/usr/bin/python3\n" _HL_OUTPUT_WRITER "${_HL_OUTPUT_WRITER}") - file(MAKE_DIRECTORY "${OMNITRACE_PAPI_INSTALL_DIR}/bin") - file(WRITE "${OMNITRACE_PAPI_INSTALL_DIR}/bin/${_UTIL_EXE}3" + file(MAKE_DIRECTORY "${ROCPROFSYS_PAPI_INSTALL_DIR}/bin") + file(WRITE "${ROCPROFSYS_PAPI_INSTALL_DIR}/bin/${_UTIL_EXE}3" "${_HL_OUTPUT_WRITER}") set(_UTIL_EXE "${_UTIL_EXE}3") endif() install( - PROGRAMS ${OMNITRACE_PAPI_INSTALL_DIR}/bin/${_UTIL_EXE} + PROGRAMS ${ROCPROFSYS_PAPI_INSTALL_DIR}/bin/${_UTIL_EXE} DESTINATION ${CMAKE_INSTALL_BINDIR} RENAME ${_UTIL_EXE_INSTALL_NAME} COMPONENT papi diff --git a/cmake/Packages.cmake b/cmake/Packages.cmake index aa29ec60..743a67db 100644 --- a/cmake/Packages.cmake +++ b/cmake/Packages.cmake @@ -7,36 +7,36 @@ include_guard(DIRECTORY) # # ######################################################################################## -omnitrace_add_interface_library( +rocprofsys_add_interface_library( rocprofsys-headers "Provides minimal set of include flags to compile with rocprofsys") -omnitrace_add_interface_library(rocprofsys-threading "Enables multithreading support") -omnitrace_add_interface_library( +rocprofsys_add_interface_library(rocprofsys-threading "Enables multithreading support") +rocprofsys_add_interface_library( rocprofsys-dyninst "Provides flags and libraries for Dyninst (dynamic instrumentation)") -omnitrace_add_interface_library(rocprofsys-hip "Provides flags and libraries for HIP") -omnitrace_add_interface_library(rocprofsys-roctracer +rocprofsys_add_interface_library(rocprofsys-hip "Provides flags and libraries for HIP") +rocprofsys_add_interface_library(rocprofsys-roctracer "Provides flags and libraries for roctracer") -omnitrace_add_interface_library(rocprofsys-rocprofiler +rocprofsys_add_interface_library(rocprofsys-rocprofiler "Provides flags and libraries for rocprofiler") -omnitrace_add_interface_library(rocprofsys-rocm-smi +rocprofsys_add_interface_library(rocprofsys-rocm-smi "Provides flags and libraries for rocm-smi") -omnitrace_add_interface_library( +rocprofsys_add_interface_library( rocprofsys-rccl "Provides flags for ROCm Communication Collectives Library (RCCL)") -omnitrace_add_interface_library(rocprofsys-mpi "Provides MPI or MPI headers") -omnitrace_add_interface_library(rocprofsys-bfd "Provides Binary File Descriptor (BFD)") -omnitrace_add_interface_library(rocprofsys-ptl "Enables PTL support (tasking)") -omnitrace_add_interface_library(rocprofsys-papi "Enable PAPI support") -omnitrace_add_interface_library(rocprofsys-ompt "Enable OMPT support") -omnitrace_add_interface_library(rocprofsys-python "Enables Python support") -omnitrace_add_interface_library(rocprofsys-elfutils "Provides ElfUtils") -omnitrace_add_interface_library(rocprofsys-perfetto "Enables Perfetto support") -omnitrace_add_interface_library(rocprofsys-timemory "Provides timemory libraries") -omnitrace_add_interface_library(rocprofsys-timemory-config +rocprofsys_add_interface_library(rocprofsys-mpi "Provides MPI or MPI headers") +rocprofsys_add_interface_library(rocprofsys-bfd "Provides Binary File Descriptor (BFD)") +rocprofsys_add_interface_library(rocprofsys-ptl "Enables PTL support (tasking)") +rocprofsys_add_interface_library(rocprofsys-papi "Enable PAPI support") +rocprofsys_add_interface_library(rocprofsys-ompt "Enable OMPT support") +rocprofsys_add_interface_library(rocprofsys-python "Enables Python support") +rocprofsys_add_interface_library(rocprofsys-elfutils "Provides ElfUtils") +rocprofsys_add_interface_library(rocprofsys-perfetto "Enables Perfetto support") +rocprofsys_add_interface_library(rocprofsys-timemory "Provides timemory libraries") +rocprofsys_add_interface_library(rocprofsys-timemory-config "CMake interface library applied to all timemory targets") -omnitrace_add_interface_library(rocprofsys-compile-definitions "Compile definitions") +rocprofsys_add_interface_library(rocprofsys-compile-definitions "Compile definitions") # libraries with relevant compile definitions -set(OMNITRACE_EXTENSION_LIBRARIES +set(ROCPROFSYS_EXTENSION_LIBRARIES rocprofsys::rocprofsys-hip rocprofsys::rocprofsys-roctracer rocprofsys::rocprofsys-rocprofiler @@ -64,16 +64,16 @@ target_link_libraries(rocprofsys-headers INTERFACE rocprofsys::rocprofsys-thread # ensure the env overrides the appending /opt/rocm later string(REPLACE ":" ";" CMAKE_PREFIX_PATH "$ENV{CMAKE_PREFIX_PATH};${CMAKE_PREFIX_PATH}") -set(OMNITRACE_DEFAULT_ROCM_PATH +set(ROCPROFSYS_DEFAULT_ROCM_PATH /opt/rocm CACHE PATH "Default search path for ROCM") -if(EXISTS ${OMNITRACE_DEFAULT_ROCM_PATH}) - get_filename_component(_OMNITRACE_DEFAULT_ROCM_PATH "${OMNITRACE_DEFAULT_ROCM_PATH}" +if(EXISTS ${ROCPROFSYS_DEFAULT_ROCM_PATH}) + get_filename_component(_ROCPROFSYS_DEFAULT_ROCM_PATH "${ROCPROFSYS_DEFAULT_ROCM_PATH}" REALPATH) - if(NOT "${_OMNITRACE_DEFAULT_ROCM_PATH}" STREQUAL "${OMNITRACE_DEFAULT_ROCM_PATH}") - set(OMNITRACE_DEFAULT_ROCM_PATH - "${_OMNITRACE_DEFAULT_ROCM_PATH}" + if(NOT "${_ROCPROFSYS_DEFAULT_ROCM_PATH}" STREQUAL "${ROCPROFSYS_DEFAULT_ROCM_PATH}") + set(ROCPROFSYS_DEFAULT_ROCM_PATH + "${_ROCPROFSYS_DEFAULT_ROCM_PATH}" CACHE PATH "Default search path for ROCM" FORCE) endif() endif() @@ -116,15 +116,15 @@ endforeach() # # ----------------------------------------------------------------------------------------# -if(OMNITRACE_USE_HIP - OR OMNITRACE_USE_ROCTRACER - OR OMNITRACE_USE_ROCPROFILER - OR OMNITRACE_USE_ROCM_SMI) +if(ROCPROFSYS_USE_HIP + OR ROCPROFSYS_USE_ROCTRACER + OR ROCPROFSYS_USE_ROCPROFILER + OR ROCPROFSYS_USE_ROCM_SMI) find_package(ROCmVersion) if(NOT ROCmVersion_FOUND) find_package(hip ${rocprofsys_FIND_QUIETLY} REQUIRED HINTS - ${OMNITRACE_DEFAULT_ROCM_PATH} PATHS ${OMNITRACE_DEFAULT_ROCM_PATH}) + ${ROCPROFSYS_DEFAULT_ROCM_PATH} PATHS ${ROCPROFSYS_DEFAULT_ROCM_PATH}) if(SPACK_BUILD) find_package(ROCmVersion HINTS ${ROCM_PATH} PATHS ${ROCM_PATH}) else() @@ -147,13 +147,13 @@ if(OMNITRACE_USE_HIP list(APPEND CMAKE_PREFIX_PATH ${ROCmVersion_DIR}) endif() - set(OMNITRACE_ROCM_VERSION ${ROCmVersion_FULL_VERSION}) - set(OMNITRACE_HIP_VERSION_MAJOR ${ROCmVersion_MAJOR_VERSION}) - set(OMNITRACE_HIP_VERSION_MINOR ${ROCmVersion_MINOR_VERSION}) - set(OMNITRACE_HIP_VERSION_PATCH ${ROCmVersion_PATCH_VERSION}) - set(OMNITRACE_HIP_VERSION ${ROCmVersion_TRIPLE_VERSION}) + set(ROCPROFSYS_ROCM_VERSION ${ROCmVersion_FULL_VERSION}) + set(ROCPROFSYS_HIP_VERSION_MAJOR ${ROCmVersion_MAJOR_VERSION}) + set(ROCPROFSYS_HIP_VERSION_MINOR ${ROCmVersion_MINOR_VERSION}) + set(ROCPROFSYS_HIP_VERSION_PATCH ${ROCmVersion_PATCH_VERSION}) + set(ROCPROFSYS_HIP_VERSION ${ROCmVersion_TRIPLE_VERSION}) - if(OMNITRACE_HIP_VERSION_MAJOR GREATER_EQUAL 4 AND OMNITRACE_HIP_VERSION_MINOR + if(ROCPROFSYS_HIP_VERSION_MAJOR GREATER_EQUAL 4 AND ROCPROFSYS_HIP_VERSION_MINOR GREATER 3) set(roctracer_kfdwrapper_LIBRARY) endif() @@ -162,12 +162,12 @@ if(OMNITRACE_USE_HIP set(roctracer_kfdwrapper_LIBRARY) endif() - omnitrace_add_feature(OMNITRACE_ROCM_VERSION "ROCm version used by rocprofsys") + rocprofsys_add_feature(ROCPROFSYS_ROCM_VERSION "ROCm version used by rocprofsys") else() - set(OMNITRACE_HIP_VERSION "0.0.0") - set(OMNITRACE_HIP_VERSION_MAJOR 0) - set(OMNITRACE_HIP_VERSION_MINOR 0) - set(OMNITRACE_HIP_VERSION_PATCH 0) + set(ROCPROFSYS_HIP_VERSION "0.0.0") + set(ROCPROFSYS_HIP_VERSION_MAJOR 0) + set(ROCPROFSYS_HIP_VERSION_MINOR 0) + set(ROCPROFSYS_HIP_VERSION_PATCH 0) endif() # ----------------------------------------------------------------------------------------# @@ -176,9 +176,9 @@ endif() # # ----------------------------------------------------------------------------------------# -if(OMNITRACE_USE_HIP) +if(ROCPROFSYS_USE_HIP) find_package(hip ${rocprofsys_FIND_QUIETLY} REQUIRED) - omnitrace_target_compile_definitions(rocprofsys-hip INTERFACE OMNITRACE_USE_HIP) + rocprofsys_target_compile_definitions(rocprofsys-hip INTERFACE ROCPROFSYS_USE_HIP) target_link_libraries(rocprofsys-hip INTERFACE hip::host) endif() @@ -188,10 +188,10 @@ endif() # # ----------------------------------------------------------------------------------------# -if(OMNITRACE_USE_ROCTRACER) +if(ROCPROFSYS_USE_ROCTRACER) find_package(roctracer ${rocprofsys_FIND_QUIETLY} REQUIRED) - omnitrace_target_compile_definitions(rocprofsys-roctracer - INTERFACE OMNITRACE_USE_ROCTRACER) + rocprofsys_target_compile_definitions(rocprofsys-roctracer + INTERFACE ROCPROFSYS_USE_ROCTRACER) target_link_libraries(rocprofsys-roctracer INTERFACE roctracer::roctracer rocprofsys::rocprofsys-hip) endif() @@ -201,10 +201,10 @@ endif() # rocprofiler # # ----------------------------------------------------------------------------------------# -if(OMNITRACE_USE_ROCPROFILER) +if(ROCPROFSYS_USE_ROCPROFILER) find_package(rocprofiler ${rocprofsys_FIND_QUIETLY} REQUIRED) - omnitrace_target_compile_definitions(rocprofsys-rocprofiler - INTERFACE OMNITRACE_USE_ROCPROFILER) + rocprofsys_target_compile_definitions(rocprofsys-rocprofiler + INTERFACE ROCPROFSYS_USE_ROCPROFILER) target_link_libraries(rocprofsys-rocprofiler INTERFACE rocprofiler::rocprofiler) endif() @@ -214,10 +214,10 @@ endif() # # ----------------------------------------------------------------------------------------# -if(OMNITRACE_USE_ROCM_SMI) +if(ROCPROFSYS_USE_ROCM_SMI) find_package(rocm-smi ${rocprofsys_FIND_QUIETLY} REQUIRED) - omnitrace_target_compile_definitions(rocprofsys-rocm-smi - INTERFACE OMNITRACE_USE_ROCM_SMI) + rocprofsys_target_compile_definitions(rocprofsys-rocm-smi + INTERFACE ROCPROFSYS_USE_ROCM_SMI) target_link_libraries(rocprofsys-rocm-smi INTERFACE rocm-smi::rocm-smi) endif() @@ -227,10 +227,10 @@ endif() # # ----------------------------------------------------------------------------------------# -if(OMNITRACE_USE_RCCL) +if(ROCPROFSYS_USE_RCCL) find_package(RCCL-Headers ${rocprofsys_FIND_QUIETLY} REQUIRED) target_link_libraries(rocprofsys-rccl INTERFACE roc::rccl-headers) - omnitrace_target_compile_definitions(rocprofsys-rccl INTERFACE OMNITRACE_USE_RCCL) + rocprofsys_target_compile_definitions(rocprofsys-rccl INTERFACE ROCPROFSYS_USE_RCCL) endif() # ----------------------------------------------------------------------------------------# @@ -240,17 +240,17 @@ endif() # ----------------------------------------------------------------------------------------# # suppress warning during CI that MPI_HEADERS_ALLOW_MPICH was unused -set(_OMNITRACE_MPI_HEADERS_ALLOW_MPICH ${MPI_HEADERS_ALLOW_MPICH}) +set(_ROCPROFSYS_MPI_HEADERS_ALLOW_MPICH ${MPI_HEADERS_ALLOW_MPICH}) -if(OMNITRACE_USE_MPI) +if(ROCPROFSYS_USE_MPI) find_package(MPI ${rocprofsys_FIND_QUIETLY} REQUIRED) target_link_libraries(rocprofsys-mpi INTERFACE MPI::MPI_C MPI::MPI_CXX) - omnitrace_target_compile_definitions(rocprofsys-mpi INTERFACE TIMEMORY_USE_MPI=1 - OMNITRACE_USE_MPI) -elseif(OMNITRACE_USE_MPI_HEADERS) + rocprofsys_target_compile_definitions(rocprofsys-mpi INTERFACE TIMEMORY_USE_MPI=1 + ROCPROFSYS_USE_MPI) +elseif(ROCPROFSYS_USE_MPI_HEADERS) find_package(MPI-Headers ${rocprofsys_FIND_QUIETLY} REQUIRED) - omnitrace_target_compile_definitions( - rocprofsys-mpi INTERFACE TIMEMORY_USE_MPI_HEADERS=1 OMNITRACE_USE_MPI_HEADERS) + rocprofsys_target_compile_definitions( + rocprofsys-mpi INTERFACE TIMEMORY_USE_MPI_HEADERS=1 ROCPROFSYS_USE_MPI_HEADERS) target_link_libraries(rocprofsys-mpi INTERFACE MPI::MPI_HEADERS) endif() @@ -260,8 +260,8 @@ endif() # # ----------------------------------------------------------------------------------------# -omnitrace_target_compile_definitions( - rocprofsys-ompt INTERFACE OMNITRACE_USE_OMPT=$) +rocprofsys_target_compile_definitions( + rocprofsys-ompt INTERFACE ROCPROFSYS_USE_OMPT=$) # ----------------------------------------------------------------------------------------# # @@ -282,8 +282,8 @@ target_link_libraries(rocprofsys-elfutils INTERFACE ${ElfUtils_LIBRARIES}) # # ----------------------------------------------------------------------------------------# -if(OMNITRACE_BUILD_DYNINST) - omnitrace_checkout_git_submodule( +if(ROCPROFSYS_BUILD_DYNINST) + rocprofsys_checkout_git_submodule( RELATIVE_PATH external/dyninst WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} REPO_URL https://github.com/jrmadsen/dyninst.git @@ -316,7 +316,7 @@ if(OMNITRACE_BUILD_DYNINST) set(CMAKE_BUILD_RPATH "") endif() - omnitrace_save_variables( + rocprofsys_save_variables( PIC VARIABLES CMAKE_POSITION_INDEPENDENT_CODE CMAKE_INSTALL_RPATH CMAKE_BUILD_RPATH CMAKE_INSTALL_RPATH_USE_LINK_PATH) set(CMAKE_POSITION_INDEPENDENT_CODE ON) @@ -331,7 +331,7 @@ if(OMNITRACE_BUILD_DYNINST) "${PACKAGE_NAME}" CACHE PATH "Third-party library install-tree install library prefix" FORCE) add_subdirectory(external/dyninst EXCLUDE_FROM_ALL) - omnitrace_restore_variables( + rocprofsys_restore_variables( PIC VARIABLES CMAKE_POSITION_INDEPENDENT_CODE CMAKE_INSTALL_RPATH CMAKE_BUILD_RPATH CMAKE_INSTALL_RPATH_USE_LINK_PATH) @@ -441,8 +441,8 @@ else() target_include_directories( rocprofsys-dyninst SYSTEM INTERFACE ${TBB_INCLUDE_DIR} ${Boost_INCLUDE_DIRS} ${DYNINST_HEADER_DIR}) - omnitrace_target_compile_definitions(rocprofsys-dyninst - INTERFACE OMNITRACE_USE_DYNINST) + rocprofsys_target_compile_definitions(rocprofsys-dyninst + INTERFACE ROCPROFSYS_USE_DYNINST) endif() endif() @@ -452,25 +452,25 @@ endif() # # ----------------------------------------------------------------------------------------# -if(OMNITRACE_BUILD_STATIC_LIBGCC) +if(ROCPROFSYS_BUILD_STATIC_LIBGCC) if(CMAKE_C_COMPILER_ID MATCHES "GNU") - omnitrace_save_variables(STATIC_LIBGCC_C VARIABLES CMAKE_C_FLAGS) + rocprofsys_save_variables(STATIC_LIBGCC_C VARIABLES CMAKE_C_FLAGS) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static-libgcc") endif() if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") - omnitrace_save_variables(STATIC_LIBGCC_CXX VARIABLES CMAKE_CXX_FLAGS) + rocprofsys_save_variables(STATIC_LIBGCC_CXX VARIABLES CMAKE_CXX_FLAGS) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc") else() - set(OMNITRACE_BUILD_STATIC_LIBGCC OFF) + set(ROCPROFSYS_BUILD_STATIC_LIBGCC OFF) endif() endif() -if(OMNITRACE_BUILD_STATIC_LIBSTDCXX) +if(ROCPROFSYS_BUILD_STATIC_LIBSTDCXX) if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") - omnitrace_save_variables(STATIC_LIBSTDCXX_CXX VARIABLES CMAKE_CXX_FLAGS) + rocprofsys_save_variables(STATIC_LIBSTDCXX_CXX VARIABLES CMAKE_CXX_FLAGS) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libstdc++") else() - set(OMNITRACE_BUILD_STATIC_LIBSTDCXX OFF) + set(ROCPROFSYS_BUILD_STATIC_LIBSTDCXX OFF) endif() endif() @@ -481,7 +481,7 @@ endif() # ----------------------------------------------------------------------------------------# set(perfetto_DIR ${PROJECT_SOURCE_DIR}/external/perfetto) -omnitrace_checkout_git_submodule( +rocprofsys_checkout_git_submodule( RELATIVE_PATH external/perfetto WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} REPO_URL https://github.com/google/perfetto.git @@ -496,8 +496,8 @@ include(Perfetto) # # ----------------------------------------------------------------------------------------# -if(OMNITRACE_BUILD_DEVICETRACE) - omnitrace_checkout_git_submodule( +if(ROCPROFSYS_BUILD_DEVICETRACE) + rocprofsys_checkout_git_submodule( RELATIVE_PATH external/elfio WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} REPO_URL https://github.com/jrmadsen/ELFIO.git @@ -512,7 +512,7 @@ endif() # # ----------------------------------------------------------------------------------------# -if(OMNITRACE_USE_PAPI AND OMNITRACE_BUILD_PAPI) +if(ROCPROFSYS_USE_PAPI AND ROCPROFSYS_BUILD_PAPI) include(PAPI) endif() @@ -528,12 +528,12 @@ target_compile_definitions( TIMEMORY_USE_CONTAINERS=0 TIMEMORY_USE_ERT_EXTERN=0 TIMEMORY_USE_CONTAINERS_EXTERN=0) -if(OMNITRACE_BUILD_STACK_PROTECTOR) +if(ROCPROFSYS_BUILD_STACK_PROTECTOR) add_target_flag_if_avail(rocprofsys-timemory-config "-fstack-protector-strong" "-Wstack-protector") endif() -if(OMNITRACE_BUILD_DEBUG) +if(ROCPROFSYS_BUILD_DEBUG) add_target_flag_if_avail(rocprofsys-timemory-config "-fno-omit-frame-pointer" "-g3") endif() @@ -573,7 +573,7 @@ set(TIMEMORY_QUIET_CONFIG # timemory feature settings set(TIMEMORY_USE_MPI - ${OMNITRACE_USE_MPI} + ${ROCPROFSYS_USE_MPI} CACHE BOOL "Enable MPI support in timemory" FORCE) set(TIMEMORY_USE_GOTCHA ON @@ -582,13 +582,13 @@ set(TIMEMORY_USE_PERFETTO OFF CACHE BOOL "Disable perfetto support in timemory") set(TIMEMORY_USE_OMPT - ${OMNITRACE_USE_OMPT} + ${ROCPROFSYS_USE_OMPT} CACHE BOOL "Enable OMPT support in timemory" FORCE) set(TIMEMORY_USE_PAPI - ${OMNITRACE_USE_PAPI} + ${ROCPROFSYS_USE_PAPI} CACHE BOOL "Enable PAPI support in timemory" FORCE) set(TIMEMORY_USE_BFD - ${OMNITRACE_USE_BFD} + ${ROCPROFSYS_USE_BFD} CACHE BOOL "Enable BFD support in timemory" FORCE) set(TIMEMORY_USE_LIBUNWIND ON @@ -597,14 +597,14 @@ set(TIMEMORY_USE_VISIBILITY OFF CACHE BOOL "Enable/disable using visibility decorations") set(TIMEMORY_USE_SANITIZER - ${OMNITRACE_USE_SANITIZER} - CACHE BOOL "Build with -fsanitze=\${OMNITRACE_SANITIZER_TYPE}" FORCE) + ${ROCPROFSYS_USE_SANITIZER} + CACHE BOOL "Build with -fsanitze=\${ROCPROFSYS_SANITIZER_TYPE}" FORCE) set(TIMEMORY_SANITIZER_TYPE - ${OMNITRACE_SANITIZER_TYPE} + ${ROCPROFSYS_SANITIZER_TYPE} CACHE STRING "Sanitizer type, e.g. leak, thread, address, memory, etc." FORCE) if(DEFINED TIMEMORY_BUILD_GOTCHA AND NOT TIMEMORY_BUILD_GOTCHA) - omnitrace_message( + rocprofsys_message( FATAL_ERROR "Using an external gotcha is not allowed due to known bug that has not been accepted upstream" ) @@ -615,10 +615,10 @@ set(TIMEMORY_BUILD_GOTCHA ON CACHE BOOL "Enable building GOTCHA library from submodule" FORCE) set(TIMEMORY_BUILD_LIBUNWIND - ${OMNITRACE_BUILD_LIBUNWIND} + ${ROCPROFSYS_BUILD_LIBUNWIND} CACHE BOOL "Enable building libunwind library from submodule" FORCE) set(TIMEMORY_BUILD_EXTRA_OPTIMIZATIONS - ${OMNITRACE_BUILD_EXTRA_OPTIMIZATIONS} + ${ROCPROFSYS_BUILD_EXTRA_OPTIMIZATIONS} CACHE BOOL "Enable building GOTCHA library from submodule" FORCE) set(TIMEMORY_BUILD_ERT OFF @@ -632,7 +632,7 @@ set(TIMEMORY_TLS_MODEL "global-dynamic" CACHE STRING "Thread-local static model" FORCE) set(TIMEMORY_MAX_THREADS - "${OMNITRACE_MAX_THREADS}" + "${ROCPROFSYS_MAX_THREADS}" CACHE STRING "Max statically-allocated threads" FORCE) set(TIMEMORY_SETTINGS_PREFIX "ROCPROFSYS_" @@ -647,13 +647,13 @@ set(TIMEMORY_CXX_LIBRARY_EXCLUDE mark_as_advanced(TIMEMORY_SETTINGS_PREFIX) mark_as_advanced(TIMEMORY_PROJECT_NAME) -omnitrace_checkout_git_submodule( +rocprofsys_checkout_git_submodule( RELATIVE_PATH external/timemory WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} REPO_URL https://github.com/NERSC/timemory.git REPO_BRANCH omnitrace) -omnitrace_save_variables( +rocprofsys_save_variables( BUILD_CONFIG VARIABLES BUILD_SHARED_LIBS BUILD_STATIC_LIBS CMAKE_POSITION_INDEPENDENT_CODE CMAKE_PREFIX_PATH) @@ -677,7 +677,7 @@ install( TARGETS gotcha DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PACKAGE_NAME} COMPONENT gotcha) -if(OMNITRACE_BUILD_LIBUNWIND) +if(ROCPROFSYS_BUILD_LIBUNWIND) install( DIRECTORY ${PROJECT_BINARY_DIR}/external/timemory/external/libunwind/install/lib/ DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PACKAGE_NAME} @@ -686,7 +686,7 @@ if(OMNITRACE_BUILD_LIBUNWIND) PATTERN "*${CMAKE_SHARED_LIBRARY_SUFFIX}*") endif() -omnitrace_restore_variables( +rocprofsys_restore_variables( BUILD_CONFIG VARIABLES BUILD_SHARED_LIBS BUILD_STATIC_LIBS CMAKE_POSITION_INDEPENDENT_CODE CMAKE_PREFIX_PATH) @@ -712,8 +712,8 @@ target_link_libraries( target_link_libraries(rocprofsys-bfd INTERFACE $) -if(OMNITRACE_USE_BFD) - omnitrace_target_compile_definitions(rocprofsys-bfd INTERFACE OMNITRACE_USE_BFD) +if(ROCPROFSYS_USE_BFD) + rocprofsys_target_compile_definitions(rocprofsys-bfd INTERFACE ROCPROFSYS_USE_BFD) endif() # ----------------------------------------------------------------------------------------# @@ -724,7 +724,7 @@ endif() # timemory might provide PTL::ptl-shared if(NOT TARGET PTL::ptl-shared) - omnitrace_checkout_git_submodule( + rocprofsys_checkout_git_submodule( RELATIVE_PATH external/PTL WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} REPO_URL https://github.com/jrmadsen/PTL.git @@ -738,7 +738,7 @@ if(NOT TARGET PTL::ptl-shared) if(NOT DEFINED BUILD_OBJECT_LIBS) set(BUILD_OBJECT_LIBS OFF) endif() - omnitrace_save_variables( + rocprofsys_save_variables( BUILD_CONFIG VARIABLES BUILD_SHARED_LIBS BUILD_STATIC_LIBS BUILD_OBJECT_LIBS CMAKE_POSITION_INDEPENDENT_CODE CMAKE_CXX_VISIBILITY_PRESET @@ -753,7 +753,7 @@ if(NOT TARGET PTL::ptl-shared) add_subdirectory(external/PTL EXCLUDE_FROM_ALL) - omnitrace_restore_variables( + rocprofsys_restore_variables( BUILD_CONFIG VARIABLES BUILD_SHARED_LIBS BUILD_STATIC_LIBS BUILD_OBJECT_LIBS CMAKE_POSITION_INDEPENDENT_CODE CMAKE_CXX_VISIBILITY_PRESET @@ -775,23 +775,23 @@ target_include_directories( # override compiler macros include(Compilers) -if(OMNITRACE_BUILD_STATIC_LIBSTDCXX) +if(ROCPROFSYS_BUILD_STATIC_LIBSTDCXX) if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") - omnitrace_restore_variables(STATIC_LIBSTDCXX_CXX VARIABLES CMAKE_CXX_FLAGS) + rocprofsys_restore_variables(STATIC_LIBSTDCXX_CXX VARIABLES CMAKE_CXX_FLAGS) endif() endif() -if(OMNITRACE_BUILD_STATIC_LIBGCC) +if(ROCPROFSYS_BUILD_STATIC_LIBGCC) if(CMAKE_C_COMPILER_ID MATCHES "GNU") - omnitrace_restore_variables(STATIC_LIBGCC_C VARIABLES CMAKE_C_FLAGS) + rocprofsys_restore_variables(STATIC_LIBGCC_C VARIABLES CMAKE_C_FLAGS) endif() if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") - omnitrace_restore_variables(STATIC_LIBGCC_CXX VARIABLES CMAKE_CXX_FLAGS) + rocprofsys_restore_variables(STATIC_LIBGCC_CXX VARIABLES CMAKE_CXX_FLAGS) endif() endif() -omnitrace_add_feature(CMAKE_C_FLAGS "C compiler flags") -omnitrace_add_feature(CMAKE_CXX_FLAGS "C++ compiler flags") +rocprofsys_add_feature(CMAKE_C_FLAGS "C compiler flags") +rocprofsys_add_feature(CMAKE_CXX_FLAGS "C++ compiler flags") # ----------------------------------------------------------------------------------------# # @@ -799,64 +799,64 @@ omnitrace_add_feature(CMAKE_CXX_FLAGS "C++ compiler flags") # # ----------------------------------------------------------------------------------------# -if(OMNITRACE_USE_PYTHON) - if(OMNITRACE_USE_PYTHON AND NOT OMNITRACE_BUILD_PYTHON) +if(ROCPROFSYS_USE_PYTHON) + if(ROCPROFSYS_USE_PYTHON AND NOT ROCPROFSYS_BUILD_PYTHON) find_package(pybind11 REQUIRED) endif() include(ConfigPython) include(PyBind11Tools) - omnitrace_watch_for_change(OMNITRACE_PYTHON_ROOT_DIRS _PYTHON_DIRS_CHANGED) + rocprofsys_watch_for_change(ROCPROFSYS_PYTHON_ROOT_DIRS _PYTHON_DIRS_CHANGED) if(_PYTHON_DIRS_CHANGED) - unset(OMNITRACE_PYTHON_VERSION CACHE) - unset(OMNITRACE_PYTHON_VERSIONS CACHE) - unset(OMNITRACE_INSTALL_PYTHONDIR CACHE) + unset(ROCPROFSYS_PYTHON_VERSION CACHE) + unset(ROCPROFSYS_PYTHON_VERSIONS CACHE) + unset(ROCPROFSYS_INSTALL_PYTHONDIR CACHE) else() foreach(_VAR PREFIX ENVS) - omnitrace_watch_for_change(OMNITRACE_PYTHON_${_VAR} _CHANGED) + rocprofsys_watch_for_change(ROCPROFSYS_PYTHON_${_VAR} _CHANGED) if(_CHANGED) - unset(OMNITRACE_PYTHON_ROOT_DIRS CACHE) - unset(OMNITRACE_PYTHON_VERSIONS CACHE) - unset(OMNITRACE_INSTALL_PYTHONDIR CACHE) + unset(ROCPROFSYS_PYTHON_ROOT_DIRS CACHE) + unset(ROCPROFSYS_PYTHON_VERSIONS CACHE) + unset(ROCPROFSYS_INSTALL_PYTHONDIR CACHE) break() endif() endforeach() endif() - if(OMNITRACE_PYTHON_PREFIX AND OMNITRACE_PYTHON_ENVS) - omnitrace_directory( + if(ROCPROFSYS_PYTHON_PREFIX AND ROCPROFSYS_PYTHON_ENVS) + rocprofsys_directory( FAIL - PREFIX ${OMNITRACE_PYTHON_PREFIX} - PATHS ${OMNITRACE_PYTHON_ENVS} + PREFIX ${ROCPROFSYS_PYTHON_PREFIX} + PATHS ${ROCPROFSYS_PYTHON_ENVS} OUTPUT_VARIABLE _PYTHON_ROOT_DIRS) - set(OMNITRACE_PYTHON_ROOT_DIRS + set(ROCPROFSYS_PYTHON_ROOT_DIRS "${_PYTHON_ROOT_DIRS}" CACHE INTERNAL "Root directories for python") endif() - if(NOT OMNITRACE_PYTHON_VERSIONS AND OMNITRACE_PYTHON_VERSION) - set(OMNITRACE_PYTHON_VERSIONS "${OMNITRACE_PYTHON_VERSION}") + if(NOT ROCPROFSYS_PYTHON_VERSIONS AND ROCPROFSYS_PYTHON_VERSION) + set(ROCPROFSYS_PYTHON_VERSIONS "${ROCPROFSYS_PYTHON_VERSION}") - if(NOT OMNITRACE_PYTHON_ROOT_DIRS) - omnitrace_find_python(_PY VERSION ${OMNITRACE_PYTHON_VERSION}) - set(OMNITRACE_PYTHON_ROOT_DIRS + if(NOT ROCPROFSYS_PYTHON_ROOT_DIRS) + rocprofsys_find_python(_PY VERSION ${ROCPROFSYS_PYTHON_VERSION}) + set(ROCPROFSYS_PYTHON_ROOT_DIRS "${_PY_ROOT_DIR}" CACHE INTERNAL "" FORCE) endif() - unset(OMNITRACE_PYTHON_VERSION CACHE) - unset(OMNITRACE_INSTALL_PYTHONDIR CACHE) + unset(ROCPROFSYS_PYTHON_VERSION CACHE) + unset(ROCPROFSYS_INSTALL_PYTHONDIR CACHE) elseif( - NOT OMNITRACE_PYTHON_VERSIONS - AND NOT OMNITRACE_PYTHON_VERSION - AND OMNITRACE_PYTHON_ROOT_DIRS) + NOT ROCPROFSYS_PYTHON_VERSIONS + AND NOT ROCPROFSYS_PYTHON_VERSION + AND ROCPROFSYS_PYTHON_ROOT_DIRS) set(_PY_VERSIONS) - foreach(_DIR ${OMNITRACE_PYTHON_ROOT_DIRS}) - omnitrace_find_python(_PY ROOT_DIR ${_DIR}) + foreach(_DIR ${ROCPROFSYS_PYTHON_ROOT_DIRS}) + rocprofsys_find_python(_PY ROOT_DIR ${_DIR}) if(NOT _PY_FOUND) continue() @@ -867,46 +867,46 @@ if(OMNITRACE_USE_PYTHON) endif() endforeach() - set(OMNITRACE_PYTHON_VERSIONS + set(ROCPROFSYS_PYTHON_VERSIONS "${_PY_VERSIONS}" CACHE INTERNAL "" FORCE) elseif( - NOT OMNITRACE_PYTHON_VERSIONS - AND NOT OMNITRACE_PYTHON_VERSION - AND NOT OMNITRACE_PYTHON_ROOT_DIRS) - omnitrace_find_python(_PY REQUIRED) - set(OMNITRACE_PYTHON_ROOT_DIRS + NOT ROCPROFSYS_PYTHON_VERSIONS + AND NOT ROCPROFSYS_PYTHON_VERSION + AND NOT ROCPROFSYS_PYTHON_ROOT_DIRS) + rocprofsys_find_python(_PY REQUIRED) + set(ROCPROFSYS_PYTHON_ROOT_DIRS "${_PY_ROOT_DIR}" CACHE INTERNAL "" FORCE) - set(OMNITRACE_PYTHON_VERSIONS + set(ROCPROFSYS_PYTHON_VERSIONS "${_PY_VERSION}" CACHE INTERNAL "" FORCE) endif() - omnitrace_watch_for_change(OMNITRACE_PYTHON_ROOT_DIRS) - omnitrace_watch_for_change(OMNITRACE_PYTHON_VERSIONS) + rocprofsys_watch_for_change(ROCPROFSYS_PYTHON_ROOT_DIRS) + rocprofsys_watch_for_change(ROCPROFSYS_PYTHON_VERSIONS) - omnitrace_check_python_dirs_and_versions(FAIL) + rocprofsys_check_python_dirs_and_versions(FAIL) - list(LENGTH OMNITRACE_PYTHON_VERSIONS _NUM_PYTHON_VERSIONS) + list(LENGTH ROCPROFSYS_PYTHON_VERSIONS _NUM_PYTHON_VERSIONS) if(_NUM_PYTHON_VERSIONS GREATER 1) - set(OMNITRACE_INSTALL_PYTHONDIR + set(ROCPROFSYS_INSTALL_PYTHONDIR "${CMAKE_INSTALL_LIBDIR}/python/site-packages" CACHE STRING "Installation prefix for python") else() - set(OMNITRACE_INSTALL_PYTHONDIR - "${CMAKE_INSTALL_LIBDIR}/python${OMNITRACE_PYTHON_VERSIONS}/site-packages" + set(ROCPROFSYS_INSTALL_PYTHONDIR + "${CMAKE_INSTALL_LIBDIR}/python${ROCPROFSYS_PYTHON_VERSIONS}/site-packages" CACHE STRING "Installation prefix for python") endif() else() - set(OMNITRACE_INSTALL_PYTHONDIR + set(ROCPROFSYS_INSTALL_PYTHONDIR "${CMAKE_INSTALL_LIBDIR}/python/site-packages" CACHE STRING "Installation prefix for python") endif() -omnitrace_watch_for_change(OMNITRACE_INSTALL_PYTHONDIR) -set(CMAKE_INSTALL_PYTHONDIR ${OMNITRACE_INSTALL_PYTHONDIR}) +rocprofsys_watch_for_change(ROCPROFSYS_INSTALL_PYTHONDIR) +set(CMAKE_INSTALL_PYTHONDIR ${ROCPROFSYS_INSTALL_PYTHONDIR}) # ----------------------------------------------------------------------------------------# # @@ -914,18 +914,18 @@ set(CMAKE_INSTALL_PYTHONDIR ${OMNITRACE_INSTALL_PYTHONDIR}) # # ----------------------------------------------------------------------------------------# -if("${CMAKE_BUILD_TYPE}" MATCHES "Release" AND NOT OMNITRACE_BUILD_DEBUG) +if("${CMAKE_BUILD_TYPE}" MATCHES "Release" AND NOT ROCPROFSYS_BUILD_DEBUG) add_target_flag_if_avail(rocprofsys-compile-options "-g1") endif() target_compile_definitions(rocprofsys-compile-definitions - INTERFACE OMNITRACE_MAX_THREADS=${OMNITRACE_MAX_THREADS}) + INTERFACE ROCPROFSYS_MAX_THREADS=${ROCPROFSYS_MAX_THREADS}) -foreach(_LIB ${OMNITRACE_EXTENSION_LIBRARIES}) +foreach(_LIB ${ROCPROFSYS_EXTENSION_LIBRARIES}) get_target_property(_COMPILE_DEFS ${_LIB} INTERFACE_COMPILE_DEFINITIONS) if(_COMPILE_DEFS) foreach(_DEF ${_COMPILE_DEFS}) - if("${_DEF}" MATCHES "OMNITRACE_") + if("${_DEF}" MATCHES "ROCPROFSYS_") target_compile_definitions(rocprofsys-compile-definitions INTERFACE ${_DEF}) endif() diff --git a/cmake/Perfetto.cmake b/cmake/Perfetto.cmake index 237412c4..9e2a781c 100644 --- a/cmake/Perfetto.cmake +++ b/cmake/Perfetto.cmake @@ -17,17 +17,17 @@ include(ProcessorCount) # ---------------------------------------------------------------------------------------# find_program( - OMNITRACE_COPY_EXECUTABLE + ROCPROFSYS_COPY_EXECUTABLE NAMES cp PATH_SUFFIXES bin) find_program( - OMNITRACE_NINJA_EXECUTABLE + ROCPROFSYS_NINJA_EXECUTABLE NAMES ninja PATH_SUFFIXES bin) -mark_as_advanced(OMNITRACE_COPY_EXECUTABLE) -mark_as_advanced(OMNITRACE_NINJA_EXECUTABLE) +mark_as_advanced(ROCPROFSYS_COPY_EXECUTABLE) +mark_as_advanced(ROCPROFSYS_NINJA_EXECUTABLE) # ---------------------------------------------------------------------------------------# # @@ -43,44 +43,44 @@ elseif(_NUM_THREADS LESS 1) set(_NUM_THREADS 1) endif() -set(OMNITRACE_PERFETTO_SOURCE_DIR ${PROJECT_BINARY_DIR}/external/perfetto/source) -set(OMNITRACE_PERFETTO_TOOLS_DIR ${PROJECT_BINARY_DIR}/external/perfetto/source/tools) -set(OMNITRACE_PERFETTO_BINARY_DIR +set(ROCPROFSYS_PERFETTO_SOURCE_DIR ${PROJECT_BINARY_DIR}/external/perfetto/source) +set(ROCPROFSYS_PERFETTO_TOOLS_DIR ${PROJECT_BINARY_DIR}/external/perfetto/source/tools) +set(ROCPROFSYS_PERFETTO_BINARY_DIR ${PROJECT_BINARY_DIR}/external/perfetto/source/out/linux) -set(OMNITRACE_PERFETTO_INSTALL_DIR +set(ROCPROFSYS_PERFETTO_INSTALL_DIR ${PROJECT_BINARY_DIR}/external/perfetto/source/out/linux/stripped) -set(OMNITRACE_PERFETTO_LINK_FLAGS +set(ROCPROFSYS_PERFETTO_LINK_FLAGS "-static-libgcc" CACHE STRING "Link flags for perfetto") -set(OMNITRACE_PERFETTO_BUILD_THREADS +set(ROCPROFSYS_PERFETTO_BUILD_THREADS ${_NUM_THREADS} CACHE STRING "Number of threads to use when building perfetto tools") if(CMAKE_CXX_COMPILER_IS_CLANG) set(PERFETTO_IS_CLANG true) - set(OMNITRACE_PERFETTO_C_FLAGS + set(ROCPROFSYS_PERFETTO_C_FLAGS "" CACHE STRING "Perfetto C flags") - set(OMNITRACE_PERFETTO_CXX_FLAGS + set(ROCPROFSYS_PERFETTO_CXX_FLAGS "" CACHE STRING "Perfetto C++ flags") else() set(PERFETTO_IS_CLANG false) - set(OMNITRACE_PERFETTO_C_FLAGS + set(ROCPROFSYS_PERFETTO_C_FLAGS "-static-libgcc -Wno-maybe-uninitialized -Wno-stringop-overflow" CACHE STRING "Perfetto C flags") - set(OMNITRACE_PERFETTO_CXX_FLAGS + set(ROCPROFSYS_PERFETTO_CXX_FLAGS "-static-libgcc -Wno-maybe-uninitialized -Wno-stringop-overflow -Wno-mismatched-new-delete" CACHE STRING "Perfetto C++ flags") endif() -mark_as_advanced(OMNITRACE_PERFETTO_C_FLAGS) -mark_as_advanced(OMNITRACE_PERFETTO_CXX_FLAGS) -mark_as_advanced(OMNITRACE_PERFETTO_LINK_FLAGS) +mark_as_advanced(ROCPROFSYS_PERFETTO_C_FLAGS) +mark_as_advanced(ROCPROFSYS_PERFETTO_CXX_FLAGS) +mark_as_advanced(ROCPROFSYS_PERFETTO_LINK_FLAGS) -if(NOT OMNITRACE_NINJA_EXECUTABLE) - set(OMNITRACE_NINJA_EXECUTABLE - ${OMNITRACE_PERFETTO_TOOLS_DIR}/ninja +if(NOT ROCPROFSYS_NINJA_EXECUTABLE) + set(ROCPROFSYS_NINJA_EXECUTABLE + ${ROCPROFSYS_PERFETTO_TOOLS_DIR}/ninja CACHE FILEPATH "Ninja" FORCE) endif() @@ -90,13 +90,13 @@ endif() # # ---------------------------------------------------------------------------------------# -if(NOT EXISTS "${OMNITRACE_PERFETTO_SOURCE_DIR}") +if(NOT EXISTS "${ROCPROFSYS_PERFETTO_SOURCE_DIR}") execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/external/perfetto) # cmake -E copy_directory fails for some reason execute_process( - COMMAND ${OMNITRACE_COPY_EXECUTABLE} -r ${PROJECT_SOURCE_DIR}/external/perfetto/ - ${OMNITRACE_PERFETTO_SOURCE_DIR}) + COMMAND ${ROCPROFSYS_COPY_EXECUTABLE} -r ${PROJECT_SOURCE_DIR}/external/perfetto/ + ${ROCPROFSYS_PERFETTO_SOURCE_DIR}) endif() file(READ ${PROJECT_SOURCE_DIR}/external/perfetto/sdk/perfetto.h _PERFETTO_HEADER) @@ -107,21 +107,21 @@ string( " ::perfetto::internal::ValidateEventNameType" _PERFETTO_HEADER "${_PERFETTO_HEADER}") -if(OMNITRACE_USE_SANITIZER AND OMNITRACE_SANITIZER_TYPE MATCHES "address") +if(ROCPROFSYS_USE_SANITIZER AND ROCPROFSYS_SANITIZER_TYPE MATCHES "address") string(REPLACE "__asan_poison_memory_region((a), (s))" "" _PERFETTO_HEADER "${_PERFETTO_HEADER}") string(REPLACE "__asan_unpoison_memory_region((a), (s))" "" _PERFETTO_HEADER "${_PERFETTO_HEADER}") endif() -file(WRITE ${OMNITRACE_PERFETTO_SOURCE_DIR}/sdk/perfetto.h.tmp "${_PERFETTO_HEADER}") +file(WRITE ${ROCPROFSYS_PERFETTO_SOURCE_DIR}/sdk/perfetto.h.tmp "${_PERFETTO_HEADER}") -configure_file(${OMNITRACE_PERFETTO_SOURCE_DIR}/sdk/perfetto.h.tmp - ${OMNITRACE_PERFETTO_SOURCE_DIR}/sdk/perfetto.h COPYONLY) +configure_file(${ROCPROFSYS_PERFETTO_SOURCE_DIR}/sdk/perfetto.h.tmp + ${ROCPROFSYS_PERFETTO_SOURCE_DIR}/sdk/perfetto.h COPYONLY) configure_file(${PROJECT_SOURCE_DIR}/external/perfetto/sdk/perfetto.cc - ${OMNITRACE_PERFETTO_SOURCE_DIR}/sdk/perfetto.cc COPYONLY) + ${ROCPROFSYS_PERFETTO_SOURCE_DIR}/sdk/perfetto.cc COPYONLY) configure_file(${PROJECT_SOURCE_DIR}/cmake/Templates/args.gn.in - ${OMNITRACE_PERFETTO_BINARY_DIR}/args.gn @ONLY) + ${ROCPROFSYS_PERFETTO_BINARY_DIR}/args.gn @ONLY) # ---------------------------------------------------------------------------------------# # @@ -129,14 +129,14 @@ configure_file(${PROJECT_SOURCE_DIR}/cmake/Templates/args.gn.in # # ---------------------------------------------------------------------------------------# -if(OMNITRACE_INSTALL_PERFETTO_TOOLS) +if(ROCPROFSYS_INSTALL_PERFETTO_TOOLS) find_program( - OMNITRACE_CURL_EXECUTABLE + ROCPROFSYS_CURL_EXECUTABLE NAMES curl PATH_SUFFIXES bin) - if(NOT OMNITRACE_CURL_EXECUTABLE) - omnitrace_message( + if(NOT ROCPROFSYS_CURL_EXECUTABLE) + rocprofsys_message( SEND_ERROR "curl executable cannot be found. install-build-deps script for perfetto will fail" ) @@ -145,27 +145,27 @@ if(OMNITRACE_INSTALL_PERFETTO_TOOLS) externalproject_add( rocprofsys-perfetto-build PREFIX ${PROJECT_BINARY_DIR}/external/perfetto - SOURCE_DIR ${OMNITRACE_PERFETTO_SOURCE_DIR} + SOURCE_DIR ${ROCPROFSYS_PERFETTO_SOURCE_DIR} BUILD_IN_SOURCE 1 - PATCH_COMMAND ${OMNITRACE_PERFETTO_TOOLS_DIR}/install-build-deps - CONFIGURE_COMMAND ${OMNITRACE_PERFETTO_TOOLS_DIR}/gn gen - ${OMNITRACE_PERFETTO_BINARY_DIR} - BUILD_COMMAND ${OMNITRACE_NINJA_EXECUTABLE} -C ${OMNITRACE_PERFETTO_BINARY_DIR} -j - ${OMNITRACE_PERFETTO_BUILD_THREADS} + PATCH_COMMAND ${ROCPROFSYS_PERFETTO_TOOLS_DIR}/install-build-deps + CONFIGURE_COMMAND ${ROCPROFSYS_PERFETTO_TOOLS_DIR}/gn gen + ${ROCPROFSYS_PERFETTO_BINARY_DIR} + BUILD_COMMAND ${ROCPROFSYS_NINJA_EXECUTABLE} -C ${ROCPROFSYS_PERFETTO_BINARY_DIR} -j + ${ROCPROFSYS_PERFETTO_BUILD_THREADS} INSTALL_COMMAND "" - BUILD_BYPRODUCTS ${OMNITRACE_PERFETTO_BINARY_DIR}/args.gn) + BUILD_BYPRODUCTS ${ROCPROFSYS_PERFETTO_BINARY_DIR}/args.gn) add_custom_target( rocprofsys-perfetto-clean - COMMAND ${OMNITRACE_NINJA_EXECUTABLE} -t clean + COMMAND ${ROCPROFSYS_NINJA_EXECUTABLE} -t clean COMMAND ${CMAKE_COMMAND} -E rm -rf ${PROJECT_BINARY_DIR}/external/perfetto/src/rocprofsys-perfetto-build-stamp - WORKING_DIRECTORY ${OMNITRACE_PERFETTO_BINARY_DIR} + WORKING_DIRECTORY ${ROCPROFSYS_PERFETTO_BINARY_DIR} COMMENT "Cleaning Perfetto...") install( - DIRECTORY ${OMNITRACE_PERFETTO_INSTALL_DIR}/ + DIRECTORY ${ROCPROFSYS_PERFETTO_INSTALL_DIR}/ DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PACKAGE_NAME} COMPONENT perfetto FILES_MATCHING @@ -178,7 +178,7 @@ if(OMNITRACE_INSTALL_PERFETTO_TOOLS) string(REPLACE "_" "-" _INSTALL_FILE "rocprof-sys-perfetto-${_FILE}") endif() install( - PROGRAMS ${OMNITRACE_PERFETTO_INSTALL_DIR}/${_FILE} + PROGRAMS ${ROCPROFSYS_PERFETTO_INSTALL_DIR}/${_FILE} DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT perfetto RENAME ${_INSTALL_FILE} @@ -195,8 +195,8 @@ endif() add_library(rocprofsys-perfetto-library STATIC) add_library(rocprofsys::rocprofsys-perfetto-library ALIAS rocprofsys-perfetto-library) target_sources( - rocprofsys-perfetto-library PRIVATE ${OMNITRACE_PERFETTO_SOURCE_DIR}/sdk/perfetto.cc - ${OMNITRACE_PERFETTO_SOURCE_DIR}/sdk/perfetto.h) + rocprofsys-perfetto-library PRIVATE ${ROCPROFSYS_PERFETTO_SOURCE_DIR}/sdk/perfetto.cc + ${ROCPROFSYS_PERFETTO_SOURCE_DIR}/sdk/perfetto.h) target_link_libraries( rocprofsys-perfetto-library PRIVATE rocprofsys::rocprofsys-threading rocprofsys::rocprofsys-static-libgcc @@ -204,19 +204,19 @@ target_link_libraries( set_target_properties( rocprofsys-perfetto-library PROPERTIES OUTPUT_NAME perfetto - ARCHIVE_OUTPUT_DIRECTORY ${OMNITRACE_PERFETTO_BINARY_DIR} + ARCHIVE_OUTPUT_DIRECTORY ${ROCPROFSYS_PERFETTO_BINARY_DIR} POSITION_INDEPENDENT_CODE ON CXX_VISIBILITY_PRESET "internal") -set(perfetto_DIR ${OMNITRACE_PERFETTO_SOURCE_DIR}) +set(perfetto_DIR ${ROCPROFSYS_PERFETTO_SOURCE_DIR}) set(PERFETTO_ROOT_DIR - ${OMNITRACE_PERFETTO_SOURCE_DIR} + ${ROCPROFSYS_PERFETTO_SOURCE_DIR} CACHE PATH "Root Perfetto installation" FORCE) set(PERFETTO_INCLUDE_DIR - ${OMNITRACE_PERFETTO_SOURCE_DIR}/sdk + ${ROCPROFSYS_PERFETTO_SOURCE_DIR}/sdk CACHE PATH "Perfetto include folder" FORCE) set(PERFETTO_LIBRARY - ${OMNITRACE_PERFETTO_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}perfetto${CMAKE_STATIC_LIBRARY_SUFFIX} + ${ROCPROFSYS_PERFETTO_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}perfetto${CMAKE_STATIC_LIBRARY_SUFFIX} CACHE FILEPATH "Perfetto library" FORCE) mark_as_advanced(PERFETTO_ROOT_DIR) @@ -229,7 +229,7 @@ mark_as_advanced(PERFETTO_LIBRARY) # # ---------------------------------------------------------------------------------------# -omnitrace_target_compile_definitions(rocprofsys-perfetto INTERFACE OMNITRACE_USE_PERFETTO) +rocprofsys_target_compile_definitions(rocprofsys-perfetto INTERFACE ROCPROFSYS_USE_PERFETTO) target_include_directories(rocprofsys-perfetto SYSTEM INTERFACE $) target_link_libraries( diff --git a/cmake/Templates/args.gn.in b/cmake/Templates/args.gn.in index 5e306deb..21c844b6 100644 --- a/cmake/Templates/args.gn.in +++ b/cmake/Templates/args.gn.in @@ -23,6 +23,6 @@ enable_perfetto_trace_processor_percentile = false enable_perfetto_trace_processor_sqlite = true enable_perfetto_ui = false -extra_cflags = "@OMNITRACE_PERFETTO_C_FLAGS@" -extra_cxxflags = "@OMNITRACE_PERFETTO_CXX_FLAGS@" -extra_ldflags = "@OMNITRACE_PERFETTO_LINK_FLAGS@ -Wl,-rpath=\\\$ORIGIN:\\\$ORIGIN/../lib:\\\$ORIGIN/../lib/rocprof-sys" +extra_cflags = "@ROCPROFSYS_PERFETTO_C_FLAGS@" +extra_cxxflags = "@ROCPROFSYS_PERFETTO_CXX_FLAGS@" +extra_ldflags = "@ROCPROFSYS_PERFETTO_LINK_FLAGS@ -Wl,-rpath=\\\$ORIGIN:\\\$ORIGIN/../lib:\\\$ORIGIN/../lib/rocprof-sys" diff --git a/cmake/Templates/modulefile.in b/cmake/Templates/modulefile.in index 211ce4f9..c7bb073d 100644 --- a/cmake/Templates/modulefile.in +++ b/cmake/Templates/modulefile.in @@ -15,6 +15,6 @@ prepend-path LD_LIBRARY_PATH "${ROOT}/@CMAKE_INSTALL_LIBDIR@" prepend-path PYTHONPATH "${ROOT}/@CMAKE_INSTALL_PYTHONDIR@" setenv @PACKAGE_NAME_UNDERSCORE@_DIR "${ROOT}/@CMAKE_INSTALL_DATAROOTDIR@/cmake/@PACKAGE_NAME@" -# @OMNITRACE_HSA_ENV@setenv HSA_TOOLS_LIB "${ROOT}/@CMAKE_INSTALL_LIBDIR@/@CMAKE_SHARED_LIBRARY_PREFIX@rocprof-sys@CMAKE_SHARED_LIBRARY_SUFFIX@" -# @OMNITRACE_HSA_ENV@setenv HSA_TOOLS_REPORT_LOAD_FAILURE 1 -# @OMNITRACE_ROCP_ENV@setenv ROCP_TOOL_LIB "${ROOT}/@CMAKE_INSTALL_LIBDIR@/@CMAKE_SHARED_LIBRARY_PREFIX@rocprof-sys@CMAKE_SHARED_LIBRARY_SUFFIX@" +# @ROCPROFSYS_HSA_ENV@setenv HSA_TOOLS_LIB "${ROOT}/@CMAKE_INSTALL_LIBDIR@/@CMAKE_SHARED_LIBRARY_PREFIX@rocprof-sys@CMAKE_SHARED_LIBRARY_SUFFIX@" +# @ROCPROFSYS_HSA_ENV@setenv HSA_TOOLS_REPORT_LOAD_FAILURE 1 +# @ROCPROFSYS_ROCP_ENV@setenv ROCP_TOOL_LIB "${ROOT}/@CMAKE_INSTALL_LIBDIR@/@CMAKE_SHARED_LIBRARY_PREFIX@rocprof-sys@CMAKE_SHARED_LIBRARY_SUFFIX@" diff --git a/cmake/Templates/rocprofsys-config.cmake.in b/cmake/Templates/rocprof-sys-config.cmake.in similarity index 100% rename from cmake/Templates/rocprofsys-config.cmake.in rename to cmake/Templates/rocprof-sys-config.cmake.in diff --git a/cmake/Templates/rocprofsys-install.py.in b/cmake/Templates/rocprof-sys-install.py.in similarity index 99% rename from cmake/Templates/rocprofsys-install.py.in rename to cmake/Templates/rocprof-sys-install.py.in index 38f2eae0..32fd160a 100755 --- a/cmake/Templates/rocprofsys-install.py.in +++ b/cmake/Templates/rocprof-sys-install.py.in @@ -10,7 +10,7 @@ import subprocess as sp from urllib import request from urllib.error import HTTPError -omnitrace_version = "@OMNITRACE_VERSION@" +omnitrace_version = "@ROCPROFSYS_VERSION@" _rocm_path = os.environ.get("ROCM_PATH", "/opt/rocm") _rocm_version = None diff --git a/cmake/Templates/setup-env.sh.in b/cmake/Templates/setup-env.sh.in index dfdc6235..c956887d 100644 --- a/cmake/Templates/setup-env.sh.in +++ b/cmake/Templates/setup-env.sh.in @@ -28,10 +28,10 @@ export CMAKE_PREFIX_PATH export @PACKAGE_NAME_UNDERSCORE@_DIR # ROCm environment variables -# @OMNITRACE_HSA_ENV@HSA_TOOLS_LIB="${BASEDIR}/@CMAKE_INSTALL_LIBDIR@/@CMAKE_SHARED_LIBRARY_PREFIX@rocprof-sys-dl@CMAKE_SHARED_LIBRARY_SUFFIX@" -# @OMNITRACE_HSA_ENV@HSA_TOOLS_REPORT_LOAD_FAILURE=1 -# @OMNITRACE_ROCP_ENV@ROCP_TOOL_LIB="${BASEDIR}/@CMAKE_INSTALL_LIBDIR@/@CMAKE_SHARED_LIBRARY_PREFIX@rocprof-sys@CMAKE_SHARED_LIBRARY_SUFFIX@" +# @ROCPROFSYS_HSA_ENV@HSA_TOOLS_LIB="${BASEDIR}/@CMAKE_INSTALL_LIBDIR@/@CMAKE_SHARED_LIBRARY_PREFIX@rocprof-sys-dl@CMAKE_SHARED_LIBRARY_SUFFIX@" +# @ROCPROFSYS_HSA_ENV@HSA_TOOLS_REPORT_LOAD_FAILURE=1 +# @ROCPROFSYS_ROCP_ENV@ROCP_TOOL_LIB="${BASEDIR}/@CMAKE_INSTALL_LIBDIR@/@CMAKE_SHARED_LIBRARY_PREFIX@rocprof-sys@CMAKE_SHARED_LIBRARY_SUFFIX@" -# @OMNITRACE_HSA_ENV@export HSA_TOOLS_LIB -# @OMNITRACE_HSA_ENV@export HSA_TOOLS_REPORT_LOAD_FAILURE -# @OMNITRACE_ROCP_ENV@export ROCP_TOOL_LIB +# @ROCPROFSYS_HSA_ENV@export HSA_TOOLS_LIB +# @ROCPROFSYS_HSA_ENV@export HSA_TOOLS_REPORT_LOAD_FAILURE +# @ROCPROFSYS_ROCP_ENV@export ROCP_TOOL_LIB diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 65aa207f..cb2d5fe3 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -17,7 +17,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_CLANG_TIDY) set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME examples) -if(OMNITRACE_BUILD_DEBUG) +if(ROCPROFSYS_BUILD_DEBUG) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -fno-omit-frame-pointer") endif() @@ -27,16 +27,16 @@ if(CMAKE_PROJECT_NAME STREQUAL "rocprofsys") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) - omnitrace_add_option(OMNITRACE_INSTALL_EXAMPLES "Install rocprofsys examples" OFF) + rocprofsys_add_option(ROCPROFSYS_INSTALL_EXAMPLES "Install rocprofsys examples" OFF) else() - option(OMNITRACE_INSTALL_EXAMPLES "Install rocprofsys examples" ON) + option(ROCPROFSYS_INSTALL_EXAMPLES "Install rocprofsys examples" ON) endif() -if(OMNITRACE_INSTALL_EXAMPLES) +if(ROCPROFSYS_INSTALL_EXAMPLES) include(GNUInstallDirs) endif() -set(OMNITRACE_EXAMPLE_ROOT_DIR +set(ROCPROFSYS_EXAMPLE_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR} CACHE INTERNAL "") # defines function for creating causal profiling exes diff --git a/examples/causal-helpers.cmake b/examples/causal-helpers.cmake index 38d455d1..a116cf09 100644 --- a/examples/causal-helpers.cmake +++ b/examples/causal-helpers.cmake @@ -15,11 +15,11 @@ if(NOT TARGET omni-causal-examples) add_custom_target(omni-causal-examples) endif() -function(omnitrace_causal_example_executable _NAME) +function(rocprofsys_causal_example_executable _NAME) cmake_parse_arguments( CAUSAL "" "" "SOURCES;DEFINITIONS;INCLUDE_DIRECTORIES;LINK_LIBRARIES" ${ARGN}) - function(omnitrace_causal_example_interface _TARGET) + function(rocprofsys_causal_example_interface _TARGET) if(NOT TARGET ${_TARGET}) find_package(Threads REQUIRED) add_library(${_TARGET} INTERFACE) @@ -27,8 +27,8 @@ function(omnitrace_causal_example_executable _NAME) endif() endfunction() - omnitrace_causal_example_interface(omni-causal-example-lib-debug) - omnitrace_causal_example_interface(omni-causal-example-lib-no-debug) + rocprofsys_causal_example_interface(omni-causal-example-lib-debug) + rocprofsys_causal_example_interface(omni-causal-example-lib-no-debug) target_compile_options(omni-causal-example-lib-debug INTERFACE -g3 -fno-omit-frame-pointer) @@ -37,7 +37,7 @@ function(omnitrace_causal_example_executable _NAME) add_executable(${_NAME} ${CAUSAL_SOURCES}) target_compile_definitions(${_NAME} PRIVATE USE_COZ=0 USE_OMNI=0 ${CAUSAL_DEFINITIONS}) - target_include_directories(${_NAME} PRIVATE ${OMNITRACE_EXAMPLE_ROOT_DIR}/causal + target_include_directories(${_NAME} PRIVATE ${ROCPROFSYS_EXAMPLE_ROOT_DIR}/causal ${CAUSAL_INCLUDE_DIRECTORIES}) target_link_libraries( ${_NAME} PRIVATE ${CAUSAL_LINK_LIBRARIES} rocprofsys::rocprofsys-user-library @@ -46,7 +46,7 @@ function(omnitrace_causal_example_executable _NAME) add_executable(${_NAME}-omni ${CAUSAL_SOURCES}) target_compile_definitions(${_NAME}-omni PRIVATE USE_COZ=0 USE_OMNI=1 ${CAUSAL_DEFINITIONS}) - target_include_directories(${_NAME}-omni PRIVATE ${OMNITRACE_EXAMPLE_ROOT_DIR}/causal + target_include_directories(${_NAME}-omni PRIVATE ${ROCPROFSYS_EXAMPLE_ROOT_DIR}/causal ${CAUSAL_INCLUDE_DIRECTORIES}) target_link_libraries( ${_NAME}-omni @@ -57,7 +57,7 @@ function(omnitrace_causal_example_executable _NAME) target_compile_definitions(${_NAME}-ndebug PRIVATE USE_COZ=0 USE_OMNI=0 ${CAUSAL_DEFINITIONS}) target_include_directories( - ${_NAME}-ndebug PRIVATE ${OMNITRACE_EXAMPLE_ROOT_DIR}/causal + ${_NAME}-ndebug PRIVATE ${ROCPROFSYS_EXAMPLE_ROOT_DIR}/causal ${CAUSAL_INCLUDE_DIRECTORIES}) target_link_libraries( ${_NAME}-ndebug @@ -68,7 +68,7 @@ function(omnitrace_causal_example_executable _NAME) target_compile_definitions(${_NAME}-omni-ndebug PRIVATE USE_COZ=0 USE_OMNI=1 ${CAUSAL_DEFINITIONS}) target_include_directories( - ${_NAME}-omni-ndebug PRIVATE ${OMNITRACE_EXAMPLE_ROOT_DIR}/causal + ${_NAME}-omni-ndebug PRIVATE ${ROCPROFSYS_EXAMPLE_ROOT_DIR}/causal ${CAUSAL_INCLUDE_DIRECTORIES}) target_link_libraries( ${_NAME}-omni-ndebug @@ -79,7 +79,7 @@ function(omnitrace_causal_example_executable _NAME) ${_NAME}-omni-ndebug) if(coz-profiler_FOUND) - omnitrace_causal_example_interface(omni-causal-example-lib-coz) + rocprofsys_causal_example_interface(omni-causal-example-lib-coz) target_compile_options(omni-causal-example-lib-coz INTERFACE -g3 -gdwarf-3 -fno-omit-frame-pointer) @@ -87,7 +87,7 @@ function(omnitrace_causal_example_executable _NAME) target_compile_definitions(${_NAME}-coz PRIVATE USE_COZ=1 USE_OMNI=0 ${CAUSAL_DEFINITIONS}) target_include_directories( - ${_NAME}-coz PRIVATE ${OMNITRACE_EXAMPLE_ROOT_DIR}/causal + ${_NAME}-coz PRIVATE ${ROCPROFSYS_EXAMPLE_ROOT_DIR}/causal ${CAUSAL_INCLUDE_DIRECTORIES}) target_link_libraries(${_NAME}-coz PRIVATE ${CAUSAL_LINK_LIBRARIES} omni-causal-example-lib-coz coz::coz) @@ -95,7 +95,7 @@ function(omnitrace_causal_example_executable _NAME) add_dependencies(omni-causal-examples ${_NAME}-coz) endif() - if(OMNITRACE_INSTALL_EXAMPLES) + if(ROCPROFSYS_INSTALL_EXAMPLES) install( TARGETS ${_NAME} ${_NAME}-omni ${_NAME}-coz DESTINATION bin diff --git a/examples/causal/CMakeLists.txt b/examples/causal/CMakeLists.txt index e0fc98f0..6b7dabad 100644 --- a/examples/causal/CMakeLists.txt +++ b/examples/causal/CMakeLists.txt @@ -2,11 +2,11 @@ cmake_minimum_required(VERSION 3.16 FATAL_ERROR) project(rocprofsys-causal-example LANGUAGES CXX) -if(OMNITRACE_DISABLE_EXAMPLES) +if(ROCPROFSYS_DISABLE_EXAMPLES) get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME) - if(${PROJECT_NAME} IN_LIST OMNITRACE_DISABLE_EXAMPLES OR ${_DIR} IN_LIST - OMNITRACE_DISABLE_EXAMPLES) + if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST + ROCPROFSYS_DISABLE_EXAMPLES) return() endif() endif() @@ -23,19 +23,19 @@ target_compile_options(causal-interface-library INTERFACE -g3 -gdwarf-3 target_link_libraries(causal-interface-library INTERFACE Threads::Threads ${CMAKE_DL_LIBS}) -omnitrace_causal_example_executable( +rocprofsys_causal_example_executable( "causal-both" SOURCES causal.cpp impl.cpp LINK_LIBRARIES causal-interface-library DEFINITIONS USE_RNG=1 USE_CPU=1) -omnitrace_causal_example_executable( +rocprofsys_causal_example_executable( "causal-rng" SOURCES causal.cpp impl.cpp LINK_LIBRARIES causal-interface-library DEFINITIONS USE_RNG=1 USE_CPU=0) -omnitrace_causal_example_executable( +rocprofsys_causal_example_executable( "causal-cpu" SOURCES causal.cpp impl.cpp LINK_LIBRARIES causal-interface-library diff --git a/examples/causal/causal.hpp b/examples/causal/causal.hpp index 8094cebf..94c457ad 100644 --- a/examples/causal/causal.hpp +++ b/examples/causal/causal.hpp @@ -28,10 +28,10 @@ #if defined(USE_OMNI) && USE_OMNI > 0 # include -# define CAUSAL_PROGRESS OMNITRACE_CAUSAL_PROGRESS -# define CAUSAL_PROGRESS_NAMED(LABEL) OMNITRACE_CAUSAL_PROGRESS_NAMED(LABEL) -# define CAUSAL_BEGIN(LABEL) OMNITRACE_CAUSAL_BEGIN(LABEL) -# define CAUSAL_END(LABEL) OMNITRACE_CAUSAL_END(LABEL) +# define CAUSAL_PROGRESS ROCPROFSYS_CAUSAL_PROGRESS +# define CAUSAL_PROGRESS_NAMED(LABEL) ROCPROFSYS_CAUSAL_PROGRESS_NAMED(LABEL) +# define CAUSAL_BEGIN(LABEL) ROCPROFSYS_CAUSAL_BEGIN(LABEL) +# define CAUSAL_END(LABEL) ROCPROFSYS_CAUSAL_END(LABEL) #elif defined(USE_COZ) && USE_COZ > 0 # include # define CAUSAL_PROGRESS COZ_PROGRESS_NAMED(CAUSAL_LABEL) diff --git a/examples/code-coverage/CMakeLists.txt b/examples/code-coverage/CMakeLists.txt index 25229f10..9d621b3c 100644 --- a/examples/code-coverage/CMakeLists.txt +++ b/examples/code-coverage/CMakeLists.txt @@ -2,11 +2,11 @@ cmake_minimum_required(VERSION 3.15 FATAL_ERROR) project(rocprofsys-code-coverage-example LANGUAGES CXX) -if(OMNITRACE_DISABLE_EXAMPLES) +if(ROCPROFSYS_DISABLE_EXAMPLES) get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME) - if(${PROJECT_NAME} IN_LIST OMNITRACE_DISABLE_EXAMPLES OR ${_DIR} IN_LIST - OMNITRACE_DISABLE_EXAMPLES) + if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST + ROCPROFSYS_DISABLE_EXAMPLES) return() endif() endif() @@ -19,7 +19,7 @@ add_executable(code-coverage code-coverage.cpp) target_link_libraries(code-coverage PRIVATE Threads::Threads) target_compile_options(code-coverage PRIVATE ${_FLAGS}) -if(OMNITRACE_INSTALL_EXAMPLES) +if(ROCPROFSYS_INSTALL_EXAMPLES) install( TARGETS code-coverage DESTINATION bin @@ -37,7 +37,7 @@ if(Python3_FOUND) configure_file(${PROJECT_SOURCE_DIR}/${_FILE} ${PROJECT_BINARY_DIR}/${_FILE} @ONLY) - if(OMNITRACE_INSTALL_EXAMPLES) + if(ROCPROFSYS_INSTALL_EXAMPLES) install( PROGRAMS ${PROJECT_BINARY_DIR}/${_FILE} DESTINATION bin diff --git a/examples/fork/CMakeLists.txt b/examples/fork/CMakeLists.txt index 02a0686d..e118db3f 100644 --- a/examples/fork/CMakeLists.txt +++ b/examples/fork/CMakeLists.txt @@ -11,7 +11,7 @@ add_executable(fork-example fork.cpp) target_link_libraries(fork-example PRIVATE Threads::Threads rocprofsys::rocprofsys) target_compile_options(fork-example PRIVATE ${_FLAGS}) -if(OMNITRACE_INSTALL_EXAMPLES) +if(ROCPROFSYS_INSTALL_EXAMPLES) install( TARGETS fork-example DESTINATION bin diff --git a/examples/lulesh/CMakeLists.txt b/examples/lulesh/CMakeLists.txt index bcd36a1f..52eb5169 100644 --- a/examples/lulesh/CMakeLists.txt +++ b/examples/lulesh/CMakeLists.txt @@ -2,11 +2,11 @@ cmake_minimum_required(VERSION 3.16 FATAL_ERROR) project(rocprofsys-lulesh-example LANGUAGES C CXX) -if(OMNITRACE_DISABLE_EXAMPLES) +if(ROCPROFSYS_DISABLE_EXAMPLES) get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME) - if(${PROJECT_NAME} IN_LIST OMNITRACE_DISABLE_EXAMPLES OR ${_DIR} IN_LIST - OMNITRACE_DISABLE_EXAMPLES) + if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST + ROCPROFSYS_DISABLE_EXAMPLES) return() endif() endif() @@ -65,13 +65,13 @@ endif() file(GLOB headers ${PROJECT_SOURCE_DIR}/*.h ${PROJECT_SOURCE_DIR}/*.hxx) file(GLOB sources ${PROJECT_SOURCE_DIR}/*.cc) -omnitrace_causal_example_executable( +rocprofsys_causal_example_executable( "lulesh" SOURCES ${sources} ${headers} LINK_LIBRARIES Kokkos::kokkos lulesh-mpi INCLUDE_DIRECTORIES ${PROJECT_SOURCE_DIR}/includes) -if(OMNITRACE_INSTALL_EXAMPLES) +if(ROCPROFSYS_INSTALL_EXAMPLES) if(LULESH_BUILD_KOKKOS) install( TARGETS kokkoscore kokkoscontainers diff --git a/examples/mpi/CMakeLists.txt b/examples/mpi/CMakeLists.txt index b37fe66c..a3d278ea 100644 --- a/examples/mpi/CMakeLists.txt +++ b/examples/mpi/CMakeLists.txt @@ -2,11 +2,11 @@ cmake_minimum_required(VERSION 3.16 FATAL_ERROR) project(rocprofsys-mpi-examples LANGUAGES C CXX) -if(OMNITRACE_DISABLE_EXAMPLES) +if(ROCPROFSYS_DISABLE_EXAMPLES) get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME) - if(${PROJECT_NAME} IN_LIST OMNITRACE_DISABLE_EXAMPLES OR ${_DIR} IN_LIST - OMNITRACE_DISABLE_EXAMPLES) + if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST + ROCPROFSYS_DISABLE_EXAMPLES) return() endif() endif() @@ -65,7 +65,7 @@ target_link_libraries( add_executable(mpi-example mpi.cpp) target_link_libraries(mpi-example PRIVATE mpi-cxx-interface-library) -if(OMNITRACE_INSTALL_EXAMPLES) +if(ROCPROFSYS_INSTALL_EXAMPLES) install( TARGETS mpi-example mpi-allgather mpi-bcast mpi-all2all mpi-reduce mpi-scatter-gather mpi-send-recv diff --git a/examples/openmp/CMakeLists.txt b/examples/openmp/CMakeLists.txt index 0f91f9ad..a1373fec 100644 --- a/examples/openmp/CMakeLists.txt +++ b/examples/openmp/CMakeLists.txt @@ -15,7 +15,7 @@ option(USE_CLANG_OMP "Use the clang OpenMP if available" ON) if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") find_package(OpenMP REQUIRED) target_link_libraries(openmp-common PUBLIC OpenMP::OpenMP_CXX) - set(OMNITRACE_OPENMP_USING_LIBOMP_LIBRARY + set(ROCPROFSYS_OPENMP_USING_LIBOMP_LIBRARY ON CACHE INTERNAL "Used by rocprofsys testing" FORCE) else() @@ -25,20 +25,20 @@ else() NAMES omp omp5 ${CMAKE_SHARED_LIBRARY_PREFIX}omp${CMAKE_SHARED_LIBRARY_SUFFIX}.5) if(CLANGXX_EXECUTABLE AND LIBOMP_LIBRARY - AND COMMAND omnitrace_custom_compilation + AND COMMAND rocprofsys_custom_compilation AND USE_CLANG_OMP) target_compile_options(openmp-common PUBLIC -W -Wall -fopenmp=libomp) target_link_libraries(openmp-common PUBLIC ${LIBOMP_LIBRARY}) - omnitrace_custom_compilation(COMPILER ${CLANGXX_EXECUTABLE} TARGET openmp-common) - omnitrace_custom_compilation(COMPILER ${CLANGXX_EXECUTABLE} TARGET openmp-cg) - omnitrace_custom_compilation(COMPILER ${CLANGXX_EXECUTABLE} TARGET openmp-lu) - set(OMNITRACE_OPENMP_USING_LIBOMP_LIBRARY + rocprofsys_custom_compilation(COMPILER ${CLANGXX_EXECUTABLE} TARGET openmp-common) + rocprofsys_custom_compilation(COMPILER ${CLANGXX_EXECUTABLE} TARGET openmp-cg) + rocprofsys_custom_compilation(COMPILER ${CLANGXX_EXECUTABLE} TARGET openmp-lu) + set(ROCPROFSYS_OPENMP_USING_LIBOMP_LIBRARY ON CACHE INTERNAL "Used by rocprofsys testing" FORCE) else() find_package(OpenMP REQUIRED) target_link_libraries(openmp-common PUBLIC OpenMP::OpenMP_CXX) - set(OMNITRACE_OPENMP_USING_LIBOMP_LIBRARY + set(ROCPROFSYS_OPENMP_USING_LIBOMP_LIBRARY OFF CACHE INTERNAL "Used by rocprofsys testing" FORCE) endif() @@ -47,7 +47,7 @@ endif() target_link_libraries(openmp-cg PRIVATE openmp-common) target_link_libraries(openmp-lu PRIVATE openmp-common) -if(OMNITRACE_INSTALL_EXAMPLES) +if(ROCPROFSYS_INSTALL_EXAMPLES) install( TARGETS openmp-cg openmp-lu DESTINATION bin diff --git a/examples/parallel-overhead/CMakeLists.txt b/examples/parallel-overhead/CMakeLists.txt index 9789a2d1..1307e516 100644 --- a/examples/parallel-overhead/CMakeLists.txt +++ b/examples/parallel-overhead/CMakeLists.txt @@ -2,11 +2,11 @@ cmake_minimum_required(VERSION 3.16 FATAL_ERROR) project(rocprofsys-parallel-overhead-example LANGUAGES CXX) -if(OMNITRACE_DISABLE_EXAMPLES) +if(ROCPROFSYS_DISABLE_EXAMPLES) get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME) - if(${PROJECT_NAME} IN_LIST OMNITRACE_DISABLE_EXAMPLES OR ${_DIR} IN_LIST - OMNITRACE_DISABLE_EXAMPLES) + if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST + ROCPROFSYS_DISABLE_EXAMPLES) return() endif() endif() @@ -26,7 +26,7 @@ target_link_libraries(parallel-overhead-locks PRIVATE Threads::Threads parallel-overhead-compile-options) target_compile_definitions(parallel-overhead-locks PRIVATE USE_LOCKS=1) -if(OMNITRACE_INSTALL_EXAMPLES) +if(ROCPROFSYS_INSTALL_EXAMPLES) install( TARGETS parallel-overhead parallel-overhead-locks DESTINATION bin diff --git a/examples/python/CMakeLists.txt b/examples/python/CMakeLists.txt index 1e627146..1e1016be 100644 --- a/examples/python/CMakeLists.txt +++ b/examples/python/CMakeLists.txt @@ -2,11 +2,11 @@ cmake_minimum_required(VERSION 3.16 FATAL_ERROR) project(rocprofsys-python) -if(OMNITRACE_DISABLE_EXAMPLES) +if(ROCPROFSYS_DISABLE_EXAMPLES) get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME) - if(${PROJECT_NAME} IN_LIST OMNITRACE_DISABLE_EXAMPLES OR ${_DIR} IN_LIST - OMNITRACE_DISABLE_EXAMPLES) + if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST + ROCPROFSYS_DISABLE_EXAMPLES) return() endif() endif() @@ -22,7 +22,7 @@ if(Python3_FOUND) configure_file(${PROJECT_SOURCE_DIR}/${_FILE} ${PROJECT_BINARY_DIR}/${_FILE} @ONLY) - if(OMNITRACE_INSTALL_EXAMPLES) + if(ROCPROFSYS_INSTALL_EXAMPLES) install( PROGRAMS ${PROJECT_BINARY_DIR}/${_FILE} DESTINATION bin diff --git a/examples/rccl/CMakeLists.txt b/examples/rccl/CMakeLists.txt index ef4b5eb5..539e671f 100644 --- a/examples/rccl/CMakeLists.txt +++ b/examples/rccl/CMakeLists.txt @@ -2,11 +2,11 @@ cmake_minimum_required(VERSION 3.16 FATAL_ERROR) project(rocprofsys-rccl-example LANGUAGES CXX) -if(OMNITRACE_DISABLE_EXAMPLES) +if(ROCPROFSYS_DISABLE_EXAMPLES) get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME) - if(${PROJECT_NAME} IN_LIST OMNITRACE_DISABLE_EXAMPLES OR ${_DIR} IN_LIST - OMNITRACE_DISABLE_EXAMPLES) + if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST + ROCPROFSYS_DISABLE_EXAMPLES) return() endif() endif() @@ -18,7 +18,7 @@ function(rccl_message _MSG_TYPE) set(_MSG_TYPE STATUS) # don't generate warnings during CI endif() if("${CMAKE_PROJECT_NAME}" STREQUAL "rocprofsys") - omnitrace_message(${_MSG_TYPE} ${ARGN}) + rocprofsys_message(${_MSG_TYPE} ${ARGN}) else() message(${_MSG_TYPE} ${ARGN}) endif() @@ -33,8 +33,8 @@ endif() if("${CMAKE_PROJECT_NAME}" STREQUAL "rocprofsys" AND ("$ENV{ROCPROFSYS_CI}" - OR OMNITRACE_CI - OR OMNITRACE_BUILD_CI)) + OR ROCPROFSYS_CI + OR ROCPROFSYS_BUILD_CI)) find_package(rccl QUIET) # avoid generating warning in CI else() find_package(rccl) diff --git a/examples/rewrite-caller/CMakeLists.txt b/examples/rewrite-caller/CMakeLists.txt index 40857483..cd63a3a7 100644 --- a/examples/rewrite-caller/CMakeLists.txt +++ b/examples/rewrite-caller/CMakeLists.txt @@ -2,11 +2,11 @@ cmake_minimum_required(VERSION 3.15 FATAL_ERROR) project(rocprofsys-rewrite-caller-example LANGUAGES CXX) -if(OMNITRACE_DISABLE_EXAMPLES) +if(ROCPROFSYS_DISABLE_EXAMPLES) get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME) - if(${PROJECT_NAME} IN_LIST OMNITRACE_DISABLE_EXAMPLES OR ${_DIR} IN_LIST - OMNITRACE_DISABLE_EXAMPLES) + if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST + ROCPROFSYS_DISABLE_EXAMPLES) return() endif() endif() @@ -16,7 +16,7 @@ set(CMAKE_BUILD_TYPE "Debug") add_executable(rewrite-caller rewrite-caller.cpp) target_compile_options(rewrite-caller PRIVATE ${_FLAGS}) -if(OMNITRACE_INSTALL_EXAMPLES) +if(ROCPROFSYS_INSTALL_EXAMPLES) install( TARGETS rewrite-caller DESTINATION bin diff --git a/examples/trace-time-window/CMakeLists.txt b/examples/trace-time-window/CMakeLists.txt index b066e64b..ae59d4af 100644 --- a/examples/trace-time-window/CMakeLists.txt +++ b/examples/trace-time-window/CMakeLists.txt @@ -2,11 +2,11 @@ cmake_minimum_required(VERSION 3.15 FATAL_ERROR) project(rocprofsys-trace-time-window-example LANGUAGES CXX) -if(OMNITRACE_DISABLE_EXAMPLES) +if(ROCPROFSYS_DISABLE_EXAMPLES) get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME) - if(${PROJECT_NAME} IN_LIST OMNITRACE_DISABLE_EXAMPLES OR ${_DIR} IN_LIST - OMNITRACE_DISABLE_EXAMPLES) + if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST + ROCPROFSYS_DISABLE_EXAMPLES) return() endif() endif() @@ -16,7 +16,7 @@ set(CMAKE_BUILD_TYPE "Debug") add_executable(trace-time-window trace-time-window.cpp) target_compile_options(trace-time-window PRIVATE ${_FLAGS}) -if(OMNITRACE_INSTALL_EXAMPLES) +if(ROCPROFSYS_INSTALL_EXAMPLES) install( TARGETS trace-time-window DESTINATION bin diff --git a/examples/transpose/CMakeLists.txt b/examples/transpose/CMakeLists.txt index 83c65ec0..bd46a547 100644 --- a/examples/transpose/CMakeLists.txt +++ b/examples/transpose/CMakeLists.txt @@ -2,11 +2,11 @@ cmake_minimum_required(VERSION 3.16 FATAL_ERROR) project(rocprofsys-transpose-example LANGUAGES CXX) -if(OMNITRACE_DISABLE_EXAMPLES) +if(ROCPROFSYS_DISABLE_EXAMPLES) get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME) - if(${PROJECT_NAME} IN_LIST OMNITRACE_DISABLE_EXAMPLES OR ${_DIR} IN_LIST - OMNITRACE_DISABLE_EXAMPLES) + if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST + ROCPROFSYS_DISABLE_EXAMPLES) return() endif() endif() @@ -36,7 +36,7 @@ endif() if((NOT CMAKE_CXX_COMPILER_IS_HIPCC OR (NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT hip_FOUND)) - AND (NOT COMMAND omnitrace_custom_compilation AND NOT HIPCC_EXECUTABLE)) + AND (NOT COMMAND rocprofsys_custom_compilation AND NOT HIPCC_EXECUTABLE)) message(AUTHOR_WARNING "transpose target could not be built") return() endif() @@ -73,10 +73,10 @@ endif() if(NOT CMAKE_CXX_COMPILER_IS_HIPCC AND HIPCC_EXECUTABLE) # defined in MacroUtilities.cmake - omnitrace_custom_compilation(COMPILER ${HIPCC_EXECUTABLE} TARGET transpose) + rocprofsys_custom_compilation(COMPILER ${HIPCC_EXECUTABLE} TARGET transpose) endif() -if(OMNITRACE_INSTALL_EXAMPLES) +if(ROCPROFSYS_INSTALL_EXAMPLES) install( TARGETS transpose DESTINATION bin diff --git a/examples/user-api/CMakeLists.txt b/examples/user-api/CMakeLists.txt index db3008b9..92ee9cb9 100644 --- a/examples/user-api/CMakeLists.txt +++ b/examples/user-api/CMakeLists.txt @@ -2,11 +2,11 @@ cmake_minimum_required(VERSION 3.16 FATAL_ERROR) project(rocprofsys-user-api-example LANGUAGES CXX) -if(OMNITRACE_DISABLE_EXAMPLES) +if(ROCPROFSYS_DISABLE_EXAMPLES) get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME) - if(${PROJECT_NAME} IN_LIST OMNITRACE_DISABLE_EXAMPLES OR ${_DIR} IN_LIST - OMNITRACE_DISABLE_EXAMPLES) + if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST + ROCPROFSYS_DISABLE_EXAMPLES) return() endif() endif() @@ -20,7 +20,7 @@ add_executable(user-api user-api.cpp) target_link_libraries(user-api PRIVATE Threads::Threads rocprofsys::rocprofsys-user-library) -if(OMNITRACE_INSTALL_EXAMPLES) +if(ROCPROFSYS_INSTALL_EXAMPLES) install( TARGETS user-api DESTINATION bin diff --git a/examples/user-api/user-api.cpp b/examples/user-api/user-api.cpp index e6908f64..66746ffa 100644 --- a/examples/user-api/user-api.cpp +++ b/examples/user-api/user-api.cpp @@ -26,15 +26,15 @@ custom_push_region(const char* name); namespace { -omnitrace_user_callbacks_t custom_callbacks = OMNITRACE_USER_CALLBACKS_INIT; -omnitrace_user_callbacks_t original_callbacks = OMNITRACE_USER_CALLBACKS_INIT; +omnitrace_user_callbacks_t custom_callbacks = ROCPROFSYS_USER_CALLBACKS_INIT; +omnitrace_user_callbacks_t original_callbacks = ROCPROFSYS_USER_CALLBACKS_INIT; } // namespace int main(int argc, char** argv) { custom_callbacks.push_region = &custom_push_region; - omnitrace_user_configure(OMNITRACE_USER_UNION_CONFIG, custom_callbacks, + omnitrace_user_configure(ROCPROFSYS_USER_UNION_CONFIG, custom_callbacks, &original_callbacks); omnitrace_user_push_region(argv[0]); @@ -102,7 +102,7 @@ int custom_push_region(const char* name) { if(!original_callbacks.push_region || !original_callbacks.push_annotated_region) - return OMNITRACE_USER_ERROR_NO_BINDING; + return ROCPROFSYS_USER_ERROR_NO_BINDING; printf("Pushing custom region :: %s\n", name); @@ -114,7 +114,7 @@ custom_push_region(const char* name) if(_err != 0) _msg = strerror_r(_err, _buff, sizeof(_buff)); omnitrace_annotation_t _annotations[] = { - { "errno", OMNITRACE_INT32, &_err }, { "strerror", OMNITRACE_STRING, _msg } + { "errno", ROCPROFSYS_INT32, &_err }, { "strerror", ROCPROFSYS_STRING, _msg } }; errno = 0; // reset errno diff --git a/scripts/build-release.sh b/scripts/build-release.sh index 227f9be0..699736df 100755 --- a/scripts/build-release.sh +++ b/scripts/build-release.sh @@ -196,12 +196,12 @@ NPROC=$(nproc) if [ ${NJOBS} -gt ${NPROC} ]; then NJOBS=${NPROC}; fi CMAKE_ARGS="-DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=OFF -DCPACK_GENERATOR=STGZ" -OMNITRACE_GENERAL_ARGS="-DOMNITRACE_CPACK_SYSTEM_NAME=${DISTRO} -DOMNITRACE_ROCM_VERSION=${ROCM_VERSION} -DOMNITRACE_MAX_THREADS=${MAX_THREADS} -DOMNITRACE_STRIP_LIBRARIES=${STRIP} -DOMNITRACE_INSTALL_PERFETTO_TOOLS=${PERFETTO_TOOLS}" -OMNITRACE_BUILD_ARGS="-DOMNITRACE_BUILD_TESTING=OFF -DOMNITRACE_BUILD_EXAMPLES=OFF -DOMNITRACE_BUILD_PAPI=ON -DOMNITRACE_BUILD_LTO=${LTO} -DOMNITRACE_BUILD_HIDDEN_VISIBILITY=${HIDDEN_VIZ} -DOMNITRACE_BUILD_STATIC_LIBGCC=${LIBGCC} -DOMNITRACE_BUILD_STATIC_LIBSTDCXX=${LIBSTDCXX} -DOMNITRACE_BUILD_RELEASE=ON" -OMNITRACE_USE_ARGS="-DOMNITRACE_USE_MPI_HEADERS=ON -DOMNITRACE_USE_OMPT=ON -DOMNITRACE_USE_PAPI=ON" +ROCPROFSYS_GENERAL_ARGS="-DROCPROFSYS_CPACK_SYSTEM_NAME=${DISTRO} -DROCPROFSYS_ROCM_VERSION=${ROCM_VERSION} -DROCPROFSYS_MAX_THREADS=${MAX_THREADS} -DROCPROFSYS_STRIP_LIBRARIES=${STRIP} -DROCPROFSYS_INSTALL_PERFETTO_TOOLS=${PERFETTO_TOOLS}" +ROCPROFSYS_BUILD_ARGS="-DROCPROFSYS_BUILD_TESTING=OFF -DROCPROFSYS_BUILD_EXAMPLES=OFF -DROCPROFSYS_BUILD_PAPI=ON -DROCPROFSYS_BUILD_LTO=${LTO} -DROCPROFSYS_BUILD_HIDDEN_VISIBILITY=${HIDDEN_VIZ} -DROCPROFSYS_BUILD_STATIC_LIBGCC=${LIBGCC} -DROCPROFSYS_BUILD_STATIC_LIBSTDCXX=${LIBSTDCXX} -DROCPROFSYS_BUILD_RELEASE=ON" +ROCPROFSYS_USE_ARGS="-DROCPROFSYS_USE_MPI_HEADERS=ON -DROCPROFSYS_USE_OMPT=ON -DROCPROFSYS_USE_PAPI=ON" TIMEMORY_ARGS="-DTIMEMORY_USE_LIBUNWIND=ON -DTIMEMORY_BUILD_LIBUNWIND=ON -DTIMEMORY_BUILD_PORTABLE=ON" -DYNINST_ARGS="-DOMNITRACE_BUILD_DYNINST=ON -DDYNINST_USE_OpenMP=ON $(echo -DDYNINST_BUILD_{TBB,BOOST,ELFUTILS,LIBIBERTY}=ON) -DDYNINST_BOOST_DOWNLOAD_VERSION=${BOOST_VERSION}" -STANDARD_ARGS="${CMAKE_ARGS} ${OMNITRACE_GENERAL_ARGS} ${OMNITRACE_USE_ARGS} ${OMNITRACE_BUILD_ARGS} ${TIMEMORY_ARGS} ${DYNINST_ARGS} ${EXTRA_ARGS}" +DYNINST_ARGS="-DROCPROFSYS_BUILD_DYNINST=ON -DDYNINST_USE_OpenMP=ON $(echo -DDYNINST_BUILD_{TBB,BOOST,ELFUTILS,LIBIBERTY}=ON) -DDYNINST_BOOST_DOWNLOAD_VERSION=${BOOST_VERSION}" +STANDARD_ARGS="${CMAKE_ARGS} ${ROCPROFSYS_GENERAL_ARGS} ${ROCPROFSYS_USE_ARGS} ${ROCPROFSYS_BUILD_ARGS} ${TIMEMORY_ARGS} ${DYNINST_ARGS} ${EXTRA_ARGS}" SCRIPT_DIR=$(realpath $(dirname ${BASH_SOURCE[0]})) cd $(dirname ${SCRIPT_DIR}) @@ -344,7 +344,7 @@ build-and-package-python() fi conda deactivate done - build-and-package-base ${DIR}-python $@ -DOMNITRACE_USE_PYTHON=ON -DOMNITRACE_BUILD_PYTHON=ON -DOMNITRACE_PYTHON_ROOT_DIRS=\"${_PYTHON_ENVS}\" + build-and-package-base ${DIR}-python $@ -DROCPROFSYS_USE_PYTHON=ON -DROCPROFSYS_BUILD_PYTHON=ON -DROCPROFSYS_PYTHON_ROOT_DIRS=\"${_PYTHON_ENVS}\" } build-and-package() @@ -372,7 +372,7 @@ if [ "${IS_DOCKER}" -ne 0 ]; then git config --global --add safe.directory ${PWD verbose-run echo "Build omnitrace installers with generators: ${GENERATORS}" -build-and-package ${WITH_CORE} ${DISTRO}-core -DOMNITRACE_USE_HIP=OFF -DOMNITRACE_USE_MPI=OFF -build-and-package ${WITH_MPI} ${DISTRO}-${MPI_IMPL} -DOMNITRACE_USE_HIP=OFF -DOMNITRACE_USE_MPI=ON -build-and-package ${WITH_ROCM} ${DISTRO}-rocm-${ROCM_VERSION} -DOMNITRACE_USE_HIP=ON -DOMNITRACE_USE_MPI=OFF -build-and-package ${WITH_ROCM_MPI} ${DISTRO}-rocm-${ROCM_VERSION}-${MPI_IMPL} -DOMNITRACE_USE_HIP=ON -DOMNITRACE_USE_MPI=ON +build-and-package ${WITH_CORE} ${DISTRO}-core -DROCPROFSYS_USE_HIP=OFF -DROCPROFSYS_USE_MPI=OFF +build-and-package ${WITH_MPI} ${DISTRO}-${MPI_IMPL} -DROCPROFSYS_USE_HIP=OFF -DROCPROFSYS_USE_MPI=ON +build-and-package ${WITH_ROCM} ${DISTRO}-rocm-${ROCM_VERSION} -DROCPROFSYS_USE_HIP=ON -DROCPROFSYS_USE_MPI=OFF +build-and-package ${WITH_ROCM_MPI} ${DISTRO}-rocm-${ROCM_VERSION}-${MPI_IMPL} -DROCPROFSYS_USE_HIP=ON -DROCPROFSYS_USE_MPI=ON diff --git a/scripts/dl-gen.py b/scripts/dl-gen.py index f725ec89..0f5894ff 100755 --- a/scripts/dl-gen.py +++ b/scripts/dl-gen.py @@ -18,13 +18,13 @@ ##### declaration: - bool OnLoad(HsaApiTable*, uint64_t, uint64_t, const char* const*) OMNITRACE_PUBLIC_API; - void OnUnload() OMNITRACE_PUBLIC_API; + bool OnLoad(HsaApiTable*, uint64_t, uint64_t, const char* const*) ROCPROFSYS_PUBLIC_API; + void OnUnload() ROCPROFSYS_PUBLIC_API; ##### dlsym: - OMNITRACE_DLSYM(OnLoad_f, m_omnihandle, "OnLoad"); - OMNITRACE_DLSYM(OnUnload_f, m_omnihandle, "OnUnload"); + ROCPROFSYS_DLSYM(OnLoad_f, m_omnihandle, "OnLoad"); + ROCPROFSYS_DLSYM(OnUnload_f, m_omnihandle, "OnUnload"); ##### member variables: @@ -35,12 +35,12 @@ bool OnLoad(HsaApiTable* table, uint64_t runtime_version, uint64_t failed_tool_count, const char* const* failed_tool_names) { - return OMNITRACE_DL_INVOKE(get_indirect().OnLoad_f, table, runtime_version, failed_tool_count, failed_tool_names); + return ROCPROFSYS_DL_INVOKE(get_indirect().OnLoad_f, table, runtime_version, failed_tool_count, failed_tool_names); } void OnUnload() { - return OMNITRACE_DL_INVOKE(get_indirect().OnUnload_f); + return ROCPROFSYS_DL_INVOKE(get_indirect().OnUnload_f); } """ @@ -69,18 +69,18 @@ def member_variables(self): ) def function_decl(self): - return " {} {}({}) OMNITRACE_PUBLIC_API;".format( + return " {} {}({}) ROCPROFSYS_PUBLIC_API;".format( self.return_type, self.func_name, ", ".join(self.param_types) ) def dlsym_function(self): - return ' OMNITRACE_DLSYM({0}_f, m_omnihandle, "{0}");'.format(self.func_name) + return ' ROCPROFSYS_DLSYM({0}_f, m_omnihandle, "{0}");'.format(self.func_name) def call_dlsym_function(self): _param_names = ", ".join(self.param_names) if _param_names and _param_names != ", ": _param_names = f", {_param_names}" - return " {} {}({})\n {}\n return OMNITRACE_DL_INVOKE(get_indirect().{}_f{});\n {}".format( + return " {} {}({})\n {}\n return ROCPROFSYS_DL_INVOKE(get_indirect().{}_f{});\n {}".format( self.return_type, self.func_name, ", ".join(self.params), diff --git a/scripts/omnitrace-launch-compiler b/scripts/omnitrace-launch-compiler index 5df1ecb3..1336ec45 100755 --- a/scripts/omnitrace-launch-compiler +++ b/scripts/omnitrace-launch-compiler @@ -15,11 +15,11 @@ # emit a message about the underlying command executed : ${DEBUG:=0} -: ${OMNITRACE_DEBUG_LAUNCH_COMPILER:=${DEBUG}} +: ${ROCPROFSYS_DEBUG_LAUNCH_COMPILER:=${DEBUG}} debug-message() { - if [ "${OMNITRACE_DEBUG_LAUNCH_COMPILER}" -ne 0 ]; then + if [ "${ROCPROFSYS_DEBUG_LAUNCH_COMPILER}" -ne 0 ]; then echo -e "##### $(basename ${BASH_SOURCE[0]}) executing: \"$@\"... #####" fi } @@ -44,7 +44,7 @@ fi if [ -z "${3}" ]; then exit 0; fi # store the omnitrace compiler -OMNITRACE_COMPILER=${1} +ROCPROFSYS_COMPILER=${1} # remove the omnitrace compiler from the arguments shift @@ -81,19 +81,19 @@ fi if [[ "${CXX_COMPILER}" != "${1}" ]]; then debug-message $@ - # the command does not depend on omnitrace so just execute the command w/o re-directing to ${OMNITRACE_COMPILER} + # the command does not depend on omnitrace so just execute the command w/o re-directing to ${ROCPROFSYS_COMPILER} eval $@ else - # 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" + # the executable is the C++ compiler, so we need to re-direct to ${ROCPROFSYS_COMPILER} + if [ ! -f "${ROCPROFSYS_COMPILER}" ]; then + echo -e "\nError: the compiler redirect for omnitrace was not found at ${ROCPROFSYS_COMPILER}\n" exit 1 fi # discard the compiler from the command shift - debug-message ${OMNITRACE_COMPILER} $@ - # execute ${OMNITRACE_COMPILER} (again, usually nvcc_wrapper) - ${OMNITRACE_COMPILER} $@ + debug-message ${ROCPROFSYS_COMPILER} $@ + # execute ${ROCPROFSYS_COMPILER} (again, usually nvcc_wrapper) + ${ROCPROFSYS_COMPILER} $@ fi diff --git a/scripts/run-ci.py b/scripts/run-ci.py index f77557ef..398f9654 100755 --- a/scripts/run-ci.py +++ b/scripts/run-ci.py @@ -66,7 +66,7 @@ def generate_custom(args, cmake_args, ctest_args): set(CTEST_BINARY_DIRECTORY {BINARY_DIR}) set(CTEST_UPDATE_COMMAND {GIT_CMD}) - set(CTEST_CONFIGURE_COMMAND "{CMAKE_CMD} -B {BINARY_DIR} {SOURCE_DIR} -DOMNITRACE_BUILD_CI=ON {CMAKE_ARGS}") + set(CTEST_CONFIGURE_COMMAND "{CMAKE_CMD} -B {BINARY_DIR} {SOURCE_DIR} -DROCPROFSYS_BUILD_CI=ON {CMAKE_ARGS}") set(CTEST_BUILD_COMMAND "{CMAKE_CMD} --build {BINARY_DIR} --target all --parallel {BUILD_JOBS}") set(CTEST_COVERAGE_COMMAND {GCOV_CMD}) """ @@ -219,7 +219,7 @@ def parse_args(args=None): cdash_args = parse_cdash_args(input_args) if cdash_args.coverage: - cmake_args += ["-DOMNITRACE_BUILD_CODECOV=ON", "-DOMNITRACE_STRIP_LIBRARIES=OFF"] + cmake_args += ["-DROCPROFSYS_BUILD_CODECOV=ON", "-DROCPROFSYS_STRIP_LIBRARIES=OFF"] def get_repeat_val(_param): _value = getattr(cdash_args, f"repeat_{_param}".replace("-", "_")) diff --git a/scripts/run-ci.sh b/scripts/run-ci.sh index f66fa666..694e7e42 100755 --- a/scripts/run-ci.sh +++ b/scripts/run-ci.sh @@ -159,7 +159,7 @@ export CMAKE_BUILD_PARALLEL_LEVEL if [ "${CODECOV}" -gt 0 ]; then GCOV_CMD=$(which gcov) - CMAKE_ARGS="${CMAKE_ARGS} -DOMNITRACE_BUILD_CODECOV=ON -DOMNITRACE_STRIP_LIBRARIES=OFF" + CMAKE_ARGS="${CMAKE_ARGS} -DROCPROFSYS_BUILD_CODECOV=ON -DROCPROFSYS_STRIP_LIBRARIES=OFF" fi GIT_CMD=$(which git) @@ -199,7 +199,7 @@ set(CTEST_SOURCE_DIRECTORY ${SOURCE_DIR}) set(CTEST_BINARY_DIRECTORY ${BINARY_DIR}) set(CTEST_UPDATE_COMMAND ${GIT_CMD}) -set(CTEST_CONFIGURE_COMMAND "${CMAKE_CMD} -B ${BINARY_DIR} ${SOURCE_DIR} -DOMNITRACE_BUILD_CI=ON ${CMAKE_ARGS}") +set(CTEST_CONFIGURE_COMMAND "${CMAKE_CMD} -B ${BINARY_DIR} ${SOURCE_DIR} -DROCPROFSYS_BUILD_CI=ON ${CMAKE_ARGS}") set(CTEST_BUILD_COMMAND "${CMAKE_CMD} --build ${BINARY_DIR} --target all --parallel ${CMAKE_BUILD_PARALLEL_LEVEL}") set(CTEST_COVERAGE_COMMAND ${GCOV_CMD}) EOF diff --git a/scripts/test-find-package.sh b/scripts/test-find-package.sh index f397d770..ebe7bbcd 100755 --- a/scripts/test-find-package.sh +++ b/scripts/test-find-package.sh @@ -23,9 +23,9 @@ fi : ${EXAMPLE_DIR:=examples} : ${EXAMPLE_NAME:=user-api} -: ${SOURCE_DIR:=$(mktemp -t -d omnitrace-test-source-XXXX)} -: ${BINARY_DIR:=$(mktemp -t -d omnitrace-test-build-XXXX)} -: ${INSTALL_DIR:=$(mktemp -t -d omnitrace-install-XXXX)} +: ${SOURCE_DIR:=$(mktemp -t -d rocprofsys-test-source-XXXX)} +: ${BINARY_DIR:=$(mktemp -t -d rocprofsys-test-build-XXXX)} +: ${INSTALL_DIR:=$(mktemp -t -d rocprofsys-install-XXXX)} : ${INSTALL_SCRIPT:=""} usage() @@ -36,7 +36,7 @@ usage() print_option example-dir "" "Directory containing example" "${EXAMPLE_DIR}" print_option source-dir "" "Location to copy example to" "${SOURCE_DIR}" print_option binary-dir "" "Location to build" "${BINARY_DIR}" - print_option install-dir "" "Location of omnitrace installation" "${INSTALL_DIR}" + print_option install-dir "" "Location of rocprofsys installation" "${INSTALL_DIR}" print_option install-script "" "Absolute path to the installer script" "" } @@ -92,9 +92,9 @@ do esac done -if [ ! -f "${INSTALL_DIR}/include/omnitrace/user.h" ]; then +if [ ! -f "${INSTALL_DIR}/include/rocprof-sys/user.h" ]; then if [ -z "${INSTALL_SCRIPT}" ]; then - error-message "Unable to find \"omnitrace/user.h\" in \"${INSTALL_DIR}/include\" and installation script not provided" + error-message "Unable to find \"rocprof-sys/user.h\" in \"${INSTALL_DIR}/include\" and installation script not provided" elif [ ! -f "${INSTALL_SCRIPT}" ]; then error-message "Unable to locate \"${INSTALL_SCRIPT}\" in directory \"${PWD}\"" else @@ -122,10 +122,10 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_C_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON) -find_package(omnitrace REQUIRED COMPONENTS user) +find_package(rocprofsys REQUIRED COMPONENTS user) find_package(Threads REQUIRED) -get_target_property(LIBS omnitrace::omnitrace INTERFACE_LINK_LIBRARIES) +get_target_property(LIBS rocprofsys::rocprofsys INTERFACE_LINK_LIBRARIES) foreach(_LIB \${LIBS}) foreach(_VAR LINK_LIBRARIES INCLUDE_DIRECTORIES) get_target_property(_VAL \${_LIB} INTERFACE_\${_VAR}) @@ -137,7 +137,7 @@ endforeach() file(GLOB sources \${CMAKE_CURRENT_LIST_DIR}/*.cpp \${CMAKE_CURRENT_LIST_DIR}/*.c) add_executable(app \${sources}) -target_link_libraries(app PRIVATE Threads::Threads omnitrace::omnitrace) +target_link_libraries(app PRIVATE Threads::Threads rocprofsys::rocprofsys) EOF export CMAKE_PREFIX_PATH=${INSTALL_DIR}:${CMAKE_PREFIX_PATH} diff --git a/scripts/test-release.sh b/scripts/test-release.sh index e94da96f..d47110b0 100755 --- a/scripts/test-release.sh +++ b/scripts/test-release.sh @@ -141,7 +141,7 @@ test-deb() test-install /opt/rocprof-sys remove-pycache /opt/rocprof-sys - verbose-run apt-get remove -y omnitrace + verbose-run apt-get remove -y rocprof-sys if [ -d /opt/rocprof-sys ]; then find /opt/rocprof-sys -type f fi @@ -159,7 +159,7 @@ test-rpm() test-install /opt/rocprof-sys remove-pycache /opt/rocprof-sys - verbose-run rpm -e omnitrace + verbose-run rpm -e rocprof-sys if [ -d /opt/rocprof-sys ]; then find /opt/rocprof-sys -type f fi diff --git a/scripts/write-rocprofsys-install.cmake b/scripts/write-rocprof-sys-install.cmake similarity index 78% rename from scripts/write-rocprofsys-install.cmake rename to scripts/write-rocprof-sys-install.cmake index 2671ac31..b15677b8 100644 --- a/scripts/write-rocprofsys-install.cmake +++ b/scripts/write-rocprof-sys-install.cmake @@ -1,10 +1,10 @@ cmake_minimum_required(VERSION 3.8) -if(NOT DEFINED OMNITRACE_VERSION) +if(NOT DEFINED ROCPROFSYS_VERSION) file(READ "${CMAKE_CURRENT_LIST_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}") + ROCPROFSYS_VERSION "${FULL_VERSION_STRING}") endif() if(NOT DEFINED OUTPUT_DIR) @@ -13,8 +13,8 @@ endif() message( STATUS - "Writing ${OUTPUT_DIR}/rocprof-sys-install.py for rocprof-sys v${OMNITRACE_VERSION}" + "Writing ${OUTPUT_DIR}/rocprof-sys-install.py for rocprof-sys v${ROCPROFSYS_VERSION}" ) -configure_file(${CMAKE_CURRENT_LIST_DIR}/../cmake/Templates/rocprofsys-install.py.in +configure_file(${CMAKE_CURRENT_LIST_DIR}/../cmake/Templates/rocprof-sys-install.py.in ${OUTPUT_DIR}/rocprof-sys-install.py @ONLY) diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 5d9e2e63..efb3d72c 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -2,7 +2,7 @@ if(NOT DEFINED CMAKE_INTERPROCEDURAL_OPTIMIZATION) set(CMAKE_INTERPROCEDURAL_OPTIMIZATION OFF) endif() -if(OMNITRACE_BUILD_LTO) +if(ROCPROFSYS_BUILD_LTO) set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON) endif() @@ -13,11 +13,11 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR} add_subdirectory(lib) add_subdirectory(bin) -if(OMNITRACE_USE_PYTHON) +if(ROCPROFSYS_USE_PYTHON) add_subdirectory(python) endif() -if(OMNITRACE_BUILD_DEVELOPER) +if(ROCPROFSYS_BUILD_DEVELOPER) add_custom_target(rocprofsys-precommit) foreach(_TARGET format-rocprofsys-source format-rocprofsys-cmake format-timemory-source format-timemory-cmake) diff --git a/source/bin/CMakeLists.txt b/source/bin/CMakeLists.txt index 69967183..c5c9f76a 100644 --- a/source/bin/CMakeLists.txt +++ b/source/bin/CMakeLists.txt @@ -1,14 +1,14 @@ # executable RPATH -if(OMNITRACE_USE_ROCPROFILER +if(ROCPROFSYS_USE_ROCPROFILER AND rocprofiler_LIBRARY_DIR AND ROCmVersion_TRIPLE_VERSION VERSION_LESS 5.2.0 AND NOT CMAKE_INSTALL_RPATH_USE_LINK_PATH) - set(OMNITRACE_EXE_INSTALL_RPATH + set(ROCPROFSYS_EXE_INSTALL_RPATH "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}/${PACKAGE_NAME}:${rocprofiler_LIBRARY_DIR}" ) else() - set(OMNITRACE_EXE_INSTALL_RPATH + set(ROCPROFSYS_EXE_INSTALL_RPATH "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}/${PACKAGE_NAME}" ) endif() @@ -21,6 +21,6 @@ add_subdirectory(omnitrace-instrument) add_subdirectory(omnitrace-run) # tests -if(OMNITRACE_BUILD_TESTING OR "$ENV{ROCPROFSYS_CI}" MATCHES "[1-9]+|ON|on|y|yes") +if(ROCPROFSYS_BUILD_TESTING OR "$ENV{ROCPROFSYS_CI}" MATCHES "[1-9]+|ON|on|y|yes") add_subdirectory(tests) endif() diff --git a/source/bin/omnitrace-avail/CMakeLists.txt b/source/bin/omnitrace-avail/CMakeLists.txt index 70f013b1..fb83ae97 100644 --- a/source/bin/omnitrace-avail/CMakeLists.txt +++ b/source/bin/omnitrace-avail/CMakeLists.txt @@ -23,7 +23,7 @@ target_sources( ${CMAKE_CURRENT_LIST_DIR}/info_type.hpp) target_include_directories(rocprofsys-avail PRIVATE ${CMAKE_CURRENT_LIST_DIR}) -target_compile_definitions(rocprofsys-avail PRIVATE OMNITRACE_EXTERN_COMPONENTS=0) +target_compile_definitions(rocprofsys-avail PRIVATE ROCPROFSYS_EXTERN_COMPONENTS=0) target_link_libraries( rocprofsys-avail PRIVATE rocprofsys::rocprofsys-compile-definitions @@ -31,10 +31,10 @@ target_link_libraries( set_target_properties( rocprofsys-avail PROPERTIES BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}" - INSTALL_RPATH "${OMNITRACE_EXE_INSTALL_RPATH}" + INSTALL_RPATH "${ROCPROFSYS_EXE_INSTALL_RPATH}" OUTPUT_NAME rocprof-sys-avail) -omnitrace_strip_target(rocprofsys-avail) +rocprofsys_strip_target(rocprofsys-avail) install( TARGETS rocprofsys-avail diff --git a/source/bin/omnitrace-avail/avail.cpp b/source/bin/omnitrace-avail/avail.cpp index 60466d2a..844ae1e1 100644 --- a/source/bin/omnitrace-avail/avail.cpp +++ b/source/bin/omnitrace-avail/avail.cpp @@ -202,7 +202,7 @@ main(int argc, char** argv) std::min(_cols - parser.get_help_width() - 8, 120)); parser.enable_help(); - parser.enable_version("rocprof-sys-avail", OMNITRACE_ARGPARSE_VERSION_INFO); + parser.enable_version("rocprof-sys-avail", ROCPROFSYS_ARGPARSE_VERSION_INFO); parser.start_group("DEBUG"); @@ -508,13 +508,13 @@ main(int argc, char** argv) return EXIT_FAILURE; } -#if OMNITRACE_USE_HIP > 0 +#if ROCPROFSYS_USE_HIP > 0 if(gpu_count > 0) { size_t _num_metrics = 0; try { - // call to rocm_metrics() will add choices to OMNITRACE_ROCM_EVENTS setting + // call to rocm_metrics() will add choices to ROCPROFSYS_ROCM_EVENTS setting // so always perform this call even if list of HW counters is not requested _num_metrics = omnitrace::rocprofiler::rocm_metrics().size(); } catch(std::runtime_error& _e) diff --git a/source/bin/omnitrace-avail/common.hpp b/source/bin/omnitrace-avail/common.hpp index 889864e2..49e4a2b8 100644 --- a/source/bin/omnitrace-avail/common.hpp +++ b/source/bin/omnitrace-avail/common.hpp @@ -110,10 +110,10 @@ extern std::stringstream lerr; extern std::set settings_exclude; // exclude some timemory settings which are not relevant to omnitrace -// exact matches, e.g. OMNITRACE_BANNER +// exact matches, e.g. ROCPROFSYS_BANNER extern std::string settings_rexclude_exact; -// leading matches, e.g. OMNITRACE_MPI_[A-Z_]+ +// leading matches, e.g. ROCPROFSYS_MPI_[A-Z_]+ extern std::string settings_rexclude_begin; constexpr size_t max_error_message_buffer_length = 4096; diff --git a/source/bin/omnitrace-avail/generate_config.cpp b/source/bin/omnitrace-avail/generate_config.cpp index 3792f9f7..7173931f 100644 --- a/source/bin/omnitrace-avail/generate_config.cpp +++ b/source/bin/omnitrace-avail/generate_config.cpp @@ -163,9 +163,9 @@ struct setting_serialization, custom_setting_serializer> template void push(type_list) { - OMNITRACE_FOLD_EXPRESSION( + ROCPROFSYS_FOLD_EXPRESSION( settings::push_serialize_map_callback()); - OMNITRACE_FOLD_EXPRESSION( + ROCPROFSYS_FOLD_EXPRESSION( settings::push_serialize_data_callback( type_list{})); } @@ -173,9 +173,9 @@ void push(type_list) template void pop(type_list) { - OMNITRACE_FOLD_EXPRESSION( + ROCPROFSYS_FOLD_EXPRESSION( settings::pop_serialize_map_callback()); - OMNITRACE_FOLD_EXPRESSION( + ROCPROFSYS_FOLD_EXPRESSION( settings::pop_serialize_data_callback( type_list{})); } @@ -245,7 +245,7 @@ generate_config(std::string _config_file, const std::set& _config_f auto _serialize = [_settings](auto&& _ar) { _ar->setNextName(TIMEMORY_PROJECT_NAME); _ar->startNode(); - (*_ar)(cereal::make_nvp("version", std::string{ OMNITRACE_VERSION_STRING })); + (*_ar)(cereal::make_nvp("version", std::string{ ROCPROFSYS_VERSION_STRING })); (*_ar)(cereal::make_nvp("date", tim::get_local_datetime("%F_%H.%M", &_time))); settings::serialize_settings(*_ar, *_settings); _ar->finishNode(); @@ -424,7 +424,7 @@ generate_config(std::string _config_file, const std::set& _config_f std::ofstream ofs{}; _open(ofs, _fname, "text") << "# auto-generated by rocprof-sys-avail (version " - << OMNITRACE_VERSION_STRING << ") on " + << ROCPROFSYS_VERSION_STRING << ") on " << tim::get_local_datetime("%F @ %H:%M", &_time) << "\n\n" << _ss.str(); } diff --git a/source/bin/omnitrace-causal/CMakeLists.txt b/source/bin/omnitrace-causal/CMakeLists.txt index de871024..b3854429 100644 --- a/source/bin/omnitrace-causal/CMakeLists.txt +++ b/source/bin/omnitrace-causal/CMakeLists.txt @@ -18,10 +18,10 @@ target_link_libraries( set_target_properties( rocprofsys-causal PROPERTIES BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}" - INSTALL_RPATH "${OMNITRACE_EXE_INSTALL_RPATH}" + INSTALL_RPATH "${ROCPROFSYS_EXE_INSTALL_RPATH}" OUTPUT_NAME "rocprof-sys-causal") -omnitrace_strip_target(rocprofsys-causal) +rocprofsys_strip_target(rocprofsys-causal) install( TARGETS rocprofsys-causal diff --git a/source/bin/omnitrace-causal/impl.cpp b/source/bin/omnitrace-causal/impl.cpp index 377a0e04..adaf444c 100644 --- a/source/bin/omnitrace-causal/impl.cpp +++ b/source/bin/omnitrace-causal/impl.cpp @@ -451,7 +451,7 @@ parse_args(int argc, char** argv, std::vector& _env, }); parser.enable_help(); - parser.enable_version("rocprof-sys-causal", OMNITRACE_ARGPARSE_VERSION_INFO); + parser.enable_version("rocprof-sys-causal", ROCPROFSYS_ARGPARSE_VERSION_INFO); auto _cols = std::get<0>(console::get_columns()); if(_cols > parser.get_help_width() + 8) @@ -528,7 +528,7 @@ parse_args(int argc, char** argv, std::vector& _env, "Do not activate default features which are recommended for causal " "profiling. For example: PID-tagging of output files and " "timestamped subdirectories are disabled by default. Kokkos tools " - "support is added by default (OMNITRACE_USE_KOKKOSP=ON) because, " + "support is added by default (ROCPROFSYS_USE_KOKKOSP=ON) because, " "for Kokkos applications, the Kokkos-Tools callbacks are used for " "progress points. Activation of OpenMP tools support is similar") .min_count(0) @@ -752,7 +752,7 @@ parse_args(int argc, char** argv, std::vector& _env, parser.end_group(); -#if OMNITRACE_HIP_VERSION > 0 && OMNITRACE_HIP_VERSION < 50300 +#if ROCPROFSYS_HIP_VERSION > 0 && ROCPROFSYS_HIP_VERSION < 50300 update_env(_env, "HSA_ENABLE_INTERRUPT", 0); #endif @@ -815,21 +815,21 @@ parse_args(int argc, char** argv, std::vector& _env, add_default_env(_env, "ROCPROFSYS_USE_PID", false); add_default_env(_env, "ROCPROFSYS_USE_KOKKOSP", true); -#if defined(OMNITRACE_USE_OMPT) && OMNITRACE_USE_OMPT > 0 +#if defined(ROCPROFSYS_USE_OMPT) && ROCPROFSYS_USE_OMPT > 0 add_default_env(_env, "ROCPROFSYS_USE_OMPT", true); #endif -#if(defined(OMNITRACE_USE_MPI) && OMNITRACE_USE_MPI > 0) || \ - (defined(OMNITRACE_USE_MPI_HEADERS) && OMNITRACE_USE_MPI_HEADERS > 0) +#if(defined(ROCPROFSYS_USE_MPI) && ROCPROFSYS_USE_MPI > 0) || \ + (defined(ROCPROFSYS_USE_MPI_HEADERS) && ROCPROFSYS_USE_MPI_HEADERS > 0) add_default_env(_env, "ROCPROFSYS_USE_MPIP", true); #endif -#if defined(OMNITRACE_USE_ROCTRACER) && OMNITRACE_USE_ROCTRACER > 0 +#if defined(ROCPROFSYS_USE_ROCTRACER) && ROCPROFSYS_USE_ROCTRACER > 0 add_default_env(_env, "ROCPROFSYS_ROCTRACER_HIP_API", true); add_default_env(_env, "ROCPROFSYS_ROCTRACER_HSA_API", true); #endif -#if defined(OMNITRACE_USE_RCCL) && OMNITRACE_USE_RCCL > 0 +#if defined(ROCPROFSYS_USE_RCCL) && ROCPROFSYS_USE_RCCL > 0 add_default_env(_env, "ROCPROFSYS_USE_RCCLP", true); #endif } diff --git a/source/bin/omnitrace-exe/CMakeLists.txt b/source/bin/omnitrace-exe/CMakeLists.txt index db97b6a9..050d4b35 100644 --- a/source/bin/omnitrace-exe/CMakeLists.txt +++ b/source/bin/omnitrace-exe/CMakeLists.txt @@ -11,12 +11,12 @@ target_link_libraries(rocprofsys-exe PRIVATE rocprofsys::rocprofsys-threading) set_target_properties( rocprofsys-exe - PROPERTIES OUTPUT_NAME omnitrace + PROPERTIES OUTPUT_NAME rocprof-sys BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}" - INSTALL_RPATH "${OMNITRACE_EXE_INSTALL_RPATH}" + INSTALL_RPATH "${ROCPROFSYS_EXE_INSTALL_RPATH}" INSTALL_RPATH_USE_LINK_PATH ON) -omnitrace_strip_target(rocprofsys-exe) +rocprofsys_strip_target(rocprofsys-exe) install( TARGETS rocprofsys-exe diff --git a/source/bin/omnitrace-exe/omnitrace.cpp b/source/bin/omnitrace-exe/omnitrace.cpp index defaeabf..4284c4e6 100644 --- a/source/bin/omnitrace-exe/omnitrace.cpp +++ b/source/bin/omnitrace-exe/omnitrace.cpp @@ -66,14 +66,14 @@ main(int argc, char** argv) gggggg - ROCm Systems Profiler has renamed the "omnitrace" executable to "rocprof-sys-instrument" to reduce confusion. + ROCm Systems Profiler has renamed the "omnitrace" executable to "rocprof-sys-instrument". This executable only exists to provide this deprecation warning and maintain backwards compatibility for a few releases. This executable will soon invoke "rocprof-sys-instrument" with the arguments you just provided after we've given you a chance to read this message. If you are running this job interactively, please acknowledge that you've read this message and whether you want to continue. - If you are running this job non-interactively, we will resume executing after ~1 minute unless CI or OMNITRACE_CI is defined + If you are running this job non-interactively, we will resume executing after ~1 minute unless CI or ROCPROFSYS_CI is defined in the environment, in which case, we will throw an error. Thanks for using ROCm Systems Profiler and happy optimizing! diff --git a/source/bin/omnitrace-instrument/CMakeLists.txt b/source/bin/omnitrace-instrument/CMakeLists.txt index 01490b2a..0f16af14 100644 --- a/source/bin/omnitrace-instrument/CMakeLists.txt +++ b/source/bin/omnitrace-instrument/CMakeLists.txt @@ -38,17 +38,17 @@ target_link_libraries( set_target_properties( rocprofsys-instrument PROPERTIES BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}" - INSTALL_RPATH "${OMNITRACE_EXE_INSTALL_RPATH}" + INSTALL_RPATH "${ROCPROFSYS_EXE_INSTALL_RPATH}" INSTALL_RPATH_USE_LINK_PATH ON OUTPUT_NAME "rocprof-sys-instrument") -if(OMNITRACE_BUILD_DYNINST) - target_compile_definitions(rocprofsys-instrument PRIVATE OMNITRACE_BUILD_DYNINST=1) +if(ROCPROFSYS_BUILD_DYNINST) + target_compile_definitions(rocprofsys-instrument PRIVATE ROCPROFSYS_BUILD_DYNINST=1) endif() add_target_flag_if_avail(rocprofsys-instrument "-Wno-deprecated-declarations") -omnitrace_strip_target(rocprofsys-instrument) +rocprofsys_strip_target(rocprofsys-instrument) if(CMAKE_BUILD_TYPE MATCHES "^(DEBUG|Debug)") string(REPLACE " " ";" _FLAGS "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") diff --git a/source/bin/omnitrace-instrument/details.cpp b/source/bin/omnitrace-instrument/details.cpp index 24d231b6..c73bc564 100644 --- a/source/bin/omnitrace-instrument/details.cpp +++ b/source/bin/omnitrace-instrument/details.cpp @@ -216,7 +216,7 @@ get_func_file_line_info(module_t* module, procedure_t* func) { using address_t = Dyninst::Address; - OMNITRACE_ADD_LOG_ENTRY("Getting function line info for", get_name(func)); + ROCPROFSYS_ADD_LOG_ENTRY("Getting function line info for", get_name(func)); auto _file_name = get_name(module); auto _func_name = get_name(func); @@ -249,7 +249,7 @@ function_signature get_loop_file_line_info(module_t* module, procedure_t* func, flow_graph_t*, basic_loop_t* loopToInstrument) { - OMNITRACE_ADD_LOG_ENTRY("Getting loop line info for", get_name(func)); + ROCPROFSYS_ADD_LOG_ENTRY("Getting loop line info for", get_name(func)); auto basic_blocks = std::vector{}; loopToInstrument->getLoopBasicBlocksExclusive(basic_blocks); @@ -343,7 +343,7 @@ get_basic_block_file_line_info(module_t* module, procedure_t* func) std::map _data{}; if(!func) return _data; - OMNITRACE_ADD_LOG_ENTRY("Getting basic block line info for", get_name(func)); + ROCPROFSYS_ADD_LOG_ENTRY("Getting basic block line info for", get_name(func)); auto* _cfg = func->getCFG(); auto _basic_blocks = std::set{}; @@ -421,7 +421,7 @@ get_basic_block_file_line_info(module_t* module, procedure_t* func) std::vector get_source_code(module_t* module, procedure_t* func) { - OMNITRACE_ADD_LOG_ENTRY("Getting source code for", get_name(func)); + ROCPROFSYS_ADD_LOG_ENTRY("Getting source code for", get_name(func)); std::vector _lines{}; if(!module || !func) return _lines; @@ -530,7 +530,7 @@ omnitrace_get_exe_realpath() if(!_cmd_line.empty()) { using array_config_t = timemory::join::array_config; - OMNITRACE_ADD_DETAILED_LOG_ENTRY(array_config_t{ " ", "[ ", " ]" }, + ROCPROFSYS_ADD_DETAILED_LOG_ENTRY(array_config_t{ " ", "[ ", " ]" }, "cmdline:: ", _cmd_line); return _cmd_line.front(); // return tim::filepath::realpath(_cmd_line.front(), nullptr, false); @@ -695,7 +695,7 @@ error_func_real(error_level_t level, int num, const char* const* params) const char* msg = bpatch->getEnglishErrorString(num); bpatch->formatErrorString(line, sizeof(line), msg, params); - OMNITRACE_ADD_LOG_ENTRY("Dyninst error function called with level", level, + ROCPROFSYS_ADD_LOG_ENTRY("Dyninst error function called with level", level, ":: ID# =", num, "::", line) .force(level < BPatchInfo); @@ -742,7 +742,7 @@ error_func_fake(error_level_t level, int num, const char* const* params) bpatch->formatErrorString(line, sizeof(line), msg, params); // just log it - OMNITRACE_ADD_LOG_ENTRY("Dyninst error function called with level", level, + ROCPROFSYS_ADD_LOG_ENTRY("Dyninst error function called with level", level, ":: ID# =", num, "::", line) .force(level < BPatchInfo); } diff --git a/source/bin/omnitrace-instrument/fwd.hpp b/source/bin/omnitrace-instrument/fwd.hpp index 93f803d7..34bf4221 100644 --- a/source/bin/omnitrace-instrument/fwd.hpp +++ b/source/bin/omnitrace-instrument/fwd.hpp @@ -268,7 +268,7 @@ extern std::unique_ptr log_ofs; { \ char _logmsgbuff[FUNCNAMELEN]; \ snprintf(_logmsgbuff, FUNCNAMELEN, __VA_ARGS__); \ - OMNITRACE_ADD_LOG_ENTRY(_logmsgbuff); \ + ROCPROFSYS_ADD_LOG_ENTRY(_logmsgbuff); \ if(werror || LEVEL < 0) \ { \ if(debug_print || verbose_level >= LEVEL) \ @@ -290,7 +290,7 @@ extern std::unique_ptr log_ofs; { \ char _logmsgbuff[FUNCNAMELEN]; \ snprintf(_logmsgbuff, FUNCNAMELEN, __VA_ARGS__); \ - OMNITRACE_ADD_LOG_ENTRY(_logmsgbuff); \ + ROCPROFSYS_ADD_LOG_ENTRY(_logmsgbuff); \ if(debug_print || verbose_level >= LEVEL) \ fprintf(stdout, "[rocprof-sys][exe] " __VA_ARGS__); \ fflush(stdout); \ @@ -300,7 +300,7 @@ extern std::unique_ptr log_ofs; { \ char _logmsgbuff[FUNCNAMELEN]; \ snprintf(_logmsgbuff, FUNCNAMELEN, __VA_ARGS__); \ - OMNITRACE_ADD_LOG_ENTRY(_logmsgbuff); \ + ROCPROFSYS_ADD_LOG_ENTRY(_logmsgbuff); \ if(debug_print || verbose_level >= LEVEL) fprintf(stdout, __VA_ARGS__); \ fflush(stdout); \ } diff --git a/source/bin/omnitrace-instrument/internal_libs.cpp b/source/bin/omnitrace-instrument/internal_libs.cpp index 129c2ee8..ea02060d 100644 --- a/source/bin/omnitrace-instrument/internal_libs.cpp +++ b/source/bin/omnitrace-instrument/internal_libs.cpp @@ -201,7 +201,7 @@ get_library_search_paths_impl() for(const auto& itr : { get_env("ROCPROFSYS_ROCM_PATH", ""), get_env("ROCM_PATH", ""), - std::string{ OMNITRACE_DEFAULT_ROCM_PATH } }) + std::string{ ROCPROFSYS_DEFAULT_ROCM_PATH } }) { if(!itr.empty()) { diff --git a/source/bin/omnitrace-instrument/log.hpp b/source/bin/omnitrace-instrument/log.hpp index beb19528..1d639fa9 100644 --- a/source/bin/omnitrace-instrument/log.hpp +++ b/source/bin/omnitrace-instrument/log.hpp @@ -81,12 +81,12 @@ struct log_entry bool); }; -#define OMNITRACE_ADD_LOG_ENTRY(...) \ +#define ROCPROFSYS_ADD_LOG_ENTRY(...) \ log_entry::add_log_entry( \ { log_entry::source_location{ __FUNCTION__, __FILE__, __LINE__ }, \ timemory::join::join(' ', __VA_ARGS__) }) -#define OMNITRACE_ADD_DETAILED_LOG_ENTRY(DELIM, ...) \ +#define ROCPROFSYS_ADD_DETAILED_LOG_ENTRY(DELIM, ...) \ log_entry::add_log_entry( \ { log_entry::source_location{ __FUNCTION__, __FILE__, __LINE__ }, \ timemory::join::join(DELIM, __VA_ARGS__) }) diff --git a/source/bin/omnitrace-instrument/module_function.cpp b/source/bin/omnitrace-instrument/module_function.cpp index 4ab8b712..7fe6c77f 100644 --- a/source/bin/omnitrace-instrument/module_function.cpp +++ b/source/bin/omnitrace-instrument/module_function.cpp @@ -64,7 +64,7 @@ module_function::module_function(module_t* mod, procedure_t* proc) , module_name{ get_name(module) } , function_name{ get_name(function) } { - OMNITRACE_ADD_LOG_ENTRY("Adding function", function_name, "from module", module_name); + ROCPROFSYS_ADD_LOG_ENTRY("Adding function", function_name, "from module", module_name); if(!function->isInstrumentable()) { diff --git a/source/bin/omnitrace-instrument/omnitrace-instrument.cpp b/source/bin/omnitrace-instrument/omnitrace-instrument.cpp index f6e572c1..24a56356 100644 --- a/source/bin/omnitrace-instrument/omnitrace-instrument.cpp +++ b/source/bin/omnitrace-instrument/omnitrace-instrument.cpp @@ -65,12 +65,12 @@ #include #include -#if !defined(OMNITRACE_USE_MPI) -# define OMNITRACE_USE_MPI 0 +#if !defined(ROCPROFSYS_USE_MPI) +# define ROCPROFSYS_USE_MPI 0 #endif -#if !defined(OMNITRACE_USE_MPI_HEADERS) -# define OMNITRACE_USE_MPI_HEADERS 0 +#if !defined(ROCPROFSYS_USE_MPI_HEADERS) +# define ROCPROFSYS_USE_MPI_HEADERS 0 #endif namespace @@ -268,7 +268,7 @@ activate_signal_handlers(const std::vector& _signals) TIMEMORY_PRINTF_FATAL( stderr, "These were the last %i log entries from rocprof-sys. You can control the " - "number of log entries via the '--log ' option or OMNITRACE_LOG_COUNT " + "number of log entries via the '--log ' option or ROCPROFSYS_LOG_COUNT " "env variable.\n", num_log_entries); @@ -322,7 +322,7 @@ main(int argc, char** argv) lib_search_paths.emplace_back(JOIN('/', _omni_root, "lib", "rocprofsys", "lib")); lib_search_paths.emplace_back( JOIN('/', _omni_root, "lib", "rocprofsys", "lib64")); - OMNITRACE_ADD_LOG_ENTRY(argv[0], "::", "rocprofsys root path: ", _omni_root); + ROCPROFSYS_ADD_LOG_ENTRY(argv[0], "::", "rocprofsys root path: ", _omni_root); } auto _omni_exe_path = get_realpath(get_absolute_exe_filepath(argv[0])); @@ -340,8 +340,8 @@ main(int argc, char** argv) lib_search_paths.emplace_back(JOIN('/', _omni_lib_path, "rocprofsys", "lib")); lib_search_paths.emplace_back(JOIN('/', _omni_lib_path, "rocprofsys", "lib64")); - OMNITRACE_ADD_LOG_ENTRY(argv[0], "::", "rocprofsys bin path: ", _omni_exe_path); - OMNITRACE_ADD_LOG_ENTRY(argv[0], "::", "rocprofsys lib path: ", _omni_lib_path); + ROCPROFSYS_ADD_LOG_ENTRY(argv[0], "::", "rocprofsys bin path: ", _omni_exe_path); + ROCPROFSYS_ADD_LOG_ENTRY(argv[0], "::", "rocprofsys lib path: ", _omni_lib_path); for(const auto& itr : omnitrace_get_link_map(nullptr)) { @@ -366,12 +366,12 @@ main(int argc, char** argv) for(const auto& itr : bin_search_paths) { - OMNITRACE_ADD_LOG_ENTRY("bin search path:", itr); + ROCPROFSYS_ADD_LOG_ENTRY("bin search path:", itr); } for(const auto& itr : lib_search_paths) { - OMNITRACE_ADD_LOG_ENTRY("lib search path:", itr); + ROCPROFSYS_ADD_LOG_ENTRY("lib search path:", itr); } address_space_t* addr_space = nullptr; @@ -471,7 +471,7 @@ main(int argc, char** argv) string_t extra_help = "-- "; parser.enable_help(); - parser.enable_version("rocprof-sys-instrument", OMNITRACE_ARGPARSE_VERSION_INFO); + parser.enable_version("rocprof-sys-instrument", ROCPROFSYS_ARGPARSE_VERSION_INFO); parser.add_argument({ "" }, ""); parser.add_argument({ "[DEBUG OPTIONS]" }, ""); @@ -887,7 +887,7 @@ main(int argc, char** argv) "defaults in the executable"); parser.add_argument({ "--env" }, "Environment variables to add to the runtime in form " - "VARIABLE=VALUE. E.g. use '--env OMNITRACE_PROFILE=ON' to " + "VARIABLE=VALUE. E.g. use '--env ROCPROFSYS_PROFILE=ON' to " "default to using timemory instead of perfetto"); parser .add_argument({ "--mpi" }, @@ -898,7 +898,7 @@ main(int argc, char** argv) .max_count(1) .action([](parser_t& p) { use_mpi = p.get("mpi"); -#if OMNITRACE_USE_MPI == 0 && OMNITRACE_USE_MPI_HEADERS == 0 +#if ROCPROFSYS_USE_MPI == 0 && ROCPROFSYS_USE_MPI_HEADERS == 0 errprintf(0, "omnitrace was not built with full or partial MPI support\n"); use_mpi = false; #endif @@ -1255,7 +1255,7 @@ main(int argc, char** argv) { // Helper function for adding regex expressions auto add_regex = [](auto& regex_array, const string_t& regex_expr) { - OMNITRACE_ADD_DETAILED_LOG_ENTRY("", "Adding regular expression \"", + ROCPROFSYS_ADD_DETAILED_LOG_ENTRY("", "Adding regular expression \"", regex_expr, "\" to regex_array@", ®ex_array); if(!regex_expr.empty()) @@ -1464,13 +1464,13 @@ main(int argc, char** argv) }; auto _add_overlapping = [](module_t* mitr, procedure_t* pitr) { - OMNITRACE_ADD_LOG_ENTRY("Checking if procedure", get_name(pitr), "in module", + ROCPROFSYS_ADD_LOG_ENTRY("Checking if procedure", get_name(pitr), "in module", get_name(mitr), "is overlapping"); if(!pitr->isInstrumentable()) return; std::vector _overlapping{}; if(pitr->findOverlapping(_overlapping)) { - OMNITRACE_ADD_LOG_ENTRY("Adding overlapping procedure", get_name(pitr), + ROCPROFSYS_ADD_LOG_ENTRY("Adding overlapping procedure", get_name(pitr), "and module", get_name(mitr)); _insert_module_function(overlapping_module_functions, module_function{ mitr, pitr }); @@ -1591,7 +1591,7 @@ main(int argc, char** argv) is_static_exe = addr_space->isStaticExecutable(); - OMNITRACE_ADD_LOG_ENTRY("address space is", (is_static_exe) ? "" : "not", + ROCPROFSYS_ADD_LOG_ENTRY("address space is", (is_static_exe) ? "" : "not", "a static executable"); if(binary_rewrite) app_binary = static_cast(addr_space); @@ -1600,7 +1600,7 @@ main(int argc, char** argv) is_attached = (_pid >= 0 && app_thread != nullptr); - OMNITRACE_ADD_LOG_ENTRY("address space is attached:", is_attached); + ROCPROFSYS_ADD_LOG_ENTRY("address space is attached:", is_attached); if(!app_binary && !app_thread) { @@ -1620,7 +1620,7 @@ main(int argc, char** argv) string_t _tried_libs; for(auto _libname : _libnames) { - OMNITRACE_ADD_LOG_ENTRY("Getting the absolute lib filepath to", _libname); + ROCPROFSYS_ADD_LOG_ENTRY("Getting the absolute lib filepath to", _libname); _libname = get_realpath(get_absolute_lib_filepath(_libname)); _tried_libs += string_t("|") + _libname; verbprintf(1, "loading library: '%s'...\n", _libname.c_str()); @@ -1629,7 +1629,7 @@ main(int argc, char** argv) (result) ? "success" : "failure"); if(result) { - OMNITRACE_ADD_LOG_ENTRY("Using library:", _libname); + ROCPROFSYS_ADD_LOG_ENTRY("Using library:", _libname); break; } } @@ -1658,7 +1658,7 @@ main(int argc, char** argv) }; for(auto& lname : lnames) lname = _get_library_ext(lname); - OMNITRACE_ADD_LOG_ENTRY("Using library:", lnames); + ROCPROFSYS_ADD_LOG_ENTRY("Using library:", lnames); return lnames; }; @@ -1674,7 +1674,7 @@ main(int argc, char** argv) { "omnitrace_user_start_thread_trace" }); auto* user_stop_func = find_function(app_image, "omnitrace_user_stop_trace", { "omnitrace_user_stop_thread_trace" }); -#if OMNITRACE_USE_MPI > 0 || OMNITRACE_USE_MPI_HEADERS > 0 +#if ROCPROFSYS_USE_MPI > 0 || ROCPROFSYS_USE_MPI_HEADERS > 0 // if any of the below MPI functions are found, enable MPI support for(const auto* itr : { "MPI_Init", "MPI_Init_thread", "MPI_Finalize", "MPI_Comm_rank", "MPI_Comm_size" }) @@ -2686,7 +2686,7 @@ get_absolute_filepath(std::string _name, const strvec_t& _search_paths) if(!is_directory(itr) || is_file(itr)) itr = filepath::dirname(itr); auto _exists = false; - OMNITRACE_ADD_LOG_ENTRY("searching", itr, "for", _name); + ROCPROFSYS_ADD_LOG_ENTRY("searching", itr, "for", _name); for(const auto& pitr : { absolute(JOIN('/', itr, _name)), absolute(JOIN('/', itr, filepath::basename(_name))) }) @@ -2815,7 +2815,7 @@ using tim::dirname; void find_dyn_api_rt() { -#if defined(OMNITRACE_BUILD_DYNINST) +#if defined(ROCPROFSYS_BUILD_DYNINST) std::string _dyn_api_rt_base = (binary_rewrite) ? "librocprof-sys-rt" : "libdyninstAPI_RT"; #else diff --git a/source/bin/omnitrace-instrument/omnitrace-instrument.hpp b/source/bin/omnitrace-instrument/omnitrace-instrument.hpp index 4af8a04d..c7a177fc 100644 --- a/source/bin/omnitrace-instrument/omnitrace-instrument.hpp +++ b/source/bin/omnitrace-instrument/omnitrace-instrument.hpp @@ -287,7 +287,7 @@ omnitrace_thread_exit(thread_t* thread, BPatch_exitType exit_type) { if(!thread) return; - OMNITRACE_ADD_LOG_ENTRY("Executing the thread callback"); + ROCPROFSYS_ADD_LOG_ENTRY("Executing the thread callback"); BPatch_process* app = thread->getProcess(); @@ -330,7 +330,7 @@ omnitrace_thread_exit(thread_t* thread, BPatch_exitType exit_type) TIMEMORY_NOINLINE inline void omnitrace_fork_callback(thread_t* parent, thread_t* child) { - OMNITRACE_ADD_LOG_ENTRY("Executing the fork callback"); + ROCPROFSYS_ADD_LOG_ENTRY("Executing the fork callback"); if(child) { @@ -388,7 +388,7 @@ insert_instr(address_space_t* mutatee, const std::vector& _points, Tp return _v; }(); - OMNITRACE_ADD_LOG_ENTRY("Inserting", _points.size(), + ROCPROFSYS_ADD_LOG_ENTRY("Inserting", _points.size(), "instrumentation points into function(s)", _names); auto _trace = traceFunc.get(); @@ -401,7 +401,7 @@ insert_instr(address_space_t* mutatee, const std::vector& _points, Tp } } - OMNITRACE_ADD_LOG_ENTRY("Found", _traps.size(), + ROCPROFSYS_ADD_LOG_ENTRY("Found", _traps.size(), "instrumentation points using traps in function(s)", _names); size_t _n = 0; @@ -412,7 +412,7 @@ insert_instr(address_space_t* mutatee, const std::vector& _points, Tp ++_n; } - OMNITRACE_ADD_LOG_ENTRY("Inserted", _n, "instrumentation points in function(s)", + ROCPROFSYS_ADD_LOG_ENTRY("Inserted", _n, "instrumentation points in function(s)", _names); return (_n > 0); @@ -434,7 +434,7 @@ insert_instr(address_space_t* mutatee, procedure_t* funcToInstr, Tp traceFunc, std::vector* _points = nullptr; auto _trace = traceFunc.get(); - OMNITRACE_ADD_LOG_ENTRY("Searching for loop instrumentation points in function", + ROCPROFSYS_ADD_LOG_ENTRY("Searching for loop instrumentation points in function", get_name(funcToInstr)); if(!cfGraph) funcToInstr->getCFG(); @@ -453,7 +453,7 @@ insert_instr(address_space_t* mutatee, procedure_t* funcToInstr, Tp traceFunc, if(_points == nullptr) return false; if(_points->empty()) return false; - OMNITRACE_ADD_LOG_ENTRY("Inserting max of", _points->size(), + ROCPROFSYS_ADD_LOG_ENTRY("Inserting max of", _points->size(), "loop instrumentation points in function", get_name(funcToInstr)); @@ -466,7 +466,7 @@ insert_instr(address_space_t* mutatee, procedure_t* funcToInstr, Tp traceFunc, } } - OMNITRACE_ADD_LOG_ENTRY("Found", _traps.size(), + ROCPROFSYS_ADD_LOG_ENTRY("Found", _traps.size(), "loop instrumentation points using traps in function", get_name(funcToInstr)); @@ -478,7 +478,7 @@ insert_instr(address_space_t* mutatee, procedure_t* funcToInstr, Tp traceFunc, ++_n; } - OMNITRACE_ADD_LOG_ENTRY("Inserted", _n, "loop instrumentation points in function", + ROCPROFSYS_ADD_LOG_ENTRY("Inserted", _n, "loop instrumentation points in function", get_name(funcToInstr)); return (_n > 0); @@ -497,7 +497,7 @@ insert_instr(address_space_t* mutatee, Tp traceFunc, procedure_loc_t traceLoc, point_t* _point = nullptr; auto _trace = traceFunc.get(); - OMNITRACE_ADD_LOG_ENTRY( + ROCPROFSYS_ADD_LOG_ENTRY( "Searching for basic-block entry and exit instrumentation points ::", *basicBlock); @@ -514,14 +514,14 @@ insert_instr(address_space_t* mutatee, Tp traceFunc, procedure_loc_t traceLoc, if(_point == nullptr) { - OMNITRACE_ADD_LOG_ENTRY("No instrumentation points were found in basic-block ", + ROCPROFSYS_ADD_LOG_ENTRY("No instrumentation points were found in basic-block ", *basicBlock); return false; } if(!allow_traps && _point->usesTrap_NP()) { - OMNITRACE_ADD_LOG_ENTRY("Basic-block", *basicBlock, + ROCPROFSYS_ADD_LOG_ENTRY("Basic-block", *basicBlock, "uses traps and traps are disallowed"); return false; } diff --git a/source/bin/omnitrace-run/CMakeLists.txt b/source/bin/omnitrace-run/CMakeLists.txt index 441c0386..a162af7e 100644 --- a/source/bin/omnitrace-run/CMakeLists.txt +++ b/source/bin/omnitrace-run/CMakeLists.txt @@ -19,10 +19,10 @@ target_link_libraries( set_target_properties( rocprofsys-run PROPERTIES BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}" - INSTALL_RPATH "${OMNITRACE_EXE_INSTALL_RPATH}" + INSTALL_RPATH "${ROCPROFSYS_EXE_INSTALL_RPATH}" OUTPUT_NAME "rocprof-sys-run") -omnitrace_strip_target(rocprofsys-run) +rocprofsys_strip_target(rocprofsys-run) install( TARGETS rocprofsys-run diff --git a/source/bin/omnitrace-run/impl.cpp b/source/bin/omnitrace-run/impl.cpp index f52b5982..766d1d46 100644 --- a/source/bin/omnitrace-run/impl.cpp +++ b/source/bin/omnitrace-run/impl.cpp @@ -293,7 +293,7 @@ parse_args(int argc, char** argv, parser_data_t& _parser_data, bool& _fork_exec) }); parser.enable_help("", "Usage: rocprof-sys-run -- "); - parser.enable_version("rocprof-sys-run", OMNITRACE_ARGPARSE_VERSION_INFO); + parser.enable_version("rocprof-sys-run", ROCPROFSYS_ARGPARSE_VERSION_INFO); auto _cols = std::get<0>(console::get_columns()); if(_cols > parser.get_help_width() + 8) diff --git a/source/bin/omnitrace-sample/CMakeLists.txt b/source/bin/omnitrace-sample/CMakeLists.txt index 20839301..6fdabf3a 100644 --- a/source/bin/omnitrace-sample/CMakeLists.txt +++ b/source/bin/omnitrace-sample/CMakeLists.txt @@ -16,10 +16,10 @@ target_link_libraries( set_target_properties( rocprofsys-sample PROPERTIES BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}" - INSTALL_RPATH "${OMNITRACE_EXE_INSTALL_RPATH}" + INSTALL_RPATH "${ROCPROFSYS_EXE_INSTALL_RPATH}" OUTPUT_NAME "rocprof-sys-sample") -omnitrace_strip_target(rocprofsys-sample) +rocprofsys_strip_target(rocprofsys-sample) install( TARGETS rocprofsys-sample diff --git a/source/bin/omnitrace-sample/impl.cpp b/source/bin/omnitrace-sample/impl.cpp index f77f9023..0fc6a052 100644 --- a/source/bin/omnitrace-sample/impl.cpp +++ b/source/bin/omnitrace-sample/impl.cpp @@ -44,12 +44,12 @@ #include #include -#if !defined(OMNITRACE_USE_ROCTRACER) -# define OMNITRACE_USE_ROCTRACER 0 +#if !defined(ROCPROFSYS_USE_ROCTRACER) +# define ROCPROFSYS_USE_ROCTRACER 0 #endif -#if !defined(OMNITRACE_USE_ROCPROFILER) -# define OMNITRACE_USE_ROCPROFILER 0 +#if !defined(ROCPROFSYS_USE_ROCPROFILER) +# define ROCPROFSYS_USE_ROCPROFILER 0 #endif namespace color = tim::log::color; @@ -74,25 +74,25 @@ auto clock_id_choices = []() { return _v; }; -#define OMNITRACE_CLOCK_IDENTIFIER(VAL) \ +#define ROCPROFSYS_CLOCK_IDENTIFIER(VAL) \ std::make_tuple(clock_name(#VAL), VAL, std::string_view{ #VAL }) auto _choices = std::vector{}; auto _aliases = std::map>{}; - for(auto itr : { OMNITRACE_CLOCK_IDENTIFIER(CLOCK_REALTIME), - OMNITRACE_CLOCK_IDENTIFIER(CLOCK_MONOTONIC), - OMNITRACE_CLOCK_IDENTIFIER(CLOCK_PROCESS_CPUTIME_ID), - OMNITRACE_CLOCK_IDENTIFIER(CLOCK_MONOTONIC_RAW), - OMNITRACE_CLOCK_IDENTIFIER(CLOCK_REALTIME_COARSE), - OMNITRACE_CLOCK_IDENTIFIER(CLOCK_MONOTONIC_COARSE), - OMNITRACE_CLOCK_IDENTIFIER(CLOCK_BOOTTIME) }) + for(auto itr : { ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_REALTIME), + ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_MONOTONIC), + ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_PROCESS_CPUTIME_ID), + ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_MONOTONIC_RAW), + ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_REALTIME_COARSE), + ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_MONOTONIC_COARSE), + ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_BOOTTIME) }) { auto _choice = std::to_string(std::get<1>(itr)); _choices.emplace_back(_choice); _aliases[_choice] = { std::get<0>(itr), std::string{ std::get<2>(itr) } }; } -#undef OMNITRACE_CLOCK_IDENTIFIER +#undef ROCPROFSYS_CLOCK_IDENTIFIER return std::make_pair(_choices, _aliases); }(); @@ -140,18 +140,18 @@ get_initial_environment() update_env(_env, "ROCPROFSYS_USE_SAMPLING", (_mode != "causal")); -#if defined(OMNITRACE_USE_ROCTRACER) || defined(OMNITRACE_USE_ROCPROFILER) +#if defined(ROCPROFSYS_USE_ROCTRACER) || defined(ROCPROFSYS_USE_ROCPROFILER) update_env(_env, "HSA_TOOLS_LIB", _dl_libpath); if(!getenv("HSA_TOOLS_REPORT_LOAD_FAILURE")) update_env(_env, "HSA_TOOLS_REPORT_LOAD_FAILURE", "1"); #endif -#if defined(OMNITRACE_USE_ROCPROFILER) +#if defined(ROCPROFSYS_USE_ROCPROFILER) update_env(_env, "ROCP_TOOL_LIB", _omni_libpath); if(!getenv("ROCP_HSA_INTERCEPT")) update_env(_env, "ROCP_HSA_INTERCEPT", "1"); #endif -#if defined(OMNITRACE_USE_OMPT) +#if defined(ROCPROFSYS_USE_OMPT) if(!getenv("OMP_TOOL_LIBRARIES")) update_env(_env, "OMP_TOOL_LIBRARIES", _dl_libpath, UPD_APPEND); #endif @@ -361,7 +361,7 @@ parse_args(int argc, char** argv, std::vector& _env) ? std::vector{ "hsa-interrupt" } : std::vector{}; -#if OMNITRACE_USE_ROCTRACER == 0 && OMNITRACE_USE_ROCPROFILER == 0 +#if ROCPROFSYS_USE_ROCTRACER == 0 && ROCPROFSYS_USE_ROCPROFILER == 0 _realtime_reqs.clear(); #endif @@ -372,7 +372,7 @@ parse_args(int argc, char** argv, std::vector& _env) parser.set_use_color(true); parser.enable_help(); - parser.enable_version("rocprof-sys-sample", OMNITRACE_ARGPARSE_VERSION_INFO); + parser.enable_version("rocprof-sys-sample", ROCPROFSYS_ARGPARSE_VERSION_INFO); auto _cols = std::get<0>(tim::utility::console::get_columns()); if(_cols > parser.get_help_width() + 8) @@ -746,28 +746,28 @@ parse_args(int argc, char** argv, std::vector& _env) "roctracer", "rocprofiler", "roctx", "mutex-locks", "spin-locks", "rw-locks" }; -#if !defined(OMNITRACE_USE_MPI) && !defined(OMNITRACE_USE_MPI_HEADERS) +#if !defined(ROCPROFSYS_USE_MPI) && !defined(ROCPROFSYS_USE_MPI_HEADERS) _backend_choices.erase("mpip"); #endif -#if !defined(OMNITRACE_USE_OMPT) +#if !defined(ROCPROFSYS_USE_OMPT) _backend_choices.erase("ompt"); #endif -#if !defined(OMNITRACE_USE_RCCL) +#if !defined(ROCPROFSYS_USE_RCCL) _backend_choices.erase("rcclp"); #endif -#if !defined(OMNITRACE_USE_ROCM_SMI) +#if !defined(ROCPROFSYS_USE_ROCM_SMI) _backend_choices.erase("rocm-smi"); #endif -#if !defined(OMNITRACE_USE_ROCTRACER) +#if !defined(ROCPROFSYS_USE_ROCTRACER) _backend_choices.erase("roctracer"); _backend_choices.erase("roctx"); #endif -#if !defined(OMNITRACE_USE_ROCPROFILER) +#if !defined(ROCPROFSYS_USE_ROCPROFILER) _backend_choices.erase("rocprofiler"); #endif @@ -850,7 +850,7 @@ parse_args(int argc, char** argv, std::vector& _env) update_env(_env, "ROCPROFSYS_PAPI_EVENTS", _events); }); -#if defined(OMNITRACE_USE_ROCPROFILER) +#if defined(ROCPROFSYS_USE_ROCPROFILER) parser .add_argument({ "-G", "--gpu-events" }, "Set the GPU hardware counter events to record (ref: " diff --git a/source/bin/tests/CMakeLists.txt b/source/bin/tests/CMakeLists.txt index eb0ae1b1..5b99554f 100644 --- a/source/bin/tests/CMakeLists.txt +++ b/source/bin/tests/CMakeLists.txt @@ -4,7 +4,7 @@ set(ROCPROFSYS_ABORT_FAIL_REGEX FORCE) # adds a ctest for executable -function(OMNITRACE_ADD_BIN_TEST) +function(ROCPROFSYS_ADD_BIN_TEST) cmake_parse_arguments( TEST "" # options @@ -46,7 +46,7 @@ function(OMNITRACE_ADD_BIN_TEST) if(NOT "${TEST_PASS_REGEX}" STREQUAL "" AND NOT "${TEST_FAIL_REGEX}" STREQUAL "" AND NOT "${TEST_FAIL_REGEX}" MATCHES "\\|ROCPROFSYS_ABORT_FAIL_REGEX") - omnitrace_message( + rocprofsys_message( FATAL_ERROR "${TEST_NAME} has set pass and fail regexes but fail regex does not include '|ROCPROFSYS_ABORT_FAIL_REGEX'" ) @@ -105,12 +105,12 @@ function(OMNITRACE_ADD_BIN_TEST) SKIP_REGULAR_EXPRESSION "${TEST_SKIP_REGEX}" ${TEST_PROPERTIES}) - elseif(OMNITRACE_BUILD_TESTING) + elseif(ROCPROFSYS_BUILD_TESTING) message(FATAL_ERROR "Error! ${TEST_TARGET} does not exist") endif() endfunction() -omnitrace_add_bin_test( +rocprofsys_add_bin_test( NAME rocprofsys-instrument-help TARGET rocprofsys-instrument ARGS --help @@ -129,7 +129,7 @@ else() set(LS_ARGS) endif() -omnitrace_add_bin_test( +rocprofsys_add_bin_test( NAME rocprofsys-instrument-simulate-ls TARGET rocprofsys-instrument ARGS --simulate @@ -146,7 +146,7 @@ omnitrace_add_bin_test( LABELS "simulate" TIMEOUT 240) -omnitrace_add_bin_test( +rocprofsys_add_bin_test( NAME rocprofsys-instrument-simulate-ls-check DEPENDS rocprofsys-instrument-simulate-ls COMMAND ls rocprofsys-tests-output/rocprofsys-instrument-simulate-ls/instrumentation @@ -155,7 +155,7 @@ omnitrace_add_bin_test( ".*available.json.*available.txt.*available.xml.*excluded.json.*excluded.txt.*excluded.xml.*instrumented.json.*instrumented.txt.*instrumented.xml.*overlapping.json.*overlapping.txt.*overlapping.xml.*" FAIL_REGEX "No such file or directory|not found|ROCPROFSYS_ABORT_FAIL_REGEX") -omnitrace_add_bin_test( +rocprofsys_add_bin_test( NAME rocprofsys-instrument-simulate-lib TARGET rocprofsys-instrument ARGS --print-available functions -v 2 -- $ @@ -167,7 +167,7 @@ omnitrace_add_bin_test( file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/rocprofsys-tests-output/tmp) -omnitrace_add_bin_test( +rocprofsys_add_bin_test( NAME rocprofsys-instrument-simulate-lib-basename TARGET rocprofsys-instrument ARGS --print-available @@ -182,7 +182,7 @@ omnitrace_add_bin_test( TIMEOUT 120 WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/rocprofsys-tests-output/tmp) -omnitrace_add_bin_test( +rocprofsys_add_bin_test( NAME rocprofsys-instrument-write-log TARGET rocprofsys-instrument ARGS --print-instrumented @@ -198,7 +198,7 @@ omnitrace_add_bin_test( TIMEOUT 120 PASS_REGEX "Opening .*/instrumentation/user.log") -omnitrace_add_bin_test( +rocprofsys_add_bin_test( NAME rocprofsys-instrument-write-log-check DEPENDS rocprofsys-instrument-write-log COMMAND @@ -209,7 +209,7 @@ omnitrace_add_bin_test( PASS_REGEX "user.log" FAIL_REGEX "No such file or directory|not found|ROCPROFSYS_ABORT_FAIL_REGEX") -omnitrace_add_bin_test( +rocprofsys_add_bin_test( NAME rocprofsys-avail-help TARGET rocprofsys-avail ARGS --help @@ -219,14 +219,14 @@ omnitrace_add_bin_test( ".*\\\[rocprof-sys-avail\\\] Usage:.*\\\[DEBUG OPTIONS\\\].*\\\[INFO OPTIONS\\\].*\\\[FILTER OPTIONS\\\].*\\\[COLUMN OPTIONS\\\].*\\\[DISPLAY OPTIONS\\\].*\\\[OUTPUT OPTIONS\\\].*" ) -omnitrace_add_bin_test( +rocprofsys_add_bin_test( NAME rocprofsys-avail-all TARGET rocprofsys-avail ARGS --all LABELS "rocprofsys-avail" TIMEOUT 45) -omnitrace_add_bin_test( +rocprofsys_add_bin_test( NAME rocprofsys-avail-all-expand-keys TARGET rocprofsys-avail ARGS --all --expand-keys @@ -234,7 +234,7 @@ omnitrace_add_bin_test( TIMEOUT 45 FAIL_REGEX "%[a-zA-Z_]%|ROCPROFSYS_ABORT_FAIL_REGEX") -omnitrace_add_bin_test( +rocprofsys_add_bin_test( NAME rocprofsys-avail-all-only-available-alphabetical TARGET rocprofsys-avail ARGS --all --available --alphabetical --debug --output @@ -245,7 +245,7 @@ omnitrace_add_bin_test( ATTACHED_FILES ${CMAKE_CURRENT_BINARY_DIR}/rocprofsys-avail-all-only-available-alphabetical.log) -omnitrace_add_bin_test( +rocprofsys_add_bin_test( NAME rocprofsys-avail-all-csv TARGET rocprofsys-avail ARGS --all --csv --csv-separator "#" @@ -255,7 +255,7 @@ omnitrace_add_bin_test( "COMPONENT#AVAILABLE#VALUE_TYPE#STRING_IDS#FILENAME#DESCRIPTION#CATEGORY#.*ENVIRONMENT VARIABLE#VALUE#DATA TYPE#DESCRIPTION#CATEGORIES#.*HARDWARE COUNTER#DEVICE#AVAILABLE#DESCRIPTION#" ) -omnitrace_add_bin_test( +rocprofsys_add_bin_test( NAME rocprofsys-avail-filter-wall-clock-available TARGET rocprofsys-avail ARGS -r wall_clock -C --available @@ -265,7 +265,7 @@ omnitrace_add_bin_test( "\\\|[-]+\\\|\n\\\|[ ]+COMPONENT[ ]+\\\|\n\\\|[-]+\\\|\n\\\| (wall_clock)[ ]+\\\|\n\\\|[-]+\\\|" ) -omnitrace_add_bin_test( +rocprofsys_add_bin_test( NAME rocprofsys-avail-category-filter-rocprofsys TARGET rocprofsys-avail ARGS --categories settings::rocprofsys --brief @@ -276,7 +276,7 @@ omnitrace_add_bin_test( "ROCPROFSYS_(ADD_SECONDARY|SCIENTIFIC|PRECISION|MEMORY_PRECISION|TIMING_PRECISION)|ROCPROFSYS_ABORT_FAIL_REGEX" ) -omnitrace_add_bin_test( +rocprofsys_add_bin_test( NAME rocprofsys-avail-category-filter-timemory TARGET rocprofsys-avail ARGS --categories settings::timemory --brief --advanced @@ -286,7 +286,7 @@ omnitrace_add_bin_test( "ROCPROFSYS_(ADD_SECONDARY|SCIENTIFIC|PRECISION|MEMORY_PRECISION|TIMING_PRECISION)" FAIL_REGEX "ROCPROFSYS_(SETTINGS_DESC|OUTPUT_FILE)|ROCPROFSYS_ABORT_FAIL_REGEX") -omnitrace_add_bin_test( +rocprofsys_add_bin_test( NAME rocprofsys-avail-regex-negation TARGET rocprofsys-avail ARGS -R @@ -310,7 +310,7 @@ string( REPLACE "+" "\\\+" _AVAIL_CFG_PATH "${PROJECT_BINARY_DIR}/rocprofsys-tests-output/rocprofsys-avail/rocprofsys-") # use of TWD == Test Working Directory (added by function) -omnitrace_add_bin_test( +rocprofsys_add_bin_test( NAME rocprofsys-avail-write-config TARGET rocprofsys-avail ARGS -G @@ -329,7 +329,7 @@ omnitrace_add_bin_test( "Outputting JSON configuration file '${_AVAIL_CFG_PATH}test\\\.json'(.*)Outputting XML configuration file '${_AVAIL_CFG_PATH}test\\\.xml'(.*)Outputting text configuration file '${_AVAIL_CFG_PATH}test\\\.cfg'(.*)" ) -omnitrace_add_bin_test( +rocprofsys_add_bin_test( NAME rocprofsys-avail-write-config-tweak TARGET rocprofsys-avail ARGS -G %env{TWD}%/rocprofsys-tests-output/rocprofsys-avail/rocprofsys-tweak.cfg -F @@ -341,7 +341,7 @@ omnitrace_add_bin_test( "Outputting JSON configuration file '${_AVAIL_CFG_PATH}tweak\\\.json'(.*)Outputting XML configuration file '${_AVAIL_CFG_PATH}tweak\\\.xml'(.*)Outputting text configuration file '${_AVAIL_CFG_PATH}tweak\\\.cfg'(.*)" ) -omnitrace_add_bin_test( +rocprofsys_add_bin_test( NAME rocprofsys-avail-list-keys TARGET rocprofsys-avail ARGS --list-keys --expand-keys @@ -349,7 +349,7 @@ omnitrace_add_bin_test( LABELS "rocprofsys-avail" PASS_REGEX "Output Keys:\n(.*)%argv%(.*)%argv_hash%") -omnitrace_add_bin_test( +rocprofsys_add_bin_test( NAME rocprofsys-avail-list-keys-markdown TARGET rocprofsys-avail ARGS --list-keys --expand-keys --markdown @@ -357,7 +357,7 @@ omnitrace_add_bin_test( LABELS "rocprofsys-avail;markdown" PASS_REGEX "(.*)`%argv%`(.*)`%argv_hash%`") -omnitrace_add_bin_test( +rocprofsys_add_bin_test( NAME rocprofsys-avail-list-categories TARGET rocprofsys-avail ARGS --list-categories @@ -365,7 +365,7 @@ omnitrace_add_bin_test( LABELS "rocprofsys-avail" PASS_REGEX " component::(.*) hw_counters::(.*) settings::") -omnitrace_add_bin_test( +rocprofsys_add_bin_test( NAME rocprofsys-avail-core-categories TARGET rocprofsys-avail ARGS -c core @@ -375,7 +375,7 @@ omnitrace_add_bin_test( "ROCPROFSYS_CONFIG_FILE(.*)ROCPROFSYS_ENABLED(.*)ROCPROFSYS_SUPPRESS_CONFIG(.*)ROCPROFSYS_SUPPRESS_PARSING(.*)ROCPROFSYS_VERBOSE" ) -omnitrace_add_bin_test( +rocprofsys_add_bin_test( NAME rocprofsys-run-help TARGET rocprofsys-run ARGS --help @@ -396,7 +396,7 @@ set_target_properties( sleeper PROPERTIES BUILD_TYPE RelWithDebInfo RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin/testing) -omnitrace_add_bin_test( +rocprofsys_add_bin_test( NAME rocprofsys-run-args TARGET rocprofsys-run ARGS --monochrome diff --git a/source/lib/CMakeLists.txt b/source/lib/CMakeLists.txt index 70180137..ccdfe5b5 100644 --- a/source/lib/CMakeLists.txt +++ b/source/lib/CMakeLists.txt @@ -12,14 +12,14 @@ if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.20) cmake_policy(SET CMP0115 NEW) endif() -if(OMNITRACE_USE_ROCPROFILER +if(ROCPROFSYS_USE_ROCPROFILER AND rocprofiler_LIBRARY_DIR AND ROCmVersion_TRIPLE_VERSION VERSION_LESS 5.2.0 AND NOT CMAKE_INSTALL_RPATH_USE_LINK_PATH) - set(OMNITRACE_LIB_INSTALL_RPATH + set(ROCPROFSYS_LIB_INSTALL_RPATH "\$ORIGIN:\$ORIGIN/${PACKAGE_NAME}:${rocprofiler_LIBRARY_DIR}") else() - set(OMNITRACE_LIB_INSTALL_RPATH "\$ORIGIN:\$ORIGIN/${PACKAGE_NAME}") + set(ROCPROFSYS_LIB_INSTALL_RPATH "\$ORIGIN:\$ORIGIN/${PACKAGE_NAME}") endif() # ------------------------------------------------------------------------------# @@ -57,7 +57,7 @@ target_link_libraries( $ $ $ - $,rocprofsys::rocprofsys-lto,>> + $,rocprofsys::rocprofsys-lto,>> ) # ------------------------------------------------------------------------------# diff --git a/source/lib/binary/address_multirange.hpp b/source/lib/binary/address_multirange.hpp index 4c5d62c8..516bf4f1 100644 --- a/source/lib/binary/address_multirange.hpp +++ b/source/lib/binary/address_multirange.hpp @@ -39,7 +39,7 @@ struct address_multirange struct coarse {}; - OMNITRACE_DEFAULT_OBJECT(address_multirange) + ROCPROFSYS_DEFAULT_OBJECT(address_multirange) address_multirange& operator+=(std::pair&&); address_multirange& operator+=(std::pair&& _v); @@ -61,7 +61,7 @@ struct address_multirange }; template -OMNITRACE_INLINE bool +ROCPROFSYS_INLINE bool address_multirange::contains(Tp&& _v) const { using type = concepts::unqualified_type_t; diff --git a/source/lib/binary/analysis.cpp b/source/lib/binary/analysis.cpp index c88b3de2..518d0e1e 100644 --- a/source/lib/binary/analysis.cpp +++ b/source/lib/binary/analysis.cpp @@ -75,7 +75,7 @@ parse_line_info(const std::string& _name, bool _process_dwarf, bool _process_bfd auto& _bfd = _info.bfd; _bfd = std::make_shared(_name); - OMNITRACE_BASIC_VERBOSE(0, "[binary] Reading line info for '%s'...\n", _name.c_str()); + ROCPROFSYS_BASIC_VERBOSE(0, "[binary] Reading line info for '%s'...\n", _name.c_str()); if(_bfd && _bfd->is_good()) { @@ -124,7 +124,7 @@ parse_line_info(const std::string& _name, bool _process_dwarf, bool _process_bfd _info.sort(); } - OMNITRACE_BASIC_VERBOSE(1, "[binary] Reading line info for '%s'... %zu entries\n", + ROCPROFSYS_BASIC_VERBOSE(1, "[binary] Reading line info for '%s'... %zu entries\n", _bfd->name.c_str(), _info.symbols.size()); return _info; diff --git a/source/lib/binary/dwarf_entry.cpp b/source/lib/binary/dwarf_entry.cpp index 8210f729..37925429 100644 --- a/source/lib/binary/dwarf_entry.cpp +++ b/source/lib/binary/dwarf_entry.cpp @@ -206,20 +206,20 @@ template void dwarf_entry::serialize(ArchiveT& ar, const unsigned int) { -#define OMNITRACE_SERIALIZE_MEMBER(MEMBER) ar(::tim::cereal::make_nvp(#MEMBER, MEMBER)); - - OMNITRACE_SERIALIZE_MEMBER(file) - OMNITRACE_SERIALIZE_MEMBER(line) - OMNITRACE_SERIALIZE_MEMBER(col) - OMNITRACE_SERIALIZE_MEMBER(address) - OMNITRACE_SERIALIZE_MEMBER(discriminator) - // OMNITRACE_SERIALIZE_MEMBER(begin_statement) - // OMNITRACE_SERIALIZE_MEMBER(end_sequence) - // OMNITRACE_SERIALIZE_MEMBER(line_block) - // OMNITRACE_SERIALIZE_MEMBER(prologue_end) - // OMNITRACE_SERIALIZE_MEMBER(epilogue_begin) - // OMNITRACE_SERIALIZE_MEMBER(vliw_op_index) - // OMNITRACE_SERIALIZE_MEMBER(isa) +#define ROCPROFSYS_SERIALIZE_MEMBER(MEMBER) ar(::tim::cereal::make_nvp(#MEMBER, MEMBER)); + + ROCPROFSYS_SERIALIZE_MEMBER(file) + ROCPROFSYS_SERIALIZE_MEMBER(line) + ROCPROFSYS_SERIALIZE_MEMBER(col) + ROCPROFSYS_SERIALIZE_MEMBER(address) + ROCPROFSYS_SERIALIZE_MEMBER(discriminator) + // ROCPROFSYS_SERIALIZE_MEMBER(begin_statement) + // ROCPROFSYS_SERIALIZE_MEMBER(end_sequence) + // ROCPROFSYS_SERIALIZE_MEMBER(line_block) + // ROCPROFSYS_SERIALIZE_MEMBER(prologue_end) + // ROCPROFSYS_SERIALIZE_MEMBER(epilogue_begin) + // ROCPROFSYS_SERIALIZE_MEMBER(vliw_op_index) + // ROCPROFSYS_SERIALIZE_MEMBER(isa) } template void diff --git a/source/lib/binary/dwarf_entry.hpp b/source/lib/binary/dwarf_entry.hpp index 3c4c4572..29d30ed8 100644 --- a/source/lib/binary/dwarf_entry.hpp +++ b/source/lib/binary/dwarf_entry.hpp @@ -35,7 +35,7 @@ struct dwarf_entry using dwarf_tuple_t = std::tuple, std::vector, std::vector>; - OMNITRACE_DEFAULT_OBJECT(dwarf_entry) + ROCPROFSYS_DEFAULT_OBJECT(dwarf_entry) bool begin_statement = false; bool end_sequence = false; diff --git a/source/lib/binary/link_map.cpp b/source/lib/binary/link_map.cpp index ca7178ff..10e4170a 100644 --- a/source/lib/binary/link_map.cpp +++ b/source/lib/binary/link_map.cpp @@ -138,13 +138,13 @@ get_link_map(const char* _lib, const std::string& _exclude_linked_by, auto _name = (!_lib) ? config::get_exe_realpath() : std::string{ _lib }; for(const auto& itr : _fini_chain) { - OMNITRACE_BASIC_VERBOSE(2, "[linkmap][%s]: %s\n", filepath::basename(_name), + ROCPROFSYS_BASIC_VERBOSE(2, "[linkmap][%s]: %s\n", filepath::basename(_name), itr.real().c_str()); } for(const auto& itr : _excl_chain) { - OMNITRACE_BASIC_VERBOSE(3, "[linkmap][%s]: %s\n", _exclude_linked_by.c_str(), + ROCPROFSYS_BASIC_VERBOSE(3, "[linkmap][%s]: %s\n", _exclude_linked_by.c_str(), link_file{ itr }.real().c_str()); } diff --git a/source/lib/binary/scope_filter.hpp b/source/lib/binary/scope_filter.hpp index 047ba90c..efb9b3de 100644 --- a/source/lib/binary/scope_filter.hpp +++ b/source/lib/binary/scope_filter.hpp @@ -55,7 +55,7 @@ struct scope_filter template static bool satisfies_filter(const ContainerT&, filter_scope, - std::string_view) OMNITRACE_PURE; + std::string_view) ROCPROFSYS_PURE; }; template diff --git a/source/lib/common/CMakeLists.txt b/source/lib/common/CMakeLists.txt index 9294ff66..476c93b4 100644 --- a/source/lib/common/CMakeLists.txt +++ b/source/lib/common/CMakeLists.txt @@ -31,4 +31,4 @@ target_include_directories( $) target_compile_definitions(rocprofsys-common-library - INTERFACE $) + INTERFACE $) diff --git a/source/lib/common/defines.h.in b/source/lib/common/defines.h.in index 334d419e..2bed0aca 100644 --- a/source/lib/common/defines.h.in +++ b/source/lib/common/defines.h.in @@ -23,117 +23,117 @@ #pragma once // clang-format off -#define OMNITRACE_VERSION_STRING "@FULL_VERSION_STRING@" -#define OMNITRACE_VERSION_MAJOR @PROJECT_VERSION_MAJOR@ -#define OMNITRACE_VERSION_MINOR @PROJECT_VERSION_MINOR@ -#define OMNITRACE_VERSION_PATCH @PROJECT_VERSION_PATCH@ -#define OMNITRACE_GIT_DESCRIBE "@OMNITRACE_GIT_DESCRIBE@" -#define OMNITRACE_GIT_REVISION "@OMNITRACE_GIT_REVISION@" +#define ROCPROFSYS_VERSION_STRING "@FULL_VERSION_STRING@" +#define ROCPROFSYS_VERSION_MAJOR @PROJECT_VERSION_MAJOR@ +#define ROCPROFSYS_VERSION_MINOR @PROJECT_VERSION_MINOR@ +#define ROCPROFSYS_VERSION_PATCH @PROJECT_VERSION_PATCH@ +#define ROCPROFSYS_GIT_DESCRIBE "@ROCPROFSYS_GIT_DESCRIBE@" +#define ROCPROFSYS_GIT_REVISION "@ROCPROFSYS_GIT_REVISION@" // system info during compilation -#define OMNITRACE_LIBRARY_ARCH "@CMAKE_LIBRARY_ARCHITECTURE@" -#define OMNITRACE_SYSTEM_NAME "@CMAKE_SYSTEM_NAME@" -#define OMNITRACE_SYSTEM_PROCESSOR "@CMAKE_SYSTEM_PROCESSOR@" -#define OMNITRACE_SYSTEM_VERSION "@CMAKE_SYSTEM_VERSION@" +#define ROCPROFSYS_LIBRARY_ARCH "@CMAKE_LIBRARY_ARCHITECTURE@" +#define ROCPROFSYS_SYSTEM_NAME "@CMAKE_SYSTEM_NAME@" +#define ROCPROFSYS_SYSTEM_PROCESSOR "@CMAKE_SYSTEM_PROCESSOR@" +#define ROCPROFSYS_SYSTEM_VERSION "@CMAKE_SYSTEM_VERSION@" // compiler information -#define OMNITRACE_COMPILER_ID "@CMAKE_CXX_COMPILER_ID@" -#define OMNITRACE_COMPILER_VERSION "@CMAKE_CXX_COMPILER_VERSION@" -#define OMNITRACE_COMPILER_STRING OMNITRACE_COMPILER_ID " v" OMNITRACE_COMPILER_VERSION +#define ROCPROFSYS_COMPILER_ID "@CMAKE_CXX_COMPILER_ID@" +#define ROCPROFSYS_COMPILER_VERSION "@CMAKE_CXX_COMPILER_VERSION@" +#define ROCPROFSYS_COMPILER_STRING ROCPROFSYS_COMPILER_ID " v" ROCPROFSYS_COMPILER_VERSION -#define OMNITRACE_DEFAULT_ROCM_PATH "@ROCmVersion_DIR@" -#define OMNITRACE_HIP_VERSION_STRING "@OMNITRACE_HIP_VERSION@" -#define OMNITRACE_HIP_VERSION_MAJOR @OMNITRACE_HIP_VERSION_MAJOR@ -#define OMNITRACE_HIP_VERSION_MINOR @OMNITRACE_HIP_VERSION_MINOR@ -#define OMNITRACE_HIP_VERSION_PATCH @OMNITRACE_HIP_VERSION_PATCH@ +#define ROCPROFSYS_DEFAULT_ROCM_PATH "@ROCmVersion_DIR@" +#define ROCPROFSYS_HIP_VERSION_STRING "@ROCPROFSYS_HIP_VERSION@" +#define ROCPROFSYS_HIP_VERSION_MAJOR @ROCPROFSYS_HIP_VERSION_MAJOR@ +#define ROCPROFSYS_HIP_VERSION_MINOR @ROCPROFSYS_HIP_VERSION_MINOR@ +#define ROCPROFSYS_HIP_VERSION_PATCH @ROCPROFSYS_HIP_VERSION_PATCH@ // these can be set via defining the variable in CMake, e.g.: -// cmake -D OMNITRACE_CACHELINE_SIZE=N /path/to/source +// cmake -D ROCPROFSYS_CACHELINE_SIZE=N /path/to/source // if not defined when configuring cmake, these values fall back to // default values set in core/containers/aligned_static_vector.hpp. -// the OMNITRACE_CACHELINE_SIZE_MIN is used to ensure portability -#cmakedefine OMNITRACE_CACHELINE_SIZE @OMNITRACE_CACHELINE_SIZE@ -#cmakedefine OMNITRACE_CACHELINE_SIZE_MIN @OMNITRACE_CACHELINE_SIZE_MIN@ +// the ROCPROFSYS_CACHELINE_SIZE_MIN is used to ensure portability +#cmakedefine ROCPROFSYS_CACHELINE_SIZE @ROCPROFSYS_CACHELINE_SIZE@ +#cmakedefine ROCPROFSYS_CACHELINE_SIZE_MIN @ROCPROFSYS_CACHELINE_SIZE_MIN@ // misc definitions which can be configured by cmake to override the defaults -#cmakedefine OMNITRACE_ROCM_MAX_COUNTERS @OMNITRACE_ROCM_MAX_COUNTERS@ +#cmakedefine ROCPROFSYS_ROCM_MAX_COUNTERS @ROCPROFSYS_ROCM_MAX_COUNTERS@ // clang-format on -#define OMNITRACE_VERSION \ - ((10000 * OMNITRACE_VERSION_MAJOR) + (100 * OMNITRACE_VERSION_MINOR) + \ - OMNITRACE_VERSION_PATCH) +#define ROCPROFSYS_VERSION \ + ((10000 * ROCPROFSYS_VERSION_MAJOR) + (100 * ROCPROFSYS_VERSION_MINOR) + \ + ROCPROFSYS_VERSION_PATCH) -#define OMNITRACE_HIP_VERSION \ - ((10000 * OMNITRACE_HIP_VERSION_MAJOR) + (100 * OMNITRACE_HIP_VERSION_MINOR) + \ - OMNITRACE_HIP_VERSION_PATCH) +#define ROCPROFSYS_HIP_VERSION \ + ((10000 * ROCPROFSYS_HIP_VERSION_MAJOR) + (100 * ROCPROFSYS_HIP_VERSION_MINOR) + \ + ROCPROFSYS_HIP_VERSION_PATCH) -#if OMNITRACE_HIP_VERSION_MAJOR > 0 -# define OMNITRACE_HIP_VERSION_COMPAT_STRING \ - "v@OMNITRACE_HIP_VERSION_MAJOR@.@OMNITRACE_HIP_VERSION_MINOR@.x" +#if ROCPROFSYS_HIP_VERSION_MAJOR > 0 +# define ROCPROFSYS_HIP_VERSION_COMPAT_STRING \ + "v@ROCPROFSYS_HIP_VERSION_MAJOR@.@ROCPROFSYS_HIP_VERSION_MINOR@.x" #else -# define OMNITRACE_HIP_VERSION_COMPAT_STRING "" +# define ROCPROFSYS_HIP_VERSION_COMPAT_STRING "" #endif // this should be passed to argparse::argument_parser::enable_version // Example: -// parser.enable_version(, OMNITRACE_ARGPARSE_VERSION_INFO); -#if !defined(OMNITRACE_ARGPARSE_VERSION_INFO) -# define OMNITRACE_ARGPARSE_VERSION_INFO \ - "v" OMNITRACE_VERSION_STRING, OMNITRACE_GIT_DESCRIBE, OMNITRACE_GIT_REVISION, \ +// parser.enable_version(, ROCPROFSYS_ARGPARSE_VERSION_INFO); +#if !defined(ROCPROFSYS_ARGPARSE_VERSION_INFO) +# define ROCPROFSYS_ARGPARSE_VERSION_INFO \ + "v" ROCPROFSYS_VERSION_STRING, ROCPROFSYS_GIT_DESCRIBE, ROCPROFSYS_GIT_REVISION, \ { \ - { "", OMNITRACE_LIBRARY_ARCH }, { "compiler", OMNITRACE_COMPILER_STRING }, \ + { "", ROCPROFSYS_LIBRARY_ARCH }, { "compiler", ROCPROFSYS_COMPILER_STRING }, \ { \ - "rocm", OMNITRACE_HIP_VERSION_COMPAT_STRING \ + "rocm", ROCPROFSYS_HIP_VERSION_COMPAT_STRING \ } \ } #endif // clang-format off -#if !defined(OMNITRACE_MAX_THREADS) -# define OMNITRACE_MAX_THREADS @OMNITRACE_MAX_THREADS@ +#if !defined(ROCPROFSYS_MAX_THREADS) +# define ROCPROFSYS_MAX_THREADS @ROCPROFSYS_MAX_THREADS@ #endif -#if !defined(OMNITRACE_MAX_UNWIND_DEPTH) -# define OMNITRACE_MAX_UNWIND_DEPTH @OMNITRACE_MAX_UNWIND_DEPTH@ +#if !defined(ROCPROFSYS_MAX_UNWIND_DEPTH) +# define ROCPROFSYS_MAX_UNWIND_DEPTH @ROCPROFSYS_MAX_UNWIND_DEPTH@ #endif // clang-format on // in general, we want to make sure the cache line size is not less than // 64 bytes (most common cacheline size for x86-64 CPUs) so unless -// OMNITRACE_CACHELINE_SIZE was explicitly set, we set the min to 64 -// and use the max value of OMNITRACE_CACHELINE_SIZE and -// OMNITRACE_CACHELINE_SIZE_MIN to assure that false-sharing is well +// ROCPROFSYS_CACHELINE_SIZE was explicitly set, we set the min to 64 +// and use the max value of ROCPROFSYS_CACHELINE_SIZE and +// ROCPROFSYS_CACHELINE_SIZE_MIN to assure that false-sharing is well // guarded against -#if !defined(OMNITRACE_CACHELINE_SIZE_MIN) -# if defined(OMNITRACE_CACHELINE_SIZE) -# define OMNITRACE_CACHELINE_SIZE_MIN OMNITRACE_CACHELINE_SIZE +#if !defined(ROCPROFSYS_CACHELINE_SIZE_MIN) +# if defined(ROCPROFSYS_CACHELINE_SIZE) +# define ROCPROFSYS_CACHELINE_SIZE_MIN ROCPROFSYS_CACHELINE_SIZE # else -# define OMNITRACE_CACHELINE_SIZE_MIN 64 +# define ROCPROFSYS_CACHELINE_SIZE_MIN 64 # endif #endif -#if !defined(OMNITRACE_ROCM_MAX_COUNTERS) -# define OMNITRACE_ROCM_MAX_COUNTERS 25 +#if !defined(ROCPROFSYS_ROCM_MAX_COUNTERS) +# define ROCPROFSYS_ROCM_MAX_COUNTERS 25 #endif -#define OMNITRACE_ATTRIBUTE(...) __attribute__((__VA_ARGS__)) -#define OMNITRACE_VISIBILITY(MODE) OMNITRACE_ATTRIBUTE(visibility(MODE)) -#define OMNITRACE_PUBLIC_API OMNITRACE_VISIBILITY("default") -#define OMNITRACE_HIDDEN_API OMNITRACE_VISIBILITY("hidden") -#define OMNITRACE_INTERNAL_API OMNITRACE_VISIBILITY("internal") -#define OMNITRACE_INLINE OMNITRACE_ATTRIBUTE(always_inline) inline -#define OMNITRACE_NOINLINE OMNITRACE_ATTRIBUTE(noinline) -#define OMNITRACE_HOT OMNITRACE_ATTRIBUTE(hot) -#define OMNITRACE_COLD OMNITRACE_ATTRIBUTE(cold) -#define OMNITRACE_CONST OMNITRACE_ATTRIBUTE(const) -#define OMNITRACE_PURE OMNITRACE_ATTRIBUTE(pure) -#define OMNITRACE_WEAK OMNITRACE_ATTRIBUTE(weak) -#define OMNITRACE_PACKED OMNITRACE_ATTRIBUTE(__packed__) -#define OMNITRACE_PACKED_ALIGN(VAL) OMNITRACE_PACKED OMNITRACE_ATTRIBUTE(__aligned__(VAL)) -#define OMNITRACE_LIKELY(...) __builtin_expect((__VA_ARGS__), 1) -#define OMNITRACE_UNLIKELY(...) __builtin_expect((__VA_ARGS__), 0) - -#if defined(OMNITRACE_CI) && OMNITRACE_CI > 0 +#define ROCPROFSYS_ATTRIBUTE(...) __attribute__((__VA_ARGS__)) +#define ROCPROFSYS_VISIBILITY(MODE) ROCPROFSYS_ATTRIBUTE(visibility(MODE)) +#define ROCPROFSYS_PUBLIC_API ROCPROFSYS_VISIBILITY("default") +#define ROCPROFSYS_HIDDEN_API ROCPROFSYS_VISIBILITY("hidden") +#define ROCPROFSYS_INTERNAL_API ROCPROFSYS_VISIBILITY("internal") +#define ROCPROFSYS_INLINE ROCPROFSYS_ATTRIBUTE(always_inline) inline +#define ROCPROFSYS_NOINLINE ROCPROFSYS_ATTRIBUTE(noinline) +#define ROCPROFSYS_HOT ROCPROFSYS_ATTRIBUTE(hot) +#define ROCPROFSYS_COLD ROCPROFSYS_ATTRIBUTE(cold) +#define ROCPROFSYS_CONST ROCPROFSYS_ATTRIBUTE(const) +#define ROCPROFSYS_PURE ROCPROFSYS_ATTRIBUTE(pure) +#define ROCPROFSYS_WEAK ROCPROFSYS_ATTRIBUTE(weak) +#define ROCPROFSYS_PACKED ROCPROFSYS_ATTRIBUTE(__packed__) +#define ROCPROFSYS_PACKED_ALIGN(VAL) ROCPROFSYS_PACKED ROCPROFSYS_ATTRIBUTE(__aligned__(VAL)) +#define ROCPROFSYS_LIKELY(...) __builtin_expect((__VA_ARGS__), 1) +#define ROCPROFSYS_UNLIKELY(...) __builtin_expect((__VA_ARGS__), 0) + +#if defined(ROCPROFSYS_CI) && ROCPROFSYS_CI > 0 # if defined(NDEBUG) # undef NDEBUG # endif @@ -147,15 +147,15 @@ # endif #endif -#define OMNITRACE_STRINGIZE(X) OMNITRACE_STRINGIZE2(X) -#define OMNITRACE_STRINGIZE2(X) #X -#define OMNITRACE_VAR_NAME_COMBINE(X, Y) X##Y -#define OMNITRACE_VARIABLE(X, Y) OMNITRACE_VAR_NAME_COMBINE(X, Y) -#define OMNITRACE_LINESTR OMNITRACE_STRINGIZE(__LINE__) -#define OMNITRACE_ESC(...) __VA_ARGS__ +#define ROCPROFSYS_STRINGIZE(X) ROCPROFSYS_STRINGIZE2(X) +#define ROCPROFSYS_STRINGIZE2(X) #X +#define ROCPROFSYS_VAR_NAME_COMBINE(X, Y) X##Y +#define ROCPROFSYS_VARIABLE(X, Y) ROCPROFSYS_VAR_NAME_COMBINE(X, Y) +#define ROCPROFSYS_LINESTR ROCPROFSYS_STRINGIZE(__LINE__) +#define ROCPROFSYS_ESC(...) __VA_ARGS__ #if defined(__cplusplus) -# if !defined(OMNITRACE_FOLD_EXPRESSION) -# define OMNITRACE_FOLD_EXPRESSION(...) ((__VA_ARGS__), ...) +# if !defined(ROCPROFSYS_FOLD_EXPRESSION) +# define ROCPROFSYS_FOLD_EXPRESSION(...) ((__VA_ARGS__), ...) # endif #endif diff --git a/source/lib/common/environment.hpp b/source/lib/common/environment.hpp index b5f17718..c8a889ac 100644 --- a/source/lib/common/environment.hpp +++ b/source/lib/common/environment.hpp @@ -34,43 +34,43 @@ #include #include -#if !defined(OMNITRACE_ENVIRON_LOG_NAME) -# if defined(OMNITRACE_COMMON_LIBRARY_NAME) -# define OMNITRACE_ENVIRON_LOG_NAME "[" OMNITRACE_COMMON_LIBRARY_NAME "]" +#if !defined(ROCPROFSYS_ENVIRON_LOG_NAME) +# if defined(ROCPROFSYS_COMMON_LIBRARY_NAME) +# define ROCPROFSYS_ENVIRON_LOG_NAME "[" ROCPROFSYS_COMMON_LIBRARY_NAME "]" # else -# define OMNITRACE_ENVIRON_LOG_NAME +# define ROCPROFSYS_ENVIRON_LOG_NAME # endif #endif -#if !defined(OMNITRACE_ENVIRON_LOG_START) -# if defined(OMNITRACE_COMMON_LIBRARY_LOG_START) -# define OMNITRACE_ENVIRON_LOG_START OMNITRACE_COMMON_LIBRARY_LOG_START +#if !defined(ROCPROFSYS_ENVIRON_LOG_START) +# if defined(ROCPROFSYS_COMMON_LIBRARY_LOG_START) +# define ROCPROFSYS_ENVIRON_LOG_START ROCPROFSYS_COMMON_LIBRARY_LOG_START # elif defined(TIMEMORY_LOG_COLORS_AVAILABLE) -# define OMNITRACE_ENVIRON_LOG_START \ +# define ROCPROFSYS_ENVIRON_LOG_START \ fprintf(stderr, "%s", ::tim::log::color::info()); # else -# define OMNITRACE_ENVIRON_LOG_START +# define ROCPROFSYS_ENVIRON_LOG_START # endif #endif -#if !defined(OMNITRACE_ENVIRON_LOG_END) -# if defined(OMNITRACE_COMMON_LIBRARY_LOG_END) -# define OMNITRACE_ENVIRON_LOG_END OMNITRACE_COMMON_LIBRARY_LOG_END +#if !defined(ROCPROFSYS_ENVIRON_LOG_END) +# if defined(ROCPROFSYS_COMMON_LIBRARY_LOG_END) +# define ROCPROFSYS_ENVIRON_LOG_END ROCPROFSYS_COMMON_LIBRARY_LOG_END # elif defined(TIMEMORY_LOG_COLORS_AVAILABLE) -# define OMNITRACE_ENVIRON_LOG_END fprintf(stderr, "%s", ::tim::log::color::end()); +# define ROCPROFSYS_ENVIRON_LOG_END fprintf(stderr, "%s", ::tim::log::color::end()); # else -# define OMNITRACE_ENVIRON_LOG_END +# define ROCPROFSYS_ENVIRON_LOG_END # endif #endif -#define OMNITRACE_ENVIRON_LOG(CONDITION, ...) \ +#define ROCPROFSYS_ENVIRON_LOG(CONDITION, ...) \ if(CONDITION) \ { \ fflush(stderr); \ - OMNITRACE_ENVIRON_LOG_START \ - fprintf(stderr, "[rocprof-sys]" OMNITRACE_ENVIRON_LOG_NAME "[%i] ", getpid()); \ + ROCPROFSYS_ENVIRON_LOG_START \ + fprintf(stderr, "[rocprof-sys]" ROCPROFSYS_ENVIRON_LOG_NAME "[%i] ", getpid()); \ fprintf(stderr, __VA_ARGS__); \ - OMNITRACE_ENVIRON_LOG_END \ + ROCPROFSYS_ENVIRON_LOG_END \ fflush(stderr); \ } @@ -162,7 +162,7 @@ get_env(std::string_view env_id, Tp&& _default) } } -struct OMNITRACE_INTERNAL_API env_config +struct ROCPROFSYS_INTERNAL_API env_config { std::string env_name = {}; std::string env_value = {}; @@ -171,7 +171,7 @@ struct OMNITRACE_INTERNAL_API env_config auto operator()(bool _verbose = false) const { if(env_name.empty()) return -1; - OMNITRACE_ENVIRON_LOG(_verbose, "setenv(\"%s\", \"%s\", %i)\n", env_name.c_str(), + ROCPROFSYS_ENVIRON_LOG(_verbose, "setenv(\"%s\", \"%s\", %i)\n", env_name.c_str(), env_value.c_str(), override); return setenv(env_name.c_str(), env_value.c_str(), override); } diff --git a/source/lib/common/invoke.hpp b/source/lib/common/invoke.hpp index e3b32431..09cd6b9f 100644 --- a/source/lib/common/invoke.hpp +++ b/source/lib/common/invoke.hpp @@ -31,17 +31,17 @@ #include #include -#if !defined(OMNITRACE_COMMON_LIBRARY_NAME) -# define OMNITRACE_COMMON_LIBRARY_NAME "common" -# error OMNITRACE_COMMON_LIBRARY_NAME must be defined +#if !defined(ROCPROFSYS_COMMON_LIBRARY_NAME) +# define ROCPROFSYS_COMMON_LIBRARY_NAME "common" +# error ROCPROFSYS_COMMON_LIBRARY_NAME must be defined #endif -#if !defined(OMNITRACE_COMMON_LIBRARY_LOG_START) -# define OMNITRACE_COMMON_LIBRARY_LOG_START +#if !defined(ROCPROFSYS_COMMON_LIBRARY_LOG_START) +# define ROCPROFSYS_COMMON_LIBRARY_LOG_START #endif -#if !defined(OMNITRACE_COMMON_LIBRARY_LOG_END) -# define OMNITRACE_COMMON_LIBRARY_LOG_END +#if !defined(ROCPROFSYS_COMMON_LIBRARY_LOG_END) +# define ROCPROFSYS_COMMON_LIBRARY_LOG_END #endif namespace omnitrace @@ -52,7 +52,7 @@ namespace { template inline auto -invoke(const char* _name, FuncT&& _func, Args... _args) OMNITRACE_HIDDEN_API; +invoke(const char* _name, FuncT&& _func, Args... _args) ROCPROFSYS_HIDDEN_API; inline int32_t& get_guard() @@ -77,7 +77,7 @@ ignore(const char* _name, int _verbose, int _value, const char* _reason, Args... { fflush(stderr); fprintf(stderr, - "[rocprof-sys][" OMNITRACE_COMMON_LIBRARY_NAME + "[rocprof-sys][" ROCPROFSYS_COMMON_LIBRARY_NAME "][%i][%li] %s(%s) was ignored :: %s\n", getpid(), get_thread_index(), _name, join(QuoteStrings{}, ", ", _args...).c_str(), _reason); @@ -107,13 +107,13 @@ invoke(const char* _name, int _verbose, bool& _toggle, FuncT&& _func, Args... _a if(_verbose >= 3) { fflush(stderr); - OMNITRACE_COMMON_LIBRARY_LOG_START + ROCPROFSYS_COMMON_LIBRARY_LOG_START fprintf(stderr, - "[rocprof-sys][" OMNITRACE_COMMON_LIBRARY_NAME + "[rocprof-sys][" ROCPROFSYS_COMMON_LIBRARY_NAME "][%i][%li][%i] %s(%s)\n", getpid(), get_thread_index(), _lk, _name, join(QuoteStrings{}, ", ", _args...).c_str()); - OMNITRACE_COMMON_LIBRARY_LOG_END + ROCPROFSYS_COMMON_LIBRARY_LOG_END fflush(stderr); } return std::invoke(std::forward(_func), _args...); @@ -121,25 +121,25 @@ invoke(const char* _name, int _verbose, bool& _toggle, FuncT&& _func, Args... _a else if(_verbose >= 2) { fflush(stderr); - OMNITRACE_COMMON_LIBRARY_LOG_START + ROCPROFSYS_COMMON_LIBRARY_LOG_START fprintf(stderr, - "[rocprof-sys][" OMNITRACE_COMMON_LIBRARY_NAME + "[rocprof-sys][" ROCPROFSYS_COMMON_LIBRARY_NAME "][%i][%li] %s(%s) was guarded :: value = %i\n", getpid(), get_thread_index(), _name, join(QuoteStrings{}, ", ", _args...).c_str(), _lk); - OMNITRACE_COMMON_LIBRARY_LOG_END + ROCPROFSYS_COMMON_LIBRARY_LOG_END fflush(stderr); } } else if(_verbose >= 0) { - OMNITRACE_COMMON_LIBRARY_LOG_START + ROCPROFSYS_COMMON_LIBRARY_LOG_START fprintf(stderr, - "[rocprof-sys][" OMNITRACE_COMMON_LIBRARY_NAME + "[rocprof-sys][" ROCPROFSYS_COMMON_LIBRARY_NAME "][%i][%li] %s(%s) ignored :: null function pointer\n", getpid(), get_thread_index(), _name, join(QuoteStrings{}, ", ", _args...).c_str()); - OMNITRACE_COMMON_LIBRARY_LOG_END + ROCPROFSYS_COMMON_LIBRARY_LOG_END } using return_type = decltype(std::invoke(std::forward(_func), _args...)); diff --git a/source/lib/common/join.hpp b/source/lib/common/join.hpp index f350e8dc..7720fd04 100644 --- a/source/lib/common/join.hpp +++ b/source/lib/common/join.hpp @@ -31,8 +31,8 @@ #include #include -#if !defined(OMNITRACE_FOLD_EXPRESSION) -# define OMNITRACE_FOLD_EXPRESSION(...) ((__VA_ARGS__), ...) +#if !defined(ROCPROFSYS_FOLD_EXPRESSION) +# define ROCPROFSYS_FOLD_EXPRESSION(...) ((__VA_ARGS__), ...) #endif namespace omnitrace @@ -99,13 +99,13 @@ join(DelimT&& _delim, Args&&... _args) if constexpr(std::is_same::value) { const char _delim_c[2] = { _delim, '\0' }; - OMNITRACE_FOLD_EXPRESSION(_ss << _delim_c << _args); + ROCPROFSYS_FOLD_EXPRESSION(_ss << _delim_c << _args); auto _ret = _ss.str(); return (_ret.length() > 1) ? _ret.substr(1) : std::string{}; } else { - OMNITRACE_FOLD_EXPRESSION(_ss << _delim << _args); + ROCPROFSYS_FOLD_EXPRESSION(_ss << _delim << _args); auto _ret = _ss.str(); auto&& _len = std::string{ _delim }.length(); return (_ret.length() > _len) ? _ret.substr(_len) : std::string{}; @@ -127,13 +127,13 @@ join(QuoteStrings&&, DelimT&& _delim, Args&&... _args) if constexpr(std::is_same::value) { const char _delim_c[2] = { _delim, '\0' }; - OMNITRACE_FOLD_EXPRESSION(_ss << _delim_c << as_string(_args)); + ROCPROFSYS_FOLD_EXPRESSION(_ss << _delim_c << as_string(_args)); auto _ret = _ss.str(); return (_ret.length() > 1) ? _ret.substr(1) : std::string{}; } else { - OMNITRACE_FOLD_EXPRESSION(_ss << _delim << as_string(_args)); + ROCPROFSYS_FOLD_EXPRESSION(_ss << _delim << as_string(_args)); auto _ret = _ss.str(); auto&& _len = std::string{ _delim }.length(); return (_ret.length() > _len) ? _ret.substr(_len) : std::string{}; diff --git a/source/lib/common/path.hpp b/source/lib/common/path.hpp index 6202f584..75bab3c9 100644 --- a/source/lib/common/path.hpp +++ b/source/lib/common/path.hpp @@ -38,42 +38,42 @@ #include #include -#if !defined(OMNITRACE_PATH_LOG_NAME) -# if defined(OMNITRACE_COMMON_LIBRARY_NAME) -# define OMNITRACE_PATH_LOG_NAME "[" OMNITRACE_COMMON_LIBRARY_NAME "]" +#if !defined(ROCPROFSYS_PATH_LOG_NAME) +# if defined(ROCPROFSYS_COMMON_LIBRARY_NAME) +# define ROCPROFSYS_PATH_LOG_NAME "[" ROCPROFSYS_COMMON_LIBRARY_NAME "]" # else -# define OMNITRACE_PATH_LOG_NAME +# define ROCPROFSYS_PATH_LOG_NAME # endif #endif -#if !defined(OMNITRACE_PATH_LOG_START) -# if defined(OMNITRACE_COMMON_LIBRARY_LOG_START) -# define OMNITRACE_PATH_LOG_START OMNITRACE_COMMON_LIBRARY_LOG_START +#if !defined(ROCPROFSYS_PATH_LOG_START) +# if defined(ROCPROFSYS_COMMON_LIBRARY_LOG_START) +# define ROCPROFSYS_PATH_LOG_START ROCPROFSYS_COMMON_LIBRARY_LOG_START # elif defined(TIMEMORY_LOG_COLORS_AVAILABLE) -# define OMNITRACE_PATH_LOG_START fprintf(stderr, "%s", ::tim::log::color::info()); +# define ROCPROFSYS_PATH_LOG_START fprintf(stderr, "%s", ::tim::log::color::info()); # else -# define OMNITRACE_PATH_LOG_START +# define ROCPROFSYS_PATH_LOG_START # endif #endif -#if !defined(OMNITRACE_PATH_LOG_END) -# if defined(OMNITRACE_COMMON_LIBRARY_LOG_END) -# define OMNITRACE_PATH_LOG_END OMNITRACE_COMMON_LIBRARY_LOG_END +#if !defined(ROCPROFSYS_PATH_LOG_END) +# if defined(ROCPROFSYS_COMMON_LIBRARY_LOG_END) +# define ROCPROFSYS_PATH_LOG_END ROCPROFSYS_COMMON_LIBRARY_LOG_END # elif defined(TIMEMORY_LOG_COLORS_AVAILABLE) -# define OMNITRACE_PATH_LOG_END fprintf(stderr, "%s", ::tim::log::color::end()); +# define ROCPROFSYS_PATH_LOG_END fprintf(stderr, "%s", ::tim::log::color::end()); # else -# define OMNITRACE_PATH_LOG_END +# define ROCPROFSYS_PATH_LOG_END # endif #endif -#define OMNITRACE_PATH_LOG(CONDITION, ...) \ +#define ROCPROFSYS_PATH_LOG(CONDITION, ...) \ if(CONDITION) \ { \ fflush(stderr); \ - OMNITRACE_PATH_LOG_START \ - fprintf(stderr, "[rocprof-sys]" OMNITRACE_PATH_LOG_NAME "[%i] ", getpid()); \ + ROCPROFSYS_PATH_LOG_START \ + fprintf(stderr, "[rocprof-sys]" ROCPROFSYS_PATH_LOG_NAME "[%i] ", getpid()); \ fprintf(stderr, __VA_ARGS__); \ - OMNITRACE_PATH_LOG_END \ + ROCPROFSYS_PATH_LOG_END \ fflush(stderr); \ } @@ -85,45 +85,45 @@ namespace path { inline std::vector get_link_map(const char*, std::vector&& = { (RTLD_LAZY | RTLD_NOLOAD) }, - bool _include_self = false) OMNITRACE_INTERNAL_API; + bool _include_self = false) ROCPROFSYS_INTERNAL_API; inline auto get_link_map(const char* _name, bool&& _include_self, std::vector&& _open_modes = { - (RTLD_LAZY | RTLD_NOLOAD) }) OMNITRACE_INTERNAL_API; + (RTLD_LAZY | RTLD_NOLOAD) }) ROCPROFSYS_INTERNAL_API; inline std::string get_origin(const std::string&, - std::vector&& = { (RTLD_LAZY | RTLD_NOLOAD) }) OMNITRACE_INTERNAL_API; + std::vector&& = { (RTLD_LAZY | RTLD_NOLOAD) }) ROCPROFSYS_INTERNAL_API; inline bool -exists(const std::string& _fname) OMNITRACE_INTERNAL_API; +exists(const std::string& _fname) ROCPROFSYS_INTERNAL_API; template inline RetT -get_default_lib_search_paths() OMNITRACE_INTERNAL_API; +get_default_lib_search_paths() ROCPROFSYS_INTERNAL_API; inline std::string find_path(const std::string& _path, int _verbose, - const std::string& _search_paths = {}) OMNITRACE_INTERNAL_API; + const std::string& _search_paths = {}) ROCPROFSYS_INTERNAL_API; inline std::string -dirname(const std::string& _fname) OMNITRACE_INTERNAL_API; +dirname(const std::string& _fname) ROCPROFSYS_INTERNAL_API; inline std::string realpath(const std::string& _relpath, - std::string* _resolved = nullptr) OMNITRACE_INTERNAL_API; + std::string* _resolved = nullptr) ROCPROFSYS_INTERNAL_API; inline bool -is_text_file(const std::string& filename) OMNITRACE_INTERNAL_API; +is_text_file(const std::string& filename) ROCPROFSYS_INTERNAL_API; inline bool -is_link(const std::string& _path) OMNITRACE_INTERNAL_API; +is_link(const std::string& _path) ROCPROFSYS_INTERNAL_API; inline std::string -readlink(const std::string& _path) OMNITRACE_INTERNAL_API; +readlink(const std::string& _path) ROCPROFSYS_INTERNAL_API; -struct OMNITRACE_INTERNAL_API path_type +struct ROCPROFSYS_INTERNAL_API path_type { enum path_type_e { @@ -205,12 +205,12 @@ find_path(const std::string& _path, int _verbose, const std::string& _search_pat for(const auto& itr : _paths) { auto _f = join('/', itr, _path); - OMNITRACE_PATH_LOG(_verbose >= _verbose_lvl + 1, + ROCPROFSYS_PATH_LOG(_verbose >= _verbose_lvl + 1, "searching for '%s' in '%s' ...\n", _path.c_str(), itr.c_str()); if(exists(_f)) { - OMNITRACE_PATH_LOG(_verbose >= _verbose_lvl, "found '%s' in '%s' ...\n", + ROCPROFSYS_PATH_LOG(_verbose >= _verbose_lvl, "found '%s' in '%s' ...\n", _path.c_str(), itr.c_str()); return _f; } @@ -225,12 +225,12 @@ find_path(const std::string& _path, int _verbose, const std::string& _search_pat for(const auto* sitr : { "lib", "lib64", "../lib", "../lib64" }) { auto _f = join('/', dirname(itr), sitr, _path); - OMNITRACE_PATH_LOG(_verbose >= _verbose_lvl + 1, + ROCPROFSYS_PATH_LOG(_verbose >= _verbose_lvl + 1, "searching for '%s' in '%s' ...\n", _path.c_str(), common::join('/', itr, sitr).c_str()); if(exists(_f)) { - OMNITRACE_PATH_LOG(_verbose >= _verbose_lvl, + ROCPROFSYS_PATH_LOG(_verbose >= _verbose_lvl, "found '%s' in '%s' ...\n", _path.c_str(), itr.c_str()); return _f; @@ -318,7 +318,7 @@ is_text_file(const std::string& filename) std::ifstream _file{ filename, std::ios::in | std::ios::binary }; if(!_file.is_open()) { - OMNITRACE_PATH_LOG(0, "Error! '%s' could not be opened...\n", filename.c_str()); + ROCPROFSYS_PATH_LOG(0, "Error! '%s' could not be opened...\n", filename.c_str()); return false; } diff --git a/source/lib/common/setup.hpp b/source/lib/common/setup.hpp index c2ebec63..39b55205 100644 --- a/source/lib/common/setup.hpp +++ b/source/lib/common/setup.hpp @@ -41,43 +41,43 @@ #include #include -#if !defined(OMNITRACE_SETUP_LOG_NAME) -# if defined(OMNITRACE_COMMON_LIBRARY_NAME) -# define OMNITRACE_SETUP_LOG_NAME "[" OMNITRACE_COMMON_LIBRARY_NAME "]" +#if !defined(ROCPROFSYS_SETUP_LOG_NAME) +# if defined(ROCPROFSYS_COMMON_LIBRARY_NAME) +# define ROCPROFSYS_SETUP_LOG_NAME "[" ROCPROFSYS_COMMON_LIBRARY_NAME "]" # else -# define OMNITRACE_SETUP_LOG_NAME +# define ROCPROFSYS_SETUP_LOG_NAME # endif #endif -#if !defined(OMNITRACE_SETUP_LOG_START) -# if defined(OMNITRACE_COMMON_LIBRARY_LOG_START) -# define OMNITRACE_SETUP_LOG_START OMNITRACE_COMMON_LIBRARY_LOG_START +#if !defined(ROCPROFSYS_SETUP_LOG_START) +# if defined(ROCPROFSYS_COMMON_LIBRARY_LOG_START) +# define ROCPROFSYS_SETUP_LOG_START ROCPROFSYS_COMMON_LIBRARY_LOG_START # elif defined(TIMEMORY_LOG_COLORS_AVAILABLE) -# define OMNITRACE_SETUP_LOG_START \ +# define ROCPROFSYS_SETUP_LOG_START \ fprintf(stderr, "%s", ::tim::log::color::info()); # else -# define OMNITRACE_SETUP_LOG_START +# define ROCPROFSYS_SETUP_LOG_START # endif #endif -#if !defined(OMNITRACE_SETUP_LOG_END) -# if defined(OMNITRACE_COMMON_LIBRARY_LOG_END) -# define OMNITRACE_SETUP_LOG_END OMNITRACE_COMMON_LIBRARY_LOG_END +#if !defined(ROCPROFSYS_SETUP_LOG_END) +# if defined(ROCPROFSYS_COMMON_LIBRARY_LOG_END) +# define ROCPROFSYS_SETUP_LOG_END ROCPROFSYS_COMMON_LIBRARY_LOG_END # elif defined(TIMEMORY_LOG_COLORS_AVAILABLE) -# define OMNITRACE_SETUP_LOG_END fprintf(stderr, "%s", ::tim::log::color::end()); +# define ROCPROFSYS_SETUP_LOG_END fprintf(stderr, "%s", ::tim::log::color::end()); # else -# define OMNITRACE_SETUP_LOG_END +# define ROCPROFSYS_SETUP_LOG_END # endif #endif -#define OMNITRACE_SETUP_LOG(CONDITION, ...) \ +#define ROCPROFSYS_SETUP_LOG(CONDITION, ...) \ if(CONDITION) \ { \ fflush(stderr); \ - OMNITRACE_SETUP_LOG_START \ - fprintf(stderr, "[rocprof-sys]" OMNITRACE_SETUP_LOG_NAME "[%i] ", getpid()); \ + ROCPROFSYS_SETUP_LOG_START \ + fprintf(stderr, "[rocprof-sys]" ROCPROFSYS_SETUP_LOG_NAME "[%i] ", getpid()); \ fprintf(stderr, __VA_ARGS__); \ - OMNITRACE_SETUP_LOG_END \ + ROCPROFSYS_SETUP_LOG_END \ fflush(stderr); \ } @@ -109,17 +109,17 @@ get_environ(int _verbose, std::string _search_paths = {}, _omnilib = common::path::find_path(_omnilib, _verbose, _search_paths); _omnilib_dl = common::path::find_path(_omnilib_dl, _verbose, _search_paths); -#if defined(OMNITRACE_USE_ROCTRACER) && OMNITRACE_USE_ROCTRACER > 0 +#if defined(ROCPROFSYS_USE_ROCTRACER) && ROCPROFSYS_USE_ROCTRACER > 0 _data.emplace_back(env_config{ "HSA_TOOLS_LIB", _omnilib.c_str(), 0 }); #endif -#if defined(OMNITRACE_USE_ROCPROFILER) && OMNITRACE_USE_ROCPROFILER > 0 -# if OMNITRACE_HIP_VERSION >= 50200 +#if defined(ROCPROFSYS_USE_ROCPROFILER) && ROCPROFSYS_USE_ROCPROFILER > 0 +# if ROCPROFSYS_HIP_VERSION >= 50200 # define ROCPROFILER_METRICS_DIR "lib/rocprofiler" # else # define ROCPROFILER_METRICS_DIR "rocprofiler/lib" # endif -# if OMNITRACE_HIP_VERSION <= 50500 +# if ROCPROFSYS_HIP_VERSION <= 50500 # define ROCPROFILER_LIBNAME "librocprofiler64.so" # else # define ROCPROFILER_LIBNAME "librocprofiler64.so.1" @@ -150,9 +150,9 @@ get_environ(int _verbose, std::string _search_paths = {}, // default path _possible_rocp_metrics.emplace_back( - common::join('/', OMNITRACE_DEFAULT_ROCM_PATH, "lib/rocprofiler")); + common::join('/', ROCPROFSYS_DEFAULT_ROCM_PATH, "lib/rocprofiler")); _possible_rocp_metrics.emplace_back( - common::join('/', OMNITRACE_DEFAULT_ROCM_PATH, "rocprofiler/lib")); + common::join('/', ROCPROFSYS_DEFAULT_ROCM_PATH, "rocprofiler/lib")); auto _realpath_and_unique = [](const auto& _inp_v) { auto _out_v = decltype(_inp_v){}; @@ -243,14 +243,14 @@ get_environ(int _verbose, std::string _search_paths = {}, "metrics.xml typically contains:\n\t#include " "\"gfx_metrics.xml\"\nMake sure the provided path also contains this " "file.\nExample:\n\texport ROCP_METRICS=" - << OMNITRACE_DEFAULT_ROCM_PATH << "/" << ROCPROFILER_METRICS_DIR + << ROCPROFSYS_DEFAULT_ROCM_PATH << "/" << ROCPROFILER_METRICS_DIR << "/metrics.xml\n"; } throw std::runtime_error(_msg.str()); } #endif -#if defined(OMNITRACE_USE_OMPT) && OMNITRACE_USE_OMPT > 0 +#if defined(ROCPROFSYS_USE_OMPT) && ROCPROFSYS_USE_OMPT > 0 if(get_env("ROCPROFSYS_USE_OMPT", true)) { std::string _omni_omp_libs = _omnilib_dl; @@ -262,7 +262,7 @@ get_environ(int _verbose, std::string _search_paths = {}, _override = 1; _omni_omp_libs = common::join(':', _omp_libs, _omnilib_dl); } - OMNITRACE_SETUP_LOG(_verbose >= 2, "setting OMP_TOOL_LIBRARIES to '%s'\n", + ROCPROFSYS_SETUP_LOG(_verbose >= 2, "setting OMP_TOOL_LIBRARIES to '%s'\n", _omni_omp_libs.c_str()); _data.emplace_back( env_config{ "OMP_TOOL_LIBRARIES", _omni_omp_libs.c_str(), _override }); diff --git a/source/lib/core/CMakeLists.txt b/source/lib/core/CMakeLists.txt index c1cb39a4..94c4319a 100644 --- a/source/lib/core/CMakeLists.txt +++ b/source/lib/core/CMakeLists.txt @@ -70,7 +70,7 @@ target_link_libraries( $ $ $ - $,rocprofsys::rocprofsys-lto,>> + $,rocprofsys::rocprofsys-lto,>> ) set_target_properties(rocprofsys-core-library PROPERTIES OUTPUT_NAME rocprof-sys-core) diff --git a/source/lib/core/argparse.cpp b/source/lib/core/argparse.cpp index b8506a48..8f7ead8f 100644 --- a/source/lib/core/argparse.cpp +++ b/source/lib/core/argparse.cpp @@ -56,25 +56,25 @@ get_clock_id_choices() return _v; }; -#define OMNITRACE_CLOCK_IDENTIFIER(VAL) \ +#define ROCPROFSYS_CLOCK_IDENTIFIER(VAL) \ std::make_tuple(clock_name(#VAL), VAL, std::string_view{ #VAL }) auto _choices = strvec_t{}; auto _aliases = std::map{}; - for(auto itr : { OMNITRACE_CLOCK_IDENTIFIER(CLOCK_REALTIME), - OMNITRACE_CLOCK_IDENTIFIER(CLOCK_MONOTONIC), - OMNITRACE_CLOCK_IDENTIFIER(CLOCK_PROCESS_CPUTIME_ID), - OMNITRACE_CLOCK_IDENTIFIER(CLOCK_MONOTONIC_RAW), - OMNITRACE_CLOCK_IDENTIFIER(CLOCK_REALTIME_COARSE), - OMNITRACE_CLOCK_IDENTIFIER(CLOCK_MONOTONIC_COARSE), - OMNITRACE_CLOCK_IDENTIFIER(CLOCK_BOOTTIME) }) + for(auto itr : { ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_REALTIME), + ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_MONOTONIC), + ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_PROCESS_CPUTIME_ID), + ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_MONOTONIC_RAW), + ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_REALTIME_COARSE), + ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_MONOTONIC_COARSE), + ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_BOOTTIME) }) { auto _choice = std::to_string(std::get<1>(itr)); _choices.emplace_back(_choice); _aliases[_choice] = { std::get<0>(itr), std::string{ std::get<2>(itr) } }; } -#undef OMNITRACE_CLOCK_IDENTIFIER +#undef ROCPROFSYS_CLOCK_IDENTIFIER return std::make_pair(_choices, _aliases); } @@ -222,18 +222,18 @@ init_parser(parser_data& _data) _data.dl_libpath = get_realpath(get_internal_libpath("librocprof-sys-dl.so").c_str()); _data.omni_libpath = get_realpath(get_internal_libpath("librocprof-sys.so").c_str()); -#if defined(OMNITRACE_USE_ROCTRACER) || defined(OMNITRACE_USE_ROCPROFILER) +#if defined(ROCPROFSYS_USE_ROCTRACER) || defined(ROCPROFSYS_USE_ROCPROFILER) update_env(_data, "HSA_TOOLS_LIB", _data.dl_libpath); if(!getenv("HSA_TOOLS_REPORT_LOAD_FAILURE")) update_env(_data, "HSA_TOOLS_REPORT_LOAD_FAILURE", "1"); #endif -#if defined(OMNITRACE_USE_ROCPROFILER) +#if defined(ROCPROFSYS_USE_ROCPROFILER) update_env(_data, "ROCP_TOOL_LIB", _data.omni_libpath); if(!getenv("ROCP_HSA_INTERCEPT")) update_env(_data, "ROCP_HSA_INTERCEPT", "1"); #endif -#if defined(OMNITRACE_USE_OMPT) +#if defined(ROCPROFSYS_USE_OMPT) if(!getenv("OMP_TOOL_LIBRARIES")) update_env(_data, "OMP_TOOL_LIBRARIES", _data.dl_libpath, UPD_PREPEND); #endif @@ -305,7 +305,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data) ? strvec_t{ "hsa-interrupt" } : strvec_t{}; -#if OMNITRACE_USE_ROCTRACER == 0 && OMNITRACE_USE_ROCPROFILER == 0 +#if ROCPROFSYS_USE_ROCTRACER == 0 && ROCPROFSYS_USE_ROCPROFILER == 0 _realtime_reqs.clear(); #endif @@ -567,28 +567,28 @@ add_core_arguments(parser_t& _parser, parser_data& _data) "rcclp", "rocm-smi", "roctracer", "rocprofiler", "roctx", "mutex-locks", "spin-locks", "rw-locks" }; -#if !defined(OMNITRACE_USE_MPI) && !defined(OMNITRACE_USE_MPI_HEADERS) +#if !defined(ROCPROFSYS_USE_MPI) && !defined(ROCPROFSYS_USE_MPI_HEADERS) _backend_choices.erase("mpip"); #endif -#if !defined(OMNITRACE_USE_OMPT) +#if !defined(ROCPROFSYS_USE_OMPT) _backend_choices.erase("ompt"); #endif -#if !defined(OMNITRACE_USE_RCCL) +#if !defined(ROCPROFSYS_USE_RCCL) _backend_choices.erase("rcclp"); #endif -#if !defined(OMNITRACE_USE_ROCM_SMI) +#if !defined(ROCPROFSYS_USE_ROCM_SMI) _backend_choices.erase("rocm-smi"); #endif -#if !defined(OMNITRACE_USE_ROCTRACER) +#if !defined(ROCPROFSYS_USE_ROCTRACER) _backend_choices.erase("roctracer"); _backend_choices.erase("roctx"); #endif -#if !defined(OMNITRACE_USE_ROCPROFILER) +#if !defined(ROCPROFSYS_USE_ROCPROFILER) _backend_choices.erase("rocprofiler"); #endif @@ -599,15 +599,15 @@ add_core_arguments(parser_t& _parser, parser_data& _data) _backend_choices.erase("roctracer"); _backend_choices.erase("rocprofiler"); -#if defined(OMNITRACE_USE_RCCL) +#if defined(ROCPROFSYS_USE_RCCL) update_env(_data, "ROCPROFSYS_USE_RCCLP", false); #endif -#if defined(OMNITRACE_USE_ROCM_SMI) +#if defined(ROCPROFSYS_USE_ROCM_SMI) update_env(_data, "ROCPROFSYS_USE_ROCM_SMI", false); #endif -#if defined(OMNITRACE_USE_ROCTRACER) +#if defined(ROCPROFSYS_USE_ROCTRACER) update_env(_data, "ROCPROFSYS_USE_ROCTRACER", false); update_env(_data, "ROCPROFSYS_USE_ROCTX", false); update_env(_data, "ROCPROFSYS_ROCTRACER_HSA_ACTIVITY", false); @@ -616,7 +616,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data) _backend_choices.erase("roctx"); #endif -#if defined(OMNITRACE_USE_ROCPROFILER) +#if defined(ROCPROFSYS_USE_ROCPROFILER) update_env(_data, "ROCPROFSYS_USE_ROCPROFILER", false); #endif } @@ -1210,7 +1210,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data) _data.processed_environs.emplace("papi_events"); } -#if defined(OMNITRACE_USE_ROCPROFILER) +#if defined(ROCPROFSYS_USE_ROCPROFILER) if(_data.environ_filter("gpu_events", _data)) { _parser diff --git a/source/lib/core/binary/address_range.hpp b/source/lib/core/binary/address_range.hpp index 96b5259e..33feab82 100644 --- a/source/lib/core/binary/address_range.hpp +++ b/source/lib/core/binary/address_range.hpp @@ -43,7 +43,7 @@ struct address_range uintptr_t low = std::numeric_limits::max(); uintptr_t high = std::numeric_limits::min(); - OMNITRACE_DEFAULT_OBJECT(address_range) + ROCPROFSYS_DEFAULT_OBJECT(address_range) explicit address_range(uintptr_t _v); address_range(uintptr_t _low, uintptr_t _high); diff --git a/source/lib/core/categories.cpp b/source/lib/core/categories.cpp index 27e19e1b..513b66b0 100644 --- a/source/lib/core/categories.cpp +++ b/source/lib/core/categories.cpp @@ -44,7 +44,7 @@ configure_categories(bool _enable, const std::set& _categories) auto _name = trait::name::value; if(_categories.count(_name) > 0) { - OMNITRACE_VERBOSE_F(3, "%s category: %s\n", (_enable) ? "Enabling" : "Disabling", + ROCPROFSYS_VERBOSE_F(3, "%s category: %s\n", (_enable) ? "Enabling" : "Disabling", _name); trait::runtime_enabled::set(_enable); } @@ -61,11 +61,11 @@ configure_categories(bool _enable, const std::set& _categories, void configure_categories(bool _enable, const std::set& _categories) { - OMNITRACE_VERBOSE_F(1, "%s categories...\n", (_enable) ? "Enabling" : "Disabling"); + ROCPROFSYS_VERBOSE_F(1, "%s categories...\n", (_enable) ? "Enabling" : "Disabling"); configure_categories( _enable, _categories, - utility::make_index_sequence_range<1, OMNITRACE_CATEGORY_LAST>{}); + utility::make_index_sequence_range<1, ROCPROFSYS_CATEGORY_LAST>{}); } } // namespace @@ -74,7 +74,7 @@ enable_categories(const std::set& _categories) { configure_categories( true, _categories, - utility::make_index_sequence_range<1, OMNITRACE_CATEGORY_LAST>{}); + utility::make_index_sequence_range<1, ROCPROFSYS_CATEGORY_LAST>{}); } void @@ -82,7 +82,7 @@ disable_categories(const std::set& _categories) { configure_categories( false, _categories, - utility::make_index_sequence_range<1, OMNITRACE_CATEGORY_LAST>{}); + utility::make_index_sequence_range<1, ROCPROFSYS_CATEGORY_LAST>{}); } void diff --git a/source/lib/core/categories.hpp b/source/lib/core/categories.hpp index 4cd96416..f5e5e461 100644 --- a/source/lib/core/categories.hpp +++ b/source/lib/core/categories.hpp @@ -35,7 +35,7 @@ #include #include -#define OMNITRACE_DEFINE_NAME_TRAIT(NAME, DESC, ...) \ +#define ROCPROFSYS_DEFINE_NAME_TRAIT(NAME, DESC, ...) \ namespace tim \ { \ namespace trait \ @@ -61,7 +61,7 @@ template using category_type_id_t = typename category_type_id::type; } // namespace omnitrace -#define OMNITRACE_DEFINE_CATEGORY_TRAIT(TYPE, ENUM) \ +#define ROCPROFSYS_DEFINE_CATEGORY_TRAIT(TYPE, ENUM) \ namespace omnitrace \ { \ template <> \ @@ -76,61 +76,61 @@ using category_type_id_t = typename category_type_id::type; }; \ } -#define OMNITRACE_DECLARE_CATEGORY(NS, VALUE, ENUM, NAME, DESC) \ +#define ROCPROFSYS_DECLARE_CATEGORY(NS, VALUE, ENUM, NAME, DESC) \ TIMEMORY_DECLARE_NS_API(NS, VALUE) \ - OMNITRACE_DEFINE_NAME_TRAIT(NAME, DESC, NS::VALUE) \ - OMNITRACE_DEFINE_CATEGORY_TRAIT(::tim::NS::VALUE, ENUM) -#define OMNITRACE_DEFINE_CATEGORY(NS, VALUE, ENUM, NAME, DESC) \ + ROCPROFSYS_DEFINE_NAME_TRAIT(NAME, DESC, NS::VALUE) \ + ROCPROFSYS_DEFINE_CATEGORY_TRAIT(::tim::NS::VALUE, ENUM) +#define ROCPROFSYS_DEFINE_CATEGORY(NS, VALUE, ENUM, NAME, DESC) \ TIMEMORY_DEFINE_NS_API(NS, VALUE) \ - OMNITRACE_DEFINE_NAME_TRAIT(NAME, DESC, NS::VALUE) \ - OMNITRACE_DEFINE_CATEGORY_TRAIT(::tim::NS::VALUE, ENUM) + ROCPROFSYS_DEFINE_NAME_TRAIT(NAME, DESC, NS::VALUE) \ + ROCPROFSYS_DEFINE_CATEGORY_TRAIT(::tim::NS::VALUE, ENUM) // clang-format off // these are defined by omnitrace -OMNITRACE_DEFINE_CATEGORY(project, omnitrace, OMNITRACE_CATEGORY_NONE, "rocprofsys", "ROCm Systems Profiler project") -OMNITRACE_DEFINE_CATEGORY(category, host, OMNITRACE_CATEGORY_HOST, "host", "Host-side function tracing") -OMNITRACE_DEFINE_CATEGORY(category, user, OMNITRACE_CATEGORY_USER, "user", "User-defined regions") -OMNITRACE_DEFINE_CATEGORY(category, python, OMNITRACE_CATEGORY_PYTHON, "python", "Python regions") -OMNITRACE_DEFINE_CATEGORY(category, device_hip, OMNITRACE_CATEGORY_DEVICE_HIP, "device_hip", "Device-side functions submitted via HIP API") -OMNITRACE_DEFINE_CATEGORY(category, device_hsa, OMNITRACE_CATEGORY_DEVICE_HSA, "device_hsa", "Device-side functions submitted via HSA API") -OMNITRACE_DEFINE_CATEGORY(category, rocm_hip, OMNITRACE_CATEGORY_ROCM_HIP, "rocm_hip", "Host-side HIP functions") -OMNITRACE_DEFINE_CATEGORY(category, rocm_hsa, OMNITRACE_CATEGORY_ROCM_HSA, "rocm_hsa", "Host-side HSA functions") -OMNITRACE_DEFINE_CATEGORY(category, rocm_roctx, OMNITRACE_CATEGORY_ROCM_ROCTX, "rocm_roctx", "ROCTx labels") -OMNITRACE_DEFINE_CATEGORY(category, rocm_smi, OMNITRACE_CATEGORY_ROCM_SMI, "rocm_smi", "rocm-smi data") -OMNITRACE_DEFINE_CATEGORY(category, rocm_smi_busy, OMNITRACE_CATEGORY_ROCM_SMI_BUSY, "device_busy", "Busy percentage of a GPU device") -OMNITRACE_DEFINE_CATEGORY(category, rocm_smi_temp, OMNITRACE_CATEGORY_ROCM_SMI_TEMP, "device_temp", "Temperature of a GPU device") -OMNITRACE_DEFINE_CATEGORY(category, rocm_smi_power, OMNITRACE_CATEGORY_ROCM_SMI_POWER, "device_power", "Power consumption of a GPU device") -OMNITRACE_DEFINE_CATEGORY(category, rocm_smi_memory_usage, OMNITRACE_CATEGORY_ROCM_SMI_MEMORY_USAGE, "device_memory_usage", "Memory usage of a GPU device") -OMNITRACE_DEFINE_CATEGORY(category, rocm_rccl, OMNITRACE_CATEGORY_ROCM_RCCL, "rccl", "ROCm Communication Collectives Library (RCCL) regions") -OMNITRACE_DEFINE_CATEGORY(category, roctracer, OMNITRACE_CATEGORY_ROCTRACER, "roctracer", "Kernel tracing provided by roctracer") -OMNITRACE_DEFINE_CATEGORY(category, rocprofiler, OMNITRACE_CATEGORY_ROCPROFILER, "rocprofiler", "HW counter data provided by rocprofiler") -OMNITRACE_DEFINE_CATEGORY(category, pthread, OMNITRACE_CATEGORY_PTHREAD, "pthread", "POSIX threading functions") -OMNITRACE_DEFINE_CATEGORY(category, kokkos, OMNITRACE_CATEGORY_KOKKOS, "kokkos", "KokkosTools regions") -OMNITRACE_DEFINE_CATEGORY(category, mpi, OMNITRACE_CATEGORY_MPI, "mpi", "MPI regions") -OMNITRACE_DEFINE_CATEGORY(category, ompt, OMNITRACE_CATEGORY_OMPT, "ompt", "OpenMP tools regions") -OMNITRACE_DEFINE_CATEGORY(category, process_sampling, OMNITRACE_CATEGORY_PROCESS_SAMPLING, "process_sampling", "Process-level data") -OMNITRACE_DEFINE_CATEGORY(category, comm_data, OMNITRACE_CATEGORY_COMM_DATA, "comm_data", "MPI/RCCL counters for tracking amount of data sent or received") -OMNITRACE_DEFINE_CATEGORY(category, causal, OMNITRACE_CATEGORY_CAUSAL, "causal", "Causal profiling data") -OMNITRACE_DEFINE_CATEGORY(category, cpu_freq, OMNITRACE_CATEGORY_CPU_FREQ, "cpu_frequency", "CPU frequency (collected in background thread)") -OMNITRACE_DEFINE_CATEGORY(category, process_page, OMNITRACE_CATEGORY_PROCESS_PAGE, "process_page_fault", "Memory page faults in process (collected in background thread)") -OMNITRACE_DEFINE_CATEGORY(category, process_virt, OMNITRACE_CATEGORY_PROCESS_VIRT, "process_virtual_memory", "Virtual memory usage in process in MB (collected in background thread)") -OMNITRACE_DEFINE_CATEGORY(category, process_peak, OMNITRACE_CATEGORY_PROCESS_PEAK, "process_memory_hwm", "Memory High-Water Mark i.e. peak memory usage (collected in background thread)") -OMNITRACE_DEFINE_CATEGORY(category, process_context_switch, OMNITRACE_CATEGORY_PROCESS_CONTEXT_SWITCH, "process_context_switch", "Context switches in process (collected in background thread)") -OMNITRACE_DEFINE_CATEGORY(category, process_page_fault, OMNITRACE_CATEGORY_PROCESS_PAGE_FAULT, "process_page_fault", "Memory page faults in process (collected in background thread)") -OMNITRACE_DEFINE_CATEGORY(category, process_user_mode_time, OMNITRACE_CATEGORY_PROCESS_USER_MODE_TIME, "process_user_cpu_time", "CPU time of functions executing in user-space in process in seconds (collected in background thread)") -OMNITRACE_DEFINE_CATEGORY(category, process_kernel_mode_time, OMNITRACE_CATEGORY_PROCESS_KERNEL_MODE_TIME, "process_kernel_cpu_time", "CPU time of functions executing in kernel-space in process in seconds (collected in background thread)") -OMNITRACE_DEFINE_CATEGORY(category, thread_wall_time, OMNITRACE_CATEGORY_THREAD_WALL_TIME, "thread_wall_time", "Wall-clock time on thread (derived from sampling)") -OMNITRACE_DEFINE_CATEGORY(category, thread_cpu_time, OMNITRACE_CATEGORY_THREAD_CPU_TIME, "thread_cpu_time", "CPU time on thread (derived from sampling)") -OMNITRACE_DEFINE_CATEGORY(category, thread_page_fault, OMNITRACE_CATEGORY_THREAD_PAGE_FAULT, "thread_page_fault", "Memory page faults on thread (derived from sampling)") -OMNITRACE_DEFINE_CATEGORY(category, thread_peak_memory, OMNITRACE_CATEGORY_THREAD_PEAK_MEMORY, "thread_peak_memory", "Peak memory usage on thread in MB (derived from sampling)") -OMNITRACE_DEFINE_CATEGORY(category, thread_context_switch, OMNITRACE_CATEGORY_THREAD_CONTEXT_SWITCH, "thread_context_switch", "Context switches on thread (derived from sampling)") -OMNITRACE_DEFINE_CATEGORY(category, thread_hardware_counter, OMNITRACE_CATEGORY_THREAD_HARDWARE_COUNTER, "thread_hardware_counter", "Hardware counter value on thread (derived from sampling)") -OMNITRACE_DEFINE_CATEGORY(category, kernel_hardware_counter, OMNITRACE_CATEGORY_KERNEL_HARDWARE_COUNTER, "kernel_hardware_counter", "Hardware counter value for kernel (deterministic)") -OMNITRACE_DEFINE_CATEGORY(category, numa, OMNITRACE_CATEGORY_NUMA, "numa", "Non-unified memory architecture") -OMNITRACE_DEFINE_CATEGORY(category, timer_sampling, OMNITRACE_CATEGORY_TIMER_SAMPLING, "timer_sampling", "Sampling based on a timer") -OMNITRACE_DEFINE_CATEGORY(category, overflow_sampling, OMNITRACE_CATEGORY_OVERFLOW_SAMPLING, "overflow_sampling", "Sampling based on a counter overflow") - -OMNITRACE_DECLARE_CATEGORY(category, sampling, OMNITRACE_CATEGORY_SAMPLING, "sampling", "Host-side call-stack sampling") +ROCPROFSYS_DEFINE_CATEGORY(project, omnitrace, ROCPROFSYS_CATEGORY_NONE, "rocprofsys", "ROCm Systems Profiler project") +ROCPROFSYS_DEFINE_CATEGORY(category, host, ROCPROFSYS_CATEGORY_HOST, "host", "Host-side function tracing") +ROCPROFSYS_DEFINE_CATEGORY(category, user, ROCPROFSYS_CATEGORY_USER, "user", "User-defined regions") +ROCPROFSYS_DEFINE_CATEGORY(category, python, ROCPROFSYS_CATEGORY_PYTHON, "python", "Python regions") +ROCPROFSYS_DEFINE_CATEGORY(category, device_hip, ROCPROFSYS_CATEGORY_DEVICE_HIP, "device_hip", "Device-side functions submitted via HIP API") +ROCPROFSYS_DEFINE_CATEGORY(category, device_hsa, ROCPROFSYS_CATEGORY_DEVICE_HSA, "device_hsa", "Device-side functions submitted via HSA API") +ROCPROFSYS_DEFINE_CATEGORY(category, rocm_hip, ROCPROFSYS_CATEGORY_ROCM_HIP, "rocm_hip", "Host-side HIP functions") +ROCPROFSYS_DEFINE_CATEGORY(category, rocm_hsa, ROCPROFSYS_CATEGORY_ROCM_HSA, "rocm_hsa", "Host-side HSA functions") +ROCPROFSYS_DEFINE_CATEGORY(category, rocm_roctx, ROCPROFSYS_CATEGORY_ROCM_ROCTX, "rocm_roctx", "ROCTx labels") +ROCPROFSYS_DEFINE_CATEGORY(category, rocm_smi, ROCPROFSYS_CATEGORY_ROCM_SMI, "rocm_smi", "rocm-smi data") +ROCPROFSYS_DEFINE_CATEGORY(category, rocm_smi_busy, ROCPROFSYS_CATEGORY_ROCM_SMI_BUSY, "device_busy", "Busy percentage of a GPU device") +ROCPROFSYS_DEFINE_CATEGORY(category, rocm_smi_temp, ROCPROFSYS_CATEGORY_ROCM_SMI_TEMP, "device_temp", "Temperature of a GPU device") +ROCPROFSYS_DEFINE_CATEGORY(category, rocm_smi_power, ROCPROFSYS_CATEGORY_ROCM_SMI_POWER, "device_power", "Power consumption of a GPU device") +ROCPROFSYS_DEFINE_CATEGORY(category, rocm_smi_memory_usage, ROCPROFSYS_CATEGORY_ROCM_SMI_MEMORY_USAGE, "device_memory_usage", "Memory usage of a GPU device") +ROCPROFSYS_DEFINE_CATEGORY(category, rocm_rccl, ROCPROFSYS_CATEGORY_ROCM_RCCL, "rccl", "ROCm Communication Collectives Library (RCCL) regions") +ROCPROFSYS_DEFINE_CATEGORY(category, roctracer, ROCPROFSYS_CATEGORY_ROCTRACER, "roctracer", "Kernel tracing provided by roctracer") +ROCPROFSYS_DEFINE_CATEGORY(category, rocprofiler, ROCPROFSYS_CATEGORY_ROCPROFILER, "rocprofiler", "HW counter data provided by rocprofiler") +ROCPROFSYS_DEFINE_CATEGORY(category, pthread, ROCPROFSYS_CATEGORY_PTHREAD, "pthread", "POSIX threading functions") +ROCPROFSYS_DEFINE_CATEGORY(category, kokkos, ROCPROFSYS_CATEGORY_KOKKOS, "kokkos", "KokkosTools regions") +ROCPROFSYS_DEFINE_CATEGORY(category, mpi, ROCPROFSYS_CATEGORY_MPI, "mpi", "MPI regions") +ROCPROFSYS_DEFINE_CATEGORY(category, ompt, ROCPROFSYS_CATEGORY_OMPT, "ompt", "OpenMP tools regions") +ROCPROFSYS_DEFINE_CATEGORY(category, process_sampling, ROCPROFSYS_CATEGORY_PROCESS_SAMPLING, "process_sampling", "Process-level data") +ROCPROFSYS_DEFINE_CATEGORY(category, comm_data, ROCPROFSYS_CATEGORY_COMM_DATA, "comm_data", "MPI/RCCL counters for tracking amount of data sent or received") +ROCPROFSYS_DEFINE_CATEGORY(category, causal, ROCPROFSYS_CATEGORY_CAUSAL, "causal", "Causal profiling data") +ROCPROFSYS_DEFINE_CATEGORY(category, cpu_freq, ROCPROFSYS_CATEGORY_CPU_FREQ, "cpu_frequency", "CPU frequency (collected in background thread)") +ROCPROFSYS_DEFINE_CATEGORY(category, process_page, ROCPROFSYS_CATEGORY_PROCESS_PAGE, "process_page_fault", "Memory page faults in process (collected in background thread)") +ROCPROFSYS_DEFINE_CATEGORY(category, process_virt, ROCPROFSYS_CATEGORY_PROCESS_VIRT, "process_virtual_memory", "Virtual memory usage in process in MB (collected in background thread)") +ROCPROFSYS_DEFINE_CATEGORY(category, process_peak, ROCPROFSYS_CATEGORY_PROCESS_PEAK, "process_memory_hwm", "Memory High-Water Mark i.e. peak memory usage (collected in background thread)") +ROCPROFSYS_DEFINE_CATEGORY(category, process_context_switch, ROCPROFSYS_CATEGORY_PROCESS_CONTEXT_SWITCH, "process_context_switch", "Context switches in process (collected in background thread)") +ROCPROFSYS_DEFINE_CATEGORY(category, process_page_fault, ROCPROFSYS_CATEGORY_PROCESS_PAGE_FAULT, "process_page_fault", "Memory page faults in process (collected in background thread)") +ROCPROFSYS_DEFINE_CATEGORY(category, process_user_mode_time, ROCPROFSYS_CATEGORY_PROCESS_USER_MODE_TIME, "process_user_cpu_time", "CPU time of functions executing in user-space in process in seconds (collected in background thread)") +ROCPROFSYS_DEFINE_CATEGORY(category, process_kernel_mode_time, ROCPROFSYS_CATEGORY_PROCESS_KERNEL_MODE_TIME, "process_kernel_cpu_time", "CPU time of functions executing in kernel-space in process in seconds (collected in background thread)") +ROCPROFSYS_DEFINE_CATEGORY(category, thread_wall_time, ROCPROFSYS_CATEGORY_THREAD_WALL_TIME, "thread_wall_time", "Wall-clock time on thread (derived from sampling)") +ROCPROFSYS_DEFINE_CATEGORY(category, thread_cpu_time, ROCPROFSYS_CATEGORY_THREAD_CPU_TIME, "thread_cpu_time", "CPU time on thread (derived from sampling)") +ROCPROFSYS_DEFINE_CATEGORY(category, thread_page_fault, ROCPROFSYS_CATEGORY_THREAD_PAGE_FAULT, "thread_page_fault", "Memory page faults on thread (derived from sampling)") +ROCPROFSYS_DEFINE_CATEGORY(category, thread_peak_memory, ROCPROFSYS_CATEGORY_THREAD_PEAK_MEMORY, "thread_peak_memory", "Peak memory usage on thread in MB (derived from sampling)") +ROCPROFSYS_DEFINE_CATEGORY(category, thread_context_switch, ROCPROFSYS_CATEGORY_THREAD_CONTEXT_SWITCH, "thread_context_switch", "Context switches on thread (derived from sampling)") +ROCPROFSYS_DEFINE_CATEGORY(category, thread_hardware_counter, ROCPROFSYS_CATEGORY_THREAD_HARDWARE_COUNTER, "thread_hardware_counter", "Hardware counter value on thread (derived from sampling)") +ROCPROFSYS_DEFINE_CATEGORY(category, kernel_hardware_counter, ROCPROFSYS_CATEGORY_KERNEL_HARDWARE_COUNTER, "kernel_hardware_counter", "Hardware counter value for kernel (deterministic)") +ROCPROFSYS_DEFINE_CATEGORY(category, numa, ROCPROFSYS_CATEGORY_NUMA, "numa", "Non-unified memory architecture") +ROCPROFSYS_DEFINE_CATEGORY(category, timer_sampling, ROCPROFSYS_CATEGORY_TIMER_SAMPLING, "timer_sampling", "Sampling based on a timer") +ROCPROFSYS_DEFINE_CATEGORY(category, overflow_sampling, ROCPROFSYS_CATEGORY_OVERFLOW_SAMPLING, "overflow_sampling", "Sampling based on a counter overflow") + +ROCPROFSYS_DECLARE_CATEGORY(category, sampling, ROCPROFSYS_CATEGORY_SAMPLING, "sampling", "Host-side call-stack sampling") // clang-format on namespace tim @@ -142,58 +142,58 @@ using name = perfetto_category; } } // namespace tim -#define OMNITRACE_PERFETTO_CATEGORY(TYPE) \ +#define ROCPROFSYS_PERFETTO_CATEGORY(TYPE) \ ::perfetto::Category(::tim::trait::perfetto_category<::tim::TYPE>::value) \ .SetDescription(::tim::trait::perfetto_category<::tim::TYPE>::description) -#define OMNITRACE_PERFETTO_CATEGORIES \ - OMNITRACE_PERFETTO_CATEGORY(category::host), \ - OMNITRACE_PERFETTO_CATEGORY(category::user), \ - OMNITRACE_PERFETTO_CATEGORY(category::python), \ - OMNITRACE_PERFETTO_CATEGORY(category::sampling), \ - OMNITRACE_PERFETTO_CATEGORY(category::device_hip), \ - OMNITRACE_PERFETTO_CATEGORY(category::device_hsa), \ - OMNITRACE_PERFETTO_CATEGORY(category::rocm_hip), \ - OMNITRACE_PERFETTO_CATEGORY(category::rocm_hsa), \ - OMNITRACE_PERFETTO_CATEGORY(category::rocm_roctx), \ - OMNITRACE_PERFETTO_CATEGORY(category::rocm_smi), \ - OMNITRACE_PERFETTO_CATEGORY(category::rocm_smi_busy), \ - OMNITRACE_PERFETTO_CATEGORY(category::rocm_smi_temp), \ - OMNITRACE_PERFETTO_CATEGORY(category::rocm_smi_power), \ - OMNITRACE_PERFETTO_CATEGORY(category::rocm_smi_memory_usage), \ - OMNITRACE_PERFETTO_CATEGORY(category::rocm_rccl), \ - OMNITRACE_PERFETTO_CATEGORY(category::roctracer), \ - OMNITRACE_PERFETTO_CATEGORY(category::rocprofiler), \ - OMNITRACE_PERFETTO_CATEGORY(category::pthread), \ - OMNITRACE_PERFETTO_CATEGORY(category::kokkos), \ - OMNITRACE_PERFETTO_CATEGORY(category::mpi), \ - OMNITRACE_PERFETTO_CATEGORY(category::ompt), \ - OMNITRACE_PERFETTO_CATEGORY(category::sampling), \ - OMNITRACE_PERFETTO_CATEGORY(category::process_sampling), \ - OMNITRACE_PERFETTO_CATEGORY(category::comm_data), \ - OMNITRACE_PERFETTO_CATEGORY(category::causal), \ - OMNITRACE_PERFETTO_CATEGORY(category::cpu_freq), \ - OMNITRACE_PERFETTO_CATEGORY(category::process_page), \ - OMNITRACE_PERFETTO_CATEGORY(category::process_virt), \ - OMNITRACE_PERFETTO_CATEGORY(category::process_peak), \ - OMNITRACE_PERFETTO_CATEGORY(category::process_context_switch), \ - OMNITRACE_PERFETTO_CATEGORY(category::process_page_fault), \ - OMNITRACE_PERFETTO_CATEGORY(category::process_user_mode_time), \ - OMNITRACE_PERFETTO_CATEGORY(category::process_kernel_mode_time), \ - OMNITRACE_PERFETTO_CATEGORY(category::thread_wall_time), \ - OMNITRACE_PERFETTO_CATEGORY(category::thread_cpu_time), \ - OMNITRACE_PERFETTO_CATEGORY(category::thread_page_fault), \ - OMNITRACE_PERFETTO_CATEGORY(category::thread_peak_memory), \ - OMNITRACE_PERFETTO_CATEGORY(category::thread_context_switch), \ - OMNITRACE_PERFETTO_CATEGORY(category::thread_hardware_counter), \ - OMNITRACE_PERFETTO_CATEGORY(category::kernel_hardware_counter), \ - OMNITRACE_PERFETTO_CATEGORY(category::numa), \ - OMNITRACE_PERFETTO_CATEGORY(category::timer_sampling), \ - OMNITRACE_PERFETTO_CATEGORY(category::overflow_sampling), \ +#define ROCPROFSYS_PERFETTO_CATEGORIES \ + ROCPROFSYS_PERFETTO_CATEGORY(category::host), \ + ROCPROFSYS_PERFETTO_CATEGORY(category::user), \ + ROCPROFSYS_PERFETTO_CATEGORY(category::python), \ + ROCPROFSYS_PERFETTO_CATEGORY(category::sampling), \ + ROCPROFSYS_PERFETTO_CATEGORY(category::device_hip), \ + ROCPROFSYS_PERFETTO_CATEGORY(category::device_hsa), \ + ROCPROFSYS_PERFETTO_CATEGORY(category::rocm_hip), \ + ROCPROFSYS_PERFETTO_CATEGORY(category::rocm_hsa), \ + ROCPROFSYS_PERFETTO_CATEGORY(category::rocm_roctx), \ + ROCPROFSYS_PERFETTO_CATEGORY(category::rocm_smi), \ + ROCPROFSYS_PERFETTO_CATEGORY(category::rocm_smi_busy), \ + ROCPROFSYS_PERFETTO_CATEGORY(category::rocm_smi_temp), \ + ROCPROFSYS_PERFETTO_CATEGORY(category::rocm_smi_power), \ + ROCPROFSYS_PERFETTO_CATEGORY(category::rocm_smi_memory_usage), \ + ROCPROFSYS_PERFETTO_CATEGORY(category::rocm_rccl), \ + ROCPROFSYS_PERFETTO_CATEGORY(category::roctracer), \ + ROCPROFSYS_PERFETTO_CATEGORY(category::rocprofiler), \ + ROCPROFSYS_PERFETTO_CATEGORY(category::pthread), \ + ROCPROFSYS_PERFETTO_CATEGORY(category::kokkos), \ + ROCPROFSYS_PERFETTO_CATEGORY(category::mpi), \ + ROCPROFSYS_PERFETTO_CATEGORY(category::ompt), \ + ROCPROFSYS_PERFETTO_CATEGORY(category::sampling), \ + ROCPROFSYS_PERFETTO_CATEGORY(category::process_sampling), \ + ROCPROFSYS_PERFETTO_CATEGORY(category::comm_data), \ + ROCPROFSYS_PERFETTO_CATEGORY(category::causal), \ + ROCPROFSYS_PERFETTO_CATEGORY(category::cpu_freq), \ + ROCPROFSYS_PERFETTO_CATEGORY(category::process_page), \ + ROCPROFSYS_PERFETTO_CATEGORY(category::process_virt), \ + ROCPROFSYS_PERFETTO_CATEGORY(category::process_peak), \ + ROCPROFSYS_PERFETTO_CATEGORY(category::process_context_switch), \ + ROCPROFSYS_PERFETTO_CATEGORY(category::process_page_fault), \ + ROCPROFSYS_PERFETTO_CATEGORY(category::process_user_mode_time), \ + ROCPROFSYS_PERFETTO_CATEGORY(category::process_kernel_mode_time), \ + ROCPROFSYS_PERFETTO_CATEGORY(category::thread_wall_time), \ + ROCPROFSYS_PERFETTO_CATEGORY(category::thread_cpu_time), \ + ROCPROFSYS_PERFETTO_CATEGORY(category::thread_page_fault), \ + ROCPROFSYS_PERFETTO_CATEGORY(category::thread_peak_memory), \ + ROCPROFSYS_PERFETTO_CATEGORY(category::thread_context_switch), \ + ROCPROFSYS_PERFETTO_CATEGORY(category::thread_hardware_counter), \ + ROCPROFSYS_PERFETTO_CATEGORY(category::kernel_hardware_counter), \ + ROCPROFSYS_PERFETTO_CATEGORY(category::numa), \ + ROCPROFSYS_PERFETTO_CATEGORY(category::timer_sampling), \ + ROCPROFSYS_PERFETTO_CATEGORY(category::overflow_sampling), \ ::perfetto::Category("timemory").SetDescription("Events from the timemory API") #if defined(TIMEMORY_USE_PERFETTO) -# define TIMEMORY_PERFETTO_CATEGORIES OMNITRACE_PERFETTO_CATEGORIES +# define TIMEMORY_PERFETTO_CATEGORIES ROCPROFSYS_PERFETTO_CATEGORIES #endif #include diff --git a/source/lib/core/common.hpp b/source/lib/core/common.hpp index 740991a6..57250680 100644 --- a/source/lib/core/common.hpp +++ b/source/lib/core/common.hpp @@ -50,7 +50,7 @@ #include #include -#define OMNITRACE_DECLARE_COMPONENT(NAME) \ +#define ROCPROFSYS_DECLARE_COMPONENT(NAME) \ namespace omnitrace \ { \ namespace component \ @@ -75,7 +75,7 @@ } \ } -#define OMNITRACE_COMPONENT_ALIAS(NAME, ...) \ +#define ROCPROFSYS_COMPONENT_ALIAS(NAME, ...) \ namespace omnitrace \ { \ namespace component \ @@ -91,7 +91,7 @@ } \ } -#define OMNITRACE_DEFINE_CONCRETE_TRAIT(TRAIT, TYPE, VALUE) \ +#define ROCPROFSYS_DEFINE_CONCRETE_TRAIT(TRAIT, TYPE, VALUE) \ namespace tim \ { \ namespace trait \ diff --git a/source/lib/core/components/fwd.hpp b/source/lib/core/components/fwd.hpp index aff7788b..5d02ee1f 100644 --- a/source/lib/core/components/fwd.hpp +++ b/source/lib/core/components/fwd.hpp @@ -39,12 +39,12 @@ #include -OMNITRACE_DECLARE_COMPONENT(roctracer) -OMNITRACE_DECLARE_COMPONENT(rocprofiler) -OMNITRACE_DECLARE_COMPONENT(rcclp_handle) -OMNITRACE_DECLARE_COMPONENT(comm_data) +ROCPROFSYS_DECLARE_COMPONENT(roctracer) +ROCPROFSYS_DECLARE_COMPONENT(rocprofiler) +ROCPROFSYS_DECLARE_COMPONENT(rcclp_handle) +ROCPROFSYS_DECLARE_COMPONENT(comm_data) -OMNITRACE_COMPONENT_ALIAS(comm_data_tracker_t, +ROCPROFSYS_COMPONENT_ALIAS(comm_data_tracker_t, ::tim::component::data_tracker) namespace omnitrace @@ -96,39 +96,39 @@ struct functors; } // namespace component } // namespace omnitrace -#if !defined(OMNITRACE_USE_ROCTRACER) -OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, component::roctracer, false_type) +#if !defined(ROCPROFSYS_USE_ROCTRACER) +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, component::roctracer, false_type) #endif -#if !defined(OMNITRACE_USE_ROCPROFILER) -OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, component::rocprofiler, false_type) +#if !defined(ROCPROFSYS_USE_ROCPROFILER) +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, component::rocprofiler, false_type) #endif -#if !defined(OMNITRACE_USE_RCCL) -OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, category::rocm_rccl, false_type) -OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, component::rcclp_handle, false_type) +#if !defined(ROCPROFSYS_USE_RCCL) +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, category::rocm_rccl, false_type) +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, component::rcclp_handle, false_type) #endif -#if !defined(OMNITRACE_USE_RCCL) && !defined(OMNITRACE_USE_MPI) -OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, component::comm_data_tracker_t, false_type) -OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, component::comm_data, false_type) +#if !defined(ROCPROFSYS_USE_RCCL) && !defined(ROCPROFSYS_USE_MPI) +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, component::comm_data_tracker_t, false_type) +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, component::comm_data, false_type) #endif #if !defined(TIMEMORY_USE_LIBUNWIND) -OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, category::sampling, false_type) -OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, component::backtrace, false_type) -OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, component::backtrace_metrics, false_type) -OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, component::backtrace_timestamp, false_type) -OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, component::sampling_wall_clock, false_type) -OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, component::sampling_cpu_clock, false_type) -OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, component::sampling_percent, false_type) +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, category::sampling, false_type) +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, component::backtrace, false_type) +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, component::backtrace_metrics, false_type) +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, component::backtrace_timestamp, false_type) +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, component::sampling_wall_clock, false_type) +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, component::sampling_cpu_clock, false_type) +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, component::sampling_percent, false_type) #endif -#if !defined(TIMEMORY_USE_LIBUNWIND) || !defined(OMNITRACE_USE_ROCM_SMI) -OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, component::sampling_gpu_busy, false_type) -OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, component::sampling_gpu_temp, false_type) -OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, component::sampling_gpu_power, false_type) -OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, component::sampling_gpu_memory, false_type) +#if !defined(TIMEMORY_USE_LIBUNWIND) || !defined(ROCPROFSYS_USE_ROCM_SMI) +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, component::sampling_gpu_busy, false_type) +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, component::sampling_gpu_temp, false_type) +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, component::sampling_gpu_power, false_type) +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, component::sampling_gpu_memory, false_type) #endif TIMEMORY_SET_COMPONENT_API(omnitrace::component::roctracer, project::omnitrace, @@ -198,46 +198,46 @@ TIMEMORY_STATISTICS_TYPE(omnitrace::component::sampling_gpu_memory, double) TIMEMORY_STATISTICS_TYPE(omnitrace::component::comm_data_tracker_t, float) // enable timing units -OMNITRACE_DEFINE_CONCRETE_TRAIT(is_timing_category, component::sampling_wall_clock, +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_timing_category, component::sampling_wall_clock, true_type) -OMNITRACE_DEFINE_CONCRETE_TRAIT(is_timing_category, component::sampling_cpu_clock, +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_timing_category, component::sampling_cpu_clock, true_type) -OMNITRACE_DEFINE_CONCRETE_TRAIT(is_timing_category, component::sampling_percent, +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_timing_category, component::sampling_percent, true_type) -OMNITRACE_DEFINE_CONCRETE_TRAIT(uses_timing_units, component::sampling_wall_clock, +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(uses_timing_units, component::sampling_wall_clock, true_type) -OMNITRACE_DEFINE_CONCRETE_TRAIT(uses_timing_units, component::sampling_cpu_clock, +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(uses_timing_units, component::sampling_cpu_clock, true_type) // enable percent units -OMNITRACE_DEFINE_CONCRETE_TRAIT(uses_percent_units, component::sampling_gpu_busy, +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(uses_percent_units, component::sampling_gpu_busy, true_type) -OMNITRACE_DEFINE_CONCRETE_TRAIT(uses_percent_units, component::sampling_percent, +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(uses_percent_units, component::sampling_percent, true_type) // enable memory units -OMNITRACE_DEFINE_CONCRETE_TRAIT(is_memory_category, component::sampling_gpu_memory, +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_memory_category, component::sampling_gpu_memory, true_type) -OMNITRACE_DEFINE_CONCRETE_TRAIT(uses_memory_units, component::sampling_gpu_memory, +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(uses_memory_units, component::sampling_gpu_memory, true_type) // reporting categories (sum) -OMNITRACE_DEFINE_CONCRETE_TRAIT(report_sum, component::sampling_gpu_busy, false_type) -OMNITRACE_DEFINE_CONCRETE_TRAIT(report_sum, component::sampling_gpu_temp, false_type) -OMNITRACE_DEFINE_CONCRETE_TRAIT(report_sum, component::sampling_gpu_power, false_type) -OMNITRACE_DEFINE_CONCRETE_TRAIT(report_sum, component::sampling_gpu_memory, false_type) +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(report_sum, component::sampling_gpu_busy, false_type) +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(report_sum, component::sampling_gpu_temp, false_type) +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(report_sum, component::sampling_gpu_power, false_type) +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(report_sum, component::sampling_gpu_memory, false_type) // reporting categories (mean) -OMNITRACE_DEFINE_CONCRETE_TRAIT(report_mean, component::sampling_percent, false_type) +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(report_mean, component::sampling_percent, false_type) // reporting categories (stats) -OMNITRACE_DEFINE_CONCRETE_TRAIT(report_statistics, component::sampling_percent, +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(report_statistics, component::sampling_percent, false_type) // reporting categories (self) -OMNITRACE_DEFINE_CONCRETE_TRAIT(report_self, component::sampling_percent, false_type) +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(report_self, component::sampling_percent, false_type) -#define OMNITRACE_DECLARE_EXTERN_COMPONENT(NAME, HAS_DATA, ...) \ +#define ROCPROFSYS_DECLARE_EXTERN_COMPONENT(NAME, HAS_DATA, ...) \ TIMEMORY_DECLARE_EXTERN_TEMPLATE( \ struct tim::component::base) \ @@ -245,7 +245,7 @@ OMNITRACE_DEFINE_CONCRETE_TRAIT(report_self, component::sampling_percent, false_ HAS_DATA) \ TIMEMORY_DECLARE_EXTERN_STORAGE(TIMEMORY_ESC(omnitrace::component::NAME)) -#define OMNITRACE_INSTANTIATE_EXTERN_COMPONENT(NAME, HAS_DATA, ...) \ +#define ROCPROFSYS_INSTANTIATE_EXTERN_COMPONENT(NAME, HAS_DATA, ...) \ TIMEMORY_INSTANTIATE_EXTERN_TEMPLATE( \ struct tim::component::base) \ diff --git a/source/lib/core/concepts.hpp b/source/lib/core/concepts.hpp index 8b40046f..99a9cc3b 100644 --- a/source/lib/core/concepts.hpp +++ b/source/lib/core/concepts.hpp @@ -35,7 +35,7 @@ namespace omnitrace { namespace concepts = ::tim::concepts; // NOLINT -static constexpr size_t max_supported_threads = OMNITRACE_MAX_THREADS; +static constexpr size_t max_supported_threads = ROCPROFSYS_MAX_THREADS; template struct thread_deleter; diff --git a/source/lib/core/config.cpp b/source/lib/core/config.cpp index 1973fe16..be4c5b6b 100644 --- a/source/lib/core/config.cpp +++ b/source/lib/core/config.cpp @@ -110,14 +110,14 @@ Tp get_available_categories() { auto _v = Tp{}; - for(auto itr : { OMNITRACE_PERFETTO_CATEGORIES }) + for(auto itr : { ROCPROFSYS_PERFETTO_CATEGORIES }) tim::utility::emplace(_v, itr.name); return _v; } using utility::parse_numeric_range; -#define OMNITRACE_CONFIG_SETTING(TYPE, ENV_NAME, DESCRIPTION, INITIAL_VALUE, ...) \ +#define ROCPROFSYS_CONFIG_SETTING(TYPE, ENV_NAME, DESCRIPTION, INITIAL_VALUE, ...) \ [&]() { \ auto _ret = _config->insert( \ ENV_NAME, get_setting_name(ENV_NAME), DESCRIPTION, TYPE{ INITIAL_VALUE }, \ @@ -125,28 +125,28 @@ using utility::parse_numeric_range; __VA_ARGS__ }); \ if(!_ret.second) \ { \ - OMNITRACE_PRINT("Warning! Duplicate setting: %s / %s\n", \ + ROCPROFSYS_PRINT("Warning! Duplicate setting: %s / %s\n", \ get_setting_name(ENV_NAME).c_str(), ENV_NAME); \ } \ return _config->find(ENV_NAME)->second; \ }() // below does not include "librocprof-sys" -#define OMNITRACE_CONFIG_EXT_SETTING(TYPE, ENV_NAME, DESCRIPTION, INITIAL_VALUE, ...) \ +#define ROCPROFSYS_CONFIG_EXT_SETTING(TYPE, ENV_NAME, DESCRIPTION, INITIAL_VALUE, ...) \ [&]() { \ auto _ret = _config->insert( \ ENV_NAME, get_setting_name(ENV_NAME), DESCRIPTION, TYPE{ INITIAL_VALUE }, \ std::set{ "custom", "rocprofsys", __VA_ARGS__ }); \ if(!_ret.second) \ { \ - OMNITRACE_PRINT("Warning! Duplicate setting: %s / %s\n", \ + ROCPROFSYS_PRINT("Warning! Duplicate setting: %s / %s\n", \ get_setting_name(ENV_NAME).c_str(), ENV_NAME); \ } \ return _config->find(ENV_NAME)->second; \ }() // setting + command line option -#define OMNITRACE_CONFIG_CL_SETTING(TYPE, ENV_NAME, DESCRIPTION, INITIAL_VALUE, \ +#define ROCPROFSYS_CONFIG_CL_SETTING(TYPE, ENV_NAME, DESCRIPTION, INITIAL_VALUE, \ CMD_LINE, ...) \ [&]() { \ auto _ret = _config->insert( \ @@ -156,7 +156,7 @@ using utility::parse_numeric_range; std::vector{ CMD_LINE }); \ if(!_ret.second) \ { \ - OMNITRACE_PRINT("Warning! Duplicate setting: %s / %s\n", \ + ROCPROFSYS_PRINT("Warning! Duplicate setting: %s / %s\n", \ get_setting_name(ENV_NAME).c_str(), ENV_NAME); \ } \ return _config->find(ENV_NAME)->second; \ @@ -173,7 +173,7 @@ auto cfg_fini_callbacks = std::vector>{}; void finalize() { - OMNITRACE_DEBUG("[omnitrace_finalize] Disabling signal handling...\n"); + ROCPROFSYS_DEBUG("[omnitrace_finalize] Disabling signal handling...\n"); tim::signals::disable_signal_detection(); _settings_are_configured() = false; for(const auto& itr : cfg_fini_callbacks) @@ -198,34 +198,34 @@ configure_settings(bool _init) if(get_is_continuous_integration() && get_state() < State::Init) { timemory_print_demangled_backtrace<64>(); - OMNITRACE_THROW("config::configure_settings() called before " + ROCPROFSYS_THROW("config::configure_settings() called before " "omnitrace_init_library. state = %s", std::to_string(get_state()).c_str()); } - tim::manager::add_metadata("ROCPROFSYS_VERSION", OMNITRACE_VERSION_STRING); - tim::manager::add_metadata("ROCPROFSYS_VERSION_MAJOR", OMNITRACE_VERSION_MAJOR); - tim::manager::add_metadata("ROCPROFSYS_VERSION_MINOR", OMNITRACE_VERSION_MINOR); - tim::manager::add_metadata("ROCPROFSYS_VERSION_PATCH", OMNITRACE_VERSION_PATCH); - tim::manager::add_metadata("ROCPROFSYS_GIT_DESCRIBE", OMNITRACE_GIT_DESCRIBE); - tim::manager::add_metadata("ROCPROFSYS_GIT_REVISION", OMNITRACE_GIT_REVISION); + tim::manager::add_metadata("ROCPROFSYS_VERSION", ROCPROFSYS_VERSION_STRING); + tim::manager::add_metadata("ROCPROFSYS_VERSION_MAJOR", ROCPROFSYS_VERSION_MAJOR); + tim::manager::add_metadata("ROCPROFSYS_VERSION_MINOR", ROCPROFSYS_VERSION_MINOR); + tim::manager::add_metadata("ROCPROFSYS_VERSION_PATCH", ROCPROFSYS_VERSION_PATCH); + tim::manager::add_metadata("ROCPROFSYS_GIT_DESCRIBE", ROCPROFSYS_GIT_DESCRIBE); + tim::manager::add_metadata("ROCPROFSYS_GIT_REVISION", ROCPROFSYS_GIT_REVISION); - tim::manager::add_metadata("ROCPROFSYS_LIBRARY_ARCH", OMNITRACE_LIBRARY_ARCH); - tim::manager::add_metadata("ROCPROFSYS_SYSTEM_NAME", OMNITRACE_SYSTEM_NAME); - tim::manager::add_metadata("ROCPROFSYS_SYSTEM_PROCESSOR", OMNITRACE_SYSTEM_PROCESSOR); - tim::manager::add_metadata("ROCPROFSYS_SYSTEM_VERSION", OMNITRACE_SYSTEM_VERSION); + tim::manager::add_metadata("ROCPROFSYS_LIBRARY_ARCH", ROCPROFSYS_LIBRARY_ARCH); + tim::manager::add_metadata("ROCPROFSYS_SYSTEM_NAME", ROCPROFSYS_SYSTEM_NAME); + tim::manager::add_metadata("ROCPROFSYS_SYSTEM_PROCESSOR", ROCPROFSYS_SYSTEM_PROCESSOR); + tim::manager::add_metadata("ROCPROFSYS_SYSTEM_VERSION", ROCPROFSYS_SYSTEM_VERSION); - tim::manager::add_metadata("ROCPROFSYS_COMPILER_ID", OMNITRACE_COMPILER_ID); - tim::manager::add_metadata("ROCPROFSYS_COMPILER_VERSION", OMNITRACE_COMPILER_VERSION); + tim::manager::add_metadata("ROCPROFSYS_COMPILER_ID", ROCPROFSYS_COMPILER_ID); + tim::manager::add_metadata("ROCPROFSYS_COMPILER_VERSION", ROCPROFSYS_COMPILER_VERSION); -#if OMNITRACE_HIP_VERSION > 0 - tim::manager::add_metadata("ROCPROFSYS_HIP_VERSION", OMNITRACE_HIP_VERSION_STRING); +#if ROCPROFSYS_HIP_VERSION > 0 + tim::manager::add_metadata("ROCPROFSYS_HIP_VERSION", ROCPROFSYS_HIP_VERSION_STRING); tim::manager::add_metadata("ROCPROFSYS_HIP_VERSION_MAJOR", - OMNITRACE_HIP_VERSION_MAJOR); + ROCPROFSYS_HIP_VERSION_MAJOR); tim::manager::add_metadata("ROCPROFSYS_HIP_VERSION_MINOR", - OMNITRACE_HIP_VERSION_MINOR); + ROCPROFSYS_HIP_VERSION_MINOR); tim::manager::add_metadata("ROCPROFSYS_HIP_VERSION_PATCH", - OMNITRACE_HIP_VERSION_PATCH); + ROCPROFSYS_HIP_VERSION_PATCH); #endif auto _config = settings::shared_instance(); @@ -239,26 +239,26 @@ configure_settings(bool _init) auto _omnitrace_debug = _config->get("ROCPROFSYS_DEBUG"); if(_omnitrace_debug) tim::set_env("TIMEMORY_DEBUG_SETTINGS", "1", 0); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( std::string, "ROCPROFSYS_MODE", - "Data collection mode. Used to set default values for OMNITRACE_USE_* options. " + "Data collection mode. Used to set default values for ROCPROFSYS_USE_* options. " "Typically set by rocprof-sys binary instrumenter.", std::string{ "trace" }, "backend", "advanced", "mode") ->set_choices({ "trace", "sampling", "causal", "coverage" }); - OMNITRACE_CONFIG_SETTING(bool, "ROCPROFSYS_CI", + ROCPROFSYS_CONFIG_SETTING(bool, "ROCPROFSYS_CI", "Enable some runtime validation checks (typically enabled " "for continuous integration)", false, "debugging", "advanced"); - OMNITRACE_CONFIG_SETTING(bool, "ROCPROFSYS_MONOCHROME", "Disable colorized logging", + ROCPROFSYS_CONFIG_SETTING(bool, "ROCPROFSYS_MONOCHROME", "Disable colorized logging", false, "debugging", "advanced"); - OMNITRACE_CONFIG_EXT_SETTING(int, "ROCPROFSYS_DL_VERBOSE", + ROCPROFSYS_CONFIG_EXT_SETTING(int, "ROCPROFSYS_DL_VERBOSE", "Verbosity within the rocprof-sys-dl library", 0, "debugging", "librocprof-sys-dl", "advanced"); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( size_t, "ROCPROFSYS_NUM_THREADS_HINT", "This is hint for how many threads are expected to be created in the " "application. Setting this value allows rocprof-sys to preallocate resources " @@ -273,113 +273,113 @@ configure_settings(bool _init) get_env("ROCPROFSYS_NUM_THREADS", 1), "threading", "performance", "sampling", "parallelism", "advanced"); - OMNITRACE_CONFIG_SETTING(bool, "ROCPROFSYS_TRACE", "Enable perfetto backend", + ROCPROFSYS_CONFIG_SETTING(bool, "ROCPROFSYS_TRACE", "Enable perfetto backend", _default_perfetto_v, "backend", "perfetto"); - OMNITRACE_CONFIG_SETTING(bool, "ROCPROFSYS_USE_PERFETTO", - "[DEPRECATED] Renamed to OMNITRACE_TRACE", + ROCPROFSYS_CONFIG_SETTING(bool, "ROCPROFSYS_USE_PERFETTO", + "[DEPRECATED] Renamed to ROCPROFSYS_TRACE", _default_perfetto_v, "backend", "perfetto", "deprecated"); - OMNITRACE_CONFIG_SETTING(bool, "ROCPROFSYS_PROFILE", "Enable timemory backend", + ROCPROFSYS_CONFIG_SETTING(bool, "ROCPROFSYS_PROFILE", "Enable timemory backend", !_config->get("ROCPROFSYS_TRACE"), "backend", "timemory"); - OMNITRACE_CONFIG_SETTING( - bool, "ROCPROFSYS_USE_TIMEMORY", "[DEPRECATED] Renamed to OMNITRACE_PROFILE", + ROCPROFSYS_CONFIG_SETTING( + bool, "ROCPROFSYS_USE_TIMEMORY", "[DEPRECATED] Renamed to ROCPROFSYS_PROFILE", !_config->get("ROCPROFSYS_TRACE"), "backend", "timemory", "deprecated"); - OMNITRACE_CONFIG_SETTING(bool, "ROCPROFSYS_USE_CAUSAL", + ROCPROFSYS_CONFIG_SETTING(bool, "ROCPROFSYS_USE_CAUSAL", "Enable causal profiling analysis", false, "backend", "causal", "analysis"); - OMNITRACE_CONFIG_SETTING(bool, "ROCPROFSYS_USE_ROCTRACER", + ROCPROFSYS_CONFIG_SETTING(bool, "ROCPROFSYS_USE_ROCTRACER", "Enable ROCm API and kernel tracing", true, "backend", "roctracer", "rocm"); - OMNITRACE_CONFIG_SETTING(bool, "ROCPROFSYS_USE_ROCPROFILER", + ROCPROFSYS_CONFIG_SETTING(bool, "ROCPROFSYS_USE_ROCPROFILER", "Enable ROCm hardware counters", true, "backend", "rocprofiler", "rocm"); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( bool, "ROCPROFSYS_USE_ROCM_SMI", "Enable sampling GPU power, temp, utilization, and memory usage", true, "backend", "rocm_smi", "rocm", "process_sampling"); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( bool, "ROCPROFSYS_USE_ROCTX", "Enable ROCtx API. Warning! Out-of-order ranges may corrupt perfetto flamegraph", false, "backend", "roctracer", "rocm", "roctx"); - OMNITRACE_CONFIG_SETTING(bool, "ROCPROFSYS_USE_SAMPLING", + ROCPROFSYS_CONFIG_SETTING(bool, "ROCPROFSYS_USE_SAMPLING", "Enable statistical sampling of call-stack", false, "backend", "sampling"); - OMNITRACE_CONFIG_SETTING(bool, "ROCPROFSYS_USE_THREAD_SAMPLING", - "[DEPRECATED] Renamed to OMNITRACE_USE_PROCESS_SAMPLING", + ROCPROFSYS_CONFIG_SETTING(bool, "ROCPROFSYS_USE_THREAD_SAMPLING", + "[DEPRECATED] Renamed to ROCPROFSYS_USE_PROCESS_SAMPLING", true, "backend", "sampling", "process_sampling", "deprecated", "advanced"); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( bool, "ROCPROFSYS_USE_PROCESS_SAMPLING", "Enable a background thread which samples process-level and system metrics " "such as the CPU/GPU freq, power, memory usage, etc.", true, "backend", "sampling", "process_sampling"); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( bool, "ROCPROFSYS_USE_PID", "Enable tagging filenames with process identifier (either MPI rank or pid)", true, "io", "filename"); - OMNITRACE_CONFIG_SETTING(bool, "ROCPROFSYS_USE_KOKKOSP", + ROCPROFSYS_CONFIG_SETTING(bool, "ROCPROFSYS_USE_KOKKOSP", "Enable support for Kokkos Tools", false, "kokkos", "backend"); - OMNITRACE_CONFIG_SETTING(bool, "ROCPROFSYS_USE_MPIP", + ROCPROFSYS_CONFIG_SETTING(bool, "ROCPROFSYS_USE_MPIP", "Enable support for MPI functions", true, "mpi", "backend", "parallelism"); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( bool, "ROCPROFSYS_USE_RCCLP", "Enable support for ROCm Communication Collectives Library (RCCL) Performance", false, "rocm", "rccl", "backend"); - OMNITRACE_CONFIG_CL_SETTING( + ROCPROFSYS_CONFIG_CL_SETTING( bool, "ROCPROFSYS_KOKKOSP_KERNEL_LOGGER", "Enables kernel logging", false, "--omnitrace-kokkos-kernel-logger", "kokkos", "debugging", "advanced"); - OMNITRACE_CONFIG_SETTING(int64_t, "ROCPROFSYS_KOKKOSP_NAME_LENGTH_MAX", + ROCPROFSYS_CONFIG_SETTING(int64_t, "ROCPROFSYS_KOKKOSP_NAME_LENGTH_MAX", "Set this to a value > 0 to help avoid unnamed Kokkos Tools " "callbacks. Generally, unnamed callbacks are the demangled " "name of the function, which is very long", 0, "kokkos", "debugging", "advanced"); - OMNITRACE_CONFIG_SETTING(std::string, "ROCPROFSYS_KOKKOSP_PREFIX", + ROCPROFSYS_CONFIG_SETTING(std::string, "ROCPROFSYS_KOKKOSP_PREFIX", "Set to [kokkos] to maintain old naming convention", "", "kokkos", "debugging", "advanced"); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( bool, "ROCPROFSYS_KOKKOSP_DEEP_COPY", "Enable tracking deep copies (warning: may corrupt flamegraph in perfetto)", false, "kokkos", "advanced"); - OMNITRACE_CONFIG_SETTING(bool, "ROCPROFSYS_USE_OMPT", + ROCPROFSYS_CONFIG_SETTING(bool, "ROCPROFSYS_USE_OMPT", "Enable support for OpenMP-Tools", false, "openmp", "ompt", "backend"); - OMNITRACE_CONFIG_SETTING(bool, "ROCPROFSYS_USE_CODE_COVERAGE", + ROCPROFSYS_CONFIG_SETTING(bool, "ROCPROFSYS_USE_CODE_COVERAGE", "Enable support for code coverage", false, "coverage", "backend", "advanced"); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( double, "ROCPROFSYS_TRACE_DELAY", "Time in seconds to wait before enabling trace/profile data collection. If " - "multiple delays + durations are needed, see OMNITRACE_TRACE_PERIODS.", + "multiple delays + durations are needed, see ROCPROFSYS_TRACE_PERIODS.", 0.0, "trace", "profile", "perfetto", "timemory"); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( double, "ROCPROFSYS_TRACE_DURATION", "If > 0.0, time (in seconds) to collect trace/profile data. If multiple delays + " - "durations are needed, see OMNITRACE_TRACE_PERIODS.", + "durations are needed, see ROCPROFSYS_TRACE_PERIODS.", 0.0, "trace", "profile", "perfetto", "timemory"); auto _clock_choices = std::vector{}; @@ -389,16 +389,16 @@ configure_settings(bool _init) join("", "(", join('|', itr.name, itr.value, itr.raw_name), ")")); } - OMNITRACE_CONFIG_SETTING(std::string, "ROCPROFSYS_TRACE_PERIODS", + ROCPROFSYS_CONFIG_SETTING(std::string, "ROCPROFSYS_TRACE_PERIODS", "Similar to specify trace delay and/or duration except in " "the form :, ::, " "and/or :::", std::string{}, "trace", "profile", "perfetto", "timemory"); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( std::string, "ROCPROFSYS_TRACE_PERIOD_CLOCK_ID", - "Set the default clock ID for OMNITRACE_TRACE_DELAY, OMNITRACE_TRACE_DURATION, " - "and/or OMNITRACE_TRACE_PERIODS. E.g. \"realtime\" == the delay/duration is " + "Set the default clock ID for ROCPROFSYS_TRACE_DELAY, ROCPROFSYS_TRACE_DURATION, " + "and/or ROCPROFSYS_TRACE_PERIODS. E.g. \"realtime\" == the delay/duration is " "governed by the elapsed realtime, \"cputime\" == the delay/duration is governed " "by the elapsed CPU-time within the process, etc. Note: when using CPU-based " "timing, it is recommened to scale the value by the number of threads and be " @@ -406,80 +406,80 @@ configure_settings(bool _init) "CLOCK_REALTIME", "trace", "profile", "perfetto", "timemory") ->set_choices(_clock_choices); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( double, "ROCPROFSYS_SAMPLING_FREQ", "Number of software interrupts per second when OMNITTRACE_USE_SAMPLING=ON", 300.0, "sampling", "process_sampling"); - OMNITRACE_CONFIG_SETTING(double, "ROCPROFSYS_SAMPLING_CPUTIME_FREQ", + ROCPROFSYS_CONFIG_SETTING(double, "ROCPROFSYS_SAMPLING_CPUTIME_FREQ", "Number of software interrupts per second of CPU-time. " - "Defaults to OMNITRACE_SAMPLING_FREQ when <= 0.0", + "Defaults to ROCPROFSYS_SAMPLING_FREQ when <= 0.0", -1.0, "sampling", "advanced"); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( double, "ROCPROFSYS_SAMPLING_REALTIME_FREQ", "Number of software interrupts per second of real (wall) time. " - "Defaults to OMNITRACE_SAMPLING_FREQ when <= 0.0", + "Defaults to ROCPROFSYS_SAMPLING_FREQ when <= 0.0", -1.0, "sampling", "advanced"); - OMNITRACE_CONFIG_SETTING(double, "ROCPROFSYS_SAMPLING_OVERFLOW_FREQ", + ROCPROFSYS_CONFIG_SETTING(double, "ROCPROFSYS_SAMPLING_OVERFLOW_FREQ", "Number of events in between each sample. " - "Defaults to OMNITRACE_SAMPLING_FREQ when <= 0.0", + "Defaults to ROCPROFSYS_SAMPLING_FREQ when <= 0.0", -1.0, "sampling", "advanced"); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( double, "ROCPROFSYS_SAMPLING_DELAY", "Time (in seconds) to wait before the first sampling signal is delivered, " "increasing this value can fix deadlocks during init", 0.5, "sampling", "process_sampling"); - OMNITRACE_CONFIG_SETTING(double, "ROCPROFSYS_SAMPLING_CPUTIME_DELAY", + ROCPROFSYS_CONFIG_SETTING(double, "ROCPROFSYS_SAMPLING_CPUTIME_DELAY", "Time (in seconds) to wait before the first CPU-time " "sampling signal is delivered. " - "Defaults to OMNITRACE_SAMPLING_DELAY when <= 0.0", + "Defaults to ROCPROFSYS_SAMPLING_DELAY when <= 0.0", -1.0, "sampling", "advanced"); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( double, "ROCPROFSYS_SAMPLING_REALTIME_DELAY", "Time (in seconds) to wait before the first real (wall) time sampling signal is " - "delivered. Defaults to OMNITRACE_SAMPLING_DELAY when <= 0.0", + "delivered. Defaults to ROCPROFSYS_SAMPLING_DELAY when <= 0.0", -1.0, "sampling", "advanced"); - OMNITRACE_CONFIG_SETTING(double, "ROCPROFSYS_SAMPLING_DURATION", + ROCPROFSYS_CONFIG_SETTING(double, "ROCPROFSYS_SAMPLING_DURATION", "If > 0.0, time (in seconds) to sample before stopping", 0.0, "sampling", "process_sampling"); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( double, "ROCPROFSYS_PROCESS_SAMPLING_FREQ", "Number of measurements per second when OMNITTRACE_USE_PROCESS_SAMPLING=ON. If " - "set to zero, uses OMNITRACE_SAMPLING_FREQ value", + "set to zero, uses ROCPROFSYS_SAMPLING_FREQ value", 0.0, "process_sampling"); - OMNITRACE_CONFIG_SETTING(double, "ROCPROFSYS_PROCESS_SAMPLING_DURATION", + ROCPROFSYS_CONFIG_SETTING(double, "ROCPROFSYS_PROCESS_SAMPLING_DURATION", "If > 0.0, time (in seconds) to sample before stopping. If " - "less than zero, uses OMNITRACE_SAMPLING_DURATION", + "less than zero, uses ROCPROFSYS_SAMPLING_DURATION", -1.0, "sampling", "process_sampling"); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( std::string, "ROCPROFSYS_SAMPLING_CPUS", "CPUs to collect frequency information for. Values should be separated by commas " "and can be explicit or ranges, e.g. 0,1,5-8. An empty value implies 'all' and " "'none' suppresses all CPU frequency sampling", std::string{}, "process_sampling"); - OMNITRACE_CONFIG_SETTING(std::string, "ROCPROFSYS_ROCM_SMI_DEVICES", - "[DEPRECATED] Renamed to OMNITRACE_SAMPLING_GPUS", + ROCPROFSYS_CONFIG_SETTING(std::string, "ROCPROFSYS_ROCM_SMI_DEVICES", + "[DEPRECATED] Renamed to ROCPROFSYS_SAMPLING_GPUS", std::string{ "all" }, "rocm_smi", "rocm", "process_sampling", "deprecated", "advanced"); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( std::string, "ROCPROFSYS_SAMPLING_GPUS", - "Devices to query when OMNITRACE_USE_ROCM_SMI=ON. Values should be separated by " + "Devices to query when ROCPROFSYS_USE_ROCM_SMI=ON. Values should be separated by " "commas and can be explicit or ranges, e.g. 0,1,5-8. An empty value implies " "'all' and 'none' suppresses all GPU sampling", std::string{ "all" }, "rocm_smi", "rocm", "process_sampling"); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( std::string, "ROCPROFSYS_SAMPLING_TIDS", "Limit call-stack sampling to specific thread IDs, starting at zero for the main " "thread. Be aware that some libraries, such as ROCm may create additional " @@ -488,64 +488,64 @@ configure_settings(bool _init) "explicit or ranges, e.g. 0,1,5-8. An empty value implies all TIDs.", std::string{}, "sampling", "advanced"); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( std::string, "ROCPROFSYS_SAMPLING_CPUTIME_TIDS", - "Same as OMNITRACE_SAMPLING_TIDS but applies specifically to samplers whose " + "Same as ROCPROFSYS_SAMPLING_TIDS but applies specifically to samplers whose " "timers are based on the CPU-time. This is useful when you want to restrict " "samples to particular threads.", std::string{}, "sampling", "advanced"); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( std::string, "ROCPROFSYS_SAMPLING_REALTIME_TIDS", - "Same as OMNITRACE_SAMPLING_TIDS but applies specifically to samplers whose " + "Same as ROCPROFSYS_SAMPLING_TIDS but applies specifically to samplers whose " "timers are based on the real (wall) time. This is useful when you want to " "restrict samples to particular threads.", std::string{}, "sampling", "advanced"); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( std::string, "ROCPROFSYS_SAMPLING_OVERFLOW_TIDS", - "Same as OMNITRACE_SAMPLING_TIDS but applies specifically to samplers whose " + "Same as ROCPROFSYS_SAMPLING_TIDS but applies specifically to samplers whose " "samples are based on the overflow of a particular event. This is useful when " "you want to restrict samples to particular threads.", std::string{}, "sampling", "advanced"); auto _backend = tim::get_env_choice( "ROCPROFSYS_PERFETTO_BACKEND", - (_system_backend) ? "system" // if OMNITRACE_PERFETTO_BACKEND_SYSTEM is true, + (_system_backend) ? "system" // if ROCPROFSYS_PERFETTO_BACKEND_SYSTEM is true, // default to system. : "inprocess", // Otherwise, default to inprocess { "inprocess", "system", "all" }, false); - OMNITRACE_CONFIG_SETTING(std::string, "ROCPROFSYS_PERFETTO_BACKEND", + ROCPROFSYS_CONFIG_SETTING(std::string, "ROCPROFSYS_PERFETTO_BACKEND", "Specify the perfetto backend to activate. Options are: " "'inprocess', 'system', or 'all'", _backend, "perfetto") ->set_choices({ "inprocess", "system", "all" }); - OMNITRACE_CONFIG_SETTING(bool, "ROCPROFSYS_TRACE_THREAD_LOCKS", + ROCPROFSYS_CONFIG_SETTING(bool, "ROCPROFSYS_TRACE_THREAD_LOCKS", "Enable tracing calls to pthread_mutex_lock, " "pthread_mutex_unlock, pthread_mutex_trylock", false, "backend", "parallelism", "gotcha", "advanced"); - OMNITRACE_CONFIG_SETTING(bool, "ROCPROFSYS_TRACE_THREAD_RW_LOCKS", + ROCPROFSYS_CONFIG_SETTING(bool, "ROCPROFSYS_TRACE_THREAD_RW_LOCKS", "Enable tracing calls to pthread_rwlock_* functions. May " "cause deadlocks with ROCm-enabled OpenMPI.", false, "backend", "parallelism", "gotcha", "advanced"); - OMNITRACE_CONFIG_SETTING(bool, "ROCPROFSYS_TRACE_THREAD_SPIN_LOCKS", + ROCPROFSYS_CONFIG_SETTING(bool, "ROCPROFSYS_TRACE_THREAD_SPIN_LOCKS", "Enable tracing calls to pthread_spin_* functions. May " "cause deadlocks with MPI distributions.", false, "backend", "parallelism", "gotcha", "advanced"); - OMNITRACE_CONFIG_SETTING(bool, "ROCPROFSYS_TRACE_THREAD_BARRIERS", + ROCPROFSYS_CONFIG_SETTING(bool, "ROCPROFSYS_TRACE_THREAD_BARRIERS", "Enable tracing calls to pthread_barrier functions.", true, "backend", "parallelism", "gotcha", "advanced"); - OMNITRACE_CONFIG_SETTING(bool, "ROCPROFSYS_TRACE_THREAD_JOIN", + ROCPROFSYS_CONFIG_SETTING(bool, "ROCPROFSYS_TRACE_THREAD_JOIN", "Enable tracing calls to pthread_join functions.", true, "backend", "parallelism", "gotcha", "advanced"); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( bool, "ROCPROFSYS_SAMPLING_KEEP_INTERNAL", "Configure whether the statistical samples should include call-stack entries " "from internal routines in rocprof-sys. E.g. when ON, the call-stack will show " @@ -553,11 +553,11 @@ configure_settings(bool _init) "filter out internal routines from the sampling call-stacks", true, "sampling", "data", "advanced"); - OMNITRACE_CONFIG_SETTING(bool, "ROCPROFSYS_SAMPLING_INCLUDE_INLINES", + ROCPROFSYS_CONFIG_SETTING(bool, "ROCPROFSYS_SAMPLING_INCLUDE_INLINES", "Create entries for inlined functions when available", false, "sampling", "data", "advanced"); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( size_t, "ROCPROFSYS_SAMPLING_ALLOCATOR_SIZE", "The number of sampled threads handled by an allocator running in a background " "thread. Each thread that is sampled communicates with an allocator running in a " @@ -569,134 +569,134 @@ configure_settings(bool _init) "thread started by the application.", 8, "sampling", "debugging", "advanced"); - OMNITRACE_CONFIG_SETTING(bool, "ROCPROFSYS_SAMPLING_OVERFLOW", + ROCPROFSYS_CONFIG_SETTING(bool, "ROCPROFSYS_SAMPLING_OVERFLOW", "Enable sampling via an overflow of a HW counter. This " "requires Linux perf (/proc/sys/kernel/perf_event_paranoid " "created by OS) with a value of 2 or less in that file", false, "sampling", "advanced"); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( bool, "ROCPROFSYS_SAMPLING_REALTIME", "Enable sampling frequency via a wall-clock timer. This may result in typically " "idle child threads consuming an unnecessary large amount of CPU time.", false, "sampling", "advanced"); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( bool, "ROCPROFSYS_SAMPLING_CPUTIME", "Enable sampling frequency via a timer that measures both CPU time used by the " "current process, and CPU time expended on behalf of the process by the system. " "This is recommended.", false, "sampling", "advanced"); - OMNITRACE_CONFIG_SETTING(int, "ROCPROFSYS_SAMPLING_CPUTIME_SIGNAL", + ROCPROFSYS_CONFIG_SETTING(int, "ROCPROFSYS_SAMPLING_CPUTIME_SIGNAL", "Modify this value only if the target process is also using " "the same signal (SIGPROF)", SIGPROF, "sampling", "advanced"); - OMNITRACE_CONFIG_SETTING(int, "ROCPROFSYS_SAMPLING_REALTIME_SIGNAL", + ROCPROFSYS_CONFIG_SETTING(int, "ROCPROFSYS_SAMPLING_REALTIME_SIGNAL", "Modify this value only if the target process is also using " "the same signal (SIGRTMIN)", SIGRTMIN, "sampling", "advanced"); - OMNITRACE_CONFIG_SETTING(int, "ROCPROFSYS_SAMPLING_OVERFLOW_SIGNAL", + ROCPROFSYS_CONFIG_SETTING(int, "ROCPROFSYS_SAMPLING_OVERFLOW_SIGNAL", "Modify this value only if the target process is also using " "the same signal (SIGRTMIN + 1)", SIGRTMIN + 1, "sampling", "advanced"); - OMNITRACE_CONFIG_SETTING(std::string, "ROCPROFSYS_SAMPLING_OVERFLOW_EVENT", + ROCPROFSYS_CONFIG_SETTING(std::string, "ROCPROFSYS_SAMPLING_OVERFLOW_EVENT", "Metric for overflow sampling", std::string{ "perf::PERF_COUNT_HW_CACHE_REFERENCES" }, "sampling", "hardware_counters") ->set_choices(perf::get_config_choices()); - OMNITRACE_CONFIG_SETTING(bool, "ROCPROFSYS_ROCTRACER_HIP_API", + ROCPROFSYS_CONFIG_SETTING(bool, "ROCPROFSYS_ROCTRACER_HIP_API", "Enable HIP API tracing support", true, "roctracer", "rocm", "advanced"); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( bool, "ROCPROFSYS_ROCTRACER_HIP_API_BACKTRACE", "Enable annotating the perfetto debug annotation with backtraces", false, "roctracer", "rocm", "perfetto", "advanced"); - OMNITRACE_CONFIG_SETTING(bool, "ROCPROFSYS_ROCTRACER_HIP_ACTIVITY", + ROCPROFSYS_CONFIG_SETTING(bool, "ROCPROFSYS_ROCTRACER_HIP_ACTIVITY", "Enable HIP activity tracing support", true, "roctracer", "rocm", "advanced"); - OMNITRACE_CONFIG_SETTING(bool, "ROCPROFSYS_ROCTRACER_HSA_ACTIVITY", + ROCPROFSYS_CONFIG_SETTING(bool, "ROCPROFSYS_ROCTRACER_HSA_ACTIVITY", "Enable HSA activity tracing support", false, "roctracer", "rocm", "advanced"); - OMNITRACE_CONFIG_SETTING(bool, "ROCPROFSYS_ROCTRACER_HSA_API", + ROCPROFSYS_CONFIG_SETTING(bool, "ROCPROFSYS_ROCTRACER_HSA_API", "Enable HSA API tracing support", false, "roctracer", "rocm", "advanced"); - OMNITRACE_CONFIG_SETTING(std::string, "ROCPROFSYS_ROCTRACER_HSA_API_TYPES", + ROCPROFSYS_CONFIG_SETTING(std::string, "ROCPROFSYS_ROCTRACER_HSA_API_TYPES", "HSA API type to collect", "", "roctracer", "rocm", "advanced"); - OMNITRACE_CONFIG_SETTING(bool, "ROCPROFSYS_ROCTRACER_DISCARD_BARRIERS", + ROCPROFSYS_CONFIG_SETTING(bool, "ROCPROFSYS_ROCTRACER_DISCARD_BARRIERS", "Skip barrier marker events in traces", false, "roctracer", "rocm", "advanced"); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( std::string, "ROCPROFSYS_ROCM_EVENTS", "ROCm hardware counters. Use ':device=N' syntax to specify collection on device " "number N, e.g. ':device=0'. If no device specification is provided, the event " "is collected on every available device", "", "rocprofiler", "rocm", "hardware_counters"); - OMNITRACE_CONFIG_SETTING(std::string, "ROCPROFSYS_ROCM_SMI_METRICS", + ROCPROFSYS_CONFIG_SETTING(std::string, "ROCPROFSYS_ROCM_SMI_METRICS", "rocm-smi metrics to collect: busy, temp, power, mem_usage", "busy,temp,power,mem_usage", "backend", "rocm_smi", "rocm", "process_sampling", "advanced"); - OMNITRACE_CONFIG_SETTING(size_t, "ROCPROFSYS_PERFETTO_SHMEM_SIZE_HINT_KB", + ROCPROFSYS_CONFIG_SETTING(size_t, "ROCPROFSYS_PERFETTO_SHMEM_SIZE_HINT_KB", "Hint for shared-memory buffer size in perfetto (in KB)", size_t{ 4096 }, "perfetto", "data", "advanced"); - OMNITRACE_CONFIG_SETTING(size_t, "ROCPROFSYS_PERFETTO_BUFFER_SIZE_KB", + ROCPROFSYS_CONFIG_SETTING(size_t, "ROCPROFSYS_PERFETTO_BUFFER_SIZE_KB", "Size of perfetto buffer (in KB)", size_t{ 1024000 }, "perfetto", "data"); - OMNITRACE_CONFIG_SETTING(bool, "ROCPROFSYS_PERFETTO_COMBINE_TRACES", + ROCPROFSYS_CONFIG_SETTING(bool, "ROCPROFSYS_PERFETTO_COMBINE_TRACES", "Combine Perfetto traces. If not explicitly set, it will " - "default to the value of OMNITRACE_COLLAPSE_PROCESSES", + "default to the value of ROCPROFSYS_COLLAPSE_PROCESSES", false, "perfetto", "data", "advanced"); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( bool, "ROCPROFSYS_PERFETTO_ROCTRACER_PER_STREAM", "Separate roctracer GPU side traces (copies, kernels) into separate " "tracks based on the stream they're enqueued into", true, "perfetto", "roctracer", "rocm", "advanced"); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( std::string, "ROCPROFSYS_PERFETTO_FILL_POLICY", "Behavior when perfetto buffer is full. 'discard' will ignore new entries, " "'ring_buffer' will overwrite old entries", "discard", "perfetto", "data") ->set_choices({ "fill", "discard" }); - OMNITRACE_CONFIG_SETTING(std::string, "ROCPROFSYS_ENABLE_CATEGORIES", + ROCPROFSYS_CONFIG_SETTING(std::string, "ROCPROFSYS_ENABLE_CATEGORIES", "Enable collecting profiling and trace data for these " "categories and disable all other categories", "", "trace", "profile", "perfetto", "timemory", "data", "category", "advanced") ->set_choices(get_available_categories>()); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( std::string, "ROCPROFSYS_DISABLE_CATEGORIES", "Disable collecting profiling and trace data for these categories", "", "trace", "profile", "perfetto", "timemory", "data", "category", "advanced") ->set_choices(get_available_categories>()); - OMNITRACE_CONFIG_SETTING(bool, "ROCPROFSYS_PERFETTO_ANNOTATIONS", + ROCPROFSYS_CONFIG_SETTING(bool, "ROCPROFSYS_PERFETTO_ANNOTATIONS", "Include debug annotations in perfetto trace. When enabled, " "this feature will encode information such as the values of " "the function arguments (when available). Disabling this " "feature may dramatically reduce the size of the trace", true, "perfetto", "data", "debugging", "advanced"); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( bool, "ROCPROFSYS_PERFETTO_COMPACT_ROCTRACER_ANNOTATIONS", "When PERFETTO_ANNOTATIONS, USE_ROCTRACER, and ROCTRACER_HIP_API are all " "enabled, enabling this option will result in the arg information for HIP API " @@ -708,38 +708,38 @@ configure_settings(bool _init) "trace with the same value", false, "perfetto", "data", "debugging", "roctracer", "rocm", "advanced"); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( uint64_t, "ROCPROFSYS_THREAD_POOL_SIZE", "Max number of threads for processing background tasks", std::max(std::min(4, std::thread::hardware_concurrency() / 2), 1), "parallelism", "advanced"); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( std::string, "ROCPROFSYS_TIMEMORY_COMPONENTS", "List of components to collect via timemory (see `rocprof-sys-avail -C`)", "wall_clock", "timemory", "component"); - OMNITRACE_CONFIG_SETTING(std::string, "ROCPROFSYS_OUTPUT_FILE", - "[DEPRECATED] See OMNITRACE_PERFETTO_FILE", std::string{}, + ROCPROFSYS_CONFIG_SETTING(std::string, "ROCPROFSYS_OUTPUT_FILE", + "[DEPRECATED] See ROCPROFSYS_PERFETTO_FILE", std::string{}, "perfetto", "io", "filename", "deprecated", "advanced"); - OMNITRACE_CONFIG_SETTING(std::string, "ROCPROFSYS_PERFETTO_FILE", "Perfetto filename", + ROCPROFSYS_CONFIG_SETTING(std::string, "ROCPROFSYS_PERFETTO_FILE", "Perfetto filename", std::string{ "perfetto-trace.proto" }, "perfetto", "io", "filename", "advanced"); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( bool, "ROCPROFSYS_USE_TEMPORARY_FILES", "Write data to temporary files to minimize the memory usage " "of rocprof-sys, e.g. call-stack samples will be periodically " "written to a file and re-loaded during finalization", true, "io", "data", "advanced"); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( std::string, "ROCPROFSYS_TMPDIR", "Base directory for temporary files", get_env("TMPDIR", "/tmp"), "io", "data", "advanced"); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( std::string, "ROCPROFSYS_CAUSAL_BACKEND", "Backend for call-stack sampling. See " "https://rocm.docs.amd.com/projects/omnitrace/en/latest/how-to/" @@ -749,20 +749,20 @@ configure_settings(bool _init) std::string{ "auto" }, "causal", "analysis") ->set_choices({ "auto", "perf", "timer" }); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( std::string, "ROCPROFSYS_CAUSAL_MODE", "Perform causal experiments at the function-scope or line-scope. Ideally, use " "function first to locate function with highest impact and then switch to line " - "mode + OMNITRACE_CAUSAL_FUNCTION_SCOPE set to the function being targeted.", + "mode + ROCPROFSYS_CAUSAL_FUNCTION_SCOPE set to the function being targeted.", std::string{ "function" }, "causal", "analysis") ->set_choices({ "func", "line", "function" }); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( double, "ROCPROFSYS_CAUSAL_DELAY", "Length of time to wait (in seconds) before starting the first causal experiment", 0.0, "causal", "analysis"); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( double, "ROCPROFSYS_CAUSAL_DURATION", "Length of time to perform causal experimentation (in seconds) after the first " "experiment has started. After this amount of time has elapsed, no more causal " @@ -771,22 +771,22 @@ configure_settings(bool _init) "completes", 0.0, "causal", "analysis"); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( bool, "ROCPROFSYS_CAUSAL_END_TO_END", "Perform causal experiment over the length of the entire application", false, "causal", "analysis", "advanced"); - OMNITRACE_CONFIG_SETTING(std::string, "ROCPROFSYS_CAUSAL_FILE", + ROCPROFSYS_CONFIG_SETTING(std::string, "ROCPROFSYS_CAUSAL_FILE", "Name of causal output filename (w/o extension)", std::string{ "experiments" }, "causal", "analysis", "advanced", "io"); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( bool, "ROCPROFSYS_CAUSAL_FILE_RESET", "Overwrite any existing causal output file instead of appending to it", false, "causal", "analysis", "advanced", "io"); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( uint64_t, "ROCPROFSYS_CAUSAL_RANDOM_SEED", "Seed for random number generator which selects speedups and experiments -- " "please note that the lines selected for experimentation are not reproducible " @@ -794,50 +794,50 @@ configure_settings(bool _init) "used.", 0, "causal", "analysis"); - OMNITRACE_CONFIG_SETTING(std::string, "ROCPROFSYS_CAUSAL_FIXED_SPEEDUP", + ROCPROFSYS_CONFIG_SETTING(std::string, "ROCPROFSYS_CAUSAL_FIXED_SPEEDUP", "List of virtual speedups between 0 and 100 (inclusive) to " "sample from for causal profiling", std::string{}, "causal", "analysis", "advanced"); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( std::string, "ROCPROFSYS_CAUSAL_BINARY_SCOPE", "Limits causal experiments to the binaries matching the provided list of regular " "expressions (separated by tab, semi-colon, and/or quotes (single or double))", std::string{ "%MAIN%" }, "causal", "analysis"); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( std::string, "ROCPROFSYS_CAUSAL_SOURCE_SCOPE", "Limits causal experiments to the source files or source file + lineno pair " "(i.e. or :) matching the provided list of regular " "expressions (separated by tab, semi-colon, and/or quotes (single or double))", std::string{}, "causal", "analysis"); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( std::string, "ROCPROFSYS_CAUSAL_FUNCTION_SCOPE", "List of regex entries for causal profiling (separated by tab, " "semi-colon, and/or quotes (single or double))", std::string{}, "causal", "analysis"); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( std::string, "ROCPROFSYS_CAUSAL_BINARY_EXCLUDE", "Excludes binaries matching the list of provided regexes from causal experiments " "(separated by tab, semi-colon, and/or quotes (single or double))", std::string{}, "causal", "analysis"); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( std::string, "ROCPROFSYS_CAUSAL_SOURCE_EXCLUDE", "Excludes source files or source file + lineno pair (i.e. or " ":) matching the list of provided regexes from causal experiments " "(separated by tab, semi-colon, and/or quotes (single or double))", std::string{}, "causal", "analysis"); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( std::string, "ROCPROFSYS_CAUSAL_FUNCTION_EXCLUDE", "Excludes functions matching the list of provided regexes from causal " "experiments (separated by tab, semi-colon, and/or quotes (single or double))", std::string{}, "causal", "analysis"); - OMNITRACE_CONFIG_SETTING( + ROCPROFSYS_CONFIG_SETTING( bool, "ROCPROFSYS_CAUSAL_FUNCTION_EXCLUDE_DEFAULTS", "This controls adding a series of function exclude regexes to avoid " "experimenting on STL implementation functions, etc. which are, " @@ -892,7 +892,7 @@ configure_settings(bool _init) { if(_config->get("ROCPROFSYS_CI")) { - OMNITRACE_THROW("Error! Setting '%s' not found!", _name.c_str()); + ROCPROFSYS_THROW("Error! Setting '%s' not found!", _name.c_str()); } } }; @@ -952,11 +952,11 @@ configure_settings(bool _init) if(_paranoid > 2 && !_has_cap_sys_admin) { - OMNITRACE_BASIC_VERBOSE(0, + ROCPROFSYS_BASIC_VERBOSE(0, "/proc/sys/kernel/perf_event_paranoid has a value of %i. " "Disabling PAPI (requires a value <= 2)...\n", _paranoid); - OMNITRACE_BASIC_VERBOSE( + ROCPROFSYS_BASIC_VERBOSE( 0, "In order to enable PAPI support, run 'echo N | sudo tee " "/proc/sys/kernel/perf_event_paranoid' where N is <= 2\n"); trait::runtime_enabled::set(false); @@ -1012,7 +1012,7 @@ configure_settings(bool _init) { if(_config->get_suppress_config()) continue; - OMNITRACE_BASIC_VERBOSE(1, "Reading config file %s\n", itr.c_str()); + ROCPROFSYS_BASIC_VERBOSE(1, "Reading config file %s\n", itr.c_str()); if(_config->read(itr) && _main_proc && ((_config->get("ROCPROFSYS_CI") && settings::verbose() >= 0) || settings::verbose() >= 1 || settings::debug())) @@ -1028,7 +1028,7 @@ configure_settings(bool _init) } if(!_iss.str().empty()) { - OMNITRACE_BASIC_VERBOSE(1, "config file '%s':\n%s\n", fitr.c_str(), + ROCPROFSYS_BASIC_VERBOSE(1, "config file '%s':\n%s\n", fitr.c_str(), _iss.str().c_str()); } } @@ -1046,7 +1046,7 @@ configure_settings(bool _init) tim::timemory_init(_cmd, _parser, "rocprofsys-"); } -#if !defined(OMNITRACE_USE_MPI) && !defined(OMNITRACE_USE_MPI_HEADERS) +#if !defined(ROCPROFSYS_USE_MPI) && !defined(ROCPROFSYS_USE_MPI_HEADERS) set_setting_value("ROCPROFSYS_USE_MPIP", false); #endif @@ -1095,7 +1095,7 @@ configure_settings(bool _init) configure_signal_handler(_config); configure_disabled_settings(_config); - OMNITRACE_BASIC_VERBOSE(2, "configuration complete\n"); + ROCPROFSYS_BASIC_VERBOSE(2, "configuration complete\n"); _settings_are_configured() = true; } @@ -1106,14 +1106,14 @@ configure_mode_settings(const std::shared_ptr& _config) auto _set = [](const std::string& _name, bool _v) { if(!set_setting_value(_name, _v)) { - OMNITRACE_BASIC_VERBOSE( + ROCPROFSYS_BASIC_VERBOSE( 4, "[configure_mode_settings] No configuration setting named '%s'...\n", _name.data()); } else { bool _changed = get_setting_value(_name).value_or(!_v) != _v; - OMNITRACE_BASIC_VERBOSE( + ROCPROFSYS_BASIC_VERBOSE( 1 && _changed, "[configure_mode_settings] Overriding %s to %s in %s mode...\n", _name.c_str(), JOIN("", std::boolalpha, _v).c_str(), @@ -1155,8 +1155,8 @@ configure_mode_settings(const std::shared_ptr& _config) if(gpu::device_count() == 0) { -#if OMNITRACE_HIP_VERSION > 0 - OMNITRACE_BASIC_VERBOSE(1, "No HIP devices were found: disabling roctracer, " +#if ROCPROFSYS_HIP_VERSION > 0 + ROCPROFSYS_BASIC_VERBOSE(1, "No HIP devices were found: disabling roctracer, " "rocprofiler, and rocm_smi...\n"); #endif _set("ROCPROFSYS_USE_ROCPROFILER", false); @@ -1178,7 +1178,7 @@ configure_mode_settings(const std::shared_ptr& _config) _message = JOIN("", " (forced. Previous value: '", _current_kokkosp_lib, "')"); } - OMNITRACE_BASIC_VERBOSE_F(1, "Setting KOKKOS_PROFILE_LIBRARY=%s%s\n", + ROCPROFSYS_BASIC_VERBOSE_F(1, "Setting KOKKOS_PROFILE_LIBRARY=%s%s\n", "librocprof-sys.so", _message.c_str()); tim::set_env("KOKKOS_PROFILE_LIBRARY", "librocprof-sys.so", _force); } @@ -1224,7 +1224,7 @@ omnitrace_exit_action(int nsig) { tim::signals::block_signals(get_sampling_signals(), tim::signals::sigmask_scope::process); - OMNITRACE_BASIC_PRINT("Finalizing after signal %i :: %s\n", nsig, + ROCPROFSYS_BASIC_PRINT("Finalizing after signal %i :: %s\n", nsig, signal_settings::str(static_cast(nsig)).c_str()); auto _handler = get_signal_handler().load(); if(_handler) (*_handler)(); @@ -1238,9 +1238,9 @@ omnitrace_trampoline_handler(int _v) { ::omnitrace::debug::flush(); ::omnitrace::debug::lock _debug_lk{}; - OMNITRACE_FPRINTF_STDERR_COLOR(warning); + ROCPROFSYS_FPRINTF_STDERR_COLOR(warning); fprintf(::omnitrace::debug::get_file(), - "signal %i ignored (OMNITRACE_IGNORE_DYNINST_TRAMPOLINE=ON)\n", _v); + "signal %i ignored (ROCPROFSYS_IGNORE_DYNINST_TRAMPOLINE=ON)\n", _v); ::omnitrace::debug::flush(); timemory_print_demangled_backtrace<64>(); } @@ -1337,7 +1337,7 @@ std::set get_sampling_signals(int64_t) if(get_use_sampling() && !get_use_sampling_cputime() && !get_use_sampling_realtime() && !get_use_sampling_overflow()) { - OMNITRACE_VERBOSE_F(1, "sampling enabled by cputime/realtime/overflow not " + ROCPROFSYS_VERBOSE_F(1, "sampling enabled by cputime/realtime/overflow not " "specified. defaulting to cputime...\n"); set_setting_value("ROCPROFSYS_SAMPLING_CPUTIME", true); } @@ -1360,13 +1360,13 @@ configure_disabled_settings(const std::shared_ptr& _config) auto _disabled = _config->disable_category(_category); _config->enable(_opt); for(auto&& itr : _disabled) - OMNITRACE_BASIC_VERBOSE(3, "[%s=OFF] disabled option :: '%s'\n", + ROCPROFSYS_BASIC_VERBOSE(3, "[%s=OFF] disabled option :: '%s'\n", _opt.c_str(), itr.c_str()); return false; } auto _enabled = _config->enable_category(_category); for(auto&& itr : _enabled) - OMNITRACE_BASIC_VERBOSE(3, "[%s=ON] enabled option :: '%s'\n", + ROCPROFSYS_BASIC_VERBOSE(3, "[%s=ON] enabled option :: '%s'\n", _opt.c_str(), itr.c_str()); return true; }; @@ -1383,25 +1383,25 @@ configure_disabled_settings(const std::shared_ptr& _config) _handle_use_option("ROCPROFSYS_USE_ROCTRACER", "roctracer"); _handle_use_option("ROCPROFSYS_USE_ROCPROFILER", "rocprofiler"); -#if !defined(OMNITRACE_USE_ROCTRACER) || OMNITRACE_USE_ROCTRACER == 0 +#if !defined(ROCPROFSYS_USE_ROCTRACER) || ROCPROFSYS_USE_ROCTRACER == 0 _config->find("ROCPROFSYS_USE_ROCTRACER")->second->set_hidden(true); for(const auto& itr : _config->disable_category("roctracer")) _config->find(itr)->second->set_hidden(true); #endif -#if !defined(OMNITRACE_USE_ROCPROFILER) || OMNITRACE_USE_ROCPROFILER == 0 +#if !defined(ROCPROFSYS_USE_ROCPROFILER) || ROCPROFSYS_USE_ROCPROFILER == 0 _config->find("ROCPROFSYS_USE_ROCPROFILER")->second->set_hidden(true); for(const auto& itr : _config->disable_category("rocprofiler")) _config->find(itr)->second->set_hidden(true); #endif -#if !defined(OMNITRACE_USE_ROCM_SMI) || OMNITRACE_USE_ROCM_SMI == 0 +#if !defined(ROCPROFSYS_USE_ROCM_SMI) || ROCPROFSYS_USE_ROCM_SMI == 0 _config->find("ROCPROFSYS_USE_ROCM_SMI")->second->set_hidden(true); for(const auto& itr : _config->disable_category("rocm_smi")) _config->find(itr)->second->set_hidden(true); #endif -#if defined(OMNITRACE_USE_OMPT) || OMNITRACE_USE_OMPT == 0 +#if defined(ROCPROFSYS_USE_OMPT) || ROCPROFSYS_USE_OMPT == 0 _config->find("ROCPROFSYS_USE_OMPT")->second->set_hidden(true); for(const auto& itr : _config->disable_category("ompt")) _config->find(itr)->second->set_hidden(true); @@ -1438,7 +1438,7 @@ configure_disabled_settings(const std::shared_ptr& _config) _config->disable("separator_freq"); // exclude some timemory settings which are not relevant to rocprof-sys - // exact matches, e.g. OMNITRACE_BANNER + // exact matches, e.g. ROCPROFSYS_BANNER std::string _hidden_exact_re = "^ROCPROFSYS_(BANNER|DESTRUCTOR_REPORT|COMPONENTS|(GLOBAL|MPIP|NCCLP|OMPT|" "PROFILER|TRACE|KOKKOS)_COMPONENTS|PYTHON_EXE|PAPI_ATTACH|PLOT_OUTPUT|SEPARATOR_" @@ -1446,7 +1446,7 @@ configure_disabled_settings(const std::shared_ptr& _config) "(ENABLE|DISABLE)_ALL_SIGNALS|ALLOW_SIGNAL_HANDLER|CTEST_NOTES|INSTRUCTION_" "ROOFLINE|ADD_SECONDARY|MAX_THREAD_BOOKMARKS)$"; - // leading matches, e.g. OMNITRACE_MPI_[A-Z_]+ + // leading matches, e.g. ROCPROFSYS_MPI_[A-Z_]+ std::string _hidden_begin_re = "^ROCPROFSYS_(ERT|DART|MPI|UPCXX|ROOFLINE|CUDA|NVTX|CUPTI)_[A-Z_]+$"; @@ -1478,7 +1478,7 @@ handle_deprecated_setting(const std::string& _old, const std::string& _new, int if(_old_setting == _config->end()) return; - OMNITRACE_CI_THROW(_new_setting == _config->end(), + ROCPROFSYS_CI_THROW(_new_setting == _config->end(), "New configuration setting not found: '%s'", _new.c_str()); if(_old_setting->second->get_environ_updated() || @@ -1488,13 +1488,13 @@ handle_deprecated_setting(const std::string& _old, const std::string& _new, int std::array _v = {}; _v.fill('='); _v.back() = '\0'; - OMNITRACE_BASIC_VERBOSE(_verbose, "#%s#\n", _v.data()); + ROCPROFSYS_BASIC_VERBOSE(_verbose, "#%s#\n", _v.data()); }; _separator(); - OMNITRACE_BASIC_VERBOSE(_verbose, "#\n"); - OMNITRACE_BASIC_VERBOSE(_verbose, "# DEPRECATION NOTICE:\n"); - OMNITRACE_BASIC_VERBOSE(_verbose, "# %s is deprecated!\n", _old.c_str()); - OMNITRACE_BASIC_VERBOSE(_verbose, "# Use %s instead!\n", _new.c_str()); + ROCPROFSYS_BASIC_VERBOSE(_verbose, "#\n"); + ROCPROFSYS_BASIC_VERBOSE(_verbose, "# DEPRECATION NOTICE:\n"); + ROCPROFSYS_BASIC_VERBOSE(_verbose, "# %s is deprecated!\n", _old.c_str()); + ROCPROFSYS_BASIC_VERBOSE(_verbose, "# Use %s instead!\n", _new.c_str()); if(!_new_setting->second->get_environ_updated() && !_new_setting->second->get_config_updated()) @@ -1507,15 +1507,15 @@ handle_deprecated_setting(const std::string& _old, const std::string& _new, int { std::string _cause = (_old_setting->second->get_environ_updated()) ? "environ" : "config"; - OMNITRACE_BASIC_VERBOSE(_verbose, "#\n"); - OMNITRACE_BASIC_VERBOSE(_verbose, "# %s :: '%s' -> '%s'\n", _new.c_str(), + ROCPROFSYS_BASIC_VERBOSE(_verbose, "#\n"); + ROCPROFSYS_BASIC_VERBOSE(_verbose, "# %s :: '%s' -> '%s'\n", _new.c_str(), _before.c_str(), _after.c_str()); - OMNITRACE_BASIC_VERBOSE(_verbose, "# via %s (%s)\n", _old.c_str(), + ROCPROFSYS_BASIC_VERBOSE(_verbose, "# via %s (%s)\n", _old.c_str(), _cause.c_str()); } } - OMNITRACE_BASIC_VERBOSE(_verbose, "#\n"); + ROCPROFSYS_BASIC_VERBOSE(_verbose, "#\n"); _separator(); } } @@ -1535,7 +1535,7 @@ print_banner(std::ostream& _os) )banner"; std::stringstream _version_info{}; - _version_info << "rocprof-sys v" << OMNITRACE_VERSION_STRING; + _version_info << "rocprof-sys v" << ROCPROFSYS_VERSION_STRING; namespace join = ::timemory::join; @@ -1555,11 +1555,11 @@ print_banner(std::ostream& _os) }; auto _properties = - _generate_properties({ { "rev", OMNITRACE_GIT_REVISION }, - { "tag", OMNITRACE_GIT_DESCRIBE }, - { "", OMNITRACE_LIBRARY_ARCH }, - { "compiler", OMNITRACE_COMPILER_STRING }, - { "rocm", OMNITRACE_HIP_VERSION_COMPAT_STRING } }); + _generate_properties({ { "rev", ROCPROFSYS_GIT_REVISION }, + { "tag", ROCPROFSYS_GIT_DESCRIBE }, + { "", ROCPROFSYS_LIBRARY_ARCH }, + { "compiler", ROCPROFSYS_COMPILER_STRING }, + { "rocm", ROCPROFSYS_HIP_VERSION_COMPAT_STRING } }); // () if(!_properties.empty()) @@ -1574,7 +1574,7 @@ print_settings( std::ostream& _ros, std::function&)>&& _filter) { - OMNITRACE_CONDITIONAL_BASIC_PRINT(true, "configuration:\n"); + ROCPROFSYS_CONDITIONAL_BASIC_PRINT(true, "configuration:\n"); std::stringstream _os{}; @@ -1606,13 +1606,13 @@ print_settings( std::sort(_data.begin(), _data.end(), [](const auto& lhs, const auto& rhs) { auto _npos = std::string::npos; - // OMNITRACE_CONFIG_FILE always first + // ROCPROFSYS_CONFIG_FILE always first if(lhs.at(0) == "ROCPROFSYS_MODE") return true; if(rhs.at(0) == "ROCPROFSYS_MODE") return false; - // OMNITRACE_CONFIG_FILE always second + // ROCPROFSYS_CONFIG_FILE always second if(lhs.at(0).find("ROCPROFSYS_CONFIG") != _npos) return true; if(rhs.at(0).find("ROCPROFSYS_CONFIG") != _npos) return false; - // OMNITRACE_USE_* prioritized + // ROCPROFSYS_USE_* prioritized auto _lhs_use = lhs.at(0).find("ROCPROFSYS_USE_"); auto _rhs_use = rhs.at(0).find("ROCPROFSYS_USE_"); if(_lhs_use != _rhs_use && _lhs_use < _rhs_use) return true; @@ -1758,7 +1758,7 @@ get_mode() for(const auto& itr : _v->second->get_choices()) _ss << ", " << itr; auto _msg = (_ss.str().length() > 2) ? _ss.str().substr(2) : std::string{}; - OMNITRACE_THROW("[%s] invalid mode %s. Choices: %s\n", __FUNCTION__, + ROCPROFSYS_THROW("[%s] invalid mode %s. Choices: %s\n", __FUNCTION__, _mode.c_str(), _msg.c_str()); } return Mode::Trace; @@ -1862,7 +1862,7 @@ get_use_causal() bool get_use_roctracer() { -#if defined(OMNITRACE_USE_ROCTRACER) && OMNITRACE_USE_ROCTRACER > 0 +#if defined(ROCPROFSYS_USE_ROCTRACER) && ROCPROFSYS_USE_ROCTRACER > 0 static auto _v = get_config()->find("ROCPROFSYS_USE_ROCTRACER"); return static_cast&>(*_v->second).get(); #else @@ -1873,7 +1873,7 @@ get_use_roctracer() bool get_perfetto_roctracer_per_stream() { -#if defined(OMNITRACE_USE_ROCTRACER) && OMNITRACE_USE_ROCTRACER > 0 +#if defined(ROCPROFSYS_USE_ROCTRACER) && ROCPROFSYS_USE_ROCTRACER > 0 static auto _v = get_config()->find("ROCPROFSYS_PERFETTO_ROCTRACER_PER_STREAM"); return static_cast&>(*_v->second).get(); #else @@ -1884,7 +1884,7 @@ get_perfetto_roctracer_per_stream() bool get_use_rocprofiler() { -#if defined(OMNITRACE_USE_ROCPROFILER) && OMNITRACE_USE_ROCPROFILER > 0 +#if defined(ROCPROFSYS_USE_ROCPROFILER) && ROCPROFSYS_USE_ROCPROFILER > 0 static auto _v = get_config()->find("ROCPROFSYS_USE_ROCPROFILER"); return static_cast&>(*_v->second).get(); #else @@ -1895,7 +1895,7 @@ get_use_rocprofiler() bool get_use_rocm_smi() { -#if defined(OMNITRACE_USE_ROCM_SMI) && OMNITRACE_USE_ROCM_SMI > 0 +#if defined(ROCPROFSYS_USE_ROCM_SMI) && ROCPROFSYS_USE_ROCM_SMI > 0 static auto _v = get_config()->find("ROCPROFSYS_USE_ROCM_SMI"); return static_cast&>(*_v->second).get(); #else @@ -1906,7 +1906,7 @@ get_use_rocm_smi() bool get_use_roctx() { -#if defined(OMNITRACE_USE_ROCTRACER) && OMNITRACE_USE_ROCTRACER > 0 +#if defined(ROCPROFSYS_USE_ROCTRACER) && ROCPROFSYS_USE_ROCTRACER > 0 static auto _v = get_config()->find("ROCPROFSYS_USE_ROCTX"); return static_cast&>(*_v->second).get(); #else @@ -1921,7 +1921,7 @@ get_use_sampling() static auto _v = get_config()->find("ROCPROFSYS_USE_SAMPLING"); return static_cast&>(*_v->second).get(); #else - OMNITRACE_THROW("Error! sampling was enabled but rocprof-sys was not built with " + ROCPROFSYS_THROW("Error! sampling was enabled but rocprof-sys was not built with " "libunwind support"); static bool _v = false; return _v; @@ -2126,11 +2126,11 @@ get_category_config() } else { - OMNITRACE_ABORT("Error! Conflicting options ROCPROFSYS_ENABLE_CATEGORIES and " + ROCPROFSYS_ABORT("Error! Conflicting options ROCPROFSYS_ENABLE_CATEGORIES and " "ROCPROFSYS_DISABLE_CATEGORIES were both provided."); } - OMNITRACE_CI_THROW(_enabled.size() + _disabled.size() != _avail.size(), + ROCPROFSYS_CI_THROW(_enabled.size() + _disabled.size() != _avail.size(), "Error! Internal error for categories: %zu (enabled) + %zu " "(disabled) != %zu (total)\n", _enabled.size(), _disabled.size(), _avail.size()); @@ -2351,7 +2351,7 @@ get_process_sampling_duration() std::string get_sampling_gpus() { -#if defined(OMNITRACE_USE_ROCM_SMI) && OMNITRACE_USE_ROCM_SMI > 0 +#if defined(ROCPROFSYS_USE_ROCM_SMI) && ROCPROFSYS_USE_ROCM_SMI > 0 static auto _v = get_config()->find("ROCPROFSYS_SAMPLING_GPUS"); return static_cast&>(*_v->second).get(); #else @@ -2448,7 +2448,7 @@ tmp_file::~tmp_file() bool tmp_file::open(std::ios::openmode _mode) { - OMNITRACE_BASIC_VERBOSE(2, "Opening temporary file '%s'...\n", filename.c_str()); + ROCPROFSYS_BASIC_VERBOSE(2, "Opening temporary file '%s'...\n", filename.c_str()); if(!filepath::exists(filename)) { @@ -2465,7 +2465,7 @@ tmp_file::open(std::ios::openmode _mode) bool tmp_file::fopen(const char* _mode) { - OMNITRACE_BASIC_VERBOSE(2, "Opening temporary file '%s'...\n", filename.c_str()); + ROCPROFSYS_BASIC_VERBOSE(2, "Opening temporary file '%s'...\n", filename.c_str()); if(!filepath::exists(filename)) { @@ -2533,7 +2533,7 @@ tmp_file::remove() close(); if(filepath::exists(filename)) { - OMNITRACE_BASIC_VERBOSE(2, "Removing temporary file '%s'...\n", filename.c_str()); + ROCPROFSYS_BASIC_VERBOSE(2, "Removing temporary file '%s'...\n", filename.c_str()); auto _ret = ::remove(filename.c_str()); return (_ret == 0); } @@ -2579,7 +2579,7 @@ get_tmp_file(std::string _basename, std::string _ext) if(_fname.empty() || _fname.front() != '/') { - OMNITRACE_THROW("Error! temporary file '%s' (based on '%s.%s') is either empty " + ROCPROFSYS_THROW("Error! temporary file '%s' (based on '%s.%s') is either empty " "or is not an absolute path", _fname.c_str(), _basename.c_str(), _ext.c_str()); } @@ -2607,7 +2607,7 @@ get_causal_backend() } catch(std::runtime_error& _e) { auto _mode = static_cast&>(*_v->second).get(); - OMNITRACE_THROW("[%s] invalid causal backend %s. Choices: %s\n", __FUNCTION__, + ROCPROFSYS_THROW("[%s] invalid causal backend %s. Choices: %s\n", __FUNCTION__, _mode.c_str(), timemory::join::join(timemory::join::array_config{ ", ", "", "" }, _v->second->get_choices()) @@ -2639,7 +2639,7 @@ get_causal_mode() } catch(std::runtime_error& _e) { auto _mode = static_cast&>(*_v->second).get(); - OMNITRACE_THROW( + ROCPROFSYS_THROW( "[%s] invalid causal mode %s. Choices: %s\n", __FUNCTION__, _mode.c_str(), timemory::join::join(timemory::join::array_config{ ", ", "", "" }, _v->second->get_choices()) diff --git a/source/lib/core/config.hpp b/source/lib/core/config.hpp index 89d7e11e..fcf7a5cc 100644 --- a/source/lib/core/config.hpp +++ b/source/lib/core/config.hpp @@ -49,7 +49,7 @@ using signal_handler_t = void (*)(void); signal_handler_t set_signal_handler(signal_handler_t); bool -settings_are_configured() OMNITRACE_HOT; +settings_are_configured() ROCPROFSYS_HOT; void configure_settings(bool _init = true); @@ -156,10 +156,10 @@ bool& is_binary_rewrite(); bool -get_is_continuous_integration() OMNITRACE_HOT; +get_is_continuous_integration() ROCPROFSYS_HOT; bool -get_debug_env() OMNITRACE_HOT; +get_debug_env() ROCPROFSYS_HOT; bool get_debug_init(); @@ -168,49 +168,49 @@ bool get_debug_finalize(); bool -get_debug() OMNITRACE_HOT; +get_debug() ROCPROFSYS_HOT; bool -get_debug_sampling() OMNITRACE_HOT; +get_debug_sampling() ROCPROFSYS_HOT; bool -get_debug_tid() OMNITRACE_HOT; +get_debug_tid() ROCPROFSYS_HOT; bool -get_debug_pid() OMNITRACE_HOT; +get_debug_pid() ROCPROFSYS_HOT; int -get_verbose_env() OMNITRACE_HOT; +get_verbose_env() ROCPROFSYS_HOT; int -get_verbose() OMNITRACE_HOT; +get_verbose() ROCPROFSYS_HOT; bool& -get_use_perfetto() OMNITRACE_HOT; +get_use_perfetto() ROCPROFSYS_HOT; bool& -get_use_timemory() OMNITRACE_HOT; +get_use_timemory() ROCPROFSYS_HOT; bool& -get_use_causal() OMNITRACE_HOT; +get_use_causal() ROCPROFSYS_HOT; bool -get_use_roctracer() OMNITRACE_HOT; +get_use_roctracer() ROCPROFSYS_HOT; bool -get_use_rocprofiler() OMNITRACE_HOT; +get_use_rocprofiler() ROCPROFSYS_HOT; bool -get_use_rocm_smi() OMNITRACE_HOT; +get_use_rocm_smi() ROCPROFSYS_HOT; bool get_use_roctx(); bool& -get_use_sampling() OMNITRACE_HOT; +get_use_sampling() ROCPROFSYS_HOT; bool& -get_use_process_sampling() OMNITRACE_HOT; +get_use_process_sampling() ROCPROFSYS_HOT; bool& get_use_pid(); @@ -267,7 +267,7 @@ std::set get_disabled_categories(); bool -get_perfetto_annotations() OMNITRACE_HOT; +get_perfetto_annotations() ROCPROFSYS_HOT; uint64_t get_thread_pool_size(); @@ -283,7 +283,7 @@ std::string get_perfetto_output_filename(); bool -get_perfetto_roctracer_per_stream() OMNITRACE_HOT; +get_perfetto_roctracer_per_stream() ROCPROFSYS_HOT; double get_trace_delay(); diff --git a/source/lib/core/constraint.cpp b/source/lib/core/constraint.cpp index 24a9e8b3..144d4f03 100644 --- a/source/lib/core/constraint.cpp +++ b/source/lib/core/constraint.cpp @@ -47,7 +47,7 @@ namespace units = ::tim::units; using clock_type = std::chrono::high_resolution_clock; using duration_type = std::chrono::duration; -#define OMNITRACE_CLOCK_IDENTIFIER(VAL) \ +#define ROCPROFSYS_CLOCK_IDENTIFIER(VAL) \ clock_identifier { #VAL, VAL } auto @@ -63,13 +63,13 @@ clock_name(std::string _v) } auto accepted_clock_ids = - std::set{ OMNITRACE_CLOCK_IDENTIFIER(CLOCK_REALTIME), - OMNITRACE_CLOCK_IDENTIFIER(CLOCK_MONOTONIC), - OMNITRACE_CLOCK_IDENTIFIER(CLOCK_PROCESS_CPUTIME_ID), - OMNITRACE_CLOCK_IDENTIFIER(CLOCK_MONOTONIC_RAW), - OMNITRACE_CLOCK_IDENTIFIER(CLOCK_REALTIME_COARSE), - OMNITRACE_CLOCK_IDENTIFIER(CLOCK_MONOTONIC_COARSE), - OMNITRACE_CLOCK_IDENTIFIER(CLOCK_BOOTTIME) }; + std::set{ ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_REALTIME), + ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_MONOTONIC), + ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_PROCESS_CPUTIME_ID), + ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_MONOTONIC_RAW), + ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_REALTIME_COARSE), + ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_MONOTONIC_COARSE), + ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_BOOTTIME) }; template clock_identifier @@ -101,7 +101,7 @@ find_clock_identifier(const Tp& _v) } } - OMNITRACE_THROW("Unknown clock id %s: %s. Valid choices: %s\n", _descript, + ROCPROFSYS_THROW("Unknown clock id %s: %s. Valid choices: %s\n", _descript, timemory::join::join("", _v).c_str(), timemory::join::join("", accepted_clock_ids).c_str()); } @@ -266,7 +266,7 @@ spec::operator()(const stages& _stages) const return _ret; }; - OMNITRACE_VERBOSE(2, + ROCPROFSYS_VERBOSE(2, "Executing constraint spec %lu of %lu :: delay: %6.3f, " "duration: %6.3f, clock: %s\n", i, _spec.repeat, _spec.delay, _spec.duration, diff --git a/source/lib/core/constraint.hpp b/source/lib/core/constraint.hpp index f2b8808f..ed7be3cb 100644 --- a/source/lib/core/constraint.hpp +++ b/source/lib/core/constraint.hpp @@ -51,7 +51,7 @@ struct stages stages(); - OMNITRACE_DEFAULT_COPY_MOVE(stages) + ROCPROFSYS_DEFAULT_COPY_MOVE(stages) functor_t init = [](const spec&) { return true; }; functor_t wait = [](const spec&) { return true; }; @@ -69,7 +69,7 @@ struct clock_identifier clock_identifier(); clock_identifier(std::string_view, int); - OMNITRACE_DEFAULT_COPY_MOVE(clock_identifier) + ROCPROFSYS_DEFAULT_COPY_MOVE(clock_identifier) std::string as_string() const; @@ -91,7 +91,7 @@ struct spec spec(const std::string&, double, double, uint64_t = 0, uint64_t = 1); spec(const std::string&); - OMNITRACE_DEFAULT_COPY_MOVE(spec) + ROCPROFSYS_DEFAULT_COPY_MOVE(spec) void operator()(const stages&) const; diff --git a/source/lib/core/containers/aligned_static_vector.hpp b/source/lib/core/containers/aligned_static_vector.hpp index dd77c6c6..1ef3960c 100644 --- a/source/lib/core/containers/aligned_static_vector.hpp +++ b/source/lib/core/containers/aligned_static_vector.hpp @@ -36,17 +36,17 @@ namespace omnitrace { namespace container { -#if !defined(OMNITRACE_CACHELINE_SIZE) +#if !defined(ROCPROFSYS_CACHELINE_SIZE) # ifdef __cpp_lib_hardware_interference_size -# define OMNITRACE_CACHELINE_SIZE std::hardware_destructive_interference_size +# define ROCPROFSYS_CACHELINE_SIZE std::hardware_destructive_interference_size # else // 64 bytes on x86-64 │ L1_CACHE_BYTES │ L1_CACHE_SHIFT │ __cacheline_aligned │ ... -# define OMNITRACE_CACHELINE_SIZE 64 +# define ROCPROFSYS_CACHELINE_SIZE 64 # endif #endif constexpr std::size_t cacheline_align_v = - std::max(OMNITRACE_CACHELINE_SIZE, OMNITRACE_CACHELINE_SIZE_MIN); + std::max(ROCPROFSYS_CACHELINE_SIZE, ROCPROFSYS_CACHELINE_SIZE_MIN); template @@ -228,7 +228,7 @@ aligned_static_vector& aligned_static_vector::operator=( std::initializer_list&& _v) { - if(OMNITRACE_UNLIKELY(_v.size() > N)) + if(ROCPROFSYS_UNLIKELY(_v.size() > N)) { throw exception( std::string{ "aligned_static_vector::operator=(initializer_list) size > " } + diff --git a/source/lib/core/containers/operators.hpp b/source/lib/core/containers/operators.hpp index 043497d0..250b9489 100644 --- a/source/lib/core/containers/operators.hpp +++ b/source/lib/core/containers/operators.hpp @@ -27,13 +27,13 @@ #include #include -#define OMNITRACE_IMPORT_TEMPLATE2(template_name) -#define OMNITRACE_IMPORT_TEMPLATE1(template_name) +#define ROCPROFSYS_IMPORT_TEMPLATE2(template_name) +#define ROCPROFSYS_IMPORT_TEMPLATE1(template_name) // Import a 2-type-argument operator template into boost (if necessary) and // provide a specialization of 'is_chained_base<>' for it. -#define OMNITRACE_OPERATOR_TEMPLATE2(template_name2) \ - OMNITRACE_IMPORT_TEMPLATE2(template_name2) \ +#define ROCPROFSYS_OPERATOR_TEMPLATE2(template_name2) \ + ROCPROFSYS_IMPORT_TEMPLATE2(template_name2) \ template \ struct is_chained_base<::omnitrace::container::template_name2> \ { \ @@ -42,15 +42,15 @@ // Import a 1-type-argument operator template into boost (if necessary) and // provide a specialization of 'is_chained_base<>' for it. -#define OMNITRACE_OPERATOR_TEMPLATE1(template_name1) \ - OMNITRACE_IMPORT_TEMPLATE1(template_name1) \ +#define ROCPROFSYS_OPERATOR_TEMPLATE1(template_name1) \ + ROCPROFSYS_IMPORT_TEMPLATE1(template_name1) \ template \ struct is_chained_base<::omnitrace::container::template_name1> \ { \ using value = ::omnitrace::container::true_t; \ }; -#define OMNITRACE_OPERATOR_TEMPLATE(template_name) \ +#define ROCPROFSYS_OPERATOR_TEMPLATE(template_name) \ template , \ typename O = typename is_chained_base::value> \ struct template_name; \ @@ -77,10 +77,10 @@ using value = ::omnitrace::container::true_t; \ }; \ \ - OMNITRACE_OPERATOR_TEMPLATE2(template_name##2) \ - OMNITRACE_OPERATOR_TEMPLATE1(template_name##1) + ROCPROFSYS_OPERATOR_TEMPLATE2(template_name##2) \ + ROCPROFSYS_OPERATOR_TEMPLATE1(template_name##1) -#define OMNITRACE_BINARY_OPERATOR_COMMUTATIVE(NAME, OP) \ +#define ROCPROFSYS_BINARY_OPERATOR_COMMUTATIVE(NAME, OP) \ template > \ struct NAME##2 \ : B{ friend T operator OP(T lhs, const U& rhs){ return lhs OP## = rhs; \ @@ -96,7 +96,7 @@ } \ ; -#define OMNITRACE_BINARY_OPERATOR_NON_COMMUTATIVE(NAME, OP) \ +#define ROCPROFSYS_BINARY_OPERATOR_NON_COMMUTATIVE(NAME, OP) \ template > \ struct NAME##2 \ : B{ friend T operator OP(T lhs, const U& rhs){ return lhs OP## = rhs; \ @@ -124,10 +124,10 @@ struct is_chained_base using value = true_t; }; -OMNITRACE_BINARY_OPERATOR_COMMUTATIVE(addable, +) -OMNITRACE_BINARY_OPERATOR_NON_COMMUTATIVE(subtractable, -) +ROCPROFSYS_BINARY_OPERATOR_COMMUTATIVE(addable, +) +ROCPROFSYS_BINARY_OPERATOR_NON_COMMUTATIVE(subtractable, -) -OMNITRACE_OPERATOR_TEMPLATE(addable) +ROCPROFSYS_OPERATOR_TEMPLATE(addable) template > struct incrementable : B diff --git a/source/lib/core/containers/stable_vector.hpp b/source/lib/core/containers/stable_vector.hpp index 6b9270b4..fa4ebf82 100644 --- a/source/lib/core/containers/stable_vector.hpp +++ b/source/lib/core/containers/stable_vector.hpp @@ -38,7 +38,7 @@ namespace omnitrace { namespace container { -template class stable_vector { @@ -299,7 +299,7 @@ template typename stable_vector::chunk_type& stable_vector::last_chunk() { - if(OMNITRACE_UNLIKELY(m_chunks.empty() || m_chunks.back()->size() == ChunkSizeV)) + if(ROCPROFSYS_UNLIKELY(m_chunks.empty() || m_chunks.back()->size() == ChunkSizeV)) { add_chunk(); } @@ -358,7 +358,7 @@ template typename stable_vector::reference stable_vector::at(size_type i) { - if(OMNITRACE_UNLIKELY(i >= size())) + if(ROCPROFSYS_UNLIKELY(i >= size())) { throw ::omnitrace::exception( "stable_vector::at(" + std::to_string(i) + "). size is " + diff --git a/source/lib/core/containers/static_vector.hpp b/source/lib/core/containers/static_vector.hpp index 0773418a..a4440a2e 100644 --- a/source/lib/core/containers/static_vector.hpp +++ b/source/lib/core/containers/static_vector.hpp @@ -147,7 +147,7 @@ template static_vector& static_vector::operator=(std::initializer_list&& _v) { - if(OMNITRACE_UNLIKELY(_v.size() > N)) + if(ROCPROFSYS_UNLIKELY(_v.size() > N)) { throw exception( std::string{ "static_vector::operator=(initializer_list) size > " } + diff --git a/source/lib/core/debug.hpp b/source/lib/core/debug.hpp index bf0e5bfb..5322644f 100644 --- a/source/lib/core/debug.hpp +++ b/source/lib/core/debug.hpp @@ -48,25 +48,25 @@ namespace omnitrace inline namespace config { bool -get_debug() OMNITRACE_HOT; +get_debug() ROCPROFSYS_HOT; int -get_verbose() OMNITRACE_HOT; +get_verbose() ROCPROFSYS_HOT; bool -get_debug_env() OMNITRACE_HOT; +get_debug_env() ROCPROFSYS_HOT; int -get_verbose_env() OMNITRACE_HOT; +get_verbose_env() ROCPROFSYS_HOT; bool -get_is_continuous_integration() OMNITRACE_HOT; +get_is_continuous_integration() ROCPROFSYS_HOT; bool -get_debug_tid() OMNITRACE_HOT; +get_debug_tid() ROCPROFSYS_HOT; bool -get_debug_pid() OMNITRACE_HOT; +get_debug_pid() ROCPROFSYS_HOT; } // namespace config namespace debug @@ -154,55 +154,55 @@ extern template std::string as_hex(void*, size_t); } // namespace omnitrace -#if !defined(OMNITRACE_DEBUG_BUFFER_LEN) -# define OMNITRACE_DEBUG_BUFFER_LEN 1024 +#if !defined(ROCPROFSYS_DEBUG_BUFFER_LEN) +# define ROCPROFSYS_DEBUG_BUFFER_LEN 1024 #endif -#if !defined(OMNITRACE_DEBUG_PROCESS_IDENTIFIER) +#if !defined(ROCPROFSYS_DEBUG_PROCESS_IDENTIFIER) # if defined(TIMEMORY_USE_MPI) -# define OMNITRACE_DEBUG_PROCESS_IDENTIFIER static_cast(::tim::dmp::rank()) +# define ROCPROFSYS_DEBUG_PROCESS_IDENTIFIER static_cast(::tim::dmp::rank()) # elif defined(TIMEMORY_USE_MPI_HEADERS) -# define OMNITRACE_DEBUG_PROCESS_IDENTIFIER \ +# define ROCPROFSYS_DEBUG_PROCESS_IDENTIFIER \ (::tim::dmp::is_initialized()) ? static_cast(::tim::dmp::rank()) \ : static_cast(::tim::process::get_id()) # else -# define OMNITRACE_DEBUG_PROCESS_IDENTIFIER \ +# define ROCPROFSYS_DEBUG_PROCESS_IDENTIFIER \ static_cast(::tim::process::get_id()) # endif #endif -#if !defined(OMNITRACE_DEBUG_THREAD_IDENTIFIER) -# define OMNITRACE_DEBUG_THREAD_IDENTIFIER ::omnitrace::debug::get_tid() +#if !defined(ROCPROFSYS_DEBUG_THREAD_IDENTIFIER) +# define ROCPROFSYS_DEBUG_THREAD_IDENTIFIER ::omnitrace::debug::get_tid() #endif -#if !defined(OMNITRACE_SOURCE_LOCATION) -# define OMNITRACE_SOURCE_LOCATION \ +#if !defined(ROCPROFSYS_SOURCE_LOCATION) +# define ROCPROFSYS_SOURCE_LOCATION \ ::omnitrace::debug::source_location { __PRETTY_FUNCTION__, __FILE__, __LINE__ } #endif -#if !defined(OMNITRACE_RECORD_SOURCE_LOCATION) -# define OMNITRACE_RECORD_SOURCE_LOCATION \ - ::omnitrace::debug::set_source_location(OMNITRACE_SOURCE_LOCATION) +#if !defined(ROCPROFSYS_RECORD_SOURCE_LOCATION) +# define ROCPROFSYS_RECORD_SOURCE_LOCATION \ + ::omnitrace::debug::set_source_location(ROCPROFSYS_SOURCE_LOCATION) #endif #if defined(__clang__) || (__GNUC__ < 9) -# define OMNITRACE_FUNCTION \ +# define ROCPROFSYS_FUNCTION \ std::string{ __FUNCTION__ } \ .substr(0, std::string_view{ __FUNCTION__ }.find("_hidden")) \ .c_str() -# define OMNITRACE_PRETTY_FUNCTION \ +# define ROCPROFSYS_PRETTY_FUNCTION \ std::string{ __PRETTY_FUNCTION__ } \ .substr(0, std::string_view{ __PRETTY_FUNCTION__ }.find("_hidden")) \ .c_str() #else -# define OMNITRACE_FUNCTION \ +# define ROCPROFSYS_FUNCTION \ ::omnitrace::debug::get_chars( \ std::string_view{ __FUNCTION__ }, \ std::make_index_sequence{}) \ .data() -# define OMNITRACE_PRETTY_FUNCTION \ +# define ROCPROFSYS_PRETTY_FUNCTION \ ::omnitrace::debug::get_chars( \ std::string_view{ __PRETTY_FUNCTION__ }, \ std::make_index_sequence(void*, size_t); //--------------------------------------------------------------------------------------// -#define OMNITRACE_FPRINTF_STDERR_COLOR(COLOR) \ +#define ROCPROFSYS_FPRINTF_STDERR_COLOR(COLOR) \ fprintf(::omnitrace::debug::get_file(), "%s", ::tim::log::color::COLOR()) //--------------------------------------------------------------------------------------// -#define OMNITRACE_CONDITIONAL_PRINT_COLOR(COLOR, COND, ...) \ - if(OMNITRACE_UNLIKELY((COND) && ::omnitrace::config::get_debug_tid() && \ +#define ROCPROFSYS_CONDITIONAL_PRINT_COLOR(COLOR, COND, ...) \ + if(ROCPROFSYS_UNLIKELY((COND) && ::omnitrace::config::get_debug_tid() && \ ::omnitrace::config::get_debug_pid())) \ { \ ::omnitrace::debug::flush(); \ ::omnitrace::debug::lock _debug_lk{}; \ - OMNITRACE_FPRINTF_STDERR_COLOR(COLOR); \ + ROCPROFSYS_FPRINTF_STDERR_COLOR(COLOR); \ fprintf(::omnitrace::debug::get_file(), "[rocprof-sys][%i][%li]%s", \ - OMNITRACE_DEBUG_PROCESS_IDENTIFIER, OMNITRACE_DEBUG_THREAD_IDENTIFIER, \ + ROCPROFSYS_DEBUG_PROCESS_IDENTIFIER, ROCPROFSYS_DEBUG_THREAD_IDENTIFIER, \ ::omnitrace::debug::is_bracket(__VA_ARGS__) ? "" : " "); \ fprintf(::omnitrace::debug::get_file(), __VA_ARGS__); \ ::omnitrace::debug::flush(); \ } -#define OMNITRACE_CONDITIONAL_PRINT_COLOR_F(COLOR, COND, ...) \ - if(OMNITRACE_UNLIKELY((COND) && ::omnitrace::config::get_debug_tid() && \ +#define ROCPROFSYS_CONDITIONAL_PRINT_COLOR_F(COLOR, COND, ...) \ + if(ROCPROFSYS_UNLIKELY((COND) && ::omnitrace::config::get_debug_tid() && \ ::omnitrace::config::get_debug_pid())) \ { \ ::omnitrace::debug::flush(); \ ::omnitrace::debug::lock _debug_lk{}; \ - OMNITRACE_FPRINTF_STDERR_COLOR(COLOR); \ + ROCPROFSYS_FPRINTF_STDERR_COLOR(COLOR); \ fprintf(::omnitrace::debug::get_file(), "[rocprof-sys][%i][%li][%s]%s", \ - OMNITRACE_DEBUG_PROCESS_IDENTIFIER, OMNITRACE_DEBUG_THREAD_IDENTIFIER, \ - OMNITRACE_FUNCTION, \ + ROCPROFSYS_DEBUG_PROCESS_IDENTIFIER, ROCPROFSYS_DEBUG_THREAD_IDENTIFIER, \ + ROCPROFSYS_FUNCTION, \ ::omnitrace::debug::is_bracket(__VA_ARGS__) ? "" : " "); \ fprintf(::omnitrace::debug::get_file(), __VA_ARGS__); \ ::omnitrace::debug::flush(); \ } -#define OMNITRACE_PRINT_COLOR(COLOR, ...) \ - OMNITRACE_CONDITIONAL_PRINT_COLOR(COLOR, true, __VA_ARGS__) +#define ROCPROFSYS_PRINT_COLOR(COLOR, ...) \ + ROCPROFSYS_CONDITIONAL_PRINT_COLOR(COLOR, true, __VA_ARGS__) -#define OMNITRACE_PRINT_COLOR_F(COLOR, ...) \ - OMNITRACE_CONDITIONAL_PRINT_COLOR_F(COLOR, true, __VA_ARGS__) +#define ROCPROFSYS_PRINT_COLOR_F(COLOR, ...) \ + ROCPROFSYS_CONDITIONAL_PRINT_COLOR_F(COLOR, true, __VA_ARGS__) //--------------------------------------------------------------------------------------// -#define OMNITRACE_CONDITIONAL_PRINT(COND, ...) \ - if(OMNITRACE_UNLIKELY((COND) && ::omnitrace::config::get_debug_tid() && \ +#define ROCPROFSYS_CONDITIONAL_PRINT(COND, ...) \ + if(ROCPROFSYS_UNLIKELY((COND) && ::omnitrace::config::get_debug_tid() && \ ::omnitrace::config::get_debug_pid())) \ { \ ::omnitrace::debug::flush(); \ ::omnitrace::debug::lock _debug_lk{}; \ - OMNITRACE_FPRINTF_STDERR_COLOR(info); \ + ROCPROFSYS_FPRINTF_STDERR_COLOR(info); \ fprintf(::omnitrace::debug::get_file(), "[rocprof-sys][%i][%li]%s", \ - OMNITRACE_DEBUG_PROCESS_IDENTIFIER, OMNITRACE_DEBUG_THREAD_IDENTIFIER, \ + ROCPROFSYS_DEBUG_PROCESS_IDENTIFIER, ROCPROFSYS_DEBUG_THREAD_IDENTIFIER, \ ::omnitrace::debug::is_bracket(__VA_ARGS__) ? "" : " "); \ fprintf(::omnitrace::debug::get_file(), __VA_ARGS__); \ ::omnitrace::debug::flush(); \ } -#define OMNITRACE_CONDITIONAL_BASIC_PRINT(COND, ...) \ - if(OMNITRACE_UNLIKELY((COND) && ::omnitrace::config::get_debug_tid() && \ +#define ROCPROFSYS_CONDITIONAL_BASIC_PRINT(COND, ...) \ + if(ROCPROFSYS_UNLIKELY((COND) && ::omnitrace::config::get_debug_tid() && \ ::omnitrace::config::get_debug_pid())) \ { \ ::omnitrace::debug::flush(); \ ::omnitrace::debug::lock _debug_lk{}; \ - OMNITRACE_FPRINTF_STDERR_COLOR(info); \ + ROCPROFSYS_FPRINTF_STDERR_COLOR(info); \ fprintf(::omnitrace::debug::get_file(), "[rocprof-sys][%i]%s", \ - OMNITRACE_DEBUG_PROCESS_IDENTIFIER, \ + ROCPROFSYS_DEBUG_PROCESS_IDENTIFIER, \ ::omnitrace::debug::is_bracket(__VA_ARGS__) ? "" : " "); \ fprintf(::omnitrace::debug::get_file(), __VA_ARGS__); \ ::omnitrace::debug::flush(); \ } -#define OMNITRACE_CONDITIONAL_PRINT_F(COND, ...) \ - if(OMNITRACE_UNLIKELY((COND) && ::omnitrace::config::get_debug_tid() && \ +#define ROCPROFSYS_CONDITIONAL_PRINT_F(COND, ...) \ + if(ROCPROFSYS_UNLIKELY((COND) && ::omnitrace::config::get_debug_tid() && \ ::omnitrace::config::get_debug_pid())) \ { \ ::omnitrace::debug::flush(); \ ::omnitrace::debug::lock _debug_lk{}; \ - OMNITRACE_FPRINTF_STDERR_COLOR(info); \ + ROCPROFSYS_FPRINTF_STDERR_COLOR(info); \ fprintf(::omnitrace::debug::get_file(), "[rocprof-sys][%i][%li][%s]%s", \ - OMNITRACE_DEBUG_PROCESS_IDENTIFIER, OMNITRACE_DEBUG_THREAD_IDENTIFIER, \ - OMNITRACE_FUNCTION, \ + ROCPROFSYS_DEBUG_PROCESS_IDENTIFIER, ROCPROFSYS_DEBUG_THREAD_IDENTIFIER, \ + ROCPROFSYS_FUNCTION, \ ::omnitrace::debug::is_bracket(__VA_ARGS__) ? "" : " "); \ fprintf(::omnitrace::debug::get_file(), __VA_ARGS__); \ ::omnitrace::debug::flush(); \ } -#define OMNITRACE_CONDITIONAL_BASIC_PRINT_F(COND, ...) \ - if(OMNITRACE_UNLIKELY((COND) && ::omnitrace::config::get_debug_tid() && \ +#define ROCPROFSYS_CONDITIONAL_BASIC_PRINT_F(COND, ...) \ + if(ROCPROFSYS_UNLIKELY((COND) && ::omnitrace::config::get_debug_tid() && \ ::omnitrace::config::get_debug_pid())) \ { \ ::omnitrace::debug::flush(); \ ::omnitrace::debug::lock _debug_lk{}; \ - OMNITRACE_FPRINTF_STDERR_COLOR(info); \ + ROCPROFSYS_FPRINTF_STDERR_COLOR(info); \ fprintf(::omnitrace::debug::get_file(), "[rocprof-sys][%i][%s]%s", \ - OMNITRACE_DEBUG_PROCESS_IDENTIFIER, OMNITRACE_FUNCTION, \ + ROCPROFSYS_DEBUG_PROCESS_IDENTIFIER, ROCPROFSYS_FUNCTION, \ ::omnitrace::debug::is_bracket(__VA_ARGS__) ? "" : " "); \ fprintf(::omnitrace::debug::get_file(), __VA_ARGS__); \ ::omnitrace::debug::flush(); \ @@ -314,58 +314,58 @@ as_hex(void*, size_t); //--------------------------------------------------------------------------------------// -#define OMNITRACE_CONDITIONAL_WARN(COND, ...) \ - if(OMNITRACE_UNLIKELY((COND) && ::omnitrace::config::get_debug_tid() && \ +#define ROCPROFSYS_CONDITIONAL_WARN(COND, ...) \ + if(ROCPROFSYS_UNLIKELY((COND) && ::omnitrace::config::get_debug_tid() && \ ::omnitrace::config::get_debug_pid())) \ { \ ::omnitrace::debug::flush(); \ ::omnitrace::debug::lock _debug_lk{}; \ - OMNITRACE_FPRINTF_STDERR_COLOR(warning); \ + ROCPROFSYS_FPRINTF_STDERR_COLOR(warning); \ fprintf(::omnitrace::debug::get_file(), "[rocprof-sys][%i][%li]%s", \ - OMNITRACE_DEBUG_PROCESS_IDENTIFIER, OMNITRACE_DEBUG_THREAD_IDENTIFIER, \ + ROCPROFSYS_DEBUG_PROCESS_IDENTIFIER, ROCPROFSYS_DEBUG_THREAD_IDENTIFIER, \ ::omnitrace::debug::is_bracket(__VA_ARGS__) ? "" : " "); \ fprintf(::omnitrace::debug::get_file(), __VA_ARGS__); \ ::omnitrace::debug::flush(); \ } -#define OMNITRACE_CONDITIONAL_BASIC_WARN(COND, ...) \ - if(OMNITRACE_UNLIKELY((COND) && ::omnitrace::config::get_debug_tid() && \ +#define ROCPROFSYS_CONDITIONAL_BASIC_WARN(COND, ...) \ + if(ROCPROFSYS_UNLIKELY((COND) && ::omnitrace::config::get_debug_tid() && \ ::omnitrace::config::get_debug_pid())) \ { \ ::omnitrace::debug::flush(); \ ::omnitrace::debug::lock _debug_lk{}; \ - OMNITRACE_FPRINTF_STDERR_COLOR(warning); \ + ROCPROFSYS_FPRINTF_STDERR_COLOR(warning); \ fprintf(::omnitrace::debug::get_file(), "[rocprof-sys][%i]%s", \ - OMNITRACE_DEBUG_PROCESS_IDENTIFIER, \ + ROCPROFSYS_DEBUG_PROCESS_IDENTIFIER, \ ::omnitrace::debug::is_bracket(__VA_ARGS__) ? "" : " "); \ fprintf(::omnitrace::debug::get_file(), __VA_ARGS__); \ ::omnitrace::debug::flush(); \ } -#define OMNITRACE_CONDITIONAL_WARN_F(COND, ...) \ - if(OMNITRACE_UNLIKELY((COND) && ::omnitrace::config::get_debug_tid() && \ +#define ROCPROFSYS_CONDITIONAL_WARN_F(COND, ...) \ + if(ROCPROFSYS_UNLIKELY((COND) && ::omnitrace::config::get_debug_tid() && \ ::omnitrace::config::get_debug_pid())) \ { \ ::omnitrace::debug::flush(); \ ::omnitrace::debug::lock _debug_lk{}; \ - OMNITRACE_FPRINTF_STDERR_COLOR(warning); \ + ROCPROFSYS_FPRINTF_STDERR_COLOR(warning); \ fprintf(::omnitrace::debug::get_file(), "[rocprof-sys][%i][%li][%s]%s", \ - OMNITRACE_DEBUG_PROCESS_IDENTIFIER, OMNITRACE_DEBUG_THREAD_IDENTIFIER, \ - OMNITRACE_FUNCTION, \ + ROCPROFSYS_DEBUG_PROCESS_IDENTIFIER, ROCPROFSYS_DEBUG_THREAD_IDENTIFIER, \ + ROCPROFSYS_FUNCTION, \ ::omnitrace::debug::is_bracket(__VA_ARGS__) ? "" : " "); \ fprintf(::omnitrace::debug::get_file(), __VA_ARGS__); \ ::omnitrace::debug::flush(); \ } -#define OMNITRACE_CONDITIONAL_BASIC_WARN_F(COND, ...) \ - if(OMNITRACE_UNLIKELY((COND) && ::omnitrace::config::get_debug_tid() && \ +#define ROCPROFSYS_CONDITIONAL_BASIC_WARN_F(COND, ...) \ + if(ROCPROFSYS_UNLIKELY((COND) && ::omnitrace::config::get_debug_tid() && \ ::omnitrace::config::get_debug_pid())) \ { \ ::omnitrace::debug::flush(); \ ::omnitrace::debug::lock _debug_lk{}; \ - OMNITRACE_FPRINTF_STDERR_COLOR(warning); \ + ROCPROFSYS_FPRINTF_STDERR_COLOR(warning); \ fprintf(::omnitrace::debug::get_file(), "[rocprof-sys][%i][%s]%s", \ - OMNITRACE_DEBUG_PROCESS_IDENTIFIER, OMNITRACE_FUNCTION, \ + ROCPROFSYS_DEBUG_PROCESS_IDENTIFIER, ROCPROFSYS_FUNCTION, \ ::omnitrace::debug::is_bracket(__VA_ARGS__) ? "" : " "); \ fprintf(::omnitrace::debug::get_file(), __VA_ARGS__); \ ::omnitrace::debug::flush(); \ @@ -373,64 +373,64 @@ as_hex(void*, size_t); //--------------------------------------------------------------------------------------// -#define OMNITRACE_CONDITIONAL_THROW_E(COND, TYPE, ...) \ - if(OMNITRACE_UNLIKELY((COND))) \ +#define ROCPROFSYS_CONDITIONAL_THROW_E(COND, TYPE, ...) \ + if(ROCPROFSYS_UNLIKELY((COND))) \ { \ - char _msg_buffer[OMNITRACE_DEBUG_BUFFER_LEN]; \ - snprintf(_msg_buffer, OMNITRACE_DEBUG_BUFFER_LEN, \ - "[rocprof-sys][%i][%li][%s]%s", OMNITRACE_DEBUG_PROCESS_IDENTIFIER, \ - OMNITRACE_DEBUG_THREAD_IDENTIFIER, OMNITRACE_FUNCTION, \ + char _msg_buffer[ROCPROFSYS_DEBUG_BUFFER_LEN]; \ + snprintf(_msg_buffer, ROCPROFSYS_DEBUG_BUFFER_LEN, \ + "[rocprof-sys][%i][%li][%s]%s", ROCPROFSYS_DEBUG_PROCESS_IDENTIFIER, \ + ROCPROFSYS_DEBUG_THREAD_IDENTIFIER, ROCPROFSYS_FUNCTION, \ ::omnitrace::debug::is_bracket(__VA_ARGS__) ? "" : " "); \ auto len = strlen(_msg_buffer); \ - snprintf(_msg_buffer + len, OMNITRACE_DEBUG_BUFFER_LEN - len, __VA_ARGS__); \ + snprintf(_msg_buffer + len, ROCPROFSYS_DEBUG_BUFFER_LEN - len, __VA_ARGS__); \ throw ::omnitrace::exception( \ ::tim::log::string(::tim::log::color::fatal(), _msg_buffer)); \ } -#define OMNITRACE_CONDITIONAL_BASIC_THROW_E(COND, TYPE, ...) \ - if(OMNITRACE_UNLIKELY((COND))) \ +#define ROCPROFSYS_CONDITIONAL_BASIC_THROW_E(COND, TYPE, ...) \ + if(ROCPROFSYS_UNLIKELY((COND))) \ { \ - char _msg_buffer[OMNITRACE_DEBUG_BUFFER_LEN]; \ - snprintf(_msg_buffer, OMNITRACE_DEBUG_BUFFER_LEN, "[rocprof-sys][%i][%s]%s", \ - OMNITRACE_DEBUG_PROCESS_IDENTIFIER, OMNITRACE_FUNCTION, \ + char _msg_buffer[ROCPROFSYS_DEBUG_BUFFER_LEN]; \ + snprintf(_msg_buffer, ROCPROFSYS_DEBUG_BUFFER_LEN, "[rocprof-sys][%i][%s]%s", \ + ROCPROFSYS_DEBUG_PROCESS_IDENTIFIER, ROCPROFSYS_FUNCTION, \ ::omnitrace::debug::is_bracket(__VA_ARGS__) ? "" : " "); \ auto len = strlen(_msg_buffer); \ - snprintf(_msg_buffer + len, OMNITRACE_DEBUG_BUFFER_LEN - len, __VA_ARGS__); \ + snprintf(_msg_buffer + len, ROCPROFSYS_DEBUG_BUFFER_LEN - len, __VA_ARGS__); \ throw ::omnitrace::exception( \ ::tim::log::string(::tim::log::color::fatal(), _msg_buffer)); \ } -#define OMNITRACE_CI_THROW_E(COND, TYPE, ...) \ - OMNITRACE_CONDITIONAL_THROW_E( \ +#define ROCPROFSYS_CI_THROW_E(COND, TYPE, ...) \ + ROCPROFSYS_CONDITIONAL_THROW_E( \ ::omnitrace::get_is_continuous_integration() && (COND), TYPE, __VA_ARGS__) -#define OMNITRACE_CI_BASIC_THROW_E(COND, TYPE, ...) \ - OMNITRACE_CONDITIONAL_BASIC_THROW_E( \ +#define ROCPROFSYS_CI_BASIC_THROW_E(COND, TYPE, ...) \ + ROCPROFSYS_CONDITIONAL_BASIC_THROW_E( \ ::omnitrace::get_is_continuous_integration() && (COND), TYPE, __VA_ARGS__) //--------------------------------------------------------------------------------------// -#define OMNITRACE_CONDITIONAL_THROW(COND, ...) \ - OMNITRACE_CONDITIONAL_THROW_E((COND), std::runtime_error, __VA_ARGS__) +#define ROCPROFSYS_CONDITIONAL_THROW(COND, ...) \ + ROCPROFSYS_CONDITIONAL_THROW_E((COND), std::runtime_error, __VA_ARGS__) -#define OMNITRACE_CONDITIONAL_BASIC_THROW(COND, ...) \ - OMNITRACE_CONDITIONAL_BASIC_THROW_E((COND), std::runtime_error, __VA_ARGS__) +#define ROCPROFSYS_CONDITIONAL_BASIC_THROW(COND, ...) \ + ROCPROFSYS_CONDITIONAL_BASIC_THROW_E((COND), std::runtime_error, __VA_ARGS__) -#define OMNITRACE_CI_THROW(COND, ...) \ - OMNITRACE_CI_THROW_E((COND), std::runtime_error, __VA_ARGS__) +#define ROCPROFSYS_CI_THROW(COND, ...) \ + ROCPROFSYS_CI_THROW_E((COND), std::runtime_error, __VA_ARGS__) -#define OMNITRACE_CI_BASIC_THROW(COND, ...) \ - OMNITRACE_CI_BASIC_THROW_E((COND), std::runtime_error, __VA_ARGS__) +#define ROCPROFSYS_CI_BASIC_THROW(COND, ...) \ + ROCPROFSYS_CI_BASIC_THROW_E((COND), std::runtime_error, __VA_ARGS__) //--------------------------------------------------------------------------------------// -#define OMNITRACE_CONDITIONAL_FAILURE(COND, METHOD, ...) \ - if(OMNITRACE_UNLIKELY((COND))) \ +#define ROCPROFSYS_CONDITIONAL_FAILURE(COND, METHOD, ...) \ + if(ROCPROFSYS_UNLIKELY((COND))) \ { \ ::omnitrace::debug::flush(); \ - OMNITRACE_FPRINTF_STDERR_COLOR(fatal); \ + ROCPROFSYS_FPRINTF_STDERR_COLOR(fatal); \ fprintf(::omnitrace::debug::get_file(), "[rocprof-sys][%i][%li]%s", \ - OMNITRACE_DEBUG_PROCESS_IDENTIFIER, OMNITRACE_DEBUG_THREAD_IDENTIFIER, \ + ROCPROFSYS_DEBUG_PROCESS_IDENTIFIER, ROCPROFSYS_DEBUG_THREAD_IDENTIFIER, \ ::omnitrace::debug::is_bracket(__VA_ARGS__) ? "" : " "); \ fprintf(::omnitrace::debug::get_file(), __VA_ARGS__); \ ::omnitrace::debug::flush(); \ @@ -439,13 +439,13 @@ as_hex(void*, size_t); METHOD; \ } -#define OMNITRACE_CONDITIONAL_BASIC_FAILURE(COND, METHOD, ...) \ - if(OMNITRACE_UNLIKELY((COND))) \ +#define ROCPROFSYS_CONDITIONAL_BASIC_FAILURE(COND, METHOD, ...) \ + if(ROCPROFSYS_UNLIKELY((COND))) \ { \ ::omnitrace::debug::flush(); \ - OMNITRACE_FPRINTF_STDERR_COLOR(fatal); \ + ROCPROFSYS_FPRINTF_STDERR_COLOR(fatal); \ fprintf(::omnitrace::debug::get_file(), "[rocprof-sys][%i]%s", \ - OMNITRACE_DEBUG_PROCESS_IDENTIFIER, \ + ROCPROFSYS_DEBUG_PROCESS_IDENTIFIER, \ ::omnitrace::debug::is_bracket(__VA_ARGS__) ? "" : " "); \ fprintf(::omnitrace::debug::get_file(), __VA_ARGS__); \ ::omnitrace::debug::flush(); \ @@ -454,14 +454,14 @@ as_hex(void*, size_t); METHOD; \ } -#define OMNITRACE_CONDITIONAL_FAILURE_F(COND, METHOD, ...) \ - if(OMNITRACE_UNLIKELY((COND))) \ +#define ROCPROFSYS_CONDITIONAL_FAILURE_F(COND, METHOD, ...) \ + if(ROCPROFSYS_UNLIKELY((COND))) \ { \ ::omnitrace::debug::flush(); \ - OMNITRACE_FPRINTF_STDERR_COLOR(fatal); \ + ROCPROFSYS_FPRINTF_STDERR_COLOR(fatal); \ fprintf(::omnitrace::debug::get_file(), "[rocprof-sys][%i][%li][%s]%s", \ - OMNITRACE_DEBUG_PROCESS_IDENTIFIER, OMNITRACE_DEBUG_THREAD_IDENTIFIER, \ - OMNITRACE_FUNCTION, \ + ROCPROFSYS_DEBUG_PROCESS_IDENTIFIER, ROCPROFSYS_DEBUG_THREAD_IDENTIFIER, \ + ROCPROFSYS_FUNCTION, \ ::omnitrace::debug::is_bracket(__VA_ARGS__) ? "" : " "); \ fprintf(::omnitrace::debug::get_file(), __VA_ARGS__); \ ::omnitrace::debug::flush(); \ @@ -470,13 +470,13 @@ as_hex(void*, size_t); METHOD; \ } -#define OMNITRACE_CONDITIONAL_BASIC_FAILURE_F(COND, METHOD, ...) \ - if(OMNITRACE_UNLIKELY((COND))) \ +#define ROCPROFSYS_CONDITIONAL_BASIC_FAILURE_F(COND, METHOD, ...) \ + if(ROCPROFSYS_UNLIKELY((COND))) \ { \ ::omnitrace::debug::flush(); \ - OMNITRACE_FPRINTF_STDERR_COLOR(fatal); \ + ROCPROFSYS_FPRINTF_STDERR_COLOR(fatal); \ fprintf(::omnitrace::debug::get_file(), "[rocprof-sys][%i][%s]%s", \ - OMNITRACE_DEBUG_PROCESS_IDENTIFIER, OMNITRACE_FUNCTION, \ + ROCPROFSYS_DEBUG_PROCESS_IDENTIFIER, ROCPROFSYS_FUNCTION, \ ::omnitrace::debug::is_bracket(__VA_ARGS__) ? "" : " "); \ fprintf(::omnitrace::debug::get_file(), __VA_ARGS__); \ ::omnitrace::debug::flush(); \ @@ -485,59 +485,59 @@ as_hex(void*, size_t); METHOD; \ } -#define OMNITRACE_CI_FAILURE(COND, METHOD, ...) \ - OMNITRACE_CONDITIONAL_FAILURE( \ +#define ROCPROFSYS_CI_FAILURE(COND, METHOD, ...) \ + ROCPROFSYS_CONDITIONAL_FAILURE( \ ::omnitrace::get_is_continuous_integration() && (COND), METHOD, __VA_ARGS__) -#define OMNITRACE_CI_BASIC_FAILURE(COND, METHOD, ...) \ - OMNITRACE_CONDITIONAL_BASIC_FAILURE( \ +#define ROCPROFSYS_CI_BASIC_FAILURE(COND, METHOD, ...) \ + ROCPROFSYS_CONDITIONAL_BASIC_FAILURE( \ ::omnitrace::get_is_continuous_integration() && (COND), METHOD, __VA_ARGS__) //--------------------------------------------------------------------------------------// -#define OMNITRACE_CONDITIONAL_FAIL(COND, ...) \ - OMNITRACE_CONDITIONAL_FAILURE(COND, OMNITRACE_ESC(::std::exit(EXIT_FAILURE)), \ +#define ROCPROFSYS_CONDITIONAL_FAIL(COND, ...) \ + ROCPROFSYS_CONDITIONAL_FAILURE(COND, ROCPROFSYS_ESC(::std::exit(EXIT_FAILURE)), \ __VA_ARGS__) -#define OMNITRACE_CONDITIONAL_BASIC_FAIL(COND, ...) \ - OMNITRACE_CONDITIONAL_BASIC_FAILURE(COND, OMNITRACE_ESC(::std::exit(EXIT_FAILURE)), \ +#define ROCPROFSYS_CONDITIONAL_BASIC_FAIL(COND, ...) \ + ROCPROFSYS_CONDITIONAL_BASIC_FAILURE(COND, ROCPROFSYS_ESC(::std::exit(EXIT_FAILURE)), \ __VA_ARGS__) -#define OMNITRACE_CONDITIONAL_FAIL_F(COND, ...) \ - OMNITRACE_CONDITIONAL_FAILURE_F(COND, OMNITRACE_ESC(::std::exit(EXIT_FAILURE)), \ +#define ROCPROFSYS_CONDITIONAL_FAIL_F(COND, ...) \ + ROCPROFSYS_CONDITIONAL_FAILURE_F(COND, ROCPROFSYS_ESC(::std::exit(EXIT_FAILURE)), \ __VA_ARGS__) -#define OMNITRACE_CONDITIONAL_BASIC_FAIL_F(COND, ...) \ - OMNITRACE_CONDITIONAL_BASIC_FAILURE_F( \ - COND, OMNITRACE_ESC(::std::exit(EXIT_FAILURE)), __VA_ARGS__) +#define ROCPROFSYS_CONDITIONAL_BASIC_FAIL_F(COND, ...) \ + ROCPROFSYS_CONDITIONAL_BASIC_FAILURE_F( \ + COND, ROCPROFSYS_ESC(::std::exit(EXIT_FAILURE)), __VA_ARGS__) -#define OMNITRACE_CI_FAIL(COND, ...) \ - OMNITRACE_CI_FAILURE(COND, OMNITRACE_ESC(::std::exit(EXIT_FAILURE)), __VA_ARGS__) +#define ROCPROFSYS_CI_FAIL(COND, ...) \ + ROCPROFSYS_CI_FAILURE(COND, ROCPROFSYS_ESC(::std::exit(EXIT_FAILURE)), __VA_ARGS__) -#define OMNITRACE_CI_BASIC_FAIL(COND, ...) \ - OMNITRACE_CI_BASIC_FAILURE(COND, OMNITRACE_ESC(::std::exit(EXIT_FAILURE)), \ +#define ROCPROFSYS_CI_BASIC_FAIL(COND, ...) \ + ROCPROFSYS_CI_BASIC_FAILURE(COND, ROCPROFSYS_ESC(::std::exit(EXIT_FAILURE)), \ __VA_ARGS__) //--------------------------------------------------------------------------------------// -#define OMNITRACE_CONDITIONAL_ABORT(COND, ...) \ - OMNITRACE_CONDITIONAL_FAILURE(COND, OMNITRACE_ESC(::std::abort()), __VA_ARGS__) +#define ROCPROFSYS_CONDITIONAL_ABORT(COND, ...) \ + ROCPROFSYS_CONDITIONAL_FAILURE(COND, ROCPROFSYS_ESC(::std::abort()), __VA_ARGS__) -#define OMNITRACE_CONDITIONAL_BASIC_ABORT(COND, ...) \ - OMNITRACE_CONDITIONAL_BASIC_FAILURE(COND, OMNITRACE_ESC(::std::abort()), __VA_ARGS__) +#define ROCPROFSYS_CONDITIONAL_BASIC_ABORT(COND, ...) \ + ROCPROFSYS_CONDITIONAL_BASIC_FAILURE(COND, ROCPROFSYS_ESC(::std::abort()), __VA_ARGS__) -#define OMNITRACE_CONDITIONAL_ABORT_F(COND, ...) \ - OMNITRACE_CONDITIONAL_FAILURE_F(COND, OMNITRACE_ESC(::std::abort()), __VA_ARGS__) +#define ROCPROFSYS_CONDITIONAL_ABORT_F(COND, ...) \ + ROCPROFSYS_CONDITIONAL_FAILURE_F(COND, ROCPROFSYS_ESC(::std::abort()), __VA_ARGS__) -#define OMNITRACE_CONDITIONAL_BASIC_ABORT_F(COND, ...) \ - OMNITRACE_CONDITIONAL_BASIC_FAILURE_F(COND, OMNITRACE_ESC(::std::abort()), \ +#define ROCPROFSYS_CONDITIONAL_BASIC_ABORT_F(COND, ...) \ + ROCPROFSYS_CONDITIONAL_BASIC_FAILURE_F(COND, ROCPROFSYS_ESC(::std::abort()), \ __VA_ARGS__) -#define OMNITRACE_CI_ABORT(COND, ...) \ - OMNITRACE_CI_FAILURE(COND, OMNITRACE_ESC(::std::abort()), __VA_ARGS__) +#define ROCPROFSYS_CI_ABORT(COND, ...) \ + ROCPROFSYS_CI_FAILURE(COND, ROCPROFSYS_ESC(::std::abort()), __VA_ARGS__) -#define OMNITRACE_CI_BASIC_ABORT(COND, ...) \ - OMNITRACE_CI_BASIC_FAILURE(COND, OMNITRACE_ESC(::std::abort()), __VA_ARGS__) +#define ROCPROFSYS_CI_BASIC_ABORT(COND, ...) \ + ROCPROFSYS_CI_BASIC_FAILURE(COND, ROCPROFSYS_ESC(::std::abort()), __VA_ARGS__) //--------------------------------------------------------------------------------------// // @@ -545,17 +545,17 @@ as_hex(void*, size_t); // //--------------------------------------------------------------------------------------// -#define OMNITRACE_DEBUG(...) \ - OMNITRACE_CONDITIONAL_PRINT(::omnitrace::get_debug(), __VA_ARGS__) +#define ROCPROFSYS_DEBUG(...) \ + ROCPROFSYS_CONDITIONAL_PRINT(::omnitrace::get_debug(), __VA_ARGS__) -#define OMNITRACE_BASIC_DEBUG(...) \ - OMNITRACE_CONDITIONAL_BASIC_PRINT(::omnitrace::get_debug_env(), __VA_ARGS__) +#define ROCPROFSYS_BASIC_DEBUG(...) \ + ROCPROFSYS_CONDITIONAL_BASIC_PRINT(::omnitrace::get_debug_env(), __VA_ARGS__) -#define OMNITRACE_DEBUG_F(...) \ - OMNITRACE_CONDITIONAL_PRINT_F(::omnitrace::get_debug(), __VA_ARGS__) +#define ROCPROFSYS_DEBUG_F(...) \ + ROCPROFSYS_CONDITIONAL_PRINT_F(::omnitrace::get_debug(), __VA_ARGS__) -#define OMNITRACE_BASIC_DEBUG_F(...) \ - OMNITRACE_CONDITIONAL_BASIC_PRINT_F(::omnitrace::get_debug_env(), __VA_ARGS__) +#define ROCPROFSYS_BASIC_DEBUG_F(...) \ + ROCPROFSYS_CONDITIONAL_BASIC_PRINT_F(::omnitrace::get_debug_env(), __VA_ARGS__) //--------------------------------------------------------------------------------------// // @@ -563,21 +563,21 @@ as_hex(void*, size_t); // //--------------------------------------------------------------------------------------// -#define OMNITRACE_VERBOSE(LEVEL, ...) \ - OMNITRACE_CONDITIONAL_PRINT( \ +#define ROCPROFSYS_VERBOSE(LEVEL, ...) \ + ROCPROFSYS_CONDITIONAL_PRINT( \ ::omnitrace::get_debug() || (::omnitrace::get_verbose() >= LEVEL), __VA_ARGS__) -#define OMNITRACE_BASIC_VERBOSE(LEVEL, ...) \ - OMNITRACE_CONDITIONAL_BASIC_PRINT(::omnitrace::get_debug_env() || \ +#define ROCPROFSYS_BASIC_VERBOSE(LEVEL, ...) \ + ROCPROFSYS_CONDITIONAL_BASIC_PRINT(::omnitrace::get_debug_env() || \ (::omnitrace::get_verbose_env() >= LEVEL), \ __VA_ARGS__) -#define OMNITRACE_VERBOSE_F(LEVEL, ...) \ - OMNITRACE_CONDITIONAL_PRINT_F( \ +#define ROCPROFSYS_VERBOSE_F(LEVEL, ...) \ + ROCPROFSYS_CONDITIONAL_PRINT_F( \ ::omnitrace::get_debug() || (::omnitrace::get_verbose() >= LEVEL), __VA_ARGS__) -#define OMNITRACE_BASIC_VERBOSE_F(LEVEL, ...) \ - OMNITRACE_CONDITIONAL_BASIC_PRINT_F(::omnitrace::get_debug_env() || \ +#define ROCPROFSYS_BASIC_VERBOSE_F(LEVEL, ...) \ + ROCPROFSYS_CONDITIONAL_BASIC_PRINT_F(::omnitrace::get_debug_env() || \ (::omnitrace::get_verbose_env() >= LEVEL), \ __VA_ARGS__) @@ -587,46 +587,46 @@ as_hex(void*, size_t); // //--------------------------------------------------------------------------------------// -#define OMNITRACE_WARNING(LEVEL, ...) \ - OMNITRACE_CONDITIONAL_WARN( \ +#define ROCPROFSYS_WARNING(LEVEL, ...) \ + ROCPROFSYS_CONDITIONAL_WARN( \ ::omnitrace::get_debug() || (::omnitrace::get_verbose() >= LEVEL), __VA_ARGS__) -#define OMNITRACE_BASIC_WARNING(LEVEL, ...) \ - OMNITRACE_CONDITIONAL_BASIC_WARN(::omnitrace::get_debug_env() || \ +#define ROCPROFSYS_BASIC_WARNING(LEVEL, ...) \ + ROCPROFSYS_CONDITIONAL_BASIC_WARN(::omnitrace::get_debug_env() || \ (::omnitrace::get_verbose_env() >= LEVEL), \ __VA_ARGS__) -#define OMNITRACE_WARNING_F(LEVEL, ...) \ - OMNITRACE_CONDITIONAL_WARN_F( \ +#define ROCPROFSYS_WARNING_F(LEVEL, ...) \ + ROCPROFSYS_CONDITIONAL_WARN_F( \ ::omnitrace::get_debug() || (::omnitrace::get_verbose() >= LEVEL), __VA_ARGS__) -#define OMNITRACE_BASIC_WARNING_F(LEVEL, ...) \ - OMNITRACE_CONDITIONAL_BASIC_WARN_F(::omnitrace::get_debug_env() || \ +#define ROCPROFSYS_BASIC_WARNING_F(LEVEL, ...) \ + ROCPROFSYS_CONDITIONAL_BASIC_WARN_F(::omnitrace::get_debug_env() || \ (::omnitrace::get_verbose_env() >= LEVEL), \ __VA_ARGS__) -#define OMNITRACE_WARNING_IF(COND, ...) OMNITRACE_CONDITIONAL_WARN((COND), __VA_ARGS__) +#define ROCPROFSYS_WARNING_IF(COND, ...) ROCPROFSYS_CONDITIONAL_WARN((COND), __VA_ARGS__) -#define OMNITRACE_WARNING_IF_F(COND, ...) \ - OMNITRACE_CONDITIONAL_WARN_F((COND), __VA_ARGS__) +#define ROCPROFSYS_WARNING_IF_F(COND, ...) \ + ROCPROFSYS_CONDITIONAL_WARN_F((COND), __VA_ARGS__) -#define OMNITRACE_WARNING_OR_CI_THROW(LEVEL, ...) \ +#define ROCPROFSYS_WARNING_OR_CI_THROW(LEVEL, ...) \ { \ - if(OMNITRACE_UNLIKELY(::omnitrace::get_is_continuous_integration())) \ + if(ROCPROFSYS_UNLIKELY(::omnitrace::get_is_continuous_integration())) \ { \ - OMNITRACE_CI_THROW(true, __VA_ARGS__); \ + ROCPROFSYS_CI_THROW(true, __VA_ARGS__); \ } \ else \ { \ - OMNITRACE_CONDITIONAL_WARN(::omnitrace::get_debug() || \ + ROCPROFSYS_CONDITIONAL_WARN(::omnitrace::get_debug() || \ (::omnitrace::get_verbose() >= LEVEL), \ __VA_ARGS__) \ } \ } -#define OMNITRACE_REQUIRE(...) TIMEMORY_REQUIRE(__VA_ARGS__) -#define OMNITRACE_PREFER(COND) \ - ((OMNITRACE_LIKELY(COND)) \ +#define ROCPROFSYS_REQUIRE(...) TIMEMORY_REQUIRE(__VA_ARGS__) +#define ROCPROFSYS_PREFER(COND) \ + ((ROCPROFSYS_LIKELY(COND)) \ ? ::tim::log::base() \ : ((::omnitrace::get_is_continuous_integration()) ? TIMEMORY_FATAL \ : TIMEMORY_WARNING)) @@ -638,10 +638,10 @@ as_hex(void*, size_t); // //--------------------------------------------------------------------------------------// -#define OMNITRACE_BASIC_PRINT(...) OMNITRACE_CONDITIONAL_BASIC_PRINT(true, __VA_ARGS__) +#define ROCPROFSYS_BASIC_PRINT(...) ROCPROFSYS_CONDITIONAL_BASIC_PRINT(true, __VA_ARGS__) -#define OMNITRACE_BASIC_PRINT_F(...) \ - OMNITRACE_CONDITIONAL_BASIC_PRINT_F(true, __VA_ARGS__) +#define ROCPROFSYS_BASIC_PRINT_F(...) \ + ROCPROFSYS_CONDITIONAL_BASIC_PRINT_F(true, __VA_ARGS__) //--------------------------------------------------------------------------------------// // @@ -649,9 +649,9 @@ as_hex(void*, size_t); // //--------------------------------------------------------------------------------------// -#define OMNITRACE_PRINT(...) OMNITRACE_CONDITIONAL_PRINT(true, __VA_ARGS__) +#define ROCPROFSYS_PRINT(...) ROCPROFSYS_CONDITIONAL_PRINT(true, __VA_ARGS__) -#define OMNITRACE_PRINT_F(...) OMNITRACE_CONDITIONAL_PRINT_F(true, __VA_ARGS__) +#define ROCPROFSYS_PRINT_F(...) ROCPROFSYS_CONDITIONAL_PRINT_F(true, __VA_ARGS__) //--------------------------------------------------------------------------------------// // @@ -659,9 +659,9 @@ as_hex(void*, size_t); // //--------------------------------------------------------------------------------------// -#define OMNITRACE_THROW(...) OMNITRACE_CONDITIONAL_THROW(true, __VA_ARGS__) +#define ROCPROFSYS_THROW(...) ROCPROFSYS_CONDITIONAL_THROW(true, __VA_ARGS__) -#define OMNITRACE_BASIC_THROW(...) OMNITRACE_CONDITIONAL_BASIC_THROW(true, __VA_ARGS__) +#define ROCPROFSYS_BASIC_THROW(...) ROCPROFSYS_CONDITIONAL_BASIC_THROW(true, __VA_ARGS__) //--------------------------------------------------------------------------------------// // @@ -669,13 +669,13 @@ as_hex(void*, size_t); // //--------------------------------------------------------------------------------------// -#define OMNITRACE_FAIL(...) OMNITRACE_CONDITIONAL_FAIL(true, __VA_ARGS__) +#define ROCPROFSYS_FAIL(...) ROCPROFSYS_CONDITIONAL_FAIL(true, __VA_ARGS__) -#define OMNITRACE_FAIL_F(...) OMNITRACE_CONDITIONAL_FAIL_F(true, __VA_ARGS__) +#define ROCPROFSYS_FAIL_F(...) ROCPROFSYS_CONDITIONAL_FAIL_F(true, __VA_ARGS__) -#define OMNITRACE_BASIC_FAIL(...) OMNITRACE_CONDITIONAL_BASIC_FAIL(true, __VA_ARGS__) +#define ROCPROFSYS_BASIC_FAIL(...) ROCPROFSYS_CONDITIONAL_BASIC_FAIL(true, __VA_ARGS__) -#define OMNITRACE_BASIC_FAIL_F(...) OMNITRACE_CONDITIONAL_BASIC_FAIL_F(true, __VA_ARGS__) +#define ROCPROFSYS_BASIC_FAIL_F(...) ROCPROFSYS_CONDITIONAL_BASIC_FAIL_F(true, __VA_ARGS__) //--------------------------------------------------------------------------------------// // @@ -683,14 +683,14 @@ as_hex(void*, size_t); // //--------------------------------------------------------------------------------------// -#define OMNITRACE_ABORT(...) OMNITRACE_CONDITIONAL_ABORT(true, __VA_ARGS__) +#define ROCPROFSYS_ABORT(...) ROCPROFSYS_CONDITIONAL_ABORT(true, __VA_ARGS__) -#define OMNITRACE_ABORT_F(...) OMNITRACE_CONDITIONAL_ABORT_F(true, __VA_ARGS__) +#define ROCPROFSYS_ABORT_F(...) ROCPROFSYS_CONDITIONAL_ABORT_F(true, __VA_ARGS__) -#define OMNITRACE_BASIC_ABORT(...) OMNITRACE_CONDITIONAL_BASIC_ABORT(true, __VA_ARGS__) +#define ROCPROFSYS_BASIC_ABORT(...) ROCPROFSYS_CONDITIONAL_BASIC_ABORT(true, __VA_ARGS__) -#define OMNITRACE_BASIC_ABORT_F(...) \ - OMNITRACE_CONDITIONAL_BASIC_ABORT_F(true, __VA_ARGS__) +#define ROCPROFSYS_BASIC_ABORT_F(...) \ + ROCPROFSYS_CONDITIONAL_BASIC_ABORT_F(true, __VA_ARGS__) #include diff --git a/source/lib/core/defines.hpp.in b/source/lib/core/defines.hpp.in index 1911e3e0..75456987 100644 --- a/source/lib/core/defines.hpp.in +++ b/source/lib/core/defines.hpp.in @@ -24,10 +24,10 @@ #include "common/defines.h" -#define OMNITRACE_METADATA(...) ::tim::manager::add_metadata(__VA_ARGS__) +#define ROCPROFSYS_METADATA(...) ::tim::manager::add_metadata(__VA_ARGS__) -#if !defined(OMNITRACE_DEFAULT_OBJECT) -# define OMNITRACE_DEFAULT_OBJECT(NAME) \ +#if !defined(ROCPROFSYS_DEFAULT_OBJECT) +# define ROCPROFSYS_DEFAULT_OBJECT(NAME) \ NAME() = default; \ NAME(const NAME&) = default; \ NAME(NAME&&) noexcept = default; \ @@ -35,8 +35,8 @@ NAME& operator=(NAME&&) noexcept = default; #endif -#if !defined(OMNITRACE_DEFAULT_COPY_MOVE) -# define OMNITRACE_DEFAULT_COPY_MOVE(NAME) \ +#if !defined(ROCPROFSYS_DEFAULT_COPY_MOVE) +# define ROCPROFSYS_DEFAULT_COPY_MOVE(NAME) \ NAME(const NAME&) = default; \ NAME(NAME&&) noexcept = default; \ NAME& operator=(const NAME&) = default; \ diff --git a/source/lib/core/dynamic_library.cpp b/source/lib/core/dynamic_library.cpp index 9959d0ef..31983738 100644 --- a/source/lib/core/dynamic_library.cpp +++ b/source/lib/core/dynamic_library.cpp @@ -100,14 +100,14 @@ dynamic_library::dynamic_library(std::string _env, std::string _fname, int _flag } else if(_env_val.find('/') == 0) { - OMNITRACE_VERBOSE_F(1, + ROCPROFSYS_VERBOSE_F(1, "Ignoring environment variable %s=\"%s\" because the " "filepath does not exist. Using \"%s\" instead...\n", envname.c_str(), _env_val.c_str(), filename.c_str()) } else if(_env_val.find('/') != 0 && filename.find('/') == 0) { - OMNITRACE_VERBOSE_F( + ROCPROFSYS_VERBOSE_F( 1, "Ignoring environment variable %s=\"%s\" because the " "filepath is relative. Using absolute path \"%s\" instead...\n", @@ -129,7 +129,7 @@ dynamic_library::open() handle = dlopen(filename.c_str(), flags); if(!handle) { - OMNITRACE_VERBOSE(2, "[dynamic_library] Error opening %s=\"%s\" :: %s.\n", + ROCPROFSYS_VERBOSE(2, "[dynamic_library] Error opening %s=\"%s\" :: %s.\n", envname.c_str(), filename.c_str(), dlerror()); } dlerror(); // Clear any existing error diff --git a/source/lib/core/gpu.cpp b/source/lib/core/gpu.cpp index d56dc7bb..9d12e739 100644 --- a/source/lib/core/gpu.cpp +++ b/source/lib/core/gpu.cpp @@ -22,17 +22,17 @@ #include "common/defines.h" -#if !defined(OMNITRACE_USE_ROCM_SMI) -# define OMNITRACE_USE_ROCM_SMI 0 +#if !defined(ROCPROFSYS_USE_ROCM_SMI) +# define ROCPROFSYS_USE_ROCM_SMI 0 #endif -#if !defined(OMNITRACE_USE_HIP) -# define OMNITRACE_USE_HIP 0 +#if !defined(ROCPROFSYS_USE_HIP) +# define ROCPROFSYS_USE_HIP 0 #endif #include "core/hip_runtime.hpp" -#if OMNITRACE_USE_HIP > 0 +#if ROCPROFSYS_USE_HIP > 0 # if !defined(TIMEMORY_USE_HIP) # define TIMEMORY_USE_HIP 1 # endif @@ -44,19 +44,19 @@ #include -#if OMNITRACE_USE_ROCM_SMI > 0 +#if ROCPROFSYS_USE_ROCM_SMI > 0 # include #endif -#if OMNITRACE_USE_HIP > 0 +#if ROCPROFSYS_USE_HIP > 0 # include -# if !defined(OMNITRACE_HIP_RUNTIME_CALL) -# define OMNITRACE_HIP_RUNTIME_CALL(err) \ +# if !defined(ROCPROFSYS_HIP_RUNTIME_CALL) +# define ROCPROFSYS_HIP_RUNTIME_CALL(err) \ { \ if(err != ::tim::hip::success_v && (int) err != 0) \ { \ - OMNITRACE_THROW( \ + ROCPROFSYS_THROW( \ "[%s:%d] Warning! HIP API call failed with code %i :: %s\n", \ __FILE__, __LINE__, (int) err, hipGetErrorString(err)); \ } \ @@ -72,8 +72,8 @@ namespace { namespace scope = ::tim::scope; -#if OMNITRACE_USE_ROCM_SMI > 0 -# define OMNITRACE_ROCM_SMI_CALL(ERROR_CODE) \ +#if ROCPROFSYS_USE_ROCM_SMI > 0 +# define ROCPROFSYS_ROCM_SMI_CALL(ERROR_CODE) \ ::omnitrace::gpu::check_rsmi_error(ERROR_CODE, __FILE__, __LINE__) void @@ -83,10 +83,10 @@ check_rsmi_error(rsmi_status_t _code, const char* _file, int _line) const char* _msg = nullptr; auto _err = rsmi_status_string(_code, &_msg); if(_err != RSMI_STATUS_SUCCESS) - OMNITRACE_THROW("rsmi_status_string failed. No error message available. " + ROCPROFSYS_THROW("rsmi_status_string failed. No error message available. " "Error code %i originated at %s:%i\n", static_cast(_code), _file, _line); - OMNITRACE_THROW("[%s:%i] Error code %i :: %s", _file, _line, static_cast(_code), + ROCPROFSYS_THROW("[%s:%i] Error code %i :: %s", _file, _line, static_cast(_code), _msg); } @@ -96,10 +96,10 @@ rsmi_init() auto _rsmi_init = []() { try { - OMNITRACE_ROCM_SMI_CALL(::rsmi_init(0)); + ROCPROFSYS_ROCM_SMI_CALL(::rsmi_init(0)); } catch(std::exception& _e) { - OMNITRACE_BASIC_VERBOSE(1, "Exception thrown initializing rocm-smi: %s\n", + ROCPROFSYS_BASIC_VERBOSE(1, "Exception thrown initializing rocm-smi: %s\n", _e.what()); return false; } @@ -110,7 +110,7 @@ rsmi_init() } #endif -#if OMNITRACE_HIP_VERSION >= 60000 +#if ROCPROFSYS_HIP_VERSION >= 60000 template ::value, int> = 0> void @@ -164,7 +164,7 @@ device_prop_serialize(ArchiveT& archive, const char* name, hipDeviceArch_t arg) namespace cereal = tim::cereal; using cereal::make_nvp; -# define OMNITRACE_SERIALIZE_HIP_DEVICE_ARCH(NAME) \ +# define ROCPROFSYS_SERIALIZE_HIP_DEVICE_ARCH(NAME) \ { \ auto val = arg.NAME; \ archive(make_nvp(#NAME, val)); \ @@ -172,26 +172,26 @@ device_prop_serialize(ArchiveT& archive, const char* name, hipDeviceArch_t arg) archive.setNextName(name); archive.startNode(); - OMNITRACE_SERIALIZE_HIP_DEVICE_ARCH(hasGlobalInt32Atomics) - OMNITRACE_SERIALIZE_HIP_DEVICE_ARCH(hasGlobalFloatAtomicExch) - OMNITRACE_SERIALIZE_HIP_DEVICE_ARCH(hasSharedInt32Atomics) - OMNITRACE_SERIALIZE_HIP_DEVICE_ARCH(hasSharedFloatAtomicExch) - OMNITRACE_SERIALIZE_HIP_DEVICE_ARCH(hasFloatAtomicAdd) - OMNITRACE_SERIALIZE_HIP_DEVICE_ARCH(hasGlobalInt64Atomics) - OMNITRACE_SERIALIZE_HIP_DEVICE_ARCH(hasSharedInt64Atomics) - OMNITRACE_SERIALIZE_HIP_DEVICE_ARCH(hasDoubles) - OMNITRACE_SERIALIZE_HIP_DEVICE_ARCH(hasWarpVote) - OMNITRACE_SERIALIZE_HIP_DEVICE_ARCH(hasWarpBallot) - OMNITRACE_SERIALIZE_HIP_DEVICE_ARCH(hasWarpShuffle) - OMNITRACE_SERIALIZE_HIP_DEVICE_ARCH(hasFunnelShift) - OMNITRACE_SERIALIZE_HIP_DEVICE_ARCH(hasThreadFenceSystem) - OMNITRACE_SERIALIZE_HIP_DEVICE_ARCH(hasSyncThreadsExt) - OMNITRACE_SERIALIZE_HIP_DEVICE_ARCH(hasSurfaceFuncs) - OMNITRACE_SERIALIZE_HIP_DEVICE_ARCH(has3dGrid) - OMNITRACE_SERIALIZE_HIP_DEVICE_ARCH(hasDynamicParallelism) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_ARCH(hasGlobalInt32Atomics) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_ARCH(hasGlobalFloatAtomicExch) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_ARCH(hasSharedInt32Atomics) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_ARCH(hasSharedFloatAtomicExch) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_ARCH(hasFloatAtomicAdd) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_ARCH(hasGlobalInt64Atomics) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_ARCH(hasSharedInt64Atomics) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_ARCH(hasDoubles) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_ARCH(hasWarpVote) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_ARCH(hasWarpBallot) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_ARCH(hasWarpShuffle) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_ARCH(hasFunnelShift) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_ARCH(hasThreadFenceSystem) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_ARCH(hasSyncThreadsExt) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_ARCH(hasSurfaceFuncs) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_ARCH(has3dGrid) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_ARCH(hasDynamicParallelism) archive.finishNode(); -# undef OMNITRACE_SERIALIZE_HIP_DEVICE_ARCH +# undef ROCPROFSYS_SERIALIZE_HIP_DEVICE_ARCH } #endif } // namespace @@ -199,7 +199,7 @@ device_prop_serialize(ArchiveT& archive, const char* name, hipDeviceArch_t arg) int hip_device_count() { -#if OMNITRACE_USE_HIP > 0 +#if ROCPROFSYS_USE_HIP > 0 return ::tim::hip::device_count(); #else return 0; @@ -209,17 +209,17 @@ hip_device_count() int rsmi_device_count() { -#if OMNITRACE_USE_ROCM_SMI > 0 +#if ROCPROFSYS_USE_ROCM_SMI > 0 if(!rsmi_init()) return 0; static auto _num_devices = []() { uint32_t _v = 0; try { - OMNITRACE_ROCM_SMI_CALL(rsmi_num_monitor_devices(&_v)); + ROCPROFSYS_ROCM_SMI_CALL(rsmi_num_monitor_devices(&_v)); } catch(std::exception& _e) { - OMNITRACE_BASIC_VERBOSE( + ROCPROFSYS_BASIC_VERBOSE( 1, "Exception thrown getting the rocm-smi devices: %s\n", _e.what()); } return _v; @@ -234,10 +234,10 @@ rsmi_device_count() int device_count() { -#if OMNITRACE_USE_ROCM_SMI > 0 +#if ROCPROFSYS_USE_ROCM_SMI > 0 // store as static since calls after rsmi_shutdown will return zero return rsmi_device_count(); -#elif OMNITRACE_USE_HIP > 0 +#elif ROCPROFSYS_USE_HIP > 0 return ::tim::hip::device_count(); #else return 0; @@ -251,7 +251,7 @@ add_hip_device_metadata(ArchiveT& ar) namespace cereal = tim::cereal; using cereal::make_nvp; -#if OMNITRACE_USE_HIP > 0 +#if ROCPROFSYS_USE_HIP > 0 int _device_count = 0; int _current_device = 0; hipError_t _device_count_err = hipGetDeviceCount(&_device_count); @@ -263,7 +263,7 @@ add_hip_device_metadata(ArchiveT& ar) scope::destructor _dtor{ [_current_device, _current_device_err]() { if(_current_device_err == hipSuccess) { - OMNITRACE_HIP_RUNTIME_CALL(hipSetDevice(_current_device)); + ROCPROFSYS_HIP_RUNTIME_CALL(hipSetDevice(_current_device)); } } }; @@ -279,20 +279,20 @@ add_hip_device_metadata(ArchiveT& ar) auto _device_prop = hipDeviceProp_t{}; int _driver_version = 0; int _runtime_version = 0; - OMNITRACE_HIP_RUNTIME_CALL(hipSetDevice(dev)); - OMNITRACE_HIP_RUNTIME_CALL(hipGetDeviceProperties(&_device_prop, dev)); - OMNITRACE_HIP_RUNTIME_CALL(hipDriverGetVersion(&_driver_version)); - OMNITRACE_HIP_RUNTIME_CALL(hipRuntimeGetVersion(&_runtime_version)); + ROCPROFSYS_HIP_RUNTIME_CALL(hipSetDevice(dev)); + ROCPROFSYS_HIP_RUNTIME_CALL(hipGetDeviceProperties(&_device_prop, dev)); + ROCPROFSYS_HIP_RUNTIME_CALL(hipDriverGetVersion(&_driver_version)); + ROCPROFSYS_HIP_RUNTIME_CALL(hipRuntimeGetVersion(&_runtime_version)); ar.startNode(); -# if OMNITRACE_HIP_VERSION < 60000 +# if ROCPROFSYS_HIP_VERSION < 60000 using intvec_t = std::vector; -# define OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(NAME) \ +# define ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(NAME) \ ar(make_nvp(#NAME, _device_prop.NAME)); -# define OMNITRACE_SERIALIZE_HIP_DEVICE_PROP_ARRAY(NAME, ...) \ +# define ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP_ARRAY(NAME, ...) \ ar(make_nvp(NAME, __VA_ARGS__)); ar(make_nvp("name", std::string{ _device_prop.name })); @@ -301,162 +301,162 @@ add_hip_device_metadata(ArchiveT& ar) ar(make_nvp("capability.major_version", _device_prop.major)); ar(make_nvp("capability.minor_version", _device_prop.minor)); - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(totalGlobalMem) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(totalConstMem) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(clockRate) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(totalGlobalMem) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(totalConstMem) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(clockRate) -# if OMNITRACE_HIP_VERSION >= 50000 - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(memoryClockRate) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(memoryBusWidth) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(l2CacheSize) +# if ROCPROFSYS_HIP_VERSION >= 50000 + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(memoryClockRate) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(memoryBusWidth) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(l2CacheSize) # endif - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(sharedMemPerBlock) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(regsPerBlock) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(warpSize) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(multiProcessorCount) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxThreadsPerMultiProcessor) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxThreadsPerBlock) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP_ARRAY( + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(sharedMemPerBlock) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(regsPerBlock) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(warpSize) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(multiProcessorCount) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxThreadsPerMultiProcessor) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxThreadsPerBlock) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP_ARRAY( "maxThreadsDim", intvec_t{ _device_prop.maxThreadsDim[0], _device_prop.maxThreadsDim[1], _device_prop.maxThreadsDim[2] }) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP_ARRAY("maxGridSize", + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP_ARRAY("maxGridSize", intvec_t{ _device_prop.maxGridSize[0], _device_prop.maxGridSize[1], _device_prop.maxGridSize[2] }) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(memPitch) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(textureAlignment) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(kernelExecTimeoutEnabled) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(integrated) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(canMapHostMemory) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(ECCEnabled) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(cooperativeLaunch) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(cooperativeMultiDeviceLaunch) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(pciDomainID) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(pciBusID) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(pciDeviceID) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(computeMode) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(gcnArch) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(gcnArchName) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(isMultiGpuBoard) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(clockInstructionRate) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(pageableMemoryAccess) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(pageableMemoryAccessUsesHostPageTables) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(directManagedMemAccessFromHost) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(concurrentManagedAccess) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(concurrentKernels) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxSharedMemoryPerMultiProcessor) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(asicRevision) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(memPitch) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(textureAlignment) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(kernelExecTimeoutEnabled) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(integrated) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(canMapHostMemory) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(ECCEnabled) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(cooperativeLaunch) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(cooperativeMultiDeviceLaunch) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(pciDomainID) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(pciBusID) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(pciDeviceID) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(computeMode) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(gcnArch) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(gcnArchName) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(isMultiGpuBoard) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(clockInstructionRate) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(pageableMemoryAccess) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(pageableMemoryAccessUsesHostPageTables) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(directManagedMemAccessFromHost) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(concurrentManagedAccess) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(concurrentKernels) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxSharedMemoryPerMultiProcessor) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(asicRevision) # else -# define OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(NAME) \ +# define ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(NAME) \ device_prop_serialize(ar, #NAME, _device_prop.NAME); - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(name) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(uuid) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(luid) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(luidDeviceNodeMask) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(totalGlobalMem) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(sharedMemPerBlock) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(regsPerBlock) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(warpSize) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(memPitch) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxThreadsPerBlock) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxThreadsDim) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxGridSize) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(clockRate) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(totalConstMem) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(major) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(minor) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(textureAlignment) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(texturePitchAlignment) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(deviceOverlap) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(multiProcessorCount) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(kernelExecTimeoutEnabled) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(integrated) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(canMapHostMemory) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(computeMode) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxTexture1D) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxTexture1DMipmap) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxTexture1DLinear) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxTexture2D) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxTexture2DMipmap) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxTexture2DLinear) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxTexture2DGather) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxTexture3D) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxTexture3DAlt) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxTextureCubemap) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxTexture1DLayered) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxTexture2DLayered) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxTextureCubemapLayered) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxSurface1D) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxSurface2D) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxSurface3D) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxSurface1DLayered) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxSurface2DLayered) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxSurfaceCubemap) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxSurfaceCubemapLayered) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(surfaceAlignment) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(concurrentKernels) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(ECCEnabled) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(pciBusID) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(pciDeviceID) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(pciDomainID) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(tccDriver) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(asyncEngineCount) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(unifiedAddressing) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(memoryClockRate) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(memoryBusWidth) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(l2CacheSize) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(persistingL2CacheMaxSize) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxThreadsPerMultiProcessor) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(streamPrioritiesSupported) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(globalL1CacheSupported) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(localL1CacheSupported) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(sharedMemPerMultiprocessor) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(regsPerMultiprocessor) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(managedMemory) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(isMultiGpuBoard) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(multiGpuBoardGroupID) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(hostNativeAtomicSupported) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(singleToDoublePrecisionPerfRatio) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(pageableMemoryAccess) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(concurrentManagedAccess) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(computePreemptionSupported) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(canUseHostPointerForRegisteredMem) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(cooperativeLaunch) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(cooperativeMultiDeviceLaunch) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(sharedMemPerBlockOptin) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(pageableMemoryAccessUsesHostPageTables) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(directManagedMemAccessFromHost) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxBlocksPerMultiProcessor) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(accessPolicyMaxWindowSize) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(reservedSharedMemPerBlock) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(hostRegisterSupported) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(sparseHipArraySupported) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(hostRegisterReadOnlySupported) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(timelineSemaphoreInteropSupported) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(memoryPoolsSupported) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(gpuDirectRDMASupported) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(gpuDirectRDMAFlushWritesOptions) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(gpuDirectRDMAWritesOrdering) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(memoryPoolSupportedHandleTypes) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(deferredMappingHipArraySupported) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(ipcEventSupported) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(clusterLaunch) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(unifiedFunctionPointers) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(gcnArchName) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxSharedMemoryPerMultiProcessor) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(clockInstructionRate) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(arch) - // OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(hdpMemFlushCntl) - // OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(hdpRegFlushCntl) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(cooperativeMultiDeviceUnmatchedFunc) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(cooperativeMultiDeviceUnmatchedGridDim) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(cooperativeMultiDeviceUnmatchedBlockDim) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(cooperativeMultiDeviceUnmatchedSharedMem) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(isLargeBar) - OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(asicRevision) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(name) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(uuid) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(luid) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(luidDeviceNodeMask) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(totalGlobalMem) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(sharedMemPerBlock) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(regsPerBlock) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(warpSize) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(memPitch) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxThreadsPerBlock) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxThreadsDim) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxGridSize) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(clockRate) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(totalConstMem) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(major) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(minor) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(textureAlignment) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(texturePitchAlignment) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(deviceOverlap) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(multiProcessorCount) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(kernelExecTimeoutEnabled) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(integrated) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(canMapHostMemory) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(computeMode) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxTexture1D) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxTexture1DMipmap) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxTexture1DLinear) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxTexture2D) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxTexture2DMipmap) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxTexture2DLinear) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxTexture2DGather) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxTexture3D) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxTexture3DAlt) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxTextureCubemap) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxTexture1DLayered) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxTexture2DLayered) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxTextureCubemapLayered) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxSurface1D) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxSurface2D) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxSurface3D) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxSurface1DLayered) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxSurface2DLayered) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxSurfaceCubemap) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxSurfaceCubemapLayered) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(surfaceAlignment) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(concurrentKernels) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(ECCEnabled) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(pciBusID) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(pciDeviceID) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(pciDomainID) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(tccDriver) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(asyncEngineCount) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(unifiedAddressing) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(memoryClockRate) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(memoryBusWidth) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(l2CacheSize) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(persistingL2CacheMaxSize) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxThreadsPerMultiProcessor) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(streamPrioritiesSupported) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(globalL1CacheSupported) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(localL1CacheSupported) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(sharedMemPerMultiprocessor) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(regsPerMultiprocessor) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(managedMemory) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(isMultiGpuBoard) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(multiGpuBoardGroupID) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(hostNativeAtomicSupported) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(singleToDoublePrecisionPerfRatio) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(pageableMemoryAccess) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(concurrentManagedAccess) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(computePreemptionSupported) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(canUseHostPointerForRegisteredMem) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(cooperativeLaunch) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(cooperativeMultiDeviceLaunch) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(sharedMemPerBlockOptin) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(pageableMemoryAccessUsesHostPageTables) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(directManagedMemAccessFromHost) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxBlocksPerMultiProcessor) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(accessPolicyMaxWindowSize) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(reservedSharedMemPerBlock) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(hostRegisterSupported) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(sparseHipArraySupported) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(hostRegisterReadOnlySupported) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(timelineSemaphoreInteropSupported) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(memoryPoolsSupported) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(gpuDirectRDMASupported) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(gpuDirectRDMAFlushWritesOptions) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(gpuDirectRDMAWritesOrdering) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(memoryPoolSupportedHandleTypes) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(deferredMappingHipArraySupported) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(ipcEventSupported) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(clusterLaunch) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(unifiedFunctionPointers) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(gcnArchName) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxSharedMemoryPerMultiProcessor) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(clockInstructionRate) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(arch) + // ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(hdpMemFlushCntl) + // ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(hdpRegFlushCntl) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(cooperativeMultiDeviceUnmatchedFunc) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(cooperativeMultiDeviceUnmatchedGridDim) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(cooperativeMultiDeviceUnmatchedBlockDim) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(cooperativeMultiDeviceUnmatchedSharedMem) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(isLargeBar) + ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(asicRevision) # endif const auto _compute_mode_descr = std::array{ @@ -487,13 +487,13 @@ add_hip_device_metadata() { if(device_count() == 0) return; - OMNITRACE_METADATA([](auto& ar) { + ROCPROFSYS_METADATA([](auto& ar) { try { add_hip_device_metadata(ar); } catch(std::runtime_error& _e) { - OMNITRACE_VERBOSE(2, "%s\n", _e.what()); + ROCPROFSYS_VERBOSE(2, "%s\n", _e.what()); } }); } diff --git a/source/lib/core/hip_runtime.hpp b/source/lib/core/hip_runtime.hpp index 492af153..e90aeff0 100644 --- a/source/lib/core/hip_runtime.hpp +++ b/source/lib/core/hip_runtime.hpp @@ -24,7 +24,7 @@ #include "core/defines.hpp" -#if defined(OMNITRACE_USE_HIP) && OMNITRACE_USE_HIP > 0 +#if defined(ROCPROFSYS_USE_HIP) && ROCPROFSYS_USE_HIP > 0 # if defined(HIP_INCLUDE_HIP_HIP_RUNTIME_H) || \ defined(HIP_INCLUDE_HIP_HIP_RUNTIME_API_H) @@ -35,7 +35,7 @@ # define HIP_PROF_HIP_API_STRING 1 // following must be included before for ROCm 6.0+ -# if OMNITRACE_HIP_VERSION >= 60000 +# if ROCPROFSYS_HIP_VERSION >= 60000 # if defined(USE_PROF_API) # undef USE_PROF_API # endif diff --git a/source/lib/core/mproc.cpp b/source/lib/core/mproc.cpp index 4fba4c0b..57cf0160 100644 --- a/source/lib/core/mproc.cpp +++ b/source/lib/core/mproc.cpp @@ -46,7 +46,7 @@ get_concurrent_processes(int _ppid) std::ifstream _ifs{ _inp }; if(!_ifs) { - OMNITRACE_VERBOSE_F(2, "Warning! File '%s' cannot be read\n", _inp.c_str()); + ROCPROFSYS_VERBOSE_F(2, "Warning! File '%s' cannot be read\n", _inp.c_str()); return _children; } diff --git a/source/lib/core/perf.cpp b/source/lib/core/perf.cpp index e4579537..b6f1cf3e 100644 --- a/source/lib/core/perf.cpp +++ b/source/lib/core/perf.cpp @@ -101,7 +101,7 @@ get_hw_config(std::string_view _v) return hw_config::reference_cpu_cycles; else { - OMNITRACE_THROW("Unknown perf hardware config: %s", _v.data()); + ROCPROFSYS_THROW("Unknown perf hardware config: %s", _v.data()); } #undef HW_CONFIG_REGEX @@ -134,7 +134,7 @@ get_sw_config(std::string_view _v) return sw_config::emulation_faults; else { - OMNITRACE_THROW("Unknown perf hw cache config: %s", _v.data()); + ROCPROFSYS_THROW("Unknown perf hw cache config: %s", _v.data()); } #undef SW_CONFIG_REGEX @@ -165,7 +165,7 @@ get_hw_cache_config(std::string_view _v) else if(HW_CACHE_CONFIG_REGEX("NODE")) _value |= static_cast(hw_cache_config::node); else - OMNITRACE_THROW("Unknown perf software config: %s", _v.data()); + ROCPROFSYS_THROW("Unknown perf software config: %s", _v.data()); #undef HW_CACHE_CONFIG_REGEX #define HW_CACHE_OP_REGEX(KEY) \ @@ -226,7 +226,7 @@ config_overflow_sampling(struct perf_event_attr& _pe, std::string_view _event, case PERF_TYPE_MAX: default: { - OMNITRACE_THROW("unsupported perf type"); + ROCPROFSYS_THROW("unsupported perf type"); } }; diff --git a/source/lib/core/perfetto.cpp b/source/lib/core/perfetto.cpp index a4725aea..f5a5b78b 100644 --- a/source/lib/core/perfetto.cpp +++ b/source/lib/core/perfetto.cpp @@ -86,7 +86,7 @@ setup() for(const auto& itr : config::get_disabled_categories()) { - OMNITRACE_VERBOSE_F(1, "Disabling perfetto track event category: %s\n", + ROCPROFSYS_VERBOSE_F(1, "Disabling perfetto track event category: %s\n", itr.c_str()); track_event_cfg.add_disabled_categories(itr); } @@ -124,12 +124,12 @@ start() } else { - OMNITRACE_VERBOSE(2, "Resuming perfetto...\n"); + ROCPROFSYS_VERBOSE(2, "Resuming perfetto...\n"); _tmp_file->fopen("a+"); } } - OMNITRACE_VERBOSE(2, "Setup perfetto...\n"); + ROCPROFSYS_VERBOSE(2, "Setup perfetto...\n"); int _fd = (_tmp_file) ? _tmp_file->fd : -1; auto& cfg = get_config(); tracing_session->Setup(cfg, _fd); @@ -143,16 +143,16 @@ stop() auto& tracing_session = get_perfetto_session(); - OMNITRACE_CI_THROW(tracing_session == nullptr, "Null pointer to the tracing session"); + ROCPROFSYS_CI_THROW(tracing_session == nullptr, "Null pointer to the tracing session"); if(tracing_session) { // Make sure the last event is closed - OMNITRACE_VERBOSE(2, "Flushing the perfetto trace data...\n"); + ROCPROFSYS_VERBOSE(2, "Flushing the perfetto trace data...\n"); ::perfetto::TrackEvent::Flush(); tracing_session->FlushBlocking(); - OMNITRACE_VERBOSE(2, "Stopping the perfetto trace session (blocking)...\n"); + ROCPROFSYS_VERBOSE(2, "Stopping the perfetto trace session (blocking)...\n"); tracing_session->StopBlocking(); } } @@ -177,7 +177,7 @@ post_process(tim::manager* _timemory_manager, bool& _perfetto_output_error) if(!_fdata) { - OMNITRACE_VERBOSE( + ROCPROFSYS_VERBOSE( -1, "Error! perfetto temp trace file '%s' could not be read", _tmp_file->filename.c_str()); return char_vec_t{ tracing_session->ReadTraceBlocking() }; @@ -191,7 +191,7 @@ post_process(tim::manager* _timemory_manager, bool& _perfetto_output_error) auto _fnum_read = fread(_data.data(), sizeof(char), _fnum_elem, _fdata); fclose(_fdata); - OMNITRACE_CI_THROW( + ROCPROFSYS_CI_THROW( _fnum_read != _fnum_elem, "Error! read %zu elements from perfetto trace file '%s'. Expected %zu\n", _fnum_read, _tmp_file->filename.c_str(), _fnum_elem); @@ -259,7 +259,7 @@ post_process(tim::manager* _timemory_manager, bool& _perfetto_output_error) } else if(dmp::rank() == 0) { - OMNITRACE_VERBOSE( + ROCPROFSYS_VERBOSE( 0, "perfetto trace data is empty. File '%s' will not be written...\n", _filename.c_str()); } diff --git a/source/lib/core/perfetto.hpp b/source/lib/core/perfetto.hpp index ac67b3e4..f63a1e90 100644 --- a/source/lib/core/perfetto.hpp +++ b/source/lib/core/perfetto.hpp @@ -29,7 +29,7 @@ # include #else # include -PERFETTO_DEFINE_CATEGORIES(OMNITRACE_PERFETTO_CATEGORIES); +PERFETTO_DEFINE_CATEGORIES(ROCPROFSYS_PERFETTO_CATEGORIES); #endif #include "debug.hpp" @@ -143,7 +143,7 @@ perfetto_counter_track::emplace(size_t _idx, const std::string& _v, std::stringstream _css{}; for(auto&& eitr : _curr) _css << " " << std::hex << std::setw(12) << std::left << eitr; - OMNITRACE_THROW("perfetto_counter_track emplace method for '%s' (%p) " + ROCPROFSYS_THROW("perfetto_counter_track emplace method for '%s' (%p) " "invalidated C-string '%s' (%p).\n%8s: %s\n%8s: %s\n", _v.c_str(), (void*) _name->c_str(), std::get<0>(itr).c_str(), diff --git a/source/lib/core/rccl.hpp b/source/lib/core/rccl.hpp index 0f97e3d3..66d6540e 100644 --- a/source/lib/core/rccl.hpp +++ b/source/lib/core/rccl.hpp @@ -25,9 +25,9 @@ #include "core/defines.hpp" #include "core/hip_runtime.hpp" -#if defined(OMNITRACE_USE_HIP) && OMNITRACE_USE_HIP > 0 && \ - defined(OMNITRACE_USE_RCCL) && OMNITRACE_USE_RCCL > 0 -# if OMNITRACE_HIP_VERSION == 0 || OMNITRACE_HIP_VERSION >= 50200 +#if defined(ROCPROFSYS_USE_HIP) && ROCPROFSYS_USE_HIP > 0 && \ + defined(ROCPROFSYS_USE_RCCL) && ROCPROFSYS_USE_RCCL > 0 +# if ROCPROFSYS_HIP_VERSION == 0 || ROCPROFSYS_HIP_VERSION >= 50200 # include # else # include diff --git a/source/lib/core/redirect.hpp b/source/lib/core/redirect.hpp index 65c59e8b..24f925c7 100644 --- a/source/lib/core/redirect.hpp +++ b/source/lib/core/redirect.hpp @@ -36,10 +36,10 @@ namespace omnitrace inline namespace config { bool -get_debug() OMNITRACE_HOT; +get_debug() ROCPROFSYS_HOT; int -get_verbose() OMNITRACE_HOT; +get_verbose() ROCPROFSYS_HOT; } // namespace config struct redirect diff --git a/source/lib/core/state.cpp b/source/lib/core/state.cpp index efc4d6d6..2c3d3074 100644 --- a/source/lib/core/state.cpp +++ b/source/lib/core/state.cpp @@ -49,10 +49,10 @@ get_thread_state_value() auto& get_thread_state_history(int64_t _idx = utility::get_thread_index()) { - static auto _v = utility::get_filled_array( + static auto _v = utility::get_filled_array( []() { return utility::get_reserved_vector(32); }); - if(_idx >= OMNITRACE_MAX_THREADS) + if(_idx >= ROCPROFSYS_MAX_THREADS) { static thread_local auto _tl_v = utility::get_reserved_vector(32); return _tl_v; @@ -77,11 +77,11 @@ get_thread_state() State set_state(State _n) { - OMNITRACE_CONDITIONAL_PRINT_F(get_debug_init(), "Setting state :: %s -> %s\n", + ROCPROFSYS_CONDITIONAL_PRINT_F(get_debug_init(), "Setting state :: %s -> %s\n", std::to_string(get_state()).c_str(), std::to_string(_n).c_str()); // state should always be increased, not decreased - OMNITRACE_CI_BASIC_THROW( + ROCPROFSYS_CI_BASIC_THROW( _n < get_state(), "State is being assigned to a lesser value :: %s -> %s", std::to_string(get_state()).c_str(), std::to_string(_n).c_str()); auto _v = get_state(); diff --git a/source/lib/core/state.hpp b/source/lib/core/state.hpp index 326fe094..85cf9f70 100644 --- a/source/lib/core/state.hpp +++ b/source/lib/core/state.hpp @@ -74,33 +74,33 @@ enum class CausalMode : unsigned short // Runtime configuration data // State -get_state() OMNITRACE_HOT; +get_state() ROCPROFSYS_HOT; ThreadState -get_thread_state() OMNITRACE_HOT; +get_thread_state() ROCPROFSYS_HOT; /// returns old state -State set_state(State) OMNITRACE_COLD; // does not change often +State set_state(State) ROCPROFSYS_COLD; // does not change often /// returns old state -ThreadState set_thread_state(ThreadState) OMNITRACE_HOT; // changes often +ThreadState set_thread_state(ThreadState) ROCPROFSYS_HOT; // changes often /// return current state (state change may be ignored) -ThreadState push_thread_state(ThreadState) OMNITRACE_HOT; +ThreadState push_thread_state(ThreadState) ROCPROFSYS_HOT; /// return current state (state change may be ignored) ThreadState -pop_thread_state() OMNITRACE_HOT; +pop_thread_state() ROCPROFSYS_HOT; struct scoped_thread_state { - OMNITRACE_INLINE scoped_thread_state(ThreadState _v) { push_thread_state(_v); } - OMNITRACE_INLINE ~scoped_thread_state() { pop_thread_state(); } + ROCPROFSYS_INLINE scoped_thread_state(ThreadState _v) { push_thread_state(_v); } + ROCPROFSYS_INLINE ~scoped_thread_state() { pop_thread_state(); } }; } // namespace omnitrace -#define OMNITRACE_SCOPED_THREAD_STATE(STATE) \ - ::omnitrace::scoped_thread_state OMNITRACE_VARIABLE(_scoped_thread_state_, __LINE__) \ +#define ROCPROFSYS_SCOPED_THREAD_STATE(STATE) \ + ::omnitrace::scoped_thread_state ROCPROFSYS_VARIABLE(_scoped_thread_state_, __LINE__) \ { \ ::omnitrace::STATE \ } diff --git a/source/lib/core/utility.cpp b/source/lib/core/utility.cpp index 2a16c068..ccb7d0ae 100644 --- a/source/lib/core/utility.cpp +++ b/source/lib/core/utility.cpp @@ -71,7 +71,7 @@ parse_numeric_range(std::string _input_string, const std::string& _label, Up _in { if(_v.find_first_not_of("0123456789-:") != std::string::npos) { - OMNITRACE_BASIC_VERBOSE_F( + ROCPROFSYS_BASIC_VERBOSE_F( 0, "Invalid %s specification. Only numerical values (e.g., 0), ranges " "(e.g., 0-7), and ranges with increments (e.g. 20-40:10) are permitted. " @@ -92,7 +92,7 @@ parse_numeric_range(std::string _input_string, const std::string& _label, Up _in if(_v.find('-') != std::string::npos) { auto _vv = tim::delimit(_v, "-"); - OMNITRACE_CONDITIONAL_THROW( + ROCPROFSYS_CONDITIONAL_THROW( _vv.size() != 2, "Invalid %s range specification: %s. Required format N-M, e.g. 0-4", _label.c_str(), _v.c_str()); diff --git a/source/lib/omnitrace-dl/CMakeLists.txt b/source/lib/omnitrace-dl/CMakeLists.txt index 43923ba7..62691e5b 100644 --- a/source/lib/omnitrace-dl/CMakeLists.txt +++ b/source/lib/omnitrace-dl/CMakeLists.txt @@ -42,7 +42,7 @@ set_target_properties( BUILD_RPATH "\$ORIGIN" INSTALL_RPATH "\$ORIGIN") -omnitrace_strip_target(rocprofsys-dl-library) +rocprofsys_strip_target(rocprofsys-dl-library) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/dl/dl.hpp DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PACKAGE_NAME}/dl) diff --git a/source/lib/omnitrace-dl/dl.cpp b/source/lib/omnitrace-dl/dl.cpp index 84417a5a..62adb981 100644 --- a/source/lib/omnitrace-dl/dl.cpp +++ b/source/lib/omnitrace-dl/dl.cpp @@ -20,17 +20,17 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -#if !defined(OMNITRACE_DL_SOURCE) -# define OMNITRACE_DL_SOURCE 1 +#if !defined(ROCPROFSYS_DL_SOURCE) +# define ROCPROFSYS_DL_SOURCE 1 #endif -#define OMNITRACE_COMMON_LIBRARY_NAME "dl" +#define ROCPROFSYS_COMMON_LIBRARY_NAME "dl" #include -#define OMNITRACE_COMMON_LIBRARY_LOG_START \ +#define ROCPROFSYS_COMMON_LIBRARY_LOG_START \ fprintf(stderr, "%s", ::tim::log::color::info()); -#define OMNITRACE_COMMON_LIBRARY_LOG_END fprintf(stderr, "%s", ::tim::log::color::end()); +#define ROCPROFSYS_COMMON_LIBRARY_LOG_END fprintf(stderr, "%s", ::tim::log::color::end()); #include "common/defines.h" #include "common/delimit.hpp" @@ -56,23 +56,23 @@ //--------------------------------------------------------------------------------------// -#define OMNITRACE_DLSYM(VARNAME, HANDLE, FUNCNAME) \ +#define ROCPROFSYS_DLSYM(VARNAME, HANDLE, FUNCNAME) \ if(HANDLE) \ { \ *(void**) (&VARNAME) = dlsym(HANDLE, FUNCNAME); \ if(VARNAME == nullptr && _omnitrace_dl_verbose >= _warn_verbose) \ { \ - OMNITRACE_COMMON_LIBRARY_LOG_START \ + ROCPROFSYS_COMMON_LIBRARY_LOG_START \ fprintf(stderr, "[rocprof-sys][dl][pid=%i]> %s :: %s\n", getpid(), FUNCNAME, \ dlerror()); \ - OMNITRACE_COMMON_LIBRARY_LOG_END \ + ROCPROFSYS_COMMON_LIBRARY_LOG_END \ } \ else if(_omnitrace_dl_verbose > _info_verbose) \ { \ - OMNITRACE_COMMON_LIBRARY_LOG_START \ + ROCPROFSYS_COMMON_LIBRARY_LOG_START \ fprintf(stderr, "[rocprof-sys][dl][pid=%i]> %s :: success\n", getpid(), \ FUNCNAME); \ - OMNITRACE_COMMON_LIBRARY_LOG_END \ + ROCPROFSYS_COMMON_LIBRARY_LOG_END \ } \ } @@ -160,18 +160,18 @@ get_omnitrace_root_pid() } void -omnitrace_preinit() OMNITRACE_INTERNAL_API; +omnitrace_preinit() ROCPROFSYS_INTERNAL_API; void -omnitrace_postinit(std::string exe = {}) OMNITRACE_INTERNAL_API; +omnitrace_postinit(std::string exe = {}) ROCPROFSYS_INTERNAL_API; pid_t _omnitrace_root_pid = get_omnitrace_root_pid(); // environment priority: -// - OMNITRACE_DL_DEBUG -// - OMNITRACE_DL_VERBOSE -// - OMNITRACE_DEBUG -// - OMNITRACE_VERBOSE +// - ROCPROFSYS_DL_DEBUG +// - ROCPROFSYS_DL_VERBOSE +// - ROCPROFSYS_DEBUG +// - ROCPROFSYS_VERBOSE int _omnitrace_dl_verbose = get_omnitrace_dl_env(); // The docs for dlopen suggest that the combination of RTLD_LOCAL + RTLD_DEEPBIND @@ -218,9 +218,9 @@ const char* _omnitrace_dl_dlopen_descr = "RTLD_LAZY | RTLD_LOCAL"; #endif /// This class contains function pointers for omnitrace's instrumentation functions -struct OMNITRACE_INTERNAL_API indirect +struct ROCPROFSYS_INTERNAL_API indirect { - OMNITRACE_INLINE indirect(const std::string& _omnilib, const std::string& _userlib, + ROCPROFSYS_INLINE indirect(const std::string& _omnilib, const std::string& _userlib, const std::string& _dllib) : m_omnilib{ common::path::find_path(_omnilib, _omnitrace_dl_verbose) } , m_dllib{ common::path::find_path(_dllib, _omnitrace_dl_verbose) } @@ -228,14 +228,14 @@ struct OMNITRACE_INTERNAL_API indirect { if(_omnitrace_dl_verbose >= 1) { - OMNITRACE_COMMON_LIBRARY_LOG_START + ROCPROFSYS_COMMON_LIBRARY_LOG_START fprintf(stderr, "[rocprof-sys][dl][pid=%i] %s resolved to '%s'\n", getpid(), ::basename(_omnilib.c_str()), m_omnilib.c_str()); fprintf(stderr, "[rocprof-sys][dl][pid=%i] %s resolved to '%s'\n", getpid(), ::basename(_dllib.c_str()), m_dllib.c_str()); fprintf(stderr, "[rocprof-sys][dl][pid=%i] %s resolved to '%s'\n", getpid(), ::basename(_userlib.c_str()), m_userlib.c_str()); - OMNITRACE_COMMON_LIBRARY_LOG_END + ROCPROFSYS_COMMON_LIBRARY_LOG_END } auto _search_paths = common::join(':', common::path::dirname(_omnilib), @@ -247,9 +247,9 @@ struct OMNITRACE_INTERNAL_API indirect init(); } - OMNITRACE_INLINE ~indirect() { dlclose(m_omnihandle); } + ROCPROFSYS_INLINE ~indirect() { dlclose(m_omnihandle); } - static OMNITRACE_INLINE void* open(const std::string& _lib) + static ROCPROFSYS_INLINE void* open(const std::string& _lib) { auto* libhandle = dlopen(_lib.c_str(), _omnitrace_dl_dlopen_flags); @@ -257,11 +257,11 @@ struct OMNITRACE_INTERNAL_API indirect { if(_omnitrace_dl_verbose >= 2) { - OMNITRACE_COMMON_LIBRARY_LOG_START + ROCPROFSYS_COMMON_LIBRARY_LOG_START fprintf(stderr, "[rocprof-sys][dl][pid=%i] dlopen(\"%s\", %s) :: success\n", getpid(), _lib.c_str(), _omnitrace_dl_dlopen_descr); - OMNITRACE_COMMON_LIBRARY_LOG_END + ROCPROFSYS_COMMON_LIBRARY_LOG_END } } else @@ -269,10 +269,10 @@ struct OMNITRACE_INTERNAL_API indirect if(_omnitrace_dl_verbose >= 0) { perror("dlopen"); - OMNITRACE_COMMON_LIBRARY_LOG_START + ROCPROFSYS_COMMON_LIBRARY_LOG_START fprintf(stderr, "[rocprof-sys][dl][pid=%i] dlopen(\"%s\", %s) :: %s\n", getpid(), _lib.c_str(), _omnitrace_dl_dlopen_descr, dlerror()); - OMNITRACE_COMMON_LIBRARY_LOG_END + ROCPROFSYS_COMMON_LIBRARY_LOG_END } } @@ -281,100 +281,100 @@ struct OMNITRACE_INTERNAL_API indirect return libhandle; } - OMNITRACE_INLINE void init() + ROCPROFSYS_INLINE void init() { if(!m_omnihandle) m_omnihandle = open(m_omnilib); int _warn_verbose = 0; int _info_verbose = 2; // Initialize all pointers - OMNITRACE_DLSYM(omnitrace_init_library_f, m_omnihandle, "omnitrace_init_library"); - OMNITRACE_DLSYM(omnitrace_init_tooling_f, m_omnihandle, "omnitrace_init_tooling"); - OMNITRACE_DLSYM(omnitrace_init_f, m_omnihandle, "omnitrace_init"); - OMNITRACE_DLSYM(omnitrace_finalize_f, m_omnihandle, "omnitrace_finalize"); - OMNITRACE_DLSYM(omnitrace_set_env_f, m_omnihandle, "omnitrace_set_env"); - OMNITRACE_DLSYM(omnitrace_set_mpi_f, m_omnihandle, "omnitrace_set_mpi"); - OMNITRACE_DLSYM(omnitrace_push_trace_f, m_omnihandle, "omnitrace_push_trace"); - OMNITRACE_DLSYM(omnitrace_pop_trace_f, m_omnihandle, "omnitrace_pop_trace"); - OMNITRACE_DLSYM(omnitrace_push_region_f, m_omnihandle, "omnitrace_push_region"); - OMNITRACE_DLSYM(omnitrace_pop_region_f, m_omnihandle, "omnitrace_pop_region"); - OMNITRACE_DLSYM(omnitrace_push_category_region_f, m_omnihandle, + ROCPROFSYS_DLSYM(omnitrace_init_library_f, m_omnihandle, "omnitrace_init_library"); + ROCPROFSYS_DLSYM(omnitrace_init_tooling_f, m_omnihandle, "omnitrace_init_tooling"); + ROCPROFSYS_DLSYM(omnitrace_init_f, m_omnihandle, "omnitrace_init"); + ROCPROFSYS_DLSYM(omnitrace_finalize_f, m_omnihandle, "omnitrace_finalize"); + ROCPROFSYS_DLSYM(omnitrace_set_env_f, m_omnihandle, "omnitrace_set_env"); + ROCPROFSYS_DLSYM(omnitrace_set_mpi_f, m_omnihandle, "omnitrace_set_mpi"); + ROCPROFSYS_DLSYM(omnitrace_push_trace_f, m_omnihandle, "omnitrace_push_trace"); + ROCPROFSYS_DLSYM(omnitrace_pop_trace_f, m_omnihandle, "omnitrace_pop_trace"); + ROCPROFSYS_DLSYM(omnitrace_push_region_f, m_omnihandle, "omnitrace_push_region"); + ROCPROFSYS_DLSYM(omnitrace_pop_region_f, m_omnihandle, "omnitrace_pop_region"); + ROCPROFSYS_DLSYM(omnitrace_push_category_region_f, m_omnihandle, "omnitrace_push_category_region"); - OMNITRACE_DLSYM(omnitrace_pop_category_region_f, m_omnihandle, + ROCPROFSYS_DLSYM(omnitrace_pop_category_region_f, m_omnihandle, "omnitrace_pop_category_region"); - OMNITRACE_DLSYM(omnitrace_register_source_f, m_omnihandle, + ROCPROFSYS_DLSYM(omnitrace_register_source_f, m_omnihandle, "omnitrace_register_source"); - OMNITRACE_DLSYM(omnitrace_register_coverage_f, m_omnihandle, + ROCPROFSYS_DLSYM(omnitrace_register_coverage_f, m_omnihandle, "omnitrace_register_coverage"); - OMNITRACE_DLSYM(omnitrace_progress_f, m_omnihandle, "omnitrace_progress"); - OMNITRACE_DLSYM(omnitrace_annotated_progress_f, m_omnihandle, + ROCPROFSYS_DLSYM(omnitrace_progress_f, m_omnihandle, "omnitrace_progress"); + ROCPROFSYS_DLSYM(omnitrace_annotated_progress_f, m_omnihandle, "omnitrace_annotated_progress"); - OMNITRACE_DLSYM(kokkosp_print_help_f, m_omnihandle, "kokkosp_print_help"); - OMNITRACE_DLSYM(kokkosp_parse_args_f, m_omnihandle, "kokkosp_parse_args"); - OMNITRACE_DLSYM(kokkosp_declare_metadata_f, m_omnihandle, + ROCPROFSYS_DLSYM(kokkosp_print_help_f, m_omnihandle, "kokkosp_print_help"); + ROCPROFSYS_DLSYM(kokkosp_parse_args_f, m_omnihandle, "kokkosp_parse_args"); + ROCPROFSYS_DLSYM(kokkosp_declare_metadata_f, m_omnihandle, "kokkosp_declare_metadata"); - OMNITRACE_DLSYM(kokkosp_request_tool_settings_f, m_omnihandle, + ROCPROFSYS_DLSYM(kokkosp_request_tool_settings_f, m_omnihandle, "kokkosp_request_tool_settings"); - OMNITRACE_DLSYM(kokkosp_init_library_f, m_omnihandle, "kokkosp_init_library"); - OMNITRACE_DLSYM(kokkosp_finalize_library_f, m_omnihandle, + ROCPROFSYS_DLSYM(kokkosp_init_library_f, m_omnihandle, "kokkosp_init_library"); + ROCPROFSYS_DLSYM(kokkosp_finalize_library_f, m_omnihandle, "kokkosp_finalize_library"); - OMNITRACE_DLSYM(kokkosp_begin_parallel_for_f, m_omnihandle, + ROCPROFSYS_DLSYM(kokkosp_begin_parallel_for_f, m_omnihandle, "kokkosp_begin_parallel_for"); - OMNITRACE_DLSYM(kokkosp_end_parallel_for_f, m_omnihandle, + ROCPROFSYS_DLSYM(kokkosp_end_parallel_for_f, m_omnihandle, "kokkosp_end_parallel_for"); - OMNITRACE_DLSYM(kokkosp_begin_parallel_reduce_f, m_omnihandle, + ROCPROFSYS_DLSYM(kokkosp_begin_parallel_reduce_f, m_omnihandle, "kokkosp_begin_parallel_reduce"); - OMNITRACE_DLSYM(kokkosp_end_parallel_reduce_f, m_omnihandle, + ROCPROFSYS_DLSYM(kokkosp_end_parallel_reduce_f, m_omnihandle, "kokkosp_end_parallel_reduce"); - OMNITRACE_DLSYM(kokkosp_begin_parallel_scan_f, m_omnihandle, + ROCPROFSYS_DLSYM(kokkosp_begin_parallel_scan_f, m_omnihandle, "kokkosp_begin_parallel_scan"); - OMNITRACE_DLSYM(kokkosp_end_parallel_scan_f, m_omnihandle, + ROCPROFSYS_DLSYM(kokkosp_end_parallel_scan_f, m_omnihandle, "kokkosp_end_parallel_scan"); - OMNITRACE_DLSYM(kokkosp_begin_fence_f, m_omnihandle, "kokkosp_begin_fence"); - OMNITRACE_DLSYM(kokkosp_end_fence_f, m_omnihandle, "kokkosp_end_fence"); - OMNITRACE_DLSYM(kokkosp_push_profile_region_f, m_omnihandle, + ROCPROFSYS_DLSYM(kokkosp_begin_fence_f, m_omnihandle, "kokkosp_begin_fence"); + ROCPROFSYS_DLSYM(kokkosp_end_fence_f, m_omnihandle, "kokkosp_end_fence"); + ROCPROFSYS_DLSYM(kokkosp_push_profile_region_f, m_omnihandle, "kokkosp_push_profile_region"); - OMNITRACE_DLSYM(kokkosp_pop_profile_region_f, m_omnihandle, + ROCPROFSYS_DLSYM(kokkosp_pop_profile_region_f, m_omnihandle, "kokkosp_pop_profile_region"); - OMNITRACE_DLSYM(kokkosp_create_profile_section_f, m_omnihandle, + ROCPROFSYS_DLSYM(kokkosp_create_profile_section_f, m_omnihandle, "kokkosp_create_profile_section"); - OMNITRACE_DLSYM(kokkosp_destroy_profile_section_f, m_omnihandle, + ROCPROFSYS_DLSYM(kokkosp_destroy_profile_section_f, m_omnihandle, "kokkosp_destroy_profile_section"); - OMNITRACE_DLSYM(kokkosp_start_profile_section_f, m_omnihandle, + ROCPROFSYS_DLSYM(kokkosp_start_profile_section_f, m_omnihandle, "kokkosp_start_profile_section"); - OMNITRACE_DLSYM(kokkosp_stop_profile_section_f, m_omnihandle, + ROCPROFSYS_DLSYM(kokkosp_stop_profile_section_f, m_omnihandle, "kokkosp_stop_profile_section"); - OMNITRACE_DLSYM(kokkosp_allocate_data_f, m_omnihandle, "kokkosp_allocate_data"); - OMNITRACE_DLSYM(kokkosp_deallocate_data_f, m_omnihandle, + ROCPROFSYS_DLSYM(kokkosp_allocate_data_f, m_omnihandle, "kokkosp_allocate_data"); + ROCPROFSYS_DLSYM(kokkosp_deallocate_data_f, m_omnihandle, "kokkosp_deallocate_data"); - OMNITRACE_DLSYM(kokkosp_begin_deep_copy_f, m_omnihandle, + ROCPROFSYS_DLSYM(kokkosp_begin_deep_copy_f, m_omnihandle, "kokkosp_begin_deep_copy"); - OMNITRACE_DLSYM(kokkosp_end_deep_copy_f, m_omnihandle, "kokkosp_end_deep_copy"); - OMNITRACE_DLSYM(kokkosp_profile_event_f, m_omnihandle, "kokkosp_profile_event"); - OMNITRACE_DLSYM(kokkosp_dual_view_sync_f, m_omnihandle, "kokkosp_dual_view_sync"); - OMNITRACE_DLSYM(kokkosp_dual_view_modify_f, m_omnihandle, + ROCPROFSYS_DLSYM(kokkosp_end_deep_copy_f, m_omnihandle, "kokkosp_end_deep_copy"); + ROCPROFSYS_DLSYM(kokkosp_profile_event_f, m_omnihandle, "kokkosp_profile_event"); + ROCPROFSYS_DLSYM(kokkosp_dual_view_sync_f, m_omnihandle, "kokkosp_dual_view_sync"); + ROCPROFSYS_DLSYM(kokkosp_dual_view_modify_f, m_omnihandle, "kokkosp_dual_view_modify"); -#if OMNITRACE_USE_ROCTRACER > 0 - OMNITRACE_DLSYM(hsa_on_load_f, m_omnihandle, "OnLoad"); - OMNITRACE_DLSYM(hsa_on_unload_f, m_omnihandle, "OnUnload"); +#if ROCPROFSYS_USE_ROCTRACER > 0 + ROCPROFSYS_DLSYM(hsa_on_load_f, m_omnihandle, "OnLoad"); + ROCPROFSYS_DLSYM(hsa_on_unload_f, m_omnihandle, "OnUnload"); #endif -#if OMNITRACE_USE_ROCPROFILER > 0 - OMNITRACE_DLSYM(rocp_on_load_tool_prop_f, m_omnihandle, "OnLoadToolProp"); - OMNITRACE_DLSYM(rocp_on_unload_tool_f, m_omnihandle, "OnUnloadTool"); +#if ROCPROFSYS_USE_ROCPROFILER > 0 + ROCPROFSYS_DLSYM(rocp_on_load_tool_prop_f, m_omnihandle, "OnLoadToolProp"); + ROCPROFSYS_DLSYM(rocp_on_unload_tool_f, m_omnihandle, "OnUnloadTool"); #endif -#if OMNITRACE_USE_OMPT == 0 +#if ROCPROFSYS_USE_OMPT == 0 _warn_verbose = 5; #else - OMNITRACE_DLSYM(ompt_start_tool_f, m_omnihandle, "ompt_start_tool"); + ROCPROFSYS_DLSYM(ompt_start_tool_f, m_omnihandle, "ompt_start_tool"); #endif if(!m_userhandle) m_userhandle = open(m_userlib); _warn_verbose = 0; - OMNITRACE_DLSYM(omnitrace_user_configure_f, m_userhandle, + ROCPROFSYS_DLSYM(omnitrace_user_configure_f, m_userhandle, "omnitrace_user_configure"); if(omnitrace_user_configure_f) @@ -390,7 +390,7 @@ struct OMNITRACE_INTERNAL_API indirect _cb.push_annotated_region = &omnitrace_user_push_annotated_region_dl; _cb.pop_annotated_region = &omnitrace_user_pop_annotated_region_dl; _cb.annotated_progress = &omnitrace_user_annotated_progress_dl; - (*omnitrace_user_configure_f)(OMNITRACE_USER_REPLACE_CONFIG, _cb, nullptr); + (*omnitrace_user_configure_f)(ROCPROFSYS_USER_REPLACE_CONFIG, _cb, nullptr); } } @@ -457,19 +457,19 @@ struct OMNITRACE_INTERNAL_API indirect void (*kokkosp_dual_view_modify_f)(const char*, const void* const, bool) = nullptr; // HSA functions -#if OMNITRACE_USE_ROCTRACER > 0 +#if ROCPROFSYS_USE_ROCTRACER > 0 bool (*hsa_on_load_f)(HsaApiTable*, uint64_t, uint64_t, const char* const*) = nullptr; void (*hsa_on_unload_f)() = nullptr; #endif // ROCP functions -#if OMNITRACE_USE_ROCPROFILER > 0 +#if ROCPROFSYS_USE_ROCPROFILER > 0 void (*rocp_on_load_tool_prop_f)(void* settings) = nullptr; void (*rocp_on_unload_tool_f)() = nullptr; #endif // OpenMP functions -#if defined(OMNITRACE_USE_OMPT) && OMNITRACE_USE_OMPT > 0 +#if defined(ROCPROFSYS_USE_OMPT) && ROCPROFSYS_USE_OMPT > 0 ompt_start_tool_result_t* (*ompt_start_tool_f)(unsigned int, const char*); #endif @@ -486,7 +486,7 @@ struct OMNITRACE_INTERNAL_API indirect }; inline indirect& -get_indirect() OMNITRACE_INTERNAL_API; +get_indirect() ROCPROFSYS_INTERNAL_API; indirect& get_indirect() @@ -567,28 +567,28 @@ bool _omnitrace_dl_fini = (std::atexit([]() { //--------------------------------------------------------------------------------------// -#define OMNITRACE_DL_INVOKE(...) \ +#define ROCPROFSYS_DL_INVOKE(...) \ ::omnitrace::common::invoke(__FUNCTION__, ::omnitrace::dl::_omnitrace_dl_verbose, \ (::omnitrace::dl::get_thread_status() = false), \ __VA_ARGS__) -#define OMNITRACE_DL_IGNORE(...) \ +#define ROCPROFSYS_DL_IGNORE(...) \ ::omnitrace::common::ignore(__FUNCTION__, ::omnitrace::dl::_omnitrace_dl_verbose, \ __VA_ARGS__) -#define OMNITRACE_DL_INVOKE_STATUS(STATUS, ...) \ +#define ROCPROFSYS_DL_INVOKE_STATUS(STATUS, ...) \ ::omnitrace::common::invoke(__FUNCTION__, ::omnitrace::dl::_omnitrace_dl_verbose, \ STATUS, __VA_ARGS__) -#define OMNITRACE_DL_LOG(LEVEL, ...) \ +#define ROCPROFSYS_DL_LOG(LEVEL, ...) \ if(::omnitrace::dl::_omnitrace_dl_verbose >= LEVEL) \ { \ fflush(stderr); \ - OMNITRACE_COMMON_LIBRARY_LOG_START \ - fprintf(stderr, "[rocprof-sys][" OMNITRACE_COMMON_LIBRARY_NAME "][%i] ", \ + ROCPROFSYS_COMMON_LIBRARY_LOG_START \ + fprintf(stderr, "[rocprof-sys][" ROCPROFSYS_COMMON_LIBRARY_NAME "][%i] ", \ getpid()); \ fprintf(stderr, __VA_ARGS__); \ - OMNITRACE_COMMON_LIBRARY_LOG_END \ + ROCPROFSYS_COMMON_LIBRARY_LOG_END \ fflush(stderr); \ } @@ -610,26 +610,26 @@ extern "C" void omnitrace_init_library(void) { - OMNITRACE_DL_INVOKE(get_indirect().omnitrace_init_library_f); + ROCPROFSYS_DL_INVOKE(get_indirect().omnitrace_init_library_f); } void omnitrace_init_tooling(void) { - OMNITRACE_DL_INVOKE(get_indirect().omnitrace_init_tooling_f); + ROCPROFSYS_DL_INVOKE(get_indirect().omnitrace_init_tooling_f); } void omnitrace_init(const char* a, bool b, const char* c) { if(dl::get_inited() && dl::get_finied()) { - OMNITRACE_DL_LOG( + ROCPROFSYS_DL_LOG( 2, "%s(%s) ignored :: already initialized and finalized\n", __FUNCTION__, ::omnitrace::join(::omnitrace::QuoteStrings{}, ", ", a, b, c).c_str()); return; } else if(dl::get_inited() && dl::get_active()) { - OMNITRACE_DL_LOG( + ROCPROFSYS_DL_LOG( 2, "%s(%s) ignored :: already initialized and active\n", __FUNCTION__, ::omnitrace::join(::omnitrace::QuoteStrings{}, ", ", a, b, c).c_str()); return; @@ -639,7 +639,7 @@ extern "C" dl::omnitrace_preinit(); bool _invoked = false; - OMNITRACE_DL_INVOKE_STATUS(_invoked, get_indirect().omnitrace_init_f, a, b, c); + ROCPROFSYS_DL_INVOKE_STATUS(_invoked, get_indirect().omnitrace_init_f, a, b, c); if(_invoked) { dl::get_active() = true; @@ -654,19 +654,19 @@ extern "C" { if(dl::get_inited() && dl::get_finied()) { - OMNITRACE_DL_LOG(2, "%s() ignored :: already initialized and finalized\n", + ROCPROFSYS_DL_LOG(2, "%s() ignored :: already initialized and finalized\n", __FUNCTION__); return; } else if(dl::get_finied() && !dl::get_active()) { - OMNITRACE_DL_LOG(2, "%s() ignored :: already finalized but not active\n", + ROCPROFSYS_DL_LOG(2, "%s() ignored :: already finalized but not active\n", __FUNCTION__); return; } bool _invoked = false; - OMNITRACE_DL_INVOKE_STATUS(_invoked, get_indirect().omnitrace_finalize_f); + ROCPROFSYS_DL_INVOKE_STATUS(_invoked, get_indirect().omnitrace_finalize_f); if(_invoked) { dl::get_active() = false; @@ -679,7 +679,7 @@ extern "C" if(!dl::get_active()) return; if(dl::get_thread_enabled()) { - OMNITRACE_DL_INVOKE(get_indirect().omnitrace_push_trace_f, name); + ROCPROFSYS_DL_INVOKE(get_indirect().omnitrace_push_trace_f, name); } else { @@ -692,7 +692,7 @@ extern "C" if(!dl::get_active()) return; if(dl::get_thread_enabled()) { - OMNITRACE_DL_INVOKE(get_indirect().omnitrace_pop_trace_f, name); + ROCPROFSYS_DL_INVOKE(get_indirect().omnitrace_pop_trace_f, name); } else { @@ -705,7 +705,7 @@ extern "C" if(!dl::get_active()) return 0; if(dl::get_thread_enabled()) { - return OMNITRACE_DL_INVOKE(get_indirect().omnitrace_push_region_f, name); + return ROCPROFSYS_DL_INVOKE(get_indirect().omnitrace_push_region_f, name); } else { @@ -719,7 +719,7 @@ extern "C" if(!dl::get_active()) return 0; if(dl::get_thread_enabled()) { - return OMNITRACE_DL_INVOKE(get_indirect().omnitrace_pop_region_f, name); + return ROCPROFSYS_DL_INVOKE(get_indirect().omnitrace_pop_region_f, name); } else { @@ -735,7 +735,7 @@ extern "C" if(!dl::get_active()) return 0; if(dl::get_thread_enabled()) { - return OMNITRACE_DL_INVOKE(get_indirect().omnitrace_push_category_region_f, + return ROCPROFSYS_DL_INVOKE(get_indirect().omnitrace_push_category_region_f, _category, name, _annotations, _annotation_count); } else @@ -752,7 +752,7 @@ extern "C" if(!dl::get_active()) return 0; if(dl::get_thread_enabled()) { - return OMNITRACE_DL_INVOKE(get_indirect().omnitrace_pop_category_region_f, + return ROCPROFSYS_DL_INVOKE(get_indirect().omnitrace_pop_category_region_f, _category, name, _annotations, _annotation_count); } else @@ -766,36 +766,36 @@ extern "C" { if(dl::get_inited() && dl::get_active()) { - OMNITRACE_DL_IGNORE(2, "already initialized and active", a, b); + ROCPROFSYS_DL_IGNORE(2, "already initialized and active", a, b); return; } - OMNITRACE_DL_LOG(2, "%s(%s, %s)\n", __FUNCTION__, a, b); + ROCPROFSYS_DL_LOG(2, "%s(%s, %s)\n", __FUNCTION__, a, b); setenv(a, b, 0); - // OMNITRACE_DL_INVOKE(get_indirect().omnitrace_set_env_f, a, b); + // ROCPROFSYS_DL_INVOKE(get_indirect().omnitrace_set_env_f, a, b); } void omnitrace_set_mpi(bool a, bool b) { if(dl::get_inited() && dl::get_active()) { - OMNITRACE_DL_IGNORE(2, "already initialized and active", a, b); + ROCPROFSYS_DL_IGNORE(2, "already initialized and active", a, b); return; } - OMNITRACE_DL_INVOKE(get_indirect().omnitrace_set_mpi_f, a, b); + ROCPROFSYS_DL_INVOKE(get_indirect().omnitrace_set_mpi_f, a, b); } void omnitrace_register_source(const char* file, const char* func, size_t line, size_t address, const char* source) { - OMNITRACE_DL_LOG(3, "%s(\"%s\", \"%s\", %zu, %zu, \"%s\")\n", __FUNCTION__, file, + ROCPROFSYS_DL_LOG(3, "%s(\"%s\", \"%s\", %zu, %zu, \"%s\")\n", __FUNCTION__, file, func, line, address, source); - OMNITRACE_DL_INVOKE(get_indirect().omnitrace_register_source_f, file, func, line, + ROCPROFSYS_DL_INVOKE(get_indirect().omnitrace_register_source_f, file, func, line, address, source); } void omnitrace_register_coverage(const char* file, const char* func, size_t address) { - OMNITRACE_DL_INVOKE(get_indirect().omnitrace_register_coverage_f, file, func, + ROCPROFSYS_DL_INVOKE(get_indirect().omnitrace_register_coverage_f, file, func, address); } @@ -826,18 +826,18 @@ extern "C" int omnitrace_user_push_region_dl(const char* name) { if(!dl::get_active()) return 0; - return OMNITRACE_DL_INVOKE(get_indirect().omnitrace_push_region_f, name); + return ROCPROFSYS_DL_INVOKE(get_indirect().omnitrace_push_region_f, name); } int omnitrace_user_pop_region_dl(const char* name) { if(!dl::get_active()) return 0; - return OMNITRACE_DL_INVOKE(get_indirect().omnitrace_pop_region_f, name); + return ROCPROFSYS_DL_INVOKE(get_indirect().omnitrace_pop_region_f, name); } int omnitrace_user_progress_dl(const char* name) { - OMNITRACE_DL_INVOKE(get_indirect().omnitrace_progress_f, name); + ROCPROFSYS_DL_INVOKE(get_indirect().omnitrace_progress_f, name); return 0; } @@ -846,8 +846,8 @@ extern "C" size_t _annotation_count) { if(!dl::get_active()) return 0; - return OMNITRACE_DL_INVOKE(get_indirect().omnitrace_push_category_region_f, - OMNITRACE_CATEGORY_USER, name, _annotations, + return ROCPROFSYS_DL_INVOKE(get_indirect().omnitrace_push_category_region_f, + ROCPROFSYS_CATEGORY_USER, name, _annotations, _annotation_count); } @@ -856,8 +856,8 @@ extern "C" size_t _annotation_count) { if(!dl::get_active()) return 0; - return OMNITRACE_DL_INVOKE(get_indirect().omnitrace_pop_category_region_f, - OMNITRACE_CATEGORY_USER, name, _annotations, + return ROCPROFSYS_DL_INVOKE(get_indirect().omnitrace_pop_category_region_f, + ROCPROFSYS_CATEGORY_USER, name, _annotations, _annotation_count); } @@ -865,31 +865,31 @@ extern "C" omnitrace_annotation_t* _annotations, size_t _annotation_count) { - OMNITRACE_DL_INVOKE(get_indirect().omnitrace_annotated_progress_f, name, + ROCPROFSYS_DL_INVOKE(get_indirect().omnitrace_annotated_progress_f, name, _annotations, _annotation_count); return 0; } void omnitrace_progress(const char* _name) { - return OMNITRACE_DL_INVOKE(get_indirect().omnitrace_progress_f, _name); + return ROCPROFSYS_DL_INVOKE(get_indirect().omnitrace_progress_f, _name); } void omnitrace_annotated_progress(const char* _name, omnitrace_annotation_t* _annotations, size_t _annotation_count) { - return OMNITRACE_DL_INVOKE(get_indirect().omnitrace_annotated_progress_f, _name, + return ROCPROFSYS_DL_INVOKE(get_indirect().omnitrace_annotated_progress_f, _name, _annotations, _annotation_count); } void omnitrace_set_instrumented(int _mode) { - OMNITRACE_DL_LOG(2, "%s(%i)\n", __FUNCTION__, _mode); + ROCPROFSYS_DL_LOG(2, "%s(%i)\n", __FUNCTION__, _mode); auto _mode_v = static_cast(_mode); if(_mode_v < dl::InstrumentMode::None || _mode_v >= dl::InstrumentMode::Last) { - OMNITRACE_DL_LOG(-127, + ROCPROFSYS_DL_LOG(-127, "%s(mode=%i) invoked with invalid instrumentation mode. " "mode should be %i >= mode < %i\n", __FUNCTION__, _mode, @@ -907,125 +907,125 @@ extern "C" void kokkosp_print_help(char* argv0) { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_print_help_f, argv0); + return ROCPROFSYS_DL_INVOKE(get_indirect().kokkosp_print_help_f, argv0); } void kokkosp_parse_args(int argc, char** argv) { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_parse_args_f, argc, argv); + return ROCPROFSYS_DL_INVOKE(get_indirect().kokkosp_parse_args_f, argc, argv); } void kokkosp_declare_metadata(const char* key, const char* value) { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_declare_metadata_f, key, value); + return ROCPROFSYS_DL_INVOKE(get_indirect().kokkosp_declare_metadata_f, key, value); } void kokkosp_request_tool_settings(const uint32_t version, Kokkos_Tools_ToolSettings* settings) { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_request_tool_settings_f, + return ROCPROFSYS_DL_INVOKE(get_indirect().kokkosp_request_tool_settings_f, version, settings); } void kokkosp_init_library(const int loadSeq, const uint64_t interfaceVer, const uint32_t devInfoCount, void* deviceInfo) { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_init_library_f, loadSeq, + return ROCPROFSYS_DL_INVOKE(get_indirect().kokkosp_init_library_f, loadSeq, interfaceVer, devInfoCount, deviceInfo); } void kokkosp_finalize_library() { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_finalize_library_f); + return ROCPROFSYS_DL_INVOKE(get_indirect().kokkosp_finalize_library_f); } void kokkosp_begin_parallel_for(const char* name, uint32_t devid, uint64_t* kernid) { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_begin_parallel_for_f, name, + return ROCPROFSYS_DL_INVOKE(get_indirect().kokkosp_begin_parallel_for_f, name, devid, kernid); } void kokkosp_end_parallel_for(uint64_t kernid) { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_end_parallel_for_f, kernid); + return ROCPROFSYS_DL_INVOKE(get_indirect().kokkosp_end_parallel_for_f, kernid); } void kokkosp_begin_parallel_reduce(const char* name, uint32_t devid, uint64_t* kernid) { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_begin_parallel_reduce_f, name, + return ROCPROFSYS_DL_INVOKE(get_indirect().kokkosp_begin_parallel_reduce_f, name, devid, kernid); } void kokkosp_end_parallel_reduce(uint64_t kernid) { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_end_parallel_reduce_f, kernid); + return ROCPROFSYS_DL_INVOKE(get_indirect().kokkosp_end_parallel_reduce_f, kernid); } void kokkosp_begin_parallel_scan(const char* name, uint32_t devid, uint64_t* kernid) { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_begin_parallel_scan_f, name, + return ROCPROFSYS_DL_INVOKE(get_indirect().kokkosp_begin_parallel_scan_f, name, devid, kernid); } void kokkosp_end_parallel_scan(uint64_t kernid) { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_end_parallel_scan_f, kernid); + return ROCPROFSYS_DL_INVOKE(get_indirect().kokkosp_end_parallel_scan_f, kernid); } void kokkosp_begin_fence(const char* name, uint32_t devid, uint64_t* kernid) { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_begin_fence_f, name, devid, + return ROCPROFSYS_DL_INVOKE(get_indirect().kokkosp_begin_fence_f, name, devid, kernid); } void kokkosp_end_fence(uint64_t kernid) { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_end_fence_f, kernid); + return ROCPROFSYS_DL_INVOKE(get_indirect().kokkosp_end_fence_f, kernid); } void kokkosp_push_profile_region(const char* name) { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_push_profile_region_f, name); + return ROCPROFSYS_DL_INVOKE(get_indirect().kokkosp_push_profile_region_f, name); } void kokkosp_pop_profile_region() { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_pop_profile_region_f); + return ROCPROFSYS_DL_INVOKE(get_indirect().kokkosp_pop_profile_region_f); } void kokkosp_create_profile_section(const char* name, uint32_t* secid) { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_create_profile_section_f, name, + return ROCPROFSYS_DL_INVOKE(get_indirect().kokkosp_create_profile_section_f, name, secid); } void kokkosp_destroy_profile_section(uint32_t secid) { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_destroy_profile_section_f, + return ROCPROFSYS_DL_INVOKE(get_indirect().kokkosp_destroy_profile_section_f, secid); } void kokkosp_start_profile_section(uint32_t secid) { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_start_profile_section_f, secid); + return ROCPROFSYS_DL_INVOKE(get_indirect().kokkosp_start_profile_section_f, secid); } void kokkosp_stop_profile_section(uint32_t secid) { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_stop_profile_section_f, secid); + return ROCPROFSYS_DL_INVOKE(get_indirect().kokkosp_stop_profile_section_f, secid); } void kokkosp_allocate_data(const SpaceHandle space, const char* label, const void* const ptr, const uint64_t size) { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_allocate_data_f, space, label, + return ROCPROFSYS_DL_INVOKE(get_indirect().kokkosp_allocate_data_f, space, label, ptr, size); } void kokkosp_deallocate_data(const SpaceHandle space, const char* label, const void* const ptr, const uint64_t size) { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_deallocate_data_f, space, label, + return ROCPROFSYS_DL_INVOKE(get_indirect().kokkosp_deallocate_data_f, space, label, ptr, size); } @@ -1033,31 +1033,31 @@ extern "C" const void* dst_ptr, SpaceHandle src_handle, const char* src_name, const void* src_ptr, uint64_t size) { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_begin_deep_copy_f, dst_handle, + return ROCPROFSYS_DL_INVOKE(get_indirect().kokkosp_begin_deep_copy_f, dst_handle, dst_name, dst_ptr, src_handle, src_name, src_ptr, size); } void kokkosp_end_deep_copy() { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_end_deep_copy_f); + return ROCPROFSYS_DL_INVOKE(get_indirect().kokkosp_end_deep_copy_f); } void kokkosp_profile_event(const char* name) { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_profile_event_f, name); + return ROCPROFSYS_DL_INVOKE(get_indirect().kokkosp_profile_event_f, name); } void kokkosp_dual_view_sync(const char* label, const void* const data, bool is_device) { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_dual_view_sync_f, label, data, + return ROCPROFSYS_DL_INVOKE(get_indirect().kokkosp_dual_view_sync_f, label, data, is_device); } void kokkosp_dual_view_modify(const char* label, const void* const data, bool is_device) { - return OMNITRACE_DL_INVOKE(get_indirect().kokkosp_dual_view_modify_f, label, data, + return ROCPROFSYS_DL_INVOKE(get_indirect().kokkosp_dual_view_modify_f, label, data, is_device); } @@ -1067,15 +1067,15 @@ extern "C" // //----------------------------------------------------------------------------------// -#if OMNITRACE_USE_ROCTRACER > 0 +#if ROCPROFSYS_USE_ROCTRACER > 0 bool OnLoad(HsaApiTable* table, uint64_t runtime_version, uint64_t failed_tool_count, const char* const* failed_tool_names) { - return OMNITRACE_DL_INVOKE(get_indirect().hsa_on_load_f, table, runtime_version, + return ROCPROFSYS_DL_INVOKE(get_indirect().hsa_on_load_f, table, runtime_version, failed_tool_count, failed_tool_names); } - void OnUnload() { return OMNITRACE_DL_INVOKE(get_indirect().hsa_on_unload_f); } + void OnUnload() { return ROCPROFSYS_DL_INVOKE(get_indirect().hsa_on_unload_f); } #endif //----------------------------------------------------------------------------------// @@ -1084,22 +1084,22 @@ extern "C" // //----------------------------------------------------------------------------------// -#if OMNITRACE_USE_ROCPROFILER > 0 +#if ROCPROFSYS_USE_ROCPROFILER > 0 void OnLoadToolProp(void* settings) { - OMNITRACE_DL_LOG( + ROCPROFSYS_DL_LOG( -16, "invoking %s(rocprofiler_settings_t*) within librocprof-sys-dl.so " "will cause a silent failure for rocprofiler. ROCP_TOOL_LIB " "should be set to librocprof-sys.so\n", __FUNCTION__); abort(); - return OMNITRACE_DL_INVOKE(get_indirect().rocp_on_load_tool_prop_f, settings); + return ROCPROFSYS_DL_INVOKE(get_indirect().rocp_on_load_tool_prop_f, settings); } void OnUnloadTool() { - return OMNITRACE_DL_INVOKE(get_indirect().rocp_on_unload_tool_f); + return ROCPROFSYS_DL_INVOKE(get_indirect().rocp_on_unload_tool_f); } #endif @@ -1108,11 +1108,11 @@ extern "C" // OMPT // //----------------------------------------------------------------------------------// -#if OMNITRACE_USE_OMPT > 0 +#if ROCPROFSYS_USE_OMPT > 0 ompt_start_tool_result_t* ompt_start_tool(unsigned int omp_version, const char* runtime_version) { - return OMNITRACE_DL_INVOKE(get_indirect().ompt_start_tool_f, omp_version, + return ROCPROFSYS_DL_INVOKE(get_indirect().ompt_start_tool_f, omp_version, runtime_version); } #endif @@ -1125,17 +1125,17 @@ namespace dl namespace { bool -omnitrace_preload() OMNITRACE_INTERNAL_API; +omnitrace_preload() ROCPROFSYS_INTERNAL_API; std::vector get_link_map(const char*, - std::vector&& = { (RTLD_LAZY | RTLD_NOLOAD) }) OMNITRACE_INTERNAL_API; + std::vector&& = { (RTLD_LAZY | RTLD_NOLOAD) }) ROCPROFSYS_INTERNAL_API; const char* -get_default_mode() OMNITRACE_INTERNAL_API; +get_default_mode() ROCPROFSYS_INTERNAL_API; void -verify_instrumented_preloaded() OMNITRACE_INTERNAL_API; +verify_instrumented_preloaded() ROCPROFSYS_INTERNAL_API; std::vector get_link_map(const char* _name, std::vector&& _open_modes) @@ -1207,7 +1207,7 @@ omnitrace_preinit() // we may intercept the MPI init call later. // If _use_mpi defaults to true above, calling this // will override can current env or config value for - // OMNITRACE_USE_PID. + // ROCPROFSYS_USE_PID. omnitrace_set_mpi(_use_mpi, dl::get_instrumented() == dl::InstrumentMode::ProcessAttach); } @@ -1393,8 +1393,8 @@ main_func_t main_real = nullptr; extern "C" { - int omnitrace_main(int argc, char** argv, char** envp) OMNITRACE_INTERNAL_API; - void omnitrace_set_main(main_func_t) OMNITRACE_INTERNAL_API; + int omnitrace_main(int argc, char** argv, char** envp) ROCPROFSYS_INTERNAL_API; + void omnitrace_set_main(main_func_t) ROCPROFSYS_INTERNAL_API; void omnitrace_set_main(main_func_t _main_real) { @@ -1403,7 +1403,7 @@ extern "C" int omnitrace_main(int argc, char** argv, char** envp) { - OMNITRACE_DL_LOG(0, "%s\n", __FUNCTION__); + ROCPROFSYS_DL_LOG(0, "%s\n", __FUNCTION__); using ::omnitrace::common::get_env; using ::omnitrace::dl::get_default_mode; @@ -1430,7 +1430,7 @@ extern "C" { auto _var = std::string{ _env_v }.substr(0, _pos); auto _val = std::string{ _env_v }.substr(_pos + 1); - OMNITRACE_DL_LOG(1, "%s(%s, %s)\n", "omnitrace_set_env", _var.c_str(), + ROCPROFSYS_DL_LOG(1, "%s(%s, %s)\n", "omnitrace_set_env", _var.c_str(), _val.c_str()); setenv(_var.c_str(), _val.c_str(), 0); } diff --git a/source/lib/omnitrace-dl/dl/dl.hpp b/source/lib/omnitrace-dl/dl/dl.hpp index f04f0a50..2177bb00 100644 --- a/source/lib/omnitrace-dl/dl/dl.hpp +++ b/source/lib/omnitrace-dl/dl/dl.hpp @@ -20,14 +20,14 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -#ifndef OMNITRACE_DL_HPP_ -#define OMNITRACE_DL_HPP_ +#ifndef ROCPROFSYS_DL_HPP_ +#define ROCPROFSYS_DL_HPP_ -#if defined(OMNITRACE_DL_SOURCE) && (OMNITRACE_DL_SOURCE > 0) +#if defined(ROCPROFSYS_DL_SOURCE) && (ROCPROFSYS_DL_SOURCE > 0) # include "common/defines.h" #else -# if !defined(OMNITRACE_PUBLIC_API) -# define OMNITRACE_PUBLIC_API +# if !defined(ROCPROFSYS_PUBLIC_API) +# define ROCPROFSYS_PUBLIC_API # endif #endif @@ -49,16 +49,16 @@ #include #include -#if !defined(OMNITRACE_USE_OMPT) -# define OMNITRACE_USE_OMPT 0 +#if !defined(ROCPROFSYS_USE_OMPT) +# define ROCPROFSYS_USE_OMPT 0 #endif -#if !defined(OMNITRACE_USE_ROCTRACER) -# define OMNITRACE_USE_ROCTRACER 0 +#if !defined(ROCPROFSYS_USE_ROCTRACER) +# define ROCPROFSYS_USE_ROCTRACER 0 #endif -#if !defined(OMNITRACE_USE_ROCPROFILER) -# define OMNITRACE_USE_ROCPROFILER 0 +#if !defined(ROCPROFSYS_USE_ROCPROFILER) +# define ROCPROFSYS_USE_ROCPROFILER 0 #endif //--------------------------------------------------------------------------------------// @@ -69,125 +69,125 @@ extern "C" { - void omnitrace_init_library(void) OMNITRACE_PUBLIC_API; - void omnitrace_init_tooling(void) OMNITRACE_PUBLIC_API; - void omnitrace_init(const char*, bool, const char*) OMNITRACE_PUBLIC_API; - void omnitrace_finalize(void) OMNITRACE_PUBLIC_API; + void omnitrace_init_library(void) ROCPROFSYS_PUBLIC_API; + void omnitrace_init_tooling(void) ROCPROFSYS_PUBLIC_API; + void omnitrace_init(const char*, bool, const char*) ROCPROFSYS_PUBLIC_API; + void omnitrace_finalize(void) ROCPROFSYS_PUBLIC_API; void omnitrace_set_env(const char* env_name, - const char* env_val) OMNITRACE_PUBLIC_API; - void omnitrace_set_mpi(bool use, bool attached) OMNITRACE_PUBLIC_API; - void omnitrace_set_instrumented(int) OMNITRACE_PUBLIC_API; - void omnitrace_push_trace(const char* name) OMNITRACE_PUBLIC_API; - void omnitrace_pop_trace(const char* name) OMNITRACE_PUBLIC_API; - int omnitrace_push_region(const char*) OMNITRACE_PUBLIC_API; - int omnitrace_pop_region(const char*) OMNITRACE_PUBLIC_API; + const char* env_val) ROCPROFSYS_PUBLIC_API; + void omnitrace_set_mpi(bool use, bool attached) ROCPROFSYS_PUBLIC_API; + void omnitrace_set_instrumented(int) ROCPROFSYS_PUBLIC_API; + void omnitrace_push_trace(const char* name) ROCPROFSYS_PUBLIC_API; + void omnitrace_pop_trace(const char* name) ROCPROFSYS_PUBLIC_API; + int omnitrace_push_region(const char*) ROCPROFSYS_PUBLIC_API; + int omnitrace_pop_region(const char*) ROCPROFSYS_PUBLIC_API; int omnitrace_push_category_region(omnitrace_category_t, const char*, omnitrace_annotation_t*, - size_t) OMNITRACE_PUBLIC_API; + size_t) ROCPROFSYS_PUBLIC_API; int omnitrace_pop_category_region(omnitrace_category_t, const char*, omnitrace_annotation_t*, - size_t) OMNITRACE_PUBLIC_API; + size_t) ROCPROFSYS_PUBLIC_API; void omnitrace_register_source(const char* file, const char* func, size_t line, size_t address, - const char* source) OMNITRACE_PUBLIC_API; + const char* source) ROCPROFSYS_PUBLIC_API; void omnitrace_register_coverage(const char* file, const char* func, - size_t address) OMNITRACE_PUBLIC_API; - void omnitrace_progress(const char*) OMNITRACE_PUBLIC_API; + size_t address) ROCPROFSYS_PUBLIC_API; + void omnitrace_progress(const char*) ROCPROFSYS_PUBLIC_API; void omnitrace_annotated_progress(const char*, omnitrace_annotation_t*, - size_t) OMNITRACE_PUBLIC_API; + size_t) ROCPROFSYS_PUBLIC_API; -#if defined(OMNITRACE_DL_SOURCE) && (OMNITRACE_DL_SOURCE > 0) - void omnitrace_preinit_library(void) OMNITRACE_HIDDEN_API; - int omnitrace_preload_library(void) OMNITRACE_HIDDEN_API; +#if defined(ROCPROFSYS_DL_SOURCE) && (ROCPROFSYS_DL_SOURCE > 0) + void omnitrace_preinit_library(void) ROCPROFSYS_HIDDEN_API; + int omnitrace_preload_library(void) ROCPROFSYS_HIDDEN_API; - int omnitrace_user_start_trace_dl(void) OMNITRACE_HIDDEN_API; - int omnitrace_user_stop_trace_dl(void) OMNITRACE_HIDDEN_API; + int omnitrace_user_start_trace_dl(void) ROCPROFSYS_HIDDEN_API; + int omnitrace_user_stop_trace_dl(void) ROCPROFSYS_HIDDEN_API; - int omnitrace_user_start_thread_trace_dl(void) OMNITRACE_HIDDEN_API; - int omnitrace_user_stop_thread_trace_dl(void) OMNITRACE_HIDDEN_API; + int omnitrace_user_start_thread_trace_dl(void) ROCPROFSYS_HIDDEN_API; + int omnitrace_user_stop_thread_trace_dl(void) ROCPROFSYS_HIDDEN_API; - int omnitrace_user_push_region_dl(const char*) OMNITRACE_HIDDEN_API; - int omnitrace_user_pop_region_dl(const char*) OMNITRACE_HIDDEN_API; + int omnitrace_user_push_region_dl(const char*) ROCPROFSYS_HIDDEN_API; + int omnitrace_user_pop_region_dl(const char*) ROCPROFSYS_HIDDEN_API; int omnitrace_user_push_annotated_region_dl(const char*, omnitrace_annotation_t*, - size_t) OMNITRACE_HIDDEN_API; + size_t) ROCPROFSYS_HIDDEN_API; int omnitrace_user_pop_annotated_region_dl(const char*, omnitrace_annotation_t*, - size_t) OMNITRACE_HIDDEN_API; + size_t) ROCPROFSYS_HIDDEN_API; - int omnitrace_user_progress_dl(const char* name) OMNITRACE_HIDDEN_API; + int omnitrace_user_progress_dl(const char* name) ROCPROFSYS_HIDDEN_API; int omnitrace_user_annotated_progress_dl(const char*, omnitrace_annotation_t*, - size_t) OMNITRACE_HIDDEN_API; + size_t) ROCPROFSYS_HIDDEN_API; // KokkosP - struct OMNITRACE_HIDDEN_API SpaceHandle + struct ROCPROFSYS_HIDDEN_API SpaceHandle { char name[64]; }; - struct OMNITRACE_HIDDEN_API Kokkos_Tools_ToolSettings + struct ROCPROFSYS_HIDDEN_API Kokkos_Tools_ToolSettings { bool requires_global_fencing; bool padding[255]; }; - void kokkosp_print_help(char*) OMNITRACE_PUBLIC_API; - void kokkosp_parse_args(int, char**) OMNITRACE_PUBLIC_API; - void kokkosp_declare_metadata(const char*, const char*) OMNITRACE_PUBLIC_API; + void kokkosp_print_help(char*) ROCPROFSYS_PUBLIC_API; + void kokkosp_parse_args(int, char**) ROCPROFSYS_PUBLIC_API; + void kokkosp_declare_metadata(const char*, const char*) ROCPROFSYS_PUBLIC_API; void kokkosp_request_tool_settings(const uint32_t, - Kokkos_Tools_ToolSettings*) OMNITRACE_PUBLIC_API; + Kokkos_Tools_ToolSettings*) ROCPROFSYS_PUBLIC_API; void kokkosp_init_library(const int, const uint64_t, const uint32_t, - void*) OMNITRACE_PUBLIC_API; - void kokkosp_finalize_library() OMNITRACE_PUBLIC_API; + void*) ROCPROFSYS_PUBLIC_API; + void kokkosp_finalize_library() ROCPROFSYS_PUBLIC_API; void kokkosp_begin_parallel_for(const char*, uint32_t, - uint64_t*) OMNITRACE_PUBLIC_API; - void kokkosp_end_parallel_for(uint64_t) OMNITRACE_PUBLIC_API; + uint64_t*) ROCPROFSYS_PUBLIC_API; + void kokkosp_end_parallel_for(uint64_t) ROCPROFSYS_PUBLIC_API; void kokkosp_begin_parallel_reduce(const char*, uint32_t, - uint64_t*) OMNITRACE_PUBLIC_API; - void kokkosp_end_parallel_reduce(uint64_t) OMNITRACE_PUBLIC_API; + uint64_t*) ROCPROFSYS_PUBLIC_API; + void kokkosp_end_parallel_reduce(uint64_t) ROCPROFSYS_PUBLIC_API; void kokkosp_begin_parallel_scan(const char*, uint32_t, - uint64_t*) OMNITRACE_PUBLIC_API; - void kokkosp_end_parallel_scan(uint64_t) OMNITRACE_PUBLIC_API; - void kokkosp_begin_fence(const char*, uint32_t, uint64_t*) OMNITRACE_PUBLIC_API; - void kokkosp_end_fence(uint64_t) OMNITRACE_PUBLIC_API; - void kokkosp_push_profile_region(const char*) OMNITRACE_PUBLIC_API; - void kokkosp_pop_profile_region() OMNITRACE_PUBLIC_API; - void kokkosp_create_profile_section(const char*, uint32_t*) OMNITRACE_PUBLIC_API; - void kokkosp_destroy_profile_section(uint32_t) OMNITRACE_PUBLIC_API; - void kokkosp_start_profile_section(uint32_t) OMNITRACE_PUBLIC_API; - void kokkosp_stop_profile_section(uint32_t) OMNITRACE_PUBLIC_API; + uint64_t*) ROCPROFSYS_PUBLIC_API; + void kokkosp_end_parallel_scan(uint64_t) ROCPROFSYS_PUBLIC_API; + void kokkosp_begin_fence(const char*, uint32_t, uint64_t*) ROCPROFSYS_PUBLIC_API; + void kokkosp_end_fence(uint64_t) ROCPROFSYS_PUBLIC_API; + void kokkosp_push_profile_region(const char*) ROCPROFSYS_PUBLIC_API; + void kokkosp_pop_profile_region() ROCPROFSYS_PUBLIC_API; + void kokkosp_create_profile_section(const char*, uint32_t*) ROCPROFSYS_PUBLIC_API; + void kokkosp_destroy_profile_section(uint32_t) ROCPROFSYS_PUBLIC_API; + void kokkosp_start_profile_section(uint32_t) ROCPROFSYS_PUBLIC_API; + void kokkosp_stop_profile_section(uint32_t) ROCPROFSYS_PUBLIC_API; void kokkosp_allocate_data(const SpaceHandle, const char*, const void* const, - const uint64_t) OMNITRACE_PUBLIC_API; + const uint64_t) ROCPROFSYS_PUBLIC_API; void kokkosp_deallocate_data(const SpaceHandle, const char*, const void* const, - const uint64_t) OMNITRACE_PUBLIC_API; + const uint64_t) ROCPROFSYS_PUBLIC_API; void kokkosp_begin_deep_copy(SpaceHandle, const char*, const void*, SpaceHandle, - const char*, const void*, uint64_t) OMNITRACE_PUBLIC_API; - void kokkosp_end_deep_copy() OMNITRACE_PUBLIC_API; - void kokkosp_profile_event(const char*) OMNITRACE_PUBLIC_API; + const char*, const void*, uint64_t) ROCPROFSYS_PUBLIC_API; + void kokkosp_end_deep_copy() ROCPROFSYS_PUBLIC_API; + void kokkosp_profile_event(const char*) ROCPROFSYS_PUBLIC_API; void kokkosp_dual_view_sync(const char*, const void* const, - bool) OMNITRACE_PUBLIC_API; + bool) ROCPROFSYS_PUBLIC_API; void kokkosp_dual_view_modify(const char*, const void* const, - bool) OMNITRACE_PUBLIC_API; + bool) ROCPROFSYS_PUBLIC_API; // OpenMP Tools (OMPT) -# if OMNITRACE_USE_OMPT > 0 +# if ROCPROFSYS_USE_OMPT > 0 struct ompt_start_tool_result_t; ompt_start_tool_result_t* ompt_start_tool(unsigned int, - const char*) OMNITRACE_PUBLIC_API; + const char*) ROCPROFSYS_PUBLIC_API; # endif -# if OMNITRACE_USE_ROCTRACER > 0 +# if ROCPROFSYS_USE_ROCTRACER > 0 // HSA struct HsaApiTable; bool OnLoad(HsaApiTable* table, uint64_t runtime_version, uint64_t failed_tool_count, - const char* const* failed_tool_names) OMNITRACE_PUBLIC_API; - void OnUnload() OMNITRACE_PUBLIC_API; + const char* const* failed_tool_names) ROCPROFSYS_PUBLIC_API; + void OnUnload() ROCPROFSYS_PUBLIC_API; # endif -# if OMNITRACE_USE_ROCPROFILER > 0 +# if ROCPROFSYS_USE_ROCPROFILER > 0 // ROCP - void OnLoadToolProp(void* settings) OMNITRACE_PUBLIC_API; - void OnUnloadTool() OMNITRACE_PUBLIC_API; + void OnLoadToolProp(void* settings) ROCPROFSYS_PUBLIC_API; + void OnUnloadTool() ROCPROFSYS_PUBLIC_API; # endif #endif } @@ -208,4 +208,4 @@ enum class InstrumentMode : int } } // namespace omnitrace -#endif // OMNITRACE_DL_HPP_ 1 +#endif // ROCPROFSYS_DL_HPP_ 1 diff --git a/source/lib/omnitrace-dl/main.c b/source/lib/omnitrace-dl/main.c index cb9c8d32..38ee887e 100644 --- a/source/lib/omnitrace-dl/main.c +++ b/source/lib/omnitrace-dl/main.c @@ -22,9 +22,9 @@ #define _GNU_SOURCE -#define OMNITRACE_PUBLIC_API __attribute__((visibility("default"))); -#define OMNITRACE_HIDDEN_API __attribute__((visibility("hidden"))); -#define OMNITRACE_INTERNAL_API __attribute__((visibility("internal"))); +#define ROCPROFSYS_PUBLIC_API __attribute__((visibility("default"))); +#define ROCPROFSYS_HIDDEN_API __attribute__((visibility("hidden"))); +#define ROCPROFSYS_INTERNAL_API __attribute__((visibility("internal"))); #include #include @@ -47,11 +47,11 @@ typedef int (*start_main_t)(int (*)(int, char**, char**), int, char**, int omnitrace_libc_start_main(int (*)(int, char**, char**), int, char**, int (*)(int, char**, char**), void (*)(void), void (*)(void), - void*) OMNITRACE_INTERNAL_API; + void*) ROCPROFSYS_INTERNAL_API; int __libc_start_main(int (*)(int, char**, char**), int, char**, int (*)(int, char**, char**), - void (*)(void), void (*)(void), void*) OMNITRACE_PUBLIC_API; + void (*)(void), void (*)(void), void*) ROCPROFSYS_PUBLIC_API; // // external function declarations @@ -77,10 +77,10 @@ omnitrace_init(const char*, bool, const char*); extern char* basename(const char*); -extern void omnitrace_set_main(main_func_t) OMNITRACE_INTERNAL_API; +extern void omnitrace_set_main(main_func_t) ROCPROFSYS_INTERNAL_API; extern int -omnitrace_main(int argc, char** argv, char** envp) OMNITRACE_INTERNAL_API; +omnitrace_main(int argc, char** argv, char** envp) ROCPROFSYS_INTERNAL_API; int omnitrace_libc_start_main(int (*_main)(int, char**, char**), int _argc, char** _argv, diff --git a/source/lib/omnitrace-rt/CMakeLists.txt b/source/lib/omnitrace-rt/CMakeLists.txt index 2481a12a..438286af 100644 --- a/source/lib/omnitrace-rt/CMakeLists.txt +++ b/source/lib/omnitrace-rt/CMakeLists.txt @@ -114,7 +114,7 @@ set_target_properties( BUILD_RPATH "\$ORIGIN" INSTALL_RPATH "\$ORIGIN") -omnitrace_strip_target(rocprofsys-rt-library) +rocprofsys_strip_target(rocprofsys-rt-library) install(TARGETS rocprofsys-rt-library DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/source/lib/omnitrace-rt/cmake/platform.cmake b/source/lib/omnitrace-rt/cmake/platform.cmake index ae737009..2b4a2844 100644 --- a/source/lib/omnitrace-rt/cmake/platform.cmake +++ b/source/lib/omnitrace-rt/cmake/platform.cmake @@ -29,14 +29,14 @@ if(INVALID_PLATFORM) OUTPUT_VARIABLE DYNSYSNAME_OUT OUTPUT_STRIP_TRAILING_WHITESPACE) string(REPLACE "\n" "" PLATFORM ${DYNSYSNAME_OUT}) - omnitrace_message(STATUS + rocprofsys_message(STATUS "-- Attempting to automatically identify platform: ${PLATFORM}") endif() list(FIND VALID_PLATFORMS ${PLATFORM} PLATFORM_FOUND) if(PLATFORM_FOUND EQUAL -1) - omnitrace_message( + rocprofsys_message( FATAL_ERROR "Error: unknown platform ${PLATFORM}; please set the PLATFORM environment variable to one of the following options: ${VALID_PLATFORMS}" ) diff --git a/source/lib/omnitrace-user/CMakeLists.txt b/source/lib/omnitrace-user/CMakeLists.txt index 04f47aef..35b5812b 100644 --- a/source/lib/omnitrace-user/CMakeLists.txt +++ b/source/lib/omnitrace-user/CMakeLists.txt @@ -38,7 +38,7 @@ set_target_properties( BUILD_RPATH "\$ORIGIN" INSTALL_RPATH "\$ORIGIN") -omnitrace_strip_target(rocprofsys-user-library) +rocprofsys_strip_target(rocprofsys-user-library) foreach(_HEADER ${_user_headers}) string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/omnitrace/" diff --git a/source/lib/omnitrace-user/omnitrace/categories.h b/source/lib/omnitrace-user/omnitrace/categories.h index dd435e50..c567ef2f 100644 --- a/source/lib/omnitrace-user/omnitrace/categories.h +++ b/source/lib/omnitrace-user/omnitrace/categories.h @@ -20,8 +20,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -#ifndef OMNITRACE_CATEGORIES_H_ -#define OMNITRACE_CATEGORIES_H_ +#ifndef ROCPROFSYS_CATEGORIES_H_ +#define ROCPROFSYS_CATEGORIES_H_ #include #include @@ -34,106 +34,106 @@ extern "C" /// @typedef omnitrace_category_t /// @brief Identifier for categories /// - typedef enum OMNITRACE_CATEGORIES + typedef enum ROCPROFSYS_CATEGORIES { // Do not use first enum value - OMNITRACE_CATEGORY_NONE = 0, + ROCPROFSYS_CATEGORY_NONE = 0, // arrange these in the order most likely to // be used since they have to be iterated over - OMNITRACE_CATEGORY_PYTHON, - OMNITRACE_CATEGORY_USER, - OMNITRACE_CATEGORY_HOST, - OMNITRACE_CATEGORY_DEVICE_HIP, - OMNITRACE_CATEGORY_DEVICE_HSA, - OMNITRACE_CATEGORY_ROCM_HIP, - OMNITRACE_CATEGORY_ROCM_HSA, - OMNITRACE_CATEGORY_ROCM_ROCTX, - OMNITRACE_CATEGORY_ROCM_SMI, - OMNITRACE_CATEGORY_ROCM_SMI_BUSY, - OMNITRACE_CATEGORY_ROCM_SMI_TEMP, - OMNITRACE_CATEGORY_ROCM_SMI_POWER, - OMNITRACE_CATEGORY_ROCM_SMI_MEMORY_USAGE, - OMNITRACE_CATEGORY_ROCM_RCCL, - OMNITRACE_CATEGORY_ROCTRACER, - OMNITRACE_CATEGORY_ROCPROFILER, - OMNITRACE_CATEGORY_SAMPLING, - OMNITRACE_CATEGORY_PTHREAD, - OMNITRACE_CATEGORY_KOKKOS, - OMNITRACE_CATEGORY_MPI, - OMNITRACE_CATEGORY_OMPT, - OMNITRACE_CATEGORY_PROCESS_SAMPLING, - OMNITRACE_CATEGORY_COMM_DATA, - OMNITRACE_CATEGORY_CAUSAL, - OMNITRACE_CATEGORY_CPU_FREQ, - OMNITRACE_CATEGORY_PROCESS_PAGE, - OMNITRACE_CATEGORY_PROCESS_VIRT, - OMNITRACE_CATEGORY_PROCESS_PEAK, - OMNITRACE_CATEGORY_PROCESS_CONTEXT_SWITCH, - OMNITRACE_CATEGORY_PROCESS_PAGE_FAULT, - OMNITRACE_CATEGORY_PROCESS_USER_MODE_TIME, - OMNITRACE_CATEGORY_PROCESS_KERNEL_MODE_TIME, - OMNITRACE_CATEGORY_THREAD_WALL_TIME, - OMNITRACE_CATEGORY_THREAD_CPU_TIME, - OMNITRACE_CATEGORY_THREAD_PAGE_FAULT, - OMNITRACE_CATEGORY_THREAD_PEAK_MEMORY, - OMNITRACE_CATEGORY_THREAD_CONTEXT_SWITCH, - OMNITRACE_CATEGORY_THREAD_HARDWARE_COUNTER, - OMNITRACE_CATEGORY_KERNEL_HARDWARE_COUNTER, - OMNITRACE_CATEGORY_NUMA, - OMNITRACE_CATEGORY_TIMER_SAMPLING, - OMNITRACE_CATEGORY_OVERFLOW_SAMPLING, - OMNITRACE_CATEGORY_LAST + ROCPROFSYS_CATEGORY_PYTHON, + ROCPROFSYS_CATEGORY_USER, + ROCPROFSYS_CATEGORY_HOST, + ROCPROFSYS_CATEGORY_DEVICE_HIP, + ROCPROFSYS_CATEGORY_DEVICE_HSA, + ROCPROFSYS_CATEGORY_ROCM_HIP, + ROCPROFSYS_CATEGORY_ROCM_HSA, + ROCPROFSYS_CATEGORY_ROCM_ROCTX, + ROCPROFSYS_CATEGORY_ROCM_SMI, + ROCPROFSYS_CATEGORY_ROCM_SMI_BUSY, + ROCPROFSYS_CATEGORY_ROCM_SMI_TEMP, + ROCPROFSYS_CATEGORY_ROCM_SMI_POWER, + ROCPROFSYS_CATEGORY_ROCM_SMI_MEMORY_USAGE, + ROCPROFSYS_CATEGORY_ROCM_RCCL, + ROCPROFSYS_CATEGORY_ROCTRACER, + ROCPROFSYS_CATEGORY_ROCPROFILER, + ROCPROFSYS_CATEGORY_SAMPLING, + ROCPROFSYS_CATEGORY_PTHREAD, + ROCPROFSYS_CATEGORY_KOKKOS, + ROCPROFSYS_CATEGORY_MPI, + ROCPROFSYS_CATEGORY_OMPT, + ROCPROFSYS_CATEGORY_PROCESS_SAMPLING, + ROCPROFSYS_CATEGORY_COMM_DATA, + ROCPROFSYS_CATEGORY_CAUSAL, + ROCPROFSYS_CATEGORY_CPU_FREQ, + ROCPROFSYS_CATEGORY_PROCESS_PAGE, + ROCPROFSYS_CATEGORY_PROCESS_VIRT, + ROCPROFSYS_CATEGORY_PROCESS_PEAK, + ROCPROFSYS_CATEGORY_PROCESS_CONTEXT_SWITCH, + ROCPROFSYS_CATEGORY_PROCESS_PAGE_FAULT, + ROCPROFSYS_CATEGORY_PROCESS_USER_MODE_TIME, + ROCPROFSYS_CATEGORY_PROCESS_KERNEL_MODE_TIME, + ROCPROFSYS_CATEGORY_THREAD_WALL_TIME, + ROCPROFSYS_CATEGORY_THREAD_CPU_TIME, + ROCPROFSYS_CATEGORY_THREAD_PAGE_FAULT, + ROCPROFSYS_CATEGORY_THREAD_PEAK_MEMORY, + ROCPROFSYS_CATEGORY_THREAD_CONTEXT_SWITCH, + ROCPROFSYS_CATEGORY_THREAD_HARDWARE_COUNTER, + ROCPROFSYS_CATEGORY_KERNEL_HARDWARE_COUNTER, + ROCPROFSYS_CATEGORY_NUMA, + ROCPROFSYS_CATEGORY_TIMER_SAMPLING, + ROCPROFSYS_CATEGORY_OVERFLOW_SAMPLING, + ROCPROFSYS_CATEGORY_LAST // the value of below enum is used for iterating // over the enum in C++ templates. It MUST // be the last enumerated id } omnitrace_category_t; - /// @enum OMNITRACE_ANNOTATION_TYPE + /// @enum ROCPROFSYS_ANNOTATION_TYPE /// @brief Identifier for the data type of the annotation. /// if the data type is not a pointer, pass the address of /// data. - /// @typedef OMNITRACE_ANNOTATION_TYPE omnitrace_annotation_type_t - typedef enum OMNITRACE_ANNOTATION_TYPE + /// @typedef ROCPROFSYS_ANNOTATION_TYPE omnitrace_annotation_type_t + typedef enum ROCPROFSYS_ANNOTATION_TYPE { // Do not use first enum value - OMNITRACE_VALUE_NONE = 0, + ROCPROFSYS_VALUE_NONE = 0, // arrange these in the order most likely to // be used since they have to be iterated over - OMNITRACE_VALUE_CSTR = 1, - OMNITRACE_STRING = OMNITRACE_VALUE_CSTR, - OMNITRACE_VALUE_SIZE_T = 2, - OMNITRACE_SIZE_T = OMNITRACE_VALUE_SIZE_T, - OMNITRACE_VALUE_INT64 = 3, - OMNITRACE_INT64 = OMNITRACE_VALUE_INT64, - OMNITRACE_I64 = OMNITRACE_VALUE_INT64, - OMNITRACE_VALUE_UINT64 = 4, - OMNITRACE_UINT64 = OMNITRACE_VALUE_UINT64, - OMNITRACE_U64 = OMNITRACE_VALUE_UINT64, - OMNITRACE_VALUE_FLOAT64 = 5, - OMNITRACE_FLOAT64 = OMNITRACE_VALUE_FLOAT64, - OMNITRACE_FP64 = OMNITRACE_VALUE_FLOAT64, - OMNITRACE_VALUE_VOID_P = 6, - OMNITRACE_VOID_P = OMNITRACE_VALUE_VOID_P, - OMNITRACE_PTR = OMNITRACE_VALUE_VOID_P, - OMNITRACE_VALUE_INT32 = 7, - OMNITRACE_INT32 = OMNITRACE_VALUE_INT32, - OMNITRACE_I32 = OMNITRACE_VALUE_INT32, - OMNITRACE_VALUE_UINT32 = 8, - OMNITRACE_UINT32 = OMNITRACE_VALUE_UINT32, - OMNITRACE_U32 = OMNITRACE_VALUE_UINT32, - OMNITRACE_VALUE_FLOAT32 = 9, - OMNITRACE_FLOAT32 = OMNITRACE_VALUE_FLOAT32, - OMNITRACE_FP32 = OMNITRACE_VALUE_FLOAT32, - OMNITRACE_VALUE_INT16 = 10, - OMNITRACE_INT16 = OMNITRACE_VALUE_INT16, - OMNITRACE_I16 = OMNITRACE_VALUE_INT16, - OMNITRACE_VALUE_UINT16 = 11, - OMNITRACE_UINT16 = OMNITRACE_VALUE_UINT16, - OMNITRACE_U16 = OMNITRACE_VALUE_UINT16, + ROCPROFSYS_VALUE_CSTR = 1, + ROCPROFSYS_STRING = ROCPROFSYS_VALUE_CSTR, + ROCPROFSYS_VALUE_SIZE_T = 2, + ROCPROFSYS_SIZE_T = ROCPROFSYS_VALUE_SIZE_T, + ROCPROFSYS_VALUE_INT64 = 3, + ROCPROFSYS_INT64 = ROCPROFSYS_VALUE_INT64, + ROCPROFSYS_I64 = ROCPROFSYS_VALUE_INT64, + ROCPROFSYS_VALUE_UINT64 = 4, + ROCPROFSYS_UINT64 = ROCPROFSYS_VALUE_UINT64, + ROCPROFSYS_U64 = ROCPROFSYS_VALUE_UINT64, + ROCPROFSYS_VALUE_FLOAT64 = 5, + ROCPROFSYS_FLOAT64 = ROCPROFSYS_VALUE_FLOAT64, + ROCPROFSYS_FP64 = ROCPROFSYS_VALUE_FLOAT64, + ROCPROFSYS_VALUE_VOID_P = 6, + ROCPROFSYS_VOID_P = ROCPROFSYS_VALUE_VOID_P, + ROCPROFSYS_PTR = ROCPROFSYS_VALUE_VOID_P, + ROCPROFSYS_VALUE_INT32 = 7, + ROCPROFSYS_INT32 = ROCPROFSYS_VALUE_INT32, + ROCPROFSYS_I32 = ROCPROFSYS_VALUE_INT32, + ROCPROFSYS_VALUE_UINT32 = 8, + ROCPROFSYS_UINT32 = ROCPROFSYS_VALUE_UINT32, + ROCPROFSYS_U32 = ROCPROFSYS_VALUE_UINT32, + ROCPROFSYS_VALUE_FLOAT32 = 9, + ROCPROFSYS_FLOAT32 = ROCPROFSYS_VALUE_FLOAT32, + ROCPROFSYS_FP32 = ROCPROFSYS_VALUE_FLOAT32, + ROCPROFSYS_VALUE_INT16 = 10, + ROCPROFSYS_INT16 = ROCPROFSYS_VALUE_INT16, + ROCPROFSYS_I16 = ROCPROFSYS_VALUE_INT16, + ROCPROFSYS_VALUE_UINT16 = 11, + ROCPROFSYS_UINT16 = ROCPROFSYS_VALUE_UINT16, + ROCPROFSYS_U16 = ROCPROFSYS_VALUE_UINT16, // the value of below enum is used for iterating // over the enum in C++ templates. It MUST // be the last enumerated id - OMNITRACE_VALUE_LAST + ROCPROFSYS_VALUE_LAST } omnitrace_annotation_type_t; /// @struct omnitrace_annotation @@ -150,11 +150,11 @@ extern "C" /// compute(size_t n, double* data, size_t nitr, double tolerance) /// { /// omnitrace_annotation_t _annotations[] = { - /// { "iteration", OMNITRACE_VALUE_SIZE_T, nullptr }, - /// { "residual", OMNITRACE_VALUE_FLOAT64, nullptr }, - /// { "data", OMNITRACE_VALUE_PTR, data }, - /// { "size", OMNITRACE_VALUE_SIZE_T, &n }, - /// { "tolerance", OMNITRACE_VALUE_FLOAT64, &tolerance }, + /// { "iteration", ROCPROFSYS_VALUE_SIZE_T, nullptr }, + /// { "residual", ROCPROFSYS_VALUE_FLOAT64, nullptr }, + /// { "data", ROCPROFSYS_VALUE_PTR, data }, + /// { "size", ROCPROFSYS_VALUE_SIZE_T, &n }, + /// { "tolerance", ROCPROFSYS_VALUE_FLOAT64, &tolerance }, /// nullptr /// }; /// @@ -188,4 +188,4 @@ extern "C" } #endif -#endif // OMNITRACE_TYPES_H_ +#endif // ROCPROFSYS_TYPES_H_ diff --git a/source/lib/omnitrace-user/omnitrace/causal.h b/source/lib/omnitrace-user/omnitrace/causal.h index b5b1b514..a81d6eaa 100644 --- a/source/lib/omnitrace-user/omnitrace/causal.h +++ b/source/lib/omnitrace-user/omnitrace/causal.h @@ -22,65 +22,65 @@ /** @file causal.h */ -#ifndef OMNITRACE_CAUSAL_H_ -#define OMNITRACE_CAUSAL_H_ +#ifndef ROCPROFSYS_CAUSAL_H_ +#define ROCPROFSYS_CAUSAL_H_ /** - * @defgroup OMNITRACE_CASUAL_GROUP OmniTrace Causal Profiling Defines + * @defgroup ROCPROFSYS_CASUAL_GROUP OmniTrace Causal Profiling Defines * * @{ */ -#if !defined(OMNITRACE_CAUSAL_ENABLED) +#if !defined(ROCPROFSYS_CAUSAL_ENABLED) /** Preprocessor switch to enable/disable instrumentation for causal profiling */ -# define OMNITRACE_CAUSAL_ENABLED 1 +# define ROCPROFSYS_CAUSAL_ENABLED 1 #endif -#if OMNITRACE_CAUSAL_ENABLED > 0 +#if ROCPROFSYS_CAUSAL_ENABLED > 0 # include -# if !defined(OMNITRACE_CAUSAL_LABEL) -/** @cond OMNITRACE_HIDDEN_DEFINES */ -# define OMNITRACE_CAUSAL_STR2(x) # x -# define OMNITRACE_CAUSAL_STR(x) OMNITRACE_CAUSAL_STR2(x) +# if !defined(ROCPROFSYS_CAUSAL_LABEL) +/** @cond ROCPROFSYS_HIDDEN_DEFINES */ +# define ROCPROFSYS_CAUSAL_STR2(x) # x +# define ROCPROFSYS_CAUSAL_STR(x) ROCPROFSYS_CAUSAL_STR2(x) /** @endcond */ /** Default label for a causal progress point */ -# define OMNITRACE_CAUSAL_LABEL __FILE__ ":" OMNITRACE_CAUSAL_STR(__LINE__) +# define ROCPROFSYS_CAUSAL_LABEL __FILE__ ":" ROCPROFSYS_CAUSAL_STR(__LINE__) # endif -# if !defined(OMNITRACE_CAUSAL_PROGRESS) +# if !defined(ROCPROFSYS_CAUSAL_PROGRESS) /** Adds a throughput progress point with label `:` */ -# define OMNITRACE_CAUSAL_PROGRESS omnitrace_user_progress(OMNITRACE_CAUSAL_LABEL); +# define ROCPROFSYS_CAUSAL_PROGRESS omnitrace_user_progress(ROCPROFSYS_CAUSAL_LABEL); # endif -# if !defined(OMNITRACE_CAUSAL_PROGRESS_NAMED) +# if !defined(ROCPROFSYS_CAUSAL_PROGRESS_NAMED) /** Adds a throughput progress point with user defined label. Each instance should use a * unique label. */ -# define OMNITRACE_CAUSAL_PROGRESS_NAMED(LABEL) omnitrace_user_progress(LABEL); +# define ROCPROFSYS_CAUSAL_PROGRESS_NAMED(LABEL) omnitrace_user_progress(LABEL); # endif -# if !defined(OMNITRACE_CAUSAL_BEGIN) +# if !defined(ROCPROFSYS_CAUSAL_BEGIN) /** Starts a latency progress point (region of interest) with user defined label. Each * instance should use a unique label. */ -# define OMNITRACE_CAUSAL_BEGIN(LABEL) omnitrace_user_push_region(LABEL); +# define ROCPROFSYS_CAUSAL_BEGIN(LABEL) omnitrace_user_push_region(LABEL); # endif -# if !defined(OMNITRACE_CAUSAL_END) +# if !defined(ROCPROFSYS_CAUSAL_END) /** End the latency progress point (region of interest) for the matching user defined * label. */ -# define OMNITRACE_CAUSAL_END(LABEL) omnitrace_user_pop_region(LABEL); +# define ROCPROFSYS_CAUSAL_END(LABEL) omnitrace_user_pop_region(LABEL); # endif #else -# if !defined(OMNITRACE_CAUSAL_PROGRESS) -# define OMNITRACE_CAUSAL_PROGRESS +# if !defined(ROCPROFSYS_CAUSAL_PROGRESS) +# define ROCPROFSYS_CAUSAL_PROGRESS # endif -# if !defined(OMNITRACE_CAUSAL_PROGRESS_NAMED) -# define OMNITRACE_CAUSAL_PROGRESS_NAMED(LABEL) +# if !defined(ROCPROFSYS_CAUSAL_PROGRESS_NAMED) +# define ROCPROFSYS_CAUSAL_PROGRESS_NAMED(LABEL) # endif -# if !defined(OMNITRACE_CAUSAL_BEGIN) -# define OMNITRACE_CAUSAL_BEGIN(LABEL) +# if !defined(ROCPROFSYS_CAUSAL_BEGIN) +# define ROCPROFSYS_CAUSAL_BEGIN(LABEL) # endif -# if !defined(OMNITRACE_CAUSAL_END) -# define OMNITRACE_CAUSAL_END(LABEL) +# if !defined(ROCPROFSYS_CAUSAL_END) +# define ROCPROFSYS_CAUSAL_END(LABEL) # endif #endif /** @} */ -#endif // OMNITRACE_CAUSAL_H_ +#endif // ROCPROFSYS_CAUSAL_H_ diff --git a/source/lib/omnitrace-user/omnitrace/types.h b/source/lib/omnitrace-user/omnitrace/types.h index 839e1caf..c05a0b7e 100644 --- a/source/lib/omnitrace-user/omnitrace/types.h +++ b/source/lib/omnitrace-user/omnitrace/types.h @@ -20,8 +20,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -#ifndef OMNITRACE_TYPES_H_ -#define OMNITRACE_TYPES_H_ +#ifndef ROCPROFSYS_TYPES_H_ +#define ROCPROFSYS_TYPES_H_ #include #include @@ -76,42 +76,42 @@ extern "C" /// @brief callback for marking an causal profiling event + annotations } omnitrace_user_callbacks_t; - /// @enum OMNITRACE_USER_CONFIGURE_MODE + /// @enum ROCPROFSYS_USER_CONFIGURE_MODE /// @brief Identifier for errors - /// @typedef OMNITRACE_USER_CONFIGURE_MODE omnitrace_user_configure_mode_t - typedef enum OMNITRACE_USER_CONFIGURE_MODE + /// @typedef ROCPROFSYS_USER_CONFIGURE_MODE omnitrace_user_configure_mode_t + typedef enum ROCPROFSYS_USER_CONFIGURE_MODE { // clang-format off - OMNITRACE_USER_UNION_CONFIG = 0, ///< Replace the callbacks in the current config with the non-null callbacks in the provided config - OMNITRACE_USER_REPLACE_CONFIG, ///< Replace the entire config even if the provided config has null callbacks - OMNITRACE_USER_INTERSECT_CONFIG, ///< Produce a config which is the intersection of the current config and the provided config - OMNITRACE_USER_CONFIGURE_MODE_LAST + ROCPROFSYS_USER_UNION_CONFIG = 0, ///< Replace the callbacks in the current config with the non-null callbacks in the provided config + ROCPROFSYS_USER_REPLACE_CONFIG, ///< Replace the entire config even if the provided config has null callbacks + ROCPROFSYS_USER_INTERSECT_CONFIG, ///< Produce a config which is the intersection of the current config and the provided config + ROCPROFSYS_USER_CONFIGURE_MODE_LAST // clang-format on } omnitrace_user_configure_mode_t; - /// @enum OMNITRACE_USER_ERROR + /// @enum ROCPROFSYS_USER_ERROR /// @brief Identifier for errors - /// @typedef OMNITRACE_USER_ERROR omnitrace_user_error_t + /// @typedef ROCPROFSYS_USER_ERROR omnitrace_user_error_t /// - typedef enum OMNITRACE_USER_ERROR + typedef enum ROCPROFSYS_USER_ERROR { - OMNITRACE_USER_SUCCESS = 0, ///< No error - OMNITRACE_USER_ERROR_NO_BINDING, ///< Function pointer was not assigned - OMNITRACE_USER_ERROR_BAD_VALUE, ///< Provided value was invalid - OMNITRACE_USER_ERROR_INVALID_CATEGORY, ///< Invalid user binding category - OMNITRACE_USER_ERROR_INTERNAL, ///< Internal error occurred within librocprof-sys - OMNITRACE_USER_ERROR_LAST + ROCPROFSYS_USER_SUCCESS = 0, ///< No error + ROCPROFSYS_USER_ERROR_NO_BINDING, ///< Function pointer was not assigned + ROCPROFSYS_USER_ERROR_BAD_VALUE, ///< Provided value was invalid + ROCPROFSYS_USER_ERROR_INVALID_CATEGORY, ///< Invalid user binding category + ROCPROFSYS_USER_ERROR_INTERNAL, ///< Internal error occurred within librocprof-sys + ROCPROFSYS_USER_ERROR_LAST } omnitrace_user_error_t; #if defined(__cplusplus) } #endif -#ifndef OMNITRACE_USER_CALLBACKS_INIT -# define OMNITRACE_USER_CALLBACKS_INIT \ +#ifndef ROCPROFSYS_USER_CALLBACKS_INIT +# define ROCPROFSYS_USER_CALLBACKS_INIT \ { \ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL \ } #endif -#endif // OMNITRACE_TYPES_H_ +#endif // ROCPROFSYS_TYPES_H_ diff --git a/source/lib/omnitrace-user/omnitrace/user.h b/source/lib/omnitrace-user/omnitrace/user.h index 64e7aa61..3a74d042 100644 --- a/source/lib/omnitrace-user/omnitrace/user.h +++ b/source/lib/omnitrace-user/omnitrace/user.h @@ -20,16 +20,16 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -#ifndef OMNITRACE_USER_H_ -#define OMNITRACE_USER_H_ +#ifndef ROCPROFSYS_USER_H_ +#define ROCPROFSYS_USER_H_ -#if defined(OMNITRACE_USER_SOURCE) && (OMNITRACE_USER_SOURCE > 0) -# if !defined(OMNITRACE_PUBLIC_API) -# define OMNITRACE_PUBLIC_API __attribute__((visibility("default"))) +#if defined(ROCPROFSYS_USER_SOURCE) && (ROCPROFSYS_USER_SOURCE > 0) +# if !defined(ROCPROFSYS_PUBLIC_API) +# define ROCPROFSYS_PUBLIC_API __attribute__((visibility("default"))) # endif #else -# if !defined(OMNITRACE_PUBLIC_API) -# define OMNITRACE_PUBLIC_API +# if !defined(ROCPROFSYS_PUBLIC_API) +# define ROCPROFSYS_PUBLIC_API # endif #endif @@ -44,30 +44,30 @@ extern "C" /// @fn int omnitrace_user_start_trace(void) /// @return omnitrace_user_error_t value /// @brief Enable tracing on this thread and all subsequently created threads - extern int omnitrace_user_start_trace(void) OMNITRACE_PUBLIC_API; + extern int omnitrace_user_start_trace(void) ROCPROFSYS_PUBLIC_API; /// @fn int omnitrace_user_stop_trace(void) /// @return omnitrace_user_error_t value /// @brief Disable tracing on this thread and all subsequently created threads - extern int omnitrace_user_stop_trace(void) OMNITRACE_PUBLIC_API; + extern int omnitrace_user_stop_trace(void) ROCPROFSYS_PUBLIC_API; /// @fn int omnitrace_user_start_thread_trace(void) /// @return omnitrace_user_error_t value /// @brief Enable tracing on this specific thread. Does not apply to subsequently /// created threads - extern int omnitrace_user_start_thread_trace(void) OMNITRACE_PUBLIC_API; + extern int omnitrace_user_start_thread_trace(void) ROCPROFSYS_PUBLIC_API; /// @fn int omnitrace_user_stop_thread_trace(void) /// @return omnitrace_user_error_t value /// @brief Disable tracing on this specific thread. Does not apply to subsequently /// created threads - extern int omnitrace_user_stop_thread_trace(void) OMNITRACE_PUBLIC_API; + extern int omnitrace_user_stop_thread_trace(void) ROCPROFSYS_PUBLIC_API; /// @fn int omnitrace_user_push_region(const char* id) /// @param id The string identifier for the region /// @return omnitrace_user_error_t value /// @brief Start a user defined region. - extern int omnitrace_user_push_region(const char*) OMNITRACE_PUBLIC_API; + extern int omnitrace_user_push_region(const char*) ROCPROFSYS_PUBLIC_API; /// @fn int omnitrace_user_pop_region(const char* id) /// @param id The string identifier for the region @@ -78,7 +78,7 @@ extern "C" /// be violated, and will thus compenstate for out-of-order popping, however, the /// perfetto backend will not; thus, out-of-order popping will result in different /// results in timemory vs. perfetto. - extern int omnitrace_user_pop_region(const char*) OMNITRACE_PUBLIC_API; + extern int omnitrace_user_pop_region(const char*) ROCPROFSYS_PUBLIC_API; /// @typedef omnitrace_annotation omnitrace_annotation_t /// @@ -91,7 +91,7 @@ extern "C" /// @return omnitrace_user_error_t value /// @brief Start a user defined region and adds the annotations to the perfetto trace. extern int omnitrace_user_push_annotated_region(const char*, omnitrace_annotation_t*, - size_t) OMNITRACE_PUBLIC_API; + size_t) ROCPROFSYS_PUBLIC_API; /// @fn int omnitrace_user_pop_annotated_region(const char* id, /// omnitrace_annotation_t* annotations, @@ -102,14 +102,14 @@ extern "C" /// @return omnitrace_user_error_t value /// @brief Stop a user defined region and adds the annotations to the perfetto trace. extern int omnitrace_user_pop_annotated_region(const char*, omnitrace_annotation_t*, - size_t) OMNITRACE_PUBLIC_API; + size_t) ROCPROFSYS_PUBLIC_API; /// mark causal progress - extern int omnitrace_user_progress(const char*) OMNITRACE_PUBLIC_API; + extern int omnitrace_user_progress(const char*) ROCPROFSYS_PUBLIC_API; /// mark causal progress with annotations extern int omnitrace_user_annotated_progress(const char*, omnitrace_annotation_t*, - size_t) OMNITRACE_PUBLIC_API; + size_t) ROCPROFSYS_PUBLIC_API; /// @fn int omnitrace_user_configure(omnitrace_user_configure_mode_t mode, /// omnitrace_user_callbacks_t inp, @@ -130,11 +130,11 @@ extern "C" /// Changing the callbacks is thread-safe but not thread-local. extern int omnitrace_user_configure( omnitrace_user_configure_mode_t mode, omnitrace_user_callbacks_t inp, - omnitrace_user_callbacks_t* out) OMNITRACE_PUBLIC_API; + omnitrace_user_callbacks_t* out) ROCPROFSYS_PUBLIC_API; /// @fn int omnitrace_user_get_callbacks(int category, void** begin_func, void** /// end_func) - /// @param[in] category An @ref OMNITRACE_USER_BINDINGS value + /// @param[in] category An @ref ROCPROFSYS_USER_BINDINGS value /// @param[out] begin_func The pointer to the function which corresponds to "starting" /// the category, e.g. omnitrace_user_start_trace or omnitrace_user_push_region /// @param[out] end_func The pointer to the function which corresponds to "ending" the @@ -143,16 +143,16 @@ extern "C" /// @brief Get the current function pointers for a given category. The initial values /// are assigned by omnitrace-dl at start up. extern int omnitrace_user_get_callbacks(omnitrace_user_callbacks_t*) - OMNITRACE_PUBLIC_API; + ROCPROFSYS_PUBLIC_API; /// @fn const char* omnitrace_user_error_string(int error_category) - /// @param error_category OMNITRACE_USER_ERROR value + /// @param error_category ROCPROFSYS_USER_ERROR value /// @return String descripting the error code /// @brief Return a descriptor for the provided error code - extern const char* omnitrace_user_error_string(int) OMNITRACE_PUBLIC_API; + extern const char* omnitrace_user_error_string(int) ROCPROFSYS_PUBLIC_API; #if defined(__cplusplus) } #endif -#endif // OMNITRACE_USER_H_ +#endif // ROCPROFSYS_USER_H_ diff --git a/source/lib/omnitrace-user/user.cpp b/source/lib/omnitrace-user/user.cpp index 72fa03fe..6125909f 100644 --- a/source/lib/omnitrace-user/user.cpp +++ b/source/lib/omnitrace-user/user.cpp @@ -20,8 +20,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -#if !defined(OMNITRACE_USER_SOURCE) -# define OMNITRACE_USER_SOURCE 1 +#if !defined(ROCPROFSYS_USER_SOURCE) +# define ROCPROFSYS_USER_SOURCE 1 #endif #include "omnitrace/user.h" @@ -42,15 +42,15 @@ using region_func_t = omnitrace_region_func_t; using annotated_region_func_t = omnitrace_annotated_region_func_t; using user_callbacks_t = omnitrace_user_callbacks_t; -user_callbacks_t _callbacks = OMNITRACE_USER_CALLBACKS_INIT; +user_callbacks_t _callbacks = ROCPROFSYS_USER_CALLBACKS_INIT; template inline auto invoke(int (*_func)(Args...), Args... args) { - if(!_func) return OMNITRACE_USER_ERROR_NO_BINDING; - if((*_func)(args...) != 0) return OMNITRACE_USER_ERROR_INTERNAL; - return OMNITRACE_USER_SUCCESS; + if(!_func) return ROCPROFSYS_USER_ERROR_NO_BINDING; + if((*_func)(args...) != 0) return ROCPROFSYS_USER_ERROR_INTERNAL; + return ROCPROFSYS_USER_SUCCESS; } } // namespace @@ -113,12 +113,12 @@ extern "C" switch(mode) { - case OMNITRACE_USER_REPLACE_CONFIG: + case ROCPROFSYS_USER_REPLACE_CONFIG: { _callbacks = inp; break; } - case OMNITRACE_USER_UNION_CONFIG: + case ROCPROFSYS_USER_UNION_CONFIG: { auto _update = [](auto& _lhs, auto _rhs) { if(_rhs) _lhs = _rhs; @@ -140,7 +140,7 @@ extern "C" _callbacks = _v; break; } - case OMNITRACE_USER_INTERSECT_CONFIG: + case ROCPROFSYS_USER_INTERSECT_CONFIG: { auto _update = [](auto& _lhs, auto _rhs) { if(_lhs != _rhs) _lhs = nullptr; @@ -165,25 +165,25 @@ extern "C" default: { if(out) *out = _former; - return OMNITRACE_USER_ERROR_INVALID_CATEGORY; + return ROCPROFSYS_USER_ERROR_INVALID_CATEGORY; } } if(out) *out = _former; - return OMNITRACE_USER_SUCCESS; + return ROCPROFSYS_USER_SUCCESS; } const char* omnitrace_user_error_string(int error_category) { switch(error_category) { - case OMNITRACE_USER_SUCCESS: return "Success"; - case OMNITRACE_USER_ERROR_NO_BINDING: return "Function pointer not assigned"; - case OMNITRACE_USER_ERROR_BAD_VALUE: return "Invalid value was provided"; - case OMNITRACE_USER_ERROR_INVALID_CATEGORY: + case ROCPROFSYS_USER_SUCCESS: return "Success"; + case ROCPROFSYS_USER_ERROR_NO_BINDING: return "Function pointer not assigned"; + case ROCPROFSYS_USER_ERROR_BAD_VALUE: return "Invalid value was provided"; + case ROCPROFSYS_USER_ERROR_INVALID_CATEGORY: return "Invalid user binding category"; - case OMNITRACE_USER_ERROR_INTERNAL: + case ROCPROFSYS_USER_ERROR_INTERNAL: return "An unknown error occurred within omnitrace library"; default: break; } diff --git a/source/lib/omnitrace/CMakeLists.txt b/source/lib/omnitrace/CMakeLists.txt index 420bf897..73dc9ff0 100644 --- a/source/lib/omnitrace/CMakeLists.txt +++ b/source/lib/omnitrace/CMakeLists.txt @@ -54,9 +54,9 @@ set_target_properties( PROPERTIES OUTPUT_NAME rocprof-sys VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} - INSTALL_RPATH "${OMNITRACE_LIB_INSTALL_RPATH}") + INSTALL_RPATH "${ROCPROFSYS_LIB_INSTALL_RPATH}") -omnitrace_strip_target(rocprofsys-shared-library) +rocprofsys_strip_target(rocprofsys-shared-library) install( TARGETS rocprofsys-shared-library diff --git a/source/lib/omnitrace/api.cpp b/source/lib/omnitrace/api.cpp index 28000ee9..5852c43c 100644 --- a/source/lib/omnitrace/api.cpp +++ b/source/lib/omnitrace/api.cpp @@ -46,7 +46,7 @@ omnitrace_push_region(const char* _name) omnitrace_push_region_hidden(_name); } catch(std::exception& _e) { - OMNITRACE_WARNING_F(1, "Exception caught: %s\n", _e.what()); + ROCPROFSYS_WARNING_F(1, "Exception caught: %s\n", _e.what()); return -1; } return 0; @@ -60,7 +60,7 @@ omnitrace_pop_region(const char* _name) omnitrace_pop_region_hidden(_name); } catch(std::exception& _e) { - OMNITRACE_WARNING_F(1, "Exception caught: %s\n", _e.what()); + ROCPROFSYS_WARNING_F(1, "Exception caught: %s\n", _e.what()); return -1; } return 0; @@ -77,7 +77,7 @@ omnitrace_push_category_region(omnitrace_category_t _category, const char* _name _annotation_count); } catch(std::exception& _e) { - OMNITRACE_WARNING_F(1, "Exception caught: %s\n", _e.what()); + ROCPROFSYS_WARNING_F(1, "Exception caught: %s\n", _e.what()); return -1; } return 0; @@ -94,7 +94,7 @@ omnitrace_pop_category_region(omnitrace_category_t _category, const char* _name, _annotation_count); } catch(std::exception& _e) { - OMNITRACE_WARNING_F(1, "Exception caught: %s\n", _e.what()); + ROCPROFSYS_WARNING_F(1, "Exception caught: %s\n", _e.what()); return -1; } return 0; diff --git a/source/lib/omnitrace/api.hpp b/source/lib/omnitrace/api.hpp index e5a2d70b..b61fea81 100644 --- a/source/lib/omnitrace/api.hpp +++ b/source/lib/omnitrace/api.hpp @@ -33,89 +33,89 @@ extern "C" { /// handles configuration logic - void omnitrace_init_library(void) OMNITRACE_PUBLIC_API; + void omnitrace_init_library(void) ROCPROFSYS_PUBLIC_API; /// handles configuration logic - void omnitrace_init_tooling(void) OMNITRACE_PUBLIC_API; + void omnitrace_init_tooling(void) ROCPROFSYS_PUBLIC_API; /// starts gotcha wrappers - void omnitrace_init(const char*, bool, const char*) OMNITRACE_PUBLIC_API; + void omnitrace_init(const char*, bool, const char*) ROCPROFSYS_PUBLIC_API; /// shuts down all tooling and generates output - void omnitrace_finalize(void) OMNITRACE_PUBLIC_API; + void omnitrace_finalize(void) ROCPROFSYS_PUBLIC_API; /// remove librocprof-sys from LD_PRELOAD - void omnitrace_reset_preload(void) OMNITRACE_PUBLIC_API; + void omnitrace_reset_preload(void) ROCPROFSYS_PUBLIC_API; /// sets an environment variable - void omnitrace_set_env(const char*, const char*) OMNITRACE_PUBLIC_API; + void omnitrace_set_env(const char*, const char*) ROCPROFSYS_PUBLIC_API; /// sets whether MPI should be used - void omnitrace_set_mpi(bool, bool) OMNITRACE_PUBLIC_API; + void omnitrace_set_mpi(bool, bool) ROCPROFSYS_PUBLIC_API; /// starts an instrumentation region - void omnitrace_push_trace(const char*) OMNITRACE_PUBLIC_API; + void omnitrace_push_trace(const char*) ROCPROFSYS_PUBLIC_API; /// stops an instrumentation region - void omnitrace_pop_trace(const char*) OMNITRACE_PUBLIC_API; + void omnitrace_pop_trace(const char*) ROCPROFSYS_PUBLIC_API; /// starts an instrumentation region (user-defined) - int omnitrace_push_region(const char*) OMNITRACE_PUBLIC_API; + int omnitrace_push_region(const char*) ROCPROFSYS_PUBLIC_API; /// stops an instrumentation region (user-defined) - int omnitrace_pop_region(const char*) OMNITRACE_PUBLIC_API; + int omnitrace_pop_region(const char*) ROCPROFSYS_PUBLIC_API; /// starts an instrumentation region in a user-defined category and (optionally) /// adds annotations to the perfetto trace. int omnitrace_push_category_region(omnitrace_category_t, const char*, omnitrace_annotation_t*, - size_t) OMNITRACE_PUBLIC_API; + size_t) ROCPROFSYS_PUBLIC_API; /// stops an instrumentation region in a user-defined category and (optionally) /// adds annotations to the perfetto trace. int omnitrace_pop_category_region(omnitrace_category_t, const char*, omnitrace_annotation_t*, - size_t) OMNITRACE_PUBLIC_API; + size_t) ROCPROFSYS_PUBLIC_API; /// stores source code information void omnitrace_register_source(const char* file, const char* func, size_t line, size_t address, - const char* source) OMNITRACE_PUBLIC_API; + const char* source) ROCPROFSYS_PUBLIC_API; /// increments coverage values void omnitrace_register_coverage(const char* file, const char* func, - size_t address) OMNITRACE_PUBLIC_API; + size_t address) ROCPROFSYS_PUBLIC_API; /// mark causal progress - void omnitrace_progress(const char*) OMNITRACE_PUBLIC_API; + void omnitrace_progress(const char*) ROCPROFSYS_PUBLIC_API; /// mark causal progress with annotations void omnitrace_annotated_progress(const char*, omnitrace_annotation_t*, - size_t) OMNITRACE_PUBLIC_API; + size_t) ROCPROFSYS_PUBLIC_API; // these are the real implementations for internal calling convention - void omnitrace_init_library_hidden(void) OMNITRACE_HIDDEN_API; - bool omnitrace_init_tooling_hidden(void) OMNITRACE_HIDDEN_API; - void omnitrace_init_hidden(const char*, bool, const char*) OMNITRACE_HIDDEN_API; - void omnitrace_finalize_hidden(void) OMNITRACE_HIDDEN_API; - void omnitrace_reset_preload_hidden(void) OMNITRACE_HIDDEN_API; - void omnitrace_set_env_hidden(const char*, const char*) OMNITRACE_HIDDEN_API; - void omnitrace_set_mpi_hidden(bool, bool) OMNITRACE_HIDDEN_API; - void omnitrace_push_trace_hidden(const char*) OMNITRACE_HIDDEN_API; - void omnitrace_pop_trace_hidden(const char*) OMNITRACE_HIDDEN_API; - void omnitrace_push_region_hidden(const char*) OMNITRACE_HIDDEN_API; - void omnitrace_pop_region_hidden(const char*) OMNITRACE_HIDDEN_API; + void omnitrace_init_library_hidden(void) ROCPROFSYS_HIDDEN_API; + bool omnitrace_init_tooling_hidden(void) ROCPROFSYS_HIDDEN_API; + void omnitrace_init_hidden(const char*, bool, const char*) ROCPROFSYS_HIDDEN_API; + void omnitrace_finalize_hidden(void) ROCPROFSYS_HIDDEN_API; + void omnitrace_reset_preload_hidden(void) ROCPROFSYS_HIDDEN_API; + void omnitrace_set_env_hidden(const char*, const char*) ROCPROFSYS_HIDDEN_API; + void omnitrace_set_mpi_hidden(bool, bool) ROCPROFSYS_HIDDEN_API; + void omnitrace_push_trace_hidden(const char*) ROCPROFSYS_HIDDEN_API; + void omnitrace_pop_trace_hidden(const char*) ROCPROFSYS_HIDDEN_API; + void omnitrace_push_region_hidden(const char*) ROCPROFSYS_HIDDEN_API; + void omnitrace_pop_region_hidden(const char*) ROCPROFSYS_HIDDEN_API; void omnitrace_push_category_region_hidden(omnitrace_category_t, const char*, omnitrace_annotation_t*, - size_t) OMNITRACE_HIDDEN_API; + size_t) ROCPROFSYS_HIDDEN_API; void omnitrace_pop_category_region_hidden(omnitrace_category_t, const char*, omnitrace_annotation_t*, - size_t) OMNITRACE_HIDDEN_API; + size_t) ROCPROFSYS_HIDDEN_API; void omnitrace_register_source_hidden(const char*, const char*, size_t, size_t, - const char*) OMNITRACE_HIDDEN_API; + const char*) ROCPROFSYS_HIDDEN_API; void omnitrace_register_coverage_hidden(const char*, const char*, - size_t) OMNITRACE_HIDDEN_API; - void omnitrace_progress_hidden(const char*) OMNITRACE_HIDDEN_API; + size_t) ROCPROFSYS_HIDDEN_API; + void omnitrace_progress_hidden(const char*) ROCPROFSYS_HIDDEN_API; void omnitrace_annotated_progress_hidden(const char*, omnitrace_annotation_t*, - size_t) OMNITRACE_HIDDEN_API; + size_t) ROCPROFSYS_HIDDEN_API; } diff --git a/source/lib/omnitrace/library.cpp b/source/lib/omnitrace/library.cpp index e53a1042..c8038485 100644 --- a/source/lib/omnitrace/library.cpp +++ b/source/lib/omnitrace/library.cpp @@ -96,7 +96,7 @@ namespace omnitrace namespace timeout { void -setup() OMNITRACE_INTERNAL_API; +setup() ROCPROFSYS_INTERNAL_API; } } // namespace omnitrace @@ -117,7 +117,7 @@ ensure_initialization(bool _offset, int64_t _glob_n, int64_t _offset_n) if(_tid > 0 && _tid < _peak_num_threads) { const auto& _info = thread_info::get(); - OMNITRACE_BASIC_VERBOSE_F(3, + ROCPROFSYS_BASIC_VERBOSE_F(3, "thread info: %s, offset: %s, global counter: %li, " "offset counter: %li, max threads: %li\n", std::to_string(static_cast(_info)).c_str(), @@ -147,7 +147,7 @@ ensure_finalization(bool _static_init = false) throw exception("failure adding threading callback"); } - OMNITRACE_CI_BASIC_THROW( + ROCPROFSYS_CI_BASIC_THROW( config::set_signal_handler(nullptr) != &finalization_handler, "Assignment of signal handler failed. signal handler is %s, expected %s\n", as_hex(reinterpret_cast(config::set_signal_handler(nullptr))).c_str(), @@ -157,10 +157,10 @@ ensure_finalization(bool _static_init = false) const auto& _tid = _info->index_data; if(_tid) { - OMNITRACE_CI_THROW(_tid->sequent_value != threading::get_id(), + ROCPROFSYS_CI_THROW(_tid->sequent_value != threading::get_id(), "Error! internal tid != %li :: %li", threading::get_id(), _tid->sequent_value); - OMNITRACE_CI_THROW(_tid->system_value != threading::get_sys_tid(), + ROCPROFSYS_CI_THROW(_tid->system_value != threading::get_sys_tid(), "Error! system tid != %li :: %li", threading::get_sys_tid(), _tid->system_value); } @@ -182,7 +182,7 @@ ensure_finalization(bool _static_init = false) if(_static_init) { - OMNITRACE_BASIC_DEBUG_F("\n"); + ROCPROFSYS_BASIC_DEBUG_F("\n"); auto _verbose = get_verbose_env() + ((get_debug_env() || get_debug_init()) ? 16 : 0); auto _search_paths = JOIN(':', tim::get_env("ROCPROFSYS_PATH", ""), @@ -194,7 +194,7 @@ ensure_finalization(bool _static_init = false) } else { - OMNITRACE_DEBUG_F("\n"); + ROCPROFSYS_DEBUG_F("\n"); } if(_timemory_manager) _timemory_manager->set_write_metadata(-1); @@ -207,7 +207,7 @@ struct fini_bundle { using data_type = std::tuple; - OMNITRACE_DEFAULT_OBJECT(fini_bundle) + ROCPROFSYS_DEFAULT_OBJECT(fini_bundle) fini_bundle(std::string_view _label) : m_label{ _label } @@ -269,14 +269,14 @@ omnitrace_set_env_hidden(const char* env_name, const char* env_val) bool _success = _set_envs.emplace(env_name).second; // just search env to avoid initializing the settings - OMNITRACE_CONDITIONAL_PRINT_F(get_debug_init() || get_verbose_env() > 2, + ROCPROFSYS_CONDITIONAL_PRINT_F(get_debug_init() || get_verbose_env() > 2, "Setting env: %s=%s\n", env_name, env_val); tim::set_env(env_name, env_val, 0); if(_success && get_state() >= State::Init) { - OMNITRACE_WARNING_F( + ROCPROFSYS_WARNING_F( 0, "omnitrace_set_env(\"%s\", \"%s\") called after rocprof-sys was initialized. " "state = %s. This environment variable will have no effect\n", @@ -316,7 +316,7 @@ omnitrace_set_mpi_hidden(bool use, bool attached) _once = true; // just search env to avoid initializing the settings - OMNITRACE_CONDITIONAL_PRINT_F(get_debug_init() || get_verbose_env() > 2, + ROCPROFSYS_CONDITIONAL_PRINT_F(get_debug_init() || get_verbose_env() > 2, "use: %s, attached: %s\n", (use) ? "y" : "n", (attached) ? "y" : "n"); @@ -334,7 +334,7 @@ omnitrace_set_mpi_hidden(bool use, bool attached) if(get_state() >= State::Init) { - OMNITRACE_WARNING_F( + ROCPROFSYS_WARNING_F( 0, "omnitrace_set_mpi(use=%s, attached=%s) called after rocprof-sys was " "initialized. state = %s. MPI support may not be properly initialized. Use " @@ -357,22 +357,22 @@ omnitrace_init_library_hidden() static bool _once = false; auto _debug_init = get_debug_init(); - OMNITRACE_CONDITIONAL_BASIC_PRINT_F(_debug_init, "State is %s...\n", + ROCPROFSYS_CONDITIONAL_BASIC_PRINT_F(_debug_init, "State is %s...\n", std::to_string(get_state()).c_str()); - OMNITRACE_CI_THROW(get_state() != State::PreInit, "State is not PreInit :: %s", + ROCPROFSYS_CI_THROW(get_state() != State::PreInit, "State is not PreInit :: %s", std::to_string(get_state()).c_str()); if(get_state() != State::PreInit || get_state() == State::Init || _once) return; _once = true; - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); - OMNITRACE_CONDITIONAL_BASIC_PRINT_F(_debug_init, "State is %s. Setting to %s...\n", + ROCPROFSYS_CONDITIONAL_BASIC_PRINT_F(_debug_init, "State is %s. Setting to %s...\n", std::to_string(get_state()).c_str(), std::to_string(State::Init).c_str()); - OMNITRACE_CONDITIONAL_BASIC_PRINT_F( + ROCPROFSYS_CONDITIONAL_BASIC_PRINT_F( _debug_init, "Calling backtrace once so that the one-time call of malloc in " "glibc's backtrace() occurs...\n"); { @@ -383,11 +383,11 @@ omnitrace_init_library_hidden() set_state(State::Init); - OMNITRACE_CI_THROW(get_state() != State::Init, + ROCPROFSYS_CI_THROW(get_state() != State::Init, "set_state(State::Init) failed. state is %s", std::to_string(get_state()).c_str()); - OMNITRACE_CONDITIONAL_BASIC_PRINT_F(_debug_init, "Configuring settings...\n"); + ROCPROFSYS_CONDITIONAL_BASIC_PRINT_F(_debug_init, "Configuring settings...\n"); // configure the settings configure_settings(); @@ -402,7 +402,7 @@ omnitrace_init_library_hidden() tim::trait::runtime_enabled::set(get_use_roctracer() && get_use_timemory()); - OMNITRACE_CONDITIONAL_BASIC_PRINT_F(_debug_init, "\n"); + ROCPROFSYS_CONDITIONAL_BASIC_PRINT_F(_debug_init, "\n"); } //======================================================================================// @@ -421,46 +421,46 @@ omnitrace_init_tooling_hidden() static bool _once = false; static auto _debug_init = get_debug_init(); - OMNITRACE_CONDITIONAL_BASIC_PRINT_F(_debug_init, "State is %s...\n", + ROCPROFSYS_CONDITIONAL_BASIC_PRINT_F(_debug_init, "State is %s...\n", std::to_string(get_state()).c_str()); if(get_state() != State::PreInit || get_state() == State::Init || _once) return false; _once = true; - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); - OMNITRACE_CONDITIONAL_THROW( + ROCPROFSYS_CONDITIONAL_THROW( get_state() == State::Init, "%s called after omnitrace_init_library() was explicitly called", - OMNITRACE_FUNCTION); + ROCPROFSYS_FUNCTION); - OMNITRACE_CONDITIONAL_BASIC_PRINT_F(get_verbose_env() >= 0, + ROCPROFSYS_CONDITIONAL_BASIC_PRINT_F(get_verbose_env() >= 0, "Instrumentation mode: %s\n", std::to_string(config::get_mode()).c_str()); - OMNITRACE_CONDITIONAL_BASIC_PRINT_F(_debug_init, "Printing banner...\n"); + ROCPROFSYS_CONDITIONAL_BASIC_PRINT_F(_debug_init, "Printing banner...\n"); if(get_verbose_env() >= 0) print_banner(); - OMNITRACE_CONDITIONAL_BASIC_PRINT_F(_debug_init, + ROCPROFSYS_CONDITIONAL_BASIC_PRINT_F(_debug_init, "Calling omnitrace_init_library()...\n"); omnitrace_init_library_hidden(); - OMNITRACE_DEBUG_F("\n"); + ROCPROFSYS_DEBUG_F("\n"); auto _dtor = scope::destructor{ []() { // if set to finalized, don't continue if(get_state() > State::Active) return; if(get_use_process_sampling()) { - OMNITRACE_SCOPED_SAMPLING_ON_CHILD_THREADS(false); + ROCPROFSYS_SCOPED_SAMPLING_ON_CHILD_THREADS(false); process_sampler::setup(); } if(get_use_causal()) { { - OMNITRACE_SCOPED_SAMPLING_ON_CHILD_THREADS(false); + ROCPROFSYS_SCOPED_SAMPLING_ON_CHILD_THREADS(false); causal::sampling::setup(); } push_enable_sampling_on_child_threads(get_use_causal()); @@ -469,19 +469,19 @@ omnitrace_init_tooling_hidden() else if(get_use_sampling()) { { - OMNITRACE_SCOPED_SAMPLING_ON_CHILD_THREADS(false); + ROCPROFSYS_SCOPED_SAMPLING_ON_CHILD_THREADS(false); sampling::setup(); } push_enable_sampling_on_child_threads(get_use_sampling()); sampling::unblock_signals(); } get_main_bundle()->start(); - OMNITRACE_DEBUG_F("State: %s -> State::Active\n", + ROCPROFSYS_DEBUG_F("State: %s -> State::Active\n", std::to_string(get_state()).c_str()); set_state(State::Active); // set to active as very last operation } }; - OMNITRACE_SCOPED_SAMPLING_ON_CHILD_THREADS(false); + ROCPROFSYS_SCOPED_SAMPLING_ON_CHILD_THREADS(false); // ideally these have already been started omnitrace_preinit_hidden(); @@ -494,7 +494,7 @@ omnitrace_init_tooling_hidden() // perfetto initialization if(get_use_perfetto()) { - OMNITRACE_VERBOSE_F(1, "Setting up Perfetto...\n"); + ROCPROFSYS_VERBOSE_F(1, "Setting up Perfetto...\n"); omnitrace::perfetto::setup(); } @@ -533,19 +533,19 @@ omnitrace_init_tooling_hidden() if(get_use_ompt()) { - OMNITRACE_VERBOSE_F(1, "Setting up OMPT...\n"); + ROCPROFSYS_VERBOSE_F(1, "Setting up OMPT...\n"); ompt::setup(); } if(get_use_rcclp()) { - OMNITRACE_VERBOSE_F(1, "Setting up RCCLP...\n"); + ROCPROFSYS_VERBOSE_F(1, "Setting up RCCLP...\n"); rcclp::setup(); } if(get_use_perfetto()) { - OMNITRACE_VERBOSE_F(1, "Starting Perfetto...\n"); + ROCPROFSYS_VERBOSE_F(1, "Starting Perfetto...\n"); omnitrace::perfetto::start(); } @@ -576,7 +576,7 @@ omnitrace_init_hidden(const char* _mode, bool _is_binary_rewrite, const char* _a std::tie(_args.first, _args.second) == std::tie(_mode_sv, _is_binary_rewrite)) return; - OMNITRACE_CONDITIONAL_THROW( + ROCPROFSYS_CONDITIONAL_THROW( _count > 0 && std::tie(_args.first, _args.second) != std::tie(_mode_sv, _is_binary_rewrite), "\nomnitrace_init(...) called multiple times with different arguments for mode " @@ -595,7 +595,7 @@ omnitrace_init_hidden(const char* _mode, bool _is_binary_rewrite, const char* _a { if(std::string_view{ _mode } != "trace" && std::string_view{ _mode } != "Trace") { - OMNITRACE_WARNING_F( + ROCPROFSYS_WARNING_F( 0, "omnitrace_init(mode=%s, is_binary_rewrite=%s, argv0=%s) " "called after rocprof-sys was initialized. state = %s. Mode-based " @@ -607,7 +607,7 @@ omnitrace_init_hidden(const char* _mode, bool _is_binary_rewrite, const char* _a } tracing::get_finalization_functions().emplace_back([_argv0_c]() { - OMNITRACE_CI_THROW(get_state() != State::Active, + ROCPROFSYS_CI_THROW(get_state() != State::Active, "Finalizer function for popping main invoked in non-active " "state :: state = %s\n", std::to_string(get_state()).c_str()); @@ -615,7 +615,7 @@ omnitrace_init_hidden(const char* _mode, bool _is_binary_rewrite, const char* _a { auto _name = (_argv0_c) ? std::string{ _argv0_c } : config::get_exe_name(); // if main hasn't been popped yet, pop it - OMNITRACE_BASIC_VERBOSE(2, "Running omnitrace_pop_trace(%s)...\n", + ROCPROFSYS_BASIC_VERBOSE(2, "Running omnitrace_pop_trace(%s)...\n", _name.c_str()); omnitrace_pop_trace_hidden(_name.c_str()); } @@ -626,7 +626,7 @@ omnitrace_init_hidden(const char* _mode, bool _is_binary_rewrite, const char* _a if(get_state() == State::Active) omnitrace_finalize_hidden(); }); - OMNITRACE_CONDITIONAL_BASIC_PRINT_F( + ROCPROFSYS_CONDITIONAL_BASIC_PRINT_F( get_debug_env() || get_verbose_env() > 2, "mode: %s | is binary rewrite: %s | command: %s\n", _mode, (_is_binary_rewrite) ? "y" : "n", _argv0.c_str()); @@ -679,7 +679,7 @@ omnitrace_finalize_hidden(void) // return if not active if(get_state() != State::Active) { - OMNITRACE_BASIC_DEBUG_F("State = %s. Finalization skipped\n", + ROCPROFSYS_BASIC_DEBUG_F("State = %s. Finalization skipped\n", std::to_string(get_state()).c_str()); return; } @@ -691,7 +691,7 @@ omnitrace_finalize_hidden(void) } if(get_verbose() >= 0 || get_debug()) fprintf(stderr, "\n"); - OMNITRACE_VERBOSE_F(0, "finalizing...\n"); + ROCPROFSYS_VERBOSE_F(0, "finalizing...\n"); sampling::block_samples(); @@ -719,7 +719,7 @@ omnitrace_finalize_hidden(void) if(get_use_roctracer()) { - OMNITRACE_VERBOSE_F(1, "Flushing roctracer...\n"); + ROCPROFSYS_VERBOSE_F(1, "Flushing roctracer...\n"); // ensure that roctracer is flushed before setting the state to finalized comp::roctracer::flush(); } @@ -747,25 +747,25 @@ omnitrace_finalize_hidden(void) { if(dmp::rank() == 0) { - OMNITRACE_PRINT_F("\n"); + ROCPROFSYS_PRINT_F("\n"); config::print_settings( tim::get_env("ROCPROFSYS_PRINT_ENV", get_debug())); } } - OMNITRACE_VERBOSE_F(1, "omnitrace_push_trace :: called %zux\n", _push_count); - OMNITRACE_VERBOSE_F(1, "omnitrace_pop_trace :: called %zux\n", _pop_count); + ROCPROFSYS_VERBOSE_F(1, "omnitrace_push_trace :: called %zux\n", _push_count); + ROCPROFSYS_VERBOSE_F(1, "omnitrace_pop_trace :: called %zux\n", _pop_count); tim::signals::enable_signal_detection({ tim::signals::sys_signal::Interrupt }, [](int) {}); - OMNITRACE_DEBUG_F("Copying over all timemory hash information to main thread...\n"); + ROCPROFSYS_DEBUG_F("Copying over all timemory hash information to main thread...\n"); tracing::copy_timemory_hash_ids(); // stop the main bundle which has stats for run if(get_main_bundle()) { - OMNITRACE_DEBUG_F("Stopping main bundle...\n"); + ROCPROFSYS_DEBUG_F("Stopping main bundle...\n"); get_main_bundle()->stop(); } @@ -774,17 +774,17 @@ omnitrace_finalize_hidden(void) if(get_use_rcclp()) { - OMNITRACE_VERBOSE_F(1, "Shutting down RCCLP...\n"); + ROCPROFSYS_VERBOSE_F(1, "Shutting down RCCLP...\n"); rcclp::shutdown(); } if(get_use_ompt()) { - OMNITRACE_VERBOSE_F(1, "Shutting down OMPT...\n"); + ROCPROFSYS_VERBOSE_F(1, "Shutting down OMPT...\n"); ompt::shutdown(); } - OMNITRACE_DEBUG_F("Stopping and destroying instrumentation bundles...\n"); + ROCPROFSYS_DEBUG_F("Stopping and destroying instrumentation bundles...\n"); for(size_t i = 0; i < thread_info::get_peak_num_threads(); ++i) { if(!instrumentation_bundles::get()) continue; @@ -798,7 +798,7 @@ omnitrace_finalize_hidden(void) ++_pop_count; _lvl = 4; } - OMNITRACE_VERBOSE_F(_lvl, + ROCPROFSYS_VERBOSE_F(_lvl, "Warning! instrumentation bundle on thread %zu (TID=%li) " "with label '%s' was not stopped.\n", i, itr->back()->tid(), itr->back()->key().c_str()); @@ -812,7 +812,7 @@ omnitrace_finalize_hidden(void) // stop the main gotcha which shuts down the pthread gotchas if(get_init_bundle()) { - OMNITRACE_DEBUG_F("Stopping main gotcha...\n"); + ROCPROFSYS_DEBUG_F("Stopping main gotcha...\n"); get_init_bundle()->stop(); pthread_gotcha::shutdown(); @@ -822,57 +822,57 @@ omnitrace_finalize_hidden(void) // stop the gotcha bundle if(get_preinit_bundle()) { - OMNITRACE_VERBOSE_F(1, "Shutting down miscellaneous gotchas...\n"); + ROCPROFSYS_VERBOSE_F(1, "Shutting down miscellaneous gotchas...\n"); get_preinit_bundle()->stop(); component::mpi_gotcha::shutdown(); } if(get_use_process_sampling()) { - OMNITRACE_VERBOSE_F(1, "Shutting down background sampler...\n"); + ROCPROFSYS_VERBOSE_F(1, "Shutting down background sampler...\n"); process_sampler::shutdown(); } if(get_use_roctracer()) { - OMNITRACE_VERBOSE_F(1, "Shutting down roctracer...\n"); + ROCPROFSYS_VERBOSE_F(1, "Shutting down roctracer...\n"); // ensure that threads running roctracer callbacks shutdown comp::roctracer::shutdown(); // join extra thread(s) used by roctracer - OMNITRACE_VERBOSE_F(2, "Waiting on roctracer tasks...\n"); + ROCPROFSYS_VERBOSE_F(2, "Waiting on roctracer tasks...\n"); tasking::join(); } if(get_use_rocprofiler()) { - OMNITRACE_VERBOSE_F(1, "Shutting down rocprofiler...\n"); + ROCPROFSYS_VERBOSE_F(1, "Shutting down rocprofiler...\n"); rocprofiler::post_process(); rocprofiler::rocm_cleanup(); } if(get_use_causal()) { - OMNITRACE_VERBOSE_F(1, "Shutting down causal sampling...\n"); + ROCPROFSYS_VERBOSE_F(1, "Shutting down causal sampling...\n"); causal::sampling::shutdown(); } if(get_use_sampling()) { - OMNITRACE_VERBOSE_F(1, "Shutting down sampling...\n"); + ROCPROFSYS_VERBOSE_F(1, "Shutting down sampling...\n"); sampling::shutdown(); } - OMNITRACE_VERBOSE_F(3, "Reporting the process- and thread-level metrics...\n"); + ROCPROFSYS_VERBOSE_F(3, "Reporting the process- and thread-level metrics...\n"); // report the high-level metrics for the process if(get_main_bundle()) { - OMNITRACE_VERBOSE_F(0, "\n"); + ROCPROFSYS_VERBOSE_F(0, "\n"); std::string _msg = JOIN("", *get_main_bundle()); auto _pos = _msg.find(">>> "); if(_pos != std::string::npos) _msg = _msg.substr(_pos + 5); - OMNITRACE_VERBOSE_F(0, "%s\n", _msg.c_str()); - OMNITRACE_DEBUG_F("Resetting main bundle...\n"); + ROCPROFSYS_VERBOSE_F(0, "%s\n", _msg.c_str()); + ROCPROFSYS_DEBUG_F("Resetting main bundle...\n"); get_main_bundle()->reset(); } @@ -891,39 +891,39 @@ omnitrace_finalize_hidden(void) std::string _msg = JOIN("", *itr); auto _pos = _msg.find(">>> "); if(_pos != std::string::npos) _msg = _msg.substr(_pos + 5); - OMNITRACE_VERBOSE_F(_thr_verbose, "%s\n", _msg.c_str()); + ROCPROFSYS_VERBOSE_F(_thr_verbose, "%s\n", _msg.c_str()); } } } - OMNITRACE_VERBOSE_F(0, "\n"); + ROCPROFSYS_VERBOSE_F(0, "\n"); // ensure that all the MT instances are flushed if(get_use_sampling()) { - OMNITRACE_VERBOSE_F(1, "Post-processing the sampling backtraces...\n"); + ROCPROFSYS_VERBOSE_F(1, "Post-processing the sampling backtraces...\n"); sampling::post_process(); } if(get_use_causal()) { - OMNITRACE_VERBOSE_F(1, "Finishing the causal experiments...\n"); + ROCPROFSYS_VERBOSE_F(1, "Finishing the causal experiments...\n"); causal::finish_experimenting(); } if(get_use_process_sampling()) { - OMNITRACE_VERBOSE_F(1, "Post-processing the system-level samples...\n"); + ROCPROFSYS_VERBOSE_F(1, "Post-processing the system-level samples...\n"); process_sampler::post_process(); } // shutdown tasking before timemory is finalized, especially the roctracer thread-pool - OMNITRACE_VERBOSE_F(1, "Shutting down thread-pools...\n"); + ROCPROFSYS_VERBOSE_F(1, "Shutting down thread-pools...\n"); tasking::shutdown(); if(get_use_code_coverage()) { - OMNITRACE_VERBOSE_F(1, "Post-processing the code coverage...\n"); + ROCPROFSYS_VERBOSE_F(1, "Post-processing the code coverage...\n"); coverage::post_process(); } @@ -932,7 +932,7 @@ omnitrace_finalize_hidden(void) bool _perfetto_output_error = false; if(get_use_perfetto()) { - OMNITRACE_VERBOSE_F(0, "Finalizing perfetto...\n"); + ROCPROFSYS_VERBOSE_F(0, "Finalizing perfetto...\n"); omnitrace::perfetto::post_process(_timemory_manager.get(), _perfetto_output_error); } @@ -952,7 +952,7 @@ omnitrace_finalize_hidden(void) tim::cereal::make_nvp("memory_maps", _maps)); }); - OMNITRACE_VERBOSE_F(1, "Finalizing timemory...\n"); + ROCPROFSYS_VERBOSE_F(1, "Finalizing timemory...\n"); tim::timemory_finalize(_timemory_manager.get()); auto _cfg = settings::compose_filename_config{}; @@ -968,11 +968,11 @@ omnitrace_finalize_hidden(void) if(_perfetto_output_error) { - OMNITRACE_THROW("Error opening perfetto output file: %s", + ROCPROFSYS_THROW("Error opening perfetto output file: %s", get_perfetto_output_filename().c_str()); } - OMNITRACE_CI_THROW( + ROCPROFSYS_CI_THROW( _push_count > _pop_count, "%s", TIMEMORY_JOIN(" ", "omnitrace_push_trace was called more times than " @@ -984,7 +984,7 @@ omnitrace_finalize_hidden(void) debug::close_file(); config::finalize(); - OMNITRACE_VERBOSE_F(0, "Finalized: %s\n", _finalization.as_string().c_str()); + ROCPROFSYS_VERBOSE_F(0, "Finalized: %s\n", _finalization.as_string().c_str()); tim::signals::enable_signal_detection( { tim::signals::sys_signal::SegFault, tim::signals::sys_signal::Stop }, diff --git a/source/lib/omnitrace/library/CMakeLists.txt b/source/lib/omnitrace/library/CMakeLists.txt index aa4d2f8a..92254128 100644 --- a/source/lib/omnitrace/library/CMakeLists.txt +++ b/source/lib/omnitrace/library/CMakeLists.txt @@ -34,26 +34,26 @@ set(library_headers target_sources(rocprofsys-object-library PRIVATE ${library_sources} ${library_headers}) -if(OMNITRACE_USE_ROCTRACER OR OMNITRACE_USE_ROCPROFILER) +if(ROCPROFSYS_USE_ROCTRACER OR ROCPROFSYS_USE_ROCPROFILER) target_sources(rocprofsys-object-library PRIVATE ${CMAKE_CURRENT_LIST_DIR}/rocm.cpp) endif() -if(OMNITRACE_USE_ROCTRACER) +if(ROCPROFSYS_USE_ROCTRACER) target_sources(rocprofsys-object-library PRIVATE ${CMAKE_CURRENT_LIST_DIR}/roctracer.cpp) endif() -if(OMNITRACE_USE_RCCL) +if(ROCPROFSYS_USE_RCCL) target_sources(rocprofsys-object-library PRIVATE ${CMAKE_CURRENT_LIST_DIR}/rcclp.cpp) endif() -if(OMNITRACE_USE_ROCPROFILER) +if(ROCPROFSYS_USE_ROCPROFILER) target_sources( rocprofsys-object-library PRIVATE ${CMAKE_CURRENT_LIST_DIR}/rocprofiler.cpp ${CMAKE_CURRENT_LIST_DIR}/rocprofiler.hpp) endif() -if(OMNITRACE_USE_ROCM_SMI) +if(ROCPROFSYS_USE_ROCM_SMI) target_sources(rocprofsys-object-library PRIVATE ${CMAKE_CURRENT_LIST_DIR}/rocm_smi.cpp) endif() diff --git a/source/lib/omnitrace/library/causal/components/backtrace.cpp b/source/lib/omnitrace/library/causal/components/backtrace.cpp index 476d2b99..d1187d53 100644 --- a/source/lib/omnitrace/library/causal/components/backtrace.cpp +++ b/source/lib/omnitrace/library/causal/components/backtrace.cpp @@ -95,7 +95,7 @@ backtrace::global_init() void overflow::sample(int _sig) { - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); static thread_local const auto& _tinfo = thread_info::get(); auto _tid = _tinfo->index_data->sequent_value; @@ -157,14 +157,14 @@ backtrace::sample(int _sig) static thread_local size_t _select_zeros = 0; if((_protect_flag & 1) == 1 || - OMNITRACE_UNLIKELY(!trait::runtime_enabled::get())) + ROCPROFSYS_UNLIKELY(!trait::runtime_enabled::get())) { return; } ++_protect_flag; // on RedHat, the unw_step within get_unw_signal_frame_stack_raw involves a mutex lock - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); m_index = causal::experiment::get_index(); m_stack = get_unw_signal_frame_stack_raw(); @@ -218,7 +218,7 @@ backtrace::sample(int _sig) } else { - OMNITRACE_THROW("unhandled signal %i\n", _sig); + ROCPROFSYS_THROW("unhandled signal %i\n", _sig); } ++_protect_flag; diff --git a/source/lib/omnitrace/library/causal/components/blocking_gotcha.hpp b/source/lib/omnitrace/library/causal/components/blocking_gotcha.hpp index 5d2ede3f..7d863e12 100644 --- a/source/lib/omnitrace/library/causal/components/blocking_gotcha.hpp +++ b/source/lib/omnitrace/library/causal/components/blocking_gotcha.hpp @@ -60,7 +60,7 @@ struct blocking_gotcha : comp::base indexes_max = gotcha_capacity - 1, }; - OMNITRACE_DEFAULT_OBJECT(blocking_gotcha) + ROCPROFSYS_DEFAULT_OBJECT(blocking_gotcha) // string id for component static std::string label(); @@ -95,9 +95,9 @@ using blocking_gotcha_t = } // namespace causal } // namespace omnitrace -OMNITRACE_DEFINE_CONCRETE_TRAIT(prevent_reentry, causal::component::blocking_gotcha_t, +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(prevent_reentry, causal::component::blocking_gotcha_t, false_type) -OMNITRACE_DEFINE_CONCRETE_TRAIT(static_data, causal::component::blocking_gotcha_t, +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(static_data, causal::component::blocking_gotcha_t, false_type) -OMNITRACE_DEFINE_CONCRETE_TRAIT(fast_gotcha, causal::component::blocking_gotcha_t, +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(fast_gotcha, causal::component::blocking_gotcha_t, true_type) diff --git a/source/lib/omnitrace/library/causal/components/causal_gotcha.hpp b/source/lib/omnitrace/library/causal/components/causal_gotcha.hpp index fb4e8d19..00e8ee92 100644 --- a/source/lib/omnitrace/library/causal/components/causal_gotcha.hpp +++ b/source/lib/omnitrace/library/causal/components/causal_gotcha.hpp @@ -37,7 +37,7 @@ namespace component { struct causal_gotcha : tim::component::base { - OMNITRACE_DEFAULT_OBJECT(causal_gotcha) + ROCPROFSYS_DEFAULT_OBJECT(causal_gotcha) // string id for component static std::string label() { return "causal_gotcha"; } diff --git a/source/lib/omnitrace/library/causal/components/progress_point.hpp b/source/lib/omnitrace/library/causal/components/progress_point.hpp index aa74c1ff..50ccdda9 100644 --- a/source/lib/omnitrace/library/causal/components/progress_point.hpp +++ b/source/lib/omnitrace/library/causal/components/progress_point.hpp @@ -52,7 +52,7 @@ struct progress_point : comp::base static std::string label(); static std::string description(); - OMNITRACE_DEFAULT_OBJECT(progress_point) + ROCPROFSYS_DEFAULT_OBJECT(progress_point) void start(); void stop(); @@ -112,13 +112,13 @@ struct progress_point : comp::base } // namespace causal } // namespace omnitrace -OMNITRACE_DEFINE_CONCRETE_TRAIT(uses_storage, causal::component::progress_point, +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(uses_storage, causal::component::progress_point, false_type) -OMNITRACE_DEFINE_CONCRETE_TRAIT(flat_storage, causal::component::progress_point, +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(flat_storage, causal::component::progress_point, true_type) -OMNITRACE_DEFINE_CONCRETE_TRAIT(uses_timing_units, causal::component::progress_point, +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(uses_timing_units, causal::component::progress_point, true_type) -OMNITRACE_DEFINE_CONCRETE_TRAIT(is_timing_category, causal::component::progress_point, +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_timing_category, causal::component::progress_point, true_type) namespace tim @@ -130,7 +130,7 @@ struct push_node { using type = omnitrace::causal::component::progress_point; - OMNITRACE_DEFAULT_OBJECT(push_node) + ROCPROFSYS_DEFAULT_OBJECT(push_node) push_node(type& _obj, scope::config _scope, hash_value_t _hash, int64_t _tid = threading::get_id()) @@ -147,7 +147,7 @@ struct pop_node { using type = omnitrace::causal::component::progress_point; - OMNITRACE_DEFAULT_OBJECT(pop_node) + ROCPROFSYS_DEFAULT_OBJECT(pop_node) pop_node(type& _obj, int64_t _tid = threading::get_id()) { (*this)(_obj, _tid); } diff --git a/source/lib/omnitrace/library/causal/components/unblocking_gotcha.hpp b/source/lib/omnitrace/library/causal/components/unblocking_gotcha.hpp index 547573f6..69fd822a 100644 --- a/source/lib/omnitrace/library/causal/components/unblocking_gotcha.hpp +++ b/source/lib/omnitrace/library/causal/components/unblocking_gotcha.hpp @@ -53,7 +53,7 @@ struct unblocking_gotcha : comp::base template using gotcha_index = std::integral_constant; - OMNITRACE_DEFAULT_OBJECT(unblocking_gotcha) + ROCPROFSYS_DEFAULT_OBJECT(unblocking_gotcha) // string id for component static std::string label(); @@ -79,9 +79,9 @@ using unblocking_gotcha_t = } // namespace causal } // namespace omnitrace -OMNITRACE_DEFINE_CONCRETE_TRAIT(prevent_reentry, causal::component::unblocking_gotcha_t, +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(prevent_reentry, causal::component::unblocking_gotcha_t, false_type) -OMNITRACE_DEFINE_CONCRETE_TRAIT(static_data, causal::component::unblocking_gotcha_t, +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(static_data, causal::component::unblocking_gotcha_t, false_type) -OMNITRACE_DEFINE_CONCRETE_TRAIT(fast_gotcha, causal::component::unblocking_gotcha_t, +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(fast_gotcha, causal::component::unblocking_gotcha_t, true_type) diff --git a/source/lib/omnitrace/library/causal/data.cpp b/source/lib/omnitrace/library/causal/data.cpp index e16a7908..563c8dbe 100644 --- a/source/lib/omnitrace/library/causal/data.cpp +++ b/source/lib/omnitrace/library/causal/data.cpp @@ -87,7 +87,7 @@ auto speedup_dist = []() { size_t _nzero = std::ceil(_v.size() / 4.0); _v.resize(_v.size() + _nzero, 0); std::sort(_v.begin(), _v.end()); - OMNITRACE_CI_THROW(_v.back() > 100, "Error! last value is too large: %i\n", + ROCPROFSYS_CI_THROW(_v.back() > 100, "Error! last value is too large: %i\n", (int) _v.back()); return _v; }(); @@ -191,13 +191,13 @@ get_filters(const std::set& _scopes = { if(_former_include != _current_include) { if(!_binary_include.empty()) - OMNITRACE_VERBOSE(0, "[causal] binary scope : %s\n", + ROCPROFSYS_VERBOSE(0, "[causal] binary scope : %s\n", _binary_include.c_str()); if(!_source_include.empty()) - OMNITRACE_VERBOSE(0, "[causal] source scope : %s\n", + ROCPROFSYS_VERBOSE(0, "[causal] source scope : %s\n", _source_include.c_str()); if(!_function_include.empty()) - OMNITRACE_VERBOSE(0, "[causal] function scope : %s\n", + ROCPROFSYS_VERBOSE(0, "[causal] function scope : %s\n", _function_include.c_str()); _former_include = _current_include; } @@ -229,13 +229,13 @@ get_filters(const std::set& _scopes = { if(_former_exclude != _current_exclude) { if(!_binary_exclude.empty()) - OMNITRACE_VERBOSE(0, "[causal] binary exclude : %s\n", + ROCPROFSYS_VERBOSE(0, "[causal] binary exclude : %s\n", _binary_exclude.c_str()); if(!_source_exclude.empty()) - OMNITRACE_VERBOSE(0, "[causal] source exclude : %s\n", + ROCPROFSYS_VERBOSE(0, "[causal] source exclude : %s\n", _source_exclude.c_str()); if(!_function_exclude.empty()) - OMNITRACE_VERBOSE(0, "[causal] function exclude : %s\n", + ROCPROFSYS_VERBOSE(0, "[causal] function exclude : %s\n", _function_exclude.c_str()); _former_exclude = _current_exclude; } @@ -341,7 +341,7 @@ compute_eligible_lines_impl() } } - OMNITRACE_VERBOSE( + ROCPROFSYS_VERBOSE( 0, "[causal] eligible address ranges: %zu, coarse address range: %zu [%s]\n", _eligible_ar.size(), _eligible_ar.range_size(), _eligible_ar.get_coarse_range().as_string().c_str()); @@ -354,7 +354,7 @@ compute_eligible_lines_impl() save_line_info(_cfg, config::get_verbose()); } - OMNITRACE_CONDITIONAL_THROW( + ROCPROFSYS_CONDITIONAL_THROW( _eligible_ar.empty(), "Error! binary analysis (after filters) resulted in zero eligible instruction " "pointer addresses for causal experimentation"); @@ -469,7 +469,7 @@ perform_experiment_impl(std::shared_ptr> _started) // NOLINT const auto& _thr_info = thread_info::init(true); set_thread_state(ThreadState::Disabled); - OMNITRACE_CONDITIONAL_THROW(!_thr_info->is_offset, + ROCPROFSYS_CONDITIONAL_THROW(!_thr_info->is_offset, "Error! causal profiling thread should be offset"); if(!perform_experiment_impl_completed) @@ -504,7 +504,7 @@ perform_experiment_impl(std::shared_ptr> _started) // NOLINT if(_delay_sec > 0.0) { - OMNITRACE_VERBOSE(1, "[causal] delaying experimentation for %.2f seconds...\n", + ROCPROFSYS_VERBOSE(1, "[causal] delaying experimentation for %.2f seconds...\n", _delay_sec); uint64_t _delay_nsec = _delay_sec * units::sec; std::this_thread::yield(); @@ -519,7 +519,7 @@ perform_experiment_impl(std::shared_ptr> _started) // NOLINT auto _elapsed = clock_type::now() - _start_time; if(_elapsed >= _duration_nsec) { - OMNITRACE_VERBOSE( + ROCPROFSYS_VERBOSE( 1, "[causal] stopping experimentation after %.2f seconds " "(elapsed: %.2f seconds)...\n", @@ -544,7 +544,7 @@ perform_experiment_impl(std::shared_ptr> _started) // NOLINT { if(_impl_no > 0) return; - OMNITRACE_VERBOSE( + ROCPROFSYS_VERBOSE( 0, "[causal] experiment failed to start. Number of PC candidates: %zu\n", eligible_pc_candidates.load()); @@ -621,7 +621,7 @@ perform_experiment_impl(std::shared_ptr> _started) // NOLINT } } - OMNITRACE_PRINT_COLOR(fatal, "causal experiment never started\n"); + ROCPROFSYS_PRINT_COLOR(fatal, "causal experiment never started\n"); std::cerr << std::flush; auto _cerr = tim::log::warning_stream(std::cerr); @@ -643,7 +643,7 @@ perform_experiment_impl(std::shared_ptr> _started) // NOLINT if(!(get_causal_end_to_end() && _omni_causal_launcher)) { - OMNITRACE_CONDITIONAL_THROW(_impl_no == 0, + ROCPROFSYS_CONDITIONAL_THROW(_impl_no == 0, "causal experiment never started"); } @@ -651,14 +651,14 @@ perform_experiment_impl(std::shared_ptr> _started) // NOLINT } else { - OMNITRACE_VERBOSE( + ROCPROFSYS_VERBOSE( 1, "[causal] experiment failed to start. Number of PC candidates: %zu\n", eligible_pc_candidates.load()); } } - OMNITRACE_VERBOSE(3, + ROCPROFSYS_VERBOSE(3, "[causal] experiment started. Number of PC candidates: %zu\n", eligible_pc_candidates.load()); @@ -785,14 +785,14 @@ reset_sample_selection() selected_entry sample_selection(size_t _nitr, size_t _wait_ns) { - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); auto _select_address = [&](auto& _address_vec) { // this isn't necessary bc of check before calling this lambda but // kept because of size() - 1 in distribution range - if(OMNITRACE_UNLIKELY(_address_vec.empty())) + if(ROCPROFSYS_UNLIKELY(_address_vec.empty())) { - OMNITRACE_WARNING(0, "no addresses for sample selection...\n"); + ROCPROFSYS_WARNING(0, "no addresses for sample selection...\n"); return selected_entry{}; } @@ -822,7 +822,7 @@ sample_selection(size_t _nitr, size_t _wait_ns) if(linfo.empty()) continue; // debugging for continuous integration - if(OMNITRACE_UNLIKELY(config::get_is_continuous_integration() || + if(ROCPROFSYS_UNLIKELY(config::get_is_continuous_integration() || config::get_debug())) { auto _location = @@ -832,9 +832,9 @@ sample_selection(size_t _nitr, size_t _wait_ns) : std::string{}; for(const auto& itr : linfo) { - if(OMNITRACE_UNLIKELY(config::get_debug())) + if(ROCPROFSYS_UNLIKELY(config::get_debug())) { - OMNITRACE_WARNING( + ROCPROFSYS_WARNING( 0, "[%s][%s][%s][%s] %s [%s:%i][%s][%zu]\n", as_hex(_lookup_addr).c_str(), as_hex(_addr).c_str(), as_hex(_sym_addr).c_str(), @@ -865,9 +865,9 @@ sample_selection(size_t _nitr, size_t _wait_ns) auto _addresses = std::deque{}; for(auto& aitr : latest_eligible_pc) { - if(OMNITRACE_UNLIKELY(!aitr)) + if(ROCPROFSYS_UNLIKELY(!aitr)) { - OMNITRACE_WARNING(0, "invalid atomic pc...\n"); + ROCPROFSYS_WARNING(0, "invalid atomic pc...\n"); continue; } @@ -938,7 +938,7 @@ get_line_info(uintptr_t _addr, bool _include_discarded) for(const auto& itr : ditr.get_debug_line_info(_filters)) { if(!_ipaddr.contains(itr.ipaddr())) - OMNITRACE_THROW( + ROCPROFSYS_THROW( "Error! debug line info ipaddr (%s) is not contained in " "symbol ipaddr (%s)", as_hex(itr.ipaddr()).c_str(), as_hex(_ipaddr).c_str()); @@ -974,7 +974,7 @@ push_progress_point(std::string_view _name) auto _hash = tim::add_hash_id(_name); auto& _data = get_progress_bundles(); - if(OMNITRACE_LIKELY(_data != nullptr)) + if(ROCPROFSYS_LIKELY(_data != nullptr)) { auto* _bundle = _data->construct(_hash); _bundle->push(); @@ -988,7 +988,7 @@ pop_progress_point(std::string_view _name) if(config::get_causal_end_to_end()) return; auto& _data = get_progress_bundles(); - if(OMNITRACE_UNLIKELY(!_data || _data->empty())) return; + if(ROCPROFSYS_UNLIKELY(!_data || _data->empty())) return; if(_name.empty()) { auto* itr = _data->back(); @@ -1022,7 +1022,7 @@ mark_progress_point(std::string_view _name, bool _force) auto _hash = tim::add_hash_id(_name); auto& _data = get_progress_bundles(); - if(OMNITRACE_LIKELY(_data != nullptr)) + if(ROCPROFSYS_LIKELY(_data != nullptr)) { auto* _bundle = _data->construct(_hash); _bundle->push(); @@ -1052,7 +1052,7 @@ sample_virtual_speedup() void start_experimenting() { - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); auto _user_speedup_dist = config::get_causal_fixed_speedup(); if(!_user_speedup_dist.empty()) @@ -1060,7 +1060,7 @@ start_experimenting() speedup_dist.clear(); for(auto itr : _user_speedup_dist) { - OMNITRACE_CONDITIONAL_ABORT_F(itr > 100, + ROCPROFSYS_CONDITIONAL_ABORT_F(itr > 100, "Virtual speedups must be in range [0, 100]. " "Invalid virtual speedup: %lu\n", itr); @@ -1073,7 +1073,7 @@ start_experimenting() if(get_state() < State::Finalized) { - OMNITRACE_SCOPED_SAMPLING_ON_CHILD_THREADS(false); + ROCPROFSYS_SCOPED_SAMPLING_ON_CHILD_THREADS(false); auto _promise = std::make_shared>(); std::thread{ perform_experiment_impl, _promise }.detach(); _promise->get_future().wait_for(std::chrono::seconds{ 2 }); diff --git a/source/lib/omnitrace/library/causal/delay.cpp b/source/lib/omnitrace/library/causal/delay.cpp index 0568a9bb..99580ae1 100644 --- a/source/lib/omnitrace/library/causal/delay.cpp +++ b/source/lib/omnitrace/library/causal/delay.cpp @@ -72,12 +72,12 @@ compute_sleep_for_overhead() int64_t _end = tracing::now(); if(i < _nwarm) continue; auto _diff = (_end - _beg); - OMNITRACE_CONDITIONAL_THROW( + ROCPROFSYS_CONDITIONAL_THROW( _diff < _val, "Error! sleep_for(%zu) [nanoseconds] >= %zu", _val, _diff); _stats += (_diff - _val); } - OMNITRACE_BASIC_VERBOSE(2, + ROCPROFSYS_BASIC_VERBOSE(2, "[causal] overhead of std::this_thread::sleep_for(...) " "invocation = %6.3f usec +/- %e\n", _stats.get_mean() / units::usec, diff --git a/source/lib/omnitrace/library/causal/delay.hpp b/source/lib/omnitrace/library/causal/delay.hpp index 6f57d633..16bceb73 100644 --- a/source/lib/omnitrace/library/causal/delay.hpp +++ b/source/lib/omnitrace/library/causal/delay.hpp @@ -42,7 +42,7 @@ struct delay : comp::empty_base { using value_type = void; - OMNITRACE_DEFAULT_OBJECT(delay) + ROCPROFSYS_DEFAULT_OBJECT(delay) static void setup(); static void process(); diff --git a/source/lib/omnitrace/library/causal/experiment.cpp b/source/lib/omnitrace/library/causal/experiment.cpp index 467a1388..64f26b33 100644 --- a/source/lib/omnitrace/library/causal/experiment.cpp +++ b/source/lib/omnitrace/library/causal/experiment.cpp @@ -251,7 +251,7 @@ experiment::start() init_progress = component::progress_point::get_progress_points(); start_time = tracing::now(); - OMNITRACE_VERBOSE(0, "Starting causal experiment #%-3u: %s\n", index, + ROCPROFSYS_VERBOSE(0, "Starting causal experiment #%-3u: %s\n", index, as_string().c_str()); if(get_state() < State::Finalized) @@ -320,7 +320,7 @@ experiment::stop() if(_lowv <= 3 && (_mean < 5 || _medi < 5)) { - OMNITRACE_VERBOSE(2, + ROCPROFSYS_VERBOSE(2, "[progress points] increasing experiment time :: low: %6.3f, " "high: %6.3f, mean: %6.3f, median: %zi\n", _lowv, _high, _mean, _medi); @@ -330,7 +330,7 @@ experiment::stop() } else if(_mean > 10 && _lowv >= 8 && global_scaling > 1) { - OMNITRACE_VERBOSE(2, + ROCPROFSYS_VERBOSE(2, "[progress points] decreasing experiment time :: low: %6.3f, " "high: %6.3f, mean: %6.3f, median: %zi\n", _lowv, _high, _mean, _medi); @@ -338,9 +338,9 @@ experiment::stop() global_scaling_increments = 0; } - if(OMNITRACE_UNLIKELY(global_scaling_increments >= 5)) + if(ROCPROFSYS_UNLIKELY(global_scaling_increments >= 5)) { - OMNITRACE_WARNING( + ROCPROFSYS_WARNING( 0, "Warning! causal experimentation hasn't seen at least 5 progress points " "in the last %li experiments. Progress points are necessary for measuring " @@ -521,7 +521,7 @@ experiment::save_experiments(std::string _fname_base, const filename_config_t& _ } } - OMNITRACE_VERBOSE_F(1, "Processing line info for %zu sampled addresses...\n", + ROCPROFSYS_VERBOSE_F(1, "Processing line info for %zu sampled addresses...\n", _total_samples.size()); for(const auto& itr : _total_samples) @@ -569,7 +569,7 @@ experiment::save_experiments(std::string _fname_base, const filename_config_t& _ } else { - OMNITRACE_THROW("Error opening causal experiments output file: %s", + ROCPROFSYS_THROW("Error opening causal experiments output file: %s", _fname.c_str()); } } @@ -612,7 +612,7 @@ experiment::save_experiments(std::string _fname_base, const filename_config_t& _ ? _line_info.func : join(":", _line_info.file, _line_info.line); - OMNITRACE_CONDITIONAL_THROW( + ROCPROFSYS_CONDITIONAL_THROW( _name.empty(), "Error! causal experiment selection has no name: address=%s, file=%s, " "line=%u, func=%s", @@ -665,7 +665,7 @@ experiment::save_experiments(std::string _fname_base, const filename_config_t& _ } else { - OMNITRACE_THROW("Error opening causal experiments output file: %s", + ROCPROFSYS_THROW("Error opening causal experiments output file: %s", _fname.c_str()); } } @@ -703,7 +703,7 @@ experiment::load_experiments(std::string _fname, const filename_config_t& _cfg, { if(_throw_on_error) { - OMNITRACE_THROW("Error opening causal experiments input file: %s", + ROCPROFSYS_THROW("Error opening causal experiments input file: %s", _fname.c_str()); } } diff --git a/source/lib/omnitrace/library/causal/experiment.hpp b/source/lib/omnitrace/library/causal/experiment.hpp index 7663acd5..d52225cb 100644 --- a/source/lib/omnitrace/library/causal/experiment.hpp +++ b/source/lib/omnitrace/library/causal/experiment.hpp @@ -92,7 +92,7 @@ struct experiment static std::string description(); static const std::atomic& get_current_experiment(); - OMNITRACE_DEFAULT_OBJECT(experiment) + ROCPROFSYS_DEFAULT_OBJECT(experiment) bool start(); bool wait() const; // returns false if interrupted diff --git a/source/lib/omnitrace/library/causal/fwd.hpp b/source/lib/omnitrace/library/causal/fwd.hpp index 31db91a9..dce6a015 100644 --- a/source/lib/omnitrace/library/causal/fwd.hpp +++ b/source/lib/omnitrace/library/causal/fwd.hpp @@ -42,7 +42,7 @@ namespace unwind = ::tim::unwind; namespace causal { -static constexpr size_t unwind_depth = OMNITRACE_MAX_UNWIND_DEPTH; +static constexpr size_t unwind_depth = ROCPROFSYS_MAX_UNWIND_DEPTH; static constexpr size_t unwind_offset = 0; using unwind_stack_t = unwind::stack; using unwind_addr_t = container::static_vector; diff --git a/source/lib/omnitrace/library/causal/sampling.cpp b/source/lib/omnitrace/library/causal/sampling.cpp index b321d18d..fa51c36f 100644 --- a/source/lib/omnitrace/library/causal/sampling.cpp +++ b/source/lib/omnitrace/library/causal/sampling.cpp @@ -77,13 +77,13 @@ using overflow_enabled = trait::runtime_enabled; } // namespace causal } // namespace omnitrace -OMNITRACE_DEFINE_CONCRETE_TRAIT(prevent_reentry, causal::sampling::causal_sampler_t, +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(prevent_reentry, causal::sampling::causal_sampler_t, std::true_type) -OMNITRACE_DEFINE_CONCRETE_TRAIT(provide_backtrace, causal::sampling::causal_sampler_t, +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(provide_backtrace, causal::sampling::causal_sampler_t, std::false_type) -OMNITRACE_DEFINE_CONCRETE_TRAIT(buffer_size, causal::sampling::causal_sampler_t, +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(buffer_size, causal::sampling::causal_sampler_t, TIMEMORY_ESC(std::integral_constant)) namespace omnitrace @@ -219,11 +219,11 @@ configure(bool _setup, int64_t _tid) auto& _running = get_causal_sampler_running(_tid); auto& _signal_types = get_causal_sampler_signals(_tid); - OMNITRACE_CONDITIONAL_THROW(get_use_sampling(), + ROCPROFSYS_CONDITIONAL_THROW(get_use_sampling(), "Internal error! configuring causal profiling not " "permitted when sampling is enabled"); - OMNITRACE_SCOPED_SAMPLING_ON_CHILD_THREADS(false); + ROCPROFSYS_SCOPED_SAMPLING_ON_CHILD_THREADS(false); if(_setup && _signal_types.empty()) _signal_types = get_sampling_signals(_tid); @@ -287,7 +287,7 @@ configure(bool _setup, int64_t _tid) return perf::get_instance(_idx)->stop(); }, _tid, threading::get_sys_tid() }); - if(_tid == 0) OMNITRACE_VERBOSE(1, "causal profiling backend: perf\n"); + if(_tid == 0) ROCPROFSYS_VERBOSE(1, "causal profiling backend: perf\n"); } return _open_error; @@ -301,7 +301,7 @@ configure(bool _setup, int64_t _tid) _causal->configure(timer{ get_sampling_realtime_signal(), CLOCK_REALTIME, SIGEV_THREAD_ID, 1000.0, 1.0e-6, _tid, threading::get_sys_tid() }); - if(_tid == 0) OMNITRACE_VERBOSE(1, "causal profiling backend: timer\n"); + if(_tid == 0) ROCPROFSYS_VERBOSE(1, "causal profiling backend: timer\n"); return true; }; @@ -314,13 +314,13 @@ configure(bool _setup, int64_t _tid) if(get_causal_backend() == CausalBackend::Perf) { auto _perf_error = _activate_perf_backend(); - OMNITRACE_REQUIRE(!_perf_error) + ROCPROFSYS_REQUIRE(!_perf_error) << "perf backend for causal profiling failed to activate: " << *_perf_error << "\n"; } else if(get_causal_backend() == CausalBackend::Timer) { - OMNITRACE_REQUIRE(_activate_timer_backend()) + ROCPROFSYS_REQUIRE(_activate_timer_backend()) << "timer backend for causal profiling failed to activate\n"; } else if(get_causal_backend() == CausalBackend::Auto) @@ -333,11 +333,11 @@ configure(bool _setup, int64_t _tid) } else { - OMNITRACE_WARNING_F( + ROCPROFSYS_WARNING_F( 0, "perf backend for causal profiling failed to activate: %s\n", _perf_error->c_str()); - OMNITRACE_REQUIRE(_activate_timer_backend()) + ROCPROFSYS_REQUIRE(_activate_timer_backend()) << "timer backend for causal profiling failed to activate\n"; config::set_setting_value("ROCPROFSYS_CAUSAL_BACKEND", @@ -354,7 +354,7 @@ configure(bool _setup, int64_t _tid) } else if(!_setup && _causal && _running) { - OMNITRACE_DEBUG("Destroying causal sampler for thread %lu...\n", _tid); + ROCPROFSYS_DEBUG("Destroying causal sampler for thread %lu...\n", _tid); _running = false; if(_tid == threading::get_id() && !_signal_types.empty()) @@ -367,7 +367,7 @@ configure(bool _setup, int64_t _tid) // this propagates to all threads _causal->ignore(_signal_types); - for(int64_t i = 1; i < OMNITRACE_MAX_THREADS; ++i) + for(int64_t i = 1; i < ROCPROFSYS_MAX_THREADS; ++i) { if(get_causal_sampler(i)) { @@ -390,7 +390,7 @@ configure(bool _setup, int64_t _tid) _causal_perf.reset(); } - OMNITRACE_DEBUG("Causal sampler destroyed for thread %lu\n", _tid); + ROCPROFSYS_DEBUG("Causal sampler destroyed for thread %lu\n", _tid); } return _signal_types; @@ -489,7 +489,7 @@ void pause(ScopeT) bool _paused_v = *_process_paused; if(!_paused_v) { - for(auto i = 0; i < OMNITRACE_MAX_THREADS; ++i) + for(auto i = 0; i < ROCPROFSYS_MAX_THREADS; ++i) { auto& _causal_perf = perf::get_instance(i); if(_causal_perf) _causal_perf->stop(); @@ -528,7 +528,7 @@ void resume(ScopeT) bool _paused_v = *_process_paused; if(_paused_v) { - for(auto i = 0; i < OMNITRACE_MAX_THREADS; ++i) + for(auto i = 0; i < ROCPROFSYS_MAX_THREADS; ++i) { auto& _causal_perf = perf::get_instance(i); if(_causal_perf) _causal_perf->start(); @@ -566,9 +566,9 @@ unblock_signals(std::set _signals) void post_process() { - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); - OMNITRACE_VERBOSE(2 || get_debug_sampling(), + ROCPROFSYS_VERBOSE(2 || get_debug_sampling(), "Stopping causal sampling components...\n"); block_samples(); diff --git a/source/lib/omnitrace/library/causal/selected_entry.hpp b/source/lib/omnitrace/library/causal/selected_entry.hpp index bc45ffbc..ecbc5fd3 100644 --- a/source/lib/omnitrace/library/causal/selected_entry.hpp +++ b/source/lib/omnitrace/library/causal/selected_entry.hpp @@ -47,7 +47,7 @@ namespace causal { struct selected_entry { - OMNITRACE_DEFAULT_OBJECT(selected_entry) + ROCPROFSYS_DEFAULT_OBJECT(selected_entry) uintptr_t address = 0x0; uintptr_t symbol_address = 0x0; diff --git a/source/lib/omnitrace/library/components/CMakeLists.txt b/source/lib/omnitrace/library/components/CMakeLists.txt index 4d1e3efd..5e292a70 100644 --- a/source/lib/omnitrace/library/components/CMakeLists.txt +++ b/source/lib/omnitrace/library/components/CMakeLists.txt @@ -37,16 +37,16 @@ set(component_headers target_sources(rocprofsys-object-library PRIVATE ${component_sources} ${component_headers}) -if(OMNITRACE_USE_ROCPROFILER) +if(ROCPROFSYS_USE_ROCPROFILER) target_sources(rocprofsys-object-library PRIVATE ${CMAKE_CURRENT_LIST_DIR}/rocprofiler.cpp) endif() -if(OMNITRACE_USE_ROCTRACER) +if(ROCPROFSYS_USE_ROCTRACER) target_sources(rocprofsys-object-library PRIVATE ${CMAKE_CURRENT_LIST_DIR}/roctracer.cpp) endif() -if(OMNITRACE_USE_RCCL) +if(ROCPROFSYS_USE_RCCL) target_sources(rocprofsys-object-library PRIVATE ${CMAKE_CURRENT_LIST_DIR}/rcclp.cpp) endif() diff --git a/source/lib/omnitrace/library/components/backtrace.cpp b/source/lib/omnitrace/library/components/backtrace.cpp index beea4086..8ef33e16 100644 --- a/source/lib/omnitrace/library/components/backtrace.cpp +++ b/source/lib/omnitrace/library/components/backtrace.cpp @@ -192,7 +192,7 @@ backtrace::sample(int signo) if(signo == get_sampling_overflow_signal()) return; // on RedHat, the unw_step within get_unw_stack involves a mutex lock - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); using namespace tim::backtrace; constexpr bool with_signal_frame = false; diff --git a/source/lib/omnitrace/library/components/backtrace.hpp b/source/lib/omnitrace/library/components/backtrace.hpp index 33a13169..c8a04fd9 100644 --- a/source/lib/omnitrace/library/components/backtrace.hpp +++ b/source/lib/omnitrace/library/components/backtrace.hpp @@ -47,7 +47,7 @@ namespace component { struct backtrace : comp::empty_base { - static constexpr size_t stack_depth = OMNITRACE_MAX_UNWIND_DEPTH; + static constexpr size_t stack_depth = ROCPROFSYS_MAX_UNWIND_DEPTH; using data_t = tim::unwind::stack; using cache_type = typename data_t::cache_type; diff --git a/source/lib/omnitrace/library/components/backtrace_metrics.cpp b/source/lib/omnitrace/library/components/backtrace_metrics.cpp index f3706ac1..55151dc8 100644 --- a/source/lib/omnitrace/library/components/backtrace_metrics.cpp +++ b/source/lib/omnitrace/library/components/backtrace_metrics.cpp @@ -210,7 +210,7 @@ backtrace_metrics::configure(bool _setup, int64_t _tid) if constexpr(tim::trait::is_available::value) { perfetto_counter_track::init(); - OMNITRACE_DEBUG("HW COUNTER: starting...\n"); + ROCPROFSYS_DEBUG("HW COUNTER: starting...\n"); if(get_papi_vector(_tid)) { get_papi_vector(_tid)->start(); @@ -220,7 +220,7 @@ backtrace_metrics::configure(bool _setup, int64_t _tid) } else if(!_setup && _is_running) { - OMNITRACE_DEBUG("Destroying sampler for thread %lu...\n", _tid); + ROCPROFSYS_DEBUG("Destroying sampler for thread %lu...\n", _tid); *_running = false; if constexpr(tim::trait::is_available::value) @@ -228,10 +228,10 @@ backtrace_metrics::configure(bool _setup, int64_t _tid) if(_tid == threading::get_id()) { if(get_papi_vector(_tid)) get_papi_vector(_tid)->stop(); - OMNITRACE_DEBUG("HW COUNTER: stopped...\n"); + ROCPROFSYS_DEBUG("HW COUNTER: stopped...\n"); } } - OMNITRACE_DEBUG("Sampler destroyed for thread %lu\n", _tid); + ROCPROFSYS_DEBUG("Sampler destroyed for thread %lu\n", _tid); } } @@ -265,7 +265,7 @@ backtrace_metrics::init_perfetto(int64_t _tid, valid_array_t _valid) { std::string _desc = tim::papi::get_event_info(itr).short_descr; if(_desc.empty()) _desc = itr; - OMNITRACE_CI_THROW(_desc.empty(), "Empty description for %s\n", itr.c_str()); + ROCPROFSYS_CI_THROW(_desc.empty(), "Empty description for %s\n", itr.c_str()); perfetto_counter_track::emplace( _tid, JOIN(' ', "Thread", _desc, _tid_name, "(S)")); } @@ -278,7 +278,7 @@ backtrace_metrics::fini_perfetto(int64_t _tid, valid_array_t _valid) auto _hw_cnt_labels = *get_papi_labels(_tid); const auto& _thread_info = thread_info::get(_tid, SequentTID); - OMNITRACE_CI_THROW(!_thread_info, "Error! missing thread info for tid=%li\n", _tid); + ROCPROFSYS_CI_THROW(!_thread_info, "Error! missing thread info for tid=%li\n", _tid); if(!_thread_info) return; uint64_t _ts = _thread_info->get_stop(); @@ -409,15 +409,15 @@ backtrace_metrics::post_process_perfetto(int64_t _tid, uint64_t _ts) const } // namespace component } // namespace omnitrace -OMNITRACE_INSTANTIATE_EXTERN_COMPONENT( +ROCPROFSYS_INSTANTIATE_EXTERN_COMPONENT( TIMEMORY_ESC(data_tracker), true, double) -OMNITRACE_INSTANTIATE_EXTERN_COMPONENT( +ROCPROFSYS_INSTANTIATE_EXTERN_COMPONENT( TIMEMORY_ESC(data_tracker), true, double) -OMNITRACE_INSTANTIATE_EXTERN_COMPONENT( +ROCPROFSYS_INSTANTIATE_EXTERN_COMPONENT( TIMEMORY_ESC(data_tracker), true, double) diff --git a/source/lib/omnitrace/library/components/backtrace_metrics.hpp b/source/lib/omnitrace/library/components/backtrace_metrics.hpp index 512007a4..a2757d99 100644 --- a/source/lib/omnitrace/library/components/backtrace_metrics.hpp +++ b/source/lib/omnitrace/library/components/backtrace_metrics.hpp @@ -164,20 +164,20 @@ bool backtrace_metrics::operator()(Tp) const } // namespace component } // namespace omnitrace -#if !defined(OMNITRACE_EXTERN_COMPONENTS) || \ - (defined(OMNITRACE_EXTERN_COMPONENTS) && OMNITRACE_EXTERN_COMPONENTS > 0) +#if !defined(ROCPROFSYS_EXTERN_COMPONENTS) || \ + (defined(ROCPROFSYS_EXTERN_COMPONENTS) && ROCPROFSYS_EXTERN_COMPONENTS > 0) # include -OMNITRACE_DECLARE_EXTERN_COMPONENT( +ROCPROFSYS_DECLARE_EXTERN_COMPONENT( TIMEMORY_ESC(data_tracker), true, double) -OMNITRACE_DECLARE_EXTERN_COMPONENT( +ROCPROFSYS_DECLARE_EXTERN_COMPONENT( TIMEMORY_ESC(data_tracker), true, double) -OMNITRACE_DECLARE_EXTERN_COMPONENT( +ROCPROFSYS_DECLARE_EXTERN_COMPONENT( TIMEMORY_ESC(data_tracker), true, double) diff --git a/source/lib/omnitrace/library/components/callchain.cpp b/source/lib/omnitrace/library/components/callchain.cpp index 33bbf227..1654f276 100644 --- a/source/lib/omnitrace/library/components/callchain.cpp +++ b/source/lib/omnitrace/library/components/callchain.cpp @@ -178,7 +178,7 @@ callchain::sample(int signo) if(signo != get_sampling_overflow_signal()) return; // on RedHat, the unw_step within get_unw_stack involves a mutex lock - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); static thread_local const auto& _tinfo = thread_info::get(); auto _tid = _tinfo->index_data->sequent_value; diff --git a/source/lib/omnitrace/library/components/callchain.hpp b/source/lib/omnitrace/library/components/callchain.hpp index 681e61f3..37349a27 100644 --- a/source/lib/omnitrace/library/components/callchain.hpp +++ b/source/lib/omnitrace/library/components/callchain.hpp @@ -48,7 +48,7 @@ namespace component { struct callchain : comp::empty_base { - static constexpr size_t stack_depth = OMNITRACE_MAX_UNWIND_DEPTH; + static constexpr size_t stack_depth = ROCPROFSYS_MAX_UNWIND_DEPTH; struct record { diff --git a/source/lib/omnitrace/library/components/category_region.hpp b/source/lib/omnitrace/library/components/category_region.hpp index 5ef91ae8..bd944ecf 100644 --- a/source/lib/omnitrace/library/components/category_region.hpp +++ b/source/lib/omnitrace/library/components/category_region.hpp @@ -136,7 +136,7 @@ category_region::start(std::string_view name, Args&&... args) if(name.empty()) return; - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); // the expectation here is that if the state is not active then the call // to omnitrace_init_tooling_hidden will activate all the appropriate @@ -154,7 +154,7 @@ category_region::start(std::string_view name, Args&&... args) constexpr bool _ct_use_causal = (sizeof...(OptsT) == 0 || is_one_of>::value); - OMNITRACE_CONDITIONAL_PRINT( + ROCPROFSYS_CONDITIONAL_PRINT( tracing::debug_push, "[%s][PID=%i][state=%s][thread_state=%s] omnitrace_push_region(%s)\n", category_name, process::get_id(), std::to_string(get_state()).c_str(), @@ -203,7 +203,7 @@ category_region::stop(std::string_view name, Args&&... args) if(get_thread_state() == ThreadState::Disabled) return; - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); constexpr bool _ct_use_timemory = (sizeof...(OptsT) == 0 || is_one_of>::value); @@ -214,7 +214,7 @@ category_region::stop(std::string_view name, Args&&... args) constexpr bool _ct_use_causal = (sizeof...(OptsT) == 0 || is_one_of>::value); - OMNITRACE_CONDITIONAL_PRINT( + ROCPROFSYS_CONDITIONAL_PRINT( tracing::debug_pop, "[%s][PID=%i][state=%s][thread_state=%s] omnitrace_pop_region(%s)\n", category_name, process::get_id(), std::to_string(get_state()).c_str(), @@ -260,7 +260,7 @@ category_region::stop(std::string_view name, Args&&... args) else { static auto _debug = get_debug_env(); - OMNITRACE_CONDITIONAL_BASIC_PRINT( + ROCPROFSYS_CONDITIONAL_BASIC_PRINT( _debug, "[%s] omnitrace_pop_region(%s) ignored :: state = %s\n", category_name, name.data(), std::to_string(get_state()).c_str()); } @@ -287,11 +287,11 @@ category_region::mark(std::string_view name, Args&&...) // unconditionally return if thread is disabled or finalized if(get_thread_state() >= ThreadState::Completed) return; - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); if(get_use_causal()) { - OMNITRACE_CONDITIONAL_PRINT( + ROCPROFSYS_CONDITIONAL_PRINT( tracing::debug_mark, "[%s][PID=%i][state=%s][thread_state=%s] omnitrace_progress(%s)\n", category_name, process::get_id(), std::to_string(get_state()).c_str(), @@ -311,7 +311,7 @@ category_region::audit(const gotcha_data_t& _data, audit::incoming, if(config::get_perfetto_annotations()) { int64_t _n = 0; - OMNITRACE_FOLD_EXPRESSION(tracing::add_perfetto_annotation( + ROCPROFSYS_FOLD_EXPRESSION(tracing::add_perfetto_annotation( ctx, tim::try_demangle>(), _args, _n++)); } }); @@ -339,7 +339,7 @@ category_region::audit(std::string_view _name, audit::incoming, if(config::get_perfetto_annotations()) { int64_t _n = 0; - OMNITRACE_FOLD_EXPRESSION(tracing::add_perfetto_annotation( + ROCPROFSYS_FOLD_EXPRESSION(tracing::add_perfetto_annotation( ctx, tim::try_demangle>(), _args, _n++)); } }); diff --git a/source/lib/omnitrace/library/components/comm_data.cpp b/source/lib/omnitrace/library/components/comm_data.cpp index e1cd9741..ce1587b5 100644 --- a/source/lib/omnitrace/library/components/comm_data.cpp +++ b/source/lib/omnitrace/library/components/comm_data.cpp @@ -105,7 +105,7 @@ comm_data::configure() comm_data_tracker_t::set_format_flags(_fmt_flags); } -#if defined(OMNITRACE_USE_MPI) +#if defined(ROCPROFSYS_USE_MPI) // MPI_Send void comm_data::audit(const gotcha_data& _data, audit::incoming, const void*, int count, @@ -297,7 +297,7 @@ comm_data::audit(const gotcha_data& _data, audit::incoming, const void*, int sen } #endif -#if defined(OMNITRACE_USE_RCCL) +#if defined(ROCPROFSYS_USE_RCCL) // ncclReduce void comm_data::audit(const gotcha_data& _data, audit::incoming, const void*, const void*, @@ -340,7 +340,7 @@ comm_data::audit(const gotcha_data& _data, audit::incoming, const void*, size_t } else { - OMNITRACE_CI_THROW(true, "RCCL function not handled: %s", _data.tool_id.c_str()); + ROCPROFSYS_CI_THROW(true, "RCCL function not handled: %s", _data.tool_id.c_str()); } write_perfetto_counter_track(count * _size); @@ -395,7 +395,7 @@ comm_data::audit(const gotcha_data& _data, audit::incoming, const void*, const v } else { - OMNITRACE_CI_THROW(true, "RCCL function not handled: %s", _data.tool_id.c_str()); + ROCPROFSYS_CI_THROW(true, "RCCL function not handled: %s", _data.tool_id.c_str()); } if(!omnitrace::get_use_timemory()) return; @@ -419,7 +419,7 @@ comm_data::audit(const gotcha_data& _data, audit::incoming, const void*, const v } // namespace component } // namespace omnitrace -OMNITRACE_INSTANTIATE_EXTERN_COMPONENT( +ROCPROFSYS_INSTANTIATE_EXTERN_COMPONENT( TIMEMORY_ESC(data_tracker), true, float) -OMNITRACE_INSTANTIATE_EXTERN_COMPONENT(comm_data, false, void) +ROCPROFSYS_INSTANTIATE_EXTERN_COMPONENT(comm_data, false, void) diff --git a/source/lib/omnitrace/library/components/comm_data.hpp b/source/lib/omnitrace/library/components/comm_data.hpp index 0c297bb5..bda6c3e0 100644 --- a/source/lib/omnitrace/library/components/comm_data.hpp +++ b/source/lib/omnitrace/library/components/comm_data.hpp @@ -38,7 +38,7 @@ #include -#if defined(OMNITRACE_USE_MPI) +#if defined(ROCPROFSYS_USE_MPI) # include #endif @@ -49,7 +49,7 @@ #include #include -OMNITRACE_COMPONENT_ALIAS(comm_data_tracker_t, +ROCPROFSYS_COMPONENT_ALIAS(comm_data_tracker_t, ::tim::component::data_tracker) namespace omnitrace @@ -90,7 +90,7 @@ struct comm_data : base static constexpr auto label = "RCCL Comm Send"; }; - OMNITRACE_DEFAULT_OBJECT(comm_data) + ROCPROFSYS_DEFAULT_OBJECT(comm_data) static void preinit(); static void configure(); @@ -98,7 +98,7 @@ struct comm_data : base static void start() {} static void stop() {} -#if defined(OMNITRACE_USE_MPI) +#if defined(ROCPROFSYS_USE_MPI) static int mpi_type_size(MPI_Datatype _datatype) { int _size = 0; @@ -148,7 +148,7 @@ struct comm_data : base MPI_Datatype recvtype, MPI_Comm); #endif -#if defined(OMNITRACE_USE_RCCL) +#if defined(ROCPROFSYS_USE_RCCL) static auto rccl_type_size(ncclDataType_t datatype) { switch(datatype) @@ -230,15 +230,15 @@ struct comm_data : base } // namespace component } // namespace omnitrace -#if !defined(OMNITRACE_EXTERN_COMPONENTS) || \ - (defined(OMNITRACE_EXTERN_COMPONENTS) && OMNITRACE_EXTERN_COMPONENTS > 0) +#if !defined(ROCPROFSYS_EXTERN_COMPONENTS) || \ + (defined(ROCPROFSYS_EXTERN_COMPONENTS) && ROCPROFSYS_EXTERN_COMPONENTS > 0) # include # include # include -OMNITRACE_DECLARE_EXTERN_COMPONENT( +ROCPROFSYS_DECLARE_EXTERN_COMPONENT( TIMEMORY_ESC(data_tracker), true, float) -OMNITRACE_DECLARE_EXTERN_COMPONENT(comm_data, false, void) +ROCPROFSYS_DECLARE_EXTERN_COMPONENT(comm_data, false, void) #endif diff --git a/source/lib/omnitrace/library/components/cpu_freq.cpp b/source/lib/omnitrace/library/components/cpu_freq.cpp index 4444eadc..147844d6 100644 --- a/source/lib/omnitrace/library/components/cpu_freq.cpp +++ b/source/lib/omnitrace/library/components/cpu_freq.cpp @@ -98,7 +98,7 @@ cpu_freq::configure() { if(_v.find_first_not_of("0123456789-") != std::string::npos) { - OMNITRACE_VERBOSE_F( + ROCPROFSYS_VERBOSE_F( 0, "Invalid CPU specification. Only numerical values (e.g., 0) or " "ranges (e.g., 0-7) are permitted. Ignoring %s...", @@ -108,7 +108,7 @@ cpu_freq::configure() if(_v.find('-') != std::string::npos) { auto _vv = tim::delimit(_v, "-"); - OMNITRACE_CONDITIONAL_THROW( + ROCPROFSYS_CONDITIONAL_THROW( _vv.size() != 2, "Invalid CPU range specification: %s. Required format N-M, e.g. 0-4", _v.c_str()); @@ -137,19 +137,19 @@ cpu_freq::configure() _enabled_freqs.emplace(itr); else { - OMNITRACE_VERBOSE( + ROCPROFSYS_VERBOSE( 0, "[cpu_freq::config] Warning! Removing invalid cpu %zu...\n", itr); } } if(!cpuinfo::freq{}) { - OMNITRACE_VERBOSE(0, "[cpu_freq::config] Warning! CPU frequencies are disabled " + ROCPROFSYS_VERBOSE(0, "[cpu_freq::config] Warning! CPU frequencies are disabled " ":: unable to open /proc/cpuinfo"); _enabled_freqs.clear(); } - OMNITRACE_CI_FAIL(!cpuinfo::freq{}, "[cpu_freq::config] CPU frequencies are disabled " + ROCPROFSYS_CI_FAIL(!cpuinfo::freq{}, "[cpu_freq::config] CPU frequencies are disabled " ":: unable to open /proc/cpuinfo"); get_enabled_cpus() = _enabled_freqs; diff --git a/source/lib/omnitrace/library/components/cpu_freq.hpp b/source/lib/omnitrace/library/components/cpu_freq.hpp index 66904bf8..14729a2b 100644 --- a/source/lib/omnitrace/library/components/cpu_freq.hpp +++ b/source/lib/omnitrace/library/components/cpu_freq.hpp @@ -44,7 +44,7 @@ struct cpu_freq using storage_type = tim::storage; using cpu_id_set_t = std::set; - OMNITRACE_DEFAULT_OBJECT(cpu_freq) + ROCPROFSYS_DEFAULT_OBJECT(cpu_freq) // string id for component static std::string label(); diff --git a/source/lib/omnitrace/library/components/ensure_storage.hpp b/source/lib/omnitrace/library/components/ensure_storage.hpp index 383f3a45..266f283e 100644 --- a/source/lib/omnitrace/library/components/ensure_storage.hpp +++ b/source/lib/omnitrace/library/components/ensure_storage.hpp @@ -39,9 +39,9 @@ namespace template struct ensure_storage { - OMNITRACE_DEFAULT_OBJECT(ensure_storage) + ROCPROFSYS_DEFAULT_OBJECT(ensure_storage) - void operator()() const { OMNITRACE_FOLD_EXPRESSION((*this)(tim::type_list{})); } + void operator()() const { ROCPROFSYS_FOLD_EXPRESSION((*this)(tim::type_list{})); } private: template ::value, int> = 0> diff --git a/source/lib/omnitrace/library/components/exit_gotcha.cpp b/source/lib/omnitrace/library/components/exit_gotcha.cpp index 540da5d4..abe7334e 100644 --- a/source/lib/omnitrace/library/components/exit_gotcha.cpp +++ b/source/lib/omnitrace/library/components/exit_gotcha.cpp @@ -64,13 +64,13 @@ invoke_exit_gotcha(const exit_gotcha::gotcha_data& _data, FuncT _func, Args... _ { if(config::settings_are_configured()) { - OMNITRACE_VERBOSE(0, "finalizing %s before calling %s(%s)...\n", + ROCPROFSYS_VERBOSE(0, "finalizing %s before calling %s(%s)...\n", get_exe_name().c_str(), _data.tool_id.c_str(), JOIN(", ", _args...).c_str()); } else { - OMNITRACE_BASIC_VERBOSE(0, "finalizing %s before calling %s(%s)...\n", + ROCPROFSYS_BASIC_VERBOSE(0, "finalizing %s before calling %s(%s)...\n", get_exe_name().c_str(), _data.tool_id.c_str(), JOIN(", ", _args...).c_str()); } @@ -80,18 +80,18 @@ invoke_exit_gotcha(const exit_gotcha::gotcha_data& _data, FuncT _func, Args... _ if(config::settings_are_configured()) { - OMNITRACE_VERBOSE(0, "calling %s(%s) in %s...\n", _data.tool_id.c_str(), + ROCPROFSYS_VERBOSE(0, "calling %s(%s) in %s...\n", _data.tool_id.c_str(), JOIN(", ", _args...).c_str(), get_exe_name().c_str()); } else { - OMNITRACE_BASIC_VERBOSE(0, "calling %s(%s) in %s...\n", _data.tool_id.c_str(), + ROCPROFSYS_BASIC_VERBOSE(0, "calling %s(%s) in %s...\n", _data.tool_id.c_str(), JOIN(", ", _args...).c_str(), get_exe_name().c_str()); } if(_exit_info.is_known && _exit_info.exit_code != 0) { - OMNITRACE_BASIC_VERBOSE(0, "%s exiting with non-zero exit code: %i...\n", + ROCPROFSYS_BASIC_VERBOSE(0, "%s exiting with non-zero exit code: %i...\n", get_exe_name().c_str(), _exit_info.exit_code); } diff --git a/source/lib/omnitrace/library/components/exit_gotcha.hpp b/source/lib/omnitrace/library/components/exit_gotcha.hpp index b5a63bad..b2c69c42 100644 --- a/source/lib/omnitrace/library/components/exit_gotcha.hpp +++ b/source/lib/omnitrace/library/components/exit_gotcha.hpp @@ -44,7 +44,7 @@ struct exit_gotcha : tim::component::base using exit_func_t = void (*)(int); using abort_func_t = void (*)(); - OMNITRACE_DEFAULT_OBJECT(exit_gotcha) + ROCPROFSYS_DEFAULT_OBJECT(exit_gotcha) // string id for component static std::string label() { return "exit_gotcha"; } diff --git a/source/lib/omnitrace/library/components/fork_gotcha.cpp b/source/lib/omnitrace/library/components/fork_gotcha.cpp index c85d3503..16fc1050 100644 --- a/source/lib/omnitrace/library/components/fork_gotcha.cpp +++ b/source/lib/omnitrace/library/components/fork_gotcha.cpp @@ -66,8 +66,8 @@ prefork_setup() { if(prefork_lock) return; - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); - OMNITRACE_SCOPED_SAMPLING_ON_CHILD_THREADS(false); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_SAMPLING_ON_CHILD_THREADS(false); if(get_state() < State::Active && !config::settings_are_configured()) omnitrace_init_library_hidden(); @@ -75,9 +75,9 @@ prefork_setup() tim::set_env("ROCPROFSYS_PRELOAD", "0", 1); tim::set_env("ROCPROFSYS_ROOT_PROCESS", process::get_id(), 0); omnitrace_reset_preload_hidden(); - OMNITRACE_BASIC_VERBOSE(0, "fork() called on PID %i (rank: %i), TID %li\n", + ROCPROFSYS_BASIC_VERBOSE(0, "fork() called on PID %i (rank: %i), TID %li\n", process::get_id(), dmp::rank(), threading::get_id()); - OMNITRACE_BASIC_DEBUG( + ROCPROFSYS_BASIC_DEBUG( "Warning! Calling fork() within an OpenMPI application using libfabric " "may result is segmentation fault\n"); TIMEMORY_CONDITIONAL_DEMANGLED_BACKTRACE(get_debug_env(), 16); @@ -111,7 +111,7 @@ postfork_child() { if(postfork_child_lock) return; - OMNITRACE_REQUIRE(is_child_process()) + ROCPROFSYS_REQUIRE(is_child_process()) << "Error! child process " << process::get_id() << " believes it is the root process " << get_root_process_id() << "\n"; @@ -155,7 +155,7 @@ fork_gotcha::operator()(const gotcha_data_t&, pid_t (*_real_fork)()) const if(_pid != 0) { - OMNITRACE_BASIC_VERBOSE(0, "fork() called on PID %i created PID %i\n", getpid(), + ROCPROFSYS_BASIC_VERBOSE(0, "fork() called on PID %i created PID %i\n", getpid(), _pid); postfork_parent(); @@ -167,9 +167,9 @@ fork_gotcha::operator()(const gotcha_data_t&, pid_t (*_real_fork)()) const if(!settings::use_output_suffix()) { - OMNITRACE_BASIC_VERBOSE( + ROCPROFSYS_BASIC_VERBOSE( 0, "Application which make calls to fork() should enable using an process " - "identifier output suffix (i.e. set OMNITRACE_USE_PID=ON)\n"); + "identifier output suffix (i.e. set ROCPROFSYS_USE_PID=ON)\n"); } return _pid; diff --git a/source/lib/omnitrace/library/components/fork_gotcha.hpp b/source/lib/omnitrace/library/components/fork_gotcha.hpp index a58b7313..f661ad68 100644 --- a/source/lib/omnitrace/library/components/fork_gotcha.hpp +++ b/source/lib/omnitrace/library/components/fork_gotcha.hpp @@ -37,7 +37,7 @@ struct fork_gotcha : comp::base using gotcha_data_t = comp::gotcha_data; - OMNITRACE_DEFAULT_OBJECT(fork_gotcha) + ROCPROFSYS_DEFAULT_OBJECT(fork_gotcha) // string id for component static std::string label() { return "fork_gotcha"; } diff --git a/source/lib/omnitrace/library/components/mpi_gotcha.cpp b/source/lib/omnitrace/library/components/mpi_gotcha.cpp index 640c87fd..df6930f8 100644 --- a/source/lib/omnitrace/library/components/mpi_gotcha.cpp +++ b/source/lib/omnitrace/library/components/mpi_gotcha.cpp @@ -75,7 +75,7 @@ struct comm_rank_data friend bool operator>(const comm_rank_data& _lhs, const comm_rank_data& _rhs) { - OMNITRACE_CI_THROW(!_lhs.updated() && !_rhs.updated(), + ROCPROFSYS_CI_THROW(!_lhs.updated() && !_rhs.updated(), "Error! comparing rank data that is not updated"); if(_lhs.updated() && !_rhs.updated()) return true; @@ -112,7 +112,7 @@ omnitrace_mpi_copy(MPI_Comm, int, void*, void*, void*, int*) int omnitrace_mpi_fini(MPI_Comm, int, void*, void*) { - OMNITRACE_DEBUG("MPI Comm attribute finalize\n"); + ROCPROFSYS_DEBUG("MPI Comm attribute finalize\n"); auto _blocked = get_sampling_signals(); if(!_blocked.empty()) tim::signals::block_signals(_blocked, tim::signals::sigmask_scope::process); @@ -168,7 +168,7 @@ mpi_gotcha::configure() reject_bindings.emplace("MPI_Init"); reject_bindings.emplace("MPI_Init_thread"); reject_bindings.emplace("MPI_Finalize"); -#if defined(OMNITRACE_USE_MPI_HEADERS) && OMNITRACE_USE_MPI_HEADERS > 0 +#if defined(ROCPROFSYS_USE_MPI_HEADERS) && ROCPROFSYS_USE_MPI_HEADERS > 0 mpi_gotcha_t::template configure<3, int, comm_t, int*>("MPI_Comm_rank"); mpi_gotcha_t::template configure<4, int, comm_t, int*>("MPI_Comm_size"); reject_bindings.emplace("MPI_Comm_rank"); @@ -211,7 +211,7 @@ mpi_gotcha::update() tim::mpi::set_size(_size); tim::settings::default_process_suffix() = _rank; - OMNITRACE_BASIC_VERBOSE(0, "[pid=%i] MPI rank: %i (%i), MPI size: %i (%i)\n", + ROCPROFSYS_BASIC_VERBOSE(0, "[pid=%i] MPI rank: %i (%i), MPI size: %i (%i)\n", process::get_id(), tim::mpi::rank(), _rank, tim::mpi::size(), _size); last_comm_record = _rank_data; @@ -224,7 +224,7 @@ mpi_gotcha::update() void mpi_gotcha::disable_comm_intercept() { -#if defined(OMNITRACE_USE_MPI_HEADERS) && OMNITRACE_USE_MPI_HEADERS > 0 +#if defined(ROCPROFSYS_USE_MPI_HEADERS) && ROCPROFSYS_USE_MPI_HEADERS > 0 mpi_gotcha_t::revert<3>(); mpi_gotcha_t::revert<4>(); #endif @@ -233,7 +233,7 @@ mpi_gotcha::disable_comm_intercept() void mpi_gotcha::audit(const gotcha_data_t& _data, audit::incoming, int*, char***) { - OMNITRACE_BASIC_DEBUG_F("%s(int*, char***)\n", _data.tool_id.c_str()); + ROCPROFSYS_BASIC_DEBUG_F("%s(int*, char***)\n", _data.tool_id.c_str()); omnitrace_push_trace_hidden(_data.tool_id.c_str()); #if !defined(TIMEMORY_USE_MPI) && defined(TIMEMORY_USE_MPI_HEADERS) @@ -245,7 +245,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*) { - OMNITRACE_BASIC_DEBUG_F("%s(int*, char***, int, int*)\n", _data.tool_id.c_str()); + ROCPROFSYS_BASIC_DEBUG_F("%s(int*, char***, int, int*)\n", _data.tool_id.c_str()); omnitrace_push_trace_hidden(_data.tool_id.c_str()); #if !defined(TIMEMORY_USE_MPI) && defined(TIMEMORY_USE_MPI_HEADERS) @@ -257,7 +257,7 @@ 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_BASIC_DEBUG_F("%s()\n", _data.tool_id.c_str()); + ROCPROFSYS_BASIC_DEBUG_F("%s()\n", _data.tool_id.c_str()); auto _blocked = get_sampling_signals(); if(!_blocked.empty()) @@ -278,7 +278,7 @@ mpi_gotcha::audit(const gotcha_data_t& _data, audit::incoming) void mpi_gotcha::audit(const gotcha_data_t& _data, audit::incoming, comm_t _comm, int* _val) { - OMNITRACE_BASIC_DEBUG_F("%s()\n", _data.tool_id.c_str()); + ROCPROFSYS_BASIC_DEBUG_F("%s()\n", _data.tool_id.c_str()); omnitrace_push_trace_hidden(_data.tool_id.c_str()); if(_data.tool_id == "MPI_Comm_rank") @@ -293,7 +293,7 @@ mpi_gotcha::audit(const gotcha_data_t& _data, audit::incoming, comm_t _comm, int } else { - OMNITRACE_BASIC_PRINT_F("%s(, %p) :: unexpected function wrapper\n", + ROCPROFSYS_BASIC_PRINT_F("%s(, %p) :: unexpected function wrapper\n", _data.tool_id.c_str(), static_cast(_val)); } } @@ -301,7 +301,7 @@ mpi_gotcha::audit(const gotcha_data_t& _data, audit::incoming, comm_t _comm, int void mpi_gotcha::audit(const gotcha_data_t& _data, audit::outgoing, int _retval) { - OMNITRACE_BASIC_DEBUG_F("%s() returned %i\n", _data.tool_id.c_str(), (int) _retval); + ROCPROFSYS_BASIC_DEBUG_F("%s() returned %i\n", _data.tool_id.c_str(), (int) _retval); if(!settings::use_output_suffix()) settings::use_output_suffix() = true; @@ -315,9 +315,9 @@ mpi_gotcha::audit(const gotcha_data_t& _data, audit::outgoing, int _retval) // were excluded via a regex expression) if(get_use_mpip()) { - OMNITRACE_BASIC_VERBOSE_F(2, "Activating MPI wrappers...\n"); + ROCPROFSYS_BASIC_VERBOSE_F(2, "Activating MPI wrappers...\n"); - // use env vars OMNITRACE_MPIP_PERMIT_LIST and OMNITRACE_MPIP_REJECT_LIST + // use env vars ROCPROFSYS_MPIP_PERMIT_LIST and ROCPROFSYS_MPIP_REJECT_LIST // to control the gotcha bindings at runtime comp::configure_mpip(permit_bindings, reject_bindings); @@ -363,7 +363,7 @@ mpi_gotcha::audit(const gotcha_data_t& _data, audit::outgoing, int _retval) } else { - OMNITRACE_BASIC_VERBOSE( + ROCPROFSYS_BASIC_VERBOSE( 0, "%s() returned %i :: unexpected function wrapper\n", _data.tool_id.c_str(), (int) _retval); } diff --git a/source/lib/omnitrace/library/components/mpi_gotcha.hpp b/source/lib/omnitrace/library/components/mpi_gotcha.hpp index 20ff490e..7f294066 100644 --- a/source/lib/omnitrace/library/components/mpi_gotcha.hpp +++ b/source/lib/omnitrace/library/components/mpi_gotcha.hpp @@ -38,7 +38,7 @@ struct mpi_gotcha : comp::base using comm_t = tim::mpi::comm_t; using gotcha_data_t = comp::gotcha_data; - OMNITRACE_DEFAULT_OBJECT(mpi_gotcha) + ROCPROFSYS_DEFAULT_OBJECT(mpi_gotcha) // string id for component static std::string label() { return "mpi_gotcha"; } diff --git a/source/lib/omnitrace/library/components/numa_gotcha.hpp b/source/lib/omnitrace/library/components/numa_gotcha.hpp index 78b65648..81a87f0f 100644 --- a/source/lib/omnitrace/library/components/numa_gotcha.hpp +++ b/source/lib/omnitrace/library/components/numa_gotcha.hpp @@ -44,7 +44,7 @@ struct numa_gotcha : tim::component::base using exit_func_t = void (*)(int); using abort_func_t = void (*)(); - OMNITRACE_DEFAULT_OBJECT(numa_gotcha) + ROCPROFSYS_DEFAULT_OBJECT(numa_gotcha) // string id for component static std::string label() { return "numa_gotcha"; } diff --git a/source/lib/omnitrace/library/components/pthread_create_gotcha.cpp b/source/lib/omnitrace/library/components/pthread_create_gotcha.cpp index e34c8306..30c0db4f 100644 --- a/source/lib/omnitrace/library/components/pthread_create_gotcha.cpp +++ b/source/lib/omnitrace/library/components/pthread_create_gotcha.cpp @@ -83,7 +83,7 @@ start_bundle(bundle_t& _bundle, int64_t _tid, Args&&... _args) { if(!get_use_timemory() && !get_use_perfetto()) return; trait::runtime_enabled::set(get_use_roctracer()); - OMNITRACE_BASIC_VERBOSE_F(3, "starting bundle '%s' in thread %li...\n", + ROCPROFSYS_BASIC_VERBOSE_F(3, "starting bundle '%s' in thread %li...\n", _bundle.key().c_str(), _tid); if constexpr(sizeof...(Args) > 0) { @@ -117,7 +117,7 @@ stop_bundle(bundle_t& _bundle, int64_t _tid, Args&&... _args) _this_manager->is_finalized()) return; - OMNITRACE_BASIC_VERBOSE_F(3, "stopping bundle '%s' in thread %li...\n", + ROCPROFSYS_BASIC_VERBOSE_F(3, "stopping bundle '%s' in thread %li...\n", _bundle.key().c_str(), _tid); if(get_use_timemory()) { @@ -211,7 +211,7 @@ pthread_create_gotcha::wrapper::operator()() const _thr_bundle->stop(); if(_bundle) stop_bundle(*_bundle, _tid); pthread_create_gotcha::shutdown(_tid); - OMNITRACE_BASIC_VERBOSE( + ROCPROFSYS_BASIC_VERBOSE( 1, "[PID=%i][rank=%i] Thread %s (parent: %s) exited\n", process::get_id(), dmp::rank(), _info->index_data->as_string().c_str(), _parent_info->index_data->as_string().c_str()); @@ -230,7 +230,7 @@ pthread_create_gotcha::wrapper::operator()() const if(_active && !_coverage && !m_config.offset) { _tid = _info->index_data->sequent_value; - OMNITRACE_BASIC_VERBOSE(1, "[PID=%i][rank=%i] Thread %s (parent: %s) created\n", + ROCPROFSYS_BASIC_VERBOSE(1, "[PID=%i][rank=%i] Thread %s (parent: %s) created\n", process::get_id(), dmp::rank(), _info->index_data->as_string().c_str(), _parent_info->index_data->as_string().c_str()); @@ -260,21 +260,21 @@ pthread_create_gotcha::wrapper::operator()() const causal::delay::get_local(_tid) = causal::delay::get_local(_parent_info->index_data->sequent_value); _is_sampling = true; - OMNITRACE_SCOPED_SAMPLING_ON_CHILD_THREADS(false); + ROCPROFSYS_SCOPED_SAMPLING_ON_CHILD_THREADS(false); _signals = causal::sampling::setup(); causal::sampling::unblock_signals(); } else if(m_config.enable_sampling) { _is_sampling = true; - OMNITRACE_SCOPED_SAMPLING_ON_CHILD_THREADS(false); + ROCPROFSYS_SCOPED_SAMPLING_ON_CHILD_THREADS(false); _signals = sampling::setup(); sampling::unblock_signals(); } } else if(m_config.offset) { - OMNITRACE_BASIC_VERBOSE( + ROCPROFSYS_BASIC_VERBOSE( 2, "[PID=%i][rank=%i] Thread %s (parent: %s) created [started by omnitrace]\n", process::get_id(), dmp::rank(), _info->index_data->as_string().c_str(), @@ -429,7 +429,7 @@ pthread_create_gotcha::shutdown() std::this_thread::sleep_for(std::chrono::milliseconds{ 50 }); } - OMNITRACE_CI_BASIC_FAIL( + ROCPROFSYS_CI_BASIC_FAIL( shutdown_signals_delivered != _expected_shutdown_signals_delivered, "Number of signals delivered (%zu) != expected number of signals delievered " "(%zu)", @@ -458,13 +458,13 @@ pthread_create_gotcha::shutdown() if(config::settings_are_configured()) { - OMNITRACE_VERBOSE(2 && _ndangling > 0, + ROCPROFSYS_VERBOSE(2 && _ndangling > 0, "[pthread_create_gotcha] cleaned up %lu dangling bundles\n", _ndangling); } else { - OMNITRACE_BASIC_VERBOSE( + ROCPROFSYS_BASIC_VERBOSE( 2 && _ndangling > 0, "[pthread_create_gotcha] cleaned up %lu dangling bundles\n", _ndangling); } @@ -518,7 +518,7 @@ pthread_create_gotcha::operator()(pthread_t* thread, const pthread_attr_t* attr, auto _active = (_glob_state == ::omnitrace::State::Active && !_disabled); const auto& _info = thread_info::init(!_active || !_sample_child || _disabled); - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); auto _coverage = (_mode == Mode::Coverage); auto _use_sampling = config::get_use_sampling(); @@ -534,7 +534,7 @@ pthread_create_gotcha::operator()(pthread_t* thread, const pthread_attr_t* attr, get_env(TIMEMORY_SETTINGS_PREFIX "DEBUG_THREADING_GET_ID", false); auto _verbose = (debug_threading_get_id) ? 0 : 3; - OMNITRACE_VERBOSE( + ROCPROFSYS_VERBOSE( _verbose, "Creating new thread :: global_state=%s, thread_state=%s, mode=%s, active=%s, " "coverage=%s, use_causal=%s, use_sampling=%s, sample_children=%s, tid=%li, " @@ -557,7 +557,7 @@ pthread_create_gotcha::operator()(pthread_t* thread, const pthread_attr_t* attr, if(_active && !_disabled && !_info->is_offset) { - OMNITRACE_BASIC_VERBOSE(2, "[PID=%i][rank=%i] Starting new thread on %s...\n", + ROCPROFSYS_BASIC_VERBOSE(2, "[PID=%i][rank=%i] Starting new thread on %s...\n", process::get_id(), dmp::rank(), _info->index_data->as_string().c_str()); } @@ -565,7 +565,7 @@ pthread_create_gotcha::operator()(pthread_t* thread, const pthread_attr_t* attr, // ensure that cpu cid stack exists on the parent thread if active if(_active && !_coverage) { - OMNITRACE_DEBUG("blocking signals...\n"); + ROCPROFSYS_DEBUG("blocking signals...\n"); get_cpu_cid_stack(); } @@ -580,7 +580,7 @@ pthread_create_gotcha::operator()(pthread_t* thread, const pthread_attr_t* attr, // block the signals in entire process if(_enable_sampling && !_blocked.empty()) { - OMNITRACE_DEBUG("blocking signals...\n"); + ROCPROFSYS_DEBUG("blocking signals...\n"); tim::signals::block_signals(_blocked, tim::signals::sigmask_scope::process); } @@ -600,7 +600,7 @@ pthread_create_gotcha::operator()(pthread_t* thread, const pthread_attr_t* attr, // wait for thread to set promise if(_promise) { - OMNITRACE_DEBUG("waiting for child to signal it is setup...\n"); + ROCPROFSYS_DEBUG("waiting for child to signal it is setup...\n"); _promise->get_future().wait_for(std::chrono::milliseconds{ 500 }); } @@ -610,11 +610,11 @@ pthread_create_gotcha::operator()(pthread_t* thread, const pthread_attr_t* attr, // unblock the signals in the entire process if(_enable_sampling && !_blocked.empty()) { - OMNITRACE_DEBUG("unblocking signals...\n"); + ROCPROFSYS_DEBUG("unblocking signals...\n"); tim::signals::unblock_signals(_blocked, tim::signals::sigmask_scope::process); } - OMNITRACE_DEBUG("returning success...\n"); + ROCPROFSYS_DEBUG("returning success...\n"); return _ret; } } // namespace component diff --git a/source/lib/omnitrace/library/components/pthread_create_gotcha.hpp b/source/lib/omnitrace/library/components/pthread_create_gotcha.hpp index 4cda99cb..55113840 100644 --- a/source/lib/omnitrace/library/components/pthread_create_gotcha.hpp +++ b/source/lib/omnitrace/library/components/pthread_create_gotcha.hpp @@ -67,7 +67,7 @@ struct pthread_create_gotcha : tim::component::base wrapper_config m_config = {}; }; - OMNITRACE_DEFAULT_OBJECT(pthread_create_gotcha) + ROCPROFSYS_DEFAULT_OBJECT(pthread_create_gotcha) // string id for component static std::string label() { return "pthread_create_gotcha"; } diff --git a/source/lib/omnitrace/library/components/pthread_gotcha.cpp b/source/lib/omnitrace/library/components/pthread_gotcha.cpp index aef2fd57..38adb216 100644 --- a/source/lib/omnitrace/library/components/pthread_gotcha.cpp +++ b/source/lib/omnitrace/library/components/pthread_gotcha.cpp @@ -47,7 +47,7 @@ struct stop { using type = omnitrace::component::pthread_create_gotcha_t; - OMNITRACE_DEFAULT_OBJECT(stop) + ROCPROFSYS_DEFAULT_OBJECT(stop) template explicit stop(type&, Args&&...) diff --git a/source/lib/omnitrace/library/components/pthread_gotcha.hpp b/source/lib/omnitrace/library/components/pthread_gotcha.hpp index 306a3d2a..9395437c 100644 --- a/source/lib/omnitrace/library/components/pthread_gotcha.hpp +++ b/source/lib/omnitrace/library/components/pthread_gotcha.hpp @@ -36,7 +36,7 @@ struct pthread_gotcha : tim::component::base { using native_handle_t = std::thread::native_handle_type; - OMNITRACE_DEFAULT_OBJECT(pthread_gotcha) + ROCPROFSYS_DEFAULT_OBJECT(pthread_gotcha) // string id for component static std::string label() { return "pthread_gotcha"; } diff --git a/source/lib/omnitrace/library/components/pthread_mutex_gotcha.cpp b/source/lib/omnitrace/library/components/pthread_mutex_gotcha.cpp index ed9650a4..dea69f40 100644 --- a/source/lib/omnitrace/library/components/pthread_mutex_gotcha.cpp +++ b/source/lib/omnitrace/library/components/pthread_mutex_gotcha.cpp @@ -76,12 +76,12 @@ pthread_mutex_gotcha::get_hashes() else { if(_skip.count(i) > 0) continue; - OMNITRACE_VERBOSE( + ROCPROFSYS_VERBOSE( 1, "WARNING!!! pthread_mutex_gotcha tool id at index %zu was empty!\n", i); } - OMNITRACE_CI_FAIL( + ROCPROFSYS_CI_FAIL( _id.empty() || _init.at(i) == 0, "pthread_mutex_gotcha tool id at index %zu has no hash value\n", i); } @@ -183,7 +183,7 @@ pthread_mutex_gotcha::operator()(uintptr_t&&, int (*_callee)(Args...), { if(m_data) { - OMNITRACE_PRINT("Warning! nullptr to %s\n", m_data->tool_id.c_str()); + ROCPROFSYS_PRINT("Warning! nullptr to %s\n", m_data->tool_id.c_str()); } return EINVAL; } diff --git a/source/lib/omnitrace/library/components/pthread_mutex_gotcha.hpp b/source/lib/omnitrace/library/components/pthread_mutex_gotcha.hpp index 36ef1ae8..7a6de394 100644 --- a/source/lib/omnitrace/library/components/pthread_mutex_gotcha.hpp +++ b/source/lib/omnitrace/library/components/pthread_mutex_gotcha.hpp @@ -44,7 +44,7 @@ struct pthread_mutex_gotcha : comp::base using hash_array_t = std::array; using gotcha_data_t = comp::gotcha_data; - OMNITRACE_DEFAULT_OBJECT(pthread_mutex_gotcha) + ROCPROFSYS_DEFAULT_OBJECT(pthread_mutex_gotcha) explicit pthread_mutex_gotcha(const gotcha_data_t&); @@ -77,8 +77,8 @@ using pthread_mutex_gotcha_t = comp::gotcha #include -#if !defined(OMNITRACE_NUM_RCCLP_WRAPPERS) -# define OMNITRACE_NUM_RCCLP_WRAPPERS 25 +#if !defined(ROCPROFSYS_NUM_RCCLP_WRAPPERS) +# define ROCPROFSYS_NUM_RCCLP_WRAPPERS 25 #endif -OMNITRACE_COMPONENT_ALIAS( +ROCPROFSYS_COMPONENT_ALIAS( rccl_toolset_t, ::tim::component_bundle, comm_data>) -OMNITRACE_COMPONENT_ALIAS(rcclp_gotcha_t, - ::tim::component::gotcha) -#if !defined(OMNITRACE_USE_RCCL) -OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, component::rcclp_gotcha_t, false_type) +#if !defined(ROCPROFSYS_USE_RCCL) +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, component::rcclp_gotcha_t, false_type) #endif namespace omnitrace @@ -73,7 +73,7 @@ configure_rcclp(const std::set& permit = {}, struct rcclp_handle : base { - static constexpr size_t rcclp_wrapper_count = OMNITRACE_NUM_RCCLP_WRAPPERS; + static constexpr size_t rcclp_wrapper_count = ROCPROFSYS_NUM_RCCLP_WRAPPERS; using value_type = void; using this_type = rcclp_handle; diff --git a/source/lib/omnitrace/library/components/rocprofiler.cpp b/source/lib/omnitrace/library/components/rocprofiler.cpp index fce20e4c..c916d4dd 100644 --- a/source/lib/omnitrace/library/components/rocprofiler.cpp +++ b/source/lib/omnitrace/library/components/rocprofiler.cpp @@ -168,7 +168,7 @@ rocprofiler::remove_shutdown(const std::string&) void rocprofiler::setup() { - OMNITRACE_VERBOSE_F(1, "rocprofiler is setup\n"); + ROCPROFSYS_VERBOSE_F(1, "rocprofiler is setup\n"); } void @@ -176,7 +176,7 @@ rocprofiler::shutdown() { omnitrace::rocprofiler::post_process(); omnitrace::rocprofiler::rocm_cleanup(); - OMNITRACE_VERBOSE_F(1, "rocprofiler is shutdown\n"); + ROCPROFSYS_VERBOSE_F(1, "rocprofiler is shutdown\n"); } scope::transient_destructor @@ -188,6 +188,6 @@ rocprofiler::protect_flush_activity() } // namespace component } // namespace omnitrace -OMNITRACE_INSTANTIATE_EXTERN_COMPONENT(rocprofiler, false, void) -OMNITRACE_INSTANTIATE_EXTERN_COMPONENT(rocprofiler_data, true, +ROCPROFSYS_INSTANTIATE_EXTERN_COMPONENT(rocprofiler, false, void) +ROCPROFSYS_INSTANTIATE_EXTERN_COMPONENT(rocprofiler_data, true, tim::component::rocprofiler_value) diff --git a/source/lib/omnitrace/library/components/rocprofiler.hpp b/source/lib/omnitrace/library/components/rocprofiler.hpp index 27f7df8c..60f35696 100644 --- a/source/lib/omnitrace/library/components/rocprofiler.hpp +++ b/source/lib/omnitrace/library/components/rocprofiler.hpp @@ -57,7 +57,7 @@ using rocm_feature_value = std::variant; struct rocm_counter { - std::array counters; + std::array counters; }; struct rocm_event @@ -109,7 +109,7 @@ struct rocprofiler using base_type = base; using tracker_type = policy::instance_tracker; - OMNITRACE_DEFAULT_OBJECT(rocprofiler) + ROCPROFSYS_DEFAULT_OBJECT(rocprofiler) static void preinit(); static void global_init() { setup(); } @@ -131,7 +131,7 @@ struct rocprofiler [[nodiscard]] static scope::transient_destructor protect_flush_activity(); }; -#if !defined(OMNITRACE_USE_ROCPROFILER) +#if !defined(ROCPROFSYS_USE_ROCPROFILER) inline void rocprofiler::setup() {} @@ -173,7 +173,7 @@ struct set_storage using storage_array_t = std::array*, max_threads>; friend struct get_storage; - OMNITRACE_DEFAULT_OBJECT(set_storage) + ROCPROFSYS_DEFAULT_OBJECT(set_storage) auto operator()(storage*, size_t) const {} auto operator()(type&, size_t) const {} @@ -192,7 +192,7 @@ struct get_storage { using type = component::rocm_data_tracker; - OMNITRACE_DEFAULT_OBJECT(get_storage) + ROCPROFSYS_DEFAULT_OBJECT(get_storage) auto operator()(const type&) const { @@ -215,27 +215,27 @@ struct get_storage } // namespace operation } // namespace tim -#if !defined(OMNITRACE_USE_ROCPROFILER) -OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, component::rocprofiler_data, false_type) +#if !defined(ROCPROFSYS_USE_ROCPROFILER) +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, component::rocprofiler_data, false_type) #endif TIMEMORY_SET_COMPONENT_API(component::rocprofiler_data, project::timemory, category::timing, os::supports_unix) -OMNITRACE_DEFINE_CONCRETE_TRAIT(is_timing_category, component::rocprofiler_data, +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_timing_category, component::rocprofiler_data, false_type) -OMNITRACE_DEFINE_CONCRETE_TRAIT(uses_timing_units, component::rocprofiler_data, +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(uses_timing_units, component::rocprofiler_data, false_type) -OMNITRACE_DEFINE_CONCRETE_TRAIT(report_units, component::rocprofiler_data, false_type) +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(report_units, component::rocprofiler_data, false_type) TIMEMORY_STATISTICS_TYPE(component::rocprofiler_data, component::rocprofiler_value) TIMEMORY_STATISTICS_TYPE(component::rocm_data_tracker, component::rocm_feature_value) -OMNITRACE_DEFINE_CONCRETE_TRAIT(report_units, component::rocm_data_tracker, false_type) +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(report_units, component::rocm_data_tracker, false_type) -#if !defined(OMNITRACE_EXTERN_COMPONENTS) || \ - (defined(OMNITRACE_EXTERN_COMPONENTS) && OMNITRACE_EXTERN_COMPONENTS > 0) +#if !defined(ROCPROFSYS_EXTERN_COMPONENTS) || \ + (defined(ROCPROFSYS_EXTERN_COMPONENTS) && ROCPROFSYS_EXTERN_COMPONENTS > 0) # include -OMNITRACE_DECLARE_EXTERN_COMPONENT(rocprofiler, false, void) -OMNITRACE_DECLARE_EXTERN_COMPONENT(rocprofiler_data, true, double) +ROCPROFSYS_DECLARE_EXTERN_COMPONENT(rocprofiler, false, void) +ROCPROFSYS_DECLARE_EXTERN_COMPONENT(rocprofiler_data, true, double) #endif diff --git a/source/lib/omnitrace/library/components/roctracer.cpp b/source/lib/omnitrace/library/components/roctracer.cpp index 2c03e416..5895753d 100644 --- a/source/lib/omnitrace/library/components/roctracer.cpp +++ b/source/lib/omnitrace/library/components/roctracer.cpp @@ -40,7 +40,7 @@ #include #include -#if OMNITRACE_HIP_VERSION < 50300 +#if ROCPROFSYS_HIP_VERSION < 50300 # include #endif @@ -135,24 +135,24 @@ roctracer::setup(void* table, bool on_load_trace) if(roctracer_is_setup()) return; roctracer_is_setup() = true; - OMNITRACE_VERBOSE_F(1, "setting up roctracer...\n"); - OMNITRACE_SCOPED_SAMPLING_ON_CHILD_THREADS(false); + ROCPROFSYS_VERBOSE_F(1, "setting up roctracer...\n"); + ROCPROFSYS_SCOPED_SAMPLING_ON_CHILD_THREADS(false); dynamic_library _amdhip64{ "ROCPROFSYS_ROCTRACER_LIBAMDHIP64", find_library_path("libamdhip64.so", { "ROCPROFSYS_ROCM_PATH", "ROCM_PATH" }, - { OMNITRACE_DEFAULT_ROCM_PATH }) }; + { ROCPROFSYS_DEFAULT_ROCM_PATH }) }; -#if OMNITRACE_HIP_VERSION_MAJOR == 4 && OMNITRACE_HIP_VERSION_MINOR < 4 +#if ROCPROFSYS_HIP_VERSION_MAJOR == 4 && ROCPROFSYS_HIP_VERSION_MINOR < 4 dynamic_library _kfdwrapper{ "ROCPROFSYS_ROCTRACER_LIBKFDWRAPPER", find_library_path("libkfdwrapper64.so", { "ROCPROFSYS_ROCM_PATH", "ROCM_PATH" }, - { OMNITRACE_DEFAULT_ROCM_PATH }, + { ROCPROFSYS_DEFAULT_ROCM_PATH }, { "roctracer/lib", "roctracer/lib64", "lib", "lib64" }) }; #endif - OMNITRACE_ROCTRACER_CALL(roctracer_set_properties(ACTIVITY_DOMAIN_HIP_API, nullptr)); + ROCPROFSYS_ROCTRACER_CALL(roctracer_set_properties(ACTIVITY_DOMAIN_HIP_API, nullptr)); // Allocating tracing pool roctracer_properties_t properties{}; @@ -160,9 +160,9 @@ roctracer::setup(void* table, bool on_load_trace) // properties.mode = 0x1000; properties.buffer_size = 0x100; properties.buffer_callback_fun = hip_activity_callback; - OMNITRACE_ROCTRACER_CALL(roctracer_open_pool(&properties)); + ROCPROFSYS_ROCTRACER_CALL(roctracer_open_pool(&properties)); -#if OMNITRACE_HIP_VERSION_MAJOR == 4 && OMNITRACE_HIP_VERSION_MINOR >= 4 +#if ROCPROFSYS_HIP_VERSION_MAJOR == 4 && ROCPROFSYS_HIP_VERSION_MINOR >= 4 // HIP 4.5.0 has an invalid warning redirect _rd{ std::cerr, "roctracer_enable_callback(), get_op_end(), invalid domain " "ID(4) in: roctracer_enable_callback(hip_api_callback, " @@ -172,26 +172,26 @@ roctracer::setup(void* table, bool on_load_trace) if(get_trace_hip_api()) { - OMNITRACE_ROCTRACER_CALL(roctracer_enable_domain_callback( + ROCPROFSYS_ROCTRACER_CALL(roctracer_enable_domain_callback( ACTIVITY_DOMAIN_HIP_API, hip_api_callback, nullptr)); } if(get_use_roctx()) { - OMNITRACE_ROCTRACER_CALL(roctracer_enable_domain_callback( + ROCPROFSYS_ROCTRACER_CALL(roctracer_enable_domain_callback( ACTIVITY_DOMAIN_ROCTX, roctx_api_callback, nullptr)); } if(get_trace_hip_activity()) { // Enable HIP activity tracing - OMNITRACE_ROCTRACER_CALL( + ROCPROFSYS_ROCTRACER_CALL( roctracer_enable_domain_activity(ACTIVITY_DOMAIN_HIP_OPS)); } if(table != nullptr) { - OMNITRACE_VERBOSE(1 || on_load_trace, "[OnLoad] setting up HSA...\n"); + ROCPROFSYS_VERBOSE(1 || on_load_trace, "[OnLoad] setting up HSA...\n"); bool trace_hsa_api = get_trace_hsa_api(); @@ -211,20 +211,20 @@ roctracer::setup(void* table, bool on_load_trace) { uint32_t cid = HSA_API_ID_NUMBER; const char* api = itr.c_str(); - OMNITRACE_ROCTRACER_CALL(roctracer_op_code( + ROCPROFSYS_ROCTRACER_CALL(roctracer_op_code( static_cast(ACTIVITY_DOMAIN_HSA_API), api, &cid, nullptr)); - OMNITRACE_ROCTRACER_CALL(roctracer_enable_op_callback( + ROCPROFSYS_ROCTRACER_CALL(roctracer_enable_op_callback( static_cast(ACTIVITY_DOMAIN_HSA_API), cid, hsa_api_callback, nullptr)); - OMNITRACE_VERBOSE(1 || on_load_trace, " HSA-trace(%s)", api); + ROCPROFSYS_VERBOSE(1 || on_load_trace, " HSA-trace(%s)", api); } } else { - OMNITRACE_VERBOSE(1 || on_load_trace, " HSA-trace()\n"); - OMNITRACE_ROCTRACER_CALL(roctracer_enable_domain_callback( + ROCPROFSYS_VERBOSE(1 || on_load_trace, " HSA-trace()\n"); + ROCPROFSYS_ROCTRACER_CALL(roctracer_enable_domain_callback( static_cast(ACTIVITY_DOMAIN_HSA_API), hsa_api_callback, nullptr)); } @@ -234,7 +234,7 @@ roctracer::setup(void* table, bool on_load_trace) // Enable HSA GPU activity if(trace_hsa_activity) { -#if OMNITRACE_HIP_VERSION < 50300 +#if ROCPROFSYS_HIP_VERSION < 50300 using namespace roctracer; // initialize HSA tracing const char* output_prefix = nullptr; @@ -242,7 +242,7 @@ roctracer::setup(void* table, bool on_load_trace) table, reinterpret_cast(hsa_activity_callback), nullptr, output_prefix }; -#elif OMNITRACE_HIP_VERSION < 50301 +#elif ROCPROFSYS_HIP_VERSION < 50301 hsa_ops_properties_t ops_properties; ops_properties.table = table; ops_properties.reserved1[0] = reinterpret_cast(&hsa_activity_callback); @@ -256,8 +256,8 @@ roctracer::setup(void* table, bool on_load_trace) roctracer_set_properties( static_cast(ACTIVITY_DOMAIN_HSA_OPS), &ops_properties); - OMNITRACE_VERBOSE(1 || on_load_trace, " HSA-activity-trace()\n"); - OMNITRACE_ROCTRACER_CALL(roctracer_enable_op_activity( + ROCPROFSYS_VERBOSE(1 || on_load_trace, " HSA-activity-trace()\n"); + ROCPROFSYS_ROCTRACER_CALL(roctracer_enable_op_activity( static_cast(ACTIVITY_DOMAIN_HSA_OPS), HSA_OP_ID_COPY)); } } @@ -270,7 +270,7 @@ roctracer::setup(void* table, bool on_load_trace) for(size_t i = 0; i < thread_info::get_peak_num_threads(); ++i) hip_exec_activity_callbacks(i); - OMNITRACE_VERBOSE_F(1, "roctracer is setup\n"); + ROCPROFSYS_VERBOSE_F(1, "roctracer is setup\n"); } void @@ -287,27 +287,27 @@ roctracer::flush() if(roctracer_activity_count() == 0) { - OMNITRACE_VERBOSE_F(2, "executing roctracer_flush_activity()...\n"); - OMNITRACE_ROCTRACER_CALL(roctracer_flush_activity()); + ROCPROFSYS_VERBOSE_F(2, "executing roctracer_flush_activity()...\n"); + ROCPROFSYS_ROCTRACER_CALL(roctracer_flush_activity()); // wait to make sure flush completes std::this_thread::sleep_for(std::chrono::milliseconds{ 100 }); wait_for_activity_flush_completion(); } else { - OMNITRACE_CI_FAIL(true, + ROCPROFSYS_CI_FAIL(true, "roctracer_activity_count() != 0 (== %li). " "roctracer::shutdown() most likely called during abort", roctracer_activity_count().load()); } - OMNITRACE_VERBOSE_F(2, "executing hip_exec_activity_callbacks(0..%zu)\n", + ROCPROFSYS_VERBOSE_F(2, "executing hip_exec_activity_callbacks(0..%zu)\n", thread_info::get_peak_num_threads()); // make sure all async operations are executed for(size_t i = 0; i < thread_info::get_peak_num_threads(); ++i) hip_exec_activity_callbacks(i); - OMNITRACE_VERBOSE_F(2, "roctracer flush completed\n"); + ROCPROFSYS_VERBOSE_F(2, "roctracer flush completed\n"); } void @@ -318,16 +318,16 @@ roctracer::shutdown() roctracer_is_setup() = false; - OMNITRACE_VERBOSE_F(1, "shutting down roctracer...\n"); + ROCPROFSYS_VERBOSE_F(1, "shutting down roctracer...\n"); // callback for hsa - OMNITRACE_VERBOSE_F(2, "executing %zu roctracer_shutdown_routines...\n", + ROCPROFSYS_VERBOSE_F(2, "executing %zu roctracer_shutdown_routines...\n", roctracer_shutdown_routines().size()); for(auto& itr : roctracer_shutdown_routines()) itr.second(); -#if OMNITRACE_HIP_VERSION_MAJOR == 4 && OMNITRACE_HIP_VERSION_MINOR >= 4 - OMNITRACE_DEBUG_F("redirecting roctracer warnings\n"); +#if ROCPROFSYS_HIP_VERSION_MAJOR == 4 && ROCPROFSYS_HIP_VERSION_MINOR >= 4 + ROCPROFSYS_DEBUG_F("redirecting roctracer warnings\n"); // HIP 4.5.0 has an invalid warning redirect _rd{ std::cerr, "roctracer_disable_callback(), get_op_end(), invalid domain ID(4) " @@ -338,49 +338,49 @@ roctracer::shutdown() if(get_trace_hip_api()) { - OMNITRACE_VERBOSE_F( + ROCPROFSYS_VERBOSE_F( 2, "executing roctracer_disable_domain_callback(ACTIVITY_DOMAIN_HIP_API)...\n"); - OMNITRACE_ROCTRACER_CALL( + ROCPROFSYS_ROCTRACER_CALL( roctracer_disable_domain_callback(ACTIVITY_DOMAIN_HIP_API)); } if(get_use_roctx()) { - OMNITRACE_VERBOSE_F( + ROCPROFSYS_VERBOSE_F( 2, "executing roctracer_disable_domain_activity(ACTIVITY_DOMAIN_ROCTX)...\n"); - OMNITRACE_ROCTRACER_CALL( + ROCPROFSYS_ROCTRACER_CALL( roctracer_disable_domain_callback(ACTIVITY_DOMAIN_ROCTX)); } if(get_trace_hip_activity()) { - OMNITRACE_VERBOSE_F( + ROCPROFSYS_VERBOSE_F( 2, "executing roctracer_disable_domain_activity(ACTIVITY_DOMAIN_HIP_OPS)...\n"); - OMNITRACE_ROCTRACER_CALL( + ROCPROFSYS_ROCTRACER_CALL( roctracer_disable_domain_activity(ACTIVITY_DOMAIN_HIP_OPS)); } if(get_trace_hsa_api()) { - OMNITRACE_VERBOSE_F( + ROCPROFSYS_VERBOSE_F( 2, "executing roctracer_disable_domain_activity(ACTIVITY_DOMAIN_HSA_API)...\n"); - OMNITRACE_ROCTRACER_CALL( + ROCPROFSYS_ROCTRACER_CALL( roctracer_disable_domain_callback(ACTIVITY_DOMAIN_HSA_API)); } if(get_trace_hsa_api()) { - OMNITRACE_VERBOSE_F( + ROCPROFSYS_VERBOSE_F( 2, "executing roctracer_disable_op_activity(ACTIVITY_DOMAIN_HSA_OPS, " "HSA_OP_ID_COPY)...\n"); - OMNITRACE_ROCTRACER_CALL( + ROCPROFSYS_ROCTRACER_CALL( roctracer_disable_op_activity(ACTIVITY_DOMAIN_HSA_OPS, HSA_OP_ID_COPY)); } - OMNITRACE_VERBOSE_F(1, "roctracer is shutdown\n"); + ROCPROFSYS_VERBOSE_F(1, "roctracer is shutdown\n"); } scope::transient_destructor @@ -392,5 +392,5 @@ roctracer::protect_flush_activity() } // namespace component } // namespace omnitrace -OMNITRACE_INSTANTIATE_EXTERN_COMPONENT(roctracer, false, void) -OMNITRACE_INSTANTIATE_EXTERN_COMPONENT(roctracer_data, true, double) +ROCPROFSYS_INSTANTIATE_EXTERN_COMPONENT(roctracer, false, void) +ROCPROFSYS_INSTANTIATE_EXTERN_COMPONENT(roctracer_data, true, double) diff --git a/source/lib/omnitrace/library/components/roctracer.hpp b/source/lib/omnitrace/library/components/roctracer.hpp index 5423f0d0..cd2ed872 100644 --- a/source/lib/omnitrace/library/components/roctracer.hpp +++ b/source/lib/omnitrace/library/components/roctracer.hpp @@ -36,7 +36,7 @@ #include #include -OMNITRACE_COMPONENT_ALIAS(roctracer_data, +ROCPROFSYS_COMPONENT_ALIAS(roctracer_data, ::tim::component::data_tracker) namespace omnitrace @@ -51,7 +51,7 @@ struct roctracer using base_type = base; using tracker_type = policy::instance_tracker; - OMNITRACE_DEFAULT_OBJECT(roctracer) + ROCPROFSYS_DEFAULT_OBJECT(roctracer) static void preinit(); static void global_finalize() { shutdown(); } @@ -73,7 +73,7 @@ struct roctracer [[nodiscard]] static scope::transient_destructor protect_flush_activity(); }; -#if !defined(OMNITRACE_USE_ROCTRACER) +#if !defined(ROCPROFSYS_USE_ROCTRACER) inline void roctracer::setup(void*, bool) {} @@ -95,23 +95,23 @@ roctracer::is_setup() } // namespace component } // namespace omnitrace -#if !defined(OMNITRACE_USE_ROCTRACER) -OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, component::roctracer_data, false_type) +#if !defined(ROCPROFSYS_USE_ROCTRACER) +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, component::roctracer_data, false_type) #endif TIMEMORY_SET_COMPONENT_API(omnitrace::component::roctracer_data, project::timemory, category::timing, os::supports_unix) -OMNITRACE_DEFINE_CONCRETE_TRAIT(is_timing_category, component::roctracer_data, true_type) -OMNITRACE_DEFINE_CONCRETE_TRAIT(uses_timing_units, component::roctracer_data, true_type) +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_timing_category, component::roctracer_data, true_type) +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(uses_timing_units, component::roctracer_data, true_type) -#if defined(OMNITRACE_USE_ROCTRACER) && OMNITRACE_USE_ROCTRACER > 0 -# if !defined(OMNITRACE_EXTERN_COMPONENTS) || \ - (defined(OMNITRACE_EXTERN_COMPONENTS) && OMNITRACE_EXTERN_COMPONENTS > 0) +#if defined(ROCPROFSYS_USE_ROCTRACER) && ROCPROFSYS_USE_ROCTRACER > 0 +# if !defined(ROCPROFSYS_EXTERN_COMPONENTS) || \ + (defined(ROCPROFSYS_EXTERN_COMPONENTS) && ROCPROFSYS_EXTERN_COMPONENTS > 0) # include -OMNITRACE_DECLARE_EXTERN_COMPONENT(roctracer, false, void) -OMNITRACE_DECLARE_EXTERN_COMPONENT(roctracer_data, true, double) +ROCPROFSYS_DECLARE_EXTERN_COMPONENT(roctracer, false, void) +ROCPROFSYS_DECLARE_EXTERN_COMPONENT(roctracer_data, true, double) # endif #endif diff --git a/source/lib/omnitrace/library/coverage.cpp b/source/lib/omnitrace/library/coverage.cpp index a91996f4..f02b9867 100644 --- a/source/lib/omnitrace/library/coverage.cpp +++ b/source/lib/omnitrace/library/coverage.cpp @@ -39,7 +39,7 @@ #include #include -#define OMNITRACE_SERIALIZE(MEMBER_VARIABLE) \ +#define ROCPROFSYS_SERIALIZE(MEMBER_VARIABLE) \ ar(::tim::cereal::make_nvp(#MEMBER_VARIABLE, MEMBER_VARIABLE)) namespace omnitrace @@ -108,7 +108,7 @@ post_process() if(_coverage.size == 0) { - OMNITRACE_VERBOSE_F( + ROCPROFSYS_VERBOSE_F( 0, "Warning! Code coverage enabled but no code coverage data is available!\n"); return; @@ -150,7 +150,7 @@ post_process() } else { - OMNITRACE_VERBOSE_F(0, + ROCPROFSYS_VERBOSE_F(0, "Warning! No matching coverage data for " "%s :: %s (0x%x)\n", func.first.data(), file.first.data(), @@ -208,10 +208,10 @@ post_process() std::swap(_coverage_data, _tmp); } - OMNITRACE_VERBOSE(0, "code coverage :: %6.2f%s\n", _coverage() * 100.0, "%"); - OMNITRACE_VERBOSE(0, "module coverage :: %6.2f%s\n", + ROCPROFSYS_VERBOSE(0, "code coverage :: %6.2f%s\n", _coverage() * 100.0, "%"); + ROCPROFSYS_VERBOSE(0, "module coverage :: %6.2f%s\n", _coverage(code_coverage::MODULE) * 100.0, "%"); - OMNITRACE_VERBOSE(0, "function coverage :: %6.2f%s\n", + ROCPROFSYS_VERBOSE(0, "function coverage :: %6.2f%s\n", _coverage(code_coverage::FUNCTION) * 100.0, "%"); if(get_verbose() >= 0) fprintf(stderr, "\n"); @@ -221,7 +221,7 @@ post_process() auto _get_setting = [](const std::string& _v) { auto&& _b = config::get_setting_value(_v); - OMNITRACE_CI_THROW(!_b, "Error! No configuration setting named '%s'", _v.c_str()); + ROCPROFSYS_CI_THROW(!_b, "Error! No configuration setting named '%s'", _v.c_str()); return _b.value_or(true); }; @@ -254,7 +254,7 @@ post_process() } else { - OMNITRACE_THROW("Error opening coverage output file: %s", _fname.c_str()); + ROCPROFSYS_THROW("Error opening coverage output file: %s", _fname.c_str()); } } @@ -286,7 +286,7 @@ post_process() } else { - OMNITRACE_THROW("Error opening coverage output file: %s", _fname.c_str()); + ROCPROFSYS_THROW("Error opening coverage output file: %s", _fname.c_str()); } } @@ -307,7 +307,7 @@ omnitrace_register_source_hidden(const char* file, const char* func, size_t line using coverage_data = coverage::coverage_data; - OMNITRACE_BASIC_VERBOSE_F(4, "[0x%x] :: %-20s :: %20s:%zu :: %s\n", + ROCPROFSYS_BASIC_VERBOSE_F(4, "[0x%x] :: %-20s :: %20s:%zu :: %s\n", (unsigned int) address, func, file, line, source); coverage::get_coverage_data().emplace_back( @@ -338,7 +338,7 @@ omnitrace_register_coverage_hidden(const char* file, const char* func, size_t ad else if(omnitrace::get_state() >= omnitrace::State::Finalized) return; - OMNITRACE_BASIC_VERBOSE_F(3, "[0x%x] %-20s :: %20s\n", (unsigned int) address, func, + ROCPROFSYS_BASIC_VERBOSE_F(3, "[0x%x] %-20s :: %20s\n", (unsigned int) address, func, file); (*coverage::get_coverage_count())[file][func][address] += 1; } diff --git a/source/lib/omnitrace/library/coverage.hpp b/source/lib/omnitrace/library/coverage.hpp index 9dcfc31e..67a2e30e 100644 --- a/source/lib/omnitrace/library/coverage.hpp +++ b/source/lib/omnitrace/library/coverage.hpp @@ -30,8 +30,8 @@ #include #include -#if !defined(OMNITRACE_SERIALIZE) -# define OMNITRACE_SERIALIZE(MEMBER_VARIABLE) \ +#if !defined(ROCPROFSYS_SERIALIZE) +# define ROCPROFSYS_SERIALIZE(MEMBER_VARIABLE) \ ar(::tim::cereal::make_nvp(#MEMBER_VARIABLE, MEMBER_VARIABLE)) #endif @@ -39,7 +39,7 @@ namespace omnitrace { namespace coverage { -#if !defined(OMNITRACE_PYBIND11_SOURCE) || OMNITRACE_PYBIND11_SOURCE == 0 +#if !defined(ROCPROFSYS_PYBIND11_SOURCE) || ROCPROFSYS_PYBIND11_SOURCE == 0 void post_process(); #endif @@ -97,10 +97,10 @@ template void code_coverage::serialize(ArchiveT& ar, const unsigned version) { - OMNITRACE_SERIALIZE(count); - OMNITRACE_SERIALIZE(size); - OMNITRACE_SERIALIZE(covered); - OMNITRACE_SERIALIZE(possible); + ROCPROFSYS_SERIALIZE(count); + ROCPROFSYS_SERIALIZE(size); + ROCPROFSYS_SERIALIZE(covered); + ROCPROFSYS_SERIALIZE(possible); if constexpr(tim::concepts::is_output_archive::value) { ar.setNextName("coverage"); @@ -118,9 +118,9 @@ template void code_coverage::data::serialize(ArchiveT& ar, const unsigned version) { - OMNITRACE_SERIALIZE(addresses); - OMNITRACE_SERIALIZE(modules); - OMNITRACE_SERIALIZE(functions); + ROCPROFSYS_SERIALIZE(addresses); + ROCPROFSYS_SERIALIZE(modules); + ROCPROFSYS_SERIALIZE(functions); (void) version; } @@ -160,12 +160,12 @@ template void coverage_data::serialize(ArchiveT& ar, const unsigned version) { - OMNITRACE_SERIALIZE(count); - OMNITRACE_SERIALIZE(line); - OMNITRACE_SERIALIZE(address); - OMNITRACE_SERIALIZE(module); - OMNITRACE_SERIALIZE(function); - OMNITRACE_SERIALIZE(source); + ROCPROFSYS_SERIALIZE(count); + ROCPROFSYS_SERIALIZE(line); + ROCPROFSYS_SERIALIZE(address); + ROCPROFSYS_SERIALIZE(module); + ROCPROFSYS_SERIALIZE(function); + ROCPROFSYS_SERIALIZE(source); (void) version; } // diff --git a/source/lib/omnitrace/library/cpu_freq.cpp b/source/lib/omnitrace/library/cpu_freq.cpp index bf13049e..677ac142 100644 --- a/source/lib/omnitrace/library/cpu_freq.cpp +++ b/source/lib/omnitrace/library/cpu_freq.cpp @@ -159,14 +159,14 @@ write_perfetto_counter_track(index&& _idx, Args... _args) void post_process() { - OMNITRACE_VERBOSE(1, + ROCPROFSYS_VERBOSE(1, "Post-processing %zu cpu frequency and memory usage entries...\n", data.size()); auto _process_frequencies = [](size_t _idx, size_t _offset) { using freq_track = perfetto_counter_track; const auto& _thread_info = thread_info::get(0, InternalTID); - OMNITRACE_CI_THROW(!_thread_info, "Missing thread info for thread 0"); + ROCPROFSYS_CI_THROW(!_thread_info, "Missing thread info for thread 0"); if(!_thread_info) return; if(!freq_track::exists(_idx)) @@ -200,7 +200,7 @@ post_process() { "MB", "MB", "MB", "", "", "sec", "sec" }); const auto& _thread_info = thread_info::get(0, InternalTID); - OMNITRACE_CI_THROW(!_thread_info, "Missing thread info for thread 0"); + ROCPROFSYS_CI_THROW(!_thread_info, "Missing thread info for thread 0"); if(!_thread_info) return; for(auto& itr : data) diff --git a/source/lib/omnitrace/library/kokkosp.cpp b/source/lib/omnitrace/library/kokkosp.cpp index bccbac8e..1e83aa17 100644 --- a/source/lib/omnitrace/library/kokkosp.cpp +++ b/source/lib/omnitrace/library/kokkosp.cpp @@ -20,7 +20,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -#define TIMEMORY_KOKKOSP_POSTFIX OMNITRACE_PUBLIC_API +#define TIMEMORY_KOKKOSP_POSTFIX ROCPROFSYS_PUBLIC_API #include "api.hpp" #include "core/components/fwd.hpp" @@ -161,23 +161,23 @@ extern "C" }; void kokkosp_request_tool_settings(const uint32_t, - Kokkos_Tools_ToolSettings*) OMNITRACE_PUBLIC_API; + Kokkos_Tools_ToolSettings*) ROCPROFSYS_PUBLIC_API; void kokkosp_dual_view_sync(const char*, const void* const, - bool) OMNITRACE_PUBLIC_API; + bool) ROCPROFSYS_PUBLIC_API; void kokkosp_dual_view_modify(const char*, const void* const, - bool) OMNITRACE_PUBLIC_API; + bool) ROCPROFSYS_PUBLIC_API; void kokkosp_print_help(char*) {} void kokkosp_parse_args(int argc, char** argv) { - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); if(!omnitrace::config::settings_are_configured() && omnitrace::get_state() < omnitrace::State::Active) { _standalone_initialized = true; - OMNITRACE_BASIC_VERBOSE_F(0, "Parsing arguments...\n"); + ROCPROFSYS_BASIC_VERBOSE_F(0, "Parsing arguments...\n"); std::string _command_line = {}; for(int i = 0; i < argc; ++i) { @@ -191,7 +191,7 @@ extern "C" void kokkosp_declare_metadata(const char* key, const char* value) { - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); tim::manager::add_metadata(key, value); } @@ -204,10 +204,10 @@ extern "C" void kokkosp_init_library(const int loadSeq, const uint64_t interfaceVer, const uint32_t devInfoCount, void* deviceInfo) { - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); tim::consume_parameters(devInfoCount, deviceInfo); - OMNITRACE_BASIC_VERBOSE_F( + ROCPROFSYS_BASIC_VERBOSE_F( 0, "Initializing rocprof-sys kokkos connector (sequence %d, version: %llu)... ", loadSeq, (unsigned long long) interfaceVer); @@ -235,7 +235,7 @@ extern "C" std::stringstream _libs_str{}; for(const auto& litr : _libs) _libs_str << " " << litr << "\n"; - OMNITRACE_ABORT( + ROCPROFSYS_ABORT( "%s was invoked with librocprof-sys.so as the " "KOKKOS_PROFILE_LIBRARY.\n" "However, librocprof-sys-dl.so has already been loaded by " @@ -247,7 +247,7 @@ extern "C" } } - OMNITRACE_BASIC_VERBOSE_F(0, "Initializing rocprof-sys (standalone)... "); + ROCPROFSYS_BASIC_VERBOSE_F(0, "Initializing rocprof-sys (standalone)... "); auto _mode = tim::get_env("ROCPROFSYS_MODE", "trace"); auto _arg0 = (_initialize_arguments.empty()) ? std::string{ "unknown" } : _initialize_arguments.at(0); @@ -283,17 +283,17 @@ extern "C" void kokkosp_finalize_library() { - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); if(_standalone_initialized) { omnitrace_pop_trace_hidden("kokkos_main"); - OMNITRACE_VERBOSE_F( + ROCPROFSYS_VERBOSE_F( 0, "Finalizing kokkos rocprof-sys connector (standalone)...\n"); omnitrace_finalize_hidden(); } else { - OMNITRACE_VERBOSE_F(0, "Finalizing kokkos rocprof-sys connector... "); + ROCPROFSYS_VERBOSE_F(0, "Finalizing kokkos rocprof-sys connector... "); kokkosp::cleanup(); if(omnitrace::get_verbose() >= 0) fprintf(stderr, "Done\n"); } @@ -305,7 +305,7 @@ extern "C" { if(violates_name_rules(name)) return set_invalid_id(kernid); - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); auto pname = (devid > std::numeric_limits::max()) // junk device number ? JOIN(" ", _kp_prefix, name, "[for]") : JOIN(" ", _kp_prefix, name, JOIN("", "[for][dev", devid, ']')); @@ -319,7 +319,7 @@ extern "C" { if(is_invalid_id(kernid)) return; - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); kokkosp::logger_t{}.mark(-1, __FUNCTION__, kernid); kokkosp::stop_profiler(kernid); kokkosp::destroy_profiler(kernid); @@ -331,7 +331,7 @@ extern "C" { if(violates_name_rules(name)) return set_invalid_id(kernid); - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); auto pname = (devid > std::numeric_limits::max()) // junk device number ? JOIN(" ", _kp_prefix, name, "[reduce]") @@ -346,7 +346,7 @@ extern "C" { if(is_invalid_id(kernid)) return; - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); kokkosp::logger_t{}.mark(-1, __FUNCTION__, kernid); kokkosp::stop_profiler(kernid); kokkosp::destroy_profiler(kernid); @@ -358,7 +358,7 @@ extern "C" { if(violates_name_rules(name)) return set_invalid_id(kernid); - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); auto pname = (devid > std::numeric_limits::max()) // junk device number ? JOIN(" ", _kp_prefix, name, "[scan]") @@ -373,7 +373,7 @@ extern "C" { if(is_invalid_id(kernid)) return; - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); kokkosp::logger_t{}.mark(-1, __FUNCTION__, kernid); kokkosp::stop_profiler(kernid); kokkosp::destroy_profiler(kernid); @@ -385,7 +385,7 @@ extern "C" { if(violates_name_rules(name)) return set_invalid_id(kernid); - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); auto pname = (devid > std::numeric_limits::max()) // junk device number ? JOIN(" ", _kp_prefix, name, "[fence]") @@ -400,7 +400,7 @@ extern "C" { if(is_invalid_id(kernid)) return; - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); kokkosp::logger_t{}.mark(-1, __FUNCTION__, kernid); kokkosp::stop_profiler(kernid); kokkosp::destroy_profiler(kernid); @@ -410,7 +410,7 @@ extern "C" void kokkosp_push_profile_region(const char* name) { - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); kokkosp::logger_t{}.mark(1, __FUNCTION__, name); kokkosp::get_profiler_stack() .emplace_back(kokkosp::profiler_t(name)) @@ -419,7 +419,7 @@ extern "C" void kokkosp_pop_profile_region() { - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); kokkosp::logger_t{}.mark(-1, __FUNCTION__); if(kokkosp::get_profiler_stack().empty()) return; kokkosp::get_profiler_stack().back().stop(); @@ -430,7 +430,7 @@ extern "C" void kokkosp_create_profile_section(const char* name, uint32_t* secid) { - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); *secid = kokkosp::get_unique_id(); auto pname = std::string{ name }; kokkosp::create_profiler(name, *secid); @@ -438,7 +438,7 @@ extern "C" void kokkosp_destroy_profile_section(uint32_t secid) { - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); kokkosp::destroy_profiler(secid); } @@ -446,14 +446,14 @@ extern "C" void kokkosp_start_profile_section(uint32_t secid) { - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); kokkosp::logger_t{}.mark(1, __FUNCTION__, secid); kokkosp::start_profiler(secid); } void kokkosp_stop_profile_section(uint32_t secid) { - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); kokkosp::logger_t{}.mark(-1, __FUNCTION__, secid); kokkosp::stop_profiler(secid); } @@ -466,7 +466,7 @@ extern "C" if(violates_name_rules(label)) return; if(omnitrace::config::get_use_causal()) return; - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); kokkosp::logger_t{}.mark(0, __FUNCTION__, space.name, label, JOIN("", '[', ptr, ']'), size); auto pname = @@ -481,7 +481,7 @@ extern "C" if(violates_name_rules(label)) return; if(omnitrace::config::get_use_causal()) return; - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); kokkosp::logger_t{}.mark(0, __FUNCTION__, space.name, label, JOIN("", '[', ptr, ']'), size); auto pname = @@ -499,7 +499,7 @@ extern "C" if(!_kp_deep_copy || omnitrace::config::get_use_causal()) return; if(violates_name_rules(dst_name, src_name)) return; - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); kokkosp::logger_t{}.mark(1, __FUNCTION__, dst_handle.name, dst_name, JOIN("", '[', dst_ptr, ']'), src_handle.name, src_name, JOIN("", '[', src_ptr, ']'), size); @@ -520,7 +520,7 @@ extern "C" { if(!_kp_deep_copy || omnitrace::config::get_use_causal()) return; - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); kokkosp::logger_t{}.mark(-1, __FUNCTION__); auto& _data = kokkosp::get_profiler_stack(); if(_data.empty()) return; @@ -534,7 +534,7 @@ extern "C" void kokkosp_profile_event(const char* name) { - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); auto _name = tim::get_hash_identifier_fast(tim::add_hash_id(name)); kokkosp::profiler_t{ _name }.mark(); } @@ -545,7 +545,7 @@ extern "C" { if(violates_name_rules(label)) return; - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); if(omnitrace::config::get_use_perfetto()) { auto _name = tim::get_hash_identifier_fast( @@ -565,7 +565,7 @@ extern "C" { if(violates_name_rules(label)) return; - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); if(omnitrace::config::get_use_perfetto()) { auto _name = tim::get_hash_identifier_fast( diff --git a/source/lib/omnitrace/library/ompt.cpp b/source/lib/omnitrace/library/ompt.cpp index 843c5bf8..4f4a0d7f 100644 --- a/source/lib/omnitrace/library/ompt.cpp +++ b/source/lib/omnitrace/library/ompt.cpp @@ -28,7 +28,7 @@ #include -#if defined(OMNITRACE_USE_OMPT) && OMNITRACE_USE_OMPT > 0 +#if defined(ROCPROFSYS_USE_OMPT) && ROCPROFSYS_USE_OMPT > 0 # include "core/components/fwd.hpp" # include "library/components/category_region.hpp" @@ -49,7 +49,7 @@ using ompt_bundle_t = tim::component_tuple; extern "C" { ompt_start_tool_result_t* ompt_start_tool(unsigned int, - const char*) OMNITRACE_PUBLIC_API; + const char*) ROCPROFSYS_PUBLIC_API; } namespace omnitrace @@ -115,7 +115,7 @@ tool_initialize(ompt_function_lookup_t lookup, int initial_device_num, { if(!omnitrace::settings_are_configured()) { - OMNITRACE_BASIC_WARNING( + ROCPROFSYS_BASIC_WARNING( 0, "[%s] invoked before omnitrace was initialized. In instrumentation mode, " "settings exported to the environment have not been propagated yet...\n", @@ -146,10 +146,10 @@ tool_finalize(ompt_data_t*) extern "C" ompt_start_tool_result_t* ompt_start_tool(unsigned int omp_version, const char* runtime_version) { - OMNITRACE_BASIC_VERBOSE_F(0, "OpenMP version: %u, runtime version: %s\n", omp_version, + ROCPROFSYS_BASIC_VERBOSE_F(0, "OpenMP version: %u, runtime version: %s\n", omp_version, runtime_version); - OMNITRACE_METADATA("OMP_VERSION", omp_version); - OMNITRACE_METADATA("OMP_RUNTIME_VERSION", runtime_version); + ROCPROFSYS_METADATA("OMP_VERSION", omp_version); + ROCPROFSYS_METADATA("OMP_RUNTIME_VERSION", runtime_version); static auto* data = new ompt_start_tool_result_t{ &omnitrace::ompt::tool_initialize, &omnitrace::ompt::tool_finalize, diff --git a/source/lib/omnitrace/library/perf.cpp b/source/lib/omnitrace/library/perf.cpp index 476515b6..7ed3c996 100644 --- a/source/lib/omnitrace/library/perf.cpp +++ b/source/lib/omnitrace/library/perf.cpp @@ -49,8 +49,8 @@ #include #include -#if !defined(OMNITRACE_RETURN_ERROR_MSG) -# define OMNITRACE_RETURN_ERROR_MSG(COND, ...) \ +#if !defined(ROCPROFSYS_RETURN_ERROR_MSG) +# define ROCPROFSYS_RETURN_ERROR_MSG(COND, ...) \ if((COND)) \ { \ auto _msg_ss = std::stringstream{}; \ @@ -59,12 +59,12 @@ } #endif -#if !defined(OMNITRACE_FATAL) -# define OMNITRACE_FATAL TIMEMORY_FATAL +#if !defined(ROCPROFSYS_FATAL) +# define ROCPROFSYS_FATAL TIMEMORY_FATAL #endif -#if !defined(OMNITRACE_ASSERT) -# define OMNITRACE_ASSERT(COND) (COND) ? ::tim::log::base() : TIMEMORY_FATAL +#if !defined(ROCPROFSYS_ASSERT) +# define ROCPROFSYS_ASSERT(COND) (COND) ? ::tim::log::base() : TIMEMORY_FATAL #endif namespace omnitrace @@ -98,7 +98,7 @@ perf_event::perf_event(perf_event&& rhs) noexcept if(m_fd != -1 && m_fd != rhs.m_fd) { ::close(m_fd); - OMNITRACE_VERBOSE(1, "Closed perf event fd %li\n", m_fd); + ROCPROFSYS_VERBOSE(1, "Closed perf event fd %li\n", m_fd); } if(m_mapping != nullptr && m_mapping != rhs.m_mapping) munmap(m_mapping, sizes.mmap); @@ -123,7 +123,7 @@ perf_event::~perf_event() { close(); } perf_event& perf_event::operator=(perf_event&& rhs) noexcept { - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); if(&rhs == this) return *this; // Release resources if the current perf_event is initialized and not equal to this @@ -150,7 +150,7 @@ perf_event::operator=(perf_event&& rhs) noexcept std::optional perf_event::open(struct perf_event_attr& _pe, pid_t _pid, int _cpu) { - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); m_sample_type = _pe.sample_type; m_read_format = _pe.read_format; m_batch_size = _pe.wakeup_events; @@ -167,16 +167,16 @@ perf_event::open(struct perf_event_attr& _pe, pid_t _pid, int _cpu) auto file = std::ifstream{ path.c_str() }; - OMNITRACE_RETURN_ERROR_MSG(!file, + ROCPROFSYS_RETURN_ERROR_MSG(!file, "Failed to open " << path << ": " << strerror(errno)); int value = 4; file >> value; - OMNITRACE_RETURN_ERROR_MSG(file.bad(), "Failed to read from " << path << ": " + ROCPROFSYS_RETURN_ERROR_MSG(file.bad(), "Failed to read from " << path << ": " << strerror(errno)); - OMNITRACE_RETURN_ERROR_MSG( + ROCPROFSYS_RETURN_ERROR_MSG( true, "Failed to open perf event. Consider tweaking " << path << " to 2 or less " << "(current value is " << value << "), " @@ -189,7 +189,7 @@ perf_event::open(struct perf_event_attr& _pe, pid_t _pid, int _cpu) void* ring_buffer = mmap(nullptr, sizes.mmap, PROT_READ | PROT_WRITE, MAP_SHARED, m_fd, 0); - OMNITRACE_RETURN_ERROR_MSG( + ROCPROFSYS_RETURN_ERROR_MSG( ring_buffer == MAP_FAILED, "Mapping perf_event ring buffer failed. Make sure the current user has " "permission to invoke the perf tool, and that the program being profiled " @@ -204,7 +204,7 @@ perf_event::open(struct perf_event_attr& _pe, pid_t _pid, int _cpu) std::optional perf_event::open(double _freq, uint32_t _batch_size, pid_t _pid, int _cpu) { - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); uint64_t _period = (1.0 / _freq) * units::sec; struct perf_event_attr _pe; @@ -247,7 +247,7 @@ uint64_t perf_event::get_count() const { uint64_t count; - OMNITRACE_REQUIRE(read(m_fd, &count, sizeof(uint64_t)) == sizeof(uint64_t)) + ROCPROFSYS_REQUIRE(read(m_fd, &count, sizeof(uint64_t)) == sizeof(uint64_t)) << "Failed to read event count from perf_event file"; return count; } @@ -258,8 +258,8 @@ perf_event::start() const { if(m_fd != -1) { - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); - OMNITRACE_REQUIRE(ioctl(m_fd, PERF_EVENT_IOC_ENABLE, 0) != -1) + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_REQUIRE(ioctl(m_fd, PERF_EVENT_IOC_ENABLE, 0) != -1) << "Failed to start perf event: " << strerror(errno); } return (m_fd != -1); @@ -271,8 +271,8 @@ perf_event::stop() const { if(m_fd != -1) { - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); - OMNITRACE_REQUIRE(ioctl(m_fd, PERF_EVENT_IOC_DISABLE, 0) != -1) + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_REQUIRE(ioctl(m_fd, PERF_EVENT_IOC_DISABLE, 0) != -1) << "Failed to stop perf event: " << strerror(errno) << " (" << m_fd << ")"; } return (m_fd != -1); @@ -287,7 +287,7 @@ perf_event::is_open() const void perf_event::close() { - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); stop(); if(m_fd != -1) @@ -306,24 +306,24 @@ perf_event::close() void perf_event::set_ready_signal(int sig) const { - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); // Set the perf_event file to async - OMNITRACE_REQUIRE(fcntl(m_fd, F_SETFL, fcntl(m_fd, F_GETFL, 0) | O_ASYNC) != -1) + ROCPROFSYS_REQUIRE(fcntl(m_fd, F_SETFL, fcntl(m_fd, F_GETFL, 0) | O_ASYNC) != -1) << "failed to set perf_event file to async mode"; // Set the notification signal for the perf file - OMNITRACE_REQUIRE(fcntl(m_fd, F_SETSIG, sig) != -1) + ROCPROFSYS_REQUIRE(fcntl(m_fd, F_SETSIG, sig) != -1) << "failed to set perf_event file signal"; // Set the current thread as the owner of the file (to target signal delivery) - OMNITRACE_REQUIRE(fcntl(m_fd, F_SETOWN, gettid()) != -1) + ROCPROFSYS_REQUIRE(fcntl(m_fd, F_SETOWN, gettid()) != -1) << "failed to set the owner of the perf_event file"; } void perf_event::iterator::next() { - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); struct perf_event_header _hdr; @@ -375,7 +375,7 @@ perf_event::iterator::operator!=(const iterator& other) const perf_event::record perf_event::iterator::get() { - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); // Copy out the record header perf_event::copy_from_ring_buffer(m_mapping, m_index, _buf, @@ -422,7 +422,7 @@ void perf_event::copy_from_ring_buffer(struct perf_event_mmap_page* _mapping, ptrdiff_t _index, void* _dest, size_t _nbytes) { - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); uintptr_t _base = reinterpret_cast(_mapping) + sizes.page; size_t _beg_idx = _index % sizes.data; @@ -448,7 +448,7 @@ perf_event::copy_from_ring_buffer(struct perf_event_mmap_page* _mapping, ptrdiff uint64_t perf_event::record::get_ip() const { - OMNITRACE_ASSERT(is_sample() && m_source != nullptr && + ROCPROFSYS_ASSERT(is_sample() && m_source != nullptr && m_source->is_sampling(sample::ip)) << "Record does not have an ip field (" << is_sample() << "|" << m_source << ")"; return *locate_field(); @@ -457,7 +457,7 @@ perf_event::record::get_ip() const uint64_t perf_event::record::get_pid() const { - OMNITRACE_ASSERT(is_sample() && m_source != nullptr && + ROCPROFSYS_ASSERT(is_sample() && m_source != nullptr && m_source->is_sampling(sample::pid_tid)) << "Record does not have a `pid` field (" << is_sample() << "|" << m_source << ")"; @@ -467,7 +467,7 @@ perf_event::record::get_pid() const uint64_t perf_event::record::get_tid() const { - OMNITRACE_ASSERT(is_sample() && m_source != nullptr && + ROCPROFSYS_ASSERT(is_sample() && m_source != nullptr && m_source->is_sampling(sample::pid_tid)) << "Record does not have a `tid` field (" << is_sample() << "|" << m_source << ")"; @@ -477,7 +477,7 @@ perf_event::record::get_tid() const uint64_t perf_event::record::get_time() const { - OMNITRACE_ASSERT(is_sample() && m_source != nullptr && + ROCPROFSYS_ASSERT(is_sample() && m_source != nullptr && m_source->is_sampling(sample::time)) << "Record does not have a 'time' field (" << is_sample() << "|" << m_source << ")"; @@ -487,7 +487,7 @@ perf_event::record::get_time() const uint64_t perf_event::record::get_period() const { - OMNITRACE_ASSERT(is_sample() && m_source != nullptr && + ROCPROFSYS_ASSERT(is_sample() && m_source != nullptr && m_source->is_sampling(sample::period)) << "Record does not have a 'period' field (" << is_sample() << "|" << m_source << ")"; @@ -497,7 +497,7 @@ perf_event::record::get_period() const uint32_t perf_event::record::get_cpu() const { - OMNITRACE_ASSERT(is_sample() && m_source != nullptr && + ROCPROFSYS_ASSERT(is_sample() && m_source != nullptr && m_source->is_sampling(sample::cpu)) << "Record does not have a 'cpu' field (" << is_sample() << "|" << m_source << ")"; @@ -507,7 +507,7 @@ perf_event::record::get_cpu() const container::c_array perf_event::record::get_callchain() const { - OMNITRACE_ASSERT(is_sample() && m_source != nullptr && + ROCPROFSYS_ASSERT(is_sample() && m_source != nullptr && m_source->is_sampling(sample::callchain)) << "Record does not have a callchain field (" << is_sample() << "|" << m_source << ")"; @@ -523,7 +523,7 @@ template Tp perf_event::record::locate_field() const { - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); uintptr_t p = reinterpret_cast(m_header) + sizeof(struct perf_event_header); @@ -617,22 +617,22 @@ perf_event::record::locate_field() const // branch_stack if constexpr(SampleT == sample::branch_stack) return reinterpret_cast(p); if(m_source != nullptr && m_source->is_sampling(sample::branch_stack)) - OMNITRACE_FATAL << "Branch stack sampling is not supported"; + ROCPROFSYS_FATAL << "Branch stack sampling is not supported"; // regs if constexpr(SampleT == sample::regs) return reinterpret_cast(p); if(m_source != nullptr && m_source->is_sampling(sample::regs)) - OMNITRACE_FATAL << "Register sampling is not supported"; + ROCPROFSYS_FATAL << "Register sampling is not supported"; // stack if constexpr(SampleT == sample::stack) return reinterpret_cast(p); if(m_source != nullptr && m_source->is_sampling(sample::stack)) - OMNITRACE_FATAL << "Stack sampling is not supported"; + ROCPROFSYS_FATAL << "Stack sampling is not supported"; // end if constexpr(SampleT == sample::last) return reinterpret_cast(p); - OMNITRACE_FATAL << "Unsupported sample field requested!"; + ROCPROFSYS_FATAL << "Unsupported sample field requested!"; if constexpr(std::is_pointer::value) return nullptr; @@ -657,7 +657,7 @@ get_instance(int64_t _tid) auto& _data = get_instances(); if(static_cast(_tid) >= _data->size()) { - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); _data->resize(_tid + 1); } return _data->at(_tid); diff --git a/source/lib/omnitrace/library/process_sampler.cpp b/source/lib/omnitrace/library/process_sampler.cpp index 29bd4efc..f4d1158d 100644 --- a/source/lib/omnitrace/library/process_sampler.cpp +++ b/source/lib/omnitrace/library/process_sampler.cpp @@ -75,7 +75,7 @@ sampler::poll(std::atomic* _state, nsec_t _interval, promise_t* _ready) threading::offset_this_id(true); threading::set_thread_name("omni.sampler"); - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); // notify thread started if(_ready) _ready->set_value(); @@ -83,7 +83,7 @@ sampler::poll(std::atomic* _state, nsec_t _interval, promise_t* _ready) for(auto& itr : instances) itr->config(); - OMNITRACE_VERBOSE( + ROCPROFSYS_VERBOSE( 1, "Background process sampling polling at an interval of %f seconds...\n", std::chrono::duration_cast>(_interval).count()); @@ -113,14 +113,14 @@ sampler::poll(std::atomic* _state, nsec_t _interval, promise_t* _ready) if(_has_duration && _now >= _end && get_state() < State::Finalized) { - OMNITRACE_VERBOSE( + ROCPROFSYS_VERBOSE( 1, "Background process sampling duration of %f seconds has elapsed. " "Shutting down process sampling...\n", _duration); } - OMNITRACE_CONDITIONAL_BASIC_PRINT(get_debug(), + ROCPROFSYS_CONDITIONAL_BASIC_PRINT(get_debug(), "Thread sampler polling completed...\n"); if(polling_finished) polling_finished->set_value(); @@ -131,11 +131,11 @@ sampler::setup() { if(!get_use_process_sampling()) { - OMNITRACE_DEBUG("Background sampler is disabled...\n"); + ROCPROFSYS_DEBUG("Background sampler is disabled...\n"); return; } - OMNITRACE_VERBOSE(1, "Setting up background sampler...\n"); + ROCPROFSYS_VERBOSE(1, "Setting up background sampler...\n"); // shutdown if already running shutdown(); @@ -167,7 +167,7 @@ sampler::setup() polling_finished = std::make_unique(); - OMNITRACE_SCOPED_SAMPLING_ON_CHILD_THREADS(false); + ROCPROFSYS_SCOPED_SAMPLING_ON_CHILD_THREADS(false); set_state(State::PreInit); get_thread() = std::make_unique(&poll, &get_sampler_state(), @@ -201,7 +201,7 @@ sampler::shutdown() } // during CI, throw an error if polling_finished is not valid - OMNITRACE_CI_THROW(!polling_finished, "polling_finished is not valid\n"); + ROCPROFSYS_CI_THROW(!polling_finished, "polling_finished is not valid\n"); if(polling_finished) { // wait for the thread to finish diff --git a/source/lib/omnitrace/library/ptl.cpp b/source/lib/omnitrace/library/ptl.cpp index 7da62aac..118117aa 100644 --- a/source/lib/omnitrace/library/ptl.cpp +++ b/source/lib/omnitrace/library/ptl.cpp @@ -132,8 +132,8 @@ get_thread_pool_state() void setup() { - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); - OMNITRACE_SCOPED_SAMPLING_ON_CHILD_THREADS(false); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_SAMPLING_ON_CHILD_THREADS(false); (void) get_thread_pool(); } @@ -142,18 +142,18 @@ join() { if(roctracer::get_thread_pool_state() == State::Active) { - OMNITRACE_DEBUG_F("waiting for all roctracer tasks to complete...\n"); + ROCPROFSYS_DEBUG_F("waiting for all roctracer tasks to complete...\n"); for(size_t i = 0; i < thread_info::get_peak_num_threads(); ++i) roctracer::get_task_group(i).join(); } else { - OMNITRACE_DEBUG_F("roctracer thread-pool is not active...\n"); + ROCPROFSYS_DEBUG_F("roctracer thread-pool is not active...\n"); } if(general::get_thread_pool_state() == State::Active) { - OMNITRACE_DEBUG_F("waiting for all general tasks to complete...\n"); + ROCPROFSYS_DEBUG_F("waiting for all general tasks to complete...\n"); for(size_t i = 0; i < thread_info::get_peak_num_threads(); ++i) general::get_task_group(i).join(); } @@ -164,7 +164,7 @@ shutdown() { if(roctracer::get_thread_pool_state() == State::Active) { - OMNITRACE_DEBUG_F("Waiting on completion of roctracer tasks...\n"); + ROCPROFSYS_DEBUG_F("Waiting on completion of roctracer tasks...\n"); for(size_t i = 0; i < thread_info::get_peak_num_threads(); ++i) { roctracer::get_task_group(i).join(); @@ -175,12 +175,12 @@ shutdown() } else { - OMNITRACE_DEBUG_F("roctracer thread-pool is not active...\n"); + ROCPROFSYS_DEBUG_F("roctracer thread-pool is not active...\n"); } if(general::get_thread_pool_state() == State::Active) { - OMNITRACE_DEBUG_F("Waiting on completion of general tasks...\n"); + ROCPROFSYS_DEBUG_F("Waiting on completion of general tasks...\n"); for(size_t i = 0; i < thread_info::get_peak_num_threads(); ++i) { general::get_task_group(i).join(); @@ -192,13 +192,13 @@ shutdown() if(get_thread_pool_state() == State::Active) { - OMNITRACE_DEBUG_F("Destroying the rocprof-sys thread pool...\n"); + ROCPROFSYS_DEBUG_F("Destroying the rocprof-sys thread pool...\n"); get_thread_pool().destroy_threadpool(); get_thread_pool_state() = State::Finalized; } else { - OMNITRACE_DEBUG_F("thread-pool is not active...\n"); + ROCPROFSYS_DEBUG_F("thread-pool is not active...\n"); } } diff --git a/source/lib/omnitrace/library/rcclp.hpp b/source/lib/omnitrace/library/rcclp.hpp index 75a5faaa..01e47f05 100644 --- a/source/lib/omnitrace/library/rcclp.hpp +++ b/source/lib/omnitrace/library/rcclp.hpp @@ -39,8 +39,8 @@ setup(); void shutdown(); -#if !defined(OMNITRACE_USE_RCCL) || \ - (defined(OMNITRACE_USE_RCCL) && OMNITRACE_USE_RCCL == 0) +#if !defined(ROCPROFSYS_USE_RCCL) || \ + (defined(ROCPROFSYS_USE_RCCL) && ROCPROFSYS_USE_RCCL == 0) inline void configure() {} diff --git a/source/lib/omnitrace/library/rocm.cpp b/source/lib/omnitrace/library/rocm.cpp index f2be1ba2..24f03b3a 100644 --- a/source/lib/omnitrace/library/rocm.cpp +++ b/source/lib/omnitrace/library/rocm.cpp @@ -46,7 +46,7 @@ #include #include -#if defined(OMNITRACE_USE_ROCPROFILER) && OMNITRACE_USE_ROCPROFILER > 0 +#if defined(ROCPROFSYS_USE_ROCPROFILER) && ROCPROFSYS_USE_ROCPROFILER > 0 # include #endif @@ -62,7 +62,7 @@ bool on_load_trace = (get_env("ROCP_ONLOAD_TRACE", 0) > 0); } // namespace rocm } // namespace omnitrace -#if defined(OMNITRACE_USE_ROCPROFILER) && OMNITRACE_USE_ROCPROFILER > 0 +#if defined(ROCPROFSYS_USE_ROCPROFILER) && ROCPROFSYS_USE_ROCPROFILER > 0 std::ostream& operator<<(std::ostream& _os, const rocprofiler_settings_t& _v) { @@ -84,17 +84,17 @@ operator<<(std::ostream& _os, const rocprofiler_settings_t& _v) // HSA-runtime tool on-load method extern "C" { -#if defined(OMNITRACE_USE_ROCPROFILER) && OMNITRACE_USE_ROCPROFILER > 0 +#if defined(ROCPROFSYS_USE_ROCPROFILER) && ROCPROFSYS_USE_ROCPROFILER > 0 void OnUnloadTool() { - OMNITRACE_BASIC_VERBOSE_F(2 || rocm::on_load_trace, "Unloading...\n"); + ROCPROFSYS_BASIC_VERBOSE_F(2 || rocm::on_load_trace, "Unloading...\n"); rocm::lock_t _lk{ rocm::rocm_mutex, std::defer_lock }; if(!_lk.owns_lock()) _lk.lock(); if(!rocm::is_loaded) { - OMNITRACE_BASIC_VERBOSE_F(1 || rocm::on_load_trace, + ROCPROFSYS_BASIC_VERBOSE_F(1 || rocm::on_load_trace, "rocprofiler is not loaded\n"); return; } @@ -113,14 +113,14 @@ extern "C" if(!config::get_use_rocprofiler() || config::get_rocm_events().empty()) return; - OMNITRACE_BASIC_VERBOSE_F(2 || rocm::on_load_trace, "Loading...\n"); + ROCPROFSYS_BASIC_VERBOSE_F(2 || rocm::on_load_trace, "Loading...\n"); rocm::lock_t _lk{ rocm::rocm_mutex, std::defer_lock }; if(!_lk.owns_lock()) _lk.lock(); if(rocm::is_loaded) { - OMNITRACE_BASIC_VERBOSE_F(1 || rocm::on_load_trace, + ROCPROFSYS_BASIC_VERBOSE_F(1 || rocm::on_load_trace, "rocprofiler is already loaded\n"); return; } @@ -141,7 +141,7 @@ extern "C" // settings->trace_size = 0; // settings->timeout = 0; - OMNITRACE_BASIC_VERBOSE_F(1 || rocm::on_load_trace, "rocprofiler settings: %s\n", + ROCPROFSYS_BASIC_VERBOSE_F(1 || rocm::on_load_trace, "rocprofiler settings: %s\n", JOIN("", *settings).c_str()); // Initialize profiling @@ -160,36 +160,36 @@ extern "C" if(_once) return true; _once = true; - OMNITRACE_BASIC_VERBOSE_F(2 || rocm::on_load_trace, "Loading...\n"); - OMNITRACE_SCOPED_SAMPLING_ON_CHILD_THREADS(false); + ROCPROFSYS_BASIC_VERBOSE_F(2 || rocm::on_load_trace, "Loading...\n"); + ROCPROFSYS_SCOPED_SAMPLING_ON_CHILD_THREADS(false); if(!tim::get_env("ROCPROFSYS_INIT_TOOLING", true)) return true; if(!tim::settings::enabled()) return true; roctracer_is_init() = true; - OMNITRACE_BASIC_VERBOSE_F(1 || rocm::on_load_trace, "Loading ROCm tooling...\n"); + ROCPROFSYS_BASIC_VERBOSE_F(1 || rocm::on_load_trace, "Loading ROCm tooling...\n"); if(!config::settings_are_configured() && get_state() < State::Active) omnitrace_init_tooling_hidden(); - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); -#if OMNITRACE_HIP_VERSION < 50300 - OMNITRACE_VERBOSE_F(1 || rocm::on_load_trace, +#if ROCPROFSYS_HIP_VERSION < 50300 + ROCPROFSYS_VERBOSE_F(1 || rocm::on_load_trace, "Computing the roctracer clock skew...\n"); (void) omnitrace::get_clock_skew(); #endif if(get_use_process_sampling() && get_use_rocm_smi()) { - OMNITRACE_VERBOSE_F(1 || rocm::on_load_trace, + ROCPROFSYS_VERBOSE_F(1 || rocm::on_load_trace, "Setting rocm_smi state to active...\n"); rocm_smi::set_state(State::Active); } comp::roctracer::setup(static_cast(table), rocm::on_load_trace); -#if defined(OMNITRACE_USE_ROCPROFILER) && OMNITRACE_USE_ROCPROFILER > 0 +#if defined(ROCPROFSYS_USE_ROCPROFILER) && ROCPROFSYS_USE_ROCPROFILER > 0 bool _force_rocprofiler_init = tim::get_env("ROCPROFSYS_FORCE_ROCPROFILER_INIT", false, false); #else @@ -201,17 +201,17 @@ extern "C" (config::settings_are_configured() && config::get_rocm_events().empty()); if(_force_rocprofiler_init || (get_use_rocprofiler() && !_is_empty)) { -#if OMNITRACE_HIP_VERSION < 50500 +#if ROCPROFSYS_HIP_VERSION < 50500 auto _rocprof = dynamic_library{ "ROCPROFSYS_ROCPROFILER_LIBRARY", find_library_path( "librocprofiler64.so", { "ROCPROFSYS_ROCM_PATH", "ROCM_PATH" }, - { OMNITRACE_DEFAULT_ROCM_PATH }, + { ROCPROFSYS_DEFAULT_ROCM_PATH }, { "lib", "lib64", "rocprofiler/lib", "rocprofiler/lib64" }), (RTLD_LAZY | RTLD_GLOBAL), false }; - OMNITRACE_VERBOSE_F(1 || rocm::on_load_trace, + ROCPROFSYS_VERBOSE_F(1 || rocm::on_load_trace, "Loading rocprofiler library (%s=%s)...\n", _rocprof.envname.c_str(), _rocprof.filename.c_str()); _rocprof.open(); @@ -219,13 +219,13 @@ extern "C" on_load_t _rocprof_load = nullptr; _success = _rocprof.invoke("OnLoad", _rocprof_load, table, runtime_version, failed_tool_count, failed_tool_names); - OMNITRACE_CONDITIONAL_PRINT_F(!_success, + ROCPROFSYS_CONDITIONAL_PRINT_F(!_success, "Warning! Invoking rocprofiler's OnLoad " - "failed! OMNITRACE_ROCPROFILER_LIBRARY=%s\n", + "failed! ROCPROFSYS_ROCPROFILER_LIBRARY=%s\n", _rocprof.filename.c_str()); - OMNITRACE_CI_THROW(!_success, + ROCPROFSYS_CI_THROW(!_success, "Warning! Invoking rocprofiler's OnLoad " - "failed! OMNITRACE_ROCPROFILER_LIBRARY=%s\n", + "failed! ROCPROFSYS_ROCPROFILER_LIBRARY=%s\n", _rocprof.filename.c_str()); #endif } @@ -238,7 +238,7 @@ extern "C" gpu::add_hip_device_metadata(); - OMNITRACE_BASIC_VERBOSE_F(2 || rocm::on_load_trace, "Loading... %s\n", + ROCPROFSYS_BASIC_VERBOSE_F(2 || rocm::on_load_trace, "Loading... %s\n", (_success) ? "Done" : "Failed"); return _success; } @@ -246,8 +246,8 @@ extern "C" // HSA-runtime on-unload method void OnUnload() { - OMNITRACE_BASIC_VERBOSE_F(2 || rocm::on_load_trace, "Unloading...\n"); + ROCPROFSYS_BASIC_VERBOSE_F(2 || rocm::on_load_trace, "Unloading...\n"); omnitrace_finalize_hidden(); - OMNITRACE_BASIC_VERBOSE_F(2 || rocm::on_load_trace, "Unloading... Done\n"); + ROCPROFSYS_BASIC_VERBOSE_F(2 || rocm::on_load_trace, "Unloading... Done\n"); } } diff --git a/source/lib/omnitrace/library/rocm.hpp b/source/lib/omnitrace/library/rocm.hpp index 2eeb3190..fdae2d88 100644 --- a/source/lib/omnitrace/library/rocm.hpp +++ b/source/lib/omnitrace/library/rocm.hpp @@ -24,7 +24,7 @@ #include "core/defines.hpp" -#if defined(OMNITRACE_USE_ROCPROFILER) && OMNITRACE_USE_ROCPROFILER > 0 +#if defined(ROCPROFSYS_USE_ROCPROFILER) && ROCPROFSYS_USE_ROCPROFILER > 0 # include #endif @@ -48,11 +48,11 @@ extern "C" using on_load_t = bool (*)(HsaApiTable*, uint64_t, uint64_t, const char* const*); bool OnLoad(HsaApiTable* table, uint64_t runtime_version, uint64_t failed_tool_count, - const char* const* failed_tool_names) OMNITRACE_PUBLIC_API; - void OnUnload() OMNITRACE_PUBLIC_API; + const char* const* failed_tool_names) ROCPROFSYS_PUBLIC_API; + void OnUnload() ROCPROFSYS_PUBLIC_API; -#if defined(OMNITRACE_USE_ROCPROFILER) && OMNITRACE_USE_ROCPROFILER > 0 - void OnLoadToolProp(rocprofiler_settings_t* settings) OMNITRACE_PUBLIC_API; - void OnUnloadTool() OMNITRACE_PUBLIC_API; +#if defined(ROCPROFSYS_USE_ROCPROFILER) && ROCPROFSYS_USE_ROCPROFILER > 0 + void OnLoadToolProp(rocprofiler_settings_t* settings) ROCPROFSYS_PUBLIC_API; + void OnUnloadTool() ROCPROFSYS_PUBLIC_API; #endif } diff --git a/source/lib/omnitrace/library/rocm/CMakeLists.txt b/source/lib/omnitrace/library/rocm/CMakeLists.txt index b47eabeb..92d47f49 100644 --- a/source/lib/omnitrace/library/rocm/CMakeLists.txt +++ b/source/lib/omnitrace/library/rocm/CMakeLists.txt @@ -1,5 +1,5 @@ # -if(OMNITRACE_USE_ROCPROFILER OR OMNITRACE_USE_ROCTRACER) +if(ROCPROFSYS_USE_ROCPROFILER OR ROCPROFSYS_USE_ROCTRACER) target_sources( rocprofsys-object-library PRIVATE ${CMAKE_CURRENT_LIST_DIR}/hsa_rsrc_factory.hpp ${CMAKE_CURRENT_LIST_DIR}/hsa_rsrc_factory.cpp) diff --git a/source/lib/omnitrace/library/rocm/hsa_rsrc_factory.cpp b/source/lib/omnitrace/library/rocm/hsa_rsrc_factory.cpp index e4f8578f..5993ee52 100644 --- a/source/lib/omnitrace/library/rocm/hsa_rsrc_factory.cpp +++ b/source/lib/omnitrace/library/rocm/hsa_rsrc_factory.cpp @@ -828,7 +828,7 @@ HsaRsrcFactory::PrintGpuAgents(const std::string&) if(itr) _agents.emplace_back(*itr); } - OMNITRACE_METADATA([_agents](auto& ar) { + ROCPROFSYS_METADATA([_agents](auto& ar) { namespace cereal = ::tim::cereal; ar.setNextName("rocm_agents"); diff --git a/source/lib/omnitrace/library/rocm_smi.cpp b/source/lib/omnitrace/library/rocm_smi.cpp index c467d74d..b5766589 100644 --- a/source/lib/omnitrace/library/rocm_smi.cpp +++ b/source/lib/omnitrace/library/rocm_smi.cpp @@ -59,7 +59,7 @@ #include #include -#define OMNITRACE_ROCM_SMI_CALL(...) \ +#define ROCPROFSYS_ROCM_SMI_CALL(...) \ ::omnitrace::rocm_smi::check_error(__FILE__, __LINE__, __VA_ARGS__) namespace omnitrace @@ -99,10 +99,10 @@ check_error(const char* _file, int _line, rsmi_status_t _code, bool* _option = n const char* _msg = nullptr; auto _err = rsmi_status_string(_code, &_msg); if(_err != RSMI_STATUS_SUCCESS) - OMNITRACE_THROW("rsmi_status_string failed. No error message available. " + ROCPROFSYS_THROW("rsmi_status_string failed. No error message available. " "Error code %i originated at %s:%i\n", static_cast(_code), _file, _line); - OMNITRACE_THROW("[%s:%i] Error code %i :: %s", _file, _line, static_cast(_code), + ROCPROFSYS_THROW("[%s:%i] Error code %i :: %s", _file, _line, static_cast(_code), _msg); } @@ -135,31 +135,31 @@ data::sample(uint32_t _dev_id) m_dev_id = _dev_id; m_ts = _ts; -#define OMNITRACE_RSMI_GET(OPTION, FUNCTION, ...) \ +#define ROCPROFSYS_RSMI_GET(OPTION, FUNCTION, ...) \ if(OPTION) \ { \ try \ { \ - OMNITRACE_ROCM_SMI_CALL(FUNCTION(__VA_ARGS__), &OPTION); \ + ROCPROFSYS_ROCM_SMI_CALL(FUNCTION(__VA_ARGS__), &OPTION); \ } catch(std::runtime_error & _e) \ { \ - OMNITRACE_VERBOSE_F( \ + ROCPROFSYS_VERBOSE_F( \ 0, "[%s] Exception: %s. Disabling future samples from rocm-smi...\n", \ #FUNCTION, _e.what()); \ get_state().store(State::Disabled); \ } \ } - OMNITRACE_RSMI_GET(get_settings(m_dev_id).busy, rsmi_dev_busy_percent_get, _dev_id, + ROCPROFSYS_RSMI_GET(get_settings(m_dev_id).busy, rsmi_dev_busy_percent_get, _dev_id, &m_busy_perc); - OMNITRACE_RSMI_GET(get_settings(m_dev_id).temp, rsmi_dev_temp_metric_get, _dev_id, + ROCPROFSYS_RSMI_GET(get_settings(m_dev_id).temp, rsmi_dev_temp_metric_get, _dev_id, RSMI_TEMP_TYPE_EDGE, RSMI_TEMP_CURRENT, &m_temp); - OMNITRACE_RSMI_GET(get_settings(m_dev_id).power, rsmi_dev_power_ave_get, _dev_id, 0, + ROCPROFSYS_RSMI_GET(get_settings(m_dev_id).power, rsmi_dev_power_ave_get, _dev_id, 0, &m_power); - OMNITRACE_RSMI_GET(get_settings(m_dev_id).mem_usage, rsmi_dev_memory_usage_get, + ROCPROFSYS_RSMI_GET(get_settings(m_dev_id).mem_usage, rsmi_dev_memory_usage_get, _dev_id, RSMI_MEM_TYPE_VRAM, &m_mem_usage); -#undef OMNITRACE_RSMI_GET +#undef ROCPROFSYS_RSMI_GET } void @@ -201,11 +201,11 @@ sample() for(auto itr : data::device_list) { if(rocm_smi::get_state() != State::Active) continue; - OMNITRACE_DEBUG_F("Polling rocm-smi for device %u...\n", itr); + ROCPROFSYS_DEBUG_F("Polling rocm-smi for device %u...\n", itr); auto& _data = *_bundle_data.at(itr); if(!_data) continue; _data->emplace_back(data{ itr }); - OMNITRACE_DEBUG_F(" %s\n", TIMEMORY_JOIN("", _data->back()).c_str()); + ROCPROFSYS_DEBUG_F(" %s\n", TIMEMORY_JOIN("", _data->back()).c_str()); } } @@ -233,7 +233,7 @@ data::setup() bool data::shutdown() { - OMNITRACE_DEBUG("Shutting down rocm-smi...\n"); + ROCPROFSYS_DEBUG("Shutting down rocm-smi...\n"); rocm_smi::set_state(State::Finalized); return true; } @@ -263,10 +263,10 @@ data::post_process(uint32_t _dev_id) auto _rocm_smi = (_rocm_smi_v) ? *_rocm_smi_v : std::deque{}; const auto& _thread_info = thread_info::get(0, InternalTID); - OMNITRACE_VERBOSE(1, "Post-processing %zu rocm-smi samples from device %u\n", + ROCPROFSYS_VERBOSE(1, "Post-processing %zu rocm-smi samples from device %u\n", _rocm_smi.size(), _dev_id); - OMNITRACE_CI_THROW(!_thread_info, "Missing thread info for thread 0"); + ROCPROFSYS_CI_THROW(!_thread_info, "Missing thread info for thread 0"); if(!_thread_info) return; auto _settings = get_settings(_dev_id); @@ -336,7 +336,7 @@ setup() if(is_initialized() || !get_use_rocm_smi()) return; - OMNITRACE_SCOPED_SAMPLING_ON_CHILD_THREADS(false); + ROCPROFSYS_SCOPED_SAMPLING_ON_CHILD_THREADS(false); // assign the data value to determined by rocm-smi data::device_count = device_count(); @@ -368,7 +368,7 @@ setup() { if(itr.find_first_not_of("0123456789-") != std::string::npos) { - OMNITRACE_THROW("Invalid GPU specification: '%s'. Only numerical values " + ROCPROFSYS_THROW("Invalid GPU specification: '%s'. Only numerical values " "(e.g., 0) or ranges (e.g., 0-7) are permitted.", itr.c_str()); } @@ -376,7 +376,7 @@ setup() if(itr.find('-') != std::string::npos) { auto _v = tim::delimit(itr, "-"); - OMNITRACE_CONDITIONAL_THROW(_v.size() != 2, + ROCPROFSYS_CONDITIONAL_THROW(_v.size() != 2, "Invalid GPU range specification: '%s'. " "Required format N-M, e.g. 0-4", itr.c_str()); @@ -399,7 +399,7 @@ setup() for(auto itr : _devices) { uint16_t dev_id = 0; - OMNITRACE_ROCM_SMI_CALL(rsmi_dev_id_get(itr, &dev_id)); + ROCPROFSYS_ROCM_SMI_CALL(rsmi_dev_id_get(itr, &dev_id)); // dev_id holds the device ID of device i, upon a successful call if(_metrics && !_metrics->empty()) @@ -417,10 +417,10 @@ setup() { auto iitr = supported.find(metric); if(iitr == supported.end()) - OMNITRACE_FAIL_F("unsupported rocm-smi metric: %s\n", + ROCPROFSYS_FAIL_F("unsupported rocm-smi metric: %s\n", metric.c_str()); - OMNITRACE_VERBOSE_F(1, "Enabling rocm-smi metric '%s'\n", + ROCPROFSYS_VERBOSE_F(1, "Enabling rocm-smi metric '%s'\n", metric.c_str()); iitr->second = true; } @@ -432,7 +432,7 @@ setup() data::setup(); } catch(std::runtime_error& _e) { - OMNITRACE_VERBOSE(0, "Exception thrown when initializing rocm-smi: %s\n", + ROCPROFSYS_VERBOSE(0, "Exception thrown when initializing rocm-smi: %s\n", _e.what()); data::device_list = {}; } @@ -449,11 +449,11 @@ shutdown() { if(data::shutdown()) { - OMNITRACE_ROCM_SMI_CALL(rsmi_shut_down()); + ROCPROFSYS_ROCM_SMI_CALL(rsmi_shut_down()); } } catch(std::runtime_error& _e) { - OMNITRACE_VERBOSE(0, "Exception thrown when shutting down rocm-smi: %s\n", + ROCPROFSYS_VERBOSE(0, "Exception thrown when shutting down rocm-smi: %s\n", _e.what()); } @@ -475,18 +475,18 @@ device_count() } // namespace rocm_smi } // namespace omnitrace -OMNITRACE_INSTANTIATE_EXTERN_COMPONENT( +ROCPROFSYS_INSTANTIATE_EXTERN_COMPONENT( TIMEMORY_ESC(data_tracker), true, double) -OMNITRACE_INSTANTIATE_EXTERN_COMPONENT( +ROCPROFSYS_INSTANTIATE_EXTERN_COMPONENT( TIMEMORY_ESC(data_tracker), true, double) -OMNITRACE_INSTANTIATE_EXTERN_COMPONENT( +ROCPROFSYS_INSTANTIATE_EXTERN_COMPONENT( TIMEMORY_ESC(data_tracker), true, double) -OMNITRACE_INSTANTIATE_EXTERN_COMPONENT( +ROCPROFSYS_INSTANTIATE_EXTERN_COMPONENT( TIMEMORY_ESC(data_tracker), true, double) diff --git a/source/lib/omnitrace/library/rocm_smi.hpp b/source/lib/omnitrace/library/rocm_smi.hpp index f6e45027..fa483ba9 100644 --- a/source/lib/omnitrace/library/rocm_smi.hpp +++ b/source/lib/omnitrace/library/rocm_smi.hpp @@ -90,7 +90,7 @@ struct data using mem_usage_t = uint64_t; using temp_t = int64_t; - OMNITRACE_DEFAULT_OBJECT(data) + ROCPROFSYS_DEFAULT_OBJECT(data) explicit data(uint32_t _dev_id); @@ -128,7 +128,7 @@ struct data static bool shutdown(); }; -#if !defined(OMNITRACE_USE_ROCM_SMI) +#if !defined(ROCPROFSYS_USE_ROCM_SMI) inline void setup() {} @@ -154,27 +154,27 @@ inline void set_state(State) {} } // namespace rocm_smi } // namespace omnitrace -#if defined(OMNITRACE_USE_ROCM_SMI) && OMNITRACE_USE_ROCM_SMI > 0 -# if !defined(OMNITRACE_EXTERN_COMPONENTS) || \ - (defined(OMNITRACE_EXTERN_COMPONENTS) && OMNITRACE_EXTERN_COMPONENTS > 0) +#if defined(ROCPROFSYS_USE_ROCM_SMI) && ROCPROFSYS_USE_ROCM_SMI > 0 +# if !defined(ROCPROFSYS_EXTERN_COMPONENTS) || \ + (defined(ROCPROFSYS_EXTERN_COMPONENTS) && ROCPROFSYS_EXTERN_COMPONENTS > 0) # include # include # include -OMNITRACE_DECLARE_EXTERN_COMPONENT( +ROCPROFSYS_DECLARE_EXTERN_COMPONENT( TIMEMORY_ESC(data_tracker), true, double) -OMNITRACE_DECLARE_EXTERN_COMPONENT( +ROCPROFSYS_DECLARE_EXTERN_COMPONENT( TIMEMORY_ESC(data_tracker), true, double) -OMNITRACE_DECLARE_EXTERN_COMPONENT( +ROCPROFSYS_DECLARE_EXTERN_COMPONENT( TIMEMORY_ESC(data_tracker), true, double) -OMNITRACE_DECLARE_EXTERN_COMPONENT( +ROCPROFSYS_DECLARE_EXTERN_COMPONENT( TIMEMORY_ESC(data_tracker), true, double) diff --git a/source/lib/omnitrace/library/rocprofiler.cpp b/source/lib/omnitrace/library/rocprofiler.cpp index 6b6d0088..fb11decc 100644 --- a/source/lib/omnitrace/library/rocprofiler.cpp +++ b/source/lib/omnitrace/library/rocprofiler.cpp @@ -71,8 +71,8 @@ get_event_names() void fatal(const std::string& msg) { - OMNITRACE_PRINT_F("\n"); - OMNITRACE_PRINT_F("%s\n", msg.c_str()); + ROCPROFSYS_PRINT_F("\n"); + ROCPROFSYS_PRINT_F("%s\n", msg.c_str()); abort(); } @@ -94,7 +94,7 @@ rocm_check_status(hsa_status_t _status, const std::set& _nonfatal if(_nonfatal.count(_status) == 0) fatal(JOIN(" :: ", "ERROR", rocm_error_string(_status))); - OMNITRACE_PRINT_F("Warning! %s\n", rocm_error_string(_status)); + ROCPROFSYS_PRINT_F("Warning! %s\n", rocm_error_string(_status)); return false; } return true; @@ -240,7 +240,7 @@ metrics_input(unsigned _device, rocprofiler_feature_t** ret) auto _this_device = JOIN("", ":device=", _device); for(auto itr : _events) { - OMNITRACE_VERBOSE_F(3, "Processing feature '%s' for device %u...\n", itr.c_str(), + ROCPROFSYS_VERBOSE_F(3, "Processing feature '%s' for device %u...\n", itr.c_str(), _device); auto _pos = itr.find(":device="); if(_pos != std::string::npos) @@ -262,7 +262,7 @@ metrics_input(unsigned _device, rocprofiler_feature_t** ret) // PMC events for(unsigned i = 0; i < feature_count; ++i) { - OMNITRACE_VERBOSE_F(3, "Adding feature '%s' for device %u...\n", + ROCPROFSYS_VERBOSE_F(3, "Adding feature '%s' for device %u...\n", _features.at(i).c_str(), _device); features[i].kind = ROCPROFILER_FEATURE_KIND_METRIC; features[i].name = strdup(_features.at(i).c_str()); @@ -353,7 +353,7 @@ rocm_metrics() (void) HsaRsrcFactory::Instance(); } catch(std::runtime_error& _e) { - OMNITRACE_VERBOSE_F(0, "%s\n", _e.what()); + ROCPROFSYS_VERBOSE_F(0, "%s\n", _e.what()); return _data; } @@ -372,7 +372,7 @@ rocm_metrics() info_data_callback, reinterpret_cast(&_data)), { HSA_STATUS_ERROR_NOT_INITIALIZED })) { - OMNITRACE_WARNING_F(-1, "rocprofiler_iterate_info failed for gpu agent %u\n", + ROCPROFSYS_WARNING_F(-1, "rocprofiler_iterate_info failed for gpu agent %u\n", i); } } @@ -384,7 +384,7 @@ rocm_metrics() info_data_callback, reinterpret_cast(&_data)), { HSA_STATUS_ERROR_NOT_INITIALIZED })) { - OMNITRACE_WARNING_F(-1, "rocprofiler_iterate_info failed for %i gpu agents\n", + ROCPROFSYS_WARNING_F(-1, "rocprofiler_iterate_info failed for %i gpu agents\n", gpu_count); } } @@ -468,7 +468,7 @@ rocm_initialize() rocprofiler_queue_callbacks_t callbacks_ptrs{}; callbacks_ptrs.dispatch = rocm_dispatch_callback; int err = rocprofiler_set_queue_callbacks(callbacks_ptrs, callbacks_arg); - OMNITRACE_VERBOSE_F(3, "err=%d, rocprofiler_set_queue_callbacks\n", err); + ROCPROFSYS_VERBOSE_F(3, "err=%d, rocprofiler_set_queue_callbacks\n", err); is_setup() = true; } @@ -504,7 +504,7 @@ post_process_perfetto() auto _device_fields = std::map>{}; auto _device_range = std::map>{}; - for(size_t i = 0; i < OMNITRACE_MAX_THREADS; ++i) + for(size_t i = 0; i < ROCPROFSYS_MAX_THREADS; ++i) { auto& _v = component::rocm_data(i); if(_v) @@ -624,7 +624,7 @@ post_process_timemory() auto _device_fields = std::map>{}; auto _device_range = std::map>{}; - for(size_t i = 0; i < OMNITRACE_MAX_THREADS; ++i) + for(size_t i = 0; i < ROCPROFSYS_MAX_THREADS; ++i) { auto& _v = component::rocm_data(i); if(_v) @@ -672,7 +672,7 @@ post_process_timemory() rocm_event* parent = nullptr; mutable std::vector children = {}; - OMNITRACE_DEFAULT_OBJECT(local_event) + ROCPROFSYS_DEFAULT_OBJECT(local_event) explicit local_event(rocm_event* _v) : parent{ _v } @@ -752,7 +752,7 @@ post_process_timemory() for(auto& ditr : _device_data) { - OMNITRACE_VERBOSE_F(1, "Post-processing %zu entries for device %u...\n", + ROCPROFSYS_VERBOSE_F(1, "Post-processing %zu entries for device %u...\n", ditr.second.size(), ditr.first); auto _storage = std::vector{}; for(auto& itr : ditr.second) @@ -795,7 +795,7 @@ post_process_timemory() } } - OMNITRACE_VERBOSE_F(3, "Average # of iterations before match: %.1f\n", + ROCPROFSYS_VERBOSE_F(3, "Average # of iterations before match: %.1f\n", _avg / ditr.second.size() * 100.0); for(auto& sitr : _storage) diff --git a/source/lib/omnitrace/library/rocprofiler.hpp b/source/lib/omnitrace/library/rocprofiler.hpp index 26eb9b58..4dcb1285 100644 --- a/source/lib/omnitrace/library/rocprofiler.hpp +++ b/source/lib/omnitrace/library/rocprofiler.hpp @@ -68,7 +68,7 @@ post_process(); std::vector rocm_metrics(); -#if !defined(OMNITRACE_USE_ROCPROFILER) || OMNITRACE_USE_ROCPROFILER == 0 +#if !defined(ROCPROFSYS_USE_ROCPROFILER) || ROCPROFSYS_USE_ROCPROFILER == 0 inline void post_process() {} diff --git a/source/lib/omnitrace/library/roctracer.cpp b/source/lib/omnitrace/library/roctracer.cpp index 816c9fe6..626a7664 100644 --- a/source/lib/omnitrace/library/roctracer.cpp +++ b/source/lib/omnitrace/library/roctracer.cpp @@ -48,18 +48,18 @@ #include #include -#if OMNITRACE_HIP_VERSION < 50300 +#if ROCPROFSYS_HIP_VERSION < 50300 # include #endif #define AMD_INTERNAL_BUILD 1 #include -#if __has_include() || (defined(OMNITRACE_USE_HIP) && OMNITRACE_USE_HIP > 0) +#if __has_include() || (defined(ROCPROFSYS_USE_HIP) && ROCPROFSYS_USE_HIP > 0) # include -# define OMNITRACE_HIP_API_ARGS 1 +# define ROCPROFSYS_HIP_API_ARGS 1 #else -# define OMNITRACE_HIP_API_ARGS 0 +# define ROCPROFSYS_HIP_API_ARGS 0 #endif TIMEMORY_DEFINE_API(roctracer) @@ -78,7 +78,7 @@ roctracer_type_mutex() std::string hip_api_string(hip_api_id_t id, const hip_api_data_t* data) { -#if OMNITRACE_HIP_API_ARGS > 0 +#if ROCPROFSYS_HIP_API_ARGS > 0 std::string _v = hipApiString(id, data); if(_v.empty()) return _v; auto _pbeg = _v.find('('); @@ -176,7 +176,7 @@ get_clock_skew() static auto _gpu_now = []() { cpu::fence(); uint64_t _ts = 0; - OMNITRACE_ROCTRACER_CALL(roctracer_get_timestamp(&_ts)); + ROCPROFSYS_ROCTRACER_CALL(roctracer_get_timestamp(&_ts)); return _ts; }; @@ -207,9 +207,9 @@ get_clock_skew() _cpu_ave += _cpu_ts / _n; _gpu_ave += _gpu_ts / _n; } - OMNITRACE_BASIC_VERBOSE(2, "CPU timestamp: %li\n", _cpu_ave); - OMNITRACE_BASIC_VERBOSE(2, "HIP timestamp: %li\n", _gpu_ave); - OMNITRACE_BASIC_VERBOSE(1, "CPU/HIP timestamp skew: %li (used: %s)\n", _diff, + ROCPROFSYS_BASIC_VERBOSE(2, "CPU timestamp: %li\n", _cpu_ave); + ROCPROFSYS_BASIC_VERBOSE(2, "HIP timestamp: %li\n", _gpu_ave); + ROCPROFSYS_BASIC_VERBOSE(1, "CPU/HIP timestamp skew: %li (used: %s)\n", _diff, _use ? "yes" : "no"); _diff /= _n; return _diff; @@ -224,11 +224,11 @@ hsa_api_callback(uint32_t domain, uint32_t cid, const void* callback_data, void* if(get_state() != State::Active || !trait::runtime_enabled::get()) return; - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); (void) arg; const hsa_api_data_t* data = reinterpret_cast(callback_data); - OMNITRACE_CONDITIONAL_PRINT_F( + ROCPROFSYS_CONDITIONAL_PRINT_F( get_debug() && get_verbose() >= 2, "<%-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"); @@ -344,7 +344,7 @@ hsa_activity_callback(uint32_t op, const void* vrecord, void* arg) if(get_state() != State::Active || !trait::runtime_enabled::get()) return; - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); auto&& _protect = comp::roctracer::protect_flush_activity(); (void) _protect; @@ -362,7 +362,7 @@ hsa_activity_callback(uint32_t op, const void* vrecord, void* arg) default: break; } - OMNITRACE_CI_FAIL(_name == nullptr, "Error! HSA operation type not handled: %u\n", + ROCPROFSYS_CI_FAIL(_name == nullptr, "Error! HSA operation type not handled: %u\n", op); if(!_name) return; @@ -414,7 +414,7 @@ hip_exec_activity_callbacks(int64_t _tid) // guard against initialization of structure when trying to exec if(static_cast(_tid) >= get_hip_activity_callbacks_size()) return; - // OMNITRACE_ROCTRACER_CALL(roctracer_flush_activity()); + // ROCPROFSYS_ROCTRACER_CALL(roctracer_flush_activity()); locking::atomic_lock _lk{ get_hip_activity_mutex(_tid) }; auto& _async_ops = get_hip_activity_callbacks(_tid); if(!_async_ops) return; @@ -437,7 +437,7 @@ roctx_api_callback(uint32_t domain, uint32_t cid, const void* callback_data, if(get_state() != State::Active || !trait::runtime_enabled::get()) return; - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); if(domain != ACTIVITY_DOMAIN_ROCTX) return; @@ -467,7 +467,7 @@ roctx_api_callback(uint32_t domain, uint32_t cid, const void* callback_data, } else { - OMNITRACE_THROW("Error! roctxRangePop stack is empty! Expected " + ROCPROFSYS_THROW("Error! roctxRangePop stack is empty! Expected " "roctxRangePush/roctxRangePop on same thread\n"); } break; @@ -491,12 +491,12 @@ roctx_api_callback(uint32_t domain, uint32_t cid, const void* callback_data, locking::atomic_lock _lk{ _range_lock, std::defer_lock }; if(!_lk.owns_lock()) _lk.lock(); auto itr = _range_map.find(roctx_range_id_t{ _data->args.id }); - OMNITRACE_CI_THROW(itr == _range_map.end(), + ROCPROFSYS_CI_THROW(itr == _range_map.end(), "Error! could not find range with id %lu\n", _data->args.id); if(itr == _range_map.end()) { - OMNITRACE_VERBOSE(0, "Warning! could not find range with id %lu\n", + ROCPROFSYS_VERBOSE(0, "Warning! could not find range with id %lu\n", _data->args.id); return; } @@ -533,7 +533,7 @@ hip_api_callback(uint32_t domain, uint32_t cid, const void* callback_data, void* if(get_state() != State::Active || !trait::runtime_enabled::get()) return; - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); assert(domain == ACTIVITY_DOMAIN_HIP_API); const char* op_name = roctracer_op_string(domain, cid, 0); @@ -546,8 +546,8 @@ hip_api_callback(uint32_t domain, uint32_t cid, const void* callback_data, void* case HIP_API_ID___hipPushCallConfiguration: case HIP_API_ID___hipPopCallConfiguration: case HIP_API_ID_hipDeviceEnablePeerAccess: -#if OMNITRACE_HIP_VERSION_MAJOR > 4 || \ - (OMNITRACE_HIP_VERSION_MAJOR == 4 && OMNITRACE_HIP_VERSION_MINOR >= 3) +#if ROCPROFSYS_HIP_VERSION_MAJOR > 4 || \ + (ROCPROFSYS_HIP_VERSION_MAJOR == 4 && ROCPROFSYS_HIP_VERSION_MINOR >= 3) case HIP_API_ID_hipImportExternalMemory: case HIP_API_ID_hipDestroyExternalMemory: #endif @@ -556,7 +556,7 @@ hip_api_callback(uint32_t domain, uint32_t cid, const void* callback_data, void* } const hip_api_data_t* data = reinterpret_cast(callback_data); - OMNITRACE_CONDITIONAL_PRINT_F( + ROCPROFSYS_CONDITIONAL_PRINT_F( get_debug() && get_verbose() >= 2, "<%-30s id(%u)\tcorrelation_id(%lu) %s>\n", op_name, cid, data->correlation_id, (data->phase == ACTIVITY_API_PHASE_ENTER) ? "on-enter" : "on-exit"); @@ -806,7 +806,7 @@ hip_activity_callback(const char* begin, const char* end, void* arg) if(get_state() != State::Active || !trait::runtime_enabled::get()) return; - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); auto&& _protect = comp::roctracer::protect_flush_activity(); (void) _protect; @@ -822,7 +822,7 @@ hip_activity_callback(const char* begin, const char* end, void* arg) reinterpret_cast(end); auto&& _advance_record = [&record]() { - OMNITRACE_ROCTRACER_CALL(roctracer_next_record(record, &record)); + ROCPROFSYS_ROCTRACER_CALL(roctracer_next_record(record, &record)); }; while(record < end_record) @@ -830,7 +830,7 @@ hip_activity_callback(const char* begin, const char* end, void* arg) // make sure every iteration advances regardless of where return point happens scope::destructor _next_dtor{ _advance_record }; - // OMNITRACE_CI will enable these asserts and should fail if something relevant + // ROCPROFSYS_CI will enable these asserts and should fail if something relevant // changes assert(HIP_OP_ID_DISPATCH == 0); assert(HIP_OP_ID_COPY == 1); @@ -886,7 +886,7 @@ hip_activity_callback(const char* begin, const char* end, void* arg) static size_t _nmax = get_env("ROCPROFSYS_ROCTRACER_DISCARD_INVALID", 0); if(_nmax == 0) std::swap(_end_ns, _beg_ns); - OMNITRACE_WARNING_IF_F( + ROCPROFSYS_WARNING_IF_F( _n < _nmax && _verbose(), "%4zu :: Discarding kernel roctracer activity record which ended before " "it started :: %-20s :: %-20s :: cid=%lu, time_ns=(%12lu:%12lu) " @@ -894,7 +894,7 @@ hip_activity_callback(const char* begin, const char* end, void* arg) _n, op_name, _name, record->correlation_id, _beg_ns, _end_ns, (static_cast(_end_ns) - static_cast(_beg_ns)), _devid, _queid, record->process_id, _tid, _op_id_names.at(record->op)); - OMNITRACE_WARNING_IF_F( + ROCPROFSYS_WARNING_IF_F( _nmax > 0 && _n == _nmax && _verbose(), "Suppressing future messages about discarding kernel roctracer activity " "record which ended before it started. Set " diff --git a/source/lib/omnitrace/library/roctracer.hpp b/source/lib/omnitrace/library/roctracer.hpp index 5b773389..3315539c 100644 --- a/source/lib/omnitrace/library/roctracer.hpp +++ b/source/lib/omnitrace/library/roctracer.hpp @@ -33,13 +33,13 @@ #include // Macro to check ROC-tracer calls status -#define OMNITRACE_ROCTRACER_CALL(call) \ +#define ROCPROFSYS_ROCTRACER_CALL(call) \ { \ - OMNITRACE_DEBUG_F(#call); \ + ROCPROFSYS_DEBUG_F(#call); \ int err = call; \ if(err != 0) \ { \ - OMNITRACE_PRINT_F("%s in: %s\n", roctracer_error_string(), #call); \ + ROCPROFSYS_PRINT_F("%s in: %s\n", roctracer_error_string(), #call); \ } \ } diff --git a/source/lib/omnitrace/library/runtime.cpp b/source/lib/omnitrace/library/runtime.cpp index e989583a..620c5832 100644 --- a/source/lib/omnitrace/library/runtime.cpp +++ b/source/lib/omnitrace/library/runtime.cpp @@ -62,10 +62,10 @@ auto root_process_id = auto& get_sampling_on_child_threads_history(int64_t _idx = utility::get_thread_index()) { - static auto _v = utility::get_filled_array( + static auto _v = utility::get_filled_array( []() { return utility::get_reserved_vector(32); }); - if(_idx >= OMNITRACE_MAX_THREADS) + if(_idx >= ROCPROFSYS_MAX_THREADS) { static thread_local auto _tl_v = utility::get_reserved_vector(32); return _tl_v; @@ -139,7 +139,7 @@ create_cpu_cid_entry(int64_t _tid) { using tim::auto_lock_t; - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); // unique lock for _tid auto& _mtx = get_cpu_cid_stack_lock(_tid); @@ -192,7 +192,7 @@ setup_gotchas() if(_initialized) return; _initialized = true; - OMNITRACE_BASIC_DEBUG( + ROCPROFSYS_BASIC_DEBUG( "Configuring gotcha wrapper around fork, MPI_Init, and MPI_Init_thread\n"); component::mpi_gotcha::configure(); diff --git a/source/lib/omnitrace/library/runtime.hpp b/source/lib/omnitrace/library/runtime.hpp index ec3bf9c3..2096e36f 100644 --- a/source/lib/omnitrace/library/runtime.hpp +++ b/source/lib/omnitrace/library/runtime.hpp @@ -132,8 +132,8 @@ bool is_child_process(); } // namespace omnitrace -#define OMNITRACE_SCOPED_SAMPLING_ON_CHILD_THREADS(VALUE) \ - ::omnitrace::scoped_child_sampling OMNITRACE_VARIABLE(_scoped_child_sampling_, \ +#define ROCPROFSYS_SCOPED_SAMPLING_ON_CHILD_THREADS(VALUE) \ + ::omnitrace::scoped_child_sampling ROCPROFSYS_VARIABLE(_scoped_child_sampling_, \ __LINE__) \ { \ VALUE \ diff --git a/source/lib/omnitrace/library/sampling.cpp b/source/lib/omnitrace/library/sampling.cpp index c742982b..e9995294 100644 --- a/source/lib/omnitrace/library/sampling.cpp +++ b/source/lib/omnitrace/library/sampling.cpp @@ -134,11 +134,11 @@ using component::sampling_wall_clock; } // namespace sampling } // namespace omnitrace -OMNITRACE_DEFINE_CONCRETE_TRAIT(prevent_reentry, sampling::sampler_t, std::true_type) +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(prevent_reentry, sampling::sampler_t, std::true_type) -OMNITRACE_DEFINE_CONCRETE_TRAIT(provide_backtrace, sampling::sampler_t, std::false_type) +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(provide_backtrace, sampling::sampler_t, std::false_type) -OMNITRACE_DEFINE_CONCRETE_TRAIT(buffer_size, sampling::sampler_t, +ROCPROFSYS_DEFINE_CONCRETE_TRAIT(buffer_size, sampling::sampler_t, TIMEMORY_ESC(std::integral_constant)) namespace omnitrace @@ -164,8 +164,8 @@ configure_sampler_allocator(std::shared_ptr& _v) { if(_v) return; - OMNITRACE_SCOPED_SAMPLING_ON_CHILD_THREADS(false); - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_SAMPLING_ON_CHILD_THREADS(false); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); _v = std::make_shared(); _v->reserve(config::get_sampling_allocator_size()); @@ -196,7 +196,7 @@ get_sampler_allocator() auto& _allocators = get_sampler_allocators(); - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); auto_lock_t _lk{ type_mutex() }; @@ -356,7 +356,7 @@ start_duration_thread() if(_premature && !_finalized) { // protect against spurious wakeups - OMNITRACE_VERBOSE( + ROCPROFSYS_VERBOSE( 2, "%sSpurious wakeup of sampling duration thread...\n", tim::log::color::warning()); _wait = true; @@ -368,7 +368,7 @@ start_duration_thread() else { get_duration_disabled().store(true); - OMNITRACE_VERBOSE(1, + ROCPROFSYS_VERBOSE(1, "Sampling duration of %f seconds has elapsed. " "Shutting down sampling...\n", config::get_sampling_duration()); @@ -377,10 +377,10 @@ start_duration_thread() } }; - OMNITRACE_VERBOSE(1, "Sampling will be disabled after %f seconds...\n", + ROCPROFSYS_VERBOSE(1, "Sampling will be disabled after %f seconds...\n", config::get_sampling_duration()); - OMNITRACE_SCOPED_SAMPLING_ON_CHILD_THREADS(false); + ROCPROFSYS_SCOPED_SAMPLING_ON_CHILD_THREADS(false); get_duration_thread() = std::make_unique(_func); _protect = false; } @@ -394,7 +394,7 @@ get_offload_file() if(get_use_tmp_files()) { auto _success = _tmp_v->open(); - OMNITRACE_CI_FAIL(!_success, + ROCPROFSYS_CI_FAIL(!_success, "Error opening sampling offload temporary file '%s'\n", _tmp_v->filename.c_str()); } @@ -419,7 +419,7 @@ auto offload_seq_data = std::unordered_map>{}; void offload_buffer(int64_t _seq, sampler_buffer_t&& _buf) { - OMNITRACE_REQUIRE(get_use_tmp_files()) + ROCPROFSYS_REQUIRE(get_use_tmp_files()) << "Error! sampling allocator tries to offload buffer of samples but " "omnitrace was configured to not use temporary files\n"; @@ -428,15 +428,15 @@ offload_buffer(int64_t _seq, sampler_buffer_t&& _buf) auto _lk = locking::atomic_lock{ get_offload_mutex() }; auto& _file = get_offload_file(); - OMNITRACE_REQUIRE(_file) + ROCPROFSYS_REQUIRE(_file) << "Error! sampling allocator tried to offload buffer of samples for thread " << _seq << " but the offload file does not exist\n"; - OMNITRACE_VERBOSE_F(2, "Offloading %zu samples for thread %li to %s...\n", + ROCPROFSYS_VERBOSE_F(2, "Offloading %zu samples for thread %li to %s...\n", _buf.count(), _seq, _file->filename.c_str()); auto& _fs = _file->stream; - OMNITRACE_REQUIRE(_fs.good()) << "Error! temporary file for offloading buffer is in " + ROCPROFSYS_REQUIRE(_fs.good()) << "Error! temporary file for offloading buffer is in " "an invalid state during offload for thread " << _seq << "\n"; @@ -454,7 +454,7 @@ load_offload_buffer(int64_t _thread_idx) auto _data = std::vector{}; if(!get_use_tmp_files()) { - OMNITRACE_WARNING_F( + ROCPROFSYS_WARNING_F( 2, "[sampling] returning no data because using temporary files is disabled"); return _data; } @@ -465,7 +465,7 @@ load_offload_buffer(int64_t _thread_idx) auto& _file = get_offload_file(); if(!_file) { - OMNITRACE_WARNING_F( + ROCPROFSYS_WARNING_F( 0, "[sampling] returning no data because the offload file no longer exists"); return _data; } @@ -476,7 +476,7 @@ load_offload_buffer(int64_t _thread_idx) if(!_file->open(std::ios::binary | std::ios::in)) { - OMNITRACE_WARNING_F(0, "[sampling] %s failed to open", _file->filename.c_str()); + ROCPROFSYS_WARNING_F(0, "[sampling] %s failed to open", _file->filename.c_str()); return _data; } @@ -496,7 +496,7 @@ load_offload_buffer(int64_t _thread_idx) if(_seq != _thread_idx) { - OMNITRACE_WARNING_F( + ROCPROFSYS_WARNING_F( 0, "[sampling] file position %zu returned %zi instead of (expected) %zi\n", static_cast(itr), _seq, _thread_idx); @@ -506,7 +506,7 @@ load_offload_buffer(int64_t _thread_idx) _data.emplace_back(std::move(_buffer)); } - OMNITRACE_VERBOSE_F(2, "[sampling] Loaded %zu samples for thread %li...\n", _count, + ROCPROFSYS_VERBOSE_F(2, "[sampling] Loaded %zu samples for thread %li...\n", _count, _thread_idx); _file->close(); @@ -524,12 +524,12 @@ configure(bool _setup, int64_t _tid) bool _is_running = (!_running) ? false : *_running; auto& _signal_types = sampling::get_signal_types(_tid); - OMNITRACE_CONDITIONAL_THROW(get_use_causal(), + ROCPROFSYS_CONDITIONAL_THROW(get_use_causal(), "Internal error! configuring sampling not permitted when " "causal profiling is enabled"); - OMNITRACE_SCOPED_SAMPLING_ON_CHILD_THREADS(false); - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_SAMPLING_ON_CHILD_THREADS(false); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); auto&& _cputime_tids = get_sampling_cputime_tids(); auto&& _realtime_tids = get_sampling_realtime_tids(); @@ -540,7 +540,7 @@ configure(bool _setup, int64_t _tid) { if(_tids.count(_tid) == 0) { - OMNITRACE_VERBOSE(3, "Disabling SIG%i from thread %li\n", _signum, _tid); + ROCPROFSYS_VERBOSE(3, "Disabling SIG%i from thread %li\n", _signum, _tid); _signal_types->erase(_signum); } } @@ -575,10 +575,10 @@ configure(bool _setup, int64_t _tid) auto _verbose = std::min(get_verbose() - 2, 2); if(get_debug_sampling()) _verbose = 2; - OMNITRACE_DEBUG("Requesting allocator for sampler on thread %lu...\n", _tid); + ROCPROFSYS_DEBUG("Requesting allocator for sampler on thread %lu...\n", _tid); auto _alloc = get_sampler_allocator(); - OMNITRACE_DEBUG("Configuring sampler for thread %lu...\n", _tid); + ROCPROFSYS_DEBUG("Configuring sampler for thread %lu...\n", _tid); sampling::sampler_instances::construct(construct_on_thread{ _tid }, _alloc, "rocprofsys", _tid, _verbose); @@ -637,7 +637,7 @@ configure(bool _setup, int64_t _tid) auto _perf_open_error = _perf_sampler->open(_pe, _info->index_data->system_value); - OMNITRACE_REQUIRE(!_perf_open_error) + ROCPROFSYS_REQUIRE(!_perf_open_error) << "perf backend for overflow failed to activate: " << *_perf_open_error; _perf_sampler->set_ready_signal(get_sampling_overflow_signal()); @@ -669,7 +669,7 @@ configure(bool _setup, int64_t _tid) static_assert(tim::trait::buffer_size::value > 0, "Error! Zero buffer size"); - OMNITRACE_CONDITIONAL_THROW( + ROCPROFSYS_CONDITIONAL_THROW( _sampler->get_buffer_size() != tim::trait::buffer_size::value, "dynamic sampler has a buffer size different from static trait: %zu instead " @@ -677,7 +677,7 @@ configure(bool _setup, int64_t _tid) _sampler->get_buffer_size(), tim::trait::buffer_size::value); - OMNITRACE_CONDITIONAL_THROW( + ROCPROFSYS_CONDITIONAL_THROW( _sampler->get_buffer_size() <= 0, "dynamic sampler requires a positive buffer size: %zu", _sampler->get_buffer_size()); @@ -690,7 +690,7 @@ configure(bool _setup, int64_t _tid) auto _overflow_event = get_setting_value("ROCPROFSYS_SAMPLING_OVERFLOW_EVENT") .value_or("perf::PERF_COUNT_HW_CACHE_REFERENCES"); - OMNITRACE_VERBOSE(2, + ROCPROFSYS_VERBOSE(2, "[SIG%i] Sampler for thread %lu will be triggered " "every %.1f %s events...\n", itr, _tid, _freq, _overflow_event.c_str()); @@ -703,7 +703,7 @@ configure(bool _setup, int64_t _tid) dynamic_cast(_sampler->get_trigger(itr)); if(_timer) { - OMNITRACE_VERBOSE( + ROCPROFSYS_VERBOSE( 2, "[SIG%i] Sampler for thread %lu will be triggered %.1fx per " "second of %s-time (every %.3e milliseconds)...\n", @@ -720,7 +720,7 @@ configure(bool _setup, int64_t _tid) } else if(!_setup && _sampler && _is_running) { - OMNITRACE_DEBUG("Stopping sampler for thread %lu...\n", _tid); + ROCPROFSYS_DEBUG("Stopping sampler for thread %lu...\n", _tid); *_running = false; if(_tid == threading::get_id() && !_signal_types->empty()) @@ -744,13 +744,13 @@ configure(bool _setup, int64_t _tid) if(_tid == 0) { - for(int64_t i = 1; i < OMNITRACE_MAX_THREADS; ++i) + for(int64_t i = 1; i < ROCPROFSYS_MAX_THREADS; ++i) { if(sampling::get_sampler(i)) sampling::get_sampler(i)->stop(); if(perf::get_instance(i)) perf::get_instance(i)->stop(); } - for(int64_t i = 1; i < OMNITRACE_MAX_THREADS; ++i) + for(int64_t i = 1; i < ROCPROFSYS_MAX_THREADS; ++i) { if(sampling::get_sampler(i)) { @@ -769,7 +769,7 @@ configure(bool _setup, int64_t _tid) if(trait::runtime_enabled::get()) backtrace_metrics::configure(_setup, _tid); - OMNITRACE_DEBUG("Sampler destroyed for thread %lu\n", _tid); + ROCPROFSYS_DEBUG("Sampler destroyed for thread %lu\n", _tid); } return (_signal_types) ? *_signal_types : std::set{}; @@ -857,11 +857,11 @@ block_signals(std::set _signals) if(_signals.empty()) _signals = *get_signal_types(threading::get_id()); if(_signals.empty()) { - OMNITRACE_VERBOSE(2, "No signals to block...\n"); + ROCPROFSYS_VERBOSE(2, "No signals to block...\n"); return; } - OMNITRACE_DEBUG("Blocking signals [%s] on thread #%lu...\n", + ROCPROFSYS_DEBUG("Blocking signals [%s] on thread #%lu...\n", get_signal_names(_signals).c_str(), threading::get_id()); sigset_t _v = get_signal_set(_signals); @@ -874,11 +874,11 @@ unblock_signals(std::set _signals) if(_signals.empty()) _signals = *get_signal_types(threading::get_id()); if(_signals.empty()) { - OMNITRACE_VERBOSE(2, "No signals to unblock...\n"); + ROCPROFSYS_VERBOSE(2, "No signals to unblock...\n"); return; } - OMNITRACE_DEBUG("Unblocking signals [%s] on thread #%lu...\n", + ROCPROFSYS_DEBUG("Unblocking signals [%s] on thread #%lu...\n", get_signal_names(_signals).c_str(), threading::get_id()); sigset_t _v = get_signal_set(_signals); @@ -888,14 +888,14 @@ unblock_signals(std::set _signals) void post_process() { - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); size_t _total_data = 0; size_t _total_threads = 0; auto _external_samples = std::atomic{ 0 }; auto _internal_samples = std::atomic{ 0 }; - OMNITRACE_VERBOSE(2 || get_debug_sampling(), "Stopping sampling components...\n"); + ROCPROFSYS_VERBOSE(2 || get_debug_sampling(), "Stopping sampling components...\n"); omnitrace::component::backtrace::stop(); configure(false, 0); @@ -910,7 +910,7 @@ post_process() if(!_sampler) { // this should be relatively common - OMNITRACE_CONDITIONAL_PRINT( + ROCPROFSYS_CONDITIONAL_PRINT( get_debug() && get_verbose() >= 2, "Post-processing sampling entries for thread %lu skipped (no sampler)\n", i); @@ -922,7 +922,7 @@ post_process() if(!_init) { // this is not common - OMNITRACE_PRINT("Post-processing sampling entries for thread %lu skipped " + ROCPROFSYS_PRINT("Post-processing sampling entries for thread %lu skipped " "(not initialized)\n", i); continue; @@ -930,7 +930,7 @@ post_process() const auto& _thread_info = thread_info::get(i, SequentTID); - OMNITRACE_VERBOSE(3 || get_debug_sampling(), + ROCPROFSYS_VERBOSE(3 || get_debug_sampling(), "Getting sampler data for thread %lu...\n", i); auto _raw_data = _sampler->get_data(); @@ -946,11 +946,11 @@ post_process() litr.destroy(); } - OMNITRACE_VERBOSE(2 || get_debug_sampling(), + ROCPROFSYS_VERBOSE(2 || get_debug_sampling(), "Sampler data for thread %lu has %zu initial entries...\n", i, _raw_data.size()); - OMNITRACE_CI_THROW( + ROCPROFSYS_CI_THROW( _sampler->get_sample_count() != _raw_data.size(), "Error! sampler recorded %zu samples but %zu samples were returned\n", _sampler->get_sample_count(), _raw_data.size()); @@ -975,7 +975,7 @@ post_process() if(!_data.empty()) { - OMNITRACE_VERBOSE(2 || get_debug_sampling(), + ROCPROFSYS_VERBOSE(2 || get_debug_sampling(), "Sampler data for thread %lu has %zu valid entries...\n", i, _data.size()); @@ -987,14 +987,14 @@ post_process() } else { - OMNITRACE_VERBOSE(2 || get_debug_sampling(), + ROCPROFSYS_VERBOSE(2 || get_debug_sampling(), "Sampler data for thread %lu has zero valid entries out of " "%zu... (skipped)\n", i, _raw_data.size()); } } - OMNITRACE_VERBOSE(3 || get_debug_sampling(), + ROCPROFSYS_VERBOSE(3 || get_debug_sampling(), "Destroying samplers and allocators...\n"); get_offload_file().reset(); // remove the temporary file @@ -1013,7 +1013,7 @@ post_process() get_offload_file().reset(); } - OMNITRACE_VERBOSE(1 || get_debug_sampling(), + ROCPROFSYS_VERBOSE(1 || get_debug_sampling(), "Collected %zu samples from %zu threads... %zu samples out of %zu " "were taken while within instrumented routines\n", _total_data, _total_threads, _internal_samples.load(), @@ -1123,7 +1123,7 @@ post_process_perfetto(int64_t _tid, const std::vector& _tim if(trait::runtime_enabled::get()) { - OMNITRACE_VERBOSE(3 || get_debug_sampling(), + ROCPROFSYS_VERBOSE(3 || get_debug_sampling(), "[%li] Post-processing metrics for perfetto...\n", _tid); backtrace_metrics::init_perfetto(_tid, _valid_metrics); for(const auto& itr : _timer_data) @@ -1131,11 +1131,11 @@ post_process_perfetto(int64_t _tid, const std::vector& _tim backtrace_metrics::fini_perfetto(_tid, _valid_metrics); } - OMNITRACE_VERBOSE(3 || get_debug_sampling(), + ROCPROFSYS_VERBOSE(3 || get_debug_sampling(), "[%li] Post-processing backtraces for perfetto...\n", _tid); const auto& _thread_info = thread_info::get(_tid, SequentTID); - OMNITRACE_CI_THROW(!_thread_info, "No valid thread info for tid=%li\n", _tid); + ROCPROFSYS_CI_THROW(!_thread_info, "No valid thread info for tid=%li\n", _tid); if(!_thread_info) return; @@ -1370,7 +1370,7 @@ void post_process_timemory(int64_t _tid, const std::vector& _timer_data, const std::vector& _overflow_data) { - OMNITRACE_VERBOSE(3 || get_debug_sampling(), + ROCPROFSYS_VERBOSE(3 || get_debug_sampling(), "[%li] Post-processing data for timemory...\n", _tid); // compute the total number of entries diff --git a/source/lib/omnitrace/library/thread_info.cpp b/source/lib/omnitrace/library/thread_info.cpp index 01ebf95f..707edaa0 100644 --- a/source/lib/omnitrace/library/thread_info.cpp +++ b/source/lib/omnitrace/library/thread_info.cpp @@ -79,7 +79,7 @@ init_index_data(int64_t _tid, bool _offset = false) threading::offset_this_id(_offset); itr = thread_index_data{}; - OMNITRACE_CONDITIONAL_THROW(itr->internal_value != _tid, + ROCPROFSYS_CONDITIONAL_THROW(itr->internal_value != _tid, "Error! thread_info::init_index_data was called for " "thread %zi on thread %zi\n", _tid, itr->internal_value); @@ -89,7 +89,7 @@ init_index_data(int64_t _tid, bool _offset = false) if(get_state() >= State::Finalized && _offset) _verb += 2; if(!config::settings_are_configured()) { - OMNITRACE_BASIC_VERBOSE_F(_verb, + ROCPROFSYS_BASIC_VERBOSE_F(_verb, "Thread %li on PID %i (rank: %i) assigned " "omnitrace TID %li (internal: %li)\n", itr->system_value, process::get_id(), dmp::rank(), @@ -97,7 +97,7 @@ init_index_data(int64_t _tid, bool _offset = false) } else { - OMNITRACE_VERBOSE_F(_verb, + ROCPROFSYS_VERBOSE_F(_verb, "Thread %li on PID %i (rank: %i) assigned omnitrace TID " "%li (internal: %li)\n", itr->system_value, process::get_id(), dmp::rank(), @@ -129,7 +129,7 @@ grow_data(int64_t _tid) if(_tid >= peak_num_threads) { - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); auto_lock_t _lk{ type_mutex() }; // check again after locking @@ -234,7 +234,7 @@ thread_info::get(native_handle_t&& _tid) } } - OMNITRACE_CI_THROW(unknown_thread, "Unknown thread has been assigned a value"); + ROCPROFSYS_CI_THROW(unknown_thread, "Unknown thread has been assigned a value"); return unknown_thread; } @@ -250,7 +250,7 @@ thread_info::get(std::thread::id _tid) } } - OMNITRACE_CI_THROW(unknown_thread, "Unknown thread has been assigned a value"); + ROCPROFSYS_CI_THROW(unknown_thread, "Unknown thread has been assigned a value"); return unknown_thread; } @@ -285,16 +285,16 @@ thread_info::get(int64_t _tid, ThreadIdType _type) } else if(_type == ThreadIdType::PthreadID) { - OMNITRACE_THROW("omnitrace does not support thread_info::get(int64_t, " + ROCPROFSYS_THROW("omnitrace does not support thread_info::get(int64_t, " "ThreadIdType) with ThreadIdType::PthreadID\n"); } else if(_type == ThreadIdType::StlThreadID) { - OMNITRACE_THROW("omnitrace does not support thread_info::get(int64_t, " + ROCPROFSYS_THROW("omnitrace does not support thread_info::get(int64_t, " "ThreadIdType) with ThreadIdType::StlThreadID\n"); } - OMNITRACE_CI_THROW(unknown_thread, "Unknown thread has been assigned a value"); + ROCPROFSYS_CI_THROW(unknown_thread, "Unknown thread has been assigned a value"); return unknown_thread; } diff --git a/source/lib/omnitrace/library/tracing.cpp b/source/lib/omnitrace/library/tracing.cpp index 2b76f2a1..b9ef8091 100644 --- a/source/lib/omnitrace/library/tracing.cpp +++ b/source/lib/omnitrace/library/tracing.cpp @@ -81,8 +81,8 @@ copy_timemory_hash_ids() // copy these over so that all hashes are known auto& _hmain = tim::hash::get_main_hash_ids(); auto& _amain = tim::hash::get_main_hash_aliases(); - OMNITRACE_REQUIRE(_hmain != nullptr) << "no main timemory hash ids"; - OMNITRACE_REQUIRE(_amain != nullptr) << "no main timemory hash aliases"; + ROCPROFSYS_REQUIRE(_hmain != nullptr) << "no main timemory hash ids"; + ROCPROFSYS_REQUIRE(_amain != nullptr) << "no main timemory hash aliases"; // combine all the hash and alias info into one container for(size_t i = 0; i < thread_info::get_peak_num_threads(); ++i) @@ -159,7 +159,7 @@ thread_init() auto _tidx = (_tinfo && _tinfo->index_data) ? _tinfo->index_data->sequent_value : threading::get_id(); - OMNITRACE_REQUIRE(_tidx >= 0) + ROCPROFSYS_REQUIRE(_tidx >= 0) << "thread setup failed. thread info not initialized: " << [&_tinfo]() { if(_tinfo) return JOIN("", *_tinfo); return std::string{ "no thread_info" }; @@ -173,9 +173,9 @@ thread_init() get_timemory_hash_ids(_tidx) = tim::get_hash_ids(); get_timemory_hash_aliases(_tidx) = tim::get_hash_aliases(); - OMNITRACE_REQUIRE(get_timemory_hash_ids(_tidx) != nullptr) + ROCPROFSYS_REQUIRE(get_timemory_hash_ids(_tidx) != nullptr) << "no timemory hash ids pointer for thread " << _tidx; - OMNITRACE_REQUIRE(get_timemory_hash_aliases(_tidx) != nullptr) + ROCPROFSYS_REQUIRE(get_timemory_hash_aliases(_tidx) != nullptr) << "no timemory hash aliases pointer for thread " << _tidx; record_thread_start_time(); @@ -193,7 +193,7 @@ thread_init() auto _use_sampling = get_use_sampling(); if(_use_causal || _use_sampling) { - OMNITRACE_SCOPED_SAMPLING_ON_CHILD_THREADS(false); + ROCPROFSYS_SCOPED_SAMPLING_ON_CHILD_THREADS(false); if(_use_causal) causal::sampling::setup(); else if(_use_sampling) diff --git a/source/lib/omnitrace/library/tracing.hpp b/source/lib/omnitrace/library/tracing.hpp index 01417d3f..65f664d6 100644 --- a/source/lib/omnitrace/library/tracing.hpp +++ b/source/lib/omnitrace/library/tracing.hpp @@ -77,10 +77,10 @@ using perfetto_annotate_component_types = tim::mpl::available_t& get_perfetto_track_uuids(); @@ -166,7 +166,7 @@ get_perfetto_track(CategoryT, FuncT&& _desc_generator, Args&&... _args) _desc.set_name(_name); ::perfetto::TrackEvent::SetTrackDescriptor(_track, _desc); - OMNITRACE_VERBOSE_F(4, "[%s] Created %s(%zu) with description: \"%s\"\n", + ROCPROFSYS_VERBOSE_F(4, "[%s] Created %s(%zu) with description: \"%s\"\n", trait::name::value, demangle().c_str(), _uuid, _name.c_str()); @@ -175,9 +175,9 @@ get_perfetto_track(CategoryT, FuncT&& _desc_generator, Args&&... _args) // guard this with ppdefs in addition to runtime check to avoid // overhead of generating string during releases -#if defined(OMNITRACE_CI) && OMNITRACE_CI > 0 +#if defined(ROCPROFSYS_CI) && ROCPROFSYS_CI > 0 auto _name = std::forward(_desc_generator)(std::forward(_args)...); - OMNITRACE_CI_THROW(_track_uuids.at(_uuid) != _name, + ROCPROFSYS_CI_THROW(_track_uuids.at(_uuid) != _name, "Error! Multiple invocations of UUID %zu produced different " "descriptions: \"%s\" and \"%s\"\n", _uuid, _track_uuids.at(_uuid).c_str(), _name.c_str()); @@ -187,7 +187,7 @@ get_perfetto_track(CategoryT, FuncT&& _desc_generator, Args&&... _args) } template -OMNITRACE_INLINE auto +ROCPROFSYS_INLINE auto now() { return ::tim::get_clock_real_now(); @@ -287,7 +287,7 @@ push_timemory(CategoryT, std::string_view name, Args&&... args) if(category_push_disabled()) return; auto& _data = tracing::get_instrumentation_bundles(); - if(OMNITRACE_LIKELY(_data != nullptr)) + if(ROCPROFSYS_LIKELY(_data != nullptr)) { // this generates a hash for the raw string array auto _hash = tim::add_hash_id(name); @@ -307,15 +307,15 @@ get_timemory(CategoryT, std::string_view name) auto _hash = tim::hash::get_hash_id(name); auto& _data = tracing::get_instrumentation_bundles(); - if(OMNITRACE_UNLIKELY(_data == nullptr || _data->empty())) + if(ROCPROFSYS_UNLIKELY(_data == nullptr || _data->empty())) { - OMNITRACE_DEBUG("[%s] skipped %s :: empty bundle stack\n", "omnitrace_pop_trace", + ROCPROFSYS_DEBUG("[%s] skipped %s :: empty bundle stack\n", "omnitrace_pop_trace", name.data()); return return_type{ nullptr, -1 }; } auto*& _v_back = _data->back(); - if(OMNITRACE_LIKELY(_v_back->get_hash() == _hash)) + if(ROCPROFSYS_LIKELY(_v_back->get_hash() == _hash)) { return std::make_pair(_v_back, _data->size() - 1); } @@ -357,7 +357,7 @@ destroy_timemory(std::pair _data) if(_data.first) { auto& _bundles = tracing::get_instrumentation_bundles(); - if(OMNITRACE_LIKELY(_bundles != nullptr)) + if(ROCPROFSYS_LIKELY(_bundles != nullptr)) _bundles->destroy(_data.first, _data.second); } } diff --git a/source/lib/omnitrace/library/tracing/annotation.cpp b/source/lib/omnitrace/library/tracing/annotation.cpp index 4cbb8baf..bf6197f8 100644 --- a/source/lib/omnitrace/library/tracing/annotation.cpp +++ b/source/lib/omnitrace/library/tracing/annotation.cpp @@ -31,7 +31,7 @@ add_perfetto_annotation(perfetto_event_context_t& ctx, const omnitrace_annotation_t& _annotation) { add_perfetto_annotation( - ctx, _annotation, utility::make_index_sequence_range<1, OMNITRACE_VALUE_LAST>{}); + ctx, _annotation, utility::make_index_sequence_range<1, ROCPROFSYS_VALUE_LAST>{}); } } // namespace tracing } // namespace omnitrace diff --git a/source/lib/omnitrace/library/tracing/annotation.hpp b/source/lib/omnitrace/library/tracing/annotation.hpp index 714be668..d6321931 100644 --- a/source/lib/omnitrace/library/tracing/annotation.hpp +++ b/source/lib/omnitrace/library/tracing/annotation.hpp @@ -48,26 +48,26 @@ struct annotation_value_type; template using annotation_value_type_t = typename annotation_value_type::type; -#define OMNITRACE_DEFINE_ANNOTATION_TYPE(ENUM, TYPE) \ +#define ROCPROFSYS_DEFINE_ANNOTATION_TYPE(ENUM, TYPE) \ template <> \ struct annotation_value_type \ { \ using type = TYPE; \ }; -OMNITRACE_DEFINE_ANNOTATION_TYPE(OMNITRACE_VALUE_CSTR, const char*) -OMNITRACE_DEFINE_ANNOTATION_TYPE(OMNITRACE_VALUE_SIZE_T, size_t) -OMNITRACE_DEFINE_ANNOTATION_TYPE(OMNITRACE_VALUE_INT16, int16_t) -OMNITRACE_DEFINE_ANNOTATION_TYPE(OMNITRACE_VALUE_INT32, int32_t) -OMNITRACE_DEFINE_ANNOTATION_TYPE(OMNITRACE_VALUE_INT64, int64_t) -OMNITRACE_DEFINE_ANNOTATION_TYPE(OMNITRACE_VALUE_UINT16, uint16_t) -OMNITRACE_DEFINE_ANNOTATION_TYPE(OMNITRACE_VALUE_UINT32, uint32_t) -OMNITRACE_DEFINE_ANNOTATION_TYPE(OMNITRACE_VALUE_UINT64, uint64_t) -OMNITRACE_DEFINE_ANNOTATION_TYPE(OMNITRACE_VALUE_FLOAT32, float) -OMNITRACE_DEFINE_ANNOTATION_TYPE(OMNITRACE_VALUE_FLOAT64, double) -OMNITRACE_DEFINE_ANNOTATION_TYPE(OMNITRACE_VALUE_VOID_P, void*) +ROCPROFSYS_DEFINE_ANNOTATION_TYPE(ROCPROFSYS_VALUE_CSTR, const char*) +ROCPROFSYS_DEFINE_ANNOTATION_TYPE(ROCPROFSYS_VALUE_SIZE_T, size_t) +ROCPROFSYS_DEFINE_ANNOTATION_TYPE(ROCPROFSYS_VALUE_INT16, int16_t) +ROCPROFSYS_DEFINE_ANNOTATION_TYPE(ROCPROFSYS_VALUE_INT32, int32_t) +ROCPROFSYS_DEFINE_ANNOTATION_TYPE(ROCPROFSYS_VALUE_INT64, int64_t) +ROCPROFSYS_DEFINE_ANNOTATION_TYPE(ROCPROFSYS_VALUE_UINT16, uint16_t) +ROCPROFSYS_DEFINE_ANNOTATION_TYPE(ROCPROFSYS_VALUE_UINT32, uint32_t) +ROCPROFSYS_DEFINE_ANNOTATION_TYPE(ROCPROFSYS_VALUE_UINT64, uint64_t) +ROCPROFSYS_DEFINE_ANNOTATION_TYPE(ROCPROFSYS_VALUE_FLOAT32, float) +ROCPROFSYS_DEFINE_ANNOTATION_TYPE(ROCPROFSYS_VALUE_FLOAT64, double) +ROCPROFSYS_DEFINE_ANNOTATION_TYPE(ROCPROFSYS_VALUE_VOID_P, void*) -#undef OMNITRACE_DEFINE_ANNOTATION_TYPE +#undef ROCPROFSYS_DEFINE_ANNOTATION_TYPE template auto @@ -149,9 +149,9 @@ add_perfetto_annotation(perfetto_event_context_t& ctx, const omnitrace_annotation_t& _annotation, std::index_sequence) { - static_assert(Idx > OMNITRACE_VALUE_NONE && Idx < OMNITRACE_VALUE_LAST, + static_assert(Idx > ROCPROFSYS_VALUE_NONE && Idx < ROCPROFSYS_VALUE_LAST, "Error! index sequence should only contain values which are greater " - "than OMNITRACE_VALUE_NONE and less than OMNITRACE_VALUE_LAST"); + "than ROCPROFSYS_VALUE_NONE and less than ROCPROFSYS_VALUE_LAST"); // in some situations the user might want to short circuit by setting // the name to a null pointer, type to none, or value to a null pointer @@ -178,15 +178,15 @@ add_perfetto_annotation(perfetto_event_context_t& ctx, else { // the first "iteration": check whether annotation type has valid range - if constexpr(Idx == OMNITRACE_VALUE_NONE + 1) + if constexpr(Idx == ROCPROFSYS_VALUE_NONE + 1) { - if(!(_annotation.type > OMNITRACE_VALUE_NONE && - _annotation.type < OMNITRACE_VALUE_LAST)) + if(!(_annotation.type > ROCPROFSYS_VALUE_NONE && + _annotation.type < ROCPROFSYS_VALUE_LAST)) { - OMNITRACE_FAIL_F("Error! annotation '%s' has an invalid type designation " + ROCPROFSYS_FAIL_F("Error! annotation '%s' has an invalid type designation " "%lu which is outside of acceptable range [%i, %i]\n", _annotation.name, _annotation.type, - OMNITRACE_VALUE_NONE + 1, OMNITRACE_VALUE_LAST - 1); + ROCPROFSYS_VALUE_NONE + 1, ROCPROFSYS_VALUE_LAST - 1); } } diff --git a/source/lib/omnitrace/regions.cpp b/source/lib/omnitrace/regions.cpp index 7f2799f2..62331daf 100644 --- a/source/lib/omnitrace/regions.cpp +++ b/source/lib/omnitrace/regions.cpp @@ -43,9 +43,9 @@ invoke_category_region_start(omnitrace_category_t _category, const char* name, omnitrace_annotation_t* _annotations, size_t _annotation_count, std::index_sequence) { - static_assert(Idx > OMNITRACE_CATEGORY_NONE && Idx < OMNITRACE_CATEGORY_LAST, + static_assert(Idx > ROCPROFSYS_CATEGORY_NONE && Idx < ROCPROFSYS_CATEGORY_LAST, "Error! index sequence should only contain values which are greater " - "than OMNITRACE_CATEGORY_NONE and less than OMNITRACE_CATEGORY_LAST"); + "than ROCPROFSYS_CATEGORY_NONE and less than ROCPROFSYS_CATEGORY_LAST"); if(_category == Idx) { @@ -78,9 +78,9 @@ invoke_category_region_stop(omnitrace_category_t _category, const char* name, omnitrace_annotation_t* _annotations, size_t _annotation_count, std::index_sequence) { - static_assert(Idx > OMNITRACE_CATEGORY_NONE && Idx < OMNITRACE_CATEGORY_LAST, + static_assert(Idx > ROCPROFSYS_CATEGORY_NONE && Idx < ROCPROFSYS_CATEGORY_LAST, "Error! index sequence should only contain values which are greater " - "than OMNITRACE_CATEGORY_NONE and less than OMNITRACE_CATEGORY_LAST"); + "than ROCPROFSYS_CATEGORY_NONE and less than ROCPROFSYS_CATEGORY_LAST"); if(_category == Idx) { @@ -155,7 +155,7 @@ omnitrace_push_category_region_hidden(omnitrace_category_t _category, const char { omnitrace::impl::invoke_category_region_start( _category, name, _annotations, _annotation_count, - omnitrace::utility::make_index_sequence_range<1, OMNITRACE_CATEGORY_LAST>{}); + omnitrace::utility::make_index_sequence_range<1, ROCPROFSYS_CATEGORY_LAST>{}); } extern "C" void @@ -165,7 +165,7 @@ omnitrace_pop_category_region_hidden(omnitrace_category_t _category, const char* { omnitrace::impl::invoke_category_region_stop( _category, name, _annotations, _annotation_count, - omnitrace::utility::make_index_sequence_range<1, OMNITRACE_CATEGORY_LAST>{}); + omnitrace::utility::make_index_sequence_range<1, ROCPROFSYS_CATEGORY_LAST>{}); } #if defined(__GNUC__) && (__GNUC__ == 7) diff --git a/source/lib/omnitrace/timeout.cpp b/source/lib/omnitrace/timeout.cpp index ce95bdc0..7734500c 100644 --- a/source/lib/omnitrace/timeout.cpp +++ b/source/lib/omnitrace/timeout.cpp @@ -42,7 +42,7 @@ namespace omnitrace namespace timeout { void -setup() OMNITRACE_INTERNAL_API; +setup() ROCPROFSYS_INTERNAL_API; namespace { @@ -76,7 +76,7 @@ ci_timeout_backtrace(int) static auto _mutex = locking::atomic_mutex{}; auto _lk = locking::atomic_lock{ _mutex }; - OMNITRACE_PRINT("%s\n", _err.str().c_str()); + ROCPROFSYS_PRINT("%s\n", _err.str().c_str()); ++ci_timeout_backtrace_global_done; } @@ -88,7 +88,7 @@ ensure_ci_timeout_backtrace(double _ci_timeout_seconds, _ci_timeout_ready.set_value(); thread_info::init(true); - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Disabled); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Disabled); auto _factor = 3.0; while(_ci_timeout_seconds <= _factor) @@ -127,14 +127,14 @@ ensure_ci_timeout_backtrace(double _ci_timeout_seconds, const auto& _info = thread_info::get(_handle); if(_info) { - OMNITRACE_WARNING_F( + ROCPROFSYS_WARNING_F( 0, "pthread_kill(%zu, %i) failed for thread %zi (info: %s)\n", _handle, timeout_signal_v, _info->index_data->sequent_value, _info->as_string().c_str()); } else { - OMNITRACE_WARNING_F(0, + ROCPROFSYS_WARNING_F(0, "pthread_kill(%zu, %i) failed. executing generic " "kill(%i, %i)...\n", _handle, timeout_signal_v, process::get_id(), @@ -151,7 +151,7 @@ ensure_ci_timeout_backtrace(double _ci_timeout_seconds, }; _tids.erase(main_thread_native_handle); - OMNITRACE_WARNING_F(-127, + ROCPROFSYS_WARNING_F(-127, "timeout after %8.3f seconds... Generating backtraces for " "%zu threads...\n", _ci_timeout_seconds, _tids.size() + 1); @@ -176,7 +176,7 @@ ensure_ci_timeout_backtrace(double _ci_timeout_seconds, } } - OMNITRACE_WARNING_F(0, "timeout thread exiting...\n"); + ROCPROFSYS_WARNING_F(0, "timeout thread exiting...\n"); } } // namespace @@ -188,7 +188,7 @@ setup() if(ci_timeout_active) return; - // in CI mode, if OMNITRACE_CI_TIMEOUT or OMNITRACE_CI_TIMEOUT_OVERRIDE is + // in CI mode, if ROCPROFSYS_CI_TIMEOUT or ROCPROFSYS_CI_TIMEOUT_OVERRIDE is // set, start a thread that will print out the backtrace for each thread // before the timeout is hit (i.e. killed by CTest) so we can potentially // diagnose where the code is stuck @@ -207,8 +207,8 @@ setup() ci_timeout_active = true; _lk.unlock(); - OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal); - OMNITRACE_SCOPED_SAMPLING_ON_CHILD_THREADS(false); + ROCPROFSYS_SCOPED_THREAD_STATE(ThreadState::Internal); + ROCPROFSYS_SCOPED_SAMPLING_ON_CHILD_THREADS(false); // enable the signal handler for when the timeout is reached struct sigaction _action = {}; diff --git a/source/python/CMakeLists.txt b/source/python/CMakeLists.txt index 59fba76e..91aeec8b 100644 --- a/source/python/CMakeLists.txt +++ b/source/python/CMakeLists.txt @@ -4,8 +4,8 @@ # # ######################################################################################## -if(OMNITRACE_BUILD_STATIC_LIBSTDCXX) - # omnitrace_message(FATAL_ERROR "static libstdc++ is not compatible with python +if(ROCPROFSYS_BUILD_STATIC_LIBSTDCXX) + # rocprofsys_message(FATAL_ERROR "static libstdc++ is not compatible with python # bindings") endif() @@ -17,7 +17,7 @@ set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME python) # ######################################################################################## -function(OMNITRACE_CONFIGURE_PYTARGET _TARGET _VERSION) +function(ROCPROFSYS_CONFIGURE_PYTARGET _TARGET _VERSION) add_library(rocprofsys::${_TARGET} ALIAS ${_TARGET}) target_link_libraries(${_TARGET} PRIVATE libpyrocprofsys-interface) @@ -87,8 +87,8 @@ target_link_libraries( rocprofsys::rocprofsys-python rocprofsys::rocprofsys-python-compile-options) -omnitrace_target_compile_definitions(libpyrocprofsys-interface - INTERFACE OMNITRACE_PYBIND11_SOURCE) +rocprofsys_target_compile_definitions(libpyrocprofsys-interface + INTERFACE ROCPROFSYS_PYBIND11_SOURCE) add_custom_target(libpyrocprofsys) @@ -104,20 +104,20 @@ foreach(_IN ${PYTHON_FILES}) OPTIONAL) endforeach() -omnitrace_python_console_script("rocprof-sys-python" "rocprofsys") +rocprofsys_python_console_script("rocprof-sys-python" "rocprofsys") set(_INDEX 0) -foreach(_VERSION ${OMNITRACE_PYTHON_VERSIONS}) +foreach(_VERSION ${ROCPROFSYS_PYTHON_VERSIONS}) # add_library(libpyrocprofsys MODULE ${pysources} ${pyheaders}) - list(GET OMNITRACE_PYTHON_ROOT_DIRS ${_INDEX} Python3_ROOT_DIR) - omnitrace_pybind11_add_module( + list(GET ROCPROFSYS_PYTHON_ROOT_DIRS ${_INDEX} Python3_ROOT_DIR) + rocprofsys_pybind11_add_module( libpyrocprofsys-${_VERSION} MODULE PYTHON_VERSION ${_VERSION} VISIBILITY "hidden" ${pysources} ${pyheaders}) - omnitrace_configure_pytarget(libpyrocprofsys-${_VERSION} ${_VERSION}) + rocprofsys_configure_pytarget(libpyrocprofsys-${_VERSION} ${_VERSION}) - if(OMNITRACE_USE_PYTHON) - omnitrace_python_console_script( + if(ROCPROFSYS_USE_PYTHON) + rocprofsys_python_console_script( "rocprof-sys-python" "rocprofsys" VERSION ${_VERSION} ROOT_DIR "${Python3_ROOT_DIR}") diff --git a/source/python/cmake/ConfigPython.cmake b/source/python/cmake/ConfigPython.cmake index 82499542..b8f0b47d 100644 --- a/source/python/cmake/ConfigPython.cmake +++ b/source/python/cmake/ConfigPython.cmake @@ -61,13 +61,13 @@ foreach(_VAR FIND_STRATEGY FIND_VIRTUALENV FIND_FRAMEWORK FIND_IMPLEMENTATIONS endforeach() # display version -omnitrace_add_feature(OMNITRACE_PYTHON_VERSIONS "Python version for rocprofsys" DOC) +rocprofsys_add_feature(ROCPROFSYS_PYTHON_VERSIONS "Python version for rocprofsys" DOC) option(PYBIND11_INSTALL "Enable Pybind11 installation" OFF) -if(OMNITRACE_BUILD_PYTHON AND NOT TARGET pybind11) +if(ROCPROFSYS_BUILD_PYTHON AND NOT TARGET pybind11) # checkout PyBind11 if not checked out - omnitrace_checkout_git_submodule( + rocprofsys_checkout_git_submodule( RECURSIVE RELATIVE_PATH external/pybind11 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} @@ -78,15 +78,15 @@ if(OMNITRACE_BUILD_PYTHON AND NOT TARGET pybind11) set(CMAKE_INTERPROCEDURAL_OPTIMIZATION OFF) endif() set(PYBIND11_NOPYTHON ON) - omnitrace_save_variables(IPO VARIABLES CMAKE_INTERPROCEDURAL_OPTIMIZATION) + rocprofsys_save_variables(IPO VARIABLES CMAKE_INTERPROCEDURAL_OPTIMIZATION) add_subdirectory(${PROJECT_SOURCE_DIR}/external/pybind11) - omnitrace_restore_variables(IPO VARIABLES CMAKE_INTERPROCEDURAL_OPTIMIZATION) + rocprofsys_restore_variables(IPO VARIABLES CMAKE_INTERPROCEDURAL_OPTIMIZATION) endif() execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "import time ; print('{} {}'.format(time.ctime(), time.tzname[0]))" - OUTPUT_VARIABLE OMNITRACE_INSTALL_DATE + OUTPUT_VARIABLE ROCPROFSYS_INSTALL_DATE OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET) -string(REPLACE " " " " OMNITRACE_INSTALL_DATE "${OMNITRACE_INSTALL_DATE}") +string(REPLACE " " " " ROCPROFSYS_INSTALL_DATE "${ROCPROFSYS_INSTALL_DATE}") diff --git a/source/python/cmake/PyBind11Tools.cmake b/source/python/cmake/PyBind11Tools.cmake index b555e29a..c6040cc7 100644 --- a/source/python/cmake/PyBind11Tools.cmake +++ b/source/python/cmake/PyBind11Tools.cmake @@ -1,5 +1,5 @@ # -function(OMNITRACE_FIND_PYTHON _VAR) +function(ROCPROFSYS_FIND_PYTHON _VAR) set(options REQUIRED QUIET) set(args VERSION ROOT_DIR) set(kwargs COMPONENTS) @@ -68,13 +68,13 @@ function(OMNITRACE_FIND_PYTHON _VAR) "${_PYTHON_VERSION_LIST}" PARENT_SCOPE) else() - omnitrace_message(WARNING "${_PYTHON_ERROR_VALUE}") + rocprofsys_message(WARNING "${_PYTHON_ERROR_VALUE}") endif() endif() endfunction() # # Internal: find the appropriate link time optimization flags for this compiler -function(_OMNITRACE_PYBIND11_ADD_LTO_FLAGS target_name prefer_thin_lto) +function(_ROCPROFSYS_PYBIND11_ADD_LTO_FLAGS target_name prefer_thin_lto) # Checks whether the given CXX/linker flags can compile and link a cxx file. cxxflags # and linkerflags are lists of flags to use. The result variable is a unique variable # name for each set of flags: the compilation result will be cached base on the result @@ -141,9 +141,9 @@ function(_OMNITRACE_PYBIND11_ADD_LTO_FLAGS target_name prefer_thin_lto) endif() if(PYBIND11_LTO_CXX_FLAGS) - omnitrace_message(STATUS "${target_name} :: LTO enabled") + rocprofsys_message(STATUS "${target_name} :: LTO enabled") else() - omnitrace_message( + rocprofsys_message( STATUS "${target_name} :: LTO disabled (not supported by the compiler and/or linker)" ) @@ -162,14 +162,14 @@ function(_OMNITRACE_PYBIND11_ADD_LTO_FLAGS target_name prefer_thin_lto) endif() endfunction() # -function(OMNITRACE_PYBIND11_ADD_MODULE target_name) +function(ROCPROFSYS_PYBIND11_ADD_MODULE target_name) set(options MODULE SHARED EXCLUDE_FROM_ALL NO_EXTRAS SYSTEM THIN_LTO LTO) set(args PYTHON_VERSION VISIBILITY CXX_STANDARD) set(kwargs) cmake_parse_arguments(ARG "${options}" "${args}" "${kwargs}" ${ARGN}) if(ARG_MODULE AND ARG_SHARED) - omnitrace_message(FATAL_ERROR "Can't be both MODULE and SHARED") + rocprofsys_message(FATAL_ERROR "Can't be both MODULE and SHARED") elseif(ARG_SHARED) set(lib_type SHARED) else() @@ -261,7 +261,7 @@ function(OMNITRACE_PYBIND11_ADD_MODULE target_name) endif() if(ARG_LTO OR ARG_THIN_LTO) - _omnitrace_pybind11_add_lto_flags(${target_name} ${ARG_THIN_LTO}) + _rocprofsys_pybind11_add_lto_flags(${target_name} ${ARG_THIN_LTO}) endif() if(NOT MSVC AND NOT ${CMAKE_BUILD_TYPE} MATCHES Debug|RelWithDebInfo) diff --git a/source/python/libpyrocprofsys.cpp b/source/python/libpyrocprofsys.cpp index 05510194..bfe21176 100644 --- a/source/python/libpyrocprofsys.cpp +++ b/source/python/libpyrocprofsys.cpp @@ -53,7 +53,7 @@ #include #include -#define OMNITRACE_PYTHON_VERSION \ +#define ROCPROFSYS_PYTHON_VERSION \ ((10000 * PY_MAJOR_VERSION) + (100 * PY_MINOR_VERSION) + PY_MICRO_VERSION) namespace pyrocprofsys @@ -223,12 +223,12 @@ struct config strset_t exclude_functions = default_exclude_functions; strset_t exclude_filenames = default_exclude_filenames; std::vector records = {}; - annotations_t annotations = { note_t{ "file", OMNITRACE_STRING, nullptr }, - note_t{ "line", OMNITRACE_INT32, nullptr }, - note_t{ "lasti", OMNITRACE_INT32, nullptr }, - note_t{ "argcount", OMNITRACE_INT32, nullptr }, - note_t{ "nlocals", OMNITRACE_INT32, nullptr }, - note_t{ "stacksize", OMNITRACE_INT32, nullptr } }; + annotations_t annotations = { note_t{ "file", ROCPROFSYS_STRING, nullptr }, + note_t{ "line", ROCPROFSYS_INT32, nullptr }, + note_t{ "lasti", ROCPROFSYS_INT32, nullptr }, + note_t{ "argcount", ROCPROFSYS_INT32, nullptr }, + note_t{ "nlocals", ROCPROFSYS_INT32, nullptr }, + note_t{ "stacksize", ROCPROFSYS_INT32, nullptr } }; }; // inline config& @@ -268,7 +268,7 @@ get_config() int get_frame_lineno(PyFrameObject* frame) { -#if OMNITRACE_PYTHON_VERSION >= 31100 +#if ROCPROFSYS_PYTHON_VERSION >= 31100 return PyFrame_GetLineNumber(frame); #else return frame->f_lineno; @@ -278,7 +278,7 @@ get_frame_lineno(PyFrameObject* frame) int get_frame_lasti(PyFrameObject* frame) { -#if OMNITRACE_PYTHON_VERSION >= 31100 +#if ROCPROFSYS_PYTHON_VERSION >= 31100 return PyFrame_GetLasti(frame); #else return frame->f_lasti; @@ -288,7 +288,7 @@ get_frame_lasti(PyFrameObject* frame) auto get_frame_code(PyFrameObject* frame) { -#if OMNITRACE_PYTHON_VERSION >= 31100 +#if ROCPROFSYS_PYTHON_VERSION >= 31100 return PyFrame_GetCode(frame); #else return frame->f_code; @@ -514,12 +514,12 @@ profiler_function(py::object pframe, const char* swhat, py::object arg) } _config.records.emplace_back([&_label_ref, _annotate]() { - omnitrace_pop_category_region(OMNITRACE_CATEGORY_PYTHON, _label_ref.c_str(), + omnitrace_pop_category_region(ROCPROFSYS_CATEGORY_PYTHON, _label_ref.c_str(), (_annotate) ? _config.annotations.data() : nullptr, _config.annotations.size()); }); - omnitrace_push_category_region(OMNITRACE_CATEGORY_PYTHON, _label_ref.c_str(), + omnitrace_push_category_region(ROCPROFSYS_CATEGORY_PYTHON, _label_ref.c_str(), (_annotate) ? _config.annotations.data() : nullptr, _config.annotations.size()); }; diff --git a/source/python/rocprofsys/__main__.py b/source/python/rocprofsys/__main__.py index 2001a082..3dc677eb 100644 --- a/source/python/rocprofsys/__main__.py +++ b/source/python/rocprofsys/__main__.py @@ -40,7 +40,7 @@ import traceback PY3 = sys.version_info[0] == 3 -_OMNITRACE_PYTHON_SCRIPT_FILE = None +_ROCPROFSYS_PYTHON_SCRIPT_FILE = None # Python 3.x compatibility utils: execfile try: @@ -104,7 +104,7 @@ def str2bool(v): parser = argparse.ArgumentParser( "rocprofsys", add_help=True, - epilog="usage: {} -m rocprofsys --