Use gersemi for CMake formatting (#257)

* Replace `cmake-format` with `gersemi`

Signed-off-by: David Galiffi <David.Galiffi@amd.com>

* Remove .cmake-format.yaml

Signed-off-by: David Galiffi <David.Galiffi@amd.com>

* Update workflow to use gersemi

Signed-off-by: David Galiffi <David.Galiffi@amd.com>

* Update CONTRIBUTING.md

* Update helper scripts

* Don't include `*/external/*` in workflows

---------

Signed-off-by: David Galiffi <David.Galiffi@amd.com>

[ROCm/rocprofiler-systems commit: 122623a929]
Этот коммит содержится в:
David Galiffi
2025-06-22 10:44:33 -04:00
коммит произвёл GitHub
родитель 0403aaa97f
Коммит 8fcf3a50b0
106 изменённых файлов: 5116 добавлений и 3156 удалений
-305
Просмотреть файл
@@ -1,305 +0,0 @@
parse:
additional_commands:
rocprofiler_systems_checkout_git_submodule:
flags:
- RECURSIVE
kwargs:
RELATIVE_PATH: '*'
WORKING_DIRECTORY: '*'
TEST_FILE: '*'
REPO_URL: '*'
REPO_BRANCH: '*'
ADDITIONAL_COMMANDS: '*'
rocprofiler_systems_save_variables:
kwargs:
VARIABLES: '*'
CONDITION: '*'
rocprofiler_systems_restore_variables:
kwargs:
VARIABLES: '*'
CONDITION: '*'
rocprofiler_systems_add_test:
flags:
- SKIP_BASELINE
- SKIP_SAMPLING
- SKIP_REWRITE
- SKIP_RUNTIME
kwargs:
NAME: '*'
TARGET: '*'
MPI: '*'
GPU: '*'
NUM_PROCS: '*'
REWRITE_TIMEOUT: '*'
RUNTIME_TIMEOUT: '*'
SAMPLING_TIMEOUT: '*'
SAMPLING_ARGS: '*'
REWRITE_ARGS: '*'
RUNTIME_ARGS: '*'
RUN_ARGS: '*'
ENVIRONMENT: '*'
LABELS: '*'
PROPERTIES: '*'
SAMPLING_PASS_REGEX: '*'
SAMPLING_FAIL_REGEX: '*'
RUNTIME_PASS_REGEX: '*'
RUNTIME_FAIL_REGEX: '*'
REWRITE_PASS_REGEX: '*'
REWRITE_FAIL_REGEX: '*'
BASELINE_PASS_REGEX: '*'
BASELINE_FAIL_REGEX: '*'
REWRITE_RUN_PASS_REGEX: '*'
REWRITE_RUN_FAIL_REGEX: '*'
rocprofiler_systems_add_causal_test:
flags:
- SKIP_BASELINE
kwargs:
NAME: '*'
TARGET: '*'
CAUSAL_TIMEOUT: '*'
CAUSAL_VALIDATE_TIMEOUT: '*'
CAUSAL_MODE: '*'
CAUSAL_ARGS: '*'
CAUSAL_VALIDATE_ARGS: '*'
RUNTIME_ARGS: '*'
RUN_ARGS: '*'
ENVIRONMENT: '*'
LABELS: '*'
PROPERTIES: '*'
CAUSAL_PASS_REGEX: '*'
CAUSAL_FAIL_REGEX: '*'
BASELINE_PASS_REGEX: '*'
BASELINE_FAIL_REGEX: '*'
CAUSAL_VALIDATE_PASS_REGEX: '*'
CAUSAL_VALIDATE_FAIL_REGEX: '*'
rocprofiler_systems_target_compile_definitions:
kwargs:
PUBLIC: '*'
PRIVATE: '*'
INTERFACE: '*'
rocprofiler_systems_add_bin_test:
flags:
- WILL_FAIL
kwargs:
NAME: '*'
ARGS: '*'
LABELS: '*'
TARGET: '*'
DEPENDS: '*'
COMMAND: '*'
TIMEOUT: '*'
PROPERTIES: '*'
ENVIRONMENT: '*'
WORKING_DIRECTORY: '*'
PASS_REGEX: '*'
FAIL_REGEX: '*'
SKIP_REGEX: '*'
rocprofiler_systems_add_python_test:
flags:
- STANDALONE
kwargs:
NAME: '*'
FILE: '*'
TIMEOUT: '*'
PROFILE_ARGS: '*'
RUN_ARGS: '*'
ENVIRONMENT: '*'
LABELS: '*'
DEPENDS: '*'
COMMAND: '*'
PROPERTIES: '*'
PYTHON_EXECUTABLE: '*'
PYTHON_VERSION: '*'
PASS_REGEX: '*'
FAIL_REGEX: '*'
SKIP_REGEX: '*'
rocprofiler_systems_add_python_validation_test:
kwargs:
NAME: '*'
ARGS: '*'
PERFETTO_FILE: '*'
PERFETTO_METRIC: '*'
TIMEMORY_FILE: '*'
TIMEMORY_METRIC: '*'
rocm_version_message:
flags:
- STATUS
- WARNING
- SEND_ERROR
- FATAL_ERROR
- AUTHOR_WARNING
rocprofiler_systems_find_python:
flags:
- REQUIRED
- QUIET
kwargs:
VERSION: '*'
ROOT_DIR: '*'
COMPONENTS: '*'
rocprofiler_systems_python_console_script:
kwargs:
VERSION: '*'
ROOT_DIR: '*'
rocprofiler_systems_pybind11_add_module:
flags:
- MODULE
- SHARED
- EXCLUDE_FROM_ALL
- NO_EXTRAS
- SYSTEM
- THIN_LTO
- LTO
kwargs:
PYTHON_VERSION: '*'
CXX_STANDARD: '*'
VISIBILITY: '*'
rocprofiler_systems_directory:
flags:
- MKDIR
- FAIL
kwargs:
PREFIX: '*'
OUTPUT_VARIABLE: '*'
WORKING_DIRECTORY: '*'
PATHS: '*'
rocprofiler_systems_check_python_dirs_and_versions:
flags:
- UNSET
- FAIL
kwargs:
RESULT_VARIABLE: '*'
OUTPUT_VARIABLE: '*'
rocprofiler_systems_find_static_library:
flags:
- NO_CACHE
- REQUIRED
- NO_DEFAULT_PATH
- NO_PACKAGE_ROOT_PATH
- NO_CMAKE_PATH
- NO_CMAKE_ENVIRONMENT_PATH
- NO_SYSTEM_ENVIRONMENT_PATH
- CMAKE_FIND_ROOT_PATH_BOTH
- ONLY_CMAKE_FIND_ROOT_PATH
- NO_CMAKE_FIND_ROOT_PATH
kwargs:
NAMES: '*'
NAMES_PER_DIR: '*'
HINTS: '*'
PATHS: '*'
PATH_SUFFIXES: '*'
DOC: '*'
rocprofiler_systems_find_shared_library:
flags:
- NO_CACHE
- REQUIRED
- NO_DEFAULT_PATH
- NO_PACKAGE_ROOT_PATH
- NO_CMAKE_PATH
- NO_CMAKE_ENVIRONMENT_PATH
- NO_SYSTEM_ENVIRONMENT_PATH
- CMAKE_FIND_ROOT_PATH_BOTH
- ONLY_CMAKE_FIND_ROOT_PATH
- NO_CMAKE_FIND_ROOT_PATH
kwargs:
NAMES: '*'
NAMES_PER_DIR: '*'
HINTS: '*'
PATHS: '*'
PATH_SUFFIXES: '*'
DOC: '*'
rocprofiler_systems_causal_example_executable:
kwargs:
TAG: '*'
SOURCES: '*'
DEFINITIONS: '*'
LINK_LIBRARIES: '*'
INCLUDE_DIRECTORIES: '*'
rocprofiler_systems_add_validation_test:
kwargs:
NAME: '*'
ARGS: '*'
LABELS: '*'
TIMEOUT: '*'
DEPENDS: '*'
PROPERTIES: '*'
PASS_REGEX: '*'
FAIL_REGEX: '*'
SKIP_REGEX: '*'
ENVIRONMENT: '*'
PERFETTO_FILE: '*'
PERFETTO_METRIC: '*'
TIMEMORY_FILE: '*'
TIMEMORY_METRIC: '*'
EXIST_FILES: '*'
rocprofiler_systems_custom_compilation:
flags:
- GLOBAL
- PROJECT
kwargs:
COMPILER: '*'
DIRECTORY: '*'
TARGET: '*'
SOURCE: '*'
override_spec: {}
vartags: []
proptags: []
format:
disable: false
line_width: 90
tab_size: 4
use_tabchars: false
fractional_tab_policy: use-space
max_subgroups_hwrap: 2
max_pargs_hwrap: 8
max_rows_cmdline: 2
separate_ctrl_name_with_space: false
separate_fn_name_with_space: false
dangle_parens: false
dangle_align: child
min_prefix_chars: 4
max_prefix_chars: 10
max_lines_hwrap: 2
line_ending: unix
command_case: lower
keyword_case: upper
always_wrap: []
enable_sort: true
autosort: false
require_valid_layout: false
layout_passes: {}
markup:
bullet_char: '*'
enum_char: .
first_comment_is_literal: true
literal_comment_pattern: ^#
fence_pattern: ^\s*([`~]{3}[`~]*)(.*)$
ruler_pattern: ^\s*[^\w\s]{3}.*[^\w\s]{3}$
explicit_trailing_pattern: '#<'
hashruler_min_length: 10
canonicalize_hashrulers: true
enable_markup: true
lint:
disabled_codes: []
function_pattern: '[0-9a-z_]+'
macro_pattern: '[0-9A-Z_]+'
global_var_pattern: '[A-Z][0-9A-Z_]+'
internal_var_pattern: _[A-Z][0-9A-Z_]+
local_var_pattern: '[a-z][a-z0-9_]+'
private_var_pattern: _[0-9a-z_]+
public_var_pattern: '[A-Z][0-9A-Z_]+'
argument_var_pattern: '[a-z][a-z0-9_]+'
keyword_pattern: '[A-Z][0-9A-Z_]+'
max_conditionals_custom_parser: 2
min_statement_spacing: 1
max_statement_spacing: 2
max_returns: 6
max_branches: 12
max_arguments: 5
max_localvars: 15
max_statements: 50
encode:
emit_byteorder_mark: false
input_encoding: utf-8
output_encoding: utf-8
misc:
per_command: {}
+5
Просмотреть файл
@@ -0,0 +1,5 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/BlankSpruce/gersemi/0.19.3/gersemi/configuration.schema.json
warn_about_unknown_commands: false
indent: 4
line_length: 90
+5 -5
Просмотреть файл
@@ -40,7 +40,7 @@ jobs:
black --diff --check .
cmake:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
@@ -48,13 +48,13 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -y python3-pip
python3 -m pip install cmake-format
- name: cmake-format
python3 -m pip install gersemi
- name: gersemi
run: |
set +e
cmake-format -i $(find . -type f | egrep 'CMakeLists.txt|\.cmake$')
gersemi -i $(find . -type f ! -path '*/external/*' | grep -E 'CMakeLists.txt|\.cmake$')
if [ $(git diff | wc -l) -gt 0 ]; then
echo -e "\nError! CMake code not formatted. Run cmake-format...\n"
echo -e "\nError! CMake code not formatted. Run gersemi ...\n"
echo -e "\nFiles:\n"
git diff --name-only
echo -e "\nFull diff:\n"
+3 -6
Просмотреть файл
@@ -40,13 +40,10 @@ repos:
- id: clang-format
files: \.(c|cpp|h.*)$
- repo: local
- repo: https://github.com/BlankSpruce/gersemi
rev: 0.19.3
hooks:
- id: check-cmake
name: cmake-format
entry: ./scripts/check-cmake-format.sh
language: script
files: (^|/)(CMakeLists\.txt|.*\.cmake)$
- id: gersemi
- repo: local
hooks:
+140 -96
Просмотреть файл
@@ -1,7 +1,9 @@
cmake_minimum_required(VERSION 3.18.4 FATAL_ERROR)
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND CMAKE_CURRENT_SOURCE_DIR STREQUAL
CMAKE_SOURCE_DIR)
if(
CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR
AND CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR
)
set(MSG "")
message(STATUS "Warning! Building from the source directory is not recommended")
message(STATUS "If unintented, please remove 'CMakeCache.txt' and 'CMakeFiles'")
@@ -17,21 +19,27 @@ endif()
if(NOT UNIX OR APPLE)
message(
AUTHOR_WARNING
"rocprofiler-systems only supports Linux. Configure and/or build is likely to fail"
)
"rocprofiler-systems only supports Linux. Configure and/or build is likely to fail"
)
endif()
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/VERSION" FULL_VERSION_STRING LIMIT_COUNT 1)
string(REGEX REPLACE "(\n|\r)" "" FULL_VERSION_STRING "${FULL_VERSION_STRING}")
string(REGEX REPLACE "([0-9]+)\.([0-9]+)\.([0-9]+)(.*)" "\\1.\\2.\\3" ROCPROFSYS_VERSION
"${FULL_VERSION_STRING}")
string(
REGEX REPLACE
"([0-9]+)\.([0-9]+)\.([0-9]+)(.*)"
"\\1.\\2.\\3"
ROCPROFSYS_VERSION
"${FULL_VERSION_STRING}"
)
project(
rocprofiler-systems
LANGUAGES C CXX
VERSION ${ROCPROFSYS_VERSION}
DESCRIPTION "CPU/GPU Application tracing with static/dynamic binary instrumentation"
HOMEPAGE_URL "https://github.com/ROCm/rocprofiler-systems")
HOMEPAGE_URL "https://github.com/ROCm/rocprofiler-systems"
)
set(PROJECT_NAME_UNDERSCORED "rocprofiler_systems")
set(BINARY_NAME_PREFIX "rocprof-sys")
@@ -44,19 +52,23 @@ if(Git_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
OUTPUT_VARIABLE ROCPROFSYS_GIT_DESCRIBE
OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE _GIT_DESCRIBE_RESULT
ERROR_QUIET)
ERROR_QUIET
)
if(NOT _GIT_DESCRIBE_RESULT EQUAL 0)
execute_process(
COMMAND ${GIT_EXECUTABLE} describe
OUTPUT_VARIABLE ROCPROFSYS_GIT_DESCRIBE
OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE _GIT_DESCRIBE_RESULT
ERROR_QUIET)
ERROR_QUIET
)
endif()
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
OUTPUT_VARIABLE ROCPROFSYS_GIT_REVISION
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
else()
set(ROCPROFSYS_GIT_DESCRIBE "v${ROCPROFSYS_VERSION}")
set(ROCPROFSYS_GIT_REVISION "")
@@ -64,38 +76,34 @@ endif()
message(
STATUS
"[${PROJECT_NAME}] version ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH} (${FULL_VERSION_STRING})"
)
"[${PROJECT_NAME}] version ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH} (${FULL_VERSION_STRING})"
)
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
ON
CACHE BOOL "Build shared libraries")
set(BUILD_STATIC_LIBS
OFF
CACHE BOOL "Build static libraries")
set(CMAKE_POSITION_INDEPENDENT_CODE
ON
CACHE BOOL "Build position independent code")
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 ON CACHE BOOL "Build shared libraries")
set(BUILD_STATIC_LIBS OFF CACHE BOOL "Build static libraries")
set(CMAKE_POSITION_INDEPENDENT_CODE ON CACHE BOOL "Build position independent code")
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.24)
cmake_policy(SET CMP0135 NEW)
endif()
if("${CMAKE_BUILD_TYPE}" STREQUAL "")
set(CMAKE_BUILD_TYPE
Release
CACHE STRING "Build type" FORCE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
else()
set(VALID_BUILD_TYPES "Release" "RelWithDebInfo" "Debug" "MinSizeRel")
if(NOT "${CMAKE_BUILD_TYPE}" IN_LIST VALID_BUILD_TYPES)
string(REPLACE ";" ", " _VALID_BUILD_TYPES "${VALID_BUILD_TYPES}")
message(
FATAL_ERROR
"Invalid CMAKE_BUILD_TYPE :: ${CMAKE_BUILD_TYPE}. Valid build types are: ${_VALID_BUILD_TYPES}"
)
"Invalid CMAKE_BUILD_TYPE :: ${CMAKE_BUILD_TYPE}. Valid build types are: ${_VALID_BUILD_TYPES}"
)
endif()
endif()
set(_STRIP_LIBRARIES_DEFAULT OFF)
@@ -110,7 +118,10 @@ if(DEFINED CMAKE_INSTALL_LIBDIR AND NOT DEFINED CMAKE_DEFAULT_INSTALL_LIBDIR)
# force this because dyninst always installs to lib
set(CMAKE_DEFAULT_INSTALL_LIBDIR
"${CMAKE_INSTALL_LIBDIR}"
CACHE STRING "Object code libraries" FORCE)
CACHE STRING
"Object code libraries"
FORCE
)
endif()
if(NOT "$ENV{ROCPROFSYS_CI}" STREQUAL "")
@@ -124,78 +135,92 @@ include(MacroUtilities) # various functions and macros
if(CI_BUILD)
rocprofiler_systems_add_option(ROCPROFSYS_BUILD_CI "Enable internal asserts, etc." ON
ADVANCED NO_FEATURE)
ADVANCED NO_FEATURE
)
rocprofiler_systems_add_option(ROCPROFSYS_BUILD_TESTING
"Enable building the testing suite" ON ADVANCED)
"Enable building the testing suite" ON ADVANCED
)
rocprofiler_systems_add_option(
ROCPROFSYS_BUILD_DEBUG "Enable building with extensive debug symbols" OFF
ADVANCED)
ADVANCED
)
rocprofiler_systems_add_option(
ROCPROFSYS_BUILD_HIDDEN_VISIBILITY
"Build with hidden visibility (disable for Debug builds)" OFF ADVANCED)
"Build with hidden visibility (disable for Debug builds)" OFF ADVANCED
)
rocprofiler_systems_add_option(ROCPROFSYS_STRIP_LIBRARIES "Strip the libraries" OFF
ADVANCED)
ADVANCED
)
else()
rocprofiler_systems_add_option(ROCPROFSYS_BUILD_CI "Enable internal asserts, etc."
OFF ADVANCED NO_FEATURE)
OFF ADVANCED NO_FEATURE
)
rocprofiler_systems_add_option(ROCPROFSYS_BUILD_EXAMPLES
"Enable building the examples" OFF ADVANCED)
"Enable building the examples" OFF ADVANCED
)
rocprofiler_systems_add_option(ROCPROFSYS_BUILD_TESTING
"Enable building the testing suite" OFF ADVANCED)
"Enable building the testing suite" OFF ADVANCED
)
rocprofiler_systems_add_option(
ROCPROFSYS_BUILD_DEBUG "Enable building with extensive debug symbols" OFF
ADVANCED)
ADVANCED
)
rocprofiler_systems_add_option(
ROCPROFSYS_BUILD_HIDDEN_VISIBILITY
"Build with hidden visibility (disable for Debug builds)" ON ADVANCED)
"Build with hidden visibility (disable for Debug builds)" ON ADVANCED
)
rocprofiler_systems_add_option(ROCPROFSYS_STRIP_LIBRARIES "Strip the libraries"
${_STRIP_LIBRARIES_DEFAULT} ADVANCED)
${_STRIP_LIBRARIES_DEFAULT} ADVANCED
)
endif()
include(Compilers) # compiler identification
include(BuildSettings) # compiler flags
set(CMAKE_INSTALL_LIBDIR
"lib"
CACHE STRING "Object code libraries (lib)" FORCE)
set(CMAKE_CXX_STANDARD
17
CACHE STRING "CXX language standard")
set(CMAKE_INSTALL_LIBDIR "lib" CACHE STRING "Object code libraries (lib)" FORCE)
set(CMAKE_CXX_STANDARD 17 CACHE STRING "CXX language standard")
rocprofiler_systems_add_feature(CMAKE_BUILD_TYPE "Build optimization level")
rocprofiler_systems_add_feature(CMAKE_INSTALL_PREFIX "Installation prefix")
rocprofiler_systems_add_feature(CMAKE_CXX_COMPILER "C++ compiler")
rocprofiler_systems_add_feature(CMAKE_CXX_STANDARD "CXX language standard")
rocprofiler_systems_add_option(CMAKE_CXX_STANDARD_REQUIRED
"Require C++ language standard" ON)
"Require C++ language standard" ON
)
rocprofiler_systems_add_option(CMAKE_CXX_EXTENSIONS
"Compiler specific language extensions" OFF)
"Compiler specific language extensions" OFF
)
rocprofiler_systems_add_option(CMAKE_INSTALL_RPATH_USE_LINK_PATH
"Enable rpath to linked libraries" ON)
set(CMAKE_INSTALL_MESSAGE
"LAZY"
CACHE STRING "Installation message")
"Enable rpath to linked libraries" ON
)
set(CMAKE_INSTALL_MESSAGE "LAZY" CACHE STRING "Installation message")
mark_as_advanced(CMAKE_INSTALL_MESSAGE)
rocprofiler_systems_add_option(ROCPROFSYS_USE_CLANG_TIDY "Enable clang-tidy" OFF)
rocprofiler_systems_add_option(ROCPROFSYS_USE_BFD
"Enable BFD support (map call-stack samples to LOC)" ON)
"Enable BFD support (map call-stack samples to LOC)" ON
)
rocprofiler_systems_add_option(ROCPROFSYS_USE_MPI "Enable MPI support" OFF)
rocprofiler_systems_add_option(ROCPROFSYS_USE_ROCM "Enable ROCm support" ON)
rocprofiler_systems_add_option(ROCPROFSYS_USE_PAPI "Enable HW counter support via PAPI"
ON)
ON
)
rocprofiler_systems_add_option(
ROCPROFSYS_USE_MPI_HEADERS
"Enable wrapping MPI functions w/o enabling MPI dependency" ON)
"Enable wrapping MPI functions w/o enabling MPI dependency" ON
)
rocprofiler_systems_add_option(ROCPROFSYS_USE_OMPT "Enable OpenMP tools support" ON)
rocprofiler_systems_add_option(ROCPROFSYS_USE_PYTHON "Enable Python support" OFF)
rocprofiler_systems_add_option(ROCPROFSYS_BUILD_DYNINST "Build dyninst from submodule"
OFF)
OFF
)
rocprofiler_systems_add_option(ROCPROFSYS_BUILD_LIBUNWIND
"Build libunwind from submodule" ON)
"Build libunwind from submodule" ON
)
rocprofiler_systems_add_option(ROCPROFSYS_BUILD_CODECOV "Build for code coverage" OFF)
rocprofiler_systems_add_option(ROCPROFSYS_INSTALL_PERFETTO_TOOLS
"Install perfetto tools (i.e. traced, perfetto, etc.)" OFF)
"Install perfetto tools (i.e. traced, perfetto, etc.)" OFF
)
if(ROCPROFSYS_USE_PAPI)
rocprofiler_systems_add_option(ROCPROFSYS_BUILD_PAPI "Build PAPI from submodule" ON)
@@ -203,24 +228,24 @@ endif()
if(ROCPROFSYS_USE_PYTHON)
rocprofiler_systems_add_option(ROCPROFSYS_BUILD_PYTHON
"Build python bindings with internal pybind11" ON)
"Build python bindings with internal pybind11" ON
)
elseif("$ENV{ROCPROFSYS_CI}")
# quiet warnings in dashboard
if(ROCPROFSYS_PYTHON_ENVS OR ROCPROFSYS_PYTHON_PREFIX)
rocprofiler_systems_message(
STATUS
"Ignoring values of ROCPROFSYS_PYTHON_ENVS and/or ROCPROFSYS_PYTHON_PREFIX")
"Ignoring values of ROCPROFSYS_PYTHON_ENVS and/or ROCPROFSYS_PYTHON_PREFIX"
)
endif()
endif()
if(ROCPROFSYS_BUILD_TESTING)
set(ROCPROFSYS_BUILD_EXAMPLES
ON
CACHE BOOL "Enable building the examples" FORCE)
set(ROCPROFSYS_BUILD_EXAMPLES ON CACHE BOOL "Enable building the examples" FORCE)
endif()
include(ProcessorCount)
processorcount(ROCPROFSYS_PROCESSOR_COUNT)
ProcessorCount(ROCPROFSYS_PROCESSOR_COUNT)
if(ROCPROFSYS_PROCESSOR_COUNT LESS 8)
set(ROCPROFSYS_THREAD_COUNT 128)
@@ -236,14 +261,13 @@ endif()
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"
)
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"
)
rocprofiler_systems_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 "${ROCPROFSYS_MAX_THREADS}")
@@ -251,35 +275,40 @@ if(_MAX_THREADS GREATER 0 AND NOT ROCPROFSYS_MAX_THREADS EQUAL _MAX_THREADS)
rocprofiler_systems_message(
FATAL_ERROR
"Error! ROCPROFSYS_MAX_THREADS must be a power of 2. Recommendation: ${_MAX_THREADS}"
)
)
elseif(NOT ROCPROFSYS_MAX_THREADS EQUAL _MAX_THREADS)
rocprofiler_systems_message(
AUTHOR_WARNING
"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(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"
)
CACHE STRING
"Maximum call-stack depth to search during call-stack unwinding. Decreasing this value will result in sampling consuming less memory"
)
rocprofiler_systems_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"
)
)
# default visibility settings
set(CMAKE_C_VISIBILITY_PRESET
"default"
CACHE STRING "Visibility preset for non-inline C functions")
CACHE STRING
"Visibility preset for non-inline C functions"
)
set(CMAKE_CXX_VISIBILITY_PRESET
"default"
CACHE STRING "Visibility preset for non-inline C++ functions/objects")
CACHE STRING
"Visibility preset for non-inline C++ functions/objects"
)
set(CMAKE_VISIBILITY_INLINES_HIDDEN
OFF
CACHE BOOL "Visibility preset for inline functions")
CACHE BOOL
"Visibility preset for inline functions"
)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
include(Formatting) # format target
@@ -309,20 +338,22 @@ set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME core)
if(ROCPROFSYS_BUILD_CODECOV)
rocprofiler_systems_save_variables(CODECOV_FLAGS VARIABLES CMAKE_C_FLAGS
CMAKE_CXX_FLAGS)
CMAKE_CXX_FLAGS
)
foreach(_BUILD_TYPE DEBUG MINSIZEREL RELWITHDEBINFO RELEASE)
rocprofiler_systems_save_variables(
CODECOV_FLAGS VARIABLES CMAKE_C_FLAGS_${_BUILD_TYPE}
CMAKE_CXX_FLAGS_${_BUILD_TYPE})
CMAKE_CXX_FLAGS_${_BUILD_TYPE}
)
endforeach()
foreach(_BUILD_TYPE DEBUG MINSIZEREL RELWITHDEBINFO RELEASE)
set(CMAKE_C_FLAGS_${_BUILD_TYPE}
"-Og -g3 -fno-omit-frame-pointer -fprofile-abs-path -fprofile-arcs -ftest-coverage"
)
)
set(CMAKE_CXX_FLAGS_${_BUILD_TYPE}
"-Og -g3 -fno-omit-frame-pointer -fprofile-abs-path -fprofile-arcs -ftest-coverage"
)
)
endforeach()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage")
@@ -333,12 +364,14 @@ add_subdirectory(source)
if(ROCPROFSYS_BUILD_CODECOV)
rocprofiler_systems_restore_variables(CODECOV_FLAGS VARIABLES CMAKE_C_FLAGS
CMAKE_CXX_FLAGS)
CMAKE_CXX_FLAGS
)
foreach(_BUILD_TYPE DEBUG MINSIZEREL RELWITHDEBINFO RELEASE)
rocprofiler_systems_restore_variables(
CODECOV_FLAGS VARIABLES CMAKE_C_FLAGS_${_BUILD_TYPE}
CMAKE_CXX_FLAGS_${_BUILD_TYPE})
CMAKE_CXX_FLAGS_${_BUILD_TYPE}
)
endforeach()
endif()
@@ -351,49 +384,60 @@ endif()
configure_file(
${PROJECT_SOURCE_DIR}/LICENSE
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/doc/${PROJECT_NAME}/LICENSE
COPYONLY)
COPYONLY
)
configure_file(
${PROJECT_SOURCE_DIR}/perfetto.cfg
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/perfetto.cfg
COPYONLY)
COPYONLY
)
configure_file(
${PROJECT_SOURCE_DIR}/cmake/Templates/setup-env.sh.in
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/setup-env.sh @ONLY)
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/setup-env.sh
@ONLY
)
configure_file(
${PROJECT_SOURCE_DIR}/cmake/Templates/modulefile.in
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/modulefiles/${PROJECT_NAME}/${ROCPROFSYS_VERSION}
@ONLY)
@ONLY
)
configure_file(
${PROJECT_SOURCE_DIR}/scripts/merge-multiprocess-output.sh
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBEXECDIR}/${PROJECT_NAME}/rocprof-sys-merge-output.sh
COPYONLY)
COPYONLY
)
install(
FILES ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/setup-env.sh
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/perfetto.cfg
FILES
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/setup-env.sh
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/perfetto.cfg
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}
COMPONENT setup)
COMPONENT setup
)
install(
FILES
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/modulefiles/${PROJECT_NAME}/${ROCPROFSYS_VERSION}
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/modulefiles/${PROJECT_NAME}
COMPONENT setup)
COMPONENT setup
)
install(
FILES ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/doc/${PROJECT_NAME}/LICENSE
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/doc/${PROJECT_NAME}
COMPONENT setup)
COMPONENT setup
)
install(
PROGRAMS
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBEXECDIR}/${PROJECT_NAME}/rocprof-sys-merge-output.sh
DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/${PROJECT_NAME}
COMPONENT setup)
COMPONENT setup
)
# ------------------------------------------------------------------------------#
#
+2 -2
Просмотреть файл
@@ -51,7 +51,7 @@ By creating a pull request, you agree to the statements made in the [code licens
* Fork the repository and create your branch from `amd-staging`.
* If you've added code that should be tested, add tests.
* Ensure the test suite passes.
* Make sure your code conforms to the format. Use clang-format-18 and/or cmake-format.
* Make sure your code conforms to the format. Use clang-format-18 and/or gersemi.
* Use clear and descriptive commit messages.
* Submit your PR and work with the reviewer or maintainer to get your PR approved
* Once approved, the PR is brought onto internal CI systems and may be merged into the component during our release cycle, as coordinated by the maintainer.
@@ -77,7 +77,7 @@ By creating a pull request, you agree to the statements made in the [code licens
* Adhere to the coding style used in the project. This includes naming conventions, indentation, and commenting practices.
* Follow the existing directory structure and organization of the codebase.
* Group related files together and maintain a logical hierarchy.
* Use `clang-format-18` and `cmake-format` formatters to ensure consistency.
* Use `clang-format-18` and `gersemi` formatters to ensure consistency.
### Using pre-commit hooks ###
+153 -85
Просмотреть файл
@@ -14,53 +14,70 @@ include(MacroUtilities)
rocprofiler_systems_add_option(
ROCPROFSYS_BUILD_DEVELOPER "Extra build flags for development like -Werror"
${ROCPROFSYS_BUILD_CI})
${ROCPROFSYS_BUILD_CI}
)
rocprofiler_systems_add_option(ROCPROFSYS_BUILD_RELEASE
"Build with minimal debug line info" OFF)
"Build with minimal debug line info" OFF
)
rocprofiler_systems_add_option(ROCPROFSYS_BUILD_EXTRA_OPTIMIZATIONS
"Extra optimization flags" OFF)
"Extra optimization flags" OFF
)
rocprofiler_systems_add_option(ROCPROFSYS_BUILD_LTO "Build with link-time optimization"
OFF)
OFF
)
rocprofiler_systems_add_option(ROCPROFSYS_USE_COMPILE_TIMING
"Build with timing metrics for compilation" OFF)
"Build with timing metrics for compilation" OFF
)
rocprofiler_systems_add_option(ROCPROFSYS_USE_SANITIZER
"Build with -fsanitze=\${ROCPROFSYS_SANITIZER_TYPE}" OFF)
"Build with -fsanitze=\${ROCPROFSYS_SANITIZER_TYPE}" OFF
)
rocprofiler_systems_add_option(ROCPROFSYS_BUILD_STATIC_LIBGCC
"Build with -static-libgcc if possible" OFF)
"Build with -static-libgcc if possible" OFF
)
rocprofiler_systems_add_option(ROCPROFSYS_BUILD_STATIC_LIBSTDCXX
"Build with -static-libstdc++ if possible" OFF)
"Build with -static-libstdc++ if possible" OFF
)
rocprofiler_systems_add_option(ROCPROFSYS_BUILD_STACK_PROTECTOR
"Build with -fstack-protector" ON)
"Build with -fstack-protector" ON
)
rocprofiler_systems_add_cache_option(
ROCPROFSYS_BUILD_LINKER
"If set to a non-empty value, pass -fuse-ld=\${ROCPROFSYS_BUILD_LINKER}" STRING "bfd")
"If set to a non-empty value, pass -fuse-ld=\${ROCPROFSYS_BUILD_LINKER}" STRING "bfd"
)
rocprofiler_systems_add_cache_option(ROCPROFSYS_BUILD_NUMBER "Internal CI use" STRING "0"
ADVANCED NO_FEATURE)
ADVANCED NO_FEATURE
)
rocprofiler_systems_add_interface_library(rocprofiler-systems-static-libgcc
"Link to static version of libgcc")
"Link to static version of libgcc"
)
rocprofiler_systems_add_interface_library(rocprofiler-systems-static-libstdcxx
"Link to static version of libstdc++")
"Link to static version of libstdc++"
)
rocprofiler_systems_add_interface_library(rocprofiler-systems-static-libgcc-optional
"Link to static version of libgcc")
"Link to static version of libgcc"
)
rocprofiler_systems_add_interface_library(rocprofiler-systems-static-libstdcxx-optional
"Link to static version of libstdc++")
"Link to static version of libstdc++"
)
target_compile_definitions(rocprofiler-systems-compile-options
INTERFACE $<$<CONFIG:DEBUG>:DEBUG>)
target_compile_definitions(
rocprofiler-systems-compile-options
INTERFACE $<$<CONFIG:DEBUG>:DEBUG>
)
set(ROCPROFSYS_SANITIZER_TYPE
"leak"
CACHE STRING "Sanitizer type")
set(ROCPROFSYS_SANITIZER_TYPE "leak" CACHE STRING "Sanitizer type")
if(ROCPROFSYS_USE_SANITIZER)
rocprofiler_systems_add_feature(
ROCPROFSYS_SANITIZER_TYPE
"Sanitizer type, e.g. leak, thread, address, memory, etc.")
"Sanitizer type, e.g. leak, thread, address, memory, etc."
)
endif()
if(ROCPROFSYS_BUILD_CI)
rocprofiler_systems_target_compile_definitions(${LIBNAME}-compile-options
INTERFACE ROCPROFSYS_CI)
INTERFACE ROCPROFSYS_CI
)
endif()
# ----------------------------------------------------------------------------------------#
@@ -68,9 +85,7 @@ endif()
#
if(CMAKE_DL_LIBS AND NOT "${CMAKE_DL_LIBS}" STREQUAL "dl")
# if cmake provides dl library, use that
set(dl_LIBRARY
${CMAKE_DL_LIBS}
CACHE FILEPATH "dynamic linking system library")
set(dl_LIBRARY ${CMAKE_DL_LIBS} CACHE FILEPATH "dynamic linking system library")
endif()
foreach(_TYPE dl rt dw)
@@ -92,7 +107,8 @@ endif()
#
add_flag_if_avail(
"-W" "-Wall" "-Wno-unknown-pragmas" "-Wno-unused-function" "-Wno-ignored-attributes"
"-Wno-attributes" "-Wno-missing-field-initializers" "-Wno-interference-size")
"-Wno-attributes" "-Wno-missing-field-initializers" "-Wno-interference-size"
)
if(ROCPROFSYS_BUILD_DEBUG)
add_flag_if_avail("-g3" "-fno-omit-frame-pointer")
@@ -113,10 +129,11 @@ endif()
rocprofiler_systems_add_interface_library(
rocprofiler-systems-compile-debuginfo
"Attempts to set best flags for more expressive profiling information in debug or optimized binaries"
)
)
add_target_flag_if_avail(rocprofiler-systems-compile-debuginfo "-g3"
"-fno-omit-frame-pointer" "-fno-optimize-sibling-calls")
"-fno-omit-frame-pointer" "-fno-optimize-sibling-calls"
)
if(CMAKE_CUDA_COMPILER_IS_NVIDIA)
add_target_cuda_flag(rocprofiler-systems-compile-debuginfo "-lineinfo")
@@ -124,19 +141,24 @@ endif()
target_compile_options(
rocprofiler-systems-compile-debuginfo
INTERFACE $<$<COMPILE_LANGUAGE:C>:$<$<C_COMPILER_ID:GNU>:-rdynamic>>
$<$<COMPILE_LANGUAGE:CXX>:$<$<CXX_COMPILER_ID:GNU>:-rdynamic>>)
INTERFACE
$<$<COMPILE_LANGUAGE:C>:$<$<C_COMPILER_ID:GNU>:-rdynamic>>
$<$<COMPILE_LANGUAGE:CXX>:$<$<CXX_COMPILER_ID:GNU>:-rdynamic>>
)
if(NOT APPLE)
target_link_options(rocprofiler-systems-compile-debuginfo INTERFACE
$<$<CXX_COMPILER_ID:GNU>:-rdynamic>)
target_link_options(
rocprofiler-systems-compile-debuginfo
INTERFACE $<$<CXX_COMPILER_ID:GNU>:-rdynamic>
)
endif()
if(CMAKE_CUDA_COMPILER_IS_NVIDIA)
target_compile_options(
rocprofiler-systems-compile-debuginfo
INTERFACE
$<$<COMPILE_LANGUAGE:CUDA>:$<$<CXX_COMPILER_ID:GNU>:-Xcompiler=-rdynamic>>)
$<$<COMPILE_LANGUAGE:CUDA>:$<$<CXX_COMPILER_ID:GNU>:-Xcompiler=-rdynamic>>
)
endif()
if(dl_LIBRARY)
@@ -151,22 +173,29 @@ endif()
# non-debug optimizations
#
rocprofiler_systems_add_interface_library(rocprofiler-systems-compile-extra
"Extra optimization flags")
"Extra optimization flags"
)
if(NOT ROCPROFSYS_BUILD_CODECOV AND ROCPROFSYS_BUILD_EXTRA_OPTIMIZATIONS)
add_target_flag_if_avail(
rocprofiler-systems-compile-extra "-finline-functions" "-funroll-loops"
"-ftree-vectorize" "-ftree-loop-optimize" "-ftree-loop-vectorize")
"-ftree-vectorize" "-ftree-loop-optimize" "-ftree-loop-vectorize"
)
endif()
if(NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Debug"
AND ROCPROFSYS_BUILD_EXTRA_OPTIMIZATIONS
AND NOT ROCPROFSYS_BUILD_CODECOV)
target_link_libraries(rocprofiler-systems-compile-options
INTERFACE $<BUILD_INTERFACE:rocprofiler-systems-compile-extra>)
if(
NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Debug"
AND ROCPROFSYS_BUILD_EXTRA_OPTIMIZATIONS
AND NOT ROCPROFSYS_BUILD_CODECOV
)
target_link_libraries(
rocprofiler-systems-compile-options
INTERFACE $<BUILD_INTERFACE:rocprofiler-systems-compile-extra>
)
add_flag_if_avail(
"-fno-signaling-nans" "-fno-trapping-math" "-fno-signed-zeros"
"-ffinite-math-only" "-fno-math-errno" "-fpredictive-commoning"
"-fvariable-expansion-in-unroller")
"-fvariable-expansion-in-unroller"
)
# add_flag_if_avail("-freciprocal-math" "-fno-signed-zeros" "-mfast-fp")
endif()
@@ -176,7 +205,8 @@ endif()
add_cxx_flag_if_avail("-faligned-new")
rocprofiler_systems_add_interface_library(rocprofiler-systems-lto
"Adds link-time-optimization flags")
"Adds link-time-optimization flags"
)
if(NOT ROCPROFSYS_BUILD_CODECOV)
rocprofiler_systems_save_variables(FLTO VARIABLES CMAKE_CXX_FLAGS)
@@ -208,7 +238,8 @@ endif()
#
rocprofiler_systems_add_interface_library(
rocprofiler-systems-compile-timing
"Adds compiler flags which report compilation timing metrics")
"Adds compiler flags which report compilation timing metrics"
)
if(CMAKE_CXX_COMPILER_IS_CLANG)
add_target_flag_if_avail(rocprofiler-systems-compile-timing "-ftime-trace")
if(NOT cxx_rocprofiler_systems_compile_timing_ftime_trace)
@@ -219,21 +250,27 @@ else()
endif()
if(ROCPROFSYS_USE_COMPILE_TIMING)
target_link_libraries(rocprofiler-systems-compile-options
INTERFACE rocprofiler-systems-compile-timing)
target_link_libraries(
rocprofiler-systems-compile-options
INTERFACE rocprofiler-systems-compile-timing
)
endif()
# ----------------------------------------------------------------------------------------#
# fstack-protector
#
rocprofiler_systems_add_interface_library(rocprofiler-systems-stack-protector
"Adds stack-protector compiler flags")
"Adds stack-protector compiler flags"
)
add_target_flag_if_avail(rocprofiler-systems-stack-protector "-fstack-protector-strong"
"-Wstack-protector")
"-Wstack-protector"
)
if(ROCPROFSYS_BUILD_STACK_PROTECTOR)
target_link_libraries(rocprofiler-systems-compile-options
INTERFACE rocprofiler-systems-stack-protector)
target_link_libraries(
rocprofiler-systems-compile-options
INTERFACE rocprofiler-systems-stack-protector
)
endif()
# ----------------------------------------------------------------------------------------#
@@ -243,7 +280,8 @@ if(ROCPROFSYS_BUILD_DEVELOPER)
add_target_flag_if_avail(
rocprofiler-systems-compile-options "-Werror" "-Wdouble-promotion" "-Wshadow"
"-Wextra" "-Wpedantic" "-Wstack-usage=524288" # 512 KB
"/showIncludes")
"/showIncludes"
)
if(ROCPROFSYS_BUILD_NUMBER GREATER 2)
add_target_flag_if_avail(rocprofiler-systems-compile-options "-gsplit-dwarf")
endif()
@@ -251,9 +289,11 @@ endif()
if(ROCPROFSYS_BUILD_LINKER)
target_link_options(
rocprofiler-systems-compile-options INTERFACE
$<$<C_COMPILER_ID:GNU>:-fuse-ld=${ROCPROFSYS_BUILD_LINKER}>
$<$<CXX_COMPILER_ID:GNU>:-fuse-ld=${ROCPROFSYS_BUILD_LINKER}>)
rocprofiler-systems-compile-options
INTERFACE
$<$<C_COMPILER_ID:GNU>:-fuse-ld=${ROCPROFSYS_BUILD_LINKER}>
$<$<CXX_COMPILER_ID:GNU>:-fuse-ld=${ROCPROFSYS_BUILD_LINKER}>
)
endif()
# ----------------------------------------------------------------------------------------#
@@ -262,20 +302,24 @@ endif()
if(ROCPROFSYS_BUILD_RELEASE AND NOT ROCPROFSYS_BUILD_DEBUG)
add_target_flag_if_avail(
rocprofiler-systems-compile-options "-g1" "-feliminate-unused-debug-symbols"
"-gno-column-info" "-gno-variable-location-views" "-gline-tables-only")
"-gno-column-info" "-gno-variable-location-views" "-gline-tables-only"
)
endif()
# ----------------------------------------------------------------------------------------#
# visibility build flags
#
rocprofiler_systems_add_interface_library(rocprofiler-systems-default-visibility
"Adds -fvisibility=default compiler flag")
"Adds -fvisibility=default compiler flag"
)
rocprofiler_systems_add_interface_library(rocprofiler-systems-hidden-visibility
"Adds -fvisibility=hidden compiler flag")
"Adds -fvisibility=hidden compiler flag"
)
add_target_flag_if_avail(rocprofiler-systems-default-visibility "-fvisibility=default")
add_target_flag_if_avail(rocprofiler-systems-hidden-visibility "-fvisibility=hidden"
"-fvisibility-inlines-hidden")
"-fvisibility-inlines-hidden"
)
# ----------------------------------------------------------------------------------------#
# developer build flags
@@ -299,30 +343,42 @@ set(ROCPROFSYS_SANITIZER_TYPES
unreachable
null
bounds
alignment)
set_property(CACHE ROCPROFSYS_SANITIZER_TYPE PROPERTY STRINGS
"${ROCPROFSYS_SANITIZER_TYPES}")
alignment
)
set_property(
CACHE ROCPROFSYS_SANITIZER_TYPE
PROPERTY STRINGS "${ROCPROFSYS_SANITIZER_TYPES}"
)
rocprofiler_systems_add_interface_library(rocprofiler-systems-sanitizer-compile-options
"Adds compiler flags for sanitizers")
"Adds compiler flags for sanitizers"
)
rocprofiler_systems_add_interface_library(
rocprofiler-systems-sanitizer
"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")
set(COMMON_SANITIZER_FLAGS
"-fno-optimize-sibling-calls"
"-fno-omit-frame-pointer"
"-fno-inline-functions"
)
add_target_flag(rocprofiler-systems-sanitizer-compile-options ${COMMON_SANITIZER_FLAGS})
foreach(_TYPE ${ROCPROFSYS_SANITIZER_TYPES})
set(_FLAG "-fsanitize=${_TYPE}")
rocprofiler_systems_add_interface_library(
rocprofiler-systems-${_TYPE}-sanitizer
"Adds compiler flags to enable ${_TYPE} sanitizer (${_FLAG})")
"Adds compiler flags to enable ${_TYPE} sanitizer (${_FLAG})"
)
add_target_flag(rocprofiler-systems-${_TYPE}-sanitizer ${_FLAG})
target_link_libraries(rocprofiler-systems-${_TYPE}-sanitizer
INTERFACE rocprofiler-systems-sanitizer-compile-options)
set_property(TARGET rocprofiler-systems-${_TYPE}-sanitizer
PROPERTY INTERFACE_LINK_OPTIONS ${_FLAG} ${COMMON_SANITIZER_FLAGS})
target_link_libraries(
rocprofiler-systems-${_TYPE}-sanitizer
INTERFACE rocprofiler-systems-sanitizer-compile-options
)
set_property(
TARGET rocprofiler-systems-${_TYPE}-sanitizer
PROPERTY INTERFACE_LINK_OPTIONS ${_FLAG} ${COMMON_SANITIZER_FLAGS}
)
endforeach()
unset(_FLAG)
@@ -331,13 +387,15 @@ unset(COMMON_SANITIZER_FLAGS)
if(ROCPROFSYS_USE_SANITIZER)
foreach(_TYPE ${ROCPROFSYS_SANITIZER_TYPE})
if(TARGET rocprofiler-systems-${_TYPE}-sanitizer)
target_link_libraries(rocprofiler-systems-sanitizer
INTERFACE rocprofiler-systems-${_TYPE}-sanitizer)
target_link_libraries(
rocprofiler-systems-sanitizer
INTERFACE rocprofiler-systems-${_TYPE}-sanitizer
)
else()
message(
FATAL_ERROR
"Error! Target 'rocprofiler-systems-${_TYPE}-sanitizer' does not exist!"
)
"Error! Target 'rocprofiler-systems-${_TYPE}-sanitizer' does not exist!"
)
endif()
endforeach()
else()
@@ -349,28 +407,38 @@ endif()
#
target_compile_options(
rocprofiler-systems-static-libgcc
INTERFACE $<$<COMPILE_LANGUAGE:C>:$<$<C_COMPILER_ID:GNU>:-static-libgcc>>
$<$<COMPILE_LANGUAGE:CXX>:$<$<CXX_COMPILER_ID:GNU>:-static-libgcc>>)
INTERFACE
$<$<COMPILE_LANGUAGE:C>:$<$<C_COMPILER_ID:GNU>:-static-libgcc>>
$<$<COMPILE_LANGUAGE:CXX>:$<$<CXX_COMPILER_ID:GNU>:-static-libgcc>>
)
target_link_options(
rocprofiler-systems-static-libgcc INTERFACE
$<$<COMPILE_LANGUAGE:C>:$<$<C_COMPILER_ID:GNU,Clang>:-static-libgcc>>
$<$<COMPILE_LANGUAGE:CXX>:$<$<CXX_COMPILER_ID:GNU,Clang>:-static-libgcc>>)
rocprofiler-systems-static-libgcc
INTERFACE
$<$<COMPILE_LANGUAGE:C>:$<$<C_COMPILER_ID:GNU,Clang>:-static-libgcc>>
$<$<COMPILE_LANGUAGE:CXX>:$<$<CXX_COMPILER_ID:GNU,Clang>:-static-libgcc>>
)
target_compile_options(
rocprofiler-systems-static-libstdcxx
INTERFACE $<$<COMPILE_LANGUAGE:CXX>:$<$<CXX_COMPILER_ID:GNU>:-static-libstdc++>>)
INTERFACE $<$<COMPILE_LANGUAGE:CXX>:$<$<CXX_COMPILER_ID:GNU>:-static-libstdc++>>
)
target_link_options(
rocprofiler-systems-static-libstdcxx INTERFACE
$<$<COMPILE_LANGUAGE:CXX>:$<$<CXX_COMPILER_ID:GNU,Clang>:-static-libstdc++>>)
rocprofiler-systems-static-libstdcxx
INTERFACE $<$<COMPILE_LANGUAGE:CXX>:$<$<CXX_COMPILER_ID:GNU,Clang>:-static-libstdc++>>
)
if(ROCPROFSYS_BUILD_STATIC_LIBGCC)
target_link_libraries(rocprofiler-systems-static-libgcc-optional
INTERFACE rocprofiler-systems-static-libgcc)
target_link_libraries(
rocprofiler-systems-static-libgcc-optional
INTERFACE rocprofiler-systems-static-libgcc
)
endif()
if(ROCPROFSYS_BUILD_STATIC_LIBSTDCXX)
target_link_libraries(rocprofiler-systems-static-libstdcxx-optional
INTERFACE rocprofiler-systems-static-libstdcxx)
target_link_libraries(
rocprofiler-systems-static-libstdcxx-optional
INTERFACE rocprofiler-systems-static-libstdcxx
)
endif()
# ----------------------------------------------------------------------------------------#
+73 -65
Просмотреть файл
@@ -32,7 +32,8 @@ endif()
if(NOT TARGET ${LIBNAME}-compile-options)
rocprofiler_systems_add_interface_library(
${LIBNAME}-compile-options
"Adds the standard set of compiler flags used by timemory")
"Adds the standard set of compiler flags used by timemory"
)
endif()
# ----------------------------------------------------------------------------------------#
@@ -41,20 +42,14 @@ endif()
macro(to_list _VAR _STR)
string(REPLACE " " " " ${_VAR} "${_STR}")
string(REPLACE " " ";" ${_VAR} "${_STR}")
endmacro(
to_list
_VAR
_STR)
endmacro(to_list _VAR _STR)
# ----------------------------------------------------------------------------------------#
# macro converting string to list
# ----------------------------------------------------------------------------------------#
macro(to_string _VAR _STR)
string(REPLACE ";" " " ${_VAR} "${_STR}")
endmacro(
to_string
_VAR
_STR)
endmacro(to_string _VAR _STR)
# ----------------------------------------------------------------------------------------#
# Macro to add to string
@@ -233,8 +228,11 @@ macro(ADD_TARGET_CXX_FLAG _TARG)
list(APPEND ${_MAKE_TARG}_CXX_FLAGS ${ARGN})
get_property(LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
if(CMAKE_CUDA_COMPILER_IS_NVIDIA)
target_compile_options(${_TARG} ${_SCOPE}
$<$<COMPILE_LANGUAGE:CUDA>:-Xcompiler=${ARGN}>)
target_compile_options(
${_TARG}
${_SCOPE}
$<$<COMPILE_LANGUAGE:CUDA>:-Xcompiler=${ARGN}>
)
list(APPEND ${_MAKE_TARG}_CUDA_FLAGS -Xcompiler=${ARGN})
elseif(CMAKE_CUDA_COMPILER_IS_CLANG)
target_compile_options(${_TARG} ${_SCOPE} $<$<COMPILE_LANGUAGE:CUDA>:${ARGN}>)
@@ -380,8 +378,11 @@ function(ROCPROFILER_SYSTEMS_TARGET_FLAG _TARG_TARGET)
foreach(_FLAG ${_TARG_FLAGS})
foreach(_LANG ${_TARG_LANGUAGES})
if(NOT _TARG_IF_AVAIL)
target_compile_options(${_TARG_TARGET} ${_TARG_MODE}
$<$<COMPILE_LANGUAGE:${_LANG}>:${_FLAG}>)
target_compile_options(
${_TARG_TARGET}
${_TARG_MODE}
$<$<COMPILE_LANGUAGE:${_LANG}>:${_FLAG}>
)
continue()
endif()
@@ -400,8 +401,11 @@ function(ROCPROFILER_SYSTEMS_TARGET_FLAG _TARG_TARGET)
endif()
rocprofiler_systems_end_flag_check()
if(${FLAG_NAME})
target_compile_options(${_TARG_TARGET} ${_TARG_MODE}
$<$<COMPILE_LANGUAGE:${_LANG}>:${_FLAG}>)
target_compile_options(
${_TARG_TARGET}
${_TARG_MODE}
$<$<COMPILE_LANGUAGE:${_LANG}>:${_FLAG}>
)
endif()
elseif("${_LANG}" STREQUAL "CXX")
string(REGEX REPLACE "^/" "cxx${_LTARG}_" FLAG_NAME "${_FLAG}")
@@ -418,15 +422,23 @@ function(ROCPROFILER_SYSTEMS_TARGET_FLAG _TARG_TARGET)
endif()
rocprofiler_systems_end_flag_check()
if(${FLAG_NAME})
target_compile_options(${_TARG_TARGET} ${_TARG_MODE}
$<$<COMPILE_LANGUAGE:${_LANG}>:${_FLAG}>)
target_compile_options(
${_TARG_TARGET}
${_TARG_MODE}
$<$<COMPILE_LANGUAGE:${_LANG}>:${_FLAG}>
)
if(CMAKE_CUDA_COMPILER_IS_NVIDIA)
target_compile_options(
${_TARG_TARGET} ${_TARG_MODE}
$<$<COMPILE_LANGUAGE:CUDA>:-Xcompiler=${_FLAG}>)
${_TARG_TARGET}
${_TARG_MODE}
$<$<COMPILE_LANGUAGE:CUDA>:-Xcompiler=${_FLAG}>
)
elseif(CMAKE_CUDA_COMPILER_IS_CLANG)
target_compile_options(${_TARG_TARGET} ${_TARG_MODE}
$<$<COMPILE_LANGUAGE:CUDA>:${_FLAG}>)
target_compile_options(
${_TARG_TARGET}
${_TARG_MODE}
$<$<COMPILE_LANGUAGE:CUDA>:${_FLAG}>
)
endif()
endif()
endif()
@@ -449,22 +461,31 @@ endmacro()
# add to any language
# ----------------------------------------------------------------------------------------#
function(ADD_USER_FLAGS _TARGET _LANGUAGE)
set(_FLAGS ${${_LANGUAGE}FLAGS} $ENV{${_LANGUAGE}FLAGS} ${${_LANGUAGE}_FLAGS}
$ENV{${_LANGUAGE}_FLAGS})
set(_FLAGS
${${_LANGUAGE}FLAGS}
$ENV{${_LANGUAGE}FLAGS}
${${_LANGUAGE}_FLAGS}
$ENV{${_LANGUAGE}_FLAGS}
)
string(REPLACE " " ";" _FLAGS "${_FLAGS}")
set(${PROJECT_NAME}_${_LANGUAGE}_FLAGS
${${PROJECT_NAME}_${_LANGUAGE}_FLAGS} ${_FLAGS}
PARENT_SCOPE)
${${PROJECT_NAME}_${_LANGUAGE}_FLAGS}
${_FLAGS}
PARENT_SCOPE
)
set(${PROJECT_NAME}_${_LANGUAGE}_COMPILE_OPTIONS
${${PROJECT_NAME}_${_LANGUAGE}_COMPILE_OPTIONS} ${_FLAGS}
PARENT_SCOPE)
${${PROJECT_NAME}_${_LANGUAGE}_COMPILE_OPTIONS}
${_FLAGS}
PARENT_SCOPE
)
target_compile_options(${_TARGET}
INTERFACE $<$<COMPILE_LANGUAGE:${_LANGUAGE}>:${_FLAGS}>)
target_compile_options(
${_TARGET}
INTERFACE $<$<COMPILE_LANGUAGE:${_LANGUAGE}>:${_FLAGS}>
)
endfunction()
# ----------------------------------------------------------------------------------------#
@@ -477,11 +498,17 @@ function(ROCPROFILER_SYSTEMS_TARGET_COMPILE_DEFINITIONS _TARG _VIS)
endif()
target_compile_definitions(${_TARG} ${_VIS} $<$<COMPILE_LANGUAGE:CXX>:${_DEF}>)
if(CMAKE_CUDA_COMPILER_IS_NVIDIA)
target_compile_definitions(${_TARG} ${_VIS}
$<$<COMPILE_LANGUAGE:CUDA>:${_DEF}>)
target_compile_definitions(
${_TARG}
${_VIS}
$<$<COMPILE_LANGUAGE:CUDA>:${_DEF}>
)
elseif(CMAKE_CUDA_COMPILER_IS_CLANG)
target_compile_definitions(${_TARG} ${_VIS}
$<$<COMPILE_LANGUAGE:CUDA>:${_DEF}>)
target_compile_definitions(
${_TARG}
${_VIS}
$<$<COMPILE_LANGUAGE:CUDA>:${_DEF}>
)
endif()
endforeach()
endfunction()
@@ -491,7 +518,6 @@ endfunction()
# ----------------------------------------------------------------------------------------#
get_property(ENABLED_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
foreach(LANG C CXX CUDA)
if(NOT DEFINED CMAKE_${LANG}_COMPILER)
set(CMAKE_${LANG}_COMPILER "")
endif()
@@ -503,36 +529,32 @@ foreach(LANG C CXX CUDA)
function(SET_COMPILER_VAR VAR _BOOL)
set(CMAKE_${LANG}_COMPILER_IS_${VAR}
${_BOOL}
CACHE INTERNAL "CMake ${LANG} compiler identification (${VAR})" FORCE)
CACHE INTERNAL
"CMake ${LANG} compiler identification (${VAR})"
FORCE
)
mark_as_advanced(CMAKE_${LANG}_COMPILER_IS_${VAR})
endfunction()
if(("${LANG}" STREQUAL "C" AND CMAKE_COMPILER_IS_GNUCC)
OR ("${LANG}" STREQUAL "CXX" AND CMAKE_COMPILER_IS_GNUCXX))
if(
("${LANG}" STREQUAL "C" AND CMAKE_COMPILER_IS_GNUCC)
OR ("${LANG}" STREQUAL "CXX" AND CMAKE_COMPILER_IS_GNUCXX)
)
# GNU compiler
set_compiler_var(GNU 1)
elseif(CMAKE_${LANG}_COMPILER MATCHES "icc.*")
# Intel icc compiler
set_compiler_var(INTEL 1)
set_compiler_var(INTEL_ICC 1)
elseif(CMAKE_${LANG}_COMPILER MATCHES "icpc.*")
# Intel icpc compiler
set_compiler_var(INTEL 1)
set_compiler_var(INTEL_ICPC 1)
elseif(CMAKE_${LANG}_COMPILER_ID MATCHES "AppleClang")
# Clang/LLVM compiler
set_compiler_var(CLANG 1)
set_compiler_var(APPLE_CLANG 1)
elseif(CMAKE_${LANG}_COMPILER_ID MATCHES "Clang")
# Clang/LLVM compiler
set_compiler_var(CLANG 1)
@@ -540,32 +562,23 @@ foreach(LANG C CXX CUDA)
if(CMAKE_${LANG}_COMPILER MATCHES "hipcc")
set_compiler_var(HIPCC 1)
endif()
elseif(CMAKE_${LANG}_COMPILER_ID MATCHES "PGI")
# PGI compiler
set_compiler_var(PGI 1)
elseif(CMAKE_${LANG}_COMPILER MATCHES "xlC" AND UNIX)
# IBM xlC compiler
set_compiler_var(XLC 1)
elseif(CMAKE_${LANG}_COMPILER MATCHES "aCC" AND UNIX)
# HP aC++ compiler
set_compiler_var(HP_ACC 1)
elseif(
CMAKE_${LANG}_COMPILER MATCHES "CC"
AND CMAKE_SYSTEM_NAME MATCHES "IRIX"
AND UNIX)
AND UNIX
)
# IRIX MIPSpro CC Compiler
set_compiler_var(MIPS 1)
elseif(CMAKE_${LANG}_COMPILER_ID MATCHES "Intel")
set_compiler_var(INTEL 1)
set(CTYPE ICC)
@@ -574,17 +587,12 @@ foreach(LANG C CXX CUDA)
endif()
set_compiler_var(INTEL_${CTYPE} 1)
elseif(CMAKE_${LANG}_COMPILER MATCHES "MSVC")
# Windows Visual Studio compiler
set_compiler_var(MSVC 1)
elseif(CMAKE_${LANG}_COMPILER_ID MATCHES "NVIDIA")
# NVCC
set_compiler_var(NVIDIA 1)
endif()
# set other to no
@@ -602,10 +610,10 @@ foreach(LANG C CXX CUDA)
MIPS
MSVC
NVIDIA
HIPCC)
HIPCC
)
if(NOT DEFINED CMAKE_${LANG}_COMPILER_IS_${TYPE})
set_compiler_var(${TYPE} 0)
endif()
endforeach()
endforeach()
+89 -38
Просмотреть файл
@@ -4,26 +4,33 @@ function(rocprofiler_systems_parse_release)
if(EXISTS /etc/lsb-release AND NOT IS_DIRECTORY /etc/lsb-release)
file(READ /etc/lsb-release _LSB_RELEASE)
if(_LSB_RELEASE)
string(REGEX
REPLACE "DISTRIB_ID=(.*)\nDISTRIB_RELEASE=(.*)\nDISTRIB_CODENAME=.*"
"\\1-\\2" _SYSTEM_NAME "${_LSB_RELEASE}")
string(
REGEX REPLACE
"DISTRIB_ID=(.*)\nDISTRIB_RELEASE=(.*)\nDISTRIB_CODENAME=.*"
"\\1-\\2"
_SYSTEM_NAME
"${_LSB_RELEASE}"
)
endif()
elseif(EXISTS /etc/os-release AND NOT IS_DIRECTORY /etc/os-release)
file(READ /etc/os-release _OS_RELEASE)
if(_OS_RELEASE)
string(REPLACE "\"" "" _OS_RELEASE "${_OS_RELEASE}")
string(REPLACE "-" " " _OS_RELEASE "${_OS_RELEASE}")
string(REGEX REPLACE "NAME=.*\nVERSION=([0-9\.]+).*\nID=([a-z]+).*" "\\2-\\1"
_SYSTEM_NAME "${_OS_RELEASE}")
string(
REGEX REPLACE
"NAME=.*\nVERSION=([0-9\.]+).*\nID=([a-z]+).*"
"\\2-\\1"
_SYSTEM_NAME
"${_OS_RELEASE}"
)
endif()
endif()
string(TOLOWER "${_SYSTEM_NAME}" _SYSTEM_NAME)
if(NOT _SYSTEM_NAME)
set(_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}")
endif()
set(_SYSTEM_NAME
"${_SYSTEM_NAME}"
PARENT_SCOPE)
set(_SYSTEM_NAME "${_SYSTEM_NAME}" PARENT_SCOPE)
endfunction()
# parse either /etc/lsb-release or /etc/os-release
@@ -37,7 +44,8 @@ endif()
set(CPACK_PACKAGE_NAME ${PROJECT_NAME})
set(CPACK_PACKAGE_VENDOR "Advanced Micro Devices, Inc.")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY
"Runtime instrumentation and binary rewriting for Perfetto via Dyninst")
"Runtime instrumentation and binary rewriting for Perfetto via Dyninst"
)
set(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}")
@@ -51,12 +59,15 @@ set(OMNITRACE_PACKAGE_NAME "omnitrace")
set(ROCPROFSYS_CPACK_SYSTEM_NAME
"${_SYSTEM_NAME}"
CACHE STRING "System name, e.g. Linux or Ubuntu-20.04")
CACHE STRING
"System name, e.g. Linux or Ubuntu-20.04"
)
set(ROCPROFSYS_CPACK_PACKAGE_SUFFIX "")
if(ROCPROFSYS_USE_ROCM)
set(ROCPROFSYS_CPACK_PACKAGE_SUFFIX
"${ROCPROFSYS_CPACK_PACKAGE_SUFFIX}-ROCm-${ROCmVersion_NUMERIC_VERSION}")
"${ROCPROFSYS_CPACK_PACKAGE_SUFFIX}-ROCm-${ROCmVersion_NUMERIC_VERSION}"
)
endif()
if(ROCPROFSYS_USE_PAPI)
@@ -76,17 +87,18 @@ if(ROCPROFSYS_USE_MPI)
else()
message(
WARNING
"MPI implementation could not be determined. Please set ROCPROFSYS_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(ROCPROFSYS_MPI_IMPL AND NOT "${ROCPROFSYS_MPI_IMPL}" IN_LIST VALID_MPI_IMPLS)
message(
SEND_ERROR
"Invalid ROCPROFSYS_MPI_IMPL (${ROCPROFSYS_MPI_IMPL}). Should be one of: ${VALID_MPI_IMPLS}"
)
"Invalid ROCPROFSYS_MPI_IMPL (${ROCPROFSYS_MPI_IMPL}). Should be one of: ${VALID_MPI_IMPLS}"
)
else()
rocprofiler_systems_add_feature(ROCPROFSYS_MPI_IMPL
"MPI implementation for CPack DEBIAN depends")
"MPI implementation for CPack DEBIAN depends"
)
endif()
if("${ROCPROFSYS_MPI_IMPL}" STREQUAL "openmpi")
@@ -97,7 +109,8 @@ if(ROCPROFSYS_USE_MPI)
set(ROCPROFSYS_MPI_IMPL_UPPER "MPI")
endif()
set(ROCPROFSYS_CPACK_PACKAGE_SUFFIX
"${ROCPROFSYS_CPACK_PACKAGE_SUFFIX}-${ROCPROFSYS_MPI_IMPL_UPPER}")
"${ROCPROFSYS_CPACK_PACKAGE_SUFFIX}-${ROCPROFSYS_MPI_IMPL_UPPER}"
)
endif()
if(ROCPROFSYS_USE_PYTHON)
@@ -112,14 +125,14 @@ endif()
set(CPACK_PACKAGE_FILE_NAME
"${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(ROCPROFSYS_PACKAGE_FILE_NAME
${CPACK_PACKAGE_NAME}-${ROCPROFSYS_VERSION}-${ROCPROFSYS_CPACK_SYSTEM_NAME}${ROCPROFSYS_CPACK_PACKAGE_SUFFIX}
)
)
rocprofiler_systems_add_feature(ROCPROFSYS_PACKAGE_FILE_NAME "CPack filename")
if(ROCM_DEP_ROCMCORE OR ROCPROFILER_DEP_ROCMCORE)
@@ -138,9 +151,15 @@ endif()
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/ROCm/rocprofiler-systems")
set(CPACK_DEBIAN_PACKAGE_RELEASE
"${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}")
"${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}")
if(ROCPROFSYS_USE_PAPI AND NOT ROCPROFSYS_BUILD_PAPI)
@@ -148,9 +167,20 @@ if(ROCPROFSYS_USE_PAPI AND NOT ROCPROFSYS_BUILD_PAPI)
endif()
if(NOT ROCPROFSYS_BUILD_DYNINST)
if(NOT ROCPROFSYS_BUILD_BOOST)
foreach(_BOOST_COMPONENT atomic system thread date-time filesystem timer)
list(APPEND _DEBIAN_PACKAGE_DEPENDS
"libboost-${_BOOST_COMPONENT}-dev (>= 1.67.0)")
foreach(
_BOOST_COMPONENT
atomic
system
thread
date-time
filesystem
timer
)
list(
APPEND
_DEBIAN_PACKAGE_DEPENDS
"libboost-${_BOOST_COMPONENT}-dev (>= 1.67.0)"
)
endforeach()
endif()
if(NOT ROCPROFSYS_BUILD_TBB)
@@ -162,7 +192,8 @@ if(NOT ROCPROFSYS_BUILD_DYNINST)
endif()
if(ROCmVersion_FOUND)
set(_AMD_SMI_SUFFIX
" (>= ${ROCmVersion_MAJOR_VERSION}.0.0.${ROCmVersion_NUMERIC_VERSION})")
" (>= ${ROCmVersion_MAJOR_VERSION}.0.0.${ROCmVersion_NUMERIC_VERSION})"
)
endif()
if(ROCPROFSYS_USE_ROCM)
list(APPEND _DEBIAN_PACKAGE_DEPENDS "amd-smi-lib${_AMD_SMI_SUFFIX}")
@@ -182,7 +213,10 @@ endif()
string(REPLACE ";" ", " _DEBIAN_PACKAGE_DEPENDS "${_DEBIAN_PACKAGE_DEPENDS}")
set(CPACK_DEBIAN_PACKAGE_DEPENDS
"${_DEBIAN_PACKAGE_DEPENDS}"
CACHE STRING "Debian package dependencies" FORCE)
CACHE STRING
"Debian package dependencies"
FORCE
)
set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
@@ -203,9 +237,15 @@ if(DEFINED CPACK_PACKAGING_INSTALL_PREFIX)
endif()
set(CPACK_RPM_PACKAGE_RELEASE
"${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}")
"${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}")
# Handle the project rebranding from "omnitrace" to "rocprofiler-systems"
@@ -223,7 +263,10 @@ endif()
string(REPLACE ";" ", " CPACK_RPM_PACKAGE_PROVIDES "${_RPM_PACKAGE_PROVIDES}")
set(CPACK_RPM_PACKAGE_PROVIDES
"${CPACK_RPM_PACKAGE_PROVIDES}"
CACHE STRING "RPM package provides" FORCE)
CACHE STRING
"RPM package provides"
FORCE
)
if(ROCPROFSYS_USE_MPI)
if("${ROCPROFSYS_MPI_IMPL}" STREQUAL "openmpi")
@@ -243,7 +286,10 @@ endif()
string(REPLACE ";" ", " _RPM_PACKAGE_REQUIRES "${_RPM_PACKAGE_REQUIRES}")
set(CPACK_RPM_PACKAGE_REQUIRES
${_RPM_PACKAGE_REQUIRES}
CACHE STRING "RPM package requires" FORCE)
CACHE STRING
"RPM package requires"
FORCE
)
set(CPACK_RPM_SPEC_MORE_DEFINE "%undefine __brp_mangle_shebangs")
set(CPACK_RPM_PACKAGE_LICENSE "MIT")
set(CPACK_RPM_FILE_NAME "RPM-DEFAULT")
@@ -259,7 +305,7 @@ set(CPACK_RPM_PACKAGE_AUTOREQ ON)
set(CPACK_PACKAGE_VERSION
"${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}"
)
)
if(DEFINED ENV{ROCM_LIBPATCH_VERSION})
set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}.$ENV{ROCM_LIBPATCH_VERSION}")
@@ -276,20 +322,25 @@ endif()
rocprofiler_systems_add_feature(CPACK_PACKAGE_NAME "Package name")
rocprofiler_systems_add_feature(CPACK_PACKAGE_VERSION "Package version")
rocprofiler_systems_add_feature(CPACK_PACKAGING_INSTALL_PREFIX
"Package installation prefix")
"Package installation prefix"
)
rocprofiler_systems_add_feature(CPACK_DEBIAN_FILE_NAME "Debian file name")
rocprofiler_systems_add_feature(CPACK_DEBIAN_PACKAGE_RELEASE
"Debian package release version")
"Debian package release version"
)
rocprofiler_systems_add_feature(CPACK_DEBIAN_PACKAGE_DEPENDS
"Debian package dependencies")
"Debian package dependencies"
)
rocprofiler_systems_add_feature(CPACK_DEBIAN_PACKAGE_SHLIBDEPS
"Debian package shared library dependencies")
"Debian package shared library dependencies"
)
rocprofiler_systems_add_feature(CPACK_RPM_FILE_NAME "RPM file name")
rocprofiler_systems_add_feature(CPACK_RPM_PACKAGE_RELEASE "RPM package release version")
rocprofiler_systems_add_feature(CPACK_RPM_PACKAGE_AUTOREQPROV
"RPM package auto generate requires and provides")
"RPM package auto generate requires and provides"
)
rocprofiler_systems_add_feature(CPACK_RPM_PACKAGE_REQUIRES "RPM package requires")
rocprofiler_systems_add_feature(CPACK_RPM_PACKAGE_PROVIDES "RPM package provides")
+20 -12
Просмотреть файл
@@ -9,7 +9,8 @@ install(
EXPORT rocprofiler-systems-library-targets
FILE ${PROJECT_NAME}-library-targets.cmake
NAMESPACE rocprofiler-systems::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
)
# ------------------------------------------------------------------------------#
# install tree
@@ -24,19 +25,22 @@ configure_package_config_file(
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}/${PROJECT_NAME}-config.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}
PATH_VARS PROJECT_INSTALL_DIR INCLUDE_INSTALL_DIR LIB_INSTALL_DIR)
PATH_VARS PROJECT_INSTALL_DIR INCLUDE_INSTALL_DIR LIB_INSTALL_DIR
)
write_basic_package_version_file(
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}/${PROJECT_NAME}-version.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMinorVersion)
COMPATIBILITY SameMinorVersion
)
install(
FILES
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}/${PROJECT_NAME}-config.cmake
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}/${PROJECT_NAME}-version.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
OPTIONAL)
OPTIONAL
)
export(PACKAGE ${PROJECT_NAME})
@@ -45,16 +49,21 @@ export(PACKAGE ${PROJECT_NAME})
#
configure_file(
${PROJECT_SOURCE_DIR}/tests/validate-causal-json.py
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/rocprof-sys-causal-print COPYONLY)
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/rocprof-sys-causal-print
COPYONLY
)
install(PROGRAMS ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/rocprof-sys-causal-print
DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/${PROJECT_NAME})
install(
PROGRAMS ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/rocprof-sys-causal-print
DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/${PROJECT_NAME}
)
# ------------------------------------------------------------------------------#
# build tree
#
set(_BUILDTREE_EXPORT_DIR
"${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
"${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
)
if(NOT EXISTS "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
@@ -71,8 +80,7 @@ endif()
export(
EXPORT ${PROJECT_NAME}-library-targets
NAMESPACE rocprofiler-systems::
FILE "${_BUILDTREE_EXPORT_DIR}/${PROJECT_NAME}-library-targets.cmake")
FILE "${_BUILDTREE_EXPORT_DIR}/${PROJECT_NAME}-library-targets.cmake"
)
set(${PROJECT_NAME}_DIR
"${_BUILDTREE_EXPORT_DIR}"
CACHE PATH "${PROJECT_NAME}" FORCE)
set(${PROJECT_NAME}_DIR "${_BUILDTREE_EXPORT_DIR}" CACHE PATH "${PROJECT_NAME}" FORCE)
+113 -61
Просмотреть файл
@@ -56,31 +56,29 @@ endif()
set(_boost_min_version 1.67.0)
# Provide a default, if the user didn't specify
set(Boost_MIN_VERSION
${_boost_min_version}
CACHE STRING "Minimum Boost version")
set(Boost_MIN_VERSION ${_boost_min_version} CACHE STRING "Minimum Boost version")
# Enforce minimum version
if(${Boost_MIN_VERSION} VERSION_LESS ${_boost_min_version})
rocprofiler_systems_message(
FATAL_ERROR
"Requested Boost-${Boost_MIN_VERSION} is less than minimum supported version (${_boost_min_version})"
)
)
endif()
# -------------- RUNTIME CONFIGURATION ----------------------------------------
# Use the multithreaded version of Boost NB: This _must_ be a cache variable as it
# controls the tagged layout of Boost library names
set(Boost_USE_MULTITHREADED
ON
CACHE BOOL "Enable multithreaded Boost libraries")
set(Boost_USE_MULTITHREADED ON CACHE BOOL "Enable multithreaded Boost libraries")
# Don't use libraries linked statically to the C++ runtime NB: This _must_ be a cache
# variable as it controls the tagged layout of Boost library names
set(Boost_USE_STATIC_RUNTIME
OFF
CACHE BOOL "Enable usage of libraries statically linked to C++ runtime")
CACHE BOOL
"Enable usage of libraries statically linked to C++ runtime"
)
# If using multithreaded Boost, make sure Threads has been intialized
if(Boost_USE_MULTITHREADED AND NOT DEFINED CMAKE_THREAD_LIBS_INIT)
@@ -88,22 +86,23 @@ if(Boost_USE_MULTITHREADED AND NOT DEFINED CMAKE_THREAD_LIBS_INIT)
endif()
# Enable debug output from FindBoost
set(Boost_DEBUG
OFF
CACHE BOOL "Enable debug output from FindBoost")
set(Boost_DEBUG OFF CACHE BOOL "Enable debug output from FindBoost")
# -------------- PATHS --------------------------------------------------------
# By default, search system paths
set(Boost_NO_SYSTEM_PATHS
OFF
CACHE BOOL "Disable searching in locations not specified by hint variables")
CACHE BOOL
"Disable searching in locations not specified by hint variables"
)
# A sanity check This must be done _before_ the cache variables are set
if(PATH_BOOST AND Boost_ROOT_DIR)
rocprofiler_systems_message(
FATAL_ERROR
"PATH_BOOST AND Boost_ROOT_DIR both specified. Please provide only one")
"PATH_BOOST AND Boost_ROOT_DIR both specified. Please provide only one"
)
endif()
# Provide a default root directory
@@ -112,9 +111,7 @@ if(NOT PATH_BOOST AND NOT Boost_ROOT_DIR)
endif()
# Set the default location to look for Boost
set(Boost_ROOT_DIR
${PATH_BOOST}
CACHE PATH "Base directory the of Boost installation")
set(Boost_ROOT_DIR ${PATH_BOOST} CACHE PATH "Base directory the of Boost installation")
# In FindBoost, Boost_ROOT_DIR is spelled BOOST_ROOT
set(BOOST_ROOT ${Boost_ROOT_DIR})
@@ -135,9 +132,7 @@ if(MSVC)
list(APPEND _boost_defines BOOST_NO_CXX11_VARIADIC_TEMPLATES)
endif()
set(Boost_DEFINES
${_boost_defines}
CACHE STRING "Boost compiler defines")
set(Boost_DEFINES ${_boost_defines} CACHE STRING "Boost compiler defines")
add_compile_definitions(${Boost_DEFINES})
# -------------- INTERNALS ----------------------------------------------------
@@ -148,7 +143,15 @@ set(Boost_NO_BOOST_CMAKE ON)
# The required Boost library components NB: These are just the ones that require
# compilation/linking This should _not_ be a cache variable
set(_boost_components atomic chrono date_time filesystem system thread timer)
set(_boost_components
atomic
chrono
date_time
filesystem
system
thread
timer
)
if(NOT BUILD_BOOST)
find_package(Boost ${Boost_MIN_VERSION} QUIET COMPONENTS ${_boost_components})
@@ -161,28 +164,35 @@ if(Boost_FOUND AND NOT BUILD_BOOST)
# However, we need them in the Testsuite
set(Boost_INCLUDE_DIRS
${Boost_INCLUDE_DIRS}
CACHE PATH "Boost include directory" FORCE)
CACHE PATH
"Boost include directory"
FORCE
)
set(Boost_LIBRARY_DIRS
${Boost_LIBRARY_DIRS}
CACHE PATH "Boost library directory" FORCE)
set(Boost_INCLUDE_DIR
${Boost_INCLUDE_DIR}
CACHE PATH "Boost include directory" FORCE)
CACHE PATH
"Boost library directory"
FORCE
)
set(Boost_INCLUDE_DIR ${Boost_INCLUDE_DIR} CACHE PATH "Boost include directory" FORCE)
elseif(NOT Boost_FOUND AND STERILE_BUILD)
rocprofiler_systems_message(
FATAL_ERROR "Boost not found and cannot be downloaded because build is sterile.")
FATAL_ERROR "Boost not found and cannot be downloaded because build is sterile."
)
elseif(NOT BUILD_BOOST)
rocprofiler_systems_message(
FATAL_ERROR
"Boost was not found. Either configure cmake to find Boost properly or set BUILD_BOOST=ON to download and build"
)
)
else()
rocprofiler_systems_add_option(BOOST_LINK_STATIC "Link to boost libraries statically"
ON)
ON
)
# If we didn't find a suitable version on the system, then download one from the web
rocprofiler_systems_add_cache_option(
ROCPROFSYS_BOOST_DOWNLOAD_VERSION "Version of boost to download and install"
STRING "1.79.0")
STRING "1.79.0"
)
# If the user specifies a version other than ROCPROFSYS_BOOST_DOWNLOAD_VERSION, use
# that version.
@@ -190,13 +200,13 @@ else()
rocprofiler_systems_message(
FATAL_ERROR
"Boost download version is set to ${ROCPROFSYS_BOOST_DOWNLOAD_VERSION} but Boost minimum version is set to ${Boost_MIN_VERSION}"
)
)
endif()
rocprofiler_systems_message(
STATUS
"Attempting to build BOOST(${ROCPROFSYS_BOOST_DOWNLOAD_VERSION}) as external project"
)
)
if(Boost_USE_MULTITHREADED)
set(_boost_threading multi)
@@ -213,18 +223,30 @@ else()
# Change the base directory
set(Boost_ROOT_DIR
${TPL_STAGING_PREFIX}/boost
CACHE PATH "Base directory the of Boost installation" FORCE)
CACHE PATH
"Base directory the of Boost installation"
FORCE
)
# Update the exported variables
set(Boost_INCLUDE_DIRS
"$<BUILD_INTERFACE:${Boost_ROOT_DIR}/include>;$<INSTALL_INTERFACE:${CMAKE_INSTALL_LIBDIR}/${TPL_INSTALL_INCLUDE_DIR}>"
CACHE PATH "Boost include directory" FORCE)
CACHE PATH
"Boost include directory"
FORCE
)
set(Boost_LIBRARY_DIRS
"$<BUILD_INTERFACE:${Boost_ROOT_DIR}/lib>;$<INSTALL_INTERFACE:${CMAKE_INSTALL_LIBDIR}/${TPL_INSTALL_LIB_DIR}>"
CACHE PATH "Boost library directory" FORCE)
CACHE PATH
"Boost library directory"
FORCE
)
set(Boost_INCLUDE_DIR
${Boost_INCLUDE_DIRS}
CACHE PATH "Boost include directory" FORCE)
CACHE PATH
"Boost include directory"
FORCE
)
file(MAKE_DIRECTORY ${Boost_ROOT_DIR}/include)
file(MAKE_DIRECTORY ${Boost_ROOT_DIR}/lib)
@@ -235,8 +257,11 @@ else()
set(_BOOST_LINK shared)
endif()
set(BOOST_ARGS link=${_BOOST_LINK} runtime-link=${_boost_runtime_link}
threading=${_boost_threading})
set(BOOST_ARGS
link=${_BOOST_LINK}
runtime-link=${_boost_runtime_link}
threading=${_boost_threading}
)
if(WIN32)
# NB: We need to build both debug/release on windows as we don't use
# CMAKE_BUILD_TYPE
@@ -283,23 +308,34 @@ else()
set(Boost_LIBRARIES "")
foreach(c ${_boost_components})
list(APPEND Boost_LIBRARIES "optimized libboost_${c} debug libboost_${c}-gd ")
list(APPEND _boost_build_byproducts
"{Boost_ROOT_DIR}/lib/libboost_${c}${_LIB_SUFFIX}")
list(
APPEND
_boost_build_byproducts
"{Boost_ROOT_DIR}/lib/libboost_${c}${_LIB_SUFFIX}"
)
set(Boost_${c}_LIBRARY
$<BUILD_INTERFACE:${Boost_ROOT_DIR}/lib/libboost_${c}${_LIB_SUFFIX}>
$<INSTALL_INTERFACE:boost_${c}>)
$<INSTALL_INTERFACE:boost_${c}>
)
set(Boost_${c}_LIBRARY_DEBUG
$<BUILD_INTERFACE:${Boost_ROOT_DIR}/lib/libboost_${c}${_LIB_SUFFIX}>
$<INSTALL_INTERFACE:libboost_${c}-gd>)
$<INSTALL_INTERFACE:libboost_${c}-gd>
)
# Also export cache variables for the file location of each library
string(TOUPPER ${c} _basename)
set(Boost_${_basename}_LIBRARY_RELEASE
"${Boost_${c}_LIBRARY}"
CACHE FILEPATH "" FORCE)
CACHE FILEPATH
""
FORCE
)
set(Boost_${_basename}_LIBRARY_DEBUG
"${Boost_${c}_LIBRARY_DEBUG}"
CACHE FILEPATH "" FORCE)
CACHE FILEPATH
""
FORCE
)
endforeach()
else()
# Transform the component names into the library filenames e.g., system ->
@@ -309,42 +345,55 @@ else()
set(Boost_${c}_LIBRARY
$<BUILD_INTERFACE:${Boost_ROOT_DIR}/lib/libboost_${c}${_LIB_SUFFIX}>
$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/${INSTALL_LIB_DIR}/${TPL_INSTALL_LIB_DIR}/libboost_${c}${_LIB_SUFFIX}>
)
list(APPEND _boost_build_byproducts
"${Boost_ROOT_DIR}/lib/libboost_${c}${_LIB_SUFFIX}")
)
list(
APPEND
_boost_build_byproducts
"${Boost_ROOT_DIR}/lib/libboost_${c}${_LIB_SUFFIX}"
)
list(APPEND Boost_LIBRARIES "${Boost_${c}_LIBRARY}")
# Also export cache variables for the file location of each library
string(TOUPPER ${c} _basename)
set(Boost_${_basename}_LIBRARY_RELEASE
"${Boost_${c}_LIBRARY}"
CACHE FILEPATH "" FORCE)
CACHE FILEPATH
""
FORCE
)
set(Boost_${_basename}_LIBRARY_DEBUG
"${Boost_${c}_LIBRARY}"
CACHE FILEPATH "" FORCE)
CACHE FILEPATH
""
FORCE
)
endforeach()
endif()
include(ExternalProject)
externalproject_add(
ExternalProject_Add(
rocprofiler-systems-boost-build
PREFIX ${Boost_ROOT_DIR}
GIT_REPOSITORY https://github.com/boostorg/boost.git
GIT_TAG boost-${ROCPROFSYS_BOOST_DOWNLOAD_VERSION}
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ${BOOST_BOOTSTRAP} --prefix=${Boost_ROOT_DIR}
--with-libraries=${_boost_lib_names}
BUILD_COMMAND ${BOOST_BUILD} --ignore-site-config --prefix=${Boost_ROOT_DIR} -j2
${BOOST_ARGS} -d0 install
CONFIGURE_COMMAND
${BOOST_BOOTSTRAP} --prefix=${Boost_ROOT_DIR}
--with-libraries=${_boost_lib_names}
BUILD_COMMAND
${BOOST_BUILD} --ignore-site-config --prefix=${Boost_ROOT_DIR} -j2
${BOOST_ARGS} -d0 install
BUILD_BYPRODUCTS ${_boost_build_byproducts}
INSTALL_COMMAND "")
INSTALL_COMMAND ""
)
# target for re-executing the installation
add_custom_target(
rocprofiler-systems-boost-install
COMMAND ${BOOST_BUILD} ${BOOST_ARGS} -d0 install
WORKING_DIRECTORY ${Boost_ROOT_DIR}/src/Boost-External
COMMENT "Installing Boost...")
COMMENT "Installing Boost..."
)
endif()
# -------------- EXPORT VARIABLES ---------------------------------------------
@@ -356,7 +405,9 @@ if(Boost_USE_MULTITHREADED AND ${_building_threads})
# the debug/release filenames are the same
set(Boost_THREAD_LIBRARY
${Boost_THREAD_LIBRARY_DEBUG}
CACHE FILEPATH "Boost thread library")
CACHE FILEPATH
"Boost thread library"
)
endif()
# Add the system thread library
@@ -365,12 +416,13 @@ if(Boost_USE_MULTITHREADED)
endif()
# Export the complete set of libraries
set(Boost_LIBRARIES
${Boost_LIBRARIES}
CACHE FILEPATH "Boost library files" FORCE)
set(Boost_LIBRARIES ${Boost_LIBRARIES} CACHE FILEPATH "Boost library files" FORCE)
target_include_directories(rocprofiler-systems-boost SYSTEM
INTERFACE ${Boost_INCLUDE_DIRS})
target_include_directories(
rocprofiler-systems-boost
SYSTEM
INTERFACE ${Boost_INCLUDE_DIRS}
)
target_compile_definitions(rocprofiler-systems-boost INTERFACE ${Boost_DEFINITIONS})
target_link_directories(rocprofiler-systems-boost INTERFACE ${Boost_LIBRARY_DIRS})
target_link_libraries(rocprofiler-systems-boost INTERFACE ${Boost_LIBRARIES})
+70 -47
Просмотреть файл
@@ -32,9 +32,7 @@ if(NOT BUILD_ELFUTILS)
find_package(Elfutils)
endif()
if(LibElf_FOUND
AND LibDwarf_FOUND
AND NOT ENABLE_DEBUGINFOD)
if(LibElf_FOUND AND LibDwarf_FOUND AND NOT ENABLE_DEBUGINFOD)
return()
endif()
@@ -48,30 +46,34 @@ set(_min_version 0.178)
set(ElfUtils_MIN_VERSION
${_min_version}
CACHE STRING "Minimum acceptable elfutils version")
CACHE STRING
"Minimum acceptable elfutils version"
)
if(${ElfUtils_MIN_VERSION} VERSION_LESS ${_min_version})
rocprofiler_systems_message(
FATAL_ERROR
"Requested version ${ElfUtils_MIN_VERSION} is less than minimum supported version (${_min_version})"
)
)
endif()
# -------------- PATHS --------------------------------------------------------
# Base directory the of elfutils installation
set(ElfUtils_ROOT_DIR
"/usr"
CACHE PATH "Base directory the of elfutils installation")
set(ElfUtils_ROOT_DIR "/usr" CACHE PATH "Base directory the of elfutils installation")
# Hint directory that contains the elfutils headers files
set(ElfUtils_INCLUDEDIR
"${ElfUtils_ROOT_DIR}/include"
CACHE PATH "Hint directory that contains the elfutils headers files")
CACHE PATH
"Hint directory that contains the elfutils headers files"
)
# Hint directory that contains the elfutils library files
set(ElfUtils_LIBRARYDIR
"${ElfUtils_ROOT_DIR}/lib"
CACHE PATH "Hint directory that contains the elfutils library files")
CACHE PATH
"Hint directory that contains the elfutils library files"
)
# libelf/dwarf-specific directory hints
foreach(l LibElf LibDwarf LibDebuginfod)
@@ -96,15 +98,19 @@ endif()
# -------------- SOURCE BUILD -------------------------------------------------
if(LibElf_FOUND
AND LibDwarf_FOUND
AND (NOT ENABLE_DEBUGINFOD OR LibDebuginfod_FOUND))
if(LibElf_FOUND AND LibDwarf_FOUND AND (NOT ENABLE_DEBUGINFOD OR LibDebuginfod_FOUND))
if(ENABLE_DEBUGINFOD AND LibDebuginfod_FOUND)
set(_eu_root ${ElfUtils_ROOT_DIR})
set(_eu_inc_dirs ${LibElf_INCLUDE_DIRS} ${LibDwarf_INCLUDE_DIRS}
${LibDebuginfod_INCLUDE_DIRS})
set(_eu_lib_dirs ${LibElf_LIBRARY_DIRS} ${LibDwarf_LIBRARY_DIRS}
${LibDebuginfod_LIBRARY_DIRS})
set(_eu_inc_dirs
${LibElf_INCLUDE_DIRS}
${LibDwarf_INCLUDE_DIRS}
${LibDebuginfod_INCLUDE_DIRS}
)
set(_eu_lib_dirs
${LibElf_LIBRARY_DIRS}
${LibDwarf_LIBRARY_DIRS}
${LibDebuginfod_LIBRARY_DIRS}
)
set(_eu_libs ${LibElf_LIBRARIES} ${LibDwarf_LIBRARIES} ${LibDebuginfod_LIBRARIES})
else()
set(_eu_root ${ElfUtils_ROOT_DIR})
@@ -115,17 +121,19 @@ if(LibElf_FOUND
elseif(NOT (LibElf_FOUND AND LibDwarf_FOUND) AND STERILE_BUILD)
rocprofiler_systems_message(
FATAL_ERROR
"ElfUtils not found and cannot be downloaded because build is sterile.")
"ElfUtils not found and cannot be downloaded because build is sterile."
)
elseif(NOT BUILD_ELFUTILS)
rocprofiler_systems_message(
FATAL_ERROR
"ElfUtils was not found. Either configure cmake to find ElfUtils properly or set BUILD_ELFUTILS=ON to download and build"
)
)
else()
# If we didn't find a suitable version on the system, then download one from the web
rocprofiler_systems_add_cache_option(
ELFUTILS_DOWNLOAD_VERSION "Version of elfutils to download and install" STRING
"0.188")
"0.188"
)
set(ELFUTILS_DOWNLOAD_VERSION ${ElfUtils_DOWNLOAD_VERSION})
# make sure we are not downloading a version less than minimum
@@ -133,36 +141,45 @@ else()
rocprofiler_systems_message(
FATAL_ERROR
"elfutils download version is set to ${ELFUTILS_DOWNLOAD_VERSION} but elfutils minimum version is set to ${ElfUtils_MIN_VERSION}"
)
)
endif()
rocprofiler_systems_message(STATUS "${ElfUtils_ERROR_REASON}")
rocprofiler_systems_message(
STATUS
"Attempting to build elfutils(${ELFUTILS_DOWNLOAD_VERSION}) as external project")
"Attempting to build elfutils(${ELFUTILS_DOWNLOAD_VERSION}) as external project"
)
if(NOT (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") OR NOT (${CMAKE_C_COMPILER_ID}
STREQUAL "GNU"))
if(
NOT (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
OR NOT (${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
)
rocprofiler_systems_message(FATAL_ERROR
"ElfUtils will only build with the GNU compiler")
"ElfUtils will only build with the GNU compiler"
)
endif()
set(_eu_root ${TPL_STAGING_PREFIX}/elfutils)
set(_eu_inc_dirs $<BUILD_INTERFACE:${_eu_root}/include>)
set(_eu_lib_dirs $<BUILD_INTERFACE:${_eu_root}/lib>)
set(_eu_libs $<BUILD_INTERFACE:${_eu_root}/lib/libdw${CMAKE_SHARED_LIBRARY_SUFFIX}>
$<BUILD_INTERFACE:${_eu_root}/lib/libelf${CMAKE_SHARED_LIBRARY_SUFFIX}>)
set(_eu_build_byproducts "${_eu_root}/lib/libdw${CMAKE_SHARED_LIBRARY_SUFFIX}"
"${_eu_root}/lib/libelf${CMAKE_SHARED_LIBRARY_SUFFIX}")
set(_eu_libs
$<BUILD_INTERFACE:${_eu_root}/lib/libdw${CMAKE_SHARED_LIBRARY_SUFFIX}>
$<BUILD_INTERFACE:${_eu_root}/lib/libelf${CMAKE_SHARED_LIBRARY_SUFFIX}>
)
set(_eu_build_byproducts
"${_eu_root}/lib/libdw${CMAKE_SHARED_LIBRARY_SUFFIX}"
"${_eu_root}/lib/libelf${CMAKE_SHARED_LIBRARY_SUFFIX}"
)
file(MAKE_DIRECTORY "${_eu_root}/lib")
file(MAKE_DIRECTORY "${_eu_root}/include")
include(ExternalProject)
externalproject_add(
ExternalProject_Add(
rocprofiler-systems-elfutils-build
PREFIX ${_eu_root}
URL ${ElfUtils_DOWNLOAD_URL}
URL
${ElfUtils_DOWNLOAD_URL}
"https://sourceware.org/elfutils/ftp/${ELFUTILS_DOWNLOAD_VERSION}/elfutils-${ELFUTILS_DOWNLOAD_VERSION}.tar.bz2"
"https://mirrors.kernel.org/sourceware/elfutils/${ELFUTILS_DOWNLOAD_VERSION}/elfutils-${ELFUTILS_DOWNLOAD_VERSION}.tar.bz2"
BUILD_IN_SOURCE 1
@@ -175,42 +192,48 @@ else()
--libdir=${_eu_root}/lib
BUILD_COMMAND make install
BUILD_BYPRODUCTS ${_eu_build_byproducts}
INSTALL_COMMAND "")
INSTALL_COMMAND ""
)
# target for re-executing the installation
add_custom_target(
rocprofiler-systems-elfutils-install
COMMAND make install
WORKING_DIRECTORY ${${_eu_root}}/src/ElfUtils-External
COMMENT "Installing ElfUtils...")
COMMENT "Installing ElfUtils..."
)
install(
DIRECTORY ${_eu_root}/lib/
DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}
FILES_MATCHING
PATTERN "*${CMAKE_SHARED_LIBRARY_SUFFIX}*")
PATTERN "*${CMAKE_SHARED_LIBRARY_SUFFIX}*"
)
endif()
# -------------- EXPORT VARIABLES ---------------------------------------------
set(ElfUtils_ROOT_DIR
${_eu_root}
CACHE PATH "Base directory the of elfutils installation" FORCE)
set(ElfUtils_INCLUDE_DIRS
${_eu_inc_dirs}
CACHE PATH "elfutils include directory" FORCE)
set(ElfUtils_LIBRARY_DIRS
${_eu_lib_dirs}
CACHE PATH "elfutils library directory" FORCE)
CACHE PATH
"Base directory the of elfutils installation"
FORCE
)
set(ElfUtils_INCLUDE_DIRS ${_eu_inc_dirs} CACHE PATH "elfutils include directory" FORCE)
set(ElfUtils_LIBRARY_DIRS ${_eu_lib_dirs} CACHE PATH "elfutils library directory" FORCE)
set(ElfUtils_INCLUDE_DIR
${ElfUtils_INCLUDE_DIRS}
CACHE PATH "elfutils include directory" FORCE)
set(ElfUtils_LIBRARIES
${_eu_libs}
CACHE FILEPATH "elfutils library files" FORCE)
CACHE PATH
"elfutils include directory"
FORCE
)
set(ElfUtils_LIBRARIES ${_eu_libs} CACHE FILEPATH "elfutils library files" FORCE)
target_include_directories(rocprofiler-systems-elfutils SYSTEM
INTERFACE ${ElfUtils_INCLUDE_DIRS})
target_include_directories(
rocprofiler-systems-elfutils
SYSTEM
INTERFACE ${ElfUtils_INCLUDE_DIRS}
)
target_compile_definitions(rocprofiler-systems-elfutils INTERFACE ${ElfUtils_DEFINITIONS})
target_link_directories(rocprofiler-systems-elfutils INTERFACE ${ElfUtils_LIBRARY_DIRS})
target_link_libraries(rocprofiler-systems-elfutils INTERFACE ${ElfUtils_LIBRARIES})
+46 -26
Просмотреть файл
@@ -5,8 +5,8 @@ foreach(dep BOOST TBB ELFUTILS LIBIBERTY)
if(DYNINST_BUILD_${dep})
message(
WARNING
"DYNINST_BUILD_${dep} is deprecated. Using ROCPROFSYS_BUILD_${dep} instead."
)
"DYNINST_BUILD_${dep} is deprecated. Using ROCPROFSYS_BUILD_${dep} instead."
)
set(ROCPROFSYS_BUILD_${dep} ON)
endif()
endforeach()
@@ -16,22 +16,27 @@ foreach(dep BOOST TBB ELFUTILS LIBIBERTY)
if(ROCPROFSYS_BUILD_${dep})
if(dep STREQUAL "BOOST")
rocprofiler_systems_add_option(BUILD_BOOST "Enable building Boost internally"
ON)
ON
)
elseif(dep STREQUAL "TBB")
rocprofiler_systems_add_option(BUILD_TBB "Enable building TBB internally" ON)
elseif(dep STREQUAL "ELFUTILS")
rocprofiler_systems_add_option(BUILD_ELFUTILS
"Enable building elfutils internally" ON)
"Enable building elfutils internally" ON
)
elseif(dep STREQUAL "LIBIBERTY")
rocprofiler_systems_add_option(BUILD_LIBIBERTY
"Enable building libiberty internally" ON)
"Enable building libiberty internally" ON
)
endif()
endif()
endforeach()
set(TPL_STAGING_PREFIX
"${PROJECT_BINARY_DIR}/external"
CACHE PATH "Third-party library build-tree install prefix")
CACHE PATH
"Third-party library build-tree install prefix"
)
file(MAKE_DIRECTORY "${TPL_STAGING_PREFIX}")
file(MAKE_DIRECTORY "${TPL_STAGING_PREFIX}/include")
@@ -42,8 +47,9 @@ include(DyninstBoost)
if(TARGET rocprofiler-systems-boost-build)
# Make Boost build serially
set_target_properties(
rocprofiler-systems-boost PROPERTIES JOB_POOL_COMPILE external_deps_pool
JOB_POOL_LINK external_deps_pool)
rocprofiler-systems-boost
PROPERTIES JOB_POOL_COMPILE external_deps_pool JOB_POOL_LINK external_deps_pool
)
# Create a prebuild target that depends on Boost
add_dependencies(external-prebuild rocprofiler-systems-boost-build)
endif()
@@ -52,24 +58,27 @@ include(DyninstTBB)
if(TARGET rocprofiler-systems-tbb-build AND TARGET external-prebuild)
# Make TBB build serially and wait for Boost
set_target_properties(
rocprofiler-systems-tbb-build PROPERTIES JOB_POOL_COMPILE external_deps_pool
JOB_POOL_LINK external_deps_pool)
rocprofiler-systems-tbb-build
PROPERTIES JOB_POOL_COMPILE external_deps_pool JOB_POOL_LINK external_deps_pool
)
add_dependencies(external-prebuild rocprofiler-systems-tbb-build)
endif()
include(DyninstElfUtils)
if(TARGET rocprofiler-systems-elfutils-build AND TARGET external-prebuild)
set_target_properties(
rocprofiler-systems-elfutils-build PROPERTIES JOB_POOL_COMPILE external_deps_pool
JOB_POOL_LINK external_deps_pool)
rocprofiler-systems-elfutils-build
PROPERTIES JOB_POOL_COMPILE external_deps_pool JOB_POOL_LINK external_deps_pool
)
add_dependencies(external-prebuild rocprofiler-systems-elfutils-build)
endif()
include(DyninstLibIberty)
if(TARGET rocprofiler-systems-libiberty-build AND TARGET external-prebuild)
set_target_properties(
rocprofiler-systems-libiberty-build PROPERTIES JOB_POOL_COMPILE external_deps_pool
JOB_POOL_LINK external_deps_pool)
rocprofiler-systems-libiberty-build
PROPERTIES JOB_POOL_COMPILE external_deps_pool JOB_POOL_LINK external_deps_pool
)
add_dependencies(external-prebuild rocprofiler-systems-libiberty-build)
endif()
@@ -86,34 +95,45 @@ endif()
if(NOT TARGET Dyninst::Boost AND TARGET rocprofiler-systems-boost)
add_library(Dyninst::Boost INTERFACE IMPORTED)
set_target_properties(Dyninst::Boost PROPERTIES INTERFACE_LINK_LIBRARIES
rocprofiler-systems-boost)
set_target_properties(
Dyninst::Boost
PROPERTIES INTERFACE_LINK_LIBRARIES rocprofiler-systems-boost
)
message(
STATUS
"Created imported target Dyninst::Boost linked to rocprofiler-systems-boost")
"Created imported target Dyninst::Boost linked to rocprofiler-systems-boost"
)
endif()
if(NOT TARGET Dyninst::ElfUtils AND TARGET rocprofiler-systems-elfutils)
add_library(Dyninst::ElfUtils INTERFACE IMPORTED)
set_target_properties(Dyninst::ElfUtils PROPERTIES INTERFACE_LINK_LIBRARIES
rocprofiler-systems-elfutils)
set_target_properties(
Dyninst::ElfUtils
PROPERTIES INTERFACE_LINK_LIBRARIES rocprofiler-systems-elfutils
)
message(STATUS "Created imported target Dyninst::ElfUtils linked to ElfUtils")
endif()
if(NOT TARGET Dyninst::TBB AND TARGET rocprofiler-systems-tbb)
add_library(Dyninst::TBB INTERFACE IMPORTED)
set_target_properties(Dyninst::TBB PROPERTIES INTERFACE_LINK_LIBRARIES
rocprofiler-systems-tbb)
set_target_properties(
Dyninst::TBB
PROPERTIES INTERFACE_LINK_LIBRARIES rocprofiler-systems-tbb
)
message(
STATUS "Created imported target Dyninst::TBB linked to rocprofiler-systems-tbb")
STATUS
"Created imported target Dyninst::TBB linked to rocprofiler-systems-tbb"
)
endif()
if(NOT TARGET Dyninst::LibIberty AND TARGET rocprofiler-systems-libiberty)
add_library(Dyninst::LibIberty INTERFACE IMPORTED)
set_target_properties(Dyninst::LibIberty PROPERTIES INTERFACE_LINK_LIBRARIES
rocprofiler-systems-libiberty)
set_target_properties(
Dyninst::LibIberty
PROPERTIES INTERFACE_LINK_LIBRARIES rocprofiler-systems-libiberty
)
message(
STATUS
"Created imported target Dyninst::LibIberty linked to rocprofiler-systems-libiberty"
)
"Created imported target Dyninst::LibIberty linked to rocprofiler-systems-libiberty"
)
endif()
+34 -23
Просмотреть файл
@@ -28,14 +28,14 @@ endif()
# -------------- PATHS --------------------------------------------------------
# Base directory the of LibIberty installation
set(LibIberty_ROOT_DIR
"/usr"
CACHE PATH "Base directory the of LibIberty installation")
set(LibIberty_ROOT_DIR "/usr" CACHE PATH "Base directory the of LibIberty installation")
# Hint directory that contains the LibIberty library files
set(LibIberty_LIBRARYDIR
"${LibIberty_ROOT_DIR}/lib"
CACHE PATH "Hint directory that contains the LibIberty library files")
CACHE PATH
"Hint directory that contains the LibIberty library files"
)
# -------------- PACKAGES -----------------------------------------------------
@@ -53,16 +53,18 @@ if(LibIberty_FOUND)
elseif(STERILE_BUILD)
rocprofiler_systems_message(
FATAL_ERROR
"LibIberty not found and cannot be downloaded because build is sterile.")
"LibIberty not found and cannot be downloaded because build is sterile."
)
elseif(NOT BUILD_LIBIBERTY)
rocprofiler_systems_message(
FATAL_ERROR
"LibIberty was not found. Either configure cmake to find TBB properly or set BUILD_LIBIBERTY=ON to download and build"
)
)
else()
rocprofiler_systems_message(STATUS "${LibIberty_ERROR_REASON}")
rocprofiler_systems_message(STATUS
"Attempting to build LibIberty as external project")
"Attempting to build LibIberty as external project"
)
set(_li_root ${TPL_STAGING_PREFIX}/binutils)
set(_li_project_name rocprofiler-systems-libiberty-build)
@@ -70,17 +72,19 @@ else()
set(_li_inc_dirs $<BUILD_INTERFACE:${_li_root}/include>)
set(_li_lib_dirs $<BUILD_INTERFACE:${_li_root}/lib>)
set(_li_libs
$<BUILD_INTERFACE:${_li_root}/lib/libiberty${CMAKE_STATIC_LIBRARY_SUFFIX}>)
$<BUILD_INTERFACE:${_li_root}/lib/libiberty${CMAKE_STATIC_LIBRARY_SUFFIX}>
)
set(_li_build_byproducts "${_li_root}/lib/libiberty${CMAKE_STATIC_LIBRARY_SUFFIX}")
file(MAKE_DIRECTORY "${_li_root}/lib")
file(MAKE_DIRECTORY "${_li_root}/include")
include(ExternalProject)
externalproject_add(
ExternalProject_Add(
${_li_project_name}
PREFIX ${_li_root}
URL ${DYNINST_BINUTILS_DOWNLOAD_URL}
URL
${DYNINST_BINUTILS_DOWNLOAD_URL}
http://ftpmirror.gnu.org/gnu/binutils/binutils-2.42.tar.gz
http://mirrors.kernel.org/sourceware/binutils/releases/binutils-2.42.tar.gz
BUILD_IN_SOURCE 1
@@ -90,14 +94,18 @@ else()
--prefix=${_li_root}
BUILD_COMMAND make
BUILD_BYPRODUCTS ${_li_build_byproducts}
INSTALL_COMMAND "")
INSTALL_COMMAND ""
)
add_custom_command(
TARGET ${_li_project_name}
POST_BUILD
COMMAND install ARGS -C ${_li_working_dir}/libiberty/libiberty.a ${_li_root}/lib
COMMAND install ARGS -C ${_li_working_dir}/include/*.h ${_li_root}/include
COMMENT "Installing LibIberty...")
COMMAND install
ARGS -C ${_li_working_dir}/libiberty/libiberty.a ${_li_root}/lib
COMMAND install
ARGS -C ${_li_working_dir}/include/*.h ${_li_root}/include
COMMENT "Installing LibIberty..."
)
# target for re-executing the installation
add_custom_target(
@@ -105,7 +113,8 @@ else()
COMMAND install -C ${_li_working_dir}/libiberty/libiberty.a ${_li_root}/lib
COMMAND install ARGS -C ${_li_working_dir}/include/*.h ${_li_root}/include
WORKING_DIRECTORY ${_li_working_dir}
COMMENT "Installing LibIberty...")
COMMENT "Installing LibIberty..."
)
# For backward compatibility
set(IBERTY_FOUND TRUE)
@@ -126,16 +135,18 @@ target_link_libraries(rocprofiler-systems-libiberty INTERFACE ${_li_libs})
set(LibIberty_ROOT_DIR
${_li_root}
CACHE PATH "Base directory the of LibIberty installation" FORCE)
CACHE PATH
"Base directory the of LibIberty installation"
FORCE
)
set(LibIberty_INCLUDE_DIRS
${_li_inc_dirs}
CACHE PATH "LibIberty include directories" FORCE)
set(LibIberty_LIBRARY_DIRS
${_li_lib_dirs}
CACHE PATH "LibIberty library directory" FORCE)
set(LibIberty_LIBRARIES
${_li_libs}
CACHE FILEPATH "LibIberty library files" FORCE)
CACHE PATH
"LibIberty include directories"
FORCE
)
set(LibIberty_LIBRARY_DIRS ${_li_lib_dirs} CACHE PATH "LibIberty library directory" FORCE)
set(LibIberty_LIBRARIES ${_li_libs} CACHE FILEPATH "LibIberty library files" FORCE)
# For backward compatibility only
set(IBERTY_LIBRARIES ${LibIberty_LIBRARIES})
+55 -69
Просмотреть файл
@@ -40,9 +40,7 @@ endif()
# -------------- RUNTIME CONFIGURATION ----------------------------------------
# Use debug versions of TBB libraries
set(TBB_USE_DEBUG_BUILD
OFF
CACHE BOOL "Use debug versions of TBB libraries")
set(TBB_USE_DEBUG_BUILD OFF CACHE BOOL "Use debug versions of TBB libraries")
# Minimum version of TBB (assumes a dotted-decimal format: YYYY.XX)
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
@@ -53,31 +51,27 @@ endif()
set(TBB_MIN_VERSION
${_tbb_min_version}
CACHE STRING "Minimum version of TBB (assumes a dotted-decimal format: YYYY.XX)")
CACHE STRING
"Minimum version of TBB (assumes a dotted-decimal format: YYYY.XX)"
)
if(${TBB_MIN_VERSION} VERSION_LESS ${_tbb_min_version})
dyninst_message(
FATAL_ERROR
"Requested TBB version ${TBB_MIN_VERSION} is less than minimum supported version ${_tbb_min_version}"
)
)
endif()
# -------------- PATHS --------------------------------------------------------
# TBB root directory
set(TBB_ROOT_DIR
"/usr"
CACHE PATH "TBB root directory")
set(TBB_ROOT_DIR "/usr" CACHE PATH "TBB root directory")
# TBB include directory hint
set(TBB_INCLUDEDIR
"${TBB_ROOT_DIR}/include"
CACHE INTERNAL "TBB include directory")
set(TBB_INCLUDEDIR "${TBB_ROOT_DIR}/include" CACHE INTERNAL "TBB include directory")
# TBB library directory hint
set(TBB_LIBRARYDIR
"${TBB_ROOT_DIR}/lib"
CACHE INTERNAL "TBB library directory")
set(TBB_LIBRARYDIR "${TBB_ROOT_DIR}/lib" CACHE INTERNAL "TBB library directory")
# Translate to FindTBB names
set(TBB_LIBRARY ${TBB_LIBRARYDIR})
@@ -94,59 +88,49 @@ endif()
if(TBB_FOUND)
# Force the cache entries to be updated Normally, these would not be exported.
# However, we need them in the Testsuite
set(TBB_INCLUDE_DIRS
${TBB_INCLUDE_DIRS}
CACHE PATH "TBB include directory" FORCE)
set(TBB_LIBRARY_DIRS
${TBB_LIBRARY_DIRS}
CACHE PATH "TBB library directory" FORCE)
set(TBB_DEFINITIONS
${TBB_DEFINITIONS}
CACHE STRING "TBB compiler definitions" FORCE)
set(TBB_LIBRARIES
${TBB_LIBRARIES}
CACHE FILEPATH "TBB library files" FORCE)
set(TBB_INCLUDE_DIRS ${TBB_INCLUDE_DIRS} CACHE PATH "TBB include directory" FORCE)
set(TBB_LIBRARY_DIRS ${TBB_LIBRARY_DIRS} CACHE PATH "TBB library directory" FORCE)
set(TBB_DEFINITIONS ${TBB_DEFINITIONS} CACHE STRING "TBB compiler definitions" FORCE)
set(TBB_LIBRARIES ${TBB_LIBRARIES} CACHE FILEPATH "TBB library files" FORCE)
elseif(STERILE_BUILD)
rocprofiler_systems_message(
FATAL_ERROR "TBB not found and cannot be downloaded because build is sterile.")
FATAL_ERROR "TBB not found and cannot be downloaded because build is sterile."
)
elseif(NOT BUILD_TBB)
rocprofiler_systems_message(
FATAL_ERROR
"TBB was not found. Either configure cmake to find TBB properly or set BUILD_TBB=ON to download and build"
)
)
else()
# If we didn't find a suitable version on the system, then download one from the web
rocprofiler_systems_message(STATUS "${ThreadingBuildingBlocks_ERROR_REASON}")
rocprofiler_systems_message(
STATUS "Attempting to build TBB(${TBB_MIN_VERSION}) as external project")
STATUS "Attempting to build TBB(${TBB_MIN_VERSION}) as external project"
)
if(NOT UNIX)
rocprofiler_systems_message(
FATAL_ERROR "Building TBB from source is not supported on this platform")
FATAL_ERROR "Building TBB from source is not supported on this platform"
)
endif()
set(TBB_ROOT_DIR
${TPL_STAGING_PREFIX}/tbb
CACHE PATH "TBB root directory" FORCE)
set(TBB_ROOT_DIR ${TPL_STAGING_PREFIX}/tbb CACHE PATH "TBB root directory" FORCE)
set(_tbb_libraries)
set(_tbb_components_cfg)
set(_tbb_library_dirs $<BUILD_INTERFACE:${TBB_ROOT_DIR}/lib>
$<INSTALL_INTERFACE:${INSTALL_LIB_DIR}/${TPL_INSTALL_LIB_DIR}>)
set(_tbb_library_dirs
$<BUILD_INTERFACE:${TBB_ROOT_DIR}/lib>
$<INSTALL_INTERFACE:${INSTALL_LIB_DIR}/${TPL_INSTALL_LIB_DIR}>
)
set(_tbb_include_dirs
$<BUILD_INTERFACE:${TBB_ROOT_DIR}/include>
$<INSTALL_INTERFACE:${INSTALL_LIB_DIR}/${TPL_INSTALL_INCLUDE_DIR}>)
$<INSTALL_INTERFACE:${INSTALL_LIB_DIR}/${TPL_INSTALL_INCLUDE_DIR}>
)
# Forcibly update the cache variables
set(TBB_INCLUDE_DIRS
"${_tbb_include_dirs}"
CACHE PATH "TBB include directory" FORCE)
set(TBB_LIBRARY_DIRS
"${_tbb_library_dirs}"
CACHE PATH "TBB library directory" FORCE)
set(TBB_DEFINITIONS
""
CACHE STRING "TBB compiler definitions" FORCE)
set(TBB_INCLUDE_DIRS "${_tbb_include_dirs}" CACHE PATH "TBB include directory" FORCE)
set(TBB_LIBRARY_DIRS "${_tbb_library_dirs}" CACHE PATH "TBB library directory" FORCE)
set(TBB_DEFINITIONS "" CACHE STRING "TBB compiler definitions" FORCE)
file(MAKE_DIRECTORY "${TBB_ROOT_DIR}/include")
file(MAKE_DIRECTORY "${TBB_ROOT_DIR}/lib")
@@ -162,23 +146,23 @@ else()
set(_tbb_${c}_lib
$<BUILD_INTERFACE:${TBB_ROOT_DIR}/lib/lib${c}${CMAKE_SHARED_LIBRARY_SUFFIX}>
$<INSTALL_INTERFACE:${c}>)
$<INSTALL_INTERFACE:${c}>
)
# Generate library filenames
list(APPEND _tbb_libraries ${_tbb_${c}_lib})
list(APPEND _tbb_build_byproducts
"${TBB_ROOT_DIR}/lib/lib${c}${CMAKE_SHARED_LIBRARY_SUFFIX}")
list(
APPEND
_tbb_build_byproducts
"${TBB_ROOT_DIR}/lib/lib${c}${CMAKE_SHARED_LIBRARY_SUFFIX}"
)
foreach(t RELEASE DEBUG)
set(TBB_${c}_LIBRARY_${t}
"${_tbb_${c}_lib}"
CACHE FILEPATH "" FORCE)
set(TBB_${c}_LIBRARY_${t} "${_tbb_${c}_lib}" CACHE FILEPATH "" FORCE)
endforeach()
endforeach()
set(TBB_LIBRARIES
"${_tbb_libraries}"
CACHE FILEPATH "TBB library files" FORCE)
set(TBB_LIBRARIES "${_tbb_libraries}" CACHE FILEPATH "TBB library files" FORCE)
# Split the dotted decimal version into major/minor parts
string(REGEX REPLACE "\\." ";" _tbb_download_name ${TBB_MIN_VERSION})
@@ -191,25 +175,23 @@ else()
set(_tbb_compiler "compiler=clang")
endif()
find_program(
MAKE_EXECUTABLE
NAMES make gmake
PATH_SUFFIXES bin)
find_program(MAKE_EXECUTABLE NAMES make gmake PATH_SUFFIXES bin)
if(NOT MAKE_EXECUTABLE AND CMAKE_GENERATOR MATCHES "Ninja")
dyninst_message(
FATAL_ERROR
"make/gmake executable not found. Please re-run with -DMAKE_EXECUTABLE=/path/to/make"
)
)
elseif(NOT MAKE_EXECUTABLE AND CMAKE_GENERATOR MATCHES "Makefiles")
set(MAKE_EXECUTABLE "$(MAKE)")
endif()
include(ExternalProject)
externalproject_add(
ExternalProject_Add(
rocprofiler-systems-tbb-build
PREFIX ${TBB_ROOT_DIR}
URL https://github.com/ajanicijamd/oneTBB/archive/refs/tags/v${_tbb_ver_major}.${_tbb_ver_minor}.01.tar.gz
URL
https://github.com/ajanicijamd/oneTBB/archive/refs/tags/v${_tbb_ver_major}.${_tbb_ver_minor}.01.tar.gz
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ""
BUILD_COMMAND
@@ -218,31 +200,35 @@ else()
${_tbb_components_cfg} tbb_build_dir=${TBB_ROOT_DIR}/src tbb_build_prefix=tbb
${_tbb_compiler}
BUILD_BYPRODUCTS ${_tbb_build_byproducts}
INSTALL_COMMAND "")
INSTALL_COMMAND ""
)
# post-build target for installing build
add_custom_command(
TARGET rocprofiler-systems-tbb-build
POST_BUILD
COMMAND
${CMAKE_COMMAND} ARGS -DLIBDIR=${TBB_LIBRARY_DIRS}
-DINCDIR=${TBB_INCLUDE_DIRS} -DPREFIX=${TBB_ROOT_DIR}
-DCMAKE_STRIP=${CMAKE_STRIP} -P
COMMAND ${CMAKE_COMMAND}
ARGS
-DLIBDIR=${TBB_LIBRARY_DIRS} -DINCDIR=${TBB_INCLUDE_DIRS}
-DPREFIX=${TBB_ROOT_DIR} -DCMAKE_STRIP=${CMAKE_STRIP} -P
${CMAKE_CURRENT_LIST_DIR}/DyninstTBBInstall.cmake
COMMENT "Installing TBB...")
COMMENT "Installing TBB..."
)
add_custom_target(
rocprofiler-systems-tbb-install
COMMAND
${CMAKE_COMMAND} -DLIBDIR=${TBB_LIBRARY_DIRS} -DINCDIR=${TBB_INCLUDE_DIRS}
-DPREFIX=${TBB_ROOT_DIR} -P ${CMAKE_CURRENT_LIST_DIR}/DyninstTBBInstall.cmake
COMMENT "Installing TBB...")
COMMENT "Installing TBB..."
)
install(
DIRECTORY ${TPL_STAGING_PREFIX}/tbb/lib/
DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}
FILES_MATCHING
PATTERN "*${CMAKE_SHARED_LIBRARY_SUFFIX}*")
PATTERN "*${CMAKE_SHARED_LIBRARY_SUFFIX}*"
)
endif()
foreach(_DIR_TYPE INCLUDE LIBRARY)
+6 -3
Просмотреть файл
@@ -20,15 +20,18 @@ file(
COPY ${PREFIX}/src/tbb_release/
DESTINATION ${LIBDIR}
FILES_MATCHING
PATTERN "*.so.*")
PATTERN "*.so.*"
)
file(COPY ${PREFIX}/src/rocprofiler-systems-tbb-build/include/tbb DESTINATION ${INCDIR})
file(GLOB _tbb_libs ${LIBDIR}/libtbb*.so.*)
foreach(_lib ${_tbb_libs})
string(REGEX REPLACE "\\.2$" "" _lib_short ${_lib})
get_filename_component(_lib "${_lib}" NAME)
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${_lib} ${_lib_short}
WORKING_DIRECTORY ${LIBDIR})
execute_process(
COMMAND ${CMAKE_COMMAND} -E create_symlink ${_lib} ${_lib_short}
WORKING_DIRECTORY ${LIBDIR}
)
endforeach()
foreach(_lib ${_tbb_libs})
+42 -23
Просмотреть файл
@@ -13,7 +13,8 @@ macro(ROCPROFILER_SYSTEMS_ACTIVATE_CLANG_TIDY)
rocprofiler_systems_add_feature(CLANG_TIDY_COMMAND "Path to clang-tidy command")
if(NOT CLANG_TIDY_COMMAND)
timemory_message(
WARNING "ROCPROFSYS_USE_CLANG_TIDY is ON but clang-tidy is not found!")
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})
@@ -39,7 +40,7 @@ endmacro()
find_program(ROCPROFSYS_CLANG_FORMAT_EXE NAMES clang-format-18 clang-format)
find_program(ROCPROFSYS_CMAKE_FORMAT_EXE NAMES cmake-format)
find_program(ROCPROFSYS_CMAKE_FORMAT_EXE NAMES gersemi)
find_program(ROCPROFSYS_BLACK_FORMAT_EXE NAMES black)
add_custom_target(format-rocprofiler-systems)
@@ -52,23 +53,38 @@ foreach(_TYPE source python cmake)
endif()
endforeach()
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
${PROJECT_SOURCE_DIR}/source/*.hpp.in ${PROJECT_SOURCE_DIR}/source/*.h
${PROJECT_SOURCE_DIR}/source/*.h.in)
file(GLOB_RECURSE examples ${PROJECT_SOURCE_DIR}/examples/*.cpp
${PROJECT_SOURCE_DIR}/examples/*.c ${PROJECT_SOURCE_DIR}/examples/*.hpp
${PROJECT_SOURCE_DIR}/examples/*.h)
file(GLOB_RECURSE tests_source ${PROJECT_SOURCE_DIR}/tests/source/*.cpp
${PROJECT_SOURCE_DIR}/tests/source/*.hpp)
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
${PROJECT_SOURCE_DIR}/source/*.hpp.in
${PROJECT_SOURCE_DIR}/source/*.h
${PROJECT_SOURCE_DIR}/source/*.h.in
)
file(
GLOB_RECURSE examples
${PROJECT_SOURCE_DIR}/examples/*.cpp
${PROJECT_SOURCE_DIR}/examples/*.c
${PROJECT_SOURCE_DIR}/examples/*.hpp
${PROJECT_SOURCE_DIR}/examples/*.h
)
file(
GLOB_RECURSE tests_source
${PROJECT_SOURCE_DIR}/tests/source/*.cpp
${PROJECT_SOURCE_DIR}/tests/source/*.hpp
)
file(GLOB_RECURSE external ${PROJECT_SOURCE_DIR}/examples/lulesh/external/kokkos/*)
file(
GLOB_RECURSE
cmake_files
GLOB_RECURSE cmake_files
${PROJECT_SOURCE_DIR}/source/*CMakeLists.txt
${PROJECT_SOURCE_DIR}/examples/*CMakeLists.txt
${PROJECT_SOURCE_DIR}/tests/*CMakeLists.txt
@@ -76,7 +92,8 @@ if(ROCPROFSYS_CLANG_FORMAT_EXE
${PROJECT_SOURCE_DIR}/examples/*.cmake
${PROJECT_SOURCE_DIR}/tests/*.cmake
${PROJECT_SOURCE_DIR}/cmake/*.cmake
${PROJECT_SOURCE_DIR}/source/*.cmake)
${PROJECT_SOURCE_DIR}/source/*.cmake
)
list(APPEND cmake_files ${PROJECT_SOURCE_DIR}/CMakeLists.txt)
if(external)
list(REMOVE_ITEM examples ${external})
@@ -90,7 +107,7 @@ if(ROCPROFSYS_CLANG_FORMAT_EXE
${tests_source}
COMMENT
"[rocprofiler-systems] Running C++ formatter ${ROCPROFSYS_CLANG_FORMAT_EXE}..."
)
)
endif()
if(ROCPROFSYS_BLACK_FORMAT_EXE)
@@ -99,7 +116,7 @@ if(ROCPROFSYS_CLANG_FORMAT_EXE
${ROCPROFSYS_BLACK_FORMAT_EXE} -q ${PROJECT_SOURCE_DIR}
COMMENT
"[rocprofiler-systems] Running Python formatter ${ROCPROFSYS_BLACK_FORMAT_EXE}..."
)
)
if(NOT TARGET format-python)
add_custom_target(format-python)
endif()
@@ -111,7 +128,7 @@ if(ROCPROFSYS_CLANG_FORMAT_EXE
${ROCPROFSYS_CMAKE_FORMAT_EXE} -i ${cmake_files}
COMMENT
"[rocprofiler-systems] Running CMake formatter ${ROCPROFSYS_CMAKE_FORMAT_EXE}..."
)
)
if(NOT TARGET format-cmake)
add_custom_target(format-cmake)
endif()
@@ -119,8 +136,10 @@ if(ROCPROFSYS_CLANG_FORMAT_EXE
foreach(_TYPE source python cmake)
if(TARGET format-rocprofiler-systems-${_TYPE})
add_dependencies(format-rocprofiler-systems
format-rocprofiler-systems-${_TYPE})
add_dependencies(
format-rocprofiler-systems
format-rocprofiler-systems-${_TYPE}
)
add_dependencies(format-${_TYPE} format-rocprofiler-systems-${_TYPE})
endif()
endforeach()
+212 -134
Просмотреть файл
@@ -31,7 +31,8 @@ macro(ROCPROFILER_SYSTEMS_SAVE_VARIABLES _PREFIX)
"" # options
"CONDITION" # single value args
"VARIABLES" # multiple value args
${ARGN})
${ARGN}
)
if(DEFINED SAVE_CONDITION AND NOT "${SAVE_CONDITION}" STREQUAL "")
if(${SAVE_CONDITION})
foreach(_VAR ${SAVE_VARIABLES})
@@ -65,7 +66,8 @@ macro(ROCPROFILER_SYSTEMS_RESTORE_VARIABLES _PREFIX)
"" # options
"CONDITION" # single value args
"VARIABLES" # multiple value args
${ARGN})
${ARGN}
)
if(DEFINED RESTORE_CONDITION AND NOT "${RESTORE_CONDITION}" STREQUAL "")
if(${RESTORE_CONDITION})
foreach(_VAR ${RESTORE_VARIABLES})
@@ -102,9 +104,7 @@ function(ROCPROFILER_SYSTEMS_CAPITALIZE str var)
string(TOUPPER "${_first}" _first)
string(SUBSTRING "${str}" 1 -1 _remainder)
string(CONCAT str "${_first}" "${_remainder}")
set(${var}
"${str}"
PARENT_SCOPE)
set(${var} "${str}" PARENT_SCOPE)
endfunction()
# ------------------------------------------------------------------------------#
@@ -122,13 +122,15 @@ function(ROCPROFILER_SYSTEMS_STRIP_TARGET)
else()
rocprofiler_systems_message(
FATAL_ERROR
"rocprofiler_systems_strip_target cannot deduce target from \"${ARGN}\"")
"rocprofiler_systems_strip_target cannot deduce target from \"${ARGN}\""
)
endif()
if(NOT TARGET "${_TARGET}")
rocprofiler_systems_message(
FATAL_ERROR
"rocprofiler_systems_strip_target not provided valid target: \"${_TARGET}\"")
"rocprofiler_systems_strip_target not provided valid target: \"${_TARGET}\""
)
endif()
if(CMAKE_STRIP AND (STRIP_FORCE OR ROCPROFSYS_STRIP_LIBRARIES))
@@ -138,7 +140,8 @@ function(ROCPROFILER_SYSTEMS_STRIP_TARGET)
POST_BUILD
COMMAND ${CMAKE_STRIP} ${STRIP_ARGS} $<TARGET_FILE:${_TARGET}>
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Stripping ${_TARGET}...")
COMMENT "Stripping ${_TARGET}..."
)
else()
add_custom_command(
TARGET ${_TARGET}
@@ -159,7 +162,8 @@ function(ROCPROFILER_SYSTEMS_STRIP_TARGET)
--keep-symbol="OnUnloadTool" --keep-symbol="__libc_start_main"
${STRIP_ARGS} $<TARGET_FILE:${_TARGET}>
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Stripping ${_TARGET}...")
COMMENT "Stripping ${_TARGET}..."
)
endif()
endif()
endfunction()
@@ -187,9 +191,12 @@ endfunction()
function(ROCPROFILER_SYSTEMS_CHECKOUT_GIT_SUBMODULE)
# parse args
cmake_parse_arguments(
CHECKOUT "RECURSIVE"
CHECKOUT
"RECURSIVE"
"RELATIVE_PATH;WORKING_DIRECTORY;TEST_FILE;REPO_URL;REPO_BRANCH"
"ADDITIONAL_CMDS" ${ARGN})
"ADDITIONAL_CMDS"
${ARGN}
)
if(NOT CHECKOUT_WORKING_DIRECTORY)
set(CHECKOUT_WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
@@ -244,15 +251,19 @@ function(ROCPROFILER_SYSTEMS_CHECKOUT_GIT_SUBMODULE)
if(NOT _TEST_FILE_EXISTS AND _SUBMODULE_EXISTS)
# perform the checkout
execute_process(
COMMAND ${GIT_EXECUTABLE} submodule update --init ${_RECURSE}
${CHECKOUT_ADDITIONAL_CMDS} ${CHECKOUT_RELATIVE_PATH}
COMMAND
${GIT_EXECUTABLE} submodule update --init ${_RECURSE}
${CHECKOUT_ADDITIONAL_CMDS} ${CHECKOUT_RELATIVE_PATH}
WORKING_DIRECTORY ${CHECKOUT_WORKING_DIRECTORY}
RESULT_VARIABLE RET)
RESULT_VARIABLE RET
)
# check the return code
if(RET GREATER 0)
set(_CMD "${GIT_EXECUTABLE} submodule update --init ${_RECURSE}
${CHECKOUT_ADDITIONAL_CMDS} ${CHECKOUT_RELATIVE_PATH}")
set(_CMD
"${GIT_EXECUTABLE} submodule update --init ${_RECURSE}
${CHECKOUT_ADDITIONAL_CMDS} ${CHECKOUT_RELATIVE_PATH}"
)
message(STATUS "function(rocprofiler_systems_checkout_git_submodule) failed.")
message(FATAL_ERROR "Command: \"${_CMD}\"")
else()
@@ -262,7 +273,9 @@ function(ROCPROFILER_SYSTEMS_CHECKOUT_GIT_SUBMODULE)
if(NOT _TEST_FILE_EXISTS AND _HAS_REPO_URL)
message(
STATUS "Checking out '${CHECKOUT_REPO_URL}' @ '${CHECKOUT_REPO_BRANCH}'...")
STATUS
"Checking out '${CHECKOUT_REPO_URL}' @ '${CHECKOUT_REPO_BRANCH}'..."
)
# remove the existing directory
if(EXISTS "${_DIR}")
@@ -275,16 +288,16 @@ function(ROCPROFILER_SYSTEMS_CHECKOUT_GIT_SUBMODULE)
${GIT_EXECUTABLE} clone -b ${CHECKOUT_REPO_BRANCH}
${CHECKOUT_ADDITIONAL_CMDS} ${CHECKOUT_REPO_URL} ${CHECKOUT_RELATIVE_PATH}
WORKING_DIRECTORY ${CHECKOUT_WORKING_DIRECTORY}
RESULT_VARIABLE RET)
RESULT_VARIABLE RET
)
# perform the submodule update
if(CHECKOUT_RECURSIVE
AND EXISTS "${_DIR}"
AND IS_DIRECTORY "${_DIR}")
if(CHECKOUT_RECURSIVE AND EXISTS "${_DIR}" AND IS_DIRECTORY "${_DIR}")
execute_process(
COMMAND ${GIT_EXECUTABLE} submodule update --init ${_RECURSE}
WORKING_DIRECTORY ${_DIR}
RESULT_VARIABLE RET)
RESULT_VARIABLE RET
)
endif()
# check the return code
@@ -292,7 +305,7 @@ function(ROCPROFILER_SYSTEMS_CHECKOUT_GIT_SUBMODULE)
set(_CMD
"${GIT_EXECUTABLE} clone -b ${CHECKOUT_REPO_BRANCH}
${CHECKOUT_ADDITIONAL_CMDS} ${CHECKOUT_REPO_URL} ${CHECKOUT_RELATIVE_PATH}"
)
)
message(STATUS "function(rocprofiler_systems_checkout_git_submodule) failed.")
message(FATAL_ERROR "Command: \"${_CMD}\"")
else()
@@ -303,9 +316,9 @@ function(ROCPROFILER_SYSTEMS_CHECKOUT_GIT_SUBMODULE)
if(NOT EXISTS "${_TEST_FILE}" OR NOT _TEST_FILE_EXISTS)
message(
FATAL_ERROR
"Error checking out submodule: '${CHECKOUT_RELATIVE_PATH}' to '${_DIR}'")
"Error checking out submodule: '${CHECKOUT_RELATIVE_PATH}' to '${_DIR}'"
)
endif()
endfunction()
# ----------------------------------------------------------------------------------------#
@@ -315,13 +328,9 @@ function(ROCPROFILER_SYSTEMS_TEST_FIND_PACKAGE PACKAGE_NAME OUTPUT_VAR)
cmake_parse_arguments(PACKAGE "" "" "UNSET" ${ARGN})
find_package(${PROJECT_NAME} QUIET ${PACKAGE_UNPARSED_ARGUMENTS})
if(NOT ${PROJECT_NAME}_FOUND)
set(${OUTPUT_VAR}
OFF
PARENT_SCOPE)
set(${OUTPUT_VAR} OFF PARENT_SCOPE)
else()
set(${OUTPUT_VAR}
ON
PARENT_SCOPE)
set(${OUTPUT_VAR} ON PARENT_SCOPE)
endif()
foreach(_ARG ${PACKAGE_UNSET} FIND_PACKAGE_MESSAGE_DETAILS_${PROJECT_NAME})
unset(${_ARG} CACHE)
@@ -339,10 +348,16 @@ macro(ROCPROFILER_SYSTEMS_ADD_INTERFACE_LIBRARY _TARGET)
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT core
EXPORT ${PROJECT_NAME}-interface-targets
OPTIONAL)
OPTIONAL
)
if(NOT "${ARGN}" STREQUAL "")
set_property(GLOBAL APPEND PROPERTY ${PROJECT_NAME}_CMAKE_INTERFACE_DOC
"${PROJECT_NAME}::${_TARGET}` | ${ARGN} |")
set_property(
GLOBAL
APPEND
PROPERTY
${PROJECT_NAME}_CMAKE_INTERFACE_DOC
"${PROJECT_NAME}::${_TARGET}` | ${ARGN} |"
)
endif()
endmacro()
@@ -354,10 +369,12 @@ endmacro()
function(ROCPROFILER_SYSTEMS_ADD_FEATURE _var _description)
set(EXTRA_DESC "")
foreach(currentArg ${ARGN})
if(NOT "${currentArg}" STREQUAL "${_var}"
AND NOT "${currentArg}" STREQUAL "${_description}"
AND NOT "${currentArg}" STREQUAL "CMAKE_DEFINE"
AND NOT "${currentArg}" STREQUAL "DOC")
if(
NOT "${currentArg}" STREQUAL "${_var}"
AND NOT "${currentArg}" STREQUAL "${_description}"
AND NOT "${currentArg}" STREQUAL "CMAKE_DEFINE"
AND NOT "${currentArg}" STREQUAL "DOC"
)
set(EXTRA_DESC "${EXTA_DESC}${currentArg}")
endif()
endforeach()
@@ -366,16 +383,28 @@ function(ROCPROFILER_SYSTEMS_ADD_FEATURE _var _description)
set_property(GLOBAL PROPERTY ${_var}_DESCRIPTION "${_description}${EXTRA_DESC}")
if("CMAKE_DEFINE" IN_LIST ARGN)
set_property(GLOBAL APPEND PROPERTY ${PROJECT_NAME}_CMAKE_DEFINES
"${_var} @${_var}@")
set_property(
GLOBAL
APPEND
PROPERTY ${PROJECT_NAME}_CMAKE_DEFINES "${_var} @${_var}@"
)
if(ROCPROFSYS_BUILD_DOCS)
set_property(
GLOBAL APPEND PROPERTY ${PROJECT_NAME}_CMAKE_OPTIONS_DOC
"${_var}` | ${_description}${EXTRA_DESC} |")
GLOBAL
APPEND
PROPERTY
${PROJECT_NAME}_CMAKE_OPTIONS_DOC
"${_var}` | ${_description}${EXTRA_DESC} |"
)
endif()
elseif("DOC" IN_LIST ARGN AND ROCPROFSYS_BUILD_DOCS)
set_property(GLOBAL APPEND PROPERTY ${PROJECT_NAME}_CMAKE_OPTIONS_DOC
"${_var}` | ${_description}${EXTRA_DESC} |")
set_property(
GLOBAL
APPEND
PROPERTY
${PROJECT_NAME}_CMAKE_OPTIONS_DOC
"${_var}` | ${_description}${EXTRA_DESC} |"
)
endif()
endfunction()
@@ -390,8 +419,11 @@ function(ROCPROFILER_SYSTEMS_ADD_OPTION _NAME _MESSAGE _DEFAULT)
else()
rocprofiler_systems_add_feature(${_NAME} "${_MESSAGE}")
if(ROCPROFSYS_BUILD_DOCS)
set_property(GLOBAL APPEND PROPERTY ${PROJECT_NAME}_CMAKE_OPTIONS_DOC
"${_NAME}` | ${_MESSAGE} |")
set_property(
GLOBAL
APPEND
PROPERTY ${PROJECT_NAME}_CMAKE_OPTIONS_DOC "${_NAME}` | ${_MESSAGE} |"
)
endif()
endif()
if("ADVANCED" IN_LIST ARGN)
@@ -412,9 +444,7 @@ function(ROCPROFILER_SYSTEMS_ADD_CACHE_OPTION _NAME _MESSAGE _TYPE _DEFAULT)
set(_FORCE FORCE)
endif()
set(${_NAME}
"${_DEFAULT}"
CACHE ${_TYPE} "${_MESSAGE}" ${_FORCE})
set(${_NAME} "${_DEFAULT}" CACHE ${_TYPE} "${_MESSAGE}" ${_FORCE})
if("NO_FEATURE" IN_LIST ARGN)
mark_as_advanced(${_NAME})
@@ -422,8 +452,11 @@ function(ROCPROFILER_SYSTEMS_ADD_CACHE_OPTION _NAME _MESSAGE _TYPE _DEFAULT)
rocprofiler_systems_add_feature(${_NAME} "${_MESSAGE}")
if(ROCPROFSYS_BUILD_DOCS)
set_property(GLOBAL APPEND PROPERTY ${PROJECT_NAME}_CMAKE_OPTIONS_DOC
"${_NAME}` | ${_MESSAGE} |")
set_property(
GLOBAL
APPEND
PROPERTY ${PROJECT_NAME}_CMAKE_OPTIONS_DOC "${_NAME}` | ${_MESSAGE} |"
)
endif()
endif()
@@ -473,13 +506,21 @@ function(ROCPROFILER_SYSTEMS_PRINT_ENABLED_FEATURES)
get_property(_desc GLOBAL PROPERTY ${_feature}_DESCRIPTION)
# print description, if not standard ON/OFF, print what is set to
if(_desc)
if(NOT "${${_feature}}" STREQUAL "ON" AND NOT "${${_feature}}" STREQUAL
"TRUE")
if(
NOT "${${_feature}}" STREQUAL "ON"
AND NOT "${${_feature}}" STREQUAL "TRUE"
)
set(_currentFeatureText
"${_currentFeatureText}: ${_desc} -- [\"${${_feature}}\"]")
"${_currentFeatureText}: ${_desc} -- [\"${${_feature}}\"]"
)
else()
string(REGEX REPLACE "^${PROJECT_NAME}_USE_" "" _feature_tmp
"${_feature}")
string(
REGEX REPLACE
"^${PROJECT_NAME}_USE_"
""
_feature_tmp
"${_feature}"
)
string(TOLOWER "${_feature_tmp}" _feature_tmp_l)
rocprofiler_systems_capitalize("${_feature_tmp}" _feature_tmp_c)
foreach(_var _feature _feature_tmp _feature_tmp_l _feature_tmp_c)
@@ -548,8 +589,13 @@ endfunction()
# a project/subproject
#
function(rocprofiler_systems_custom_compilation)
cmake_parse_arguments(COMP "GLOBAL;PROJECT" "COMPILER" "DIRECTORY;TARGET;SOURCE"
${ARGN})
cmake_parse_arguments(
COMP
"GLOBAL;PROJECT"
"COMPILER"
"DIRECTORY;TARGET;SOURCE"
${ARGN}
)
# find rocprof-sys-launch-compiler
find_program(
@@ -557,20 +603,23 @@ function(rocprofiler_systems_custom_compilation)
NAMES rocprof-sys-launch-compiler
HINTS ${PROJECT_SOURCE_DIR} ${CMAKE_SOURCE_DIR}
PATHS ${PROJECT_SOURCE_DIR} ${CMAKE_SOURCE_DIR}
PATH_SUFFIXES scripts bin)
PATH_SUFFIXES scripts bin
)
message(STATUS "rocprof_sys_compile_launcher: ${ROCPROFSYS_COMPILE_LAUNCHER}")
if(NOT COMP_COMPILER)
message(
FATAL_ERROR "rocprof_sys_custom_compilation not provided COMPILER argument")
FATAL_ERROR
"rocprof_sys_custom_compilation not provided COMPILER argument"
)
endif()
if(NOT ROCPROFSYS_COMPILE_LAUNCHER)
message(
FATAL_ERROR
"rocprofiler-systems could not find 'rocprof-sys-launch-compiler'. Please set '-DROCPROFSYS_COMPILE_LAUNCHER=/path/to/launcher'"
)
"rocprofiler-systems could not find 'rocprof-sys-launch-compiler'. Please set '-DROCPROFSYS_COMPILE_LAUNCHER=/path/to/launcher'"
)
endif()
if(COMP_GLOBAL)
@@ -579,12 +628,14 @@ function(rocprofiler_systems_custom_compilation)
GLOBAL
PROPERTY
RULE_LAUNCH_COMPILE
"${ROCPROFSYS_COMPILE_LAUNCHER} ${COMP_COMPILER} ${CMAKE_CXX_COMPILER}")
"${ROCPROFSYS_COMPILE_LAUNCHER} ${COMP_COMPILER} ${CMAKE_CXX_COMPILER}"
)
set_property(
GLOBAL
PROPERTY
RULE_LAUNCH_LINK
"${ROCPROFSYS_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.
@@ -597,17 +648,19 @@ function(rocprofiler_systems_custom_compilation)
if(COMP_${_TYPE})
foreach(_VAL ${COMP_${_TYPE}})
set_property(
${_TYPE} ${_VAL}
${_TYPE}
${_VAL}
PROPERTY
RULE_LAUNCH_COMPILE
"${ROCPROFSYS_COMPILE_LAUNCHER} ${COMP_COMPILER} ${CMAKE_CXX_COMPILER}"
)
"${ROCPROFSYS_COMPILE_LAUNCHER} ${COMP_COMPILER} ${CMAKE_CXX_COMPILER}"
)
set_property(
${_TYPE} ${_VAL}
${_TYPE}
${_VAL}
PROPERTY
RULE_LAUNCH_LINK
"${ROCPROFSYS_COMPILE_LAUNCHER} ${COMP_COMPILER} ${CMAKE_CXX_COMPILER}"
)
"${ROCPROFSYS_COMPILE_LAUNCHER} ${COMP_COMPILER} ${CMAKE_CXX_COMPILER}"
)
endforeach()
endif()
endforeach()
@@ -624,9 +677,7 @@ function(ROCPROFILER_SYSTEMS_WATCH_FOR_CHANGE _var)
macro(update_var _VAL)
if(_VAR)
set(${_VAR}
${_VAL}
PARENT_SCOPE)
set(${_VAR} ${_VAL} PARENT_SCOPE)
endif()
endmacro()
@@ -640,7 +691,7 @@ function(ROCPROFILER_SYSTEMS_WATCH_FOR_CHANGE _var)
rocprofiler_systems_message(
STATUS
"${_var} changed :: ${${_rocprofiler_systems_watch_var_name}} --> ${${_var}}"
)
)
update_var(ON)
endif()
else()
@@ -653,24 +704,33 @@ function(ROCPROFILER_SYSTEMS_WATCH_FOR_CHANGE _var)
# store the value for the next run
set(${_rocprofiler_systems_watch_var_name}
"${${_var}}"
CACHE INTERNAL "Last value of ${_var}" FORCE)
CACHE INTERNAL
"Last value of ${_var}"
FORCE
)
endfunction()
function(ROCPROFILER_SYSTEMS_DIRECTORY)
cmake_parse_arguments(F "MKDIR;FAIL;FORCE" "PREFIX;OUTPUT_VARIABLE;WORKING_DIRECTORY"
"PATHS" ${ARGN})
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)
rocprofiler_systems_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()
rocprofiler_systems_message(
FATAL_ERROR
"PREFIX was specified but it is not an absolute path: ${F_PREFIX}")
"PREFIX was specified but it is not an absolute path: ${F_PREFIX}"
)
endif()
endif()
@@ -693,27 +753,29 @@ function(ROCPROFILER_SYSTEMS_DIRECTORY)
rocprofiler_systems_message(FATAL_ERROR "Directory '${_PATH}' does not exist")
elseif(NOT IS_DIRECTORY "${_PATH}" AND F_FAIL)
rocprofiler_systems_message(FATAL_ERROR
"'${_PATH}' exists but is not a directory")
"'${_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})
elseif(
EXISTS "${_PATH}"
AND NOT IS_DIRECTORY "${_PATH}"
AND F_MKDIR)
execute_process(
COMMAND ${CMAKE_COMMAND} -E make_directory ${_PATH}
WORKING_DIRECTORY ${F_WORKING_DIRECTORY}
)
elseif(EXISTS "${_PATH}" AND NOT IS_DIRECTORY "${_PATH}" AND F_MKDIR)
if(F_FORCE)
execute_process(COMMAND ${CMAKE_COMMAND} -E rm ${_PATH}
WORKING_DIRECTORY ${F_WORKING_DIRECTORY})
execute_process(
COMMAND ${CMAKE_COMMAND} -E rm ${_PATH}
WORKING_DIRECTORY ${F_WORKING_DIRECTORY}
)
endif()
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${_PATH}
WORKING_DIRECTORY ${F_WORKING_DIRECTORY})
execute_process(
COMMAND ${CMAKE_COMMAND} -E make_directory ${_PATH}
WORKING_DIRECTORY ${F_WORKING_DIRECTORY}
)
endif()
endforeach()
if(F_OUTPUT_VARIABLE)
set(${F_OUTPUT_VARIABLE}
"${_OUTPUT_VAR}"
PARENT_SCOPE)
set(${F_OUTPUT_VARIABLE} "${_OUTPUT_VAR}" PARENT_SCOPE)
endif()
endfunction()
@@ -728,16 +790,12 @@ function(ROCPROFILER_SYSTEMS_CHECK_PYTHON_DIRS_AND_VERSIONS)
else()
set(_RET 0)
if(F_OUTPUT_VARIABLE)
set(${F_OUTPUT_VARIABLE}
${_NUM_PYTHON_VERSIONS}
PARENT_SCOPE)
set(${F_OUTPUT_VARIABLE} ${_NUM_PYTHON_VERSIONS} PARENT_SCOPE)
endif()
endif()
if(F_RESULT_VARIABLE)
set(${F_RESULT_VARIABLE}
${_RET}
PARENT_SCOPE)
set(${F_RESULT_VARIABLE} ${_RET} PARENT_SCOPE)
endif()
if(NOT ${_RET} EQUAL 0)
@@ -745,14 +803,15 @@ function(ROCPROFILER_SYSTEMS_CHECK_PYTHON_DIRS_AND_VERSIONS)
rocprofiler_systems_message(
WARNING
"Error! Number of python versions : ${_NUM_PYTHON_VERSIONS}. VERSIONS :: ${ROCPROFSYS_PYTHON_VERSIONS}"
)
)
rocprofiler_systems_message(
WARNING
"Error! Number of python root directories : ${_NUM_PYTHON_ROOT_DIRS}. ROOT DIRS :: ${ROCPROFSYS_PYTHON_ROOT_DIRS}"
)
)
rocprofiler_systems_message(
FATAL_ERROR
"Error! Number of python versions != number of python root directories")
"Error! Number of python versions != number of python root directories"
)
elseif(F_UNSET)
unset(ROCPROFSYS_PYTHON_VERSIONS CACHE)
unset(ROCPROFSYS_PYTHON_ROOT_DIRS CACHE)
@@ -776,46 +835,59 @@ function(ROCPROFILER_SYSTEMS_PYTHON_CONSOLE_SCRIPT SCRIPT_NAME SCRIPT_SUBMODULE)
set(Python3_ROOT_DIR "${ARG_ROOT_DIR}")
find_package(Python3 ${ARG_VERSION} EXACT QUIET MODULE COMPONENTS Interpreter)
set(PYTHON_EXECUTABLE "${Python3_EXECUTABLE}")
configure_file(${PROJECT_SOURCE_DIR}/cmake/Templates/console-script.in
${PROJECT_BINARY_DIR}/bin/${SCRIPT_NAME}-${ARG_VERSION} @ONLY)
configure_file(
${PROJECT_SOURCE_DIR}/cmake/Templates/console-script.in
${PROJECT_BINARY_DIR}/bin/${SCRIPT_NAME}-${ARG_VERSION}
@ONLY
)
if(CMAKE_INSTALL_PYTHONDIR)
install(
PROGRAMS ${PROJECT_BINARY_DIR}/bin/${SCRIPT_NAME}-${ARG_VERSION}
DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT python
OPTIONAL)
OPTIONAL
)
endif()
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
WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
)
set_tests_properties(
${SCRIPT_NAME}-console-script-test-${ARG_VERSION}
PROPERTIES LABELS "python;python-${ARG_VERSION};console-script")
PROPERTIES LABELS "python;python-${ARG_VERSION};console-script"
)
add_test(
NAME ${SCRIPT_NAME}-generic-console-script-test-${ARG_VERSION}
COMMAND ${PROJECT_BINARY_DIR}/bin/${SCRIPT_NAME} --help
WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
)
set_tests_properties(
${SCRIPT_NAME}-generic-console-script-test-${ARG_VERSION}
PROPERTIES ENVIRONMENT "PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}" LABELS
"python;python-${ARG_VERSION};console-script")
PROPERTIES
ENVIRONMENT "PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}"
LABELS "python;python-${ARG_VERSION};console-script"
)
endif()
else()
set(PYTHON_EXECUTABLE "python3")
configure_file(${PROJECT_SOURCE_DIR}/cmake/Templates/console-script.in
${PROJECT_BINARY_DIR}/bin/${SCRIPT_NAME} @ONLY)
configure_file(
${PROJECT_SOURCE_DIR}/cmake/Templates/console-script.in
${PROJECT_BINARY_DIR}/bin/${SCRIPT_NAME}
@ONLY
)
if(CMAKE_INSTALL_PYTHONDIR)
install(
PROGRAMS ${PROJECT_BINARY_DIR}/bin/${SCRIPT_NAME}
DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT python
OPTIONAL)
OPTIONAL
)
endif()
endif()
endfunction()
@@ -837,8 +909,12 @@ function(ROCPROFILER_SYSTEMS_BUILDTREE_TPL _TPL_TARGET _NEW_NAME _BUILD_TREE_DIR
set(_TPL_PREFIX ${CMAKE_SHARED_LIBRARY_PREFIX})
set(_TPL_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX})
foreach(_TAIL ${_TPL_SUFFIX} ${_TPL_SUFFIX}.${_TPL_SOVERSION}
${_TPL_SUFFIX}.${_TPL_VERSION})
foreach(
_TAIL
${_TPL_SUFFIX}
${_TPL_SUFFIX}.${_TPL_SOVERSION}
${_TPL_SUFFIX}.${_TPL_VERSION}
)
set(_INP ${_TPL_PREFIX}${_TPL_NAME}${_TAIL})
set(_OUT ${_TPL_PREFIX}${_NEW_NAME}${_TAIL})
endforeach()
@@ -847,7 +923,8 @@ function(ROCPROFILER_SYSTEMS_BUILDTREE_TPL _TPL_TARGET _NEW_NAME _BUILD_TREE_DIR
# build tree symbolic links
add_custom_target(
${_NEW_NAME}-build-tree-library${_TAIL} ALL
${_NEW_NAME}-build-tree-library${_TAIL}
ALL
${CMAKE_COMMAND} -E create_symlink $<TARGET_FILE:${_TPL_TARGET}>
${_TPL_PREFIX}${_NEW_NAME}${_TPL_SUFFIX}.${_TPL_VERSION}
COMMAND
@@ -860,7 +937,8 @@ function(ROCPROFILER_SYSTEMS_BUILDTREE_TPL _TPL_TARGET _NEW_NAME _BUILD_TREE_DIR
${_BUILD_TREE_DIR}/${_TPL_PREFIX}${_NEW_NAME}${_TPL_SUFFIX}
WORKING_DIRECTORY ${_BUILD_TREE_DIR}
DEPENDS ${_TPL_TARGET}
COMMENT "Creating ${_NEW_NAME} from ${_TPL_TARGET}...")
COMMENT "Creating ${_NEW_NAME} from ${_TPL_TARGET}..."
)
endfunction()
function(ROCPROFILER_SYSTEMS_INSTALL_TPL _TPL_TARGET _NEW_NAME _BUILD_TREE_DIR _COMPONENT)
@@ -870,29 +948,35 @@ function(ROCPROFILER_SYSTEMS_INSTALL_TPL _TPL_TARGET _NEW_NAME _BUILD_TREE_DIR _
set(_TPL_PREFIX ${CMAKE_SHARED_LIBRARY_PREFIX})
set(_TPL_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX})
foreach(_TAIL ${_TPL_SUFFIX} ${_TPL_SUFFIX}.${_TPL_SOVERSION}
${_TPL_SUFFIX}.${_TPL_VERSION})
foreach(
_TAIL
${_TPL_SUFFIX}
${_TPL_SUFFIX}.${_TPL_SOVERSION}
${_TPL_SUFFIX}.${_TPL_VERSION}
)
set(_INP ${_TPL_PREFIX}${_TPL_NAME}${_TAIL})
set(_OUT ${_TPL_PREFIX}${_NEW_NAME}${_TAIL})
endforeach()
# build tree symbolic links
rocprofiler_systems_buildtree_tpl("${_TPL_TARGET}" "${_NEW_NAME}"
"${_BUILD_TREE_DIR}" ${ARGN})
"${_BUILD_TREE_DIR}" ${ARGN}
)
install(
FILES $<TARGET_FILE:${_TPL_TARGET}>
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT ${_COMPONENT}
RENAME ${_TPL_PREFIX}${_NEW_NAME}${_TPL_SUFFIX}.${_TPL_VERSION})
RENAME ${_TPL_PREFIX}${_NEW_NAME}${_TPL_SUFFIX}.${_TPL_VERSION}
)
install(
FILES
${_BUILD_TREE_DIR}/${_TPL_PREFIX}${_NEW_NAME}${_TPL_SUFFIX}.${_TPL_SOVERSION}
${_BUILD_TREE_DIR}/${_TPL_PREFIX}${_NEW_NAME}${_TPL_SUFFIX}
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT ${_COMPONENT})
COMPONENT ${_COMPONENT}
)
endfunction()
function(COMPUTE_POW2_CEIL _OUTPUT _VALUE)
@@ -906,23 +990,17 @@ function(COMPUTE_POW2_CEIL _OUTPUT _VALUE)
RESULT_VARIABLE _POW2_RET
OUTPUT_VARIABLE _POW2_OUT
ERROR_VARIABLE _POW2_ERR
OUTPUT_STRIP_TRAILING_WHITESPACE)
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(_POW2_RET EQUAL 0)
set(${_OUTPUT}
${_POW2_OUT}
PARENT_SCOPE)
set(${_OUTPUT} ${_POW2_OUT} PARENT_SCOPE)
else()
set(${_OUTPUT}
"-1"
PARENT_SCOPE)
set(${_OUTPUT} "-1" PARENT_SCOPE)
endif()
else()
set(${_OUTPUT}
"-1"
PARENT_SCOPE)
set(${_OUTPUT} "-1" PARENT_SCOPE)
endif()
endfunction()
cmake_policy(POP)
Разница между файлами не показана из-за своего большого размера Загрузить разницу
+27 -26
Просмотреть файл
@@ -61,29 +61,21 @@ if(PC_LIBDW_FOUND)
pkg_get_variable(PC_LIBDW_INCLUDE_DIRS libdw includedir)
endif()
set(LibDW_INCLUDE_DIRS
${PC_LIBDW_INCLUDE_DIRS}
CACHE PATH "")
set(LibDW_LIBRARIES
${PC_LIBDW_LINK_LIBRARIES}
CACHE PATH "")
set(LibDW_VERSION
${PC_LIBDW_VERSION}
CACHE STRING "")
set(LibDW_INCLUDE_DIRS ${PC_LIBDW_INCLUDE_DIRS} CACHE PATH "")
set(LibDW_LIBRARIES ${PC_LIBDW_LINK_LIBRARIES} CACHE PATH "")
set(LibDW_VERSION ${PC_LIBDW_VERSION} CACHE STRING "")
else()
find_path(
LibDW_INCLUDE_DIRS
NAMES libdw.h
PATH_SUFFIXES elfutils ${_find_path_args})
find_path(LibDW_INCLUDE_DIRS NAMES libdw.h PATH_SUFFIXES elfutils ${_find_path_args})
find_library(
LibDW_LIBRARIES
NAMES libdw dw
PATH_SUFFIXES elfutils ${_find_path_args})
find_library(LibDW_LIBRARIES NAMES libdw dw PATH_SUFFIXES elfutils ${_find_path_args})
if(EXISTS "${LibDW_INCLUDE_DIRS}/version.h")
file(STRINGS "${LibDW_INCLUDE_DIRS}/version.h" _version_line
REGEX "^#define _ELFUTILS_VERSION[ \t]+[0-9]+")
file(
STRINGS
"${LibDW_INCLUDE_DIRS}/version.h"
_version_line
REGEX "^#define _ELFUTILS_VERSION[ \t]+[0-9]+"
)
string(REGEX MATCH "[0-9]+" _version "${_version_line}")
if(NOT "x${_version}" STREQUAL "x")
set(LibDW_VERSION "0.${_version}")
@@ -98,7 +90,8 @@ find_package_handle_standard_args(
LibDW
FOUND_VAR LibDW_FOUND
REQUIRED_VARS LibDW_LIBRARIES LibDW_INCLUDE_DIRS
VERSION_VAR LibDW_VERSION)
VERSION_VAR LibDW_VERSION
)
if(LibDW_FOUND)
mark_as_advanced(LibDW_INCLUDE_DIRS)
@@ -120,21 +113,29 @@ if(LibDW_FOUND)
if(NOT TARGET LibDW::LibDW)
add_library(LibDW::LibDW UNKNOWN IMPORTED)
set_target_properties(LibDW::LibDW PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
"${LibDW_INCLUDE_DIRS}")
set_target_properties(
LibDW::LibDW
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${LibDW_INCLUDE_DIRS}"
)
if(NOT "x${_link_libs}" STREQUAL "x")
set_target_properties(
LibDW::LibDW PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LINK_DEPENDENT_LIBRARIES "${_link_libs}")
LibDW::LibDW
PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LINK_DEPENDENT_LIBRARIES "${_link_libs}"
)
set(LibDW_LIBRARIES ${_libdw})
unset(_libdw)
unset(_link_libs)
endif()
set_target_properties(
LibDW::LibDW PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${LibDW_LIBRARIES}")
LibDW::LibDW
PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${LibDW_LIBRARIES}"
)
endif()
endif()
+20 -17
Просмотреть файл
@@ -61,29 +61,29 @@ if(PC_LIBDEBUGINFOD_FOUND)
pkg_get_variable(PC_LIBDEBUGINFOD_INCLUDE_DIRS libdebuginfod includedir)
endif()
set(LibDebuginfod_INCLUDE_DIRS
${PC_LIBDEBUGINFOD_INCLUDE_DIRS}
CACHE PATH "")
set(LibDebuginfod_LIBRARIES
${PC_LIBDEBUGINFOD_LINK_LIBRARIES}
CACHE PATH "")
set(LibDebuginfod_VERSION
${PC_LIBDEBUGINFOD_VERSION}
CACHE STRING "")
set(LibDebuginfod_INCLUDE_DIRS ${PC_LIBDEBUGINFOD_INCLUDE_DIRS} CACHE PATH "")
set(LibDebuginfod_LIBRARIES ${PC_LIBDEBUGINFOD_LINK_LIBRARIES} CACHE PATH "")
set(LibDebuginfod_VERSION ${PC_LIBDEBUGINFOD_VERSION} CACHE STRING "")
else()
find_path(
LibDebuginfod_INCLUDE_DIRS
NAMES debuginfod.h
PATH_SUFFIXES elfutils ${_find_path_args})
PATH_SUFFIXES elfutils ${_find_path_args}
)
find_library(
LibDebuginfod_LIBRARIES
NAMES libdebuginfod debuginfod
PATH_SUFFIXES elfutils ${_find_path_args})
PATH_SUFFIXES elfutils ${_find_path_args}
)
if(EXISTS "${LibDebuginfod_INCLUDE_DIRS}/version.h")
file(STRINGS "${LibDebuginfod_INCLUDE_DIRS}/version.h" _version_line
REGEX "^#define _ELFUTILS_VERSION[ \t]+[0-9]+")
file(
STRINGS
"${LibDebuginfod_INCLUDE_DIRS}/version.h"
_version_line
REGEX "^#define _ELFUTILS_VERSION[ \t]+[0-9]+"
)
string(REGEX MATCH "[0-9]+" _version "${_version_line}")
if(NOT "x${_version}" STREQUAL "x")
set(LibDebuginfod_VERSION "0.${_version}")
@@ -98,7 +98,8 @@ find_package_handle_standard_args(
LibDebuginfod
FOUND_VAR LibDebuginfod_FOUND
REQUIRED_VARS LibDebuginfod_LIBRARIES LibDebuginfod_INCLUDE_DIRS
VERSION_VAR LibDebuginfod_VERSION)
VERSION_VAR LibDebuginfod_VERSION
)
if(LibDebuginfod_FOUND)
mark_as_advanced(LibDebuginfod_INCLUDE_DIR)
@@ -109,9 +110,11 @@ if(LibDebuginfod_FOUND)
add_library(LibDebuginfod::LibDebuginfod UNKNOWN IMPORTED)
set_target_properties(
LibDebuginfod::LibDebuginfod
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${LibDebuginfod_INCLUDE_DIRS}"
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${LibDebuginfod_LIBRARIES}")
PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${LibDebuginfod_INCLUDE_DIRS}"
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${LibDebuginfod_LIBRARIES}"
)
endif()
endif()
+6 -3
Просмотреть файл
@@ -33,14 +33,16 @@ find_path(
HINTS ${LibDwarf_ROOT_DIR}/include ${LibDwarf_ROOT_DIR} ${LibDwarf_INCLUDEDIR}
PATHS ${DYNINST_SYSTEM_INCLUDE_PATHS}
PATH_SUFFIXES ${_path_suffixes}
DOC "libdw include directories")
DOC "libdw include directories"
)
find_library(
LibDwarf_LIBRARIES
NAMES libdw.so.1 libdw.so
HINTS ${LibDwarf_ROOT_DIR}/lib ${LibDwarf_ROOT_DIR} ${LibDwarf_LIBRARYDIR}
PATHS ${DYNINST_SYSTEM_LIBRARY_PATHS}
PATH_SUFFIXES ${_path_suffixes})
PATH_SUFFIXES ${_path_suffixes}
)
# Find the library with the highest version
set(_max_ver 0.0)
@@ -67,7 +69,8 @@ find_package_handle_standard_args(
LibDwarf
FOUND_VAR LibDwarf_FOUND
REQUIRED_VARS LibDwarf_LIBRARIES LibDwarf_INCLUDE_DIR
VERSION_VAR LibDwarf_VERSION)
VERSION_VAR LibDwarf_VERSION
)
# Export cache variables
if(LibDwarf_FOUND)
+6 -3
Просмотреть файл
@@ -35,14 +35,16 @@ find_path(
HINTS ${LibElf_ROOT_DIR}/include ${LibElf_ROOT_DIR} ${LibElf_INCLUDEDIR}
PATHS ${DYNINST_SYSTEM_INCLUDE_PATHS}
PATH_SUFFIXES ${_path_suffixes}
DOC "libelf include directories")
DOC "libelf include directories"
)
find_library(
LibElf_LIBRARIES
NAMES libelf.so.1 libelf.so
HINTS ${LibElf_ROOT_DIR}/lib ${LibElf_ROOT_DIR} ${LibElf_LIBRARYDIR}
PATHS ${DYNINST_SYSTEM_LIBRARY_PATHS}
PATH_SUFFIXES ${_path_suffixes})
PATH_SUFFIXES ${_path_suffixes}
)
# Find the library with the highest version
set(_max_ver 0.0)
@@ -69,7 +71,8 @@ find_package_handle_standard_args(
LibElf
FOUND_VAR LibElf_FOUND
REQUIRED_VARS LibElf_LIBRARIES LibElf_INCLUDE_DIR
VERSION_VAR LibElf_VERSION)
VERSION_VAR LibElf_VERSION
)
# Export cache variables
if(LibElf_FOUND)
+6 -3
Просмотреть файл
@@ -44,7 +44,8 @@ find_path(
HINTS ${LibIberty_ROOT_DIR} ${LibIberty_ROOT_DIR}/include ${LibIberty_INCLUDEDIR}
PATHS ${DYNINST_SYSTEM_INCLUDE_PATHS}
PATH_SUFFIXES ${_path_suffixes}
DOC "LibIberty include directories")
DOC "LibIberty include directories"
)
# iberty_pic is for Debian <= wheezy
find_library(
@@ -52,13 +53,15 @@ find_library(
NAMES iberty_pic iberty
HINTS ${LibIberty_ROOT_DIR} ${LibIberty_LIBRARYDIR} ${IBERTY_LIBRARIES}
PATHS ${DYNINST_SYSTEM_LIBRARY_PATHS}
PATH_SUFFIXES ${_path_suffixes})
PATH_SUFFIXES ${_path_suffixes}
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
LibIberty
FOUND_VAR LibIberty_FOUND
REQUIRED_VARS LibIberty_INCLUDE_DIRS LibIberty_LIBRARIES)
REQUIRED_VARS LibIberty_INCLUDE_DIRS LibIberty_LIBRARIES
)
# For backwards compatibility only
set(IBERTY_FOUND ${LibIberty_FOUND})
+17 -7
Просмотреть файл
@@ -7,26 +7,33 @@ include(FindPackageHandleStandardArgs)
set(LIBVA_HEADERS_INCLUDE_DIR_INTERNAL
"${PROJECT_SOURCE_DIR}/source/lib/rocprof-sys/library/tpls"
CACHE PATH "Path to internal va headers")
CACHE PATH
"Path to internal va headers"
)
# ----------------------------------------------------------------------------------------#
find_path(
LIBVA_HEADERS_INCLUDE_DIR
NAMES va/va.h
PATHS /opt/amdgpu/include
NO_DEFAULT_PATH)
NO_DEFAULT_PATH
)
if(NOT EXISTS "${LIBVA_HEADERS_INCLUDE_DIR}")
rocprofiler_systems_message(
AUTHOR_WARNING
"VA API header does not exist! Setting LIBVA_HEADERS_INCLUDE_DIR to internal directory: ${LIBVA_HEADERS_INCLUDE_DIR}"
)
)
set(LIBVA_HEADERS_INCLUDE_DIR
"${LIBVA_HEADERS_INCLUDE_DIR_INTERNAL}"
CACHE PATH "Path to VA API headers" FORCE)
CACHE PATH
"Path to VA API headers"
FORCE
)
else()
rocprofiler_systems_message(STATUS
"VA API header found: ${LIBVA_HEADERS_INCLUDE_DIR}")
"VA API header found: ${LIBVA_HEADERS_INCLUDE_DIR}"
)
endif()
mark_as_advanced(LIBVA_HEADERS_INCLUDE_DIR)
@@ -39,8 +46,11 @@ find_package_handle_standard_args(Libva-headers DEFAULT_MSG LIBVA_HEADERS_INCLUD
if(Libva-headers_FOUND)
add_library(roc::libva-headers INTERFACE IMPORTED)
target_include_directories(roc::libva-headers SYSTEM
INTERFACE ${LIBVA_HEADERS_INCLUDE_DIR})
target_include_directories(
roc::libva-headers
SYSTEM
INTERFACE ${LIBVA_HEADERS_INCLUDE_DIR}
)
endif()
# ------------------------------------------------------------------------------#
+64 -31
Просмотреть файл
@@ -8,19 +8,29 @@ include(FindPackageHandleStandardArgs)
set(MPI_HEADERS_VENDOR_INTERNAL
"OpenMPI"
CACHE STRING "Distribution type of internal mpi.h")
CACHE STRING
"Distribution type of internal mpi.h"
)
set(MPI_HEADERS_INCLUDE_DIR_INTERNAL
"${PROJECT_SOURCE_DIR}/source/lib/rocprof-sys/library/tpls/mpi"
CACHE PATH "Path to internal ${MPI_HEADERS_VENDOR_INTERNAL} mpi.h")
CACHE PATH
"Path to internal ${MPI_HEADERS_VENDOR_INTERNAL} mpi.h"
)
mark_as_advanced(MPI_HEADERS_VENDOR_INTERNAL)
mark_as_advanced(MPI_HEADERS_INCLUDE_DIR_INTERNAL)
if(DEFINED _MPI_HEADERS_LAST_MPI_HEADERS_INCLUDE_DIR
AND NOT _MPI_HEADERS_LAST_MPI_HEADERS_INCLUDE_DIR STREQUAL MPI_HEADERS_INCLUDE_DIR)
if(
DEFINED _MPI_HEADERS_LAST_MPI_HEADERS_INCLUDE_DIR
AND NOT _MPI_HEADERS_LAST_MPI_HEADERS_INCLUDE_DIR STREQUAL MPI_HEADERS_INCLUDE_DIR
)
unset(MPI_HEADERS_VENDOR CACHE)
# if skip mpicxx is on because of internal unset this value
if(MPI_HEADERS_SKIP_MPICXX AND "${_MPI_HEADERS_LAST_MPI_HEADERS_INCLUDE_DIR}"
STREQUAL "${MPI_HEADERS_INCLUDE_DIR_INTERNAL}")
if(
MPI_HEADERS_SKIP_MPICXX
AND "${_MPI_HEADERS_LAST_MPI_HEADERS_INCLUDE_DIR}"
STREQUAL
"${MPI_HEADERS_INCLUDE_DIR_INTERNAL}"
)
unset(MPI_HEADERS_SKIP_MPICXX CACHE)
endif()
endif()
@@ -40,7 +50,8 @@ find_path(
NAMES mpi.h
PATH_SUFFIXES include/openmpi openmpi include
HINTS ${MPI_ROOT_DIR}
PATHS ${MPI_ROOT_DIR})
PATHS ${MPI_ROOT_DIR}
)
# ------------------------------------------------------------------------------#
#
@@ -53,11 +64,17 @@ if(NOT MPI_HEADERS_INCLUDE_DIR)
if(MPI_C_INCLUDE_DIRS)
set(MPI_HEADERS_INCLUDE_DIR
${MPI_C_INCLUDE_DIRS}
CACHE PATH "Include directory for MPI" FORCE)
CACHE PATH
"Include directory for MPI"
FORCE
)
elseif(MPI_CXX_INCLUDE_DIRS)
set(MPI_HEADERS_INCLUDE_DIR
${MPI_CXX_INCLUDE_DIRS}
CACHE PATH "Include directory for MPI" FORCE)
CACHE PATH
"Include directory for MPI"
FORCE
)
endif()
endif()
@@ -73,17 +90,23 @@ if(MPI_HEADERS_INCLUDE_DIR)
if("${_LINE}" MATCHES "define([ \t]+)OMPI_")
set(MPI_HEADERS_VENDOR
"OpenMPI"
CACHE STRING "MPI headers are from OpenMPI distribution")
CACHE STRING
"MPI headers are from OpenMPI distribution"
)
break()
elseif("${_LINE}" MATCHES "define([ \t]+)MPICH_")
set(MPI_HEADERS_VENDOR
"MPICH"
CACHE STRING "MPI headers are from MPICH distribution")
CACHE STRING
"MPI headers are from MPICH distribution"
)
break()
elseif("${_LINE}" MATCHES "define([ \t]+)MVAPICH_")
set(MPI_HEADERS_VENDOR
"MVAPICH"
CACHE STRING "MPI headers are from MVAPICH distribution")
CACHE STRING
"MPI headers are from MVAPICH distribution"
)
break()
endif()
endforeach()
@@ -96,42 +119,47 @@ endif()
# ------------------------------------------------------------------------------#
if(NOT MPI_HEADERS_INCLUDE_DIR)
set(MPI_HEADERS_INCLUDE_DIR
"${MPI_HEADERS_INCLUDE_DIR_INTERNAL}"
CACHE PATH "" FORCE)
set(MPI_HEADERS_INCLUDE_DIR "${MPI_HEADERS_INCLUDE_DIR_INTERNAL}" CACHE PATH "" FORCE)
set(MPI_HEADERS_VENDOR
"${MPI_HEADERS_VENDOR_INTERNAL}"
CACHE STRING "MPI headers are from OpenMPI distribution" FORCE)
set(MPI_HEADERS_SKIP_MPICXX
ON
CACHE BOOL "" FORCE)
CACHE STRING
"MPI headers are from OpenMPI distribution"
FORCE
)
set(MPI_HEADERS_SKIP_MPICXX ON CACHE BOOL "" FORCE)
elseif("${MPI_HEADERS_VENDOR}" STREQUAL "MPICH")
option(
MPI_HEADERS_ALLOW_MPICH
"Permit the use of MPI headers from MPICH instead of using internal OpenMPI header"
OFF)
OFF
)
mark_as_advanced(MPI_HEADERS_ALLOW_MPICH)
if(NOT MPI_HEADERS_ALLOW_MPICH)
set(_MESSAGE "\nFound MPI headers belonging to a MPICH distribution. ")
set(_MESSAGE
"${_MESSAGE}The data types for MPICH will cause segfaults when an application uses OpenMPI, "
)
)
set(_MESSAGE
"${_MESSAGE}whereas the OpenMPI data types are compatible with both. ")
"${_MESSAGE}whereas the OpenMPI data types are compatible with both. "
)
set(_MESSAGE
"${_MESSAGE}Forcing internal OpenMPI header... This can be disabled via MPI_HEADERS_ALLOW_MPICH=ON ...\n"
)
)
message(AUTHOR_WARNING "${_MESSAGE}")
unset(_MESSAGE)
set(MPI_HEADERS_INCLUDE_DIR
"${MPI_HEADERS_INCLUDE_DIR_INTERNAL}"
CACHE PATH "" FORCE)
CACHE PATH
""
FORCE
)
set(MPI_HEADERS_VENDOR
"${MPI_HEADERS_VENDOR_INTERNAL}"
CACHE STRING "MPI headers are from OpenMPI distribution" FORCE)
set(MPI_HEADERS_SKIP_MPICXX
ON
CACHE BOOL "" FORCE)
CACHE STRING
"MPI headers are from OpenMPI distribution"
FORCE
)
set(MPI_HEADERS_SKIP_MPICXX ON CACHE BOOL "" FORCE)
endif()
endif()
@@ -145,7 +173,9 @@ mark_as_advanced(MPI_HEADERS_INCLUDE_DIR)
# store value to detect changes
set(_MPI_HEADERS_LAST_MPI_HEADERS_INCLUDE_DIR
"${MPI_HEADERS_INCLUDE_DIR}"
CACHE INTERNAL "Last value of MPI_HEADERS_INCLUDE_DIR")
CACHE INTERNAL
"Last value of MPI_HEADERS_INCLUDE_DIR"
)
# handle find_package
find_package_handle_standard_args(MPI-Headers REQUIRED_VARS MPI_HEADERS_INCLUDE_DIR)
@@ -160,6 +190,9 @@ if(MPI-Headers_FOUND)
endif()
endif()
target_include_directories(
MPI::MPI_HEADERS INTERFACE $<$<COMPILE_LANGUAGE:C>:${MPI_HEADERS_INCLUDE_DIR}>
$<$<COMPILE_LANGUAGE:CXX>:${MPI_HEADERS_INCLUDE_DIR}>)
MPI::MPI_HEADERS
INTERFACE
$<$<COMPILE_LANGUAGE:C>:${MPI_HEADERS_INCLUDE_DIR}>
$<$<COMPILE_LANGUAGE:CXX>:${MPI_HEADERS_INCLUDE_DIR}>
)
endif()
+115 -45
Просмотреть файл
@@ -42,7 +42,8 @@ set(ROCmVersion_VARIABLES
TRIPLE
NUMERIC
CANONICAL
FULL)
FULL
)
function(ROCM_VERSION_MESSAGE _TYPE)
if(ROCmVersion_DEBUG)
@@ -52,7 +53,6 @@ endfunction()
# read a .info/version* file and propagate the variables to the calling scope
function(ROCM_VERSION_COMPUTE FULL_VERSION_STRING _VAR_PREFIX)
# remove any line endings
string(REGEX REPLACE "(\n|\r)" "" FULL_VERSION_STRING "${FULL_VERSION_STRING}")
@@ -61,8 +61,13 @@ function(ROCM_VERSION_COMPUTE FULL_VERSION_STRING _VAR_PREFIX)
# get number and remove from full version string
string(REGEX REPLACE "([0-9]+)\:(.*)" "\\1" EPOCH_VERSION "${FULL_VERSION_STRING}")
string(REGEX REPLACE "([0-9]+)\:(.*)" "\\2" FULL_VERSION_STRING
"${FULL_VERSION_STRING}")
string(
REGEX REPLACE
"([0-9]+)\:(.*)"
"\\2"
FULL_VERSION_STRING
"${FULL_VERSION_STRING}"
)
if(EPOCH_VERSION STREQUAL FULL_VERSION)
set(EPOCH_VERSION)
@@ -70,18 +75,33 @@ function(ROCM_VERSION_COMPUTE FULL_VERSION_STRING _VAR_PREFIX)
# get number and remove from full version string
string(REGEX REPLACE "([0-9]+)(.*)" "\\1" MAJOR_VERSION "${FULL_VERSION_STRING}")
string(REGEX REPLACE "([0-9]+)(.*)" "\\2" FULL_VERSION_STRING
"${FULL_VERSION_STRING}")
string(
REGEX REPLACE
"([0-9]+)(.*)"
"\\2"
FULL_VERSION_STRING
"${FULL_VERSION_STRING}"
)
# get number and remove from full version string
string(REGEX REPLACE "\.([0-9]+)(.*)" "\\1" MINOR_VERSION "${FULL_VERSION_STRING}")
string(REGEX REPLACE "\.([0-9]+)(.*)" "\\2" FULL_VERSION_STRING
"${FULL_VERSION_STRING}")
string(
REGEX REPLACE
"\.([0-9]+)(.*)"
"\\2"
FULL_VERSION_STRING
"${FULL_VERSION_STRING}"
)
# get number and remove from full version string
string(REGEX REPLACE "\.([0-9]+)(.*)" "\\1" PATCH_VERSION "${FULL_VERSION_STRING}")
string(REGEX REPLACE "\.([0-9]+)(.*)" "\\2" FULL_VERSION_STRING
"${FULL_VERSION_STRING}")
string(
REGEX REPLACE
"\.([0-9]+)(.*)"
"\\2"
FULL_VERSION_STRING
"${FULL_VERSION_STRING}"
)
if(NOT PATCH_VERSION LESS 100)
set(PATCH_VERSION 0)
@@ -89,12 +109,22 @@ function(ROCM_VERSION_COMPUTE FULL_VERSION_STRING _VAR_PREFIX)
# get number and remove from full version string
string(REGEX REPLACE "\.([0-9]+)(.*)" "\\1" TWEAK_VERSION "${FULL_VERSION_STRING}")
string(REGEX REPLACE "\.([0-9]+)(.*)" "\\2" FULL_VERSION_STRING
"${FULL_VERSION_STRING}")
string(
REGEX REPLACE
"\.([0-9]+)(.*)"
"\\2"
FULL_VERSION_STRING
"${FULL_VERSION_STRING}"
)
# get number
string(REGEX REPLACE "-([0-9A-Za-z+~]+)" "\\1" REVISION_VERSION
"${FULL_VERSION_STRING}")
string(
REGEX REPLACE
"-([0-9A-Za-z+~]+)"
"\\1"
REVISION_VERSION
"${FULL_VERSION_STRING}"
)
set(CANONICAL_VERSION)
set(_MAJOR_SEP ":")
@@ -103,7 +133,15 @@ function(ROCM_VERSION_COMPUTE FULL_VERSION_STRING _VAR_PREFIX)
set(_TWEAK_SEP ".")
set(_REVISION_SEP "-")
foreach(_V EPOCH MAJOR MINOR PATCH TWEAK REVISION)
foreach(
_V
EPOCH
MAJOR
MINOR
PATCH
TWEAK
REVISION
)
if(${_V}_VERSION)
set(CANONICAL_VERSION "${CANONICAL_VERSION}${_${_V}_SEP}${${_V}_VERSION}")
else()
@@ -125,13 +163,11 @@ function(ROCM_VERSION_COMPUTE FULL_VERSION_STRING _VAR_PREFIX)
EXPR
NUMERIC_VERSION
"(10000 * (${MAJOR_VERSION}+0)) + (100 * (${MINOR_VERSION}+0)) + (${PATCH_VERSION}+0)"
)
)
# propagate to parent scopes
foreach(_V ${ROCmVersion_VARIABLES})
set(${_VAR_PREFIX}_${_V}_VERSION
${${_V}_VERSION}
PARENT_SCOPE)
set(${_VAR_PREFIX}_${_V}_VERSION ${${_V}_VERSION} PARENT_SCOPE)
endforeach()
endfunction()
@@ -147,18 +183,18 @@ function(ROCM_VERSION_WATCH_FOR_CHANGE _var)
endif()
list(REMOVE_ITEM _REMAIN_VARIABLES ${_var})
set(_REMAIN_VARIABLES
"${_REMAIN_VARIABLES}"
PARENT_SCOPE)
set(_REMAIN_VARIABLES "${_REMAIN_VARIABLES}" PARENT_SCOPE)
return()
else()
rocm_version_message(
STATUS
"${_var} changed :: ${${_rocm_version_watch_var_name}} --> ${${_var}}")
"${_var} changed :: ${${_rocm_version_watch_var_name}} --> ${${_var}}"
)
foreach(_V ${_REMAIN_VARIABLES})
rocm_version_message(
STATUS "${_var} changed :: Unsetting cache variable ${_V}...")
STATUS "${_var} changed :: Unsetting cache variable ${_V}..."
)
unset(${_V} CACHE)
endforeach()
endif()
@@ -171,12 +207,14 @@ function(ROCM_VERSION_WATCH_FOR_CHANGE _var)
# store the value for the next run
set(${_rocm_version_watch_var_name}
"${${_var}}"
CACHE INTERNAL "Last value of ${_var}" FORCE)
CACHE INTERNAL
"Last value of ${_var}"
FORCE
)
endfunction()
# scope this to a function to avoid leaking local variables
function(ROCM_VERSION_PARSE_VERSION_FILES)
# the list of variables set by module. when one of these changes, we need to unset the
# cache variables after it
set(_ALL_VARIABLES)
@@ -193,23 +231,25 @@ function(ROCM_VERSION_PARSE_VERSION_FILES)
# propagate to parent scopes
foreach(_V ${ROCmVersion_VARIABLES})
set(${_VAR_PREFIX}_${_V}_VERSION
${${_VAR_PREFIX}_${_V}_VERSION}
PARENT_SCOPE)
set(${_VAR_PREFIX}_${_V}_VERSION ${${_VAR_PREFIX}_${_V}_VERSION} PARENT_SCOPE)
endforeach()
endfunction()
# search for HIP to set ROCM_PATH if(NOT hip_FOUND) find_package(hip) endif()
function(COMPUTE_ROCM_VERSION_DIR)
if(EXISTS "${ROCmVersion_VERSION_FILE}" AND IS_ABSOLUTE
"${ROCmVersion_VERSION_FILE}")
if(
EXISTS "${ROCmVersion_VERSION_FILE}"
AND IS_ABSOLUTE "${ROCmVersion_VERSION_FILE}"
)
get_filename_component(_VERSION_DIR "${ROCmVersion_VERSION_FILE}" PATH)
get_filename_component(_VERSION_DIR "${_VERSION_DIR}/.." REALPATH)
set(ROCmVersion_DIR
"${_VERSION_DIR}"
CACHE PATH "Root path to ROCm's .info/${ROCmVersion_VERSION_FILE}"
${ARGN})
CACHE PATH
"Root path to ROCm's .info/${ROCmVersion_VERSION_FILE}"
${ARGN}
)
rocm_version_watch_for_change(ROCmVersion_DIR)
endif()
endfunction()
@@ -219,20 +259,36 @@ function(ROCM_VERSION_PARSE_VERSION_FILES)
set(_VERSION_FILES ${_VERSION_FILE})
compute_rocm_version_dir(FORCE)
else()
set(_VERSION_FILES version version-dev version-hip-libraries version-hiprt
version-hiprt-devel version-hip-sdk version-libs version-utils)
set(_VERSION_FILES
version
version-dev
version-hip-libraries
version-hiprt
version-hiprt-devel
version-hip-sdk
version-libs
version-utils
)
rocm_version_message(STATUS "ROCmVersion version files: ${_VERSION_FILES}")
endif()
# convert env to cache if not defined
foreach(_PATH ROCmVersion_DIR ROCmVersion_ROOT ROCmVersion_ROOT_DIR
ROCPROFSYS_DEFAULT_ROCM_PATH ROCM_PATH)
foreach(
_PATH
ROCmVersion_DIR
ROCmVersion_ROOT
ROCmVersion_ROOT_DIR
ROCPROFSYS_DEFAULT_ROCM_PATH
ROCM_PATH
)
if(NOT DEFINED ${_PATH} AND DEFINED ENV{${_PATH}})
set(_VAL "$ENV{${_PATH}}")
get_filename_component(_VAL "${_VAL}" REALPATH)
set(${_PATH}
"${_VAL}"
CACHE PATH "Search path for ROCm version for ROCmVersion")
CACHE PATH
"Search path for ROCm version for ROCmVersion"
)
endif()
endforeach()
@@ -242,9 +298,15 @@ function(ROCM_VERSION_PARSE_VERSION_FILES)
set(_PATHS)
foreach(
_DIR
${ROCmVersion_DIR} ${ROCmVersion_ROOT} ${ROCmVersion_ROOT_DIR}
$ENV{CMAKE_PREFIX_PATH} ${CMAKE_PREFIX_PATH} ${ROCPROFSYS_DEFAULT_ROCM_PATH}
${ROCM_PATH} /opt/rocm)
${ROCmVersion_DIR}
${ROCmVersion_ROOT}
${ROCmVersion_ROOT_DIR}
$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)
list(APPEND _PATHS ${_ABS_DIR})
@@ -261,7 +323,9 @@ function(ROCM_VERSION_PARSE_VERSION_FILES)
if(EXISTS ${_F})
set(ROCmVersion_VERSION_FILE
"${_F}"
CACHE FILEPATH "File with versioning info")
CACHE FILEPATH
"File with versioning info"
)
rocm_version_watch_for_change(ROCmVersion_VERSION_FILE)
compute_rocm_version_dir()
else()
@@ -283,7 +347,9 @@ function(ROCM_VERSION_PARSE_VERSION_FILES)
set(_LOCAL_VAR ${_B}_${_V}_VERSION)
set(ROCmVersion_${_V}_VERSION
"${${_LOCAL_VAR}}"
CACHE STRING "ROCm ${_V} version")
CACHE STRING
"ROCm ${_V} version"
)
rocm_version_watch_for_change(${_CACHE_VAR})
endforeach()
endif()
@@ -296,7 +362,11 @@ include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
ROCmVersion
VERSION_VAR ROCmVersion_FULL_VERSION
REQUIRED_VARS ROCmVersion_FULL_VERSION ROCmVersion_TRIPLE_VERSION ROCmVersion_DIR
ROCmVersion_VERSION_FILE)
REQUIRED_VARS
ROCmVersion_FULL_VERSION
ROCmVersion_TRIPLE_VERSION
ROCmVersion_DIR
ROCmVersion_VERSION_FILE
)
# don't add major/minor/patch/etc. version variables to required vars because they might
# be zero, which will cause CMake to evaluate it as not set
+52 -23
Просмотреть файл
@@ -81,8 +81,10 @@ set(TBB_SEARCH_DIR ${TBB_ROOT_DIR} $ENV{TBB_INSTALL_DIR} $ENV{TBBROOT})
# Define the search directories based on the current platform
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(TBB_DEFAULT_SEARCH_DIR "C:/Program Files/Intel/TBB"
"C:/Program Files (x86)/Intel/TBB")
set(TBB_DEFAULT_SEARCH_DIR
"C:/Program Files/Intel/TBB"
"C:/Program Files (x86)/Intel/TBB"
)
# Set the target architecture
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
@@ -106,7 +108,6 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
# Add the library path search suffix for the VC independent version of TBB
list(APPEND TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc_mt")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
# OS X
set(TBB_DEFAULT_SEARCH_DIR "/opt/intel/tbb")
@@ -136,18 +137,22 @@ endif()
# Find the TBB include dir
#
find_path(
TBB_INCLUDE_DIRS tbb/tbb.h
TBB_INCLUDE_DIRS
tbb/tbb.h
HINTS ${TBB_INCLUDE_DIRS} ${TBB_SEARCH_DIR}
PATHS ${TBB_DEFAULT_SEARCH_DIR}
PATH_SUFFIXES include)
PATH_SUFFIXES include
)
#
# Set version strings
#
if(TBB_INCLUDE_DIRS)
# Starting in 2020.1.1, tbb_stddef.h is replaced by version.h
set(_version_files "${TBB_INCLUDE_DIRS}/tbb/tbb_stddef.h"
"${TBB_INCLUDE_DIRS}/tbb/version.h")
set(_version_files
"${TBB_INCLUDE_DIRS}/tbb/tbb_stddef.h"
"${TBB_INCLUDE_DIRS}/tbb/version.h"
)
foreach(f IN ITEMS ${_version_files})
if(EXISTS ${f})
set(_version_file ${f})
@@ -156,20 +161,38 @@ if(TBB_INCLUDE_DIRS)
unset(_version_files)
file(READ ${_version_file} _tbb_version_file)
string(REGEX REPLACE ".*#define TBB_VERSION_MAJOR ([0-9]+).*" "\\1" TBB_VERSION_MAJOR
"${_tbb_version_file}")
string(REGEX REPLACE ".*#define TBB_VERSION_MINOR ([0-9]+).*" "\\1" TBB_VERSION_MINOR
"${_tbb_version_file}")
string(REGEX REPLACE ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1"
TBB_INTERFACE_VERSION "${_tbb_version_file}")
string(
REGEX REPLACE
".*#define TBB_VERSION_MAJOR ([0-9]+).*"
"\\1"
TBB_VERSION_MAJOR
"${_tbb_version_file}"
)
string(
REGEX REPLACE
".*#define TBB_VERSION_MINOR ([0-9]+).*"
"\\1"
TBB_VERSION_MINOR
"${_tbb_version_file}"
)
string(
REGEX REPLACE
".*#define TBB_INTERFACE_VERSION ([0-9]+).*"
"\\1"
TBB_INTERFACE_VERSION
"${_tbb_version_file}"
)
# The TBB_VERSION_MINOR isn't necessarily changed for minor releases Hence, we need to
# read the engineering versioning in TBB_INTERFACE_VERSION to get the minor version
# correct
if("${TBB_VERSION_MINOR}" STREQUAL "0")
math(EXPR _tbb_iface_major_ver "${TBB_INTERFACE_VERSION} / 100")
math(EXPR TBB_VERSION_MINOR
"${TBB_INTERFACE_VERSION} - ${_tbb_iface_major_ver} * 100")
math(
EXPR
TBB_VERSION_MINOR
"${TBB_INTERFACE_VERSION} - ${_tbb_iface_major_ver} * 100"
)
endif()
set(TBB_VERSION "${TBB_VERSION_MAJOR}.${TBB_VERSION_MINOR}")
endif()
@@ -190,19 +213,24 @@ foreach(_comp ${TBB_SEARCH_COMPOMPONENTS})
# message(STATUS "Searching for ${_comp}...") message(STATUS "Hints: ${TBB_LIBRARY}
# ${TBB_SEARCH_DIR}")
if(";${TBB_FIND_COMPONENTS};tbb;" MATCHES ";${_comp};")
# Search for the libraries
find_library(
TBB_${_comp}_LIBRARY_RELEASE ${_comp}
TBB_${_comp}_LIBRARY_RELEASE
${_comp}
HINTS ${TBB_LIBRARY} ${TBB_SEARCH_DIR}
PATHS ${TBB_DEFAULT_SEARCH_DIR} ENV LIBRARY_PATH
PATH_SUFFIXES ${TBB_LIB_PATH_SUFFIX} lib_release)
PATHS ${TBB_DEFAULT_SEARCH_DIR}
ENV LIBRARY_PATH
PATH_SUFFIXES ${TBB_LIB_PATH_SUFFIX} lib_release
)
find_library(
TBB_${_comp}_LIBRARY_DEBUG ${_comp}_debug
TBB_${_comp}_LIBRARY_DEBUG
${_comp}_debug
HINTS ${TBB_LIBRARY} ${TBB_SEARCH_DIR}
PATHS ${TBB_DEFAULT_SEARCH_DIR} ENV LIBRARY_PATH
PATH_SUFFIXES ${TBB_LIB_PATH_SUFFIX} lib_debug)
PATHS ${TBB_DEFAULT_SEARCH_DIR}
ENV LIBRARY_PATH
PATH_SUFFIXES ${TBB_LIB_PATH_SUFFIX} lib_debug
)
if(TBB_${_comp}_LIBRARY_DEBUG)
list(APPEND TBB_LIBRARIES_DEBUG "${TBB_${_comp}_LIBRARY_DEBUG}")
@@ -258,7 +286,8 @@ find_package_handle_standard_args(
TBB
REQUIRED_VARS TBB_INCLUDE_DIRS TBB_LIBRARIES
HANDLE_COMPONENTS
VERSION_VAR TBB_VERSION)
VERSION_VAR TBB_VERSION
)
mark_as_advanced(TBB_INCLUDE_DIRS TBB_LIBRARIES TBB_LIBRARY_DIRS)
+13 -6
Просмотреть файл
@@ -23,7 +23,8 @@ find_path(
NAMES include/amd_smi/amdsmi.h
HINTS ${_AMD_SMI_PATHS}
PATHS ${_AMD_SMI_PATHS}
PATH_SUFFIXES amd_smi)
PATH_SUFFIXES amd_smi
)
mark_as_advanced(amd-smi_ROOT_DIR)
@@ -34,7 +35,8 @@ find_path(
NAMES amd_smi/amdsmi.h
HINTS ${amd-smi_ROOT_DIR} ${_AMD_SMI_PATHS}
PATHS ${amd-smi_ROOT_DIR} ${_AMD_SMI_PATHS}
PATH_SUFFIXES include amd_smi/include)
PATH_SUFFIXES include amd_smi/include
)
mark_as_advanced(amd-smi_INCLUDE_DIR)
@@ -45,7 +47,8 @@ find_library(
NAMES amd_smi
HINTS ${amd-smi_ROOT_DIR} ${_AMD_SMI_PATHS}
PATHS ${amd-smi_ROOT_DIR} ${_AMD_SMI_PATHS}
PATH_SUFFIXES amd-smi/lib lib)
PATH_SUFFIXES amd-smi/lib lib
)
if(amd-smi_LIBRARY)
get_filename_component(amd-smi_LIBRARY_DIR "${amd-smi_LIBRARY}" PATH CACHE)
@@ -55,8 +58,13 @@ mark_as_advanced(amd-smi_LIBRARY)
# ----------------------------------------------------------------------------------------#
find_package_handle_standard_args(amd-smi DEFAULT_MSG amd-smi_ROOT_DIR
amd-smi_INCLUDE_DIR amd-smi_LIBRARY)
find_package_handle_standard_args(
amd-smi
DEFAULT_MSG
amd-smi_ROOT_DIR
amd-smi_INCLUDE_DIR
amd-smi_LIBRARY
)
# ------------------------------------------------------------------------------#
@@ -69,7 +77,6 @@ if(amd-smi_FOUND)
target_include_directories(amd-smi::amd-smi INTERFACE ${amd-smi_INCLUDE_DIR})
target_link_libraries(amd-smi::amd-smi INTERFACE ${amd-smi_LIBRARY})
endif()
# ------------------------------------------------------------------------------#
+120 -66
Просмотреть файл
@@ -12,44 +12,51 @@ rocprofiler_systems_checkout_git_submodule(
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
REPO_URL https://bitbucket.org/icl/papi.git
REPO_BRANCH effd1ef4e0fd4b80e36546791277215a2d6b9eba
TEST_FILE src/configure)
TEST_FILE src/configure
)
set(PAPI_LIBPFM_SOVERSION
"4.11.1"
CACHE STRING "libpfm.so version")
set(PAPI_LIBPFM_SOVERSION "4.11.1" CACHE STRING "libpfm.so version")
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 "${ROCPROFSYS_PAPI_SOURCE_DIR}")
execute_process(
COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/external/papi
${ROCPROFSYS_PAPI_SOURCE_DIR})
COMMAND
${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/external/papi
${ROCPROFSYS_PAPI_SOURCE_DIR}
)
endif()
if(NOT EXISTS "${ROCPROFSYS_PAPI_INSTALL_DIR}")
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory
${ROCPROFSYS_PAPI_INSTALL_DIR})
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory
${ROCPROFSYS_PAPI_INSTALL_DIR}/include)
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory
${ROCPROFSYS_PAPI_INSTALL_DIR}/lib)
execute_process(
COMMAND ${CMAKE_COMMAND} -E make_directory ${ROCPROFSYS_PAPI_INSTALL_DIR}
)
execute_process(
COMMAND ${CMAKE_COMMAND} -E make_directory ${ROCPROFSYS_PAPI_INSTALL_DIR}/include
)
execute_process(
COMMAND ${CMAKE_COMMAND} -E make_directory ${ROCPROFSYS_PAPI_INSTALL_DIR}/lib
)
execute_process(
COMMAND
${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)
${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)
${ROCPROFSYS_PAPI_INSTALL_DIR}/lib/libpfm.so
)
endif()
# Set ROCPROFSYS_PAPI_CONFIGURE_JOBS for commands that need to be run nonparallel
set(ROCPROFSYS_PAPI_CONFIGURE_JOBS 1)
rocprofiler_systems_add_option(ROCPROFSYS_PAPI_AUTO_COMPONENTS
"Automatically enable components" OFF)
"Automatically enable components" OFF
)
# -------------- PACKAGES -----------------------------------------------------
@@ -89,10 +96,13 @@ set(_ROCPROFSYS_VALID_PAPI_COMPONENTS
sensors_ppc
stealtime
sysdetect
vmware)
vmware
)
set(ROCPROFSYS_VALID_PAPI_COMPONENTS
"${_ROCPROFSYS_VALID_PAPI_COMPONENTS}"
CACHE STRING "Valid PAPI components")
CACHE STRING
"Valid PAPI components"
)
mark_as_advanced(ROCPROFSYS_VALID_PAPI_COMPONENTS)
# default components which do not require 3rd-party headers or libraries
@@ -106,12 +116,14 @@ set(_ROCPROFSYS_PAPI_COMPONENTS
perf_event
perf_event_uncore
# rapl stealtime
)
)
if(ROCPROFSYS_PAPI_AUTO_COMPONENTS)
# lmsensors
find_path(ROCPROFSYS_PAPI_LMSENSORS_ROOT_DIR NAMES include/sensors/sensors.h
include/sensors.h)
find_path(
ROCPROFSYS_PAPI_LMSENSORS_ROOT_DIR
NAMES include/sensors/sensors.h include/sensors.h
)
if(ROCPROFSYS_PAPI_LMSENSORS_ROOT_DIR)
list(APPEND _ROCPROFSYS_PAPI_COMPONENTS lmsensors)
@@ -119,10 +131,7 @@ if(ROCPROFSYS_PAPI_AUTO_COMPONENTS)
# pcp
find_path(ROCPROFSYS_PAPI_PCP_ROOT_DIR NAMES include/pcp/impl.h)
find_library(
ROCPROFSYS_PAPI_PCP_LIBRARY
NAMES pcp
PATH_SUFFIXES lib lib64)
find_library(ROCPROFSYS_PAPI_PCP_LIBRARY NAMES pcp PATH_SUFFIXES lib lib64)
if(ROCPROFSYS_PAPI_PCP_ROOT_DIR AND ROCPROFSYS_PAPI_PCP_LIBRARY)
list(APPEND _ROCPROFSYS_PAPI_COMPONENTS pcp)
@@ -132,19 +141,26 @@ endif()
# set the ROCPROFSYS_PAPI_COMPONENTS cache variable
set(ROCPROFSYS_PAPI_COMPONENTS
"${_ROCPROFSYS_PAPI_COMPONENTS}"
CACHE STRING "PAPI components")
CACHE STRING
"PAPI components"
)
rocprofiler_systems_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}")
string(
REPLACE
";"
", "
_ROCPROFSYS_VALID_PAPI_COMPONENTS_MSG
"${ROCPROFSYS_VALID_PAPI_COMPONENTS}"
)
if(NOT "${_COMP}" IN_LIST ROCPROFSYS_VALID_PAPI_COMPONENTS)
rocprofiler_systems_message(
AUTHOR_WARNING
"ROCPROFSYS_PAPI_COMPONENTS contains an unknown component '${_COMP}'. Known components: ${_ROCPROFSYS_VALID_PAPI_COMPONENTS_MSG}"
)
)
endif()
unset(_ROCPROFSYS_VALID_PAPI_COMPONENTS_MSG)
endforeach()
@@ -155,32 +171,34 @@ if("rocm" IN_LIST ROCPROFSYS_PAPI_COMPONENTS)
endif()
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})
list(
APPEND
ROCPROFSYS_PAPI_EXTRA_ENV
PAPI_LMSENSORS_ROOT=${ROCPROFSYS_PAPI_LMSENSORS_ROOT_DIR}
)
endif()
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 ROCPROFSYS_PAPI_COMPONENTS AND NOT "perf_event" IN_LIST
ROCPROFSYS_PAPI_COMPONENTS)
if(
"perf_event_uncore" IN_LIST ROCPROFSYS_PAPI_COMPONENTS
AND NOT "perf_event" IN_LIST ROCPROFSYS_PAPI_COMPONENTS
)
rocprofiler_systems_message(
FATAL_ERROR
"ROCPROFSYS_PAPI_COMPONENTS :: 'perf_event_uncore' requires 'perf_event' component"
)
)
endif()
find_program(
MAKE_EXECUTABLE
NAMES make gmake
PATH_SUFFIXES bin)
find_program(MAKE_EXECUTABLE NAMES make gmake PATH_SUFFIXES bin)
if(NOT MAKE_EXECUTABLE)
rocprofiler_systems_message(
FATAL_ERROR
"make/gmake executable not found. Please re-run with -DMAKE_EXECUTABLE=/path/to/make"
)
)
endif()
set(_PAPI_C_COMPILER ${CMAKE_C_COMPILER})
@@ -190,12 +208,10 @@ if(CMAKE_C_COMPILER_IS_CLANG)
set(_PAPI_C_COMPILER ${ROCPROFSYS_GNU_C_COMPILER})
endif()
endif()
set(PAPI_C_COMPILER
${_PAPI_C_COMPILER}
CACHE FILEPATH "C compiler used to compile PAPI")
set(PAPI_C_COMPILER ${_PAPI_C_COMPILER} CACHE FILEPATH "C compiler used to compile PAPI")
include(ExternalProject)
externalproject_add(
ExternalProject_Add(
rocprofiler-systems-papi-build
PREFIX ${PROJECT_BINARY_DIR}/external/papi
SOURCE_DIR ${ROCPROFSYS_PAPI_SOURCE_DIR}/src
@@ -218,7 +234,8 @@ externalproject_add(
CFLAGS=-fPIC\ -O3\ -Wno-stringop-truncation\ -Wno-use-after-free
${ROCPROFSYS_PAPI_EXTRA_ENV} ${MAKE_EXECUTABLE} utils install-utils -s
INSTALL_COMMAND ""
BUILD_BYPRODUCTS "${_ROCPROFSYS_PAPI_BUILD_BYPRODUCTS}")
BUILD_BYPRODUCTS "${_ROCPROFSYS_PAPI_BUILD_BYPRODUCTS}"
)
# target for re-executing the installation
add_custom_target(
@@ -232,7 +249,8 @@ add_custom_target(
CFLAGS=-fPIC\ -O3\ -Wno-stringop-truncation\ -Wno-use-after-free
${ROCPROFSYS_PAPI_EXTRA_ENV} ${MAKE_EXECUTABLE} utils install-utils -s
WORKING_DIRECTORY ${ROCPROFSYS_PAPI_SOURCE_DIR}/src
COMMENT "Installing PAPI...")
COMMENT "Installing PAPI..."
)
add_custom_target(
rocprofiler-systems-papi-clean
@@ -244,42 +262,67 @@ add_custom_target(
${ROCPROFSYS_PAPI_INSTALL_DIR}/lib/libpfm.a
${ROCPROFSYS_PAPI_INSTALL_DIR}/lib/libpfm.so
WORKING_DIRECTORY ${ROCPROFSYS_PAPI_SOURCE_DIR}/src
COMMENT "Cleaning PAPI...")
COMMENT "Cleaning PAPI..."
)
set(PAPI_ROOT_DIR
${ROCPROFSYS_PAPI_INSTALL_DIR}
CACHE PATH "Root PAPI installation" FORCE)
CACHE PATH
"Root PAPI installation"
FORCE
)
set(PAPI_INCLUDE_DIR
${ROCPROFSYS_PAPI_INSTALL_DIR}/include
CACHE PATH "PAPI include folder" FORCE)
CACHE PATH
"PAPI include folder"
FORCE
)
set(PAPI_LIBRARY
${ROCPROFSYS_PAPI_INSTALL_DIR}/lib/libpapi.a
CACHE FILEPATH "PAPI library" FORCE)
CACHE FILEPATH
"PAPI library"
FORCE
)
set(PAPI_pfm_LIBRARY
${ROCPROFSYS_PAPI_INSTALL_DIR}/lib/libpfm.so
CACHE FILEPATH "PAPI library" FORCE)
CACHE FILEPATH
"PAPI library"
FORCE
)
set(PAPI_STATIC_LIBRARY
${ROCPROFSYS_PAPI_INSTALL_DIR}/lib/libpapi.a
CACHE FILEPATH "PAPI library" FORCE)
CACHE FILEPATH
"PAPI library"
FORCE
)
set(PAPI_pfm_STATIC_LIBRARY
${ROCPROFSYS_PAPI_INSTALL_DIR}/lib/libpfm.a
CACHE FILEPATH "PAPI library" FORCE)
CACHE FILEPATH
"PAPI library"
FORCE
)
target_include_directories(rocprofiler-systems-papi SYSTEM
INTERFACE $<BUILD_INTERFACE:${PAPI_INCLUDE_DIR}>)
target_include_directories(
rocprofiler-systems-papi
SYSTEM
INTERFACE $<BUILD_INTERFACE:${PAPI_INCLUDE_DIR}>
)
target_link_libraries(
rocprofiler-systems-papi INTERFACE $<BUILD_INTERFACE:${PAPI_LIBRARY}>
$<BUILD_INTERFACE:${PAPI_pfm_LIBRARY}>)
rocprofiler-systems-papi
INTERFACE $<BUILD_INTERFACE:${PAPI_LIBRARY}> $<BUILD_INTERFACE:${PAPI_pfm_LIBRARY}>
)
rocprofiler_systems_target_compile_definitions(
rocprofiler-systems-papi INTERFACE ROCPROFSYS_USE_PAPI
$<BUILD_INTERFACE:TIMEMORY_USE_PAPI=1>)
$<BUILD_INTERFACE:TIMEMORY_USE_PAPI=1>
)
install(
DIRECTORY ${ROCPROFSYS_PAPI_INSTALL_DIR}/lib/
DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}
COMPONENT papi
FILES_MATCHING
PATTERN "*.so*")
PATTERN "*.so*"
)
foreach(
_UTIL_EXE
@@ -297,8 +340,8 @@ foreach(
papi_multiplex_cost
papi_native_avail
papi_version
papi_xml_event_info)
papi_xml_event_info
)
string(REPLACE "_" "-" _UTIL_EXE_INSTALL_NAME "${BINARY_NAME_PREFIX}-${_UTIL_EXE}")
# RPM installer on RedHat/RockyLinux throws error that #!/usr/bin/python should either
@@ -307,12 +350,21 @@ foreach(
file(
READ
"${PROJECT_BINARY_DIR}/external/papi/source/src/high-level/scripts/${_UTIL_EXE}"
_HL_OUTPUT_WRITER)
string(REPLACE "#!/usr/bin/python\n" "#!/usr/bin/python3\n" _HL_OUTPUT_WRITER
"${_HL_OUTPUT_WRITER}")
_HL_OUTPUT_WRITER
)
string(
REPLACE
"#!/usr/bin/python\n"
"#!/usr/bin/python3\n"
_HL_OUTPUT_WRITER
"${_HL_OUTPUT_WRITER}"
)
file(MAKE_DIRECTORY "${ROCPROFSYS_PAPI_INSTALL_DIR}/bin")
file(WRITE "${ROCPROFSYS_PAPI_INSTALL_DIR}/bin/${_UTIL_EXE}3"
"${_HL_OUTPUT_WRITER}")
file(
WRITE
"${ROCPROFSYS_PAPI_INSTALL_DIR}/bin/${_UTIL_EXE}3"
"${_HL_OUTPUT_WRITER}"
)
set(_UTIL_EXE "${_UTIL_EXE}3")
# python script file install to libexec
@@ -321,7 +373,8 @@ foreach(
DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/${PROJECT_NAME}
RENAME ${_UTIL_EXE_INSTALL_NAME}
COMPONENT papi
OPTIONAL)
OPTIONAL
)
else()
# Binary files moved to bin
install(
@@ -329,6 +382,7 @@ foreach(
DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}
RENAME ${_UTIL_EXE_INSTALL_NAME}
COMPONENT papi
OPTIONAL)
OPTIONAL
)
endif()
endforeach()
+338 -208
Просмотреть файл
@@ -9,43 +9,60 @@ include_guard(DIRECTORY)
rocprofiler_systems_add_interface_library(
rocprofiler-systems-headers
"Provides minimal set of include flags to compile with rocprofiler-systems")
"Provides minimal set of include flags to compile with rocprofiler-systems"
)
rocprofiler_systems_add_interface_library(rocprofiler-systems-threading
"Enables multithreading support")
"Enables multithreading support"
)
rocprofiler_systems_add_interface_library(
rocprofiler-systems-dyninst
"Provides flags and libraries for Dyninst (dynamic instrumentation)")
"Provides flags and libraries for Dyninst (dynamic instrumentation)"
)
rocprofiler_systems_add_interface_library(rocprofiler-systems-boost
"Boost interface library (for Dyninst)")
"Boost interface library (for Dyninst)"
)
rocprofiler_systems_add_interface_library(rocprofiler-systems-elfutils
"ElfUtils interface library (for Dyninst)")
"ElfUtils interface library (for Dyninst)"
)
rocprofiler_systems_add_interface_library(rocprofiler-systems-libiberty
"LibIberty interface library (for Dyninst)")
"LibIberty interface library (for Dyninst)"
)
rocprofiler_systems_add_interface_library(
rocprofiler-systems-tbb "Threading Building Blocks interface library (for Dyninst)")
rocprofiler-systems-tbb "Threading Building Blocks interface library (for Dyninst)"
)
rocprofiler_systems_add_interface_library(rocprofiler-systems-rocm
"Provides flags and libraries for ROCm")
"Provides flags and libraries for ROCm"
)
rocprofiler_systems_add_interface_library(rocprofiler-systems-mpi
"Provides MPI or MPI headers")
"Provides MPI or MPI headers"
)
rocprofiler_systems_add_interface_library(rocprofiler-systems-libva
"Provides VA-API headers")
"Provides VA-API headers"
)
rocprofiler_systems_add_interface_library(rocprofiler-systems-bfd
"Provides Binary File Descriptor (BFD)")
"Provides Binary File Descriptor (BFD)"
)
rocprofiler_systems_add_interface_library(rocprofiler-systems-ptl
"Enables PTL support (tasking)")
"Enables PTL support (tasking)"
)
rocprofiler_systems_add_interface_library(rocprofiler-systems-papi "Enable PAPI support")
rocprofiler_systems_add_interface_library(rocprofiler-systems-ompt "Enable OMPT support")
rocprofiler_systems_add_interface_library(rocprofiler-systems-python
"Enables Python support")
"Enables Python support"
)
rocprofiler_systems_add_interface_library(rocprofiler-systems-perfetto
"Enables Perfetto support")
"Enables Perfetto support"
)
rocprofiler_systems_add_interface_library(rocprofiler-systems-timemory
"Provides timemory libraries")
"Provides timemory libraries"
)
rocprofiler_systems_add_interface_library(
rocprofiler-systems-timemory-config
"CMake interface library applied to all timemory targets")
"CMake interface library applied to all timemory targets"
)
rocprofiler_systems_add_interface_library(rocprofiler-systems-compile-definitions
"Compile definitions")
"Compile definitions"
)
# libraries with relevant compile definitions
set(ROCPROFSYS_EXTENSION_LIBRARIES
@@ -55,35 +72,44 @@ set(ROCPROFSYS_EXTENSION_LIBRARIES
rocprofiler-systems::rocprofiler-systems-ptl
rocprofiler-systems::rocprofiler-systems-ompt
rocprofiler-systems::rocprofiler-systems-papi
rocprofiler-systems::rocprofiler-systems-perfetto)
rocprofiler-systems::rocprofiler-systems-perfetto
)
target_include_directories(
rocprofiler-systems-headers
INTERFACE $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/source/lib>
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/source/lib/core>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/source/lib>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/source/lib/rocprof-sys>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/source/lib/rocprof-sys-dl>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/source/lib/rocprof-sys-user>)
INTERFACE
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/source/lib>
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/source/lib/core>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/source/lib>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/source/lib/rocprof-sys>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/source/lib/rocprof-sys-dl>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/source/lib/rocprof-sys-user>
)
# include threading because of rooflines
target_link_libraries(rocprofiler-systems-headers
INTERFACE rocprofiler-systems::rocprofiler-systems-threading)
target_link_libraries(
rocprofiler-systems-headers
INTERFACE rocprofiler-systems::rocprofiler-systems-threading
)
# ensure the env overrides the appending /opt/rocm later
string(REPLACE ":" ";" CMAKE_PREFIX_PATH "$ENV{CMAKE_PREFIX_PATH};${CMAKE_PREFIX_PATH}")
set(ROCPROFSYS_DEFAULT_ROCM_PATH
/opt/rocm
CACHE PATH "Default search path for ROCM")
set(ROCPROFSYS_DEFAULT_ROCM_PATH /opt/rocm CACHE PATH "Default search path for ROCM")
if(EXISTS ${ROCPROFSYS_DEFAULT_ROCM_PATH})
get_filename_component(_ROCPROFSYS_DEFAULT_ROCM_PATH
"${ROCPROFSYS_DEFAULT_ROCM_PATH}" REALPATH)
get_filename_component(
_ROCPROFSYS_DEFAULT_ROCM_PATH
"${ROCPROFSYS_DEFAULT_ROCM_PATH}"
REALPATH
)
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)
CACHE PATH
"Default search path for ROCM"
FORCE
)
endif()
endif()
@@ -105,8 +131,11 @@ find_package_handle_standard_args(pthread-library REQUIRED_VARS pthread_LIBRARY)
if(pthread_LIBRARY)
target_link_libraries(rocprofiler-systems-threading INTERFACE ${pthread_LIBRARY})
else()
find_package(Threads ${rocprofiler_systems_FIND_QUIETLY}
${rocprofiler_systems_FIND_REQUIREMENT})
find_package(
Threads
${rocprofiler_systems_FIND_QUIETLY}
${rocprofiler_systems_FIND_REQUIREMENT}
)
if(Threads_FOUND)
target_link_libraries(rocprofiler-systems-threading INTERFACE Threads::Threads)
endif()
@@ -131,8 +160,12 @@ if(ROCPROFSYS_USE_ROCM)
if(NOT ROCmVersion_FOUND)
find_package(
hip ${rocprofiler_systems_FIND_QUIETLY} REQUIRED HINTS
${ROCPROFSYS_DEFAULT_ROCM_PATH} PATHS ${ROCPROFSYS_DEFAULT_ROCM_PATH})
hip
${rocprofiler_systems_FIND_QUIETLY}
REQUIRED
HINTS ${ROCPROFSYS_DEFAULT_ROCM_PATH}
PATHS ${ROCPROFSYS_DEFAULT_ROCM_PATH}
)
if(SPACK_BUILD)
find_package(ROCmVersion HINTS ${ROCM_PATH} PATHS ${ROCM_PATH})
else()
@@ -148,7 +181,9 @@ if(ROCPROFSYS_USE_ROCM)
set(_LOCAL_VAR _local_${_V}_VERSION)
set(ROCmVersion_${_V}_VERSION
"${${_LOCAL_VAR}}"
CACHE STRING "ROCm ${_V} version")
CACHE STRING
"ROCm ${_V} version"
)
rocm_version_watch_for_change(${_CACHE_VAR})
endforeach()
else()
@@ -162,7 +197,8 @@ if(ROCPROFSYS_USE_ROCM)
set(ROCPROFSYS_ROCM_VERSION ${ROCmVersion_TRIPLE_VERSION})
rocprofiler_systems_add_feature(ROCPROFSYS_ROCM_VERSION
"ROCm version used by rocprofiler-systems")
"ROCm version used by rocprofiler-systems"
)
else()
set(ROCPROFSYS_ROCM_VERSION "0.0.0")
set(ROCPROFSYS_ROCM_VERSION_MAJOR 0)
@@ -179,9 +215,12 @@ endif()
if(ROCPROFSYS_USE_ROCM)
find_package(rocprofiler-sdk ${rocprofiler_systems_FIND_QUIETLY} REQUIRED)
rocprofiler_systems_target_compile_definitions(rocprofiler-systems-rocm
INTERFACE ROCPROFSYS_USE_ROCM)
target_link_libraries(rocprofiler-systems-rocm
INTERFACE rocprofiler-sdk::rocprofiler-sdk)
INTERFACE ROCPROFSYS_USE_ROCM
)
target_link_libraries(
rocprofiler-systems-rocm
INTERFACE rocprofiler-sdk::rocprofiler-sdk
)
find_package(amd-smi ${rocprofiler_systems_FIND_QUIETLY} REQUIRED)
target_link_libraries(rocprofiler-systems-rocm INTERFACE amd-smi::amd-smi)
@@ -200,11 +239,13 @@ if(ROCPROFSYS_USE_MPI)
find_package(MPI ${rocprofiler_systems_FIND_QUIETLY} REQUIRED)
target_link_libraries(rocprofiler-systems-mpi INTERFACE MPI::MPI_C MPI::MPI_CXX)
rocprofiler_systems_target_compile_definitions(rocprofiler-systems-mpi
INTERFACE ROCPROFSYS_USE_MPI)
INTERFACE ROCPROFSYS_USE_MPI
)
elseif(ROCPROFSYS_USE_MPI_HEADERS)
find_package(MPI-Headers ${rocprofiler_systems_FIND_QUIETLY} REQUIRED)
rocprofiler_systems_target_compile_definitions(rocprofiler-systems-mpi
INTERFACE ROCPROFSYS_USE_MPI_HEADERS)
INTERFACE ROCPROFSYS_USE_MPI_HEADERS
)
target_link_libraries(rocprofiler-systems-mpi INTERFACE MPI::MPI_HEADERS)
endif()
@@ -215,7 +256,8 @@ endif()
# ----------------------------------------------------------------------------------------#
rocprofiler_systems_target_compile_definitions(
rocprofiler-systems-ompt INTERFACE ROCPROFSYS_USE_OMPT=$<BOOL:${ROCPROFSYS_USE_OMPT}>)
rocprofiler-systems-ompt INTERFACE ROCPROFSYS_USE_OMPT=$<BOOL:${ROCPROFSYS_USE_OMPT}>
)
# ----------------------------------------------------------------------------------------#
#
@@ -228,26 +270,17 @@ if(ROCPROFSYS_BUILD_DYNINST)
RELATIVE_PATH external/dyninst
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
REPO_URL https://github.com/ROCm/dyninst.git
REPO_BRANCH dyninst_13)
REPO_BRANCH dyninst_13
)
set(DYNINST_OPTION_PREFIX ON)
set(DYNINST_BUILD_DOCS OFF)
set(DYNINST_BUILD_RTLIB OFF)
set(DYNINST_QUIET_CONFIG
ON
CACHE BOOL "Suppress dyninst cmake messages")
set(DYNINST_BUILD_PARSE_THAT
OFF
CACHE BOOL "Build dyninst parseThat executable")
set(DYNINST_BUILD_SHARED_LIBS
ON
CACHE BOOL "Build shared dyninst libraries")
set(DYNINST_BUILD_STATIC_LIBS
OFF
CACHE BOOL "Build static dyninst libraries")
set(DYNINST_ENABLE_LTO
OFF
CACHE BOOL "Enable LTO for dyninst libraries")
set(DYNINST_QUIET_CONFIG ON CACHE BOOL "Suppress dyninst cmake messages")
set(DYNINST_BUILD_PARSE_THAT OFF CACHE BOOL "Build dyninst parseThat executable")
set(DYNINST_BUILD_SHARED_LIBS ON CACHE BOOL "Build shared dyninst libraries")
set(DYNINST_BUILD_STATIC_LIBS OFF CACHE BOOL "Build static dyninst libraries")
set(DYNINST_ENABLE_LTO OFF CACHE BOOL "Enable LTO for dyninst libraries")
if(NOT DEFINED CMAKE_INSTALL_RPATH)
set(CMAKE_INSTALL_RPATH "")
@@ -259,7 +292,8 @@ if(ROCPROFSYS_BUILD_DYNINST)
rocprofiler_systems_save_variables(
PIC VARIABLES CMAKE_POSITION_INDEPENDENT_CODE CMAKE_INSTALL_RPATH
CMAKE_BUILD_RPATH CMAKE_INSTALL_RPATH_USE_LINK_PATH)
CMAKE_BUILD_RPATH CMAKE_INSTALL_RPATH_USE_LINK_PATH
)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH OFF)
@@ -267,18 +301,33 @@ if(ROCPROFSYS_BUILD_DYNINST)
set(CMAKE_INSTALL_RPATH "\$ORIGIN:\$ORIGIN/${PROJECT_NAME}")
set(DYNINST_TPL_INSTALL_PREFIX
"${PROJECT_NAME}"
CACHE PATH "Third-party library install-tree install prefix" FORCE)
CACHE PATH
"Third-party library install-tree install prefix"
FORCE
)
set(DYNINST_TPL_INSTALL_LIB_DIR
"${PROJECT_NAME}"
CACHE PATH "Third-party library install-tree install library prefix" FORCE)
CACHE PATH
"Third-party library install-tree install library prefix"
FORCE
)
add_subdirectory(external/dyninst EXCLUDE_FROM_ALL)
rocprofiler_systems_restore_variables(
PIC VARIABLES CMAKE_POSITION_INDEPENDENT_CODE CMAKE_INSTALL_RPATH
CMAKE_BUILD_RPATH CMAKE_INSTALL_RPATH_USE_LINK_PATH)
CMAKE_BUILD_RPATH CMAKE_INSTALL_RPATH_USE_LINK_PATH
)
add_library(Dyninst::Dyninst INTERFACE IMPORTED)
foreach(_LIB common dyninstAPI parseAPI instructionAPI symtabAPI stackwalk)
foreach(
_LIB
common
dyninstAPI
parseAPI
instructionAPI
symtabAPI
stackwalk
)
target_link_libraries(Dyninst::Dyninst INTERFACE Dyninst::${_LIB})
endforeach()
@@ -293,14 +342,16 @@ if(ROCPROFSYS_BUILD_DYNINST)
patchAPI
pcontrol
stackwalk
symtabAPI)
symtabAPI
)
if(TARGET ${_LIB})
install(
TARGETS ${_LIB}
DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}
COMPONENT dyninst
PUBLIC_HEADER
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/dyninst)
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/dyninst
)
endif()
endforeach()
@@ -315,7 +366,8 @@ if(ROCPROFSYS_BUILD_DYNINST)
patchAPI
pcontrol
stackwalk
symtabAPI)
symtabAPI
)
if(TARGET ${_LIB})
add_dependencies(${_LIB} external-prebuild)
if(NOT TARGET Dyninst::${_LIB})
@@ -325,18 +377,24 @@ if(ROCPROFSYS_BUILD_DYNINST)
endforeach()
target_link_libraries(rocprofiler-systems-dyninst INTERFACE Dyninst::Dyninst)
else()
# Find Boost before finding Dyninst
find_package(Boost)
if(NOT TARGET Dyninst::Boost_headers)
add_library(Dyninst::Boost_headers INTERFACE IMPORTED)
target_include_directories(Dyninst::Boost_headers SYSTEM
INTERFACE ${Boost_INCLUDE_DIRS})
target_include_directories(
Dyninst::Boost_headers
SYSTEM
INTERFACE ${Boost_INCLUDE_DIRS}
)
endif()
find_package(Dyninst ${rocprofiler_systems_FIND_QUIETLY} REQUIRED
COMPONENTS dyninstAPI parseAPI instructionAPI symtabAPI)
find_package(
Dyninst
${rocprofiler_systems_FIND_QUIETLY}
REQUIRED
COMPONENTS dyninstAPI parseAPI instructionAPI symtabAPI
)
if(TARGET Dyninst::Dyninst) # updated Dyninst CMake system was found
target_link_libraries(rocprofiler-systems-dyninst INTERFACE Dyninst::Dyninst)
@@ -344,22 +402,33 @@ else()
set(_BOOST_COMPONENTS atomic system thread date_time)
set(rocprofiler_systems_BOOST_COMPONENTS
"${_BOOST_COMPONENTS}"
CACHE STRING "Boost components used by Dyninst in rocprofiler-systems")
CACHE STRING
"Boost components used by Dyninst in rocprofiler-systems"
)
set(Boost_NO_BOOST_CMAKE ON)
find_package(Boost QUIET REQUIRED
COMPONENTS ${rocprofiler_systems_BOOST_COMPONENTS})
find_package(
Boost
QUIET
REQUIRED
COMPONENTS ${rocprofiler_systems_BOOST_COMPONENTS}
)
# some installs of dyninst don't set this properly
if(EXISTS "${DYNINST_INCLUDE_DIR}" AND NOT DYNINST_HEADER_DIR)
get_filename_component(DYNINST_HEADER_DIR "${DYNINST_INCLUDE_DIR}" REALPATH
CACHE)
get_filename_component(
DYNINST_HEADER_DIR
"${DYNINST_INCLUDE_DIR}"
REALPATH
CACHE
)
else()
find_path(
DYNINST_HEADER_DIR
NAMES BPatch.h dyninstAPI_RT.h
HINTS ${Dyninst_ROOT_DIR} ${Dyninst_DIR} ${Dyninst_DIR}/../../..
PATHS ${Dyninst_ROOT_DIR} ${Dyninst_DIR} ${Dyninst_DIR}/../../..
PATH_SUFFIXES include)
PATH_SUFFIXES include
)
endif()
# try to find TBB
@@ -372,14 +441,13 @@ else()
endif()
if(NOT TBB_FOUND)
find_path(
TBB_INCLUDE_DIR
NAMES tbb/tbb.h
PATH_SUFFIXES include)
find_path(TBB_INCLUDE_DIR NAMES tbb/tbb.h PATH_SUFFIXES include)
endif()
target_link_libraries(rocprofiler-systems-dyninst INTERFACE ${DYNINST_LIBRARIES}
${Boost_LIBRARIES})
target_link_libraries(
rocprofiler-systems-dyninst
INTERFACE ${DYNINST_LIBRARIES} ${Boost_LIBRARIES}
)
foreach(
_TARG
dyninst
@@ -392,22 +460,30 @@ else()
system
thread
date_time
TBB)
TBB
)
if(TARGET Dyninst::${_TARG})
target_link_libraries(rocprofiler-systems-dyninst
INTERFACE Dyninst::${_TARG})
target_link_libraries(
rocprofiler-systems-dyninst
INTERFACE Dyninst::${_TARG}
)
elseif(TARGET Boost::${_TARG})
target_link_libraries(rocprofiler-systems-dyninst
INTERFACE Boost::${_TARG})
target_link_libraries(
rocprofiler-systems-dyninst
INTERFACE Boost::${_TARG}
)
elseif(TARGET ${_TARG})
target_link_libraries(rocprofiler-systems-dyninst INTERFACE ${_TARG})
endif()
endforeach()
target_include_directories(
rocprofiler-systems-dyninst SYSTEM
INTERFACE ${TBB_INCLUDE_DIR} ${Boost_INCLUDE_DIRS} ${DYNINST_HEADER_DIR})
rocprofiler-systems-dyninst
SYSTEM
INTERFACE ${TBB_INCLUDE_DIR} ${Boost_INCLUDE_DIRS} ${DYNINST_HEADER_DIR}
)
rocprofiler_systems_target_compile_definitions(rocprofiler-systems-dyninst
INTERFACE ROCPROFSYS_USE_DYNINST)
INTERFACE ROCPROFSYS_USE_DYNINST
)
endif()
endif()
@@ -451,7 +527,8 @@ rocprofiler_systems_checkout_git_submodule(
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
REPO_URL https://github.com/google/perfetto.git
REPO_BRANCH v46.0
TEST_FILE sdk/perfetto.cc)
TEST_FILE sdk/perfetto.cc
)
include(Perfetto)
@@ -466,7 +543,8 @@ if(ROCPROFSYS_BUILD_DEVICETRACE)
RELATIVE_PATH external/elfio
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
REPO_URL https://github.com/jrmadsen/ELFIO.git
REPO_BRANCH set-offset-support)
REPO_BRANCH set-offset-support
)
add_subdirectory(external/elfio)
endif()
@@ -489,123 +567,144 @@ endif()
target_compile_definitions(
rocprofiler-systems-timemory-config
INTERFACE TIMEMORY_PAPI_ARRAY_SIZE=12 TIMEMORY_USE_ROOFLINE=0 TIMEMORY_USE_ERT=0
TIMEMORY_USE_CONTAINERS=0 TIMEMORY_USE_ERT_EXTERN=0
TIMEMORY_USE_CONTAINERS_EXTERN=0)
INTERFACE
TIMEMORY_PAPI_ARRAY_SIZE=12
TIMEMORY_USE_ROOFLINE=0
TIMEMORY_USE_ERT=0
TIMEMORY_USE_CONTAINERS=0
TIMEMORY_USE_ERT_EXTERN=0
TIMEMORY_USE_CONTAINERS_EXTERN=0
)
if(ROCPROFSYS_BUILD_STACK_PROTECTOR)
add_target_flag_if_avail(rocprofiler-systems-timemory-config
"-fstack-protector-strong" "-Wstack-protector")
"-fstack-protector-strong" "-Wstack-protector"
)
endif()
if(ROCPROFSYS_BUILD_DEBUG)
add_target_flag_if_avail(rocprofiler-systems-timemory-config
"-fno-omit-frame-pointer" "-g3")
"-fno-omit-frame-pointer" "-g3"
)
endif()
set(TIMEMORY_EXTERNAL_INTERFACE_LIBRARY
rocprofiler-systems-timemory-config
CACHE STRING "timemory configuration interface library")
set(TIMEMORY_INSTALL_HEADERS
OFF
CACHE BOOL "Disable timemory header install")
set(TIMEMORY_INSTALL_CONFIG
OFF
CACHE BOOL "Disable timemory cmake configuration install")
CACHE STRING
"timemory configuration interface library"
)
set(TIMEMORY_INSTALL_HEADERS OFF CACHE BOOL "Disable timemory header install")
set(TIMEMORY_INSTALL_CONFIG OFF CACHE BOOL "Disable timemory cmake configuration install")
set(TIMEMORY_INSTALL_LIBRARIES
OFF
CACHE BOOL "Disable timemory installation of libraries not needed at runtime")
set(TIMEMORY_INSTALL_ALL
OFF
CACHE BOOL "Disable install target depending on all target")
set(TIMEMORY_BUILD_C
OFF
CACHE BOOL "Disable timemory C library")
set(TIMEMORY_BUILD_FORTRAN
OFF
CACHE BOOL "Disable timemory Fortran library")
set(TIMEMORY_BUILD_TOOLS
OFF
CACHE BOOL "Ensure timem executable is built")
CACHE BOOL
"Disable timemory installation of libraries not needed at runtime"
)
set(TIMEMORY_INSTALL_ALL OFF CACHE BOOL "Disable install target depending on all target")
set(TIMEMORY_BUILD_C OFF CACHE BOOL "Disable timemory C library")
set(TIMEMORY_BUILD_FORTRAN OFF CACHE BOOL "Disable timemory Fortran library")
set(TIMEMORY_BUILD_TOOLS OFF CACHE BOOL "Ensure timem executable is built")
set(TIMEMORY_BUILD_EXCLUDE_FROM_ALL
ON
CACHE BOOL "Set timemory to only build dependencies")
CACHE BOOL
"Set timemory to only build dependencies"
)
set(TIMEMORY_BUILD_HIDDEN_VISIBILITY
ON
CACHE BOOL "Build timemory with hidden visibility")
set(TIMEMORY_QUIET_CONFIG
ON
CACHE BOOL "Make timemory configuration quieter")
CACHE BOOL
"Build timemory with hidden visibility"
)
set(TIMEMORY_QUIET_CONFIG ON CACHE BOOL "Make timemory configuration quieter")
# timemory feature settings
set(TIMEMORY_USE_GOTCHA
ON
CACHE BOOL "Enable GOTCHA support in timemory")
set(TIMEMORY_USE_PERFETTO
OFF
CACHE BOOL "Disable perfetto support in timemory")
set(TIMEMORY_USE_GOTCHA ON CACHE BOOL "Enable GOTCHA support in timemory")
set(TIMEMORY_USE_PERFETTO OFF CACHE BOOL "Disable perfetto support in timemory")
set(TIMEMORY_USE_OMPT
${ROCPROFSYS_USE_OMPT}
CACHE BOOL "Enable OMPT support in timemory" FORCE)
CACHE BOOL
"Enable OMPT support in timemory"
FORCE
)
set(TIMEMORY_USE_PAPI
${ROCPROFSYS_USE_PAPI}
CACHE BOOL "Enable PAPI support in timemory" FORCE)
CACHE BOOL
"Enable PAPI support in timemory"
FORCE
)
set(TIMEMORY_USE_BFD
${ROCPROFSYS_USE_BFD}
CACHE BOOL "Enable BFD support in timemory" FORCE)
set(TIMEMORY_USE_LIBUNWIND
ON
CACHE BOOL "Enable libunwind support in timemory")
set(TIMEMORY_USE_VISIBILITY
OFF
CACHE BOOL "Enable/disable using visibility decorations")
CACHE BOOL
"Enable BFD support in timemory"
FORCE
)
set(TIMEMORY_USE_LIBUNWIND ON CACHE BOOL "Enable libunwind support in timemory")
set(TIMEMORY_USE_VISIBILITY OFF CACHE BOOL "Enable/disable using visibility decorations")
set(TIMEMORY_USE_SANITIZER
${ROCPROFSYS_USE_SANITIZER}
CACHE BOOL "Build with -fsanitze=\${ROCPROFSYS_SANITIZER_TYPE}" FORCE)
CACHE BOOL
"Build with -fsanitze=\${ROCPROFSYS_SANITIZER_TYPE}"
FORCE
)
set(TIMEMORY_SANITIZER_TYPE
${ROCPROFSYS_SANITIZER_TYPE}
CACHE STRING "Sanitizer type, e.g. leak, thread, address, memory, etc." FORCE)
CACHE STRING
"Sanitizer type, e.g. leak, thread, address, memory, etc."
FORCE
)
if(DEFINED TIMEMORY_BUILD_GOTCHA AND NOT TIMEMORY_BUILD_GOTCHA)
rocprofiler_systems_message(
FATAL_ERROR
"Using an external gotcha is not allowed due to known bug that has not been accepted upstream"
)
)
endif()
# timemory feature build settings
set(TIMEMORY_BUILD_GOTCHA
ON
CACHE BOOL "Enable building GOTCHA library from submodule" FORCE)
CACHE BOOL
"Enable building GOTCHA library from submodule"
FORCE
)
set(TIMEMORY_BUILD_LIBUNWIND
${ROCPROFSYS_BUILD_LIBUNWIND}
CACHE BOOL "Enable building libunwind library from submodule" FORCE)
CACHE BOOL
"Enable building libunwind library from submodule"
FORCE
)
set(TIMEMORY_BUILD_EXTRA_OPTIMIZATIONS
${ROCPROFSYS_BUILD_EXTRA_OPTIMIZATIONS}
CACHE BOOL "Enable building GOTCHA library from submodule" FORCE)
set(TIMEMORY_BUILD_ERT
OFF
CACHE BOOL "Disable building ERT support" FORCE)
CACHE BOOL
"Enable building GOTCHA library from submodule"
FORCE
)
set(TIMEMORY_BUILD_ERT OFF CACHE BOOL "Disable building ERT support" FORCE)
set(TIMEMORY_BUILD_CONTAINERS
OFF
CACHE BOOL "Disable building container extern templates (unused)" FORCE)
CACHE BOOL
"Disable building container extern templates (unused)"
FORCE
)
# timemory build settings
set(TIMEMORY_TLS_MODEL
"global-dynamic"
CACHE STRING "Thread-local static model" FORCE)
set(TIMEMORY_TLS_MODEL "global-dynamic" CACHE STRING "Thread-local static model" FORCE)
set(TIMEMORY_MAX_THREADS
"${ROCPROFSYS_MAX_THREADS}"
CACHE STRING "Max statically-allocated threads" FORCE)
CACHE STRING
"Max statically-allocated threads"
FORCE
)
set(TIMEMORY_SETTINGS_PREFIX
"ROCPROFSYS_"
CACHE STRING "Prefix used for settings and environment variables")
set(TIMEMORY_PROJECT_NAME
"rocprofiler-systems"
CACHE STRING "Name for configuration")
CACHE STRING
"Prefix used for settings and environment variables"
)
set(TIMEMORY_PROJECT_NAME "rocprofiler-systems" CACHE STRING "Name for configuration")
set(TIMEMORY_CXX_LIBRARY_EXCLUDE
"kokkosp.cpp;pthread.cpp;timemory_c.cpp;trace.cpp;weak.cpp;library.cpp"
CACHE STRING "Timemory C++ library implementation files to exclude from compiling")
CACHE STRING
"Timemory C++ library implementation files to exclude from compiling"
)
mark_as_advanced(TIMEMORY_SETTINGS_PREFIX)
mark_as_advanced(TIMEMORY_PROJECT_NAME)
@@ -614,11 +713,13 @@ rocprofiler_systems_checkout_git_submodule(
RELATIVE_PATH external/timemory
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
REPO_URL https://github.com/ROCm/timemory.git
REPO_BRANCH omnitrace)
REPO_BRANCH omnitrace
)
rocprofiler_systems_save_variables(
BUILD_CONFIG VARIABLES BUILD_SHARED_LIBS BUILD_STATIC_LIBS
CMAKE_POSITION_INDEPENDENT_CODE CMAKE_PREFIX_PATH)
CMAKE_POSITION_INDEPENDENT_CODE CMAKE_PREFIX_PATH
)
# ensure timemory builds PIC static libs so that we don't have to install timemory shared
# lib
@@ -629,9 +730,7 @@ set(TIMEMORY_CTP_OPTIONS GLOBAL)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
# results in undefined symbols to component::base<T>::load()
set(TIMEMORY_BUILD_HIDDEN_VISIBILITY
OFF
CACHE BOOL "" FORCE)
set(TIMEMORY_BUILD_HIDDEN_VISIBILITY OFF CACHE BOOL "" FORCE)
endif()
add_subdirectory(external/timemory EXCLUDE_FROM_ALL)
@@ -639,23 +738,32 @@ add_subdirectory(external/timemory EXCLUDE_FROM_ALL)
install(
TARGETS gotcha
DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}
COMPONENT gotcha)
COMPONENT gotcha
)
if(ROCPROFSYS_BUILD_LIBUNWIND)
install(
DIRECTORY ${PROJECT_BINARY_DIR}/external/timemory/external/libunwind/install/lib/
DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}
COMPONENT libunwind
FILES_MATCHING
PATTERN "*${CMAKE_SHARED_LIBRARY_SUFFIX}*")
PATTERN "*${CMAKE_SHARED_LIBRARY_SUFFIX}*"
)
endif()
rocprofiler_systems_restore_variables(
BUILD_CONFIG VARIABLES BUILD_SHARED_LIBS BUILD_STATIC_LIBS
CMAKE_POSITION_INDEPENDENT_CODE CMAKE_PREFIX_PATH)
CMAKE_POSITION_INDEPENDENT_CODE CMAKE_PREFIX_PATH
)
if(TARGET rocprofiler-systems-papi-build)
foreach(_TARGET PAPI::papi timemory-core timemory-common timemory-papi-component
timemory-cxx)
foreach(
_TARGET
PAPI::papi
timemory-core
timemory-common
timemory-papi-component
timemory-cxx
)
if(TARGET "${_TARGET}")
add_dependencies(${_TARGET} rocprofiler-systems-papi-build)
endif()
@@ -669,21 +777,28 @@ endif()
target_link_libraries(
rocprofiler-systems-timemory
INTERFACE $<BUILD_INTERFACE:timemory::timemory-headers>
$<BUILD_INTERFACE:timemory::timemory-gotcha>
$<BUILD_INTERFACE:timemory::timemory-cxx-static>)
INTERFACE
$<BUILD_INTERFACE:timemory::timemory-headers>
$<BUILD_INTERFACE:timemory::timemory-gotcha>
$<BUILD_INTERFACE:timemory::timemory-cxx-static>
)
target_link_libraries(rocprofiler-systems-bfd
INTERFACE $<BUILD_INTERFACE:timemory::timemory-bfd>)
target_link_libraries(
rocprofiler-systems-bfd
INTERFACE $<BUILD_INTERFACE:timemory::timemory-bfd>
)
if(ROCPROFSYS_USE_BFD)
rocprofiler_systems_target_compile_definitions(rocprofiler-systems-bfd
INTERFACE ROCPROFSYS_USE_BFD)
INTERFACE ROCPROFSYS_USE_BFD
)
endif()
find_package(Libva-headers ${rocprofiler_systems_FIND_QUIETLY} REQUIRED)
target_include_directories(rocprofiler-systems-libva
INTERFACE ${LIBVA_HEADERS_INCLUDE_DIR})
target_include_directories(
rocprofiler-systems-libva
INTERFACE ${LIBVA_HEADERS_INCLUDE_DIR}
)
# ----------------------------------------------------------------------------------------#
#
@@ -697,7 +812,8 @@ if(NOT TARGET PTL::ptl-shared)
RELATIVE_PATH external/PTL
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
REPO_URL https://github.com/jrmadsen/PTL.git
REPO_BRANCH omnitrace)
REPO_BRANCH omnitrace
)
set(PTL_BUILD_EXAMPLES OFF)
set(PTL_USE_TBB OFF)
@@ -711,7 +827,8 @@ if(NOT TARGET PTL::ptl-shared)
BUILD_CONFIG
VARIABLES BUILD_SHARED_LIBS BUILD_STATIC_LIBS BUILD_OBJECT_LIBS
CMAKE_POSITION_INDEPENDENT_CODE CMAKE_CXX_VISIBILITY_PRESET
CMAKE_VISIBILITY_INLINES_HIDDEN)
CMAKE_VISIBILITY_INLINES_HIDDEN
)
set(BUILD_SHARED_LIBS OFF)
set(BUILD_STATIC_LIBS OFF)
@@ -726,15 +843,20 @@ if(NOT TARGET PTL::ptl-shared)
BUILD_CONFIG
VARIABLES BUILD_SHARED_LIBS BUILD_STATIC_LIBS BUILD_OBJECT_LIBS
CMAKE_POSITION_INDEPENDENT_CODE CMAKE_CXX_VISIBILITY_PRESET
CMAKE_VISIBILITY_INLINES_HIDDEN)
CMAKE_VISIBILITY_INLINES_HIDDEN
)
endif()
target_sources(rocprofiler-systems-ptl
INTERFACE $<BUILD_INTERFACE:$<TARGET_OBJECTS:PTL::ptl-object>>)
target_sources(
rocprofiler-systems-ptl
INTERFACE $<BUILD_INTERFACE:$<TARGET_OBJECTS:PTL::ptl-object>>
)
target_include_directories(
rocprofiler-systems-ptl
INTERFACE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/external/PTL/source>
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/external/PTL/source>)
INTERFACE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/external/PTL/source>
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/external/PTL/source>
)
# ----------------------------------------------------------------------------------------#
#
@@ -748,7 +870,8 @@ include(Compilers)
if(ROCPROFSYS_BUILD_STATIC_LIBSTDCXX)
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
rocprofiler_systems_restore_variables(STATIC_LIBSTDCXX_CXX
VARIABLES CMAKE_CXX_FLAGS)
VARIABLES CMAKE_CXX_FLAGS
)
endif()
endif()
@@ -802,10 +925,13 @@ if(ROCPROFSYS_USE_PYTHON)
FAIL
PREFIX ${ROCPROFSYS_PYTHON_PREFIX}
PATHS ${ROCPROFSYS_PYTHON_ENVS}
OUTPUT_VARIABLE _PYTHON_ROOT_DIRS)
OUTPUT_VARIABLE _PYTHON_ROOT_DIRS
)
set(ROCPROFSYS_PYTHON_ROOT_DIRS
"${_PYTHON_ROOT_DIRS}"
CACHE INTERNAL "Root directories for python")
CACHE INTERNAL
"Root directories for python"
)
endif()
if(NOT ROCPROFSYS_PYTHON_VERSIONS AND ROCPROFSYS_PYTHON_VERSION)
@@ -813,9 +939,7 @@ if(ROCPROFSYS_USE_PYTHON)
if(NOT ROCPROFSYS_PYTHON_ROOT_DIRS)
rocprofiler_systems_find_python(_PY VERSION ${ROCPROFSYS_PYTHON_VERSION})
set(ROCPROFSYS_PYTHON_ROOT_DIRS
"${_PY_ROOT_DIR}"
CACHE INTERNAL "" FORCE)
set(ROCPROFSYS_PYTHON_ROOT_DIRS "${_PY_ROOT_DIR}" CACHE INTERNAL "" FORCE)
endif()
unset(ROCPROFSYS_PYTHON_VERSION CACHE)
@@ -823,7 +947,8 @@ if(ROCPROFSYS_USE_PYTHON)
elseif(
NOT ROCPROFSYS_PYTHON_VERSIONS
AND NOT ROCPROFSYS_PYTHON_VERSION
AND ROCPROFSYS_PYTHON_ROOT_DIRS)
AND ROCPROFSYS_PYTHON_ROOT_DIRS
)
set(_PY_VERSIONS)
foreach(_DIR ${ROCPROFSYS_PYTHON_ROOT_DIRS})
@@ -838,20 +963,15 @@ if(ROCPROFSYS_USE_PYTHON)
endif()
endforeach()
set(ROCPROFSYS_PYTHON_VERSIONS
"${_PY_VERSIONS}"
CACHE INTERNAL "" FORCE)
set(ROCPROFSYS_PYTHON_VERSIONS "${_PY_VERSIONS}" CACHE INTERNAL "" FORCE)
elseif(
NOT ROCPROFSYS_PYTHON_VERSIONS
AND NOT ROCPROFSYS_PYTHON_VERSION
AND NOT ROCPROFSYS_PYTHON_ROOT_DIRS)
AND NOT ROCPROFSYS_PYTHON_ROOT_DIRS
)
rocprofiler_systems_find_python(_PY REQUIRED)
set(ROCPROFSYS_PYTHON_ROOT_DIRS
"${_PY_ROOT_DIR}"
CACHE INTERNAL "" FORCE)
set(ROCPROFSYS_PYTHON_VERSIONS
"${_PY_VERSION}"
CACHE INTERNAL "" FORCE)
set(ROCPROFSYS_PYTHON_ROOT_DIRS "${_PY_ROOT_DIR}" CACHE INTERNAL "" FORCE)
set(ROCPROFSYS_PYTHON_VERSIONS "${_PY_VERSION}" CACHE INTERNAL "" FORCE)
endif()
rocprofiler_systems_watch_for_change(ROCPROFSYS_PYTHON_ROOT_DIRS)
@@ -864,16 +984,22 @@ if(ROCPROFSYS_USE_PYTHON)
if(_NUM_PYTHON_VERSIONS GREATER 1)
set(ROCPROFSYS_INSTALL_PYTHONDIR
"${CMAKE_INSTALL_LIBDIR}/python/site-packages"
CACHE STRING "Installation prefix for python")
CACHE STRING
"Installation prefix for python"
)
else()
set(ROCPROFSYS_INSTALL_PYTHONDIR
"${CMAKE_INSTALL_LIBDIR}/python${ROCPROFSYS_PYTHON_VERSIONS}/site-packages"
CACHE STRING "Installation prefix for python")
CACHE STRING
"Installation prefix for python"
)
endif()
else()
set(ROCPROFSYS_INSTALL_PYTHONDIR
"${CMAKE_INSTALL_LIBDIR}/python/site-packages"
CACHE STRING "Installation prefix for python")
CACHE STRING
"Installation prefix for python"
)
endif()
rocprofiler_systems_watch_for_change(ROCPROFSYS_INSTALL_PYTHONDIR)
@@ -889,16 +1015,20 @@ if("${CMAKE_BUILD_TYPE}" MATCHES "Release" AND NOT ROCPROFSYS_BUILD_DEBUG)
add_target_flag_if_avail(rocprofiler-systems-compile-options "-g1")
endif()
target_compile_definitions(rocprofiler-systems-compile-definitions
INTERFACE ROCPROFSYS_MAX_THREADS=${ROCPROFSYS_MAX_THREADS})
target_compile_definitions(
rocprofiler-systems-compile-definitions
INTERFACE ROCPROFSYS_MAX_THREADS=${ROCPROFSYS_MAX_THREADS}
)
foreach(_LIB ${ROCPROFSYS_EXTENSION_LIBRARIES})
get_target_property(_COMPILE_DEFS ${_LIB} INTERFACE_COMPILE_DEFINITIONS)
if(_COMPILE_DEFS)
foreach(_DEF ${_COMPILE_DEFS})
if("${_DEF}" MATCHES "ROCPROFSYS_")
target_compile_definitions(rocprofiler-systems-compile-definitions
INTERFACE ${_DEF})
target_compile_definitions(
rocprofiler-systems-compile-definitions
INTERFACE ${_DEF}
)
endif()
endforeach()
endif()
+134 -74
Просмотреть файл
@@ -16,15 +16,9 @@ include(ProcessorCount)
#
# ---------------------------------------------------------------------------------------#
find_program(
ROCPROFSYS_COPY_EXECUTABLE
NAMES cp
PATH_SUFFIXES bin)
find_program(ROCPROFSYS_COPY_EXECUTABLE NAMES cp PATH_SUFFIXES bin)
find_program(
ROCPROFSYS_NINJA_EXECUTABLE
NAMES ninja
PATH_SUFFIXES bin)
find_program(ROCPROFSYS_NINJA_EXECUTABLE NAMES ninja PATH_SUFFIXES bin)
mark_as_advanced(ROCPROFSYS_COPY_EXECUTABLE)
mark_as_advanced(ROCPROFSYS_NINJA_EXECUTABLE)
@@ -35,7 +29,7 @@ mark_as_advanced(ROCPROFSYS_NINJA_EXECUTABLE)
#
# ---------------------------------------------------------------------------------------#
processorcount(NUM_PROCS_REAL)
ProcessorCount(NUM_PROCS_REAL)
math(EXPR _NUM_THREADS "${NUM_PROCS_REAL} - (${NUM_PROCS_REAL} / 2)")
if(_NUM_THREADS GREATER 8)
set(_NUM_THREADS 8)
@@ -46,32 +40,38 @@ endif()
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)
${PROJECT_BINARY_DIR}/external/perfetto/source/out/linux
)
set(ROCPROFSYS_PERFETTO_INSTALL_DIR
${PROJECT_BINARY_DIR}/external/perfetto/source/out/linux/stripped)
${PROJECT_BINARY_DIR}/external/perfetto/source/out/linux/stripped
)
set(ROCPROFSYS_PERFETTO_LINK_FLAGS
"-static-libgcc"
CACHE STRING "Link flags for perfetto")
CACHE STRING
"Link flags for perfetto"
)
set(ROCPROFSYS_PERFETTO_BUILD_THREADS
${_NUM_THREADS}
CACHE STRING "Number of threads to use when building perfetto tools")
CACHE STRING
"Number of threads to use when building perfetto tools"
)
if(CMAKE_CXX_COMPILER_IS_CLANG)
set(PERFETTO_IS_CLANG true)
set(ROCPROFSYS_PERFETTO_C_FLAGS
""
CACHE STRING "Perfetto C flags")
set(ROCPROFSYS_PERFETTO_CXX_FLAGS
""
CACHE STRING "Perfetto C++ flags")
set(ROCPROFSYS_PERFETTO_C_FLAGS "" CACHE STRING "Perfetto C flags")
set(ROCPROFSYS_PERFETTO_CXX_FLAGS "" CACHE STRING "Perfetto C++ flags")
else()
set(PERFETTO_IS_CLANG false)
set(ROCPROFSYS_PERFETTO_C_FLAGS
"-static-libgcc -Wno-maybe-uninitialized -Wno-stringop-overflow"
CACHE STRING "Perfetto C flags")
CACHE STRING
"Perfetto C flags"
)
set(ROCPROFSYS_PERFETTO_CXX_FLAGS
"-static-libgcc -Wno-maybe-uninitialized -Wno-stringop-overflow -Wno-mismatched-new-delete"
CACHE STRING "Perfetto C++ flags")
CACHE STRING
"Perfetto C++ flags"
)
endif()
mark_as_advanced(ROCPROFSYS_PERFETTO_C_FLAGS)
@@ -81,7 +81,10 @@ mark_as_advanced(ROCPROFSYS_PERFETTO_LINK_FLAGS)
if(NOT ROCPROFSYS_NINJA_EXECUTABLE)
set(ROCPROFSYS_NINJA_EXECUTABLE
${ROCPROFSYS_PERFETTO_TOOLS_DIR}/ninja
CACHE FILEPATH "Ninja" FORCE)
CACHE FILEPATH
"Ninja"
FORCE
)
endif()
# ---------------------------------------------------------------------------------------#
@@ -91,37 +94,61 @@ endif()
# ---------------------------------------------------------------------------------------#
if(NOT EXISTS "${ROCPROFSYS_PERFETTO_SOURCE_DIR}")
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory
${PROJECT_BINARY_DIR}/external/perfetto)
execute_process(
COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/external/perfetto
)
# cmake -E copy_directory fails for some reason
execute_process(
COMMAND ${ROCPROFSYS_COPY_EXECUTABLE} -r ${PROJECT_SOURCE_DIR}/external/perfetto/
${ROCPROFSYS_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)
string(
REGEX
REPLACE " perfetto::internal::ValidateEventNameType"
" ::perfetto::internal::ValidateEventNameType" _PERFETTO_HEADER
"${_PERFETTO_HEADER}")
REGEX REPLACE
" perfetto::internal::ValidateEventNameType"
" ::perfetto::internal::ValidateEventNameType"
_PERFETTO_HEADER
"${_PERFETTO_HEADER}"
)
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}")
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 ${ROCPROFSYS_PERFETTO_SOURCE_DIR}/sdk/perfetto.h.tmp "${_PERFETTO_HEADER}")
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
${ROCPROFSYS_PERFETTO_SOURCE_DIR}/sdk/perfetto.cc COPYONLY)
configure_file(${PROJECT_SOURCE_DIR}/cmake/Templates/args.gn.in
${ROCPROFSYS_PERFETTO_BINARY_DIR}/args.gn @ONLY)
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
${ROCPROFSYS_PERFETTO_SOURCE_DIR}/sdk/perfetto.cc
COPYONLY
)
configure_file(
${PROJECT_SOURCE_DIR}/cmake/Templates/args.gn.in
${ROCPROFSYS_PERFETTO_BINARY_DIR}/args.gn
@ONLY
)
# ---------------------------------------------------------------------------------------#
#
@@ -130,30 +157,29 @@ configure_file(${PROJECT_SOURCE_DIR}/cmake/Templates/args.gn.in
# ---------------------------------------------------------------------------------------#
if(ROCPROFSYS_INSTALL_PERFETTO_TOOLS)
find_program(
ROCPROFSYS_CURL_EXECUTABLE
NAMES curl
PATH_SUFFIXES bin)
find_program(ROCPROFSYS_CURL_EXECUTABLE NAMES curl PATH_SUFFIXES bin)
if(NOT ROCPROFSYS_CURL_EXECUTABLE)
rocprofiler_systems_message(
SEND_ERROR
"curl executable cannot be found. install-build-deps script for perfetto will fail"
)
)
endif()
externalproject_add(
ExternalProject_Add(
rocprofiler-systems-perfetto-build
PREFIX ${PROJECT_BINARY_DIR}/external/perfetto
SOURCE_DIR ${ROCPROFSYS_PERFETTO_SOURCE_DIR}
BUILD_IN_SOURCE 1
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}
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 ${ROCPROFSYS_PERFETTO_BINARY_DIR}/args.gn)
BUILD_BYPRODUCTS ${ROCPROFSYS_PERFETTO_BINARY_DIR}/args.gn
)
add_custom_target(
rocprofiler-systems-perfetto-clean
@@ -162,16 +188,26 @@ if(ROCPROFSYS_INSTALL_PERFETTO_TOOLS)
${CMAKE_COMMAND} -E rm -rf
${PROJECT_BINARY_DIR}/external/perfetto/src/rocprof-sys-perfetto-build-stamp
WORKING_DIRECTORY ${ROCPROFSYS_PERFETTO_BINARY_DIR}
COMMENT "Cleaning Perfetto...")
COMMENT "Cleaning Perfetto..."
)
install(
DIRECTORY ${ROCPROFSYS_PERFETTO_INSTALL_DIR}/
DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}
COMPONENT perfetto
FILES_MATCHING
PATTERN "*libperfetto.so*")
PATTERN "*libperfetto.so*"
)
foreach(_FILE perfetto traced tracebox traced_probes traced_perf trigger_perfetto)
foreach(
_FILE
perfetto
traced
tracebox
traced_probes
traced_perf
trigger_perfetto
)
if("${_FILE}" STREQUAL "perfetto")
string(REPLACE "_" "-" _INSTALL_FILE "rocprof-sys-${_FILE}")
else()
@@ -182,7 +218,8 @@ if(ROCPROFSYS_INSTALL_PERFETTO_TOOLS)
DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT perfetto
RENAME ${_INSTALL_FILE}
OPTIONAL)
OPTIONAL
)
endforeach()
endif()
@@ -193,34 +230,51 @@ endif()
# ---------------------------------------------------------------------------------------#
add_library(rocprofiler-systems-perfetto-library STATIC)
add_library(rocprofiler-systems::rocprofiler-systems-perfetto-library ALIAS
rocprofiler-systems-perfetto-library)
add_library(
rocprofiler-systems::rocprofiler-systems-perfetto-library
ALIAS rocprofiler-systems-perfetto-library
)
target_sources(
rocprofiler-systems-perfetto-library
PRIVATE ${ROCPROFSYS_PERFETTO_SOURCE_DIR}/sdk/perfetto.cc
${ROCPROFSYS_PERFETTO_SOURCE_DIR}/sdk/perfetto.h)
PRIVATE
${ROCPROFSYS_PERFETTO_SOURCE_DIR}/sdk/perfetto.cc
${ROCPROFSYS_PERFETTO_SOURCE_DIR}/sdk/perfetto.h
)
target_link_libraries(
rocprofiler-systems-perfetto-library
PRIVATE rocprofiler-systems::rocprofiler-systems-threading
rocprofiler-systems::rocprofiler-systems-static-libgcc
rocprofiler-systems::rocprofiler-systems-static-libstdcxx)
PRIVATE
rocprofiler-systems::rocprofiler-systems-threading
rocprofiler-systems::rocprofiler-systems-static-libgcc
rocprofiler-systems::rocprofiler-systems-static-libstdcxx
)
set_target_properties(
rocprofiler-systems-perfetto-library
PROPERTIES OUTPUT_NAME perfetto
ARCHIVE_OUTPUT_DIRECTORY ${ROCPROFSYS_PERFETTO_BINARY_DIR}
POSITION_INDEPENDENT_CODE ON
CXX_VISIBILITY_PRESET "internal")
PROPERTIES
OUTPUT_NAME perfetto
ARCHIVE_OUTPUT_DIRECTORY ${ROCPROFSYS_PERFETTO_BINARY_DIR}
POSITION_INDEPENDENT_CODE ON
CXX_VISIBILITY_PRESET "internal"
)
set(perfetto_DIR ${ROCPROFSYS_PERFETTO_SOURCE_DIR})
set(PERFETTO_ROOT_DIR
${ROCPROFSYS_PERFETTO_SOURCE_DIR}
CACHE PATH "Root Perfetto installation" FORCE)
CACHE PATH
"Root Perfetto installation"
FORCE
)
set(PERFETTO_INCLUDE_DIR
${ROCPROFSYS_PERFETTO_SOURCE_DIR}/sdk
CACHE PATH "Perfetto include folder" FORCE)
CACHE PATH
"Perfetto include folder"
FORCE
)
set(PERFETTO_LIBRARY
${ROCPROFSYS_PERFETTO_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}perfetto${CMAKE_STATIC_LIBRARY_SUFFIX}
CACHE FILEPATH "Perfetto library" FORCE)
CACHE FILEPATH
"Perfetto library"
FORCE
)
mark_as_advanced(PERFETTO_ROOT_DIR)
mark_as_advanced(PERFETTO_INCLUDE_DIR)
@@ -233,10 +287,16 @@ mark_as_advanced(PERFETTO_LIBRARY)
# ---------------------------------------------------------------------------------------#
rocprofiler_systems_target_compile_definitions(rocprofiler-systems-perfetto
INTERFACE ROCPROFSYS_USE_PERFETTO)
target_include_directories(rocprofiler-systems-perfetto SYSTEM
INTERFACE $<BUILD_INTERFACE:${PERFETTO_INCLUDE_DIR}>)
INTERFACE ROCPROFSYS_USE_PERFETTO
)
target_include_directories(
rocprofiler-systems-perfetto
SYSTEM
INTERFACE $<BUILD_INTERFACE:${PERFETTO_INCLUDE_DIR}>
)
target_link_libraries(
rocprofiler-systems-perfetto
INTERFACE $<BUILD_INTERFACE:${PERFETTO_LIBRARY}>
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-threading>)
INTERFACE
$<BUILD_INTERFACE:${PERFETTO_LIBRARY}>
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-threading>
)
+4 -7
Просмотреть файл
@@ -3,9 +3,7 @@ cmake_minimum_required(VERSION 3.18.4 FATAL_ERROR)
project(rocprofiler-systems-examples LANGUAGES C CXX)
if("${CMAKE_BUILD_TYPE}" STREQUAL "")
set(CMAKE_BUILD_TYPE
"RelWithDebInfo"
CACHE STRING "Build type" FORCE)
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Build type" FORCE)
endif()
string(TOUPPER "${CMAKE_BUILD_TYPE}" BUILD_TYPE)
@@ -28,7 +26,8 @@ if(CMAKE_PROJECT_NAME STREQUAL "rocprofiler-systems")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
rocprofiler_systems_add_option(ROCPROFSYS_INSTALL_EXAMPLES
"Install rocprofiler-systems examples" OFF)
"Install rocprofiler-systems examples" OFF
)
else()
option(ROCPROFSYS_INSTALL_EXAMPLES "Install rocprofiler-systems examples" ON)
endif()
@@ -37,9 +36,7 @@ if(ROCPROFSYS_INSTALL_EXAMPLES)
include(GNUInstallDirs)
endif()
set(ROCPROFSYS_EXAMPLE_ROOT_DIR
${CMAKE_CURRENT_LIST_DIR}
CACHE INTERNAL "")
set(ROCPROFSYS_EXAMPLE_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR} CACHE INTERNAL "")
# defines function for creating causal profiling exes
include(${CMAKE_CURRENT_LIST_DIR}/causal-helpers.cmake)
+82 -42
Просмотреть файл
@@ -17,7 +17,12 @@ endif()
function(rocprofiler_systems_causal_example_executable _NAME)
cmake_parse_arguments(
CAUSAL "" "" "SOURCES;DEFINITIONS;INCLUDE_DIRECTORIES;LINK_LIBRARIES" ${ARGN})
CAUSAL
""
""
"SOURCES;DEFINITIONS;INCLUDE_DIRECTORIES;LINK_LIBRARIES"
${ARGN}
)
function(rocprofiler_systems_causal_example_interface _TARGET)
if(NOT TARGET ${_TARGET})
@@ -30,74 +35,108 @@ function(rocprofiler_systems_causal_example_executable _NAME)
rocprofiler_systems_causal_example_interface(rocprofsys-causal-example-lib-debug)
rocprofiler_systems_causal_example_interface(rocprofsys-causal-example-lib-no-debug)
target_compile_options(rocprofsys-causal-example-lib-debug
INTERFACE -g3 -fno-omit-frame-pointer)
target_compile_options(
rocprofsys-causal-example-lib-debug
INTERFACE -g3 -fno-omit-frame-pointer
)
target_compile_options(rocprofsys-causal-example-lib-no-debug INTERFACE -g0)
add_executable(${_NAME} ${CAUSAL_SOURCES})
target_compile_definitions(${_NAME} PRIVATE USE_COZ=0 USE_OMNI=0
${CAUSAL_DEFINITIONS})
target_include_directories(${_NAME} PRIVATE ${ROCPROFSYS_EXAMPLE_ROOT_DIR}/causal
${CAUSAL_INCLUDE_DIRECTORIES})
target_compile_definitions(
${_NAME}
PRIVATE USE_COZ=0 USE_OMNI=0 ${CAUSAL_DEFINITIONS}
)
target_include_directories(
${_NAME}
PRIVATE ${ROCPROFSYS_EXAMPLE_ROOT_DIR}/causal ${CAUSAL_INCLUDE_DIRECTORIES}
)
target_link_libraries(
${_NAME}
PRIVATE ${CAUSAL_LINK_LIBRARIES}
rocprofiler-systems::rocprofiler-systems-user-library
rocprofsys-causal-example-lib-debug)
PRIVATE
${CAUSAL_LINK_LIBRARIES}
rocprofiler-systems::rocprofiler-systems-user-library
rocprofsys-causal-example-lib-debug
)
add_executable(${_NAME}-rocprofsys ${CAUSAL_SOURCES})
target_compile_definitions(${_NAME}-rocprofsys PRIVATE USE_COZ=0 USE_OMNI=1
${CAUSAL_DEFINITIONS})
target_compile_definitions(
${_NAME}-rocprofsys
PRIVATE USE_COZ=0 USE_OMNI=1 ${CAUSAL_DEFINITIONS}
)
target_include_directories(
${_NAME}-rocprofsys PRIVATE ${ROCPROFSYS_EXAMPLE_ROOT_DIR}/causal
${CAUSAL_INCLUDE_DIRECTORIES})
${_NAME}-rocprofsys
PRIVATE ${ROCPROFSYS_EXAMPLE_ROOT_DIR}/causal ${CAUSAL_INCLUDE_DIRECTORIES}
)
target_link_libraries(
${_NAME}-rocprofsys
PRIVATE ${CAUSAL_LINK_LIBRARIES}
rocprofiler-systems::rocprofiler-systems-user-library
rocprofsys-causal-example-lib-debug)
PRIVATE
${CAUSAL_LINK_LIBRARIES}
rocprofiler-systems::rocprofiler-systems-user-library
rocprofsys-causal-example-lib-debug
)
add_executable(${_NAME}-ndebug ${CAUSAL_SOURCES})
target_compile_definitions(${_NAME}-ndebug PRIVATE USE_COZ=0 USE_OMNI=0
${CAUSAL_DEFINITIONS})
target_compile_definitions(
${_NAME}-ndebug
PRIVATE USE_COZ=0 USE_OMNI=0 ${CAUSAL_DEFINITIONS}
)
target_include_directories(
${_NAME}-ndebug PRIVATE ${ROCPROFSYS_EXAMPLE_ROOT_DIR}/causal
${CAUSAL_INCLUDE_DIRECTORIES})
${_NAME}-ndebug
PRIVATE ${ROCPROFSYS_EXAMPLE_ROOT_DIR}/causal ${CAUSAL_INCLUDE_DIRECTORIES}
)
target_link_libraries(
${_NAME}-ndebug
PRIVATE ${CAUSAL_LINK_LIBRARIES}
rocprofiler-systems::rocprofiler-systems-user-library
rocprofsys-causal-example-lib-no-debug)
PRIVATE
${CAUSAL_LINK_LIBRARIES}
rocprofiler-systems::rocprofiler-systems-user-library
rocprofsys-causal-example-lib-no-debug
)
add_executable(${_NAME}-rocprofsys-ndebug ${CAUSAL_SOURCES})
target_compile_definitions(${_NAME}-rocprofsys-ndebug PRIVATE USE_COZ=0 USE_OMNI=1
${CAUSAL_DEFINITIONS})
target_compile_definitions(
${_NAME}-rocprofsys-ndebug
PRIVATE USE_COZ=0 USE_OMNI=1 ${CAUSAL_DEFINITIONS}
)
target_include_directories(
${_NAME}-rocprofsys-ndebug PRIVATE ${ROCPROFSYS_EXAMPLE_ROOT_DIR}/causal
${CAUSAL_INCLUDE_DIRECTORIES})
${_NAME}-rocprofsys-ndebug
PRIVATE ${ROCPROFSYS_EXAMPLE_ROOT_DIR}/causal ${CAUSAL_INCLUDE_DIRECTORIES}
)
target_link_libraries(
${_NAME}-rocprofsys-ndebug
PRIVATE ${CAUSAL_LINK_LIBRARIES}
rocprofiler-systems::rocprofiler-systems-user-library
rocprofsys-causal-example-lib-no-debug)
PRIVATE
${CAUSAL_LINK_LIBRARIES}
rocprofiler-systems::rocprofiler-systems-user-library
rocprofsys-causal-example-lib-no-debug
)
add_dependencies(rocprofsys-causal-examples ${_NAME} ${_NAME}-rocprofsys
${_NAME}-ndebug ${_NAME}-rocprofsys-ndebug)
add_dependencies(
rocprofsys-causal-examples
${_NAME}
${_NAME}-rocprofsys
${_NAME}-ndebug
${_NAME}-rocprofsys-ndebug
)
if(coz-profiler_FOUND)
rocprofiler_systems_causal_example_interface(rocprofsys-causal-example-lib-coz)
target_compile_options(rocprofsys-causal-example-lib-coz
INTERFACE -g3 -gdwarf-3 -fno-omit-frame-pointer)
target_compile_options(
rocprofsys-causal-example-lib-coz
INTERFACE -g3 -gdwarf-3 -fno-omit-frame-pointer
)
add_executable(${_NAME}-coz ${CAUSAL_SOURCES})
target_compile_definitions(${_NAME}-coz PRIVATE USE_COZ=1 USE_OMNI=0
${CAUSAL_DEFINITIONS})
target_compile_definitions(
${_NAME}-coz
PRIVATE USE_COZ=1 USE_OMNI=0 ${CAUSAL_DEFINITIONS}
)
target_include_directories(
${_NAME}-coz PRIVATE ${ROCPROFSYS_EXAMPLE_ROOT_DIR}/causal
${CAUSAL_INCLUDE_DIRECTORIES})
${_NAME}-coz
PRIVATE ${ROCPROFSYS_EXAMPLE_ROOT_DIR}/causal ${CAUSAL_INCLUDE_DIRECTORIES}
)
target_link_libraries(
${_NAME}-coz PRIVATE ${CAUSAL_LINK_LIBRARIES}
rocprofsys-causal-example-lib-coz coz::coz)
${_NAME}-coz
PRIVATE ${CAUSAL_LINK_LIBRARIES} rocprofsys-causal-example-lib-coz coz::coz
)
add_dependencies(rocprofsys-causal-examples ${_NAME}-coz)
endif()
@@ -107,6 +146,7 @@ function(rocprofiler_systems_causal_example_executable _NAME)
TARGETS ${_NAME} ${_NAME}-rocprofsys ${_NAME}-coz
DESTINATION bin
COMPONENT rocprofiler-systems-examples
OPTIONAL)
OPTIONAL
)
endif()
endfunction()
+18 -9
Просмотреть файл
@@ -5,8 +5,10 @@ project(rocprofiler-systems-causal-example LANGUAGES CXX)
if(ROCPROFSYS_DISABLE_EXAMPLES)
get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME)
if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST
ROCPROFSYS_DISABLE_EXAMPLES)
if(
${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
OR ${_DIR} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
)
return()
endif()
endif()
@@ -18,25 +20,32 @@ if(NOT TARGET rocprofiler-systems::rocprofiler-systems-user-library)
endif()
add_library(causal-interface-library INTERFACE)
target_compile_options(causal-interface-library INTERFACE -g3 -gdwarf-3
-fno-omit-frame-pointer)
target_link_libraries(causal-interface-library INTERFACE Threads::Threads
${CMAKE_DL_LIBS})
target_compile_options(
causal-interface-library
INTERFACE -g3 -gdwarf-3 -fno-omit-frame-pointer
)
target_link_libraries(
causal-interface-library
INTERFACE Threads::Threads ${CMAKE_DL_LIBS}
)
rocprofiler_systems_causal_example_executable(
"causal-both"
SOURCES causal.cpp impl.cpp
LINK_LIBRARIES causal-interface-library
DEFINITIONS USE_RNG=1 USE_CPU=1)
DEFINITIONS USE_RNG=1 USE_CPU=1
)
rocprofiler_systems_causal_example_executable(
"causal-rng"
SOURCES causal.cpp impl.cpp
LINK_LIBRARIES causal-interface-library
DEFINITIONS USE_RNG=1 USE_CPU=0)
DEFINITIONS USE_RNG=1 USE_CPU=0
)
rocprofiler_systems_causal_example_executable(
"causal-cpu"
SOURCES causal.cpp impl.cpp
LINK_LIBRARIES causal-interface-library
DEFINITIONS USE_RNG=0 USE_CPU=1)
DEFINITIONS USE_RNG=0 USE_CPU=1
)
+12 -9
Просмотреть файл
@@ -5,8 +5,10 @@ project(rocprofiler-systems-code-coverage-example LANGUAGES CXX)
if(ROCPROFSYS_DISABLE_EXAMPLES)
get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME)
if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST
ROCPROFSYS_DISABLE_EXAMPLES)
if(
${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
OR ${_DIR} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
)
return()
endif()
endif()
@@ -20,10 +22,7 @@ target_link_libraries(code-coverage PRIVATE Threads::Threads)
target_compile_options(code-coverage PRIVATE ${_FLAGS})
if(ROCPROFSYS_INSTALL_EXAMPLES)
install(
TARGETS code-coverage
DESTINATION bin
COMPONENT rocprofiler-systems-examples)
install(TARGETS code-coverage DESTINATION bin COMPONENT rocprofiler-systems-examples)
endif()
set(PYTHON_FILES code-coverage.py)
@@ -34,14 +33,18 @@ if(Python3_FOUND)
set(PYTHON_EXECUTABLE "${Python3_EXECUTABLE}")
foreach(_FILE ${PYTHON_FILES})
configure_file(${PROJECT_SOURCE_DIR}/${_FILE} ${PROJECT_BINARY_DIR}/${_FILE}
@ONLY)
configure_file(
${PROJECT_SOURCE_DIR}/${_FILE}
${PROJECT_BINARY_DIR}/${_FILE}
@ONLY
)
if(ROCPROFSYS_INSTALL_EXAMPLES)
install(
PROGRAMS ${PROJECT_BINARY_DIR}/${_FILE}
DESTINATION bin
COMPONENT rocprofiler-systems-examples)
COMPONENT rocprofiler-systems-examples
)
endif()
endforeach()
endif()
+5 -6
Просмотреть файл
@@ -8,13 +8,12 @@ string(REPLACE " " ";" _FLAGS "${CMAKE_CXX_FLAGS_DEBUG}")
find_package(Threads REQUIRED)
find_package(rocprofiler-systems REQUIRED COMPONENTS user)
add_executable(fork-example fork.cpp)
target_link_libraries(fork-example PRIVATE Threads::Threads
rocprofiler-systems::rocprofiler-systems)
target_link_libraries(
fork-example
PRIVATE Threads::Threads rocprofiler-systems::rocprofiler-systems
)
target_compile_options(fork-example PRIVATE ${_FLAGS})
if(ROCPROFSYS_INSTALL_EXAMPLES)
install(
TARGETS fork-example
DESTINATION bin
COMPONENT rocprofiler-systems-examples)
install(TARGETS fork-example DESTINATION bin COMPONENT rocprofiler-systems-examples)
endif()
+17 -17
Просмотреть файл
@@ -52,8 +52,10 @@ string(REPLACE " " ";" _FLAGS "${CMAKE_CXX_FLAGS_DEBUG}")
if(ROCPROFSYS_DISABLE_EXAMPLES)
get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME)
if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST
ROCPROFSYS_DISABLE_EXAMPLES)
if(
${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
OR ${_DIR} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
)
return()
endif()
endif()
@@ -76,24 +78,24 @@ function(copy_image_files_and_make_copies)
foreach(file ${image_files})
get_filename_component(filename ${file} NAME)
foreach(i RANGE 1 ${NUM_COPIES})
file(COPY ${file}
DESTINATION ${CMAKE_BINARY_DIR}/images/${filename}_copy${i}.jpg)
file(
COPY ${file}
DESTINATION ${CMAKE_BINARY_DIR}/images/${filename}_copy${i}.jpg
)
endforeach()
endforeach()
else()
message(
AUTHOR_WARNING
"Source directory ${ROCmVersion_DIR}/share/rocjpeg/images does not exist")
"Source directory ${ROCmVersion_DIR}/share/rocjpeg/images does not exist"
)
endif()
endfunction()
# threads
find_package(Threads REQUIRED)
if(HIP_FOUND
AND ROCJPEG_FOUND
AND Threads_FOUND
AND rocprofiler-register_FOUND)
if(HIP_FOUND AND ROCJPEG_FOUND AND Threads_FOUND AND rocprofiler-register_FOUND)
# HIP
set(LINK_LIBRARY_LIST ${LINK_LIBRARY_LIST} hip::host)
# threads
@@ -116,19 +118,17 @@ if(HIP_FOUND
copy_image_files_and_make_copies()
if(ROCPROFSYS_INSTALL_EXAMPLES)
install(
TARGETS jpegdecode
DESTINATION bin
COMPONENT rocprofiler-systems-examples)
install(TARGETS jpegdecode DESTINATION bin COMPONENT rocprofiler-systems-examples)
install(
FILES ${CMAKE_BINARY_DIR}/images
DESTINATION share/rocprofiler-systems/tests/images
COMPONENT rocprofiler-systems-examples)
COMPONENT rocprofiler-systems-examples
)
endif()
else()
message(
"-- ERROR!: ${PROJECT_NAME} excluded! please install all the dependencies and try again!"
)
)
if(NOT HIP_FOUND)
message(FATAL_ERROR "-- ERROR!: HIP Not Found! - please install ROCm and HIP!")
endif()
@@ -141,7 +141,7 @@ else()
if(NOT rocprofiler-register_FOUND)
message(
FATAL_ERROR
"-- ERROR!: rocprofiler-register Not Found! - please install rocprofiler-register!"
)
"-- ERROR!: rocprofiler-register Not Found! - please install rocprofiler-register!"
)
endif()
endif()
+27 -13
Просмотреть файл
@@ -5,15 +5,22 @@ project(rocprofiler-systems-lulesh-example LANGUAGES C CXX)
if(ROCPROFSYS_DISABLE_EXAMPLES)
get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME)
if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST
ROCPROFSYS_DISABLE_EXAMPLES)
if(
${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
OR ${_DIR} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
)
return()
endif()
endif()
set(CMAKE_BUILD_TYPE "RelWithDebInfo")
string(REGEX REPLACE " -g(|[0-2]) " " -g3 " CMAKE_CXX_FLAGS_RELWITHDEBINFO
"${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
string(
REGEX REPLACE
" -g(|[0-2]) "
" -g3 "
CMAKE_CXX_FLAGS_RELWITHDEBINFO
"${CMAKE_CXX_FLAGS_RELWITHDEBINFO}"
)
list(INSERT CMAKE_MODULE_PATH 0 ${PROJECT_SOURCE_DIR}/cmake/Modules)
@@ -29,8 +36,13 @@ if(LULESH_BUILD_KOKKOS)
find_program(
HIPCC_EXECUTABLE
NAMES hipcc
HINTS ${ROCmVersion_DIR} ${ROCM_PATH} ENV ROCM_PATH /opt/rocm
PATHS ${ROCmVersion_DIR} ${ROCM_PATH} ENV ROCM_PATH /opt/rocm)
HINTS ${ROCmVersion_DIR} ${ROCM_PATH}
ENV ROCM_PATH
/opt/rocm
PATHS ${ROCmVersion_DIR} ${ROCM_PATH}
ENV ROCM_PATH
/opt/rocm
)
mark_as_advanced(HIPCC_EXECUTABLE)
endif()
kokkos_compilation(PROJECT COMPILER ${HIPCC_EXECUTABLE})
@@ -43,9 +55,7 @@ endif()
set(CMAKE_CXX_EXTENSIONS OFF)
if("${CMAKE_BUILD_TYPE}" STREQUAL "")
set(CMAKE_BUILD_TYPE
"Release"
CACHE STRING "CMake build type" FORCE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "CMake build type" FORCE)
endif()
option(LULESH_USE_MPI "Enable MPI" OFF)
@@ -69,15 +79,19 @@ rocprofiler_systems_causal_example_executable(
"lulesh"
SOURCES ${sources} ${headers}
LINK_LIBRARIES Kokkos::kokkos lulesh-mpi
INCLUDE_DIRECTORIES ${PROJECT_SOURCE_DIR}/includes)
INCLUDE_DIRECTORIES ${PROJECT_SOURCE_DIR}/includes
)
if(ROCPROFSYS_INSTALL_EXAMPLES)
if(LULESH_BUILD_KOKKOS)
install(
TARGETS kokkoscore kokkoscontainers
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT rocprofiler-systems-examples)
set_target_properties(lulesh PROPERTIES INSTALL_RPATH
"\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}")
COMPONENT rocprofiler-systems-examples
)
set_target_properties(
lulesh
PROPERTIES INSTALL_RPATH "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}"
)
endif()
endif()
+26 -19
Просмотреть файл
@@ -17,9 +17,7 @@ function(CAPITALIZE str var)
string(TOUPPER "${_first}" _first)
string(SUBSTRING "${str}" 1 -1 _remainder)
string(CONCAT str "${_first}" "${_remainder}")
set(${var}
"${str}"
PARENT_SCOPE)
set(${var} "${str}" PARENT_SCOPE)
endfunction()
# ----------------------------------------------------------------------------------------#
@@ -35,9 +33,12 @@ endfunction()
function(CHECKOUT_GIT_SUBMODULE)
# parse args
cmake_parse_arguments(
CHECKOUT "RECURSIVE"
CHECKOUT
"RECURSIVE"
"RELATIVE_PATH;WORKING_DIRECTORY;TEST_FILE;REPO_URL;REPO_BRANCH"
"ADDITIONAL_CMDS" ${ARGN})
"ADDITIONAL_CMDS"
${ARGN}
)
if(NOT CHECKOUT_WORKING_DIRECTORY)
set(CHECKOUT_WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
@@ -97,15 +98,19 @@ function(CHECKOUT_GIT_SUBMODULE)
if(NOT _TEST_FILE_EXISTS AND _SUBMODULE_EXISTS)
# perform the checkout
execute_process(
COMMAND ${GIT_EXECUTABLE} submodule update --init ${_RECURSE}
${CHECKOUT_ADDITIONAL_CMDS} ${CHECKOUT_RELATIVE_PATH}
COMMAND
${GIT_EXECUTABLE} submodule update --init ${_RECURSE}
${CHECKOUT_ADDITIONAL_CMDS} ${CHECKOUT_RELATIVE_PATH}
WORKING_DIRECTORY ${CHECKOUT_WORKING_DIRECTORY}
RESULT_VARIABLE RET)
RESULT_VARIABLE RET
)
# check the return code
if(RET GREATER 0)
set(_CMD "${GIT_EXECUTABLE} submodule update --init ${_RECURSE}
${CHECKOUT_ADDITIONAL_CMDS} ${CHECKOUT_RELATIVE_PATH}")
set(_CMD
"${GIT_EXECUTABLE} submodule update --init ${_RECURSE}
${CHECKOUT_ADDITIONAL_CMDS} ${CHECKOUT_RELATIVE_PATH}"
)
message(STATUS "function(CHECKOUT_GIT_SUBMODULE) failed.")
message(FATAL_ERROR "Command: \"${_CMD}\"")
else()
@@ -115,7 +120,9 @@ function(CHECKOUT_GIT_SUBMODULE)
if(NOT _TEST_FILE_EXISTS AND _HAS_REPO_URL)
message(
STATUS "Checking out '${CHECKOUT_REPO_URL}' @ '${CHECKOUT_REPO_BRANCH}'...")
STATUS
"Checking out '${CHECKOUT_REPO_URL}' @ '${CHECKOUT_REPO_BRANCH}'..."
)
# remove the existing directory
if(EXISTS "${_DIR}")
@@ -128,16 +135,16 @@ function(CHECKOUT_GIT_SUBMODULE)
${GIT_EXECUTABLE} clone -b ${CHECKOUT_REPO_BRANCH}
${CHECKOUT_ADDITIONAL_CMDS} ${CHECKOUT_REPO_URL} ${CHECKOUT_RELATIVE_PATH}
WORKING_DIRECTORY ${CHECKOUT_WORKING_DIRECTORY}
RESULT_VARIABLE RET)
RESULT_VARIABLE RET
)
# perform the submodule update
if(CHECKOUT_RECURSIVE
AND EXISTS "${_DIR}"
AND IS_DIRECTORY "${_DIR}")
if(CHECKOUT_RECURSIVE AND EXISTS "${_DIR}" AND IS_DIRECTORY "${_DIR}")
execute_process(
COMMAND ${GIT_EXECUTABLE} submodule update --init ${_RECURSE}
WORKING_DIRECTORY ${_DIR}
RESULT_VARIABLE RET)
RESULT_VARIABLE RET
)
endif()
# check the return code
@@ -145,7 +152,7 @@ function(CHECKOUT_GIT_SUBMODULE)
set(_CMD
"${GIT_EXECUTABLE} clone -b ${CHECKOUT_REPO_BRANCH}
${CHECKOUT_ADDITIONAL_CMDS} ${CHECKOUT_REPO_URL} ${CHECKOUT_RELATIVE_PATH}"
)
)
message(STATUS "function(CHECKOUT_GIT_SUBMODULE) failed.")
message(FATAL_ERROR "Command: \"${_CMD}\"")
else()
@@ -156,7 +163,7 @@ function(CHECKOUT_GIT_SUBMODULE)
if(NOT EXISTS "${_TEST_FILE}" OR NOT _TEST_FILE_EXISTS)
message(
FATAL_ERROR
"Error checking out submodule: '${CHECKOUT_RELATIVE_PATH}' to '${_DIR}'")
"Error checking out submodule: '${CHECKOUT_RELATIVE_PATH}' to '${_DIR}'"
)
endif()
endfunction()
+26 -11
Просмотреть файл
@@ -5,8 +5,10 @@ project(rocprofiler-systems-mpi-examples LANGUAGES C CXX)
if(ROCPROFSYS_DISABLE_EXAMPLES)
get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME)
if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST
ROCPROFSYS_DISABLE_EXAMPLES)
if(
${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
OR ${_DIR} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
)
return()
endif()
endif()
@@ -18,8 +20,10 @@ if(NOT MPI_FOUND)
else()
set(_MSG_TYPE AUTHOR_WARNING)
endif()
message(${_MSG_TYPE}
"MPI could not be found. Cannot build rocprofiler-systems-mpi target")
message(
${_MSG_TYPE}
"MPI could not be found. Cannot build rocprofiler-systems-mpi target"
)
return()
endif()
@@ -31,8 +35,10 @@ add_library(mpi-c-interface-library INTERFACE)
target_link_libraries(
mpi-c-interface-library
INTERFACE
Threads::Threads MPI::MPI_C
$<TARGET_NAME_IF_EXISTS:rocprofiler-systems::rocprofiler-systems-compile-options>)
Threads::Threads
MPI::MPI_C
$<TARGET_NAME_IF_EXISTS:rocprofiler-systems::rocprofiler-systems-compile-options>
)
target_compile_options(mpi-c-interface-library INTERFACE -Wno-double-promotion)
add_executable(mpi-allgather allgather.c)
@@ -62,16 +68,25 @@ add_library(mpi-cxx-interface-library INTERFACE)
target_link_libraries(
mpi-cxx-interface-library
INTERFACE
Threads::Threads MPI::MPI_CXX
$<TARGET_NAME_IF_EXISTS:rocprofiler-systems::rocprofiler-systems-compile-options>)
Threads::Threads
MPI::MPI_CXX
$<TARGET_NAME_IF_EXISTS:rocprofiler-systems::rocprofiler-systems-compile-options>
)
add_executable(mpi-example mpi.cpp)
target_link_libraries(mpi-example PRIVATE mpi-cxx-interface-library)
if(ROCPROFSYS_INSTALL_EXAMPLES)
install(
TARGETS mpi-example mpi-allgather mpi-bcast mpi-all2all mpi-reduce
mpi-scatter-gather mpi-send-recv
TARGETS
mpi-example
mpi-allgather
mpi-bcast
mpi-all2all
mpi-reduce
mpi-scatter-gather
mpi-send-recv
DESTINATION bin
COMPONENT rocprofiler-systems-examples)
COMPONENT rocprofiler-systems-examples
)
endif()
+42 -18
Просмотреть файл
@@ -5,8 +5,10 @@ project(rocprofiler-systems-openmp LANGUAGES CXX)
if(ROCPROFSYS_DISABLE_EXAMPLES)
get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME)
if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST
ROCPROFSYS_DISABLE_EXAMPLES)
if(
${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
OR ${_DIR} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
)
return()
endif()
endif()
@@ -15,10 +17,16 @@ file(GLOB common_source ${CMAKE_CURRENT_SOURCE_DIR}/common/*.cpp)
add_library(openmp-common OBJECT ${common_source})
target_include_directories(openmp-common PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/common)
add_executable(openmp-cg ${CMAKE_CURRENT_SOURCE_DIR}/CG/cg.cpp
$<TARGET_OBJECTS:openmp-common>)
add_executable(openmp-lu ${CMAKE_CURRENT_SOURCE_DIR}/LU/lu.cpp
$<TARGET_OBJECTS:openmp-common>)
add_executable(
openmp-cg
${CMAKE_CURRENT_SOURCE_DIR}/CG/cg.cpp
$<TARGET_OBJECTS:openmp-common>
)
add_executable(
openmp-lu
${CMAKE_CURRENT_SOURCE_DIR}/LU/lu.cpp
$<TARGET_OBJECTS:openmp-common>
)
option(USE_CLANG_OMP "Use the clang OpenMP if available" ON)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
@@ -26,33 +34,48 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
target_link_libraries(openmp-common PUBLIC OpenMP::OpenMP_CXX)
set(ROCPROFSYS_OPENMP_USING_LIBOMP_LIBRARY
ON
CACHE INTERNAL "Used by rocprofiler-systems testing" FORCE)
CACHE INTERNAL
"Used by rocprofiler-systems testing"
FORCE
)
else()
find_program(CLANGXX_EXECUTABLE NAMES clang++)
find_library(
LIBOMP_LIBRARY
NAMES omp omp5 ${CMAKE_SHARED_LIBRARY_PREFIX}omp${CMAKE_SHARED_LIBRARY_SUFFIX}.5)
if(CLANGXX_EXECUTABLE
AND LIBOMP_LIBRARY
AND COMMAND rocprofiler_systems_custom_compilation
AND USE_CLANG_OMP)
NAMES omp omp5 ${CMAKE_SHARED_LIBRARY_PREFIX}omp${CMAKE_SHARED_LIBRARY_SUFFIX}.5
)
if(
CLANGXX_EXECUTABLE
AND LIBOMP_LIBRARY
AND COMMAND rocprofiler_systems_custom_compilation
AND USE_CLANG_OMP
)
target_compile_options(openmp-common PUBLIC -W -Wall -fopenmp=libomp)
target_link_libraries(openmp-common PUBLIC ${LIBOMP_LIBRARY})
rocprofiler_systems_custom_compilation(COMPILER ${CLANGXX_EXECUTABLE}
TARGET openmp-common)
TARGET openmp-common
)
rocprofiler_systems_custom_compilation(COMPILER ${CLANGXX_EXECUTABLE}
TARGET openmp-cg)
TARGET openmp-cg
)
rocprofiler_systems_custom_compilation(COMPILER ${CLANGXX_EXECUTABLE}
TARGET openmp-lu)
TARGET openmp-lu
)
set(ROCPROFSYS_OPENMP_USING_LIBOMP_LIBRARY
ON
CACHE INTERNAL "Used by rocprofiler-systems testing" FORCE)
CACHE INTERNAL
"Used by rocprofiler-systems testing"
FORCE
)
else()
find_package(OpenMP REQUIRED)
target_link_libraries(openmp-common PUBLIC OpenMP::OpenMP_CXX)
set(ROCPROFSYS_OPENMP_USING_LIBOMP_LIBRARY
OFF
CACHE INTERNAL "Used by rocprofiler-systems testing" FORCE)
CACHE INTERNAL
"Used by rocprofiler-systems testing"
FORCE
)
endif()
endif()
@@ -63,7 +86,8 @@ if(ROCPROFSYS_INSTALL_EXAMPLES)
install(
TARGETS openmp-cg openmp-lu
DESTINATION bin
COMPONENT rocprofiler-systems-examples)
COMPONENT rocprofiler-systems-examples
)
endif()
if(ROCPROFSYS_DISABLE_EXAMPLES)
+27 -17
Просмотреть файл
@@ -4,15 +4,22 @@ if(NOT OMP_TARGET_COMPILER)
find_program(
amdclangpp_EXECUTABLE
NAMES amdclang++
HINTS ${ROCM_PATH} ENV ROCM_PATH /opt/rocm
PATHS ${ROCM_PATH} ENV ROCM_PATH /opt/rocm
PATH_SUFFIXES bin llvm/bin)
HINTS ${ROCM_PATH}
ENV ROCM_PATH
/opt/rocm
PATHS ${ROCM_PATH}
ENV ROCM_PATH
/opt/rocm
PATH_SUFFIXES bin llvm/bin
)
mark_as_advanced(amdclangpp_EXECUTABLE)
if(amdclangpp_EXECUTABLE)
set(OMP_TARGET_COMPILER
"${amdclangpp_EXECUTABLE}"
CACHE FILEPATH "OpenMP target compiler")
CACHE FILEPATH
"OpenMP target compiler"
)
else()
message(WARNING "OpenMP target compiler not found. Skipping this example.")
return()
@@ -36,11 +43,10 @@ set(DEFAULT_GPU_TARGETS
"gfx1010"
"gfx1100"
"gfx1101"
"gfx1102")
"gfx1102"
)
set(GPU_TARGETS
"${DEFAULT_GPU_TARGETS}"
CACHE STRING "GPU targets to compile for")
set(GPU_TARGETS "${DEFAULT_GPU_TARGETS}" CACHE STRING "GPU targets to compile for")
find_package(Threads REQUIRED)
@@ -67,13 +73,15 @@ if(NOT EXISTS ${OMP_TARGET_COMPILER_DIR}/llvm/lib)
endif()
set_target_properties(
openmp-target-lib
PROPERTIES BUILD_RPATH
"${OMP_TARGET_COMPILER_DIR}/llvm/lib:${OMP_TARGET_COMPILER_DIR}/lib"
OUTPUT_NAME "openmp-target"
POSITION_INDEPENDENT_CODE ON)
PROPERTIES
BUILD_RPATH "${OMP_TARGET_COMPILER_DIR}/llvm/lib:${OMP_TARGET_COMPILER_DIR}/lib"
OUTPUT_NAME "openmp-target"
POSITION_INDEPENDENT_CODE ON
)
rocprofiler_systems_custom_compilation(TARGET openmp-target-lib
COMPILER ${OMP_TARGET_COMPILER})
COMPILER ${OMP_TARGET_COMPILER}
)
add_executable(openmp-target)
target_sources(openmp-target PRIVATE main.cpp)
@@ -82,9 +90,11 @@ target_compile_options(openmp-target PRIVATE -ggdb)
set_target_properties(
openmp-target
PROPERTIES BUILD_RPATH
"${OMP_TARGET_COMPILER_DIR}/llvm/lib:${OMP_TARGET_COMPILER_DIR}/lib"
POSITION_INDEPENDENT_CODE ON)
PROPERTIES
BUILD_RPATH "${OMP_TARGET_COMPILER_DIR}/llvm/lib:${OMP_TARGET_COMPILER_DIR}/lib"
POSITION_INDEPENDENT_CODE ON
)
rocprofiler_systems_custom_compilation(TARGET openmp-target
COMPILER ${OMP_TARGET_COMPILER})
COMPILER ${OMP_TARGET_COMPILER}
)
+14 -7
Просмотреть файл
@@ -5,8 +5,10 @@ project(rocprofiler-systems-parallel-overhead-example LANGUAGES CXX)
if(ROCPROFSYS_DISABLE_EXAMPLES)
get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME)
if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST
ROCPROFSYS_DISABLE_EXAMPLES)
if(
${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
OR ${_DIR} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
)
return()
endif()
endif()
@@ -18,17 +20,22 @@ add_library(parallel-overhead-compile-options INTERFACE)
target_compile_options(parallel-overhead-compile-options INTERFACE -g)
add_executable(parallel-overhead parallel-overhead.cpp)
target_link_libraries(parallel-overhead PRIVATE Threads::Threads
parallel-overhead-compile-options)
target_link_libraries(
parallel-overhead
PRIVATE Threads::Threads parallel-overhead-compile-options
)
add_executable(parallel-overhead-locks parallel-overhead.cpp)
target_link_libraries(parallel-overhead-locks PRIVATE Threads::Threads
parallel-overhead-compile-options)
target_link_libraries(
parallel-overhead-locks
PRIVATE Threads::Threads parallel-overhead-compile-options
)
target_compile_definitions(parallel-overhead-locks PRIVATE USE_LOCKS=1)
if(ROCPROFSYS_INSTALL_EXAMPLES)
install(
TARGETS parallel-overhead parallel-overhead-locks
DESTINATION bin
COMPONENT rocprofiler-systems-examples)
COMPONENT rocprofiler-systems-examples
)
endif()
+18 -6
Просмотреть файл
@@ -5,13 +5,21 @@ project(rocprofiler-systems-python)
if(ROCPROFSYS_DISABLE_EXAMPLES)
get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME)
if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST
ROCPROFSYS_DISABLE_EXAMPLES)
if(
${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
OR ${_DIR} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
)
return()
endif()
endif()
set(PYTHON_FILES builtin.py external.py source.py noprofile.py fill.py)
set(PYTHON_FILES
builtin.py
external.py
source.py
noprofile.py
fill.py
)
find_package(Python3 COMPONENTS Interpreter)
@@ -19,14 +27,18 @@ if(Python3_FOUND)
set(PYTHON_EXECUTABLE "${Python3_EXECUTABLE}")
foreach(_FILE ${PYTHON_FILES})
configure_file(${PROJECT_SOURCE_DIR}/${_FILE} ${PROJECT_BINARY_DIR}/${_FILE}
@ONLY)
configure_file(
${PROJECT_SOURCE_DIR}/${_FILE}
${PROJECT_BINARY_DIR}/${_FILE}
@ONLY
)
if(ROCPROFSYS_INSTALL_EXAMPLES)
install(
PROGRAMS ${PROJECT_BINARY_DIR}/${_FILE}
DESTINATION bin
COMPONENT rocprofiler-systems-examples)
COMPONENT rocprofiler-systems-examples
)
endif()
endforeach()
endif()
+30 -20
Просмотреть файл
@@ -5,16 +5,20 @@ project(rocprofiler-systems-rccl-example LANGUAGES CXX)
if(ROCPROFSYS_DISABLE_EXAMPLES)
get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME)
if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST
ROCPROFSYS_DISABLE_EXAMPLES)
if(
${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
OR ${_DIR} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
)
return()
endif()
endif()
function(rccl_message _MSG_TYPE)
if("${CMAKE_PROJECT_NAME}" STREQUAL "rocprofiler-systems"
AND "$ENV{ROCPROFSYS_CI}"
AND "${_MSG_TYPE}" MATCHES "WARNING")
if(
"${CMAKE_PROJECT_NAME}" STREQUAL "rocprofiler-systems"
AND "$ENV{ROCPROFSYS_CI}"
AND "${_MSG_TYPE}" MATCHES "WARNING"
)
set(_MSG_TYPE STATUS) # don't generate warnings during CI
endif()
if("${CMAKE_PROJECT_NAME}" STREQUAL "rocprofiler-systems")
@@ -31,10 +35,10 @@ if(NOT hip_FOUND)
return()
endif()
if("${CMAKE_PROJECT_NAME}" STREQUAL "rocprofiler-systems"
AND ("$ENV{ROCPROFSYS_CI}"
OR ROCPROFSYS_CI
OR ROCPROFSYS_BUILD_CI))
if(
"${CMAKE_PROJECT_NAME}" STREQUAL "rocprofiler-systems"
AND ("$ENV{ROCPROFSYS_CI}" OR ROCPROFSYS_CI OR ROCPROFSYS_BUILD_CI)
)
find_package(rccl QUIET) # avoid generating warning in CI
else()
find_package(rccl)
@@ -47,11 +51,11 @@ endif()
if(hip_FOUND AND rccl_FOUND)
include(FetchContent)
fetchcontent_declare(rccl-tests GIT_REPOSITORY https://github.com/ROCm/rccl-tests.git)
FetchContent_Declare(rccl-tests GIT_REPOSITORY https://github.com/ROCm/rccl-tests.git)
# After the following call, the CMake targets defined by googletest and Catch2 will be
# available to the rest of the build
fetchcontent_populate(rccl-tests)
FetchContent_Populate(rccl-tests)
get_filename_component(rccl_ROOT_DIR "${rccl_INCLUDE_DIR}" DIRECTORY)
@@ -62,29 +66,35 @@ if(hip_FOUND AND rccl_FOUND)
RESULT_VARIABLE _RCCL_BUILD_RET
ERROR_VARIABLE _RCCL_BUILD_ERR
OUTPUT_VARIABLE _RCCL_BUILD_OUT
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_STRIP_TRAILING_WHITESPACE)
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_STRIP_TRAILING_WHITESPACE
)
if(NOT _RCCL_BUILD_RET EQUAL 0)
rccl_message(${_RCCL_BUILD_OUT})
rccl_message(AUTHOR_WARNING "Failed to build rccl-tests: ${_RCCL_BUILD_ERR}")
else()
file(GLOB RCCL_TEST_EXECUTABLES
${CMAKE_BINARY_DIR}/_deps/rccl-tests-src/build/*_perf)
file(
GLOB RCCL_TEST_EXECUTABLES
${CMAKE_BINARY_DIR}/_deps/rccl-tests-src/build/*_perf
)
set(_RCCL_TEST_TARGETS)
foreach(_EXE ${RCCL_TEST_EXECUTABLES})
get_filename_component(_EXE_NAME "${_EXE}" NAME)
execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${_EXE}
${CMAKE_CURRENT_BINARY_DIR}/${_EXE_NAME})
execute_process(
COMMAND
${CMAKE_COMMAND} -E copy ${_EXE}
${CMAKE_CURRENT_BINARY_DIR}/${_EXE_NAME}
)
add_executable(rccl-tests::${_EXE_NAME} IMPORTED GLOBAL)
set_property(
TARGET rccl-tests::${_EXE_NAME}
PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/${_EXE_NAME})
PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/${_EXE_NAME}
)
list(APPEND _RCCL_TEST_TARGETS "rccl-tests::${_EXE_NAME}")
endforeach()
set(RCCL_TEST_TARGETS
"${_RCCL_TEST_TARGETS}"
CACHE INTERNAL "rccl-test targets")
set(RCCL_TEST_TARGETS "${_RCCL_TEST_TARGETS}" CACHE INTERNAL "rccl-test targets")
endif()
endif()
+5 -6
Просмотреть файл
@@ -5,8 +5,10 @@ project(rocprofiler-systems-rewrite-caller-example LANGUAGES CXX)
if(ROCPROFSYS_DISABLE_EXAMPLES)
get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME)
if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST
ROCPROFSYS_DISABLE_EXAMPLES)
if(
${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
OR ${_DIR} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
)
return()
endif()
endif()
@@ -17,8 +19,5 @@ add_executable(rewrite-caller rewrite-caller.cpp)
target_compile_options(rewrite-caller PRIVATE ${_FLAGS})
if(ROCPROFSYS_INSTALL_EXAMPLES)
install(
TARGETS rewrite-caller
DESTINATION bin
COMPONENT rocprofiler-systems-examples)
install(TARGETS rewrite-caller DESTINATION bin COMPONENT rocprofiler-systems-examples)
endif()
+6 -3
Просмотреть файл
@@ -5,8 +5,10 @@ project(rocprofiler-systems-trace-time-window-example LANGUAGES CXX)
if(ROCPROFSYS_DISABLE_EXAMPLES)
get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME)
if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST
ROCPROFSYS_DISABLE_EXAMPLES)
if(
${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
OR ${_DIR} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
)
return()
endif()
endif()
@@ -20,5 +22,6 @@ if(ROCPROFSYS_INSTALL_EXAMPLES)
install(
TARGETS trace-time-window
DESTINATION bin
COMPONENT rocprofiler-systems-examples)
COMPONENT rocprofiler-systems-examples
)
endif()
+32 -20
Просмотреть файл
@@ -5,8 +5,10 @@ project(rocprofiler-systems-transpose-example LANGUAGES CXX)
if(ROCPROFSYS_DISABLE_EXAMPLES)
get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME)
if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST
ROCPROFSYS_DISABLE_EXAMPLES)
if(
${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
OR ${_DIR} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
)
return()
endif()
endif()
@@ -16,8 +18,14 @@ find_package(hip QUIET HINTS ${ROCmVersion_DIR} PATHS ${ROCmVersion_DIR})
find_program(
HIPCC_EXECUTABLE
NAMES hipcc
HINTS ${ROCmVersion_DIR} ${ROCM_PATH} ENV ROCM_PATH /opt/rocm
PATHS ${ROCmVersion_DIR} ${ROCM_PATH} ENV ROCM_PATH /opt/rocm NO_CACHE)
HINTS ${ROCmVersion_DIR} ${ROCM_PATH}
ENV ROCM_PATH
/opt/rocm
PATHS ${ROCmVersion_DIR} ${ROCM_PATH}
ENV ROCM_PATH
/opt/rocm
NO_CACHE
)
mark_as_advanced(HIPCC_EXECUTABLE)
if(NOT HIPCC_EXECUTABLE)
@@ -26,17 +34,21 @@ if(NOT HIPCC_EXECUTABLE)
endif()
if(NOT CMAKE_CXX_COMPILER_IS_HIPCC AND HIPCC_EXECUTABLE)
if(CMAKE_CXX_COMPILER STREQUAL HIPCC_EXECUTABLE OR "${CMAKE_CXX_COMPILER}" MATCHES
"hipcc")
set(CMAKE_CXX_COMPILER_IS_HIPCC
1
CACHE BOOL "HIP compiler")
if(
CMAKE_CXX_COMPILER STREQUAL HIPCC_EXECUTABLE
OR "${CMAKE_CXX_COMPILER}" MATCHES "hipcc"
)
set(CMAKE_CXX_COMPILER_IS_HIPCC 1 CACHE BOOL "HIP compiler")
endif()
endif()
if((NOT CMAKE_CXX_COMPILER_IS_HIPCC OR (NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang"
AND NOT hip_FOUND))
AND (NOT COMMAND rocprofiler_systems_custom_compilation AND NOT HIPCC_EXECUTABLE))
if(
(
NOT CMAKE_CXX_COMPILER_IS_HIPCC
OR (NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT hip_FOUND)
)
AND (NOT COMMAND rocprofiler_systems_custom_compilation AND NOT HIPCC_EXECUTABLE)
)
message(AUTHOR_WARNING "transpose target could not be built")
return()
endif()
@@ -51,15 +63,18 @@ endif()
add_executable(transpose transpose.cpp)
target_link_libraries(transpose PRIVATE Threads::Threads)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang"
AND NOT CMAKE_CXX_COMPILER_IS_HIPCC
AND NOT HIPCC_EXECUTABLE)
if(
CMAKE_CXX_COMPILER_ID MATCHES "Clang"
AND NOT CMAKE_CXX_COMPILER_IS_HIPCC
AND NOT HIPCC_EXECUTABLE
)
target_link_libraries(
transpose
PRIVATE
$<TARGET_NAME_IF_EXISTS:rocprofiler-systems::rocprofiler-systems-compile-options>
$<TARGET_NAME_IF_EXISTS:hip::host>
$<TARGET_NAME_IF_EXISTS:hip::device>)
$<TARGET_NAME_IF_EXISTS:hip::device>
)
else()
target_compile_options(transpose PRIVATE -W -Wall)
endif()
@@ -79,8 +94,5 @@ if(NOT CMAKE_CXX_COMPILER_IS_HIPCC AND HIPCC_EXECUTABLE)
endif()
if(ROCPROFSYS_INSTALL_EXAMPLES)
install(
TARGETS transpose
DESTINATION bin
COMPONENT rocprofiler-systems-examples)
install(TARGETS transpose DESTINATION bin COMPONENT rocprofiler-systems-examples)
endif()
+8 -8
Просмотреть файл
@@ -5,8 +5,10 @@ project(rocprofiler-systems-user-api-example LANGUAGES CXX)
if(ROCPROFSYS_DISABLE_EXAMPLES)
get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME)
if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST
ROCPROFSYS_DISABLE_EXAMPLES)
if(
${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
OR ${_DIR} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
)
return()
endif()
endif()
@@ -18,12 +20,10 @@ if(NOT TARGET rocprofiler-systems::rocprofiler-systems-user-library)
endif()
add_executable(user-api user-api.cpp)
target_link_libraries(
user-api PRIVATE Threads::Threads
rocprofiler-systems::rocprofiler-systems-user-library)
user-api
PRIVATE Threads::Threads rocprofiler-systems::rocprofiler-systems-user-library
)
if(ROCPROFSYS_INSTALL_EXAMPLES)
install(
TARGETS user-api
DESTINATION bin
COMPONENT rocprofiler-systems-examples)
install(TARGETS user-api DESTINATION bin COMPONENT rocprofiler-systems-examples)
endif()
+21 -22
Просмотреть файл
@@ -30,16 +30,20 @@ string(REPLACE " " ";" _FLAGS "${CMAKE_CXX_FLAGS_DEBUG}")
if(ROCPROFSYS_DISABLE_EXAMPLES)
get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME)
if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST
ROCPROFSYS_DISABLE_EXAMPLES)
if(
${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
OR ${_DIR} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
)
return()
endif()
endif()
function(videodecode_message _MSG_TYPE)
if("${CMAKE_PROJECT_NAME}" STREQUAL "rocprofiler-systems"
AND "$ENV{ROCPROFSYS_CI}"
AND "${_MSG_TYPE}" MATCHES "WARNING")
if(
"${CMAKE_PROJECT_NAME}" STREQUAL "rocprofiler-systems"
AND "$ENV{ROCPROFSYS_CI}"
AND "${_MSG_TYPE}" MATCHES "WARNING"
)
set(_MSG_TYPE STATUS) # don't generate warnings during CI
endif()
if("${CMAKE_PROJECT_NAME}" STREQUAL "rocprofiler-systems")
@@ -67,7 +71,8 @@ if(EXISTS "${ROCmVersion_DIR}/share/rocdecode/video")
else()
videodecode_message(
AUTHOR_WARNING
"Source directory ${ROCmVersion_DIR}/share/rocdecode/video does not exist")
"Source directory ${ROCmVersion_DIR}/share/rocdecode/video does not exist"
)
endif()
# Find FFMPEG
@@ -86,19 +91,11 @@ find_path(
FFMPEG_INCLUDE_DIR
NAMES libavcodec/avcodec.h libavformat/avformat.h libavutil/avutil.h
PATHS ${FFMPEG_INCLUDE_DIRS}
PATH_SUFFIXES ffmpeg libav)
find_library(
AVCODEC_LIBRARY
NAMES avcodec
PATHS ${FFMPEG_LIBRARY_DIRS})
find_library(
AVFORMAT_LIBRARY
NAMES avformat
PATHS ${FFMPEG_LIBRARY_DIRS})
find_library(
AVUTIL_LIBRARY
NAMES avutil
PATHS ${FFMPEG_LIBRARY_DIRS})
PATH_SUFFIXES ffmpeg libav
)
find_library(AVCODEC_LIBRARY NAMES avcodec PATHS ${FFMPEG_LIBRARY_DIRS})
find_library(AVFORMAT_LIBRARY NAMES avformat PATHS ${FFMPEG_LIBRARY_DIRS})
find_library(AVUTIL_LIBRARY NAMES avutil PATHS ${FFMPEG_LIBRARY_DIRS})
set(FFMPEG_LIBRARIES ${AVCODEC_LIBRARY} ${AVFORMAT_LIBRARY} ${AVUTIL_LIBRARY})
set(FFMPEG_INCLUDE_DIRS ${FFMPEG_INCLUDE_DIR})
@@ -143,16 +140,18 @@ if(FFMPEG_FOUND AND ROCDECODE_FOUND)
install(
TARGETS videodecode
DESTINATION bin
COMPONENT rocprofiler-systems-examples)
COMPONENT rocprofiler-systems-examples
)
install(
FILES ${CMAKE_BINARY_DIR}/videos
DESTINATION share/rocprofiler-systems/tests/videos
COMPONENT rocprofiler-systems-examples)
COMPONENT rocprofiler-systems-examples
)
endif()
else()
message(
"-- ERROR!: videodecode excluded! please install all the dependencies and try again!"
)
)
if(NOT FFMPEG_FOUND)
message(WARNING "-- ERROR!: FFMPEG Not Found! - please install FFMPEG!")
endif()
+4 -4
Просмотреть файл
@@ -22,14 +22,14 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
if ! command -v cmake-format &> /dev/null; then
echo "cmake-format could not be found. Please install it with 'pip install cmake-format' or 'apt install cmake-format'."
if ! command -v gersemi &> /dev/null; then
echo "gersemi could not be found. Please install it with 'pip install gersemi' or 'apt install gersemi'."
exit 1
fi
for file in "$@"; do
# Run cmake-format in-place
cmake-format -i "$file"
# Run gersemi in-place
gersemi -i "$file"
# Check if the file has changes using git diff
if ! git diff --quiet -- "$file"; then
echo "Formatted: $file"
+18 -8
Просмотреть файл
@@ -25,8 +25,13 @@ cmake_minimum_required(VERSION 3.18.4)
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"
ROCPROFSYS_VERSION "${FULL_VERSION_STRING}")
string(
REGEX REPLACE
"([0-9]+)\.([0-9]+)\.([0-9]+)(.*)"
"\\1.\\2.\\3"
ROCPROFSYS_VERSION
"${FULL_VERSION_STRING}"
)
endif()
find_package(Git)
@@ -37,20 +42,22 @@ if(Git_FOUND AND EXISTS ".git")
OUTPUT_VARIABLE ROCPROFSYS_GIT_TAG
OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE _GIT_DESCRIBE_RESULT
ERROR_QUIET)
ERROR_QUIET
)
if(NOT _GIT_DESCRIBE_RESULT EQUAL 0)
execute_process(
COMMAND ${GIT_EXECUTABLE} describe
OUTPUT_VARIABLE ROCPROFSYS_GIT_TAG
OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE _GIT_DESCRIBE_RESULT
ERROR_QUIET)
ERROR_QUIET
)
endif()
else()
message(
STATUS
"Git not found or .git directory not found; using version ${ROCPROFSYS_VERSION}"
)
"Git not found or .git directory not found; using version ${ROCPROFSYS_VERSION}"
)
set(GIT_DESCRIBE "v${ROCPROFSYS_VERSION}")
endif()
@@ -62,5 +69,8 @@ message(STATUS "Writing ${OUTPUT_DIR}/rocprofiler-systems-install.py.")
message(STATUS "rocprofiler-systems version: ${ROCPROFSYS_VERSION}.")
message(STATUS "rocprofiler-systems git describe: ${ROCPROFSYS_GIT_TAG}")
configure_file(${CMAKE_CURRENT_LIST_DIR}/../cmake/Templates/rocprof-sys-install.py.in
${OUTPUT_DIR}/rocprofiler-systems-install.py @ONLY)
configure_file(
${CMAKE_CURRENT_LIST_DIR}/../cmake/Templates/rocprof-sys-install.py.in
${OUTPUT_DIR}/rocprofiler-systems-install.py
@ONLY
)
+7 -2
Просмотреть файл
@@ -19,8 +19,13 @@ endif()
if(ROCPROFSYS_BUILD_DEVELOPER)
add_custom_target(rocprofiler-systems-precommit)
foreach(_TARGET format-rocprofiler-systems-source format-rocprofiler-systems-cmake
format-timemory-source format-timemory-cmake)
foreach(
_TARGET
format-rocprofiler-systems-source
format-rocprofiler-systems-cmake
format-timemory-source
format-timemory-cmake
)
if(TARGET ${_TARGET})
add_dependencies(rocprofiler-systems-precommit ${_TARGET})
endif()
+1 -1
Просмотреть файл
@@ -2,7 +2,7 @@
set(ROCPROFSYS_EXE_INSTALL_RPATH
"\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}"
)
)
# executables
add_subdirectory(rocprof-sys-avail)
+30 -25
Просмотреть файл
@@ -8,37 +8,42 @@ add_executable(rocprofiler-systems-avail)
target_sources(
rocprofiler-systems-avail
PRIVATE ${CMAKE_CURRENT_LIST_DIR}/avail.cpp
${CMAKE_CURRENT_LIST_DIR}/avail.hpp
${CMAKE_CURRENT_LIST_DIR}/common.cpp
${CMAKE_CURRENT_LIST_DIR}/common.hpp
${CMAKE_CURRENT_LIST_DIR}/component_categories.hpp
${CMAKE_CURRENT_LIST_DIR}/defines.hpp
${CMAKE_CURRENT_LIST_DIR}/enumerated_list.hpp
${CMAKE_CURRENT_LIST_DIR}/generate_config.cpp
${CMAKE_CURRENT_LIST_DIR}/generate_config.hpp
${CMAKE_CURRENT_LIST_DIR}/get_availability.hpp
${CMAKE_CURRENT_LIST_DIR}/get_categories.hpp
${CMAKE_CURRENT_LIST_DIR}/info_type.cpp
${CMAKE_CURRENT_LIST_DIR}/info_type.hpp)
PRIVATE
${CMAKE_CURRENT_LIST_DIR}/avail.cpp
${CMAKE_CURRENT_LIST_DIR}/avail.hpp
${CMAKE_CURRENT_LIST_DIR}/common.cpp
${CMAKE_CURRENT_LIST_DIR}/common.hpp
${CMAKE_CURRENT_LIST_DIR}/component_categories.hpp
${CMAKE_CURRENT_LIST_DIR}/defines.hpp
${CMAKE_CURRENT_LIST_DIR}/enumerated_list.hpp
${CMAKE_CURRENT_LIST_DIR}/generate_config.cpp
${CMAKE_CURRENT_LIST_DIR}/generate_config.hpp
${CMAKE_CURRENT_LIST_DIR}/get_availability.hpp
${CMAKE_CURRENT_LIST_DIR}/get_categories.hpp
${CMAKE_CURRENT_LIST_DIR}/info_type.cpp
${CMAKE_CURRENT_LIST_DIR}/info_type.hpp
)
target_include_directories(rocprofiler-systems-avail PRIVATE ${CMAKE_CURRENT_LIST_DIR})
target_compile_definitions(rocprofiler-systems-avail
PRIVATE ROCPROFSYS_EXTERN_COMPONENTS=0)
target_compile_definitions(
rocprofiler-systems-avail
PRIVATE ROCPROFSYS_EXTERN_COMPONENTS=0
)
target_link_libraries(
rocprofiler-systems-avail
PRIVATE rocprofiler-systems::rocprofiler-systems-compile-definitions
rocprofiler-systems::rocprofiler-systems-interface-library
rocprofiler-systems::librocprofiler-systems-static)
PRIVATE
rocprofiler-systems::rocprofiler-systems-compile-definitions
rocprofiler-systems::rocprofiler-systems-interface-library
rocprofiler-systems::librocprofiler-systems-static
)
set_target_properties(
rocprofiler-systems-avail
PROPERTIES BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}"
INSTALL_RPATH "${ROCPROFSYS_EXE_INSTALL_RPATH}"
OUTPUT_NAME ${BINARY_NAME_PREFIX}-avail)
PROPERTIES
BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}"
INSTALL_RPATH "${ROCPROFSYS_EXE_INSTALL_RPATH}"
OUTPUT_NAME ${BINARY_NAME_PREFIX}-avail
)
rocprofiler_systems_strip_target(rocprofiler-systems-avail)
install(
TARGETS rocprofiler-systems-avail
DESTINATION ${CMAKE_INSTALL_BINDIR}
OPTIONAL)
install(TARGETS rocprofiler-systems-avail DESTINATION ${CMAKE_INSTALL_BINDIR} OPTIONAL)
+15 -12
Просмотреть файл
@@ -7,25 +7,28 @@
add_executable(
rocprofiler-systems-causal
${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-causal.cpp
${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-causal.hpp ${CMAKE_CURRENT_LIST_DIR}/impl.cpp)
${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-causal.hpp
${CMAKE_CURRENT_LIST_DIR}/impl.cpp
)
target_compile_definitions(rocprofiler-systems-causal PRIVATE TIMEMORY_CMAKE=1)
target_include_directories(rocprofiler-systems-causal PRIVATE ${CMAKE_CURRENT_LIST_DIR})
target_link_libraries(
rocprofiler-systems-causal
PRIVATE rocprofiler-systems::rocprofiler-systems-compile-definitions
rocprofiler-systems::rocprofiler-systems-headers
rocprofiler-systems::rocprofiler-systems-common-library
rocprofiler-systems::rocprofiler-systems-core)
PRIVATE
rocprofiler-systems::rocprofiler-systems-compile-definitions
rocprofiler-systems::rocprofiler-systems-headers
rocprofiler-systems::rocprofiler-systems-common-library
rocprofiler-systems::rocprofiler-systems-core
)
set_target_properties(
rocprofiler-systems-causal
PROPERTIES BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}"
INSTALL_RPATH "${ROCPROFSYS_EXE_INSTALL_RPATH}"
OUTPUT_NAME ${BINARY_NAME_PREFIX}-causal)
PROPERTIES
BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}"
INSTALL_RPATH "${ROCPROFSYS_EXE_INSTALL_RPATH}"
OUTPUT_NAME ${BINARY_NAME_PREFIX}-causal
)
rocprofiler_systems_strip_target(rocprofiler-systems-causal)
install(
TARGETS rocprofiler-systems-causal
DESTINATION ${CMAKE_INSTALL_BINDIR}
OPTIONAL)
install(TARGETS rocprofiler-systems-causal DESTINATION ${CMAKE_INSTALL_BINDIR} OPTIONAL)
+11 -10
Просмотреть файл
@@ -7,19 +7,20 @@
add_executable(rocprofiler-systems-exe ${CMAKE_CURRENT_LIST_DIR}/rocprof-sys.cpp)
target_link_libraries(rocprofiler-systems-exe
PRIVATE rocprofiler-systems::rocprofiler-systems-threading)
target_link_libraries(
rocprofiler-systems-exe
PRIVATE rocprofiler-systems::rocprofiler-systems-threading
)
set_target_properties(
rocprofiler-systems-exe
PROPERTIES OUTPUT_NAME rocprof-sys
BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}"
INSTALL_RPATH "${ROCPROFSYS_EXE_INSTALL_RPATH}"
INSTALL_RPATH_USE_LINK_PATH ON)
PROPERTIES
OUTPUT_NAME rocprof-sys
BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}"
INSTALL_RPATH "${ROCPROFSYS_EXE_INSTALL_RPATH}"
INSTALL_RPATH_USE_LINK_PATH ON
)
rocprofiler_systems_strip_target(rocprofiler-systems-exe)
install(
TARGETS rocprofiler-systems-exe
DESTINATION ${CMAKE_INSTALL_BINDIR}
OPTIONAL)
install(TARGETS rocprofiler-systems-exe DESTINATION ${CMAKE_INSTALL_BINDIR} OPTIONAL)
+37 -28
Просмотреть файл
@@ -10,43 +10,51 @@ add_executable(rocprofiler-systems-instrument)
target_sources(
rocprofiler-systems-instrument
PRIVATE ${CMAKE_CURRENT_LIST_DIR}/details.cpp
${CMAKE_CURRENT_LIST_DIR}/function_signature.cpp
${CMAKE_CURRENT_LIST_DIR}/function_signature.hpp
${CMAKE_CURRENT_LIST_DIR}/fwd.hpp
${CMAKE_CURRENT_LIST_DIR}/info.hpp
${CMAKE_CURRENT_LIST_DIR}/internal_libs.cpp
${CMAKE_CURRENT_LIST_DIR}/internal_libs.hpp
${CMAKE_CURRENT_LIST_DIR}/log.cpp
${CMAKE_CURRENT_LIST_DIR}/log.hpp
${CMAKE_CURRENT_LIST_DIR}/module_function.cpp
${CMAKE_CURRENT_LIST_DIR}/module_function.hpp
${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-instrument.cpp
${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-instrument.hpp)
PRIVATE
${CMAKE_CURRENT_LIST_DIR}/details.cpp
${CMAKE_CURRENT_LIST_DIR}/function_signature.cpp
${CMAKE_CURRENT_LIST_DIR}/function_signature.hpp
${CMAKE_CURRENT_LIST_DIR}/fwd.hpp
${CMAKE_CURRENT_LIST_DIR}/info.hpp
${CMAKE_CURRENT_LIST_DIR}/internal_libs.cpp
${CMAKE_CURRENT_LIST_DIR}/internal_libs.hpp
${CMAKE_CURRENT_LIST_DIR}/log.cpp
${CMAKE_CURRENT_LIST_DIR}/log.hpp
${CMAKE_CURRENT_LIST_DIR}/module_function.cpp
${CMAKE_CURRENT_LIST_DIR}/module_function.hpp
${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-instrument.cpp
${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-instrument.hpp
)
target_link_libraries(
rocprofiler-systems-instrument
PRIVATE rocprofiler-systems::rocprofiler-systems-headers
rocprofiler-systems::rocprofiler-systems-dyninst
rocprofiler-systems::rocprofiler-systems-compile-options
rocprofiler-systems::rocprofiler-systems-compile-definitions
rocprofiler-systems::rocprofiler-systems-sanitizer
timemory::timemory-headers
timemory::timemory-extensions
timemory::timemory-core)
PRIVATE
rocprofiler-systems::rocprofiler-systems-headers
rocprofiler-systems::rocprofiler-systems-dyninst
rocprofiler-systems::rocprofiler-systems-compile-options
rocprofiler-systems::rocprofiler-systems-compile-definitions
rocprofiler-systems::rocprofiler-systems-sanitizer
timemory::timemory-headers
timemory::timemory-extensions
timemory::timemory-core
)
add_target_flag_if_avail(rocprofiler-systems-instrument "-Wno-deprecated-declarations")
set_target_properties(
rocprofiler-systems-instrument
PROPERTIES BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}"
INSTALL_RPATH "${ROCPROFSYS_EXE_INSTALL_RPATH}"
INSTALL_RPATH_USE_LINK_PATH ON
OUTPUT_NAME ${BINARY_NAME_PREFIX}-instrument)
PROPERTIES
BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}"
INSTALL_RPATH "${ROCPROFSYS_EXE_INSTALL_RPATH}"
INSTALL_RPATH_USE_LINK_PATH ON
OUTPUT_NAME ${BINARY_NAME_PREFIX}-instrument
)
if(ROCPROFSYS_BUILD_DYNINST)
target_compile_definitions(rocprofiler-systems-instrument
PRIVATE ROCPROFSYS_BUILD_DYNINST=1)
target_compile_definitions(
rocprofiler-systems-instrument
PRIVATE ROCPROFSYS_BUILD_DYNINST=1
)
endif()
add_target_flag_if_avail(rocprofiler-systems-instrument "-Wno-deprecated-declarations")
@@ -61,4 +69,5 @@ endif()
install(
TARGETS rocprofiler-systems-instrument
DESTINATION ${CMAKE_INSTALL_BINDIR}
OPTIONAL)
OPTIONAL
)
+16 -13
Просмотреть файл
@@ -7,26 +7,29 @@
add_executable(
rocprofiler-systems-run
${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-run.cpp
${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-run.hpp ${CMAKE_CURRENT_LIST_DIR}/impl.cpp)
${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-run.hpp
${CMAKE_CURRENT_LIST_DIR}/impl.cpp
)
target_compile_definitions(rocprofiler-systems-run PRIVATE TIMEMORY_CMAKE=1)
target_include_directories(rocprofiler-systems-run PRIVATE ${CMAKE_CURRENT_LIST_DIR})
target_link_libraries(
rocprofiler-systems-run
PRIVATE rocprofiler-systems::rocprofiler-systems-compile-definitions
rocprofiler-systems::rocprofiler-systems-headers
rocprofiler-systems::rocprofiler-systems-common-library
rocprofiler-systems::rocprofiler-systems-core
rocprofiler-systems::rocprofiler-systems-sanitizer)
PRIVATE
rocprofiler-systems::rocprofiler-systems-compile-definitions
rocprofiler-systems::rocprofiler-systems-headers
rocprofiler-systems::rocprofiler-systems-common-library
rocprofiler-systems::rocprofiler-systems-core
rocprofiler-systems::rocprofiler-systems-sanitizer
)
set_target_properties(
rocprofiler-systems-run
PROPERTIES BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}"
INSTALL_RPATH "${ROCPROFSYS_EXE_INSTALL_RPATH}"
OUTPUT_NAME ${BINARY_NAME_PREFIX}-run)
PROPERTIES
BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}"
INSTALL_RPATH "${ROCPROFSYS_EXE_INSTALL_RPATH}"
OUTPUT_NAME ${BINARY_NAME_PREFIX}-run
)
rocprofiler_systems_strip_target(rocprofiler-systems-run)
install(
TARGETS rocprofiler-systems-run
DESTINATION ${CMAKE_INSTALL_BINDIR}
OPTIONAL)
install(TARGETS rocprofiler-systems-run DESTINATION ${CMAKE_INSTALL_BINDIR} OPTIONAL)
+16 -12
Просмотреть файл
@@ -4,25 +4,29 @@
#
# ------------------------------------------------------------------------------#
add_executable(rocprofiler-systems-sample ${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-sample.cpp
${CMAKE_CURRENT_LIST_DIR}/impl.cpp)
add_executable(
rocprofiler-systems-sample
${CMAKE_CURRENT_LIST_DIR}/rocprof-sys-sample.cpp
${CMAKE_CURRENT_LIST_DIR}/impl.cpp
)
target_compile_definitions(rocprofiler-systems-sample PRIVATE TIMEMORY_CMAKE=1)
target_include_directories(rocprofiler-systems-sample PRIVATE ${CMAKE_CURRENT_LIST_DIR})
target_link_libraries(
rocprofiler-systems-sample
PRIVATE rocprofiler-systems::rocprofiler-systems-compile-definitions
rocprofiler-systems::rocprofiler-systems-headers
rocprofiler-systems::rocprofiler-systems-common-library)
PRIVATE
rocprofiler-systems::rocprofiler-systems-compile-definitions
rocprofiler-systems::rocprofiler-systems-headers
rocprofiler-systems::rocprofiler-systems-common-library
)
set_target_properties(
rocprofiler-systems-sample
PROPERTIES BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}"
INSTALL_RPATH "${ROCPROFSYS_EXE_INSTALL_RPATH}"
OUTPUT_NAME ${BINARY_NAME_PREFIX}-sample)
PROPERTIES
BUILD_RPATH "\$ORIGIN:\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}"
INSTALL_RPATH "${ROCPROFSYS_EXE_INSTALL_RPATH}"
OUTPUT_NAME ${BINARY_NAME_PREFIX}-sample
)
rocprofiler_systems_strip_target(rocprofiler-systems-sample)
install(
TARGETS rocprofiler-systems-sample
DESTINATION ${CMAKE_INSTALL_BINDIR}
OPTIONAL)
install(TARGETS rocprofiler-systems-sample DESTINATION ${CMAKE_INSTALL_BINDIR} OPTIONAL)
+99 -73
Просмотреть файл
@@ -1,7 +1,9 @@
set(ROCPROFSYS_ABORT_FAIL_REGEX
"### ERROR ###|unknown-hash=|address of faulting memory reference|exiting with non-zero exit code|terminate called after throwing an instance|calling abort.. in |Exit code: [1-9]"
CACHE INTERNAL "Regex to catch abnormal exits when a PASS_REGULAR_EXPRESSION is set"
FORCE)
CACHE INTERNAL
"Regex to catch abnormal exits when a PASS_REGULAR_EXPRESSION is set"
FORCE
)
# adds a ctest for executable
function(ROCPROFILER_SYSTEMS_ADD_BIN_TEST)
@@ -11,7 +13,8 @@ function(ROCPROFILER_SYSTEMS_ADD_BIN_TEST)
"NAME;TARGET;TIMEOUT;WORKING_DIRECTORY" # single value args
"ARGS;ENVIRONMENT;LABELS;PROPERTIES;PASS_REGEX;FAIL_REGEX;SKIP_REGEX;DEPENDS;COMMAND" # multiple
# value args
${ARGN})
${ARGN}
)
if(NOT TEST_WORKING_DIRECTORY)
set(TEST_WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
@@ -24,7 +27,7 @@ function(ROCPROFILER_SYSTEMS_ADD_BIN_TEST)
"ROCPROFSYS_USE_SAMPLING=ON"
"ROCPROFSYS_TIME_OUTPUT=OFF"
"LD_LIBRARY_PATH=${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}:$ENV{LD_LIBRARY_PATH}"
)
)
endif()
# common
@@ -35,7 +38,8 @@ function(ROCPROFILER_SYSTEMS_ADD_BIN_TEST)
"ROCPROFSYS_CI_TIMEOUT=${TEST_TIMEOUT}"
"ROCPROFSYS_CONFIG_FILE="
"ROCPROFSYS_OUTPUT_PATH=${PROJECT_BINARY_DIR}/rocprof-sys-tests-output"
"TWD=${TEST_WORKING_DIRECTORY}")
"TWD=${TEST_WORKING_DIRECTORY}"
)
# copy for inverse
set(TEST_ENVIRONMENT_INV "${TEST_ENVIRONMENT}")
@@ -43,68 +47,67 @@ function(ROCPROFILER_SYSTEMS_ADD_BIN_TEST)
list(APPEND TEST_ENVIRONMENT "ROCPROFSYS_OUTPUT_PREFIX=${TEST_NAME}/")
list(APPEND TEST_ENVIRONMENT_INV "ROCPROFSYS_OUTPUT_PREFIX=${TEST_NAME}-inverse/")
if(NOT "${TEST_PASS_REGEX}" STREQUAL ""
AND NOT "${TEST_FAIL_REGEX}" STREQUAL ""
AND NOT "${TEST_FAIL_REGEX}" MATCHES "\\|ROCPROFSYS_ABORT_FAIL_REGEX")
if(
NOT "${TEST_PASS_REGEX}" STREQUAL ""
AND NOT "${TEST_FAIL_REGEX}" STREQUAL ""
AND NOT "${TEST_FAIL_REGEX}" MATCHES "\\|ROCPROFSYS_ABORT_FAIL_REGEX"
)
rocprofiler_systems_message(
FATAL_ERROR
"${TEST_NAME} has set pass and fail regexes but fail regex does not include '|ROCPROFSYS_ABORT_FAIL_REGEX'"
)
)
endif()
if("${TEST_FAIL_REGEX}" STREQUAL "")
set(TEST_FAIL_REGEX "(${ROCPROFSYS_ABORT_FAIL_REGEX})")
else()
string(REPLACE "|ROCPROFSYS_ABORT_FAIL_REGEX" "|${ROCPROFSYS_ABORT_FAIL_REGEX}"
TEST_FAIL_REGEX "${TEST_FAIL_REGEX}")
string(
REPLACE
"|ROCPROFSYS_ABORT_FAIL_REGEX"
"|${ROCPROFSYS_ABORT_FAIL_REGEX}"
TEST_FAIL_REGEX
"${TEST_FAIL_REGEX}"
)
endif()
if(TEST_COMMAND)
add_test(
NAME ${TEST_NAME}
COMMAND ${TEST_COMMAND} ${TEST_ARGS}
WORKING_DIRECTORY ${TEST_WORKING_DIRECTORY})
WORKING_DIRECTORY ${TEST_WORKING_DIRECTORY}
)
set_tests_properties(
${TEST_NAME}
PROPERTIES ENVIRONMENT
"${TEST_ENVIRONMENT}"
TIMEOUT
${TEST_TIMEOUT}
DEPENDS
"${TEST_DEPENDS}"
LABELS
"rocprofiler-systems-bin;${TEST_LABELS}"
PASS_REGULAR_EXPRESSION
"${TEST_PASS_REGEX}"
FAIL_REGULAR_EXPRESSION
"${TEST_FAIL_REGEX}"
SKIP_REGULAR_EXPRESSION
"${TEST_SKIP_REGEX}"
${TEST_PROPERTIES})
PROPERTIES
ENVIRONMENT "${TEST_ENVIRONMENT}"
TIMEOUT ${TEST_TIMEOUT}
DEPENDS "${TEST_DEPENDS}"
LABELS "rocprofiler-systems-bin;${TEST_LABELS}"
PASS_REGULAR_EXPRESSION "${TEST_PASS_REGEX}"
FAIL_REGULAR_EXPRESSION "${TEST_FAIL_REGEX}"
SKIP_REGULAR_EXPRESSION "${TEST_SKIP_REGEX}"
${TEST_PROPERTIES}
)
elseif(TARGET ${TEST_TARGET})
add_test(
NAME ${TEST_NAME}
COMMAND $<TARGET_FILE:${TEST_TARGET}> ${TEST_ARGS}
WORKING_DIRECTORY ${TEST_WORKING_DIRECTORY})
WORKING_DIRECTORY ${TEST_WORKING_DIRECTORY}
)
set_tests_properties(
${TEST_NAME}
PROPERTIES ENVIRONMENT
"${TEST_ENVIRONMENT}"
TIMEOUT
${TEST_TIMEOUT}
DEPENDS
"${TEST_DEPENDS}"
LABELS
"rocprofiler-systems-bin;${TEST_LABELS}"
PASS_REGULAR_EXPRESSION
"${TEST_PASS_REGEX}"
FAIL_REGULAR_EXPRESSION
"${TEST_FAIL_REGEX}"
SKIP_REGULAR_EXPRESSION
"${TEST_SKIP_REGEX}"
${TEST_PROPERTIES})
PROPERTIES
ENVIRONMENT "${TEST_ENVIRONMENT}"
TIMEOUT ${TEST_TIMEOUT}
DEPENDS "${TEST_DEPENDS}"
LABELS "rocprofiler-systems-bin;${TEST_LABELS}"
PASS_REGULAR_EXPRESSION "${TEST_PASS_REGEX}"
FAIL_REGULAR_EXPRESSION "${TEST_FAIL_REGEX}"
SKIP_REGULAR_EXPRESSION "${TEST_SKIP_REGEX}"
${TEST_PROPERTIES}
)
elseif(ROCPROFSYS_BUILD_TESTING)
message(FATAL_ERROR "Error! ${TEST_TARGET} does not exist")
endif()
@@ -118,7 +121,7 @@ rocprofiler_systems_add_bin_test(
TIMEOUT 45
PASS_REGEX
".*\\\[rocprof-sys-instrument\\\] Usage:.*\\\[DEBUG OPTIONS\\\].*\\\[MODE OPTIONS\\\].*\\\[LIBRARY OPTIONS\\\].*\\\[SYMBOL SELECTION OPTIONS\\\].*\\\[RUNTIME OPTIONS\\\].*\\\[GRANULARITY OPTIONS\\\].*\\\[DYNINST OPTIONS\\\].*"
)
)
# on RedHat, /usr/bin/ls is a script for `coreutils --coreutils-prog=ls`
if(EXISTS /usr/bin/coreutils)
@@ -144,7 +147,8 @@ rocprofiler_systems_add_bin_test(
${LS_NAME}
${LS_ARGS}
LABELS "simulate"
TIMEOUT 240)
TIMEOUT 240
)
rocprofiler_systems_add_bin_test(
NAME rocprofiler-systems-instrument-simulate-ls-check
@@ -155,7 +159,8 @@ rocprofiler_systems_add_bin_test(
TIMEOUT 60
PASS_REGEX
".*available.json.*available.txt.*available.xml.*excluded.json.*excluded.txt.*excluded.xml.*instrumented.json.*instrumented.txt.*instrumented.xml.*overlapping.json.*overlapping.txt.*overlapping.xml.*"
FAIL_REGEX "No such file or directory|not found|ROCPROFSYS_ABORT_FAIL_REGEX")
FAIL_REGEX "No such file or directory|not found|ROCPROFSYS_ABORT_FAIL_REGEX"
)
rocprofiler_systems_add_bin_test(
NAME rocprofiler-systems-instrument-simulate-lib
@@ -166,7 +171,7 @@ rocprofiler_systems_add_bin_test(
TIMEOUT 120
PASS_REGEX
"\\\[rocprof-sys\\\]\\\[exe\\\] Runtime instrumentation is not possible!(.*)\n(.*)\\\[rocprof-sys\\\]\\\[exe\\\] Switching to binary rewrite mode and assuming '--simulate --all-functions'"
)
)
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/rocprof-sys-tests-output/tmp)
@@ -183,7 +188,8 @@ rocprofiler_systems_add_bin_test(
${CMAKE_SHARED_LIBRARY_PREFIX}$<TARGET_FILE_BASE_NAME:rocprofiler-systems-user-library>${CMAKE_SHARED_LIBRARY_SUFFIX}
LABELS "simulate"
TIMEOUT 120
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/rocprof-sys-tests-output/tmp)
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/rocprof-sys-tests-output/tmp
)
rocprofiler_systems_add_bin_test(
NAME rocprofiler-systems-instrument-write-log
@@ -199,7 +205,8 @@ rocprofiler_systems_add_bin_test(
${LS_ARGS}
LABELS "log"
TIMEOUT 120
PASS_REGEX "Opening .*/instrumentation/user.log")
PASS_REGEX "Opening .*/instrumentation/user.log"
)
rocprofiler_systems_add_bin_test(
NAME rocprofiler-systems-instrument-write-log-check
@@ -210,7 +217,8 @@ rocprofiler_systems_add_bin_test(
LABELS "log"
TIMEOUT 60
PASS_REGEX "user.log"
FAIL_REGEX "No such file or directory|not found|ROCPROFSYS_ABORT_FAIL_REGEX")
FAIL_REGEX "No such file or directory|not found|ROCPROFSYS_ABORT_FAIL_REGEX"
)
rocprofiler_systems_add_bin_test(
NAME rocprofiler-systems-avail-help
@@ -220,14 +228,15 @@ rocprofiler_systems_add_bin_test(
TIMEOUT 45
PASS_REGEX
".*\\\[rocprof-sys-avail\\\] Usage:.*\\\[DEBUG OPTIONS\\\].*\\\[INFO OPTIONS\\\].*\\\[FILTER OPTIONS\\\].*\\\[COLUMN OPTIONS\\\].*\\\[DISPLAY OPTIONS\\\].*\\\[OUTPUT OPTIONS\\\].*"
)
)
rocprofiler_systems_add_bin_test(
NAME rocprofiler-systems-avail-all
TARGET rocprofiler-systems-avail
ARGS --all
LABELS "rocprofiler-systems-avail"
TIMEOUT 45)
TIMEOUT 45
)
rocprofiler_systems_add_bin_test(
NAME rocprofiler-systems-avail-all-expand-keys
@@ -235,7 +244,8 @@ rocprofiler_systems_add_bin_test(
ARGS --all --expand-keys
LABELS "rocprofiler-systems-avail"
TIMEOUT 45
FAIL_REGEX "%[a-zA-Z_]%|ROCPROFSYS_ABORT_FAIL_REGEX")
FAIL_REGEX "%[a-zA-Z_]%|ROCPROFSYS_ABORT_FAIL_REGEX"
)
rocprofiler_systems_add_bin_test(
NAME rocprofiler-systems-avail-all-only-available-alphabetical
@@ -246,7 +256,8 @@ rocprofiler_systems_add_bin_test(
TIMEOUT 45
PROPERTIES
ATTACHED_FILES
${CMAKE_CURRENT_BINARY_DIR}/rocprof-sys-avail-all-only-available-alphabetical.log)
${CMAKE_CURRENT_BINARY_DIR}/rocprof-sys-avail-all-only-available-alphabetical.log
)
rocprofiler_systems_add_bin_test(
NAME rocprofiler-systems-avail-all-csv
@@ -256,7 +267,7 @@ rocprofiler_systems_add_bin_test(
TIMEOUT 45
PASS_REGEX
"COMPONENT#AVAILABLE#VALUE_TYPE#STRING_IDS#FILENAME#DESCRIPTION#CATEGORY#.*ENVIRONMENT VARIABLE#VALUE#DATA TYPE#DESCRIPTION#CATEGORIES#.*HARDWARE COUNTER#DEVICE#AVAILABLE#DESCRIPTION#"
)
)
rocprofiler_systems_add_bin_test(
NAME rocprofiler-systems-avail-filter-wall-clock-available
@@ -266,7 +277,7 @@ rocprofiler_systems_add_bin_test(
TIMEOUT 45
PASS_REGEX
"\\\|[-]+\\\|\n\\\|[ ]+COMPONENT[ ]+\\\|\n\\\|[-]+\\\|\n\\\| (wall_clock)[ ]+\\\|\n\\\|[-]+\\\|"
)
)
rocprofiler_systems_add_bin_test(
NAME rocprofiler-systems-avail-category-filter-rocprofiler-systems
@@ -277,7 +288,7 @@ rocprofiler_systems_add_bin_test(
PASS_REGEX "ROCPROFSYS_(SETTINGS_DESC|OUTPUT_FILE|OUTPUT_PREFIX)"
FAIL_REGEX
"ROCPROFSYS_(ADD_SECONDARY|SCIENTIFIC|PRECISION|MEMORY_PRECISION|TIMING_PRECISION)|ROCPROFSYS_ABORT_FAIL_REGEX"
)
)
rocprofiler_systems_add_bin_test(
NAME rocprofiler-systems-avail-category-filter-timemory
@@ -287,7 +298,8 @@ rocprofiler_systems_add_bin_test(
TIMEOUT 45
PASS_REGEX
"ROCPROFSYS_(ADD_SECONDARY|SCIENTIFIC|PRECISION|MEMORY_PRECISION|TIMING_PRECISION)"
FAIL_REGEX "ROCPROFSYS_(SETTINGS_DESC|OUTPUT_FILE)|ROCPROFSYS_ABORT_FAIL_REGEX")
FAIL_REGEX "ROCPROFSYS_(SETTINGS_DESC|OUTPUT_FILE)|ROCPROFSYS_ABORT_FAIL_REGEX"
)
rocprofiler_systems_add_bin_test(
NAME rocprofiler-systems-avail-regex-negation
@@ -307,12 +319,16 @@ rocprofiler_systems_add_bin_test(
TIMEOUT 45
PASS_REGEX
"ENVIRONMENT VARIABLE,[ \n]+ROCPROFSYS_THREAD_POOL_SIZE,[ \n]+ROCPROFSYS_USE_PID,[ \n]+"
FAIL_REGEX "ROCPROFSYS_TRACE|ROCPROFSYS_ABORT_FAIL_REGEX")
FAIL_REGEX "ROCPROFSYS_TRACE|ROCPROFSYS_ABORT_FAIL_REGEX"
)
string(
REPLACE
"+" "\\\+" _AVAIL_CFG_PATH
"${PROJECT_BINARY_DIR}/rocprof-sys-tests-output/rocprof-sys-avail/rocprof-sys-")
"+"
"\\\+"
_AVAIL_CFG_PATH
"${PROJECT_BINARY_DIR}/rocprof-sys-tests-output/rocprof-sys-avail/rocprof-sys-"
)
# use of TWD == Test Working Directory (added by function)
rocprofiler_systems_add_bin_test(
NAME rocprofiler-systems-avail-write-config
@@ -331,7 +347,7 @@ rocprofiler_systems_add_bin_test(
LABELS "rocprofiler-systems-avail"
PASS_REGEX
"Outputting JSON configuration file '${_AVAIL_CFG_PATH}test\\\.json'(.*)Outputting XML configuration file '${_AVAIL_CFG_PATH}test\\\.xml'(.*)Outputting text configuration file '${_AVAIL_CFG_PATH}test\\\.cfg'(.*)"
)
)
rocprofiler_systems_add_bin_test(
NAME rocprofiler-systems-avail-write-config-tweak
@@ -343,7 +359,7 @@ rocprofiler_systems_add_bin_test(
ENVIRONMENT "ROCPROFSYS_TRACE=OFF;ROCPROFSYS_PROFILE=ON"
PASS_REGEX
"Outputting JSON configuration file '${_AVAIL_CFG_PATH}tweak\\\.json'(.*)Outputting XML configuration file '${_AVAIL_CFG_PATH}tweak\\\.xml'(.*)Outputting text configuration file '${_AVAIL_CFG_PATH}tweak\\\.cfg'(.*)"
)
)
rocprofiler_systems_add_bin_test(
NAME rocprofiler-systems-avail-list-keys
@@ -351,7 +367,8 @@ rocprofiler_systems_add_bin_test(
ARGS --list-keys --expand-keys
TIMEOUT 45
LABELS "rocprofiler-systems-avail"
PASS_REGEX "Output Keys:\n(.*)%argv%(.*)%argv_hash%")
PASS_REGEX "Output Keys:\n(.*)%argv%(.*)%argv_hash%"
)
rocprofiler_systems_add_bin_test(
NAME rocprofiler-systems-avail-list-keys-markdown
@@ -359,7 +376,8 @@ rocprofiler_systems_add_bin_test(
ARGS --list-keys --expand-keys --markdown
TIMEOUT 45
LABELS "rocprofiler-systems-avail;markdown"
PASS_REGEX "(.*)`%argv%`(.*)`%argv_hash%`")
PASS_REGEX "(.*)`%argv%`(.*)`%argv_hash%`"
)
rocprofiler_systems_add_bin_test(
NAME rocprofiler-systems-avail-list-categories
@@ -367,7 +385,8 @@ rocprofiler_systems_add_bin_test(
ARGS --list-categories
TIMEOUT 45
LABELS "rocprofiler-systems-avail"
PASS_REGEX " component::(.*) hw_counters::(.*) settings::")
PASS_REGEX " component::(.*) hw_counters::(.*) settings::"
)
rocprofiler_systems_add_bin_test(
NAME rocprofiler-systems-avail-core-categories
@@ -377,28 +396,34 @@ rocprofiler_systems_add_bin_test(
LABELS "rocprofiler-systems-avail"
PASS_REGEX
"ROCPROFSYS_CONFIG_FILE(.*)ROCPROFSYS_ENABLED(.*)ROCPROFSYS_SUPPRESS_CONFIG(.*)ROCPROFSYS_SUPPRESS_PARSING(.*)ROCPROFSYS_VERBOSE"
)
)
rocprofiler_systems_add_bin_test(
NAME rocprofiler-systems-run-help
TARGET rocprofiler-systems-run
ARGS --help
TIMEOUT 45
LABELS "rocprofiler-systems-run")
LABELS "rocprofiler-systems-run"
)
file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/rocprof-sys-tests-config")
file(
WRITE "${PROJECT_BINARY_DIR}/rocprof-sys-tests-config/empty.cfg"
WRITE
"${PROJECT_BINARY_DIR}/rocprof-sys-tests-config/empty.cfg"
"
#
# empty config file
#
")
"
)
add_executable(sleeper ${CMAKE_CURRENT_SOURCE_DIR}/sleeper.cpp)
set_target_properties(
sleeper PROPERTIES BUILD_TYPE RelWithDebInfo RUNTIME_OUTPUT_DIRECTORY
${PROJECT_BINARY_DIR}/bin/testing)
sleeper
PROPERTIES
BUILD_TYPE RelWithDebInfo
RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin/testing
)
rocprofiler_systems_add_bin_test(
NAME rocprofiler-systems-run-args
@@ -494,4 +519,5 @@ rocprofiler_systems_add_bin_test(
$<TARGET_FILE:sleeper>
5
TIMEOUT 45
LABELS "rocprofiler-systems-run")
LABELS "rocprofiler-systems-run"
)
+7 -4
Просмотреть файл
@@ -21,12 +21,15 @@ set(ROCPROFSYS_LIB_INSTALL_RPATH "\$ORIGIN:\$ORIGIN/${PROJECT_NAME}")
# ------------------------------------------------------------------------------#
add_library(rocprofiler-systems-interface-library INTERFACE)
add_library(rocprofiler-systems::rocprofiler-systems-interface-library ALIAS
rocprofiler-systems-interface-library)
add_library(
rocprofiler-systems::rocprofiler-systems-interface-library
ALIAS rocprofiler-systems-interface-library
)
target_include_directories(
rocprofiler-systems-interface-library
INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/rocprof-sys)
INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/rocprof-sys
)
target_link_libraries(
rocprofiler-systems-interface-library
@@ -48,7 +51,7 @@ target_link_libraries(
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-static-libstdcxx-optional>
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-sanitizer>
$<BUILD_INTERFACE:$<IF:$<BOOL:${ROCPROFSYS_BUILD_LTO}>,rocprofiler-systems::rocprofiler-systems-lto,>>
)
)
# ------------------------------------------------------------------------------#
#
+20 -10
Просмотреть файл
@@ -5,7 +5,8 @@ set(binary_sources
${CMAKE_CURRENT_LIST_DIR}/dwarf_entry.cpp
${CMAKE_CURRENT_LIST_DIR}/link_map.cpp
${CMAKE_CURRENT_LIST_DIR}/scope_filter.cpp
${CMAKE_CURRENT_LIST_DIR}/symbol.cpp)
${CMAKE_CURRENT_LIST_DIR}/symbol.cpp
)
set(binary_headers
${CMAKE_CURRENT_LIST_DIR}/address_multirange.hpp
@@ -14,19 +15,28 @@ set(binary_headers
${CMAKE_CURRENT_LIST_DIR}/binary_info.hpp
${CMAKE_CURRENT_LIST_DIR}/link_map.hpp
${CMAKE_CURRENT_LIST_DIR}/scope_filter.hpp
${CMAKE_CURRENT_LIST_DIR}/symbol.hpp)
${CMAKE_CURRENT_LIST_DIR}/symbol.hpp
)
add_library(rocprofiler-systems-binary-library STATIC)
add_library(rocprofiler-systems::rocprofiler-systems-binary ALIAS
rocprofiler-systems-binary-library)
add_library(
rocprofiler-systems::rocprofiler-systems-binary
ALIAS rocprofiler-systems-binary-library
)
target_sources(rocprofiler-systems-binary-library PRIVATE ${binary_sources}
${binary_headers})
target_sources(
rocprofiler-systems-binary-library
PRIVATE ${binary_sources} ${binary_headers}
)
target_link_libraries(
rocprofiler-systems-binary-library
PRIVATE rocprofiler-systems::rocprofiler-systems-interface-library
rocprofiler-systems::rocprofiler-systems-core)
PRIVATE
rocprofiler-systems::rocprofiler-systems-interface-library
rocprofiler-systems::rocprofiler-systems-core
)
set_target_properties(rocprofiler-systems-binary-library
PROPERTIES OUTPUT_NAME ${BINARY_NAME_PREFIX}-binary)
set_target_properties(
rocprofiler-systems-binary-library
PROPERTIES OUTPUT_NAME ${BINARY_NAME_PREFIX}-binary
)
+29 -18
Просмотреть файл
@@ -6,32 +6,43 @@
add_library(rocprofiler-systems-common-library INTERFACE)
add_library(rocprofiler-systems::common-library ALIAS rocprofiler-systems-common-library)
add_library(rocprofiler-systems::rocprofiler-systems-common-library ALIAS
rocprofiler-systems-common-library)
add_library(
rocprofiler-systems::rocprofiler-systems-common-library
ALIAS rocprofiler-systems-common-library
)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/defines.h.in
${CMAKE_CURRENT_BINARY_DIR}/defines.h @ONLY)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/defines.h.in
${CMAKE_CURRENT_BINARY_DIR}/defines.h
@ONLY
)
target_sources(
rocprofiler-systems-common-library
INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/defines.h
${CMAKE_CURRENT_SOURCE_DIR}/delimit.hpp
${CMAKE_CURRENT_SOURCE_DIR}/environment.hpp
${CMAKE_CURRENT_SOURCE_DIR}/invoke.hpp
${CMAKE_CURRENT_SOURCE_DIR}/join.hpp
${CMAKE_CURRENT_SOURCE_DIR}/setup.hpp
${CMAKE_CURRENT_SOURCE_DIR}/static_object.hpp
${CMAKE_CURRENT_SOURCE_DIR}/synchronized.hpp)
INTERFACE
${CMAKE_CURRENT_BINARY_DIR}/defines.h
${CMAKE_CURRENT_SOURCE_DIR}/delimit.hpp
${CMAKE_CURRENT_SOURCE_DIR}/environment.hpp
${CMAKE_CURRENT_SOURCE_DIR}/invoke.hpp
${CMAKE_CURRENT_SOURCE_DIR}/join.hpp
${CMAKE_CURRENT_SOURCE_DIR}/setup.hpp
${CMAKE_CURRENT_SOURCE_DIR}/static_object.hpp
${CMAKE_CURRENT_SOURCE_DIR}/synchronized.hpp
)
get_filename_component(COMMON_SOURCE_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" DIRECTORY)
get_filename_component(COMMON_BINARY_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}" DIRECTORY)
target_include_directories(
rocprofiler-systems-common-library
INTERFACE $<BUILD_INTERFACE:${COMMON_SOURCE_INCLUDE_DIR}>
$<BUILD_INTERFACE:${COMMON_BINARY_INCLUDE_DIR}>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/external/timemory/source>
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/external/timemory/source>)
INTERFACE
$<BUILD_INTERFACE:${COMMON_SOURCE_INCLUDE_DIR}>
$<BUILD_INTERFACE:${COMMON_BINARY_INCLUDE_DIR}>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/external/timemory/source>
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/external/timemory/source>
)
target_compile_definitions(rocprofiler-systems-common-library
INTERFACE $<BUILD_INTERFACE:ROCPROFSYS_INTERNAL_BUILD=1>)
target_compile_definitions(
rocprofiler-systems-common-library
INTERFACE $<BUILD_INTERFACE:ROCPROFSYS_INTERNAL_BUILD=1>
)
+32 -16
Просмотреть файл
@@ -1,6 +1,9 @@
#
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/defines.hpp.in
${CMAKE_CURRENT_BINARY_DIR}/defines.hpp @ONLY)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/defines.hpp.in
${CMAKE_CURRENT_BINARY_DIR}/defines.hpp
@ONLY
)
set(core_sources
${CMAKE_CURRENT_LIST_DIR}/argparse.cpp
@@ -18,7 +21,8 @@ set(core_sources
${CMAKE_CURRENT_LIST_DIR}/amd_smi.cpp
${CMAKE_CURRENT_LIST_DIR}/state.cpp
${CMAKE_CURRENT_LIST_DIR}/timemory.cpp
${CMAKE_CURRENT_LIST_DIR}/utility.cpp)
${CMAKE_CURRENT_LIST_DIR}/utility.cpp
)
set(core_headers
${CMAKE_CURRENT_LIST_DIR}/argparse.hpp
@@ -41,28 +45,38 @@ set(core_headers
${CMAKE_CURRENT_LIST_DIR}/amd_smi.hpp
${CMAKE_CURRENT_LIST_DIR}/state.hpp
${CMAKE_CURRENT_LIST_DIR}/timemory.hpp
${CMAKE_CURRENT_LIST_DIR}/utility.hpp)
${CMAKE_CURRENT_LIST_DIR}/utility.hpp
)
add_library(rocprofiler-systems-core-library STATIC)
add_library(rocprofiler-systems::rocprofiler-systems-core ALIAS
rocprofiler-systems-core-library)
add_library(
rocprofiler-systems::rocprofiler-systems-core
ALIAS rocprofiler-systems-core-library
)
target_sources(
rocprofiler-systems-core-library PRIVATE ${core_sources} ${core_headers}
${CMAKE_CURRENT_BINARY_DIR}/defines.hpp)
rocprofiler-systems-core-library
PRIVATE ${core_sources} ${core_headers} ${CMAKE_CURRENT_BINARY_DIR}/defines.hpp
)
add_subdirectory(binary)
add_subdirectory(components)
add_subdirectory(containers)
target_include_directories(rocprofiler-systems-core-library BEFORE
PRIVATE ${CMAKE_CURRENT_LIST_DIR})
target_include_directories(
rocprofiler-systems-core-library
BEFORE
PRIVATE ${CMAKE_CURRENT_LIST_DIR}
)
target_include_directories(
rocprofiler-systems-core-library
PRIVATE ${PROJECT_SOURCE_DIR}/external/timemory/source/timemory/tpls/cereal)
PRIVATE ${PROJECT_SOURCE_DIR}/external/timemory/source/timemory/tpls/cereal
)
target_link_libraries(rocprofiler-systems-core-library
PRIVATE rocprofiler-systems::rocprofiler-systems-interface-library)
target_link_libraries(
rocprofiler-systems-core-library
PRIVATE rocprofiler-systems::rocprofiler-systems-interface-library
)
target_link_libraries(
rocprofiler-systems-core-library
PRIVATE
@@ -79,7 +93,9 @@ target_link_libraries(
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-static-libstdcxx-optional>
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-sanitizer>
$<BUILD_INTERFACE:$<IF:$<BOOL:${ROCPROFSYS_BUILD_LTO}>,rocprofiler-systems::rocprofiler-systems-lto,>>
)
)
set_target_properties(rocprofiler-systems-core-library
PROPERTIES OUTPUT_NAME ${BINARY_NAME_PREFIX}-core)
set_target_properties(
rocprofiler-systems-core-library
PROPERTIES OUTPUT_NAME ${BINARY_NAME_PREFIX}-core
)
+8 -4
Просмотреть файл
@@ -1,8 +1,12 @@
#
set(binary_sources ${CMAKE_CURRENT_LIST_DIR}/address_range.cpp)
set(binary_headers ${CMAKE_CURRENT_LIST_DIR}/address_range.hpp
${CMAKE_CURRENT_LIST_DIR}/fwd.hpp)
set(binary_headers
${CMAKE_CURRENT_LIST_DIR}/address_range.hpp
${CMAKE_CURRENT_LIST_DIR}/fwd.hpp
)
target_sources(rocprofiler-systems-core-library PRIVATE ${binary_sources}
${binary_headers})
target_sources(
rocprofiler-systems-core-library
PRIVATE ${binary_sources} ${binary_headers}
)
+4 -2
Просмотреть файл
@@ -3,5 +3,7 @@ set(component_sources)
set(component_headers ${CMAKE_CURRENT_LIST_DIR}/fwd.hpp)
target_sources(rocprofiler-systems-core-library PRIVATE ${component_sources}
${component_headers})
target_sources(
rocprofiler-systems-core-library
PRIVATE ${component_sources} ${component_headers}
)
+6 -3
Просмотреть файл
@@ -6,7 +6,10 @@ set(containers_headers
${CMAKE_CURRENT_LIST_DIR}/c_array.hpp
${CMAKE_CURRENT_LIST_DIR}/operators.hpp
${CMAKE_CURRENT_LIST_DIR}/stable_vector.hpp
${CMAKE_CURRENT_LIST_DIR}/static_vector.hpp)
${CMAKE_CURRENT_LIST_DIR}/static_vector.hpp
)
target_sources(rocprofiler-systems-core-library PRIVATE ${containers_sources}
${containers_headers})
target_sources(
rocprofiler-systems-core-library
PRIVATE ${containers_sources} ${containers_headers}
)
+33 -20
Просмотреть файл
@@ -13,41 +13,54 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
find_package(Threads REQUIRED)
add_library(rocprofiler-systems-dl-library SHARED)
add_library(rocprofiler-systems::rocprofiler-systems-dl-library ALIAS
rocprofiler-systems-dl-library)
add_library(
rocprofiler-systems::rocprofiler-systems-dl-library
ALIAS rocprofiler-systems-dl-library
)
target_sources(
rocprofiler-systems-dl-library
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/dl.cpp ${CMAKE_CURRENT_SOURCE_DIR}/main.c
${CMAKE_CURRENT_SOURCE_DIR}/dl/dl.hpp)
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/dl.cpp
${CMAKE_CURRENT_SOURCE_DIR}/main.c
${CMAKE_CURRENT_SOURCE_DIR}/dl/dl.hpp
)
target_include_directories(
rocprofiler-systems-dl-library
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../rocprof-sys-user>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/../rocprof-sys>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
PRIVATE ${rocprofiler-sdk_INCLUDE_DIR})
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../rocprof-sys-user>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/../rocprof-sys>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
PRIVATE ${rocprofiler-sdk_INCLUDE_DIR}
)
target_link_libraries(
rocprofiler-systems-dl-library
PUBLIC $<BUILD_INTERFACE:${dl_LIBRARY}>
$<BUILD_INTERFACE:rocprofiler-systems::common-library>
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-compile-definitions>
$<BUILD_INTERFACE:Threads::Threads>)
PUBLIC
$<BUILD_INTERFACE:${dl_LIBRARY}>
$<BUILD_INTERFACE:rocprofiler-systems::common-library>
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-compile-definitions>
$<BUILD_INTERFACE:Threads::Threads>
)
add_target_cxx_flag_if_avail(rocprofiler-systems-dl-library "-ftls-model=global-dynamic")
add_target_cxx_flag_if_avail(rocprofiler-systems-dl-library "-g3")
set_target_properties(
rocprofiler-systems-dl-library
PROPERTIES OUTPUT_NAME ${BINARY_NAME_PREFIX}-dl
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}
BUILD_RPATH "\$ORIGIN"
INSTALL_RPATH "\$ORIGIN")
PROPERTIES
OUTPUT_NAME ${BINARY_NAME_PREFIX}-dl
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}
BUILD_RPATH "\$ORIGIN"
INSTALL_RPATH "\$ORIGIN"
)
rocprofiler_systems_strip_target(rocprofiler-systems-dl-library)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/dl/dl.hpp
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/dl)
install(
FILES ${CMAKE_CURRENT_SOURCE_DIR}/dl/dl.hpp
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/dl
)
install(TARGETS rocprofiler-systems-dl-library DESTINATION ${CMAKE_INSTALL_LIBDIR})
+53 -26
Просмотреть файл
@@ -23,7 +23,8 @@ if(PLATFORM MATCHES freebsd)
src/RTheap-freebsd.c
src/RTthread.c
src/RTspace.S
src/RTsignal.c)
src/RTsignal.c
)
elseif(PLATFORM MATCHES linux)
list(
APPEND
@@ -34,12 +35,24 @@ elseif(PLATFORM MATCHES linux)
src/RTheap-linux.c
src/RTthread.c
src/RTspace.S
src/RTsignal.c)
list(APPEND RT_STATIC_ONLY_SRC_LIST src/RTstatic_ctors_dtors_begin.c
src/RTstatic_ctors_dtors_end.c)
src/RTsignal.c
)
list(
APPEND
RT_STATIC_ONLY_SRC_LIST
src/RTstatic_ctors_dtors_begin.c
src/RTstatic_ctors_dtors_end.c
)
elseif(PLATFORM MATCHES nt OR PLATFORM MATCHES windows)
list(APPEND SRC_LIST src/RTheap.c src/RTheap-win.c src/RTwinnt.c src/RTthread.c
src/RTthread-x86.c)
list(
APPEND
SRC_LIST
src/RTheap.c
src/RTheap-win.c
src/RTwinnt.c
src/RTthread.c
src/RTthread-x86.c
)
endif()
set(SRC_LIST_i386 src/RTthread-x86.c src/RTtlsgetaddr-x86.S)
@@ -50,9 +63,10 @@ set(SRC_LIST_ppc32 src/RTthread-powerpc.c src/RTthread-powerpc-asm.S)
set(RT_STATIC_ONLY_SRC_LIST_ppc32 src/RTstatic_ctors_dtors-ppc32.c)
set(SRC_LIST_ppc64 src/RTthread-powerpc.c src/RTthread-powerpc-asm.S)
set(RT_STATIC_ONLY_SRC_LIST_ppc64 src/RTstatic_ctors_dtors-ppc64.c)
set(SRC_LIST_aarch64 src/RTthread-aarch64.c
# src/RTthread-aarch64-asm.S
)
set(SRC_LIST_aarch64
src/RTthread-aarch64.c
# src/RTthread-aarch64-asm.S
)
set(RT_STATIC_ONLY_SRC_LIST_aarch64 src/RTstatic_ctors_dtors-aarch64.c)
# We use gcc to compile the various assembly files, but cmake doesn't default to knowing
@@ -69,14 +83,18 @@ endif()
if(UNIX)
if(PLATFORM MATCHES amd64 OR PLATFORM MATCHES x86_64)
set(SRC_LIST_mabi ${SRC_LIST} ${SRC_LIST_i386})
set(RT_STATIC_ONLY_SRC_LIST_mabi ${RT_STATIC_ONLY_SRC_LIST}
${RT_STATIC_ONLY_SRC_LIST_i386})
set(RT_STATIC_ONLY_SRC_LIST_mabi
${RT_STATIC_ONLY_SRC_LIST}
${RT_STATIC_ONLY_SRC_LIST_i386}
)
list(APPEND SRC_LIST ${SRC_LIST_x86_64})
list(APPEND RT_STATIC_ONLY_SRC_LIST ${RT_STATIC_ONLY_SRC_LIST_x86_64})
elseif(PLATFORM MATCHES ppc64)
set(SRC_LIST_mabi ${SRC_LIST} ${SRC_LIST_ppc32})
set(RT_STATIC_ONLY_SRC_LIST_mabi ${RT_STATIC_ONLY_SRC_LIST}
${RT_STATIC_ONLY_SRC_LIST_ppc32})
set(RT_STATIC_ONLY_SRC_LIST_mabi
${RT_STATIC_ONLY_SRC_LIST}
${RT_STATIC_ONLY_SRC_LIST_ppc32}
)
list(APPEND SRC_LIST ${SRC_LIST_ppc64})
list(APPEND RT_STATIC_ONLY_SRC_LIST ${RT_STATIC_ONLY_SRC_LIST_ppc64})
elseif(PLATFORM MATCHES i386)
@@ -92,29 +110,36 @@ if(UNIX)
endif()
add_library(rocprofiler-systems-rt-library SHARED)
add_library(rocprofiler-systems::rocprofiler-systems-rt-library ALIAS
rocprofiler-systems-rt-library)
add_library(
rocprofiler-systems::rocprofiler-systems-rt-library
ALIAS rocprofiler-systems-rt-library
)
target_sources(rocprofiler-systems-rt-library PRIVATE ${SRC_LIST})
target_include_directories(
rocprofiler-systems-rt-library
PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/h>)
PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/h>
)
target_compile_definitions(rocprofiler-systems-rt-library PRIVATE ${UNIFIED_DEFINES})
target_link_libraries(
rocprofiler-systems-rt-library
PUBLIC $<BUILD_INTERFACE:${dl_LIBRARY}>
PRIVATE rocprofiler-systems::rocprofiler-systems-threading)
PRIVATE rocprofiler-systems::rocprofiler-systems-threading
)
add_target_cxx_flag_if_avail(rocprofiler-systems-rt-library "-g3")
set_target_properties(
rocprofiler-systems-rt-library
PROPERTIES OUTPUT_NAME ${BINARY_NAME_PREFIX}-rt
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}
BUILD_RPATH "\$ORIGIN"
INSTALL_RPATH "\$ORIGIN")
PROPERTIES
OUTPUT_NAME ${BINARY_NAME_PREFIX}-rt
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}
BUILD_RPATH "\$ORIGIN"
INSTALL_RPATH "\$ORIGIN"
)
rocprofiler_systems_strip_target(rocprofiler-systems-rt-library)
@@ -125,7 +150,8 @@ if(NOT EXISTS ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME})
endif()
add_custom_target(
rocprofiler-systems-rt-library-dyninstAPI_RT-symlink ALL
rocprofiler-systems-rt-library-dyninstAPI_RT-symlink
ALL
${CMAKE_COMMAND} -E create_symlink
../$<TARGET_FILE_NAME:rocprofiler-systems-rt-library>
${CMAKE_SHARED_LIBRARY_PREFIX}dyninstAPI_RT${CMAKE_SHARED_LIBRARY_SUFFIX}
@@ -133,9 +159,10 @@ add_custom_target(
DEPENDS rocprofiler-systems-rt-library
COMMENT
"Creating ${CMAKE_SHARED_LIBRARY_PREFIX}dyninstAPI_RT${CMAKE_SHARED_LIBRARY_SUFFIX} to rocprof-sys-rt..."
)
)
install(
FILES
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}/${CMAKE_SHARED_LIBRARY_PREFIX}dyninstAPI_RT${CMAKE_SHARED_LIBRARY_SUFFIX}
DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME})
DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}
)
+58 -17
Просмотреть файл
@@ -4,8 +4,14 @@
set(PLATFORM $ENV{PLATFORM})
set(VALID_PLATFORMS
amd64-unknown-freebsd7.2 i386-unknown-freebsd7.2 i386-unknown-linux2.4 ppc32_linux
ppc64_linux x86_64-unknown-linux2.4 aarch64-unknown-linux)
amd64-unknown-freebsd7.2
i386-unknown-freebsd7.2
i386-unknown-linux2.4
ppc32_linux
ppc64_linux
x86_64-unknown-linux2.4
aarch64-unknown-linux
)
if(NOT PLATFORM)
set(INVALID_PLATFORM true)
@@ -19,7 +25,8 @@ endif()
execute_process(
COMMAND ${CMAKE_CURRENT_LIST_DIR}/sysname
OUTPUT_VARIABLE SYSNAME_OUT
OUTPUT_STRIP_TRAILING_WHITESPACE)
OUTPUT_STRIP_TRAILING_WHITESPACE
)
string(REPLACE "\n" "" SYSPLATFORM ${SYSNAME_OUT})
if(INVALID_PLATFORM)
@@ -27,10 +34,12 @@ if(INVALID_PLATFORM)
execute_process(
COMMAND ${CMAKE_CURRENT_LIST_DIR}/dynsysname ${SYSNAME_OUT}
OUTPUT_VARIABLE DYNSYSNAME_OUT
OUTPUT_STRIP_TRAILING_WHITESPACE)
OUTPUT_STRIP_TRAILING_WHITESPACE
)
string(REPLACE "\n" "" PLATFORM ${DYNSYSNAME_OUT})
rocprofiler_systems_message(
STATUS "-- Attempting to automatically identify platform: ${PLATFORM}")
STATUS "-- Attempting to automatically identify platform: ${PLATFORM}"
)
endif()
list(FIND VALID_PLATFORMS ${PLATFORM} PLATFORM_FOUND)
@@ -39,13 +48,21 @@ if(PLATFORM_FOUND EQUAL -1)
rocprofiler_systems_message(
FATAL_ERROR
"Error: unknown platform ${PLATFORM}; please set the PLATFORM environment variable to one of the following options: ${VALID_PLATFORMS}"
)
)
endif()
if(PLATFORM MATCHES i386)
set(ARCH_DEFINES arch_x86)
list(APPEND CAP_DEFINES cap_fixpoint_gen cap_noaddr_gen cap_stripped_binaries
cap_tramp_liveness cap_virtual_registers cap_stack_mods)
list(
APPEND
CAP_DEFINES
cap_fixpoint_gen
cap_noaddr_gen
cap_stripped_binaries
cap_tramp_liveness
cap_virtual_registers
cap_stack_mods
)
elseif(PLATFORM MATCHES x86_64 OR PLATFORM MATCHES amd64)
set(ARCH_DEFINES arch_x86_64 arch_64bit)
list(
@@ -57,7 +74,8 @@ elseif(PLATFORM MATCHES x86_64 OR PLATFORM MATCHES amd64)
cap_registers
cap_stripped_binaries
cap_tramp_liveness
cap_stack_mods)
cap_stack_mods
)
elseif(PLATFORM MATCHES ppc32)
set(ARCH_DEFINES arch_power)
list(APPEND CAP_DEFINES cap_registers)
@@ -78,20 +96,38 @@ endif()
if(PLATFORM MATCHES linux)
set(OS_DEFINES os_linux)
list(APPEND CAP_DEFINES cap_async_events cap_binary_rewriter cap_dwarf
cap_mutatee_traps cap_ptrace)
list(
APPEND
CAP_DEFINES
cap_async_events
cap_binary_rewriter
cap_dwarf
cap_mutatee_traps
cap_ptrace
)
set(BUG_DEFINES bug_syscall_changepc_rewind bug_force_terminate_failure)
elseif(PLATFORM MATCHES cnl)
set(OS_DEFINES os_linux os_cnl)
list(APPEND CAP_DEFINES cap_async_events cap_binary_rewriter cap_dwarf
cap_mutatee_traps cap_ptrace)
list(
APPEND
CAP_DEFINES
cap_async_events
cap_binary_rewriter
cap_dwarf
cap_mutatee_traps
cap_ptrace
)
set(BUG_DEFINES bug_syscall_changepc_rewind)
elseif(PLATFORM MATCHES freebsd)
set(OS_DEFINES os_freebsd)
list(APPEND CAP_DEFINES cap_binary_rewriter cap_dwarf cap_mutatee_traps)
set(BUG_DEFINES
bug_freebsd_missing_sigstop bug_freebsd_mt_suspend bug_freebsd_change_pc
bug_phdrs_first_page bug_syscall_changepc_rewind)
bug_freebsd_missing_sigstop
bug_freebsd_mt_suspend
bug_freebsd_change_pc
bug_phdrs_first_page
bug_syscall_changepc_rewind
)
elseif(PLATFORM STREQUAL i386-unknown-nt4.0)
set(OS_DEFINES os_windows)
list(APPEND CAP_DEFINES cap_mem_emulation cap_mutatee_traps)
@@ -126,7 +162,12 @@ if(Thread_DB_FOUND)
list(APPEND CAP_DEFINES cap_thread_db)
endif()
set(UNIFIED_DEFINES ${CAP_DEFINES} ${BUG_DEFINES} ${ARCH_DEFINES} ${OS_DEFINES}
${OLD_DEFINES})
set(UNIFIED_DEFINES
${CAP_DEFINES}
${BUG_DEFINES}
${ARCH_DEFINES}
${OS_DEFINES}
${OLD_DEFINES}
)
list(REMOVE_DUPLICATES UNIFIED_DEFINES)
+36 -17
Просмотреть файл
@@ -11,43 +11,61 @@ set(CMAKE_CXX_VISIBILITY_PRESET "hidden")
set(CMAKE_VISIBILITY_INLINES_HIDDEN ON)
add_library(rocprofiler-systems-user-library SHARED)
add_library(rocprofiler-systems::rocprofiler-systems-user-library ALIAS
rocprofiler-systems-user-library)
add_library(
rocprofiler-systems::rocprofiler-systems-user-library
ALIAS rocprofiler-systems-user-library
)
set(_user_headers
${CMAKE_CURRENT_SOURCE_DIR}/rocprofiler-systems/user.h
${CMAKE_CURRENT_SOURCE_DIR}/rocprofiler-systems/types.h
${CMAKE_CURRENT_SOURCE_DIR}/rocprofiler-systems/causal.h
${CMAKE_CURRENT_SOURCE_DIR}/rocprofiler-systems/categories.h)
${CMAKE_CURRENT_SOURCE_DIR}/rocprofiler-systems/categories.h
)
set(_user_sources ${CMAKE_CURRENT_SOURCE_DIR}/user.cpp)
target_sources(rocprofiler-systems-user-library PRIVATE ${_user_sources} ${_user_headers})
target_include_directories(
rocprofiler-systems-user-library
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
target_link_libraries(
rocprofiler-systems-user-library
PRIVATE
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-compile-definitions>)
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-compile-definitions>
)
set_target_properties(
rocprofiler-systems-user-library
PROPERTIES OUTPUT_NAME ${BINARY_NAME_PREFIX}-user
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}
POSITION_INDEPENDENT_CODE ON
BUILD_RPATH "\$ORIGIN"
INSTALL_RPATH "\$ORIGIN")
PROPERTIES
OUTPUT_NAME ${BINARY_NAME_PREFIX}-user
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}
POSITION_INDEPENDENT_CODE ON
BUILD_RPATH "\$ORIGIN"
INSTALL_RPATH "\$ORIGIN"
)
rocprofiler_systems_strip_target(rocprofiler-systems-user-library)
foreach(_HEADER ${_user_headers})
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/rocprofiler-systems/"
"${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}/" _DEST ${_HEADER})
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/"
"${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/" _DEST "${_DEST}")
string(
REPLACE
"${CMAKE_CURRENT_SOURCE_DIR}/rocprofiler-systems/"
"${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}/"
_DEST
${_HEADER}
)
string(
REPLACE
"${CMAKE_CURRENT_SOURCE_DIR}/"
"${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/"
_DEST
"${_DEST}"
)
configure_file(${_HEADER} ${_DEST} COPYONLY)
endforeach()
@@ -57,4 +75,5 @@ install(FILES ${_user_headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT
install(
TARGETS rocprofiler-systems-user-library
EXPORT rocprofiler-systems-library-targets
DESTINATION ${CMAKE_INSTALL_LIBDIR})
DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
+60 -30
Просмотреть файл
@@ -5,19 +5,28 @@
# ------------------------------------------------------------------------------#
add_library(rocprofiler-systems-object-library OBJECT)
add_library(rocprofiler-systems::rocprofiler-systems-object-library ALIAS
rocprofiler-systems-object-library)
add_library(
rocprofiler-systems::rocprofiler-systems-object-library
ALIAS rocprofiler-systems-object-library
)
target_sources(
rocprofiler-systems-object-library
PRIVATE ${CMAKE_CURRENT_LIST_DIR}/library.cpp ${CMAKE_CURRENT_LIST_DIR}/regions.cpp
${CMAKE_CURRENT_LIST_DIR}/progress.cpp ${CMAKE_CURRENT_LIST_DIR}/api.cpp
${CMAKE_CURRENT_LIST_DIR}/timeout.cpp ${CMAKE_CURRENT_LIST_DIR}/api.hpp)
PRIVATE
${CMAKE_CURRENT_LIST_DIR}/library.cpp
${CMAKE_CURRENT_LIST_DIR}/regions.cpp
${CMAKE_CURRENT_LIST_DIR}/progress.cpp
${CMAKE_CURRENT_LIST_DIR}/api.cpp
${CMAKE_CURRENT_LIST_DIR}/timeout.cpp
${CMAKE_CURRENT_LIST_DIR}/api.hpp
)
add_subdirectory(library)
target_link_libraries(rocprofiler-systems-object-library
PRIVATE rocprofiler-systems::rocprofiler-systems-interface-library)
target_link_libraries(
rocprofiler-systems-object-library
PRIVATE rocprofiler-systems::rocprofiler-systems-interface-library
)
# ------------------------------------------------------------------------------#
#
@@ -25,19 +34,28 @@ target_link_libraries(rocprofiler-systems-object-library
#
# ------------------------------------------------------------------------------#
add_library(rocprofiler-systems-static-library STATIC
$<TARGET_OBJECTS:rocprofiler-systems-object-library>)
add_library(rocprofiler-systems::librocprofiler-systems-static ALIAS
rocprofiler-systems-static-library)
add_library(
rocprofiler-systems-static-library
STATIC
$<TARGET_OBJECTS:rocprofiler-systems-object-library>
)
add_library(
rocprofiler-systems::librocprofiler-systems-static
ALIAS rocprofiler-systems-static-library
)
target_link_libraries(
rocprofiler-systems-static-library
PRIVATE rocprofiler-systems::rocprofiler-systems-interface-library
rocprofiler-systems::rocprofiler-systems-core
rocprofiler-systems::rocprofiler-systems-binary)
PRIVATE
rocprofiler-systems::rocprofiler-systems-interface-library
rocprofiler-systems::rocprofiler-systems-core
rocprofiler-systems::rocprofiler-systems-binary
)
set_target_properties(rocprofiler-systems-static-library PROPERTIES OUTPUT_NAME
${BINARY_NAME_PREFIX})
set_target_properties(
rocprofiler-systems-static-library
PROPERTIES OUTPUT_NAME ${BINARY_NAME_PREFIX}
)
# ------------------------------------------------------------------------------#
#
@@ -45,29 +63,41 @@ set_target_properties(rocprofiler-systems-static-library PROPERTIES OUTPUT_NAME
#
# ------------------------------------------------------------------------------#
add_library(rocprofiler-systems-shared-library SHARED
$<TARGET_OBJECTS:rocprofiler-systems-object-library>)
add_library(rocprofiler-systems::librocprofiler-systems-shared ALIAS
rocprofiler-systems-shared-library)
add_library(rocprofiler-systems::rocprofiler-systems-library ALIAS
rocprofiler-systems-shared-library)
add_library(
rocprofiler-systems-shared-library
SHARED
$<TARGET_OBJECTS:rocprofiler-systems-object-library>
)
add_library(
rocprofiler-systems::librocprofiler-systems-shared
ALIAS rocprofiler-systems-shared-library
)
add_library(
rocprofiler-systems::rocprofiler-systems-library
ALIAS rocprofiler-systems-shared-library
)
target_link_libraries(
rocprofiler-systems-shared-library
PRIVATE rocprofiler-systems::rocprofiler-systems-interface-library
rocprofiler-systems::rocprofiler-systems-core
rocprofiler-systems::rocprofiler-systems-binary)
PRIVATE
rocprofiler-systems::rocprofiler-systems-interface-library
rocprofiler-systems::rocprofiler-systems-core
rocprofiler-systems::rocprofiler-systems-binary
)
set_target_properties(
rocprofiler-systems-shared-library
PROPERTIES OUTPUT_NAME ${BINARY_NAME_PREFIX}
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}
INSTALL_RPATH "${ROCPROFSYS_LIB_INSTALL_RPATH}")
PROPERTIES
OUTPUT_NAME ${BINARY_NAME_PREFIX}
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}
INSTALL_RPATH "${ROCPROFSYS_LIB_INSTALL_RPATH}"
)
rocprofiler_systems_strip_target(rocprofiler-systems-shared-library)
install(
TARGETS rocprofiler-systems-shared-library
DESTINATION ${CMAKE_INSTALL_LIBDIR}
OPTIONAL)
OPTIONAL
)
+19 -10
Просмотреть файл
@@ -11,7 +11,8 @@ set(library_sources
${CMAKE_CURRENT_LIST_DIR}/sampling.cpp
${CMAKE_CURRENT_LIST_DIR}/thread_deleter.cpp
${CMAKE_CURRENT_LIST_DIR}/thread_info.cpp
${CMAKE_CURRENT_LIST_DIR}/tracing.cpp)
${CMAKE_CURRENT_LIST_DIR}/tracing.cpp
)
set(library_headers
${CMAKE_CURRENT_LIST_DIR}/coverage.hpp
@@ -28,17 +29,22 @@ set(library_headers
${CMAKE_CURRENT_LIST_DIR}/thread_data.hpp
${CMAKE_CURRENT_LIST_DIR}/thread_deleter.hpp
${CMAKE_CURRENT_LIST_DIR}/thread_info.hpp
${CMAKE_CURRENT_LIST_DIR}/tracing.hpp)
${CMAKE_CURRENT_LIST_DIR}/tracing.hpp
)
target_sources(rocprofiler-systems-object-library PRIVATE ${library_sources}
${library_headers})
target_sources(
rocprofiler-systems-object-library
PRIVATE ${library_sources} ${library_headers}
)
if(ROCPROFSYS_USE_ROCM)
target_sources(
rocprofiler-systems-object-library
PRIVATE ${CMAKE_CURRENT_LIST_DIR}/rocm.cpp
${CMAKE_CURRENT_LIST_DIR}/rocprofiler-sdk.cpp
${CMAKE_CURRENT_LIST_DIR}/amd_smi.cpp)
PRIVATE
${CMAKE_CURRENT_LIST_DIR}/rocm.cpp
${CMAKE_CURRENT_LIST_DIR}/rocprofiler-sdk.cpp
${CMAKE_CURRENT_LIST_DIR}/amd_smi.cpp
)
add_subdirectory(rocprofiler-sdk)
endif()
@@ -52,8 +58,11 @@ set(ndebug_sources
${CMAKE_CURRENT_LIST_DIR}/components/backtrace_metrics.cpp
${CMAKE_CURRENT_LIST_DIR}/kokkosp.cpp
${CMAKE_CURRENT_LIST_DIR}/amd_smi.cpp
${CMAKE_CURRENT_LIST_DIR}/ompt.cpp)
${CMAKE_CURRENT_LIST_DIR}/ompt.cpp
)
set_source_files_properties(
${ndebug_sources} DIRECTORY ${PROJECT_SOURCE_DIR}/source/lib/rocprof-sys
PROPERTIES COMPILE_DEFINITIONS NDEBUG COMPILE_OPTIONS "-g0;-O3")
${ndebug_sources}
DIRECTORY ${PROJECT_SOURCE_DIR}/source/lib/rocprof-sys
PROPERTIES COMPILE_DEFINITIONS NDEBUG COMPILE_OPTIONS "-g0;-O3"
)
+18 -8
Просмотреть файл
@@ -1,15 +1,25 @@
#
set(causal_sources
${CMAKE_CURRENT_LIST_DIR}/data.cpp ${CMAKE_CURRENT_LIST_DIR}/delay.cpp
${CMAKE_CURRENT_LIST_DIR}/experiment.cpp ${CMAKE_CURRENT_LIST_DIR}/sample_data.cpp
${CMAKE_CURRENT_LIST_DIR}/sampling.cpp ${CMAKE_CURRENT_LIST_DIR}/selected_entry.cpp)
${CMAKE_CURRENT_LIST_DIR}/data.cpp
${CMAKE_CURRENT_LIST_DIR}/delay.cpp
${CMAKE_CURRENT_LIST_DIR}/experiment.cpp
${CMAKE_CURRENT_LIST_DIR}/sample_data.cpp
${CMAKE_CURRENT_LIST_DIR}/sampling.cpp
${CMAKE_CURRENT_LIST_DIR}/selected_entry.cpp
)
set(causal_headers
${CMAKE_CURRENT_LIST_DIR}/data.hpp ${CMAKE_CURRENT_LIST_DIR}/delay.hpp
${CMAKE_CURRENT_LIST_DIR}/experiment.hpp ${CMAKE_CURRENT_LIST_DIR}/sample_data.hpp
${CMAKE_CURRENT_LIST_DIR}/sampling.hpp ${CMAKE_CURRENT_LIST_DIR}/selected_entry.hpp)
${CMAKE_CURRENT_LIST_DIR}/data.hpp
${CMAKE_CURRENT_LIST_DIR}/delay.hpp
${CMAKE_CURRENT_LIST_DIR}/experiment.hpp
${CMAKE_CURRENT_LIST_DIR}/sample_data.hpp
${CMAKE_CURRENT_LIST_DIR}/sampling.hpp
${CMAKE_CURRENT_LIST_DIR}/selected_entry.hpp
)
target_sources(rocprofiler-systems-object-library PRIVATE ${causal_sources}
${causal_headers})
target_sources(
rocprofiler-systems-object-library
PRIVATE ${causal_sources} ${causal_headers}
)
add_subdirectory(components)
+8 -4
Просмотреть файл
@@ -4,14 +4,18 @@ set(component_sources
${CMAKE_CURRENT_LIST_DIR}/blocking_gotcha.cpp
${CMAKE_CURRENT_LIST_DIR}/causal_gotcha.cpp
${CMAKE_CURRENT_LIST_DIR}/progress_point.cpp
${CMAKE_CURRENT_LIST_DIR}/unblocking_gotcha.cpp)
${CMAKE_CURRENT_LIST_DIR}/unblocking_gotcha.cpp
)
set(component_headers
${CMAKE_CURRENT_LIST_DIR}/backtrace.hpp
${CMAKE_CURRENT_LIST_DIR}/blocking_gotcha.hpp
${CMAKE_CURRENT_LIST_DIR}/causal_gotcha.hpp
${CMAKE_CURRENT_LIST_DIR}/progress_point.hpp
${CMAKE_CURRENT_LIST_DIR}/unblocking_gotcha.hpp)
${CMAKE_CURRENT_LIST_DIR}/unblocking_gotcha.hpp
)
target_sources(rocprofiler-systems-object-library PRIVATE ${component_sources}
${component_headers})
target_sources(
rocprofiler-systems-object-library
PRIVATE ${component_sources} ${component_headers}
)
+8 -4
Просмотреть файл
@@ -13,7 +13,8 @@ set(component_sources
${CMAKE_CURRENT_LIST_DIR}/vaapi_gotcha.cpp
${CMAKE_CURRENT_LIST_DIR}/pthread_gotcha.cpp
${CMAKE_CURRENT_LIST_DIR}/pthread_create_gotcha.cpp
${CMAKE_CURRENT_LIST_DIR}/pthread_mutex_gotcha.cpp)
${CMAKE_CURRENT_LIST_DIR}/pthread_mutex_gotcha.cpp
)
set(component_headers
${CMAKE_CURRENT_LIST_DIR}/backtrace.hpp
@@ -32,7 +33,10 @@ set(component_headers
${CMAKE_CURRENT_LIST_DIR}/vaapi_gotcha.hpp
${CMAKE_CURRENT_LIST_DIR}/pthread_gotcha.hpp
${CMAKE_CURRENT_LIST_DIR}/pthread_create_gotcha.hpp
${CMAKE_CURRENT_LIST_DIR}/pthread_mutex_gotcha.hpp)
${CMAKE_CURRENT_LIST_DIR}/pthread_mutex_gotcha.hpp
)
target_sources(rocprofiler-systems-object-library PRIVATE ${component_sources}
${component_headers})
target_sources(
rocprofiler-systems-object-library
PRIVATE ${component_sources} ${component_headers}
)
+4 -2
Просмотреть файл
@@ -2,5 +2,7 @@
set(coverage_sources)
set(coverage_headers ${CMAKE_CURRENT_LIST_DIR}/impl.hpp)
target_sources(rocprofiler-systems-object-library PRIVATE ${coverage_sources}
${coverage_headers})
target_sources(
rocprofiler-systems-object-library
PRIVATE ${coverage_sources} ${coverage_headers}
)
+12 -6
Просмотреть файл
@@ -1,11 +1,17 @@
#
set(rocprofiler_sdk_sources
${CMAKE_CURRENT_LIST_DIR}/counters.cpp ${CMAKE_CURRENT_LIST_DIR}/fwd.cpp
${CMAKE_CURRENT_LIST_DIR}/rccl.cpp)
${CMAKE_CURRENT_LIST_DIR}/counters.cpp
${CMAKE_CURRENT_LIST_DIR}/fwd.cpp
${CMAKE_CURRENT_LIST_DIR}/rccl.cpp
)
set(rocprofiler_sdk_headers
${CMAKE_CURRENT_LIST_DIR}/counters.hpp ${CMAKE_CURRENT_LIST_DIR}/fwd.hpp
${CMAKE_CURRENT_LIST_DIR}/rccl.hpp)
${CMAKE_CURRENT_LIST_DIR}/counters.hpp
${CMAKE_CURRENT_LIST_DIR}/fwd.hpp
${CMAKE_CURRENT_LIST_DIR}/rccl.hpp
)
target_sources(rocprofiler-systems-object-library PRIVATE ${rocprofiler_sdk_sources}
${rocprofiler_sdk_headers})
target_sources(
rocprofiler-systems-object-library
PRIVATE ${rocprofiler_sdk_sources} ${rocprofiler_sdk_headers}
)
+4 -2
Просмотреть файл
@@ -2,5 +2,7 @@
set(tracing_sources ${CMAKE_CURRENT_LIST_DIR}/annotation.cpp)
set(tracing_headers ${CMAKE_CURRENT_LIST_DIR}/annotation.hpp)
target_sources(rocprofiler-systems-object-library PRIVATE ${tracing_sources}
${tracing_headers})
target_sources(
rocprofiler-systems-object-library
PRIVATE ${tracing_sources} ${tracing_headers}
)
+73 -50
Просмотреть файл
@@ -18,24 +18,25 @@ set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME python)
# ########################################################################################
function(ROCPROFILER_SYSTEMS_CONFIGURE_PYTARGET _TARGET _VERSION)
add_library(rocprofiler-systems::${_TARGET} ALIAS ${_TARGET})
target_link_libraries(${_TARGET} PRIVATE libpyrocprofiler-systems-interface)
add_dependencies(libpyrocprofsys ${_TARGET})
set_target_properties(
${_TARGET}
PROPERTIES PREFIX ""
OUTPUT_NAME libpyrocprofsys
LIBRARY_OUTPUT_DIRECTORY
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/rocprofsys
ARCHIVE_OUTPUT_DIRECTORY
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/rocprofsys
RUNTIME_OUTPUT_DIRECTORY
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/rocprofsys
PDB_OUTPUT_DIRECTORY
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/rocprofsys
${EXTRA_PROPERTIES})
PROPERTIES
PREFIX ""
OUTPUT_NAME libpyrocprofsys
LIBRARY_OUTPUT_DIRECTORY
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/rocprofsys
ARCHIVE_OUTPUT_DIRECTORY
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/rocprofsys
RUNTIME_OUTPUT_DIRECTORY
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/rocprofsys
PDB_OUTPUT_DIRECTORY
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/rocprofsys
${EXTRA_PROPERTIES}
)
set(_PYLIB ${CMAKE_INSTALL_PYTHONDIR}/rocprofsys)
if(NOT IS_ABSOLUTE "${_PYLIB}")
@@ -45,28 +46,34 @@ function(ROCPROFILER_SYSTEMS_CONFIGURE_PYTARGET _TARGET _VERSION)
if(SKBUILD)
set(LIB_RELPATH ../../..)
else()
file(RELATIVE_PATH LIB_RELPATH "${_PYLIB}"
"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
file(
RELATIVE_PATH
LIB_RELPATH
"${_PYLIB}"
"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}"
)
endif()
set_target_properties(${_TARGET} PROPERTIES INSTALL_RPATH
"\$ORIGIN:\$ORIGIN/${LIB_RELPATH}")
set_target_properties(
${_TARGET}
PROPERTIES INSTALL_RPATH "\$ORIGIN:\$ORIGIN/${LIB_RELPATH}"
)
install(
TARGETS ${_TARGET}
DESTINATION ${CMAKE_INSTALL_PYTHONDIR}/rocprofsys
OPTIONAL)
install(TARGETS ${_TARGET} DESTINATION ${CMAKE_INSTALL_PYTHONDIR}/rocprofsys OPTIONAL)
endfunction()
# ########################################################################################
add_library(rocprofiler-systems-python-compile-options INTERFACE)
add_library(rocprofiler-systems::rocprofiler-systems-python-compile-options ALIAS
rocprofiler-systems-python-compile-options)
add_library(
rocprofiler-systems::rocprofiler-systems-python-compile-options
ALIAS rocprofiler-systems-python-compile-options
)
add_target_cxx_flag_if_avail(
rocprofiler-systems-python-compile-options "-Wno-unused-value"
"-Wno-range-loop-analysis" "-Wno-deprecated-declarations"
"-Wno-unused-but-set-parameter" "-ftls-model=global-dynamic")
"-Wno-unused-but-set-parameter" "-ftls-model=global-dynamic"
)
file(GLOB pyheaders ${CMAKE_CURRENT_LIST_DIR}/libpyrocprofsys*.hpp)
set(pysources ${CMAKE_CURRENT_LIST_DIR}/libpyrocprofsys.cpp)
@@ -76,32 +83,36 @@ set(pybind_libs pybind11::module)
add_library(libpyrocprofiler-systems-interface INTERFACE)
target_link_libraries(
libpyrocprofiler-systems-interface
INTERFACE pybind11::module
timemory::timemory-headers
rocprofiler-systems::rocprofiler-systems-headers
rocprofiler-systems::rocprofiler-systems-compile-options
rocprofiler-systems::rocprofiler-systems-static-libgcc-optional
rocprofiler-systems::rocprofiler-systems-lto
rocprofiler-systems::rocprofiler-systems-dl-library
rocprofiler-systems::rocprofiler-systems-user-library
rocprofiler-systems::rocprofiler-systems-python
rocprofiler-systems::rocprofiler-systems-python-compile-options)
INTERFACE
pybind11::module
timemory::timemory-headers
rocprofiler-systems::rocprofiler-systems-headers
rocprofiler-systems::rocprofiler-systems-compile-options
rocprofiler-systems::rocprofiler-systems-static-libgcc-optional
rocprofiler-systems::rocprofiler-systems-lto
rocprofiler-systems::rocprofiler-systems-dl-library
rocprofiler-systems::rocprofiler-systems-user-library
rocprofiler-systems::rocprofiler-systems-python
rocprofiler-systems::rocprofiler-systems-python-compile-options
)
rocprofiler_systems_target_compile_definitions(libpyrocprofiler-systems-interface
INTERFACE ROCPROFSYS_PYBIND11_SOURCE)
INTERFACE ROCPROFSYS_PYBIND11_SOURCE
)
add_custom_target(libpyrocprofsys)
file(GLOB_RECURSE PYTHON_FILES ${CMAKE_CURRENT_SOURCE_DIR}/rocprofsys/*.py)
foreach(_IN ${PYTHON_FILES})
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/rocprofsys"
"${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/rocprofsys" _OUT
"${_IN}")
string(
REPLACE
"${CMAKE_CURRENT_SOURCE_DIR}/rocprofsys"
"${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/rocprofsys"
_OUT
"${_IN}"
)
configure_file(${_IN} ${_OUT} @ONLY)
install(
FILES ${_OUT}
DESTINATION ${CMAKE_INSTALL_PYTHONDIR}/rocprofsys
OPTIONAL)
install(FILES ${_OUT} DESTINATION ${CMAKE_INSTALL_PYTHONDIR}/rocprofsys OPTIONAL)
endforeach()
rocprofiler_systems_python_console_script("${BINARY_NAME_PREFIX}-python" "rocprofsys")
@@ -113,22 +124,34 @@ foreach(_VERSION ${ROCPROFSYS_PYTHON_VERSIONS})
rocprofiler_systems_pybind11_add_module(
libpyrocprofiler-systems-${_VERSION} MODULE
PYTHON_VERSION ${_VERSION}
VISIBILITY "hidden" ${pysources} ${pyheaders})
VISIBILITY "hidden" ${pysources} ${pyheaders}
)
rocprofiler_systems_configure_pytarget(libpyrocprofiler-systems-${_VERSION}
${_VERSION})
${_VERSION}
)
if(ROCPROFSYS_USE_PYTHON)
rocprofiler_systems_python_console_script(
"${BINARY_NAME_PREFIX}-python" "rocprofsys"
VERSION ${_VERSION}
ROOT_DIR "${Python3_ROOT_DIR}")
ROOT_DIR "${Python3_ROOT_DIR}"
)
endif()
math(EXPR _INDEX "${_INDEX} + 1")
endforeach()
configure_file(${CMAKE_CURRENT_LIST_DIR}/setup.py.in
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/setup.py @ONLY)
configure_file(${CMAKE_CURRENT_LIST_DIR}/setup.cfg.in
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/setup.cfg @ONLY)
configure_file(${CMAKE_CURRENT_LIST_DIR}/pyproject.toml
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/pyproject.toml COPYONLY)
configure_file(
${CMAKE_CURRENT_LIST_DIR}/setup.py.in
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/setup.py
@ONLY
)
configure_file(
${CMAKE_CURRENT_LIST_DIR}/setup.cfg.in
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/setup.cfg
@ONLY
)
configure_file(
${CMAKE_CURRENT_LIST_DIR}/pyproject.toml
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/pyproject.toml
COPYONLY
)
+41 -17
Просмотреть файл
@@ -8,29 +8,37 @@ include_guard(DIRECTORY)
set(Python3_FIND_STRATEGY
"LOCATION"
CACHE STRING
"Stops lookup as soon as a version satisfying version constraints is found")
"Stops lookup as soon as a version satisfying version constraints is found"
)
# virtual environment is used before any other standard paths to look-up for the
# interpreter
set(Python3_FIND_VIRTUALENV
"FIRST"
CACHE STRING "Virtual environment is used before any other standard paths")
CACHE STRING
"Virtual environment is used before any other standard paths"
)
set_property(CACHE Python3_FIND_VIRTUALENV PROPERTY STRINGS "FIRST;LAST;NEVER")
if(APPLE)
set(Python3_FIND_FRAMEWORK
"LAST"
CACHE STRING
"Order of preference between Apple-style and unix-style package components")
"Order of preference between Apple-style and unix-style package components"
)
set_property(CACHE Python3_FIND_FRAMEWORK PROPERTY STRINGS "FIRST;LAST;NEVER")
endif()
# PyPy does not support embedding the interpreter
set(Python3_FIND_IMPLEMENTATIONS
"CPython"
CACHE STRING "Different implementations which will be searched.")
set_property(CACHE Python3_FIND_IMPLEMENTATIONS PROPERTY STRINGS
"CPython;IronPython;PyPy")
CACHE STRING
"Different implementations which will be searched."
)
set_property(
CACHE Python3_FIND_IMPLEMENTATIONS
PROPERTY STRINGS "CPython;IronPython;PyPy"
)
# variable is a 3-tuple specifying, in order, pydebug (d), pymalloc (m) and unicode (u)
# set(Python3_FIND_ABI "OFF" "OFF" "OFF" CACHE STRING "variable is a 3-tuple specifying
@@ -41,20 +49,30 @@ set_property(CACHE Python3_FIND_IMPLEMENTATIONS PROPERTY STRINGS
# requirements.
set(Python3_ARTIFACTS_INTERACTIVE
OFF
CACHE BOOL "Create CMake cache entries so that users can edit them interactively"
FORCE)
CACHE BOOL
"Create CMake cache entries so that users can edit them interactively"
FORCE
)
# if("${Python3_USE_STATIC_LIBS}" STREQUAL "ANY") set(Python3_USE_STATIC_LIBS "OFF" CACHE
# STRING "If ON, only static libs; if OFF, only shared libs; if ANY, shared then static")
# set_property(CACHE Python3_USE_STATIC_LIBS PROPERTY STRINGS "ON;OFF;ANY") else()
# unset(Python3_USE_STATIC_LIBS) endif()
foreach(_VAR FIND_STRATEGY FIND_VIRTUALENV FIND_FRAMEWORK FIND_IMPLEMENTATIONS
ARTIFACTS_INTERACTIVE)
foreach(
_VAR
FIND_STRATEGY
FIND_VIRTUALENV
FIND_FRAMEWORK
FIND_IMPLEMENTATIONS
ARTIFACTS_INTERACTIVE
)
if(DEFINED Python3_${_VAR})
set(Python_${_VAR}
"${Python3_${_VAR}}"
CACHE STRING "Set via Python3_${_VAR} setting (rocprofsys)")
CACHE STRING
"Set via Python3_${_VAR} setting (rocprofsys)"
)
mark_as_advanced(Python_${_VAR})
mark_as_advanced(Python3_${_VAR})
endif()
@@ -62,7 +80,8 @@ endforeach()
# display version
rocprofiler_systems_add_feature(ROCPROFSYS_PYTHON_VERSIONS
"Python version for rocprofsys" DOC)
"Python version for rocprofsys" DOC
)
option(PYBIND11_INSTALL "Enable Pybind11 installation" OFF)
@@ -73,7 +92,8 @@ if(ROCPROFSYS_BUILD_PYTHON AND NOT TARGET pybind11)
RELATIVE_PATH external/pybind11
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
REPO_URL https://github.com/jrmadsen/pybind11.git
REPO_BRANCH omnitrace)
REPO_BRANCH omnitrace
)
if(NOT DEFINED CMAKE_INTERPROCEDURAL_OPTIMIZATION)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION OFF)
@@ -82,13 +102,17 @@ if(ROCPROFSYS_BUILD_PYTHON AND NOT TARGET pybind11)
rocprofiler_systems_save_variables(IPO VARIABLES CMAKE_INTERPROCEDURAL_OPTIMIZATION)
add_subdirectory(${PROJECT_SOURCE_DIR}/external/pybind11)
rocprofiler_systems_restore_variables(IPO
VARIABLES CMAKE_INTERPROCEDURAL_OPTIMIZATION)
VARIABLES CMAKE_INTERPROCEDURAL_OPTIMIZATION
)
endif()
execute_process(
COMMAND ${PYTHON_EXECUTABLE} -c
"import time ; print('{} {}'.format(time.ctime(), time.tzname[0]))"
COMMAND
${PYTHON_EXECUTABLE} -c
"import time ; print('{} {}'.format(time.ctime(), time.tzname[0]))"
OUTPUT_VARIABLE ROCPROFSYS_INSTALL_DATE
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
string(REPLACE " " " " ROCPROFSYS_INSTALL_DATE "${ROCPROFSYS_INSTALL_DATE}")
+22 -8
Просмотреть файл
@@ -70,8 +70,15 @@ if(NOT PyBind11Python_COMPONENTS)
endif()
# Use the Python interpreter to find the libs.
find_package(${PyBind11Python_PYTHON} ${PyBind11Python_FIND_VERSION} ${_find_exact} MODULE
${_find_required} ${_find_quiet} COMPONENTS ${PyBind11Python_COMPONENTS})
find_package(
${PyBind11Python_PYTHON}
${PyBind11Python_FIND_VERSION}
${_find_exact}
MODULE
${_find_required}
${_find_quiet}
COMPONENTS ${PyBind11Python_COMPONENTS}
)
# According to
# https://stackoverflow.com/questions/646518/python-how-to-detect-debug-interpreter
@@ -110,7 +117,8 @@ print(s.get_config_var('MULTIARCH') or '');
"
RESULT_VARIABLE _PYTHON_SUCCESS
OUTPUT_VARIABLE _PYTHON_VALUES
ERROR_VARIABLE _PYTHON_ERROR_VALUE)
ERROR_VARIABLE _PYTHON_ERROR_VALUE
)
if(NOT _PYTHON_SUCCESS MATCHES 0)
if(PyBind11Python_FIND_REQUIRED)
@@ -139,13 +147,18 @@ list(GET _PYTHON_VALUES 9 PYTHON_MULTIARCH)
# Make sure the Python has the same pointer-size as the chosen compiler Skip if
# CMAKE_SIZEOF_VOID_P is not defined
if(CMAKE_SIZEOF_VOID_P AND (NOT "${PYTHON_SIZEOF_VOID_P}" STREQUAL
"${CMAKE_SIZEOF_VOID_P}"))
if(
CMAKE_SIZEOF_VOID_P
AND (NOT "${PYTHON_SIZEOF_VOID_P}" STREQUAL "${CMAKE_SIZEOF_VOID_P}")
)
if(PyBind11Python_FIND_REQUIRED)
math(EXPR _PYTHON_BITS "${PYTHON_SIZEOF_VOID_P} * 8")
math(EXPR _CMAKE_BITS "${CMAKE_SIZEOF_VOID_P} * 8")
message(FATAL_ERROR "Python config failure: Python is ${_PYTHON_BITS}-bit, "
"chosen compiler is ${_CMAKE_BITS}-bit")
message(
FATAL_ERROR
"Python config failure: Python is ${_PYTHON_BITS}-bit, "
"chosen compiler is ${_CMAKE_BITS}-bit"
)
endif()
set(PyBind11Python_FOUND FALSE)
return()
@@ -157,7 +170,8 @@ list(GET _PYTHON_VERSION_LIST 0 PYTHON_VERSION_MAJOR)
list(GET _PYTHON_VERSION_LIST 1 PYTHON_VERSION_MINOR)
list(GET _PYTHON_VERSION_LIST 2 PYTHON_VERSION_PATCH)
set(PYTHON_VERSION
"${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.${PYTHON_VERSION_PATCH}")
"${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.${PYTHON_VERSION_PATCH}"
)
# Make sure all directory separators are '/'
string(REGEX REPLACE "\\\\" "/" PYTHON_PREFIX "${PYTHON_PREFIX}")
+79 -59
Просмотреть файл
@@ -26,34 +26,32 @@ function(ROCPROFILER_SYSTEMS_FIND_PYTHON _VAR)
set(Python3_FIND_VIRTUALENV "FIRST")
set(Python3_ARTIFACTS_INTERACTIVE OFF)
find_package(Python3 ${ARG_VERSION} ${_EXACT} ${_QUIET} MODULE ${_FIND_REQUIREMENT}
COMPONENTS ${ARG_COMPONENTS})
find_package(
Python3
${ARG_VERSION}
${_EXACT}
${_QUIET}
MODULE
${_FIND_REQUIREMENT}
COMPONENTS ${ARG_COMPONENTS}
)
set(${_VAR}_FOUND
"${Python3_FOUND}"
PARENT_SCOPE)
set(${_VAR}_FOUND "${Python3_FOUND}" PARENT_SCOPE)
if(NOT Python3_FOUND)
set(${_VAR}_EXECUTABLE
""
PARENT_SCOPE)
set(${_VAR}_ROOT_DIR
""
PARENT_SCOPE)
set(${_VAR}_VERSION
""
PARENT_SCOPE)
set(${_VAR}_EXECUTABLE "" PARENT_SCOPE)
set(${_VAR}_ROOT_DIR "" PARENT_SCOPE)
set(${_VAR}_VERSION "" PARENT_SCOPE)
return()
else()
set(${_VAR}_EXECUTABLE
"${Python3_EXECUTABLE}"
PARENT_SCOPE)
set(${_VAR}_EXECUTABLE "${Python3_EXECUTABLE}" PARENT_SCOPE)
execute_process(
COMMAND
"${Python3_EXECUTABLE}" "-c"
"import sys; print('.'.join(str(v) for v in [sys.version_info[0], sys.version_info[1]])); print(sys.prefix);"
RESULT_VARIABLE _PYTHON_SUCCESS
OUTPUT_VARIABLE _PYTHON_VALUES
ERROR_VARIABLE _PYTHON_ERROR_VALUE)
ERROR_VARIABLE _PYTHON_ERROR_VALUE
)
if(_PYTHON_SUCCESS MATCHES 0)
# Convert the process output into a list
@@ -61,12 +59,8 @@ function(ROCPROFILER_SYSTEMS_FIND_PYTHON _VAR)
string(REGEX REPLACE "\n" ";" _PYTHON_VALUES ${_PYTHON_VALUES})
list(GET _PYTHON_VALUES 0 _PYTHON_VERSION_LIST)
list(GET _PYTHON_VALUES 1 _PYTHON_PREFIX)
set(${_VAR}_ROOT_DIR
"${_PYTHON_PREFIX}"
PARENT_SCOPE)
set(${_VAR}_VERSION
"${_PYTHON_VERSION_LIST}"
PARENT_SCOPE)
set(${_VAR}_ROOT_DIR "${_PYTHON_PREFIX}" PARENT_SCOPE)
set(${_VAR}_VERSION "${_PYTHON_VERSION_LIST}" PARENT_SCOPE)
else()
rocprofiler_systems_message(WARNING "${_PYTHON_ERROR_VALUE}")
endif()
@@ -80,28 +74,26 @@ function(_ROCPROFSYS_PYBIND11_ADD_LTO_FLAGS target_name prefer_thin_lto)
# name for each set of flags: the compilation result will be cached base on the result
# variable. If the flags work, sets them in cxxflags_out/linkerflags_out internal
# cache variables (in addition to ${result}).
function(_PYBIND11_RETURN_IF_CXX_AND_LINKER_FLAGS_WORK result cxxflags linkerflags
cxxflags_out linkerflags_out)
function(
_PYBIND11_RETURN_IF_CXX_AND_LINKER_FLAGS_WORK
result
cxxflags
linkerflags
cxxflags_out
linkerflags_out
)
include(CheckCXXCompilerFlag)
set(CMAKE_REQUIRED_LIBRARIES ${linkerflags})
check_cxx_compiler_flag("${cxxflags}" ${result})
if(${result})
set(${cxxflags_out}
"${cxxflags}"
CACHE INTERNAL "" FORCE)
set(${linkerflags_out}
"${linkerflags}"
CACHE INTERNAL "" FORCE)
set(${cxxflags_out} "${cxxflags}" CACHE INTERNAL "" FORCE)
set(${linkerflags_out} "${linkerflags}" CACHE INTERNAL "" FORCE)
endif()
endfunction()
if(NOT DEFINED PYBIND11_LTO_CXX_FLAGS)
set(PYBIND11_LTO_CXX_FLAGS
""
CACHE INTERNAL "")
set(PYBIND11_LTO_LINKER_FLAGS
""
CACHE INTERNAL "")
set(PYBIND11_LTO_CXX_FLAGS "" CACHE INTERNAL "")
set(PYBIND11_LTO_LINKER_FLAGS "" CACHE INTERNAL "")
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
set(cxx_append "")
@@ -117,19 +109,22 @@ function(_ROCPROFSYS_PYBIND11_ADD_LTO_FLAGS target_name prefer_thin_lto)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND prefer_thin_lto)
_pybind11_return_if_cxx_and_linker_flags_work(
HAS_FLTO_THIN "-flto=thin${cxx_append}" "-flto=thin${linker_append}"
PYBIND11_LTO_CXX_FLAGS PYBIND11_LTO_LINKER_FLAGS)
PYBIND11_LTO_CXX_FLAGS PYBIND11_LTO_LINKER_FLAGS
)
endif()
if(NOT HAS_FLTO_THIN)
_pybind11_return_if_cxx_and_linker_flags_work(
HAS_FLTO "-flto${cxx_append}" "-flto${linker_append}"
PYBIND11_LTO_CXX_FLAGS PYBIND11_LTO_LINKER_FLAGS)
PYBIND11_LTO_CXX_FLAGS PYBIND11_LTO_LINKER_FLAGS
)
endif()
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
# Intel equivalent to LTO is called IPO
_pybind11_return_if_cxx_and_linker_flags_work(
HAS_INTEL_IPO "-ipo" "-ipo" PYBIND11_LTO_CXX_FLAGS
PYBIND11_LTO_LINKER_FLAGS)
PYBIND11_LTO_LINKER_FLAGS
)
elseif(MSVC)
# cmake only interprets libraries as linker flags when they start with a -
# (otherwise it converts /LTCG to \LTCG as if it was a Windows path). Luckily
@@ -137,7 +132,8 @@ function(_ROCPROFSYS_PYBIND11_ADD_LTO_FLAGS target_name prefer_thin_lto)
# non-standard:
_pybind11_return_if_cxx_and_linker_flags_work(
HAS_MSVC_GL_LTCG "/GL" "-LTCG" PYBIND11_LTO_CXX_FLAGS
PYBIND11_LTO_LINKER_FLAGS)
PYBIND11_LTO_LINKER_FLAGS
)
endif()
if(PYBIND11_LTO_CXX_FLAGS)
@@ -146,24 +142,35 @@ function(_ROCPROFSYS_PYBIND11_ADD_LTO_FLAGS target_name prefer_thin_lto)
rocprofiler_systems_message(
STATUS
"${target_name} :: LTO disabled (not supported by the compiler and/or linker)"
)
)
endif()
endif()
# Enable LTO flags if found, except for Debug builds
if(PYBIND11_LTO_CXX_FLAGS)
target_compile_options(
${target_name} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:${PYBIND11_LTO_CXX_FLAGS}>")
${target_name}
PRIVATE "$<$<NOT:$<CONFIG:Debug>>:${PYBIND11_LTO_CXX_FLAGS}>"
)
endif()
if(PYBIND11_LTO_LINKER_FLAGS)
target_link_libraries(
${target_name}
PRIVATE "$<$<NOT:$<CONFIG:Debug>>:${PYBIND11_LTO_LINKER_FLAGS}>")
PRIVATE "$<$<NOT:$<CONFIG:Debug>>:${PYBIND11_LTO_LINKER_FLAGS}>"
)
endif()
endfunction()
#
function(ROCPROFILER_SYSTEMS_PYBIND11_ADD_MODULE target_name)
set(options MODULE SHARED EXCLUDE_FROM_ALL NO_EXTRAS SYSTEM THIN_LTO LTO)
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})
@@ -202,10 +209,14 @@ function(ROCPROFILER_SYSTEMS_PYBIND11_ADD_MODULE target_name)
find_package(PyBind11Python ${ARG_PYTHON_VERSION})
target_include_directories(
${target_name} ${inc_isystem}
PRIVATE ${PYBIND11_INCLUDE_DIR} # from project CMakeLists.txt
PRIVATE ${pybind11_INCLUDE_DIR} # from pybind11Config
PRIVATE ${Python3_INCLUDE_DIRS})
${target_name}
${inc_isystem}
PRIVATE
${PYBIND11_INCLUDE_DIR} # from project CMakeLists.txt
PRIVATE
${pybind11_INCLUDE_DIR} # from pybind11Config
PRIVATE ${Python3_INCLUDE_DIRS}
)
# Python debug libraries expose slightly different objects
# https://docs.python.org/3.6/c-api/intro.html#debugging-builds
@@ -223,10 +234,14 @@ function(ROCPROFILER_SYSTEMS_PYBIND11_ADD_MODULE target_name)
# force it on everything inside the `pybind11` namespace; also turning it on for a
# pybind module compilation here avoids potential warnings or issues from having mixed
# hidden/non-hidden types.
set_target_properties(${target_name} PROPERTIES CXX_VISIBILITY_PRESET
"${ARG_VISIBILITY}")
set_target_properties(${target_name} PROPERTIES CUDA_VISIBILITY_PRESET
"${ARG_VISIBILITY}")
set_target_properties(
${target_name}
PROPERTIES CXX_VISIBILITY_PRESET "${ARG_VISIBILITY}"
)
set_target_properties(
${target_name}
PROPERTIES CUDA_VISIBILITY_PRESET "${ARG_VISIBILITY}"
)
if(WIN32 OR CYGWIN)
# Link against the Python shared library on Windows
@@ -253,8 +268,10 @@ function(ROCPROFILER_SYSTEMS_PYBIND11_ADD_MODULE target_name)
endif()
# Make sure C++11/14 are enabled
set_target_properties(${target_name} PROPERTIES CXX_STANDARD ${ARG_CXX_STANDARD}
CXX_STANDARD_REQUIRED ON)
set_target_properties(
${target_name}
PROPERTIES CXX_STANDARD ${ARG_CXX_STANDARD} CXX_STANDARD_REQUIRED ON
)
if(ARG_NO_EXTRAS)
return()
@@ -271,12 +288,14 @@ function(ROCPROFILER_SYSTEMS_PYBIND11_ADD_MODULE target_name)
add_custom_command(
TARGET ${target_name}
POST_BUILD
COMMAND ${CMAKE_STRIP} -x $<TARGET_FILE:${target_name}>)
COMMAND ${CMAKE_STRIP} -x $<TARGET_FILE:${target_name}>
)
else()
add_custom_command(
TARGET ${target_name}
POST_BUILD
COMMAND ${CMAKE_STRIP} $<TARGET_FILE:${target_name}>)
COMMAND ${CMAKE_STRIP} $<TARGET_FILE:${target_name}>
)
endif()
endif()
endif()
@@ -295,7 +314,8 @@ function(ROCPROFILER_SYSTEMS_PYBIND11_ADD_MODULE target_name)
# build to fail.
target_compile_options(
${target_name}
PRIVATE $<$<NOT:$<CONFIG:Debug>>:$<$<COMPILE_LANGUAGE:CXX>:/MP>>)
PRIVATE $<$<NOT:$<CONFIG:Debug>>:$<$<COMPILE_LANGUAGE:CXX>:/MP>>
)
endif()
endif()
endfunction()
+25 -12
Просмотреть файл
@@ -26,15 +26,20 @@
#
# -------------------------------------------------------------------------------------- #
if(ROCPROFSYS_USE_PAPI
AND (rocprofiler_systems_perf_event_paranoid LESS_EQUAL 3
if(
ROCPROFSYS_USE_PAPI
AND (
rocprofiler_systems_perf_event_paranoid LESS_EQUAL 3
OR rocprofiler_systems_cap_sys_admin EQUAL 0
OR rocprofiler_systems_cap_perfmon EQUAL 0))
OR rocprofiler_systems_cap_perfmon EQUAL 0
)
)
set(_annotate_environment
"${_base_environment}"
"ROCPROFSYS_TIMEMORY_COMPONENTS=thread_cpu_clock papi_array"
"ROCPROFSYS_PAPI_EVENTS=perf::PERF_COUNT_SW_CPU_CLOCK"
"ROCPROFSYS_USE_SAMPLING=OFF")
"ROCPROFSYS_USE_SAMPLING=OFF"
)
rocprofiler_systems_add_test(
SKIP_BASELINE SKIP_RUNTIME
@@ -58,23 +63,28 @@ if(ROCPROFSYS_USE_PAPI
functions
--print-instructions
ENVIRONMENT "${_annotate_environment}"
LABELS "annotate;papi")
LABELS "annotate;papi"
)
rocprofiler_systems_add_validation_test(
NAME annotate-binary-rewrite
PERFETTO_FILE "perfetto-trace.proto"
LABELS "annotate;papi"
ARGS --key-names perf::PERF_COUNT_SW_CPU_CLOCK thread_cpu_clock --key-counts 8 8)
ARGS --key-names perf::PERF_COUNT_SW_CPU_CLOCK thread_cpu_clock --key-counts 8 8
)
rocprofiler_systems_add_validation_test(
NAME annotate-sampling
PERFETTO_FILE "perfetto-trace.proto"
LABELS "papi"
ARGS --key-names thread_cpu_clock --key-counts 6)
ARGS --key-names thread_cpu_clock --key-counts 6
)
else()
set(_annotate_environment
"${_base_environment}" "ROCPROFSYS_TIMEMORY_COMPONENTS=thread_cpu_clock"
"ROCPROFSYS_USE_SAMPLING=OFF")
"${_base_environment}"
"ROCPROFSYS_TIMEMORY_COMPONENTS=thread_cpu_clock"
"ROCPROFSYS_USE_SAMPLING=OFF"
)
rocprofiler_systems_add_test(
SKIP_BASELINE SKIP_RUNTIME
@@ -98,17 +108,20 @@ else()
functions
--print-instructions
ENVIRONMENT "${_annotate_environment}"
LABELS "annotate")
LABELS "annotate"
)
rocprofiler_systems_add_validation_test(
NAME annotate-binary-rewrite
PERFETTO_FILE "perfetto-trace.proto"
LABELS "annotate"
ARGS --key-names thread_cpu_clock --key-counts 8)
ARGS --key-names thread_cpu_clock --key-counts 8
)
rocprofiler_systems_add_validation_test(
NAME annotate-sampling
PERFETTO_FILE "perfetto-trace.proto"
LABELS "annotate"
ARGS --key-names thread_cpu_clock --key-counts 6)
ARGS --key-names thread_cpu_clock --key-counts 6
)
endif()
+15 -14
Просмотреть файл
@@ -38,7 +38,7 @@ else()
rocprofiler_systems_message(
AUTHOR_WARNING
"Disabling attach tests. Run 'echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope' to enable attaching to process"
)
)
endif()
if(NOT _VALID_PTRACE_SCOPE)
@@ -55,21 +55,22 @@ add_test(
${CMAKE_CURRENT_LIST_DIR}/run-rocprof-sys-pid.sh
$<TARGET_FILE:rocprofiler-systems-instrument> -ME "\.c$" -E fib -e -v 1 --label
return args file -l -- $<TARGET_FILE:parallel-overhead> 30 8 1000
WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
)
set(_parallel_overhead_attach_environ
"${_attach_environment}" "ROCPROFSYS_OUTPUT_PATH=rocprof-sys-tests-output"
"ROCPROFSYS_OUTPUT_PREFIX=parallel-overhead-attach/")
"${_attach_environment}"
"ROCPROFSYS_OUTPUT_PATH=rocprof-sys-tests-output"
"ROCPROFSYS_OUTPUT_PREFIX=parallel-overhead-attach/"
)
set_tests_properties(
parallel-overhead-attach
PROPERTIES ENVIRONMENT
"${_parallel_overhead_attach_environ}"
TIMEOUT
300
LABELS
"parallel-overhead;attach"
PASS_REGULAR_EXPRESSION
"Outputting.*(perfetto-trace.proto).*Outputting.*(wall_clock.txt)"
FAIL_REGULAR_EXPRESSION
"Dyninst was unable to attach to the specified process")
PROPERTIES
ENVIRONMENT "${_parallel_overhead_attach_environ}"
TIMEOUT 300
LABELS "parallel-overhead;attach"
PASS_REGULAR_EXPRESSION
"Outputting.*(perfetto-trace.proto).*Outputting.*(wall_clock.txt)"
FAIL_REGULAR_EXPRESSION "Dyninst was unable to attach to the specified process"
)
+21 -15
Просмотреть файл
@@ -33,7 +33,7 @@ rocprofiler_systems_add_causal_test(
CAUSAL_MODE "function"
CAUSAL_PASS_REGEX
"Starting causal experiment #1(.*)causal/experiments.json(.*)causal/experiments.coz"
)
)
rocprofiler_systems_add_causal_test(
SKIP_BASELINE
@@ -43,7 +43,7 @@ rocprofiler_systems_add_causal_test(
CAUSAL_MODE "function"
CAUSAL_PASS_REGEX
"Starting causal experiment #1(.*)causal/experiments.json(.*)causal/experiments.coz"
)
)
rocprofiler_systems_add_causal_test(
SKIP_BASELINE
@@ -53,7 +53,7 @@ rocprofiler_systems_add_causal_test(
CAUSAL_MODE "line"
CAUSAL_PASS_REGEX
"Starting causal experiment #1(.*)causal/experiments.json(.*)causal/experiments.coz"
)
)
rocprofiler_systems_add_causal_test(
NAME both-rocprofsys-func
@@ -79,7 +79,7 @@ rocprofiler_systems_add_causal_test(
ENVIRONMENT "ROCPROFSYS_STRICT_CONFIG=OFF"
CAUSAL_PASS_REGEX
"Starting causal experiment #1(.*)causal/experiments.json(.*)causal/experiments.coz"
)
)
rocprofiler_systems_add_causal_test(
NAME lulesh-func
@@ -89,7 +89,7 @@ rocprofiler_systems_add_causal_test(
CAUSAL_ARGS -s 0,10,25,50,75
CAUSAL_PASS_REGEX
"Starting causal experiment #1(.*)causal/experiments.json(.*)causal/experiments.coz"
)
)
rocprofiler_systems_add_causal_test(
SKIP_BASELINE
@@ -100,7 +100,7 @@ rocprofiler_systems_add_causal_test(
CAUSAL_ARGS -s 0,10,25,50,75
CAUSAL_PASS_REGEX
"Starting causal experiment #1(.*)causal/experiments.json(.*)causal/experiments.coz"
)
)
rocprofiler_systems_add_causal_test(
SKIP_BASELINE
@@ -111,13 +111,14 @@ rocprofiler_systems_add_causal_test(
CAUSAL_ARGS -s 0,10,25,50,75 -S lulesh.cc
CAUSAL_PASS_REGEX
"Starting causal experiment #1(.*)causal/experiments.json(.*)causal/experiments.coz"
)
)
# set(_causal_e2e_exe_args 80 100 432525 100000000) set(_causal_e2e_exe_args 80 12 432525
# 500000000)
set(_causal_e2e_exe_args 80 50 432525 100000000)
set(_causal_common_args
"-n 5 -e -s 0 10 20 30 -B $<TARGET_FILE_BASE_NAME:causal-cpu-rocprofsys>")
"-n 5 -e -s 0 10 20 30 -B $<TARGET_FILE_BASE_NAME:causal-cpu-rocprofsys>"
)
macro(
causal_e2e_args_and_validation
@@ -129,14 +130,14 @@ macro(
_V20
_V30
_TOL # tolerance for virtual speedup
)
)
# arguments to rocprofiler-systems-causal
set(${_NAME}_args "${_causal_common_args} ${_MODE} ${_EXPER}")
# arguments to validate-causal-json.py
set(${_NAME}_valid
"-n 0 -i rocprof-sys-tests-output/causal-cpu-rocprofsys-${_TEST}-e2e/causal/experiments.json -v ${_EXPER} $<TARGET_FILE_BASE_NAME:causal-cpu-rocprofsys> 10 ${_V10} ${_TOL} ${_EXPER} $<TARGET_FILE_BASE_NAME:causal-cpu-rocprofsys> 20 ${_V20} ${_TOL} ${_EXPER} $<TARGET_FILE_BASE_NAME:causal-cpu-rocprofsys> 30 ${_V30} ${_TOL}"
)
)
# patch string for command-line
string(REPLACE " " ";" ${_NAME}_args "${${_NAME}_args}")
@@ -144,7 +145,8 @@ macro(
endmacro()
causal_e2e_args_and_validation(_causal_slow_func slow-func "-F" "cpu_slow_func" 10 20 20
5)
5
)
causal_e2e_args_and_validation(_causal_fast_func fast-func "-F" "cpu_fast_func" 0 0 0 5)
causal_e2e_args_and_validation(_causal_line_100 line-100 "-S" "causal.cpp:100" 10 20 20 5)
causal_e2e_args_and_validation(_causal_line_110 line-110 "-S" "causal.cpp:110" 0 0 0 5)
@@ -167,7 +169,8 @@ rocprofiler_systems_add_causal_test(
CAUSAL_PASS_REGEX
"Starting causal experiment #1(.*)causal/experiments.json(.*)causal/experiments.coz"
ENVIRONMENT "${_causal_e2e_environment}"
PROPERTIES PROCESSORS 2 PROCESSOR_AFFINITY OFF)
PROPERTIES PROCESSORS 2 PROCESSOR_AFFINITY OFF
)
rocprofiler_systems_add_causal_test(
SKIP_BASELINE
@@ -181,7 +184,8 @@ rocprofiler_systems_add_causal_test(
CAUSAL_PASS_REGEX
"Starting causal experiment #1(.*)causal/experiments.json(.*)causal/experiments.coz"
ENVIRONMENT "${_causal_e2e_environment}"
PROPERTIES PROCESSORS 2 PROCESSOR_AFFINITY OFF)
PROPERTIES PROCESSORS 2 PROCESSOR_AFFINITY OFF
)
rocprofiler_systems_add_causal_test(
SKIP_BASELINE
@@ -195,7 +199,8 @@ rocprofiler_systems_add_causal_test(
CAUSAL_PASS_REGEX
"Starting causal experiment #1(.*)causal/experiments.json(.*)causal/experiments.coz"
ENVIRONMENT "${_causal_e2e_environment}"
PROPERTIES PROCESSORS 2 PROCESSOR_AFFINITY OFF)
PROPERTIES PROCESSORS 2 PROCESSOR_AFFINITY OFF
)
rocprofiler_systems_add_causal_test(
SKIP_BASELINE
@@ -209,4 +214,5 @@ rocprofiler_systems_add_causal_test(
CAUSAL_PASS_REGEX
"Starting causal experiment #1(.*)causal/experiments.json(.*)causal/experiments.coz"
ENVIRONMENT "${_causal_e2e_environment}"
PROPERTIES PROCESSORS 2 PROCESSOR_AFFINITY OFF)
PROPERTIES PROCESSORS 2 PROCESSOR_AFFINITY OFF
)
+8 -4
Просмотреть файл
@@ -63,7 +63,8 @@ rocprofiler_systems_add_test(
RUN_ARGS 10 ${NUM_THREADS} 1000
ENVIRONMENT "${_base_environment}"
RUNTIME_PASS_REGEX "(\\\[[0-9]+\\\]) code coverage :: 66.67%"
REWRITE_RUN_PASS_REGEX "(\\\[[0-9]+\\\]) code coverage :: 66.67%")
REWRITE_RUN_PASS_REGEX "(\\\[[0-9]+\\\]) code coverage :: 66.67%"
)
rocprofiler_systems_add_test(
SKIP_BASELINE SKIP_SAMPLING
@@ -90,7 +91,8 @@ rocprofiler_systems_add_test(
RUN_ARGS 10 ${NUM_THREADS} 1000
ENVIRONMENT "${_base_environment}"
RUNTIME_PASS_REGEX "(\\\[[0-9]+\\\]) code coverage :: 66.67%"
REWRITE_RUN_PASS_REGEX "(\\\[[0-9]+\\\]) code coverage :: 66.67%")
REWRITE_RUN_PASS_REGEX "(\\\[[0-9]+\\\]) code coverage :: 66.67%"
)
rocprofiler_systems_add_test(
SKIP_BASELINE SKIP_SAMPLING
@@ -129,7 +131,8 @@ rocprofiler_systems_add_test(
RUN_ARGS 10 ${NUM_THREADS} 1000
ENVIRONMENT "${_base_environment}"
RUNTIME_PASS_REGEX "(\\\[[0-9]+\\\]) function coverage :: 66.67%"
REWRITE_RUN_PASS_REGEX "(\\\[[0-9]+\\\]) function coverage :: 66.67%")
REWRITE_RUN_PASS_REGEX "(\\\[[0-9]+\\\]) function coverage :: 66.67%"
)
rocprofiler_systems_add_test(
SKIP_BASELINE SKIP_SAMPLING
@@ -156,4 +159,5 @@ rocprofiler_systems_add_test(
RUN_ARGS 10 ${NUM_THREADS} 1000
ENVIRONMENT "${_base_environment}"
RUNTIME_PASS_REGEX "(\\\[[0-9]+\\\]) function coverage :: 66.67%"
REWRITE_RUN_PASS_REGEX "(\\\[[0-9]+\\\]) function coverage :: 66.67%")
REWRITE_RUN_PASS_REGEX "(\\\[[0-9]+\\\]) function coverage :: 66.67%"
)
+18 -18
Просмотреть файл
@@ -27,11 +27,13 @@
# -------------------------------------------------------------------------------------- #
file(
WRITE ${CMAKE_CURRENT_BINARY_DIR}/invalid.cfg
WRITE
${CMAKE_CURRENT_BINARY_DIR}/invalid.cfg
"
ROCPROFSYS_CONFIG_FILE =
FOOBAR = ON
")
"
)
if(TARGET parallel-overhead)
set(_CONFIG_TEST_EXE $<TARGET_FILE:parallel-overhead>)
@@ -42,33 +44,31 @@ endif()
add_test(
NAME rocprofiler-systems-invalid-config
COMMAND $<TARGET_FILE:rocprofiler-systems-instrument> -- ${_CONFIG_TEST_EXE}
WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
)
set_tests_properties(
rocprofiler-systems-invalid-config
PROPERTIES
ENVIRONMENT
"ROCPROFSYS_CONFIG_FILE=${CMAKE_CURRENT_BINARY_DIR}/invalid.cfg;ROCPROFSYS_CI=ON;ROCPROFSYS_CI_TIMEOUT=120"
TIMEOUT
120
LABELS
"config"
WILL_FAIL
ON)
"ROCPROFSYS_CONFIG_FILE=${CMAKE_CURRENT_BINARY_DIR}/invalid.cfg;ROCPROFSYS_CI=ON;ROCPROFSYS_CI_TIMEOUT=120"
TIMEOUT 120
LABELS "config"
WILL_FAIL ON
)
add_test(
NAME rocprofiler-systems-missing-config
COMMAND $<TARGET_FILE:rocprofiler-systems-instrument> -- ${_CONFIG_TEST_EXE}
WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
)
set_tests_properties(
rocprofiler-systems-missing-config
PROPERTIES
ENVIRONMENT
"ROCPROFSYS_CONFIG_FILE=${CMAKE_CURRENT_BINARY_DIR}/missing.cfg;ROCPROFSYS_CI=ON;ROCPROFSYS_CI_TIMEOUT=120"
TIMEOUT
120
LABELS
"config"
WILL_FAIL
ON)
"ROCPROFSYS_CONFIG_FILE=${CMAKE_CURRENT_BINARY_DIR}/missing.cfg;ROCPROFSYS_CI=ON;ROCPROFSYS_CI_TIMEOUT=120"
TIMEOUT 120
LABELS "config"
WILL_FAIL ON
)
+12 -6
Просмотреть файл
@@ -30,12 +30,14 @@ set(_video_decode_environment
"${_base_environment}"
"ROCPROFSYS_ROCM_DOMAINS=hip_runtime_api,kernel_dispatch,memory_copy,rocdecode_api"
"ROCPROFSYS_AMD_SMI_METRICS=busy,temp,power,vcn_activity,mem_usage"
"ROCPROFSYS_SAMPLING_CPUS=none")
"ROCPROFSYS_SAMPLING_CPUS=none"
)
set(_jpeg_decode_environment
"${_base_environment}"
"ROCPROFSYS_ROCM_DOMAINS=hip_runtime_api,kernel_dispatch,memory_copy,rocjpeg_api"
"ROCPROFSYS_AMD_SMI_METRICS=busy,temp,power,jpeg_activity,mem_usage"
"ROCPROFSYS_SAMPLING_CPUS=none")
"ROCPROFSYS_SAMPLING_CPUS=none"
)
rocprofiler_systems_get_gfx_archs(MI300_DETECTED GFX_MATCH "gfx9[4-9][A-Fa-f0-9]" ECHO)
@@ -54,14 +56,16 @@ rocprofiler_systems_add_test(
GPU ON
ENVIRONMENT "${_video_decode_environment}"
RUN_ARGS -i ${PROJECT_BINARY_DIR}/videos -t 1
LABELS "decode")
LABELS "decode"
)
rocprofiler_systems_add_validation_test(
NAME video-decode-sampling
PERFETTO_METRIC "rocm_rocdecode_api"
PERFETTO_FILE "perfetto-trace.proto"
LABELS "decode"
ARGS -l rocDecCreateVideoParser -c 2 -d 1 ${VCN_COUNTER_NAMES_ARG} -p)
ARGS -l rocDecCreateVideoParser -c 2 -d 1 ${VCN_COUNTER_NAMES_ARG} -p
)
# -------------------------------------------------------------------------------------- #
#
@@ -76,11 +80,13 @@ rocprofiler_systems_add_test(
GPU ON
ENVIRONMENT "${_jpeg_decode_environment}"
RUN_ARGS -i ${PROJECT_BINARY_DIR}/images -b 32
LABELS "decode")
LABELS "decode"
)
rocprofiler_systems_add_validation_test(
NAME jpeg-decode-sampling
PERFETTO_METRIC "rocm_rocjpeg_api"
PERFETTO_FILE "perfetto-trace.proto"
LABELS "decode"
ARGS -l rocJpegCreate -c 1 -d 1 ${JPEG_COUNTER_NAMES_ARG} -p)
ARGS -l rocJpegCreate -c 1 -d 1 ${JPEG_COUNTER_NAMES_ARG} -p
)
+2 -1
Просмотреть файл
@@ -38,4 +38,5 @@ rocprofiler_systems_add_test(
REWRITE_RUN_PASS_REGEX "fork.. called on PID"
SAMPLING_FAIL_REGEX "(${ROCPROFSYS_ABORT_FAIL_REGEX})"
RUNTIME_FAIL_REGEX "(${ROCPROFSYS_ABORT_FAIL_REGEX})"
REWRITE_RUN_FAIL_REGEX "(${ROCPROFSYS_ABORT_FAIL_REGEX})")
REWRITE_RUN_FAIL_REGEX "(${ROCPROFSYS_ABORT_FAIL_REGEX})"
)
+5 -3
Просмотреть файл
@@ -45,7 +45,8 @@ rocprofiler_systems_add_test(
ENVIRONMENT "${_base_environment};ROCPROFSYS_COUT_OUTPUT=ON"
BASELINE_PASS_REGEX "number of calls made = 17"
REWRITE_PASS_REGEX "\\[function\\]\\[Forcing\\] caller-include-regex :: 'outer'"
REWRITE_RUN_PASS_REGEX ">>> ._outer ([ \\|]+) 17")
REWRITE_RUN_PASS_REGEX ">>> ._outer ([ \\|]+) 17"
)
rocprofiler_systems_add_test(
NAME parallel-overhead
@@ -62,7 +63,8 @@ rocprofiler_systems_add_test(
return
args
RUN_ARGS 10 ${NUM_THREADS} 1000
ENVIRONMENT "${_base_environment}")
ENVIRONMENT "${_base_environment}"
)
rocprofiler_systems_add_test(
SKIP_BASELINE SKIP_RUNTIME
@@ -73,4 +75,4 @@ rocprofiler_systems_add_test(
RUN_ARGS 10 4 1000
ENVIRONMENT
"${_lock_environment};ROCPROFSYS_FLAT_PROFILE=ON;ROCPROFSYS_PROFILE=OFF;ROCPROFSYS_TRACE=ON;ROCPROFSYS_SAMPLING_KEEP_INTERNAL=OFF"
)
)
+12 -6
Просмотреть файл
@@ -50,7 +50,8 @@ rocprofiler_systems_add_test(
ENVIRONMENT
"${_base_environment};ROCPROFSYS_USE_KOKKOSP=ON;ROCPROFSYS_COUT_OUTPUT=ON;ROCPROFSYS_SAMPLING_FREQ=50;ROCPROFSYS_KOKKOSP_PREFIX=[kokkos];KOKKOS_TOOLS_LIBS=librocprof-sys-dl.so"
REWRITE_RUN_PASS_REGEX "\\|_\\[kokkos\\] [a-zA-Z]"
RUNTIME_PASS_REGEX "\\|_\\[kokkos\\] [a-zA-Z]")
RUNTIME_PASS_REGEX "\\|_\\[kokkos\\] [a-zA-Z]"
)
rocprofiler_systems_add_test(
SKIP_RUNTIME SKIP_REWRITE
@@ -63,7 +64,8 @@ rocprofiler_systems_add_test(
RUN_ARGS -i 10 -s 20 -p
ENVIRONMENT
"${_base_environment};ROCPROFSYS_USE_KOKKOSP=ON;ROCPROFSYS_COUT_OUTPUT=ON;ROCPROFSYS_SAMPLING_FREQ=50;ROCPROFSYS_KOKKOSP_PREFIX=[kokkos];KOKKOS_TOOLS_LIBS=librocprof-sys.so"
BASELINE_PASS_REGEX "\\|_\\[kokkos\\] [a-zA-Z]")
BASELINE_PASS_REGEX "\\|_\\[kokkos\\] [a-zA-Z]"
)
rocprofiler_systems_add_test(
SKIP_RUNTIME SKIP_REWRITE
@@ -76,7 +78,8 @@ rocprofiler_systems_add_test(
RUN_ARGS -i 10 -s 20 -p
ENVIRONMENT
"${_base_environment};ROCPROFSYS_USE_KOKKOSP=ON;ROCPROFSYS_COUT_OUTPUT=ON;ROCPROFSYS_SAMPLING_FREQ=50;ROCPROFSYS_KOKKOSP_PREFIX=[kokkos];KOKKOS_TOOLS_LIBS=librocprof-sys-dl.so"
BASELINE_PASS_REGEX "\\|_\\[kokkos\\] [a-zA-Z]")
BASELINE_PASS_REGEX "\\|_\\[kokkos\\] [a-zA-Z]"
)
rocprofiler_systems_add_test(
SKIP_BASELINE
@@ -99,7 +102,8 @@ rocprofiler_systems_add_test(
-ME
[==[lib(gomp|m-)]==]
RUN_ARGS -i 10 -s 20 -p
ENVIRONMENT "${_base_environment};ROCPROFSYS_USE_KOKKOSP=ON")
ENVIRONMENT "${_base_environment};ROCPROFSYS_USE_KOKKOSP=ON"
)
rocprofiler_systems_add_test(
SKIP_BASELINE
@@ -121,7 +125,8 @@ rocprofiler_systems_add_test(
-ME
[==[libgomp]==]
RUN_ARGS -i 10 -s 20 -p
ENVIRONMENT "${_perfetto_environment};ROCPROFSYS_USE_KOKKOSP=OFF")
ENVIRONMENT "${_perfetto_environment};ROCPROFSYS_USE_KOKKOSP=OFF"
)
rocprofiler_systems_add_test(
NAME lulesh-timemory
@@ -143,4 +148,5 @@ rocprofiler_systems_add_test(
ROCPROFSYS_TIMEMORY_COMPONENTS="wall_clock peak_rss"
RUN_ARGS -i 10 -s 20 -p
ENVIRONMENT "${_timemory_environment};ROCPROFSYS_USE_KOKKOSP=OFF"
REWRITE_FAIL_REGEX "0 instrumented loops in procedure")
REWRITE_FAIL_REGEX "0 instrumented loops in procedure"
)
+19 -7
Просмотреть файл
@@ -52,7 +52,7 @@ rocprofiler_systems_add_test(
"(/[A-Za-z-]+/perfetto-trace-0.proto).*(/[A-Za-z-]+/wall_clock-0.txt')"
REWRITE_RUN_FAIL_REGEX
"(perfetto-trace|trip_count|sampling_percent|sampling_cpu_clock|sampling_wall_clock|wall_clock)-[0-9][0-9]+.(json|txt|proto)|ROCPROFSYS_ABORT_FAIL_REGEX"
)
)
rocprofiler_systems_add_test(
SKIP_RUNTIME
@@ -75,7 +75,7 @@ rocprofiler_systems_add_test(
"${_flat_environment};ROCPROFSYS_USE_SAMPLING=OFF;ROCPROFSYS_STRICT_CONFIG=OFF;ROCPROFSYS_USE_MPIP=ON"
REWRITE_RUN_PASS_REGEX
">>> mpi-flat-mpip.inst(.*\n.*)>>> MPI_Init_thread(.*\n.*)>>> pthread_create(.*\n.*)>>> MPI_Comm_size(.*\n.*)>>> MPI_Comm_rank(.*\n.*)>>> MPI_Barrier(.*\n.*)>>> MPI_Alltoall"
)
)
rocprofiler_systems_add_test(
SKIP_RUNTIME
@@ -97,7 +97,7 @@ rocprofiler_systems_add_test(
ENVIRONMENT "${_flat_environment};ROCPROFSYS_USE_SAMPLING=OFF"
REWRITE_RUN_PASS_REGEX
">>> mpi-flat.inst(.*\n.*)>>> MPI_Init_thread(.*\n.*)>>> pthread_create(.*\n.*)>>> MPI_Comm_size(.*\n.*)>>> MPI_Comm_rank(.*\n.*)>>> MPI_Barrier(.*\n.*)>>> MPI_Alltoall"
)
)
set(_mpip_environment
"ROCPROFSYS_TRACE=ON"
@@ -111,7 +111,8 @@ set(_mpip_environment
"ROCPROFSYS_VERBOSE=2"
"ROCPROFSYS_DL_VERBOSE=2"
"${_test_openmp_env}"
"${_test_library_path}")
"${_test_library_path}"
)
set(_mpip_all2all_environment
"ROCPROFSYS_TRACE=ON"
@@ -125,9 +126,19 @@ set(_mpip_all2all_environment
"ROCPROFSYS_VERBOSE=3"
"ROCPROFSYS_DL_VERBOSE=3"
"${_test_openmp_env}"
"${_test_library_path}")
"${_test_library_path}"
)
foreach(_EXAMPLE all2all allgather allreduce bcast reduce scatter-gather send-recv)
foreach(
_EXAMPLE
all2all
allgather
allreduce
bcast
reduce
scatter-gather
send-recv
)
if("${_mpip_${_EXAMPLE}_environment}" STREQUAL "")
set(_mpip_${_EXAMPLE}_environment "${_mpip_environment}")
endif()
@@ -140,5 +151,6 @@ foreach(_EXAMPLE all2all allgather allreduce bcast reduce scatter-gather send-re
LABELS "mpip"
REWRITE_ARGS -e -v 2 --label file line --min-instructions 0
RUN_ARGS 30
ENVIRONMENT "${_mpip_${_EXAMPLE}_environment}")
ENVIRONMENT "${_mpip_${_EXAMPLE}_environment}"
)
endforeach()
+27 -21
Просмотреть файл
@@ -30,7 +30,8 @@
execute_process(
COMMAND "${CMAKE_SOURCE_DIR}/tests/get_default_nic.sh"
OUTPUT_STRIP_TRAILING_WHITESPACE
OUTPUT_VARIABLE _network_interface)
OUTPUT_VARIABLE _network_interface
)
message(STATUS "Default network interface is ${_network_interface}")
@@ -46,23 +47,28 @@ set(_nic_perf_environment
"ROCPROFSYS_TIMEMORY_COMPONENTS=wall_clock,papi_array,network_stats"
"ROCPROFSYS_NETWORK_INTERFACE=${_network_interface}"
"ROCPROFSYS_PAPI_EVENTS=net:::${_network_interface}:tx:byte net:::${_network_interface}:rx:byte net:::${_network_interface}:rx:packet net:::${_network_interface}:tx:packet"
"ROCPROFSYS_SAMPLING_DELAY=0.05")
"ROCPROFSYS_SAMPLING_DELAY=0.05"
)
# Set _download_url to a large file that will give rocprof-sys-sample time to collect NIC
# performance data (but not too large, because each test will time out after 2 min).
set(_download_url
"https://github.com/ROCm/rocprofiler-systems/releases/download/rocm-6.4.1/rocprofiler-systems-1.0.1-ubuntu-22.04-ROCm-60400-PAPI-OMPT-Python3.sh"
)
)
# Run the NIC performance test
add_test(
NAME nic-performance
COMMAND $<TARGET_FILE:rocprofiler-systems-sample> -- wget --no-check-certificate
${_download_url} -O /tmp/rocprofiler-systems.test.bin
WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
COMMAND
$<TARGET_FILE:rocprofiler-systems-sample> -- wget --no-check-certificate
${_download_url} -O /tmp/rocprofiler-systems.test.bin
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
)
set_tests_properties(nic-performance PROPERTIES ENVIRONMENT "${_nic_perf_environment}"
TIMEOUT 120 LABELS "network")
set_tests_properties(
nic-performance
PROPERTIES ENVIRONMENT "${_nic_perf_environment}" TIMEOUT 120 LABELS "network"
)
# Validate the perfetto file generated from NIC performance test output
add_test(
@@ -73,22 +79,22 @@ add_test(
${PROJECT_BINARY_DIR}/rocprof-sys-tests-output/nic-performance/perfetto-trace.proto
--counter-names rx:byte rx:packet tx:byte tx:packet -t
/opt/trace_processor/bin/trace_processor_shell -p
WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
)
set(_test_pass_regex
"rocprof-sys-tests-output/nic-performance/perfetto-trace.proto validated")
"rocprof-sys-tests-output/nic-performance/perfetto-trace.proto validated"
)
set(_test_fail_regex
"Failure validating rocprof-sys-tests-output/nic-performance/perfetto-trace.proto")
"Failure validating rocprof-sys-tests-output/nic-performance/perfetto-trace.proto"
)
set_tests_properties(
validate-nic-performance-perfetto
PROPERTIES TIMEOUT
30
LABELS
"network"
DEPENDS
nic-performance
PASS_REGULAR_EXPRESSION
${_test_pass_regex}
FAIL_REGULAR_EXPRESSION
${_test_fail_regex})
PROPERTIES
TIMEOUT 30
LABELS "network"
DEPENDS nic-performance
PASS_REGULAR_EXPRESSION ${_test_pass_regex}
FAIL_REGULAR_EXPRESSION ${_test_fail_regex}
)
+21 -12
Просмотреть файл
@@ -44,7 +44,8 @@ rocprofiler_systems_add_test(
"${_ompt_environment};ROCPROFSYS_USE_SAMPLING=OFF;ROCPROFSYS_COUT_OUTPUT=ON"
REWRITE_RUN_PASS_REGEX "${_OMPT_PASS_REGEX}"
RUNTIME_PASS_REGEX "${_OMPT_PASS_REGEX}"
REWRITE_FAIL_REGEX "0 instrumented loops in procedure")
REWRITE_FAIL_REGEX "0 instrumented loops in procedure"
)
rocprofiler_systems_add_test(
SKIP_RUNTIME
@@ -58,7 +59,8 @@ rocprofiler_systems_add_test(
ENVIRONMENT
"${_ompt_environment};ROCPROFSYS_USE_SAMPLING=ON;ROCPROFSYS_SAMPLING_FREQ=50;ROCPROFSYS_COUT_OUTPUT=ON"
REWRITE_RUN_PASS_REGEX "${_OMPT_PASS_REGEX}"
REWRITE_FAIL_REGEX "0 instrumented loops in procedure")
REWRITE_FAIL_REGEX "0 instrumented loops in procedure"
)
rocprofiler_systems_add_test(
SKIP_RUNTIME SKIP_REWRITE
@@ -67,7 +69,8 @@ rocprofiler_systems_add_test(
GPU ON
LABELS "openmp;openmp-target"
ENVIRONMENT
"${_ompt_environment};ROCPROFSYS_ROCM_DOMAINS=hip_runtime_api,kernel_dispatch")
"${_ompt_environment};ROCPROFSYS_ROCM_DOMAINS=hip_runtime_api,kernel_dispatch"
)
rocprofiler_systems_add_validation_test(
NAME openmp-target-sampling
@@ -86,7 +89,8 @@ rocprofiler_systems_add_validation_test(
0
0
0
-p)
-p
)
set(_ompt_sampling_environ
"${_ompt_environment}"
@@ -101,7 +105,8 @@ set(_ompt_sampling_environ
"ROCPROFSYS_SAMPLING_REALTIME=ON"
"ROCPROFSYS_SAMPLING_CPUTIME_FREQ=1000"
"ROCPROFSYS_SAMPLING_REALTIME_FREQ=500"
"ROCPROFSYS_MONOCHROME=ON")
"ROCPROFSYS_MONOCHROME=ON"
)
set(_ompt_sample_no_tmpfiles_environ
"${_ompt_environment}"
@@ -113,17 +118,18 @@ set(_ompt_sample_no_tmpfiles_environ
"ROCPROFSYS_SAMPLING_REALTIME=OFF"
"ROCPROFSYS_SAMPLING_CPUTIME_FREQ=700"
"ROCPROFSYS_USE_TEMPORARY_FILES=OFF"
"ROCPROFSYS_MONOCHROME=ON")
"ROCPROFSYS_MONOCHROME=ON"
)
set(_ompt_sampling_samp_regex
"Sampler for thread 0 will be triggered 1000.0x per second of CPU-time(.*)Sampler for thread 0 will be triggered 500.0x per second of wall-time(.*)Sampling will be disabled after 0.250000 seconds(.*)Sampling duration of 0.250000 seconds has elapsed. Shutting down sampling"
)
)
set(_ompt_sampling_file_regex
"sampling-duration-sampling/sampling_percent.(json|txt)(.*)sampling-duration-sampling/sampling_cpu_clock.(json|txt)(.*)sampling-duration-sampling/sampling_wall_clock.(json|txt)"
)
)
set(_notmp_sampling_file_regex
"sampling-no-tmp-files-sampling/sampling_percent.(json|txt)(.*)sampling-no-tmp-files-sampling/sampling_cpu_clock.(json|txt)(.*)sampling-no-tmp-files-sampling/sampling_wall_clock.(json|txt)"
)
)
rocprofiler_systems_add_test(
SKIP_BASELINE SKIP_RUNTIME SKIP_REWRITE
@@ -131,7 +137,8 @@ rocprofiler_systems_add_test(
TARGET openmp-cg
LABELS "openmp;sampling-duration"
ENVIRONMENT "${_ompt_sampling_environ}"
SAMPLING_PASS_REGEX "${_ompt_sampling_samp_regex}(.*)${_ompt_sampling_file_regex}")
SAMPLING_PASS_REGEX "${_ompt_sampling_samp_regex}(.*)${_ompt_sampling_file_regex}"
)
rocprofiler_systems_add_test(
SKIP_BASELINE SKIP_RUNTIME SKIP_REWRITE
@@ -139,7 +146,8 @@ rocprofiler_systems_add_test(
TARGET openmp-lu
LABELS "openmp;sampling-duration"
ENVIRONMENT "${_ompt_sampling_environ}"
SAMPLING_PASS_REGEX "${_ompt_sampling_samp_regex}(.*)${_ompt_sampling_file_regex}")
SAMPLING_PASS_REGEX "${_ompt_sampling_samp_regex}(.*)${_ompt_sampling_file_regex}"
)
rocprofiler_systems_add_test(
SKIP_BASELINE SKIP_RUNTIME SKIP_REWRITE
@@ -147,4 +155,5 @@ rocprofiler_systems_add_test(
TARGET openmp-cg
LABELS "openmp;no-tmp-files"
ENVIRONMENT "${_ompt_sample_no_tmpfiles_environ}"
SAMPLING_PASS_REGEX "${_notmp_sampling_file_regex}")
SAMPLING_PASS_REGEX "${_notmp_sampling_file_regex}"
)
+9 -5
Просмотреть файл
@@ -34,11 +34,14 @@ set(_overflow_environment
"ROCPROFSYS_SAMPLING_OVERFLOW=ON"
"ROCPROFSYS_SAMPLING_OVERFLOW_EVENT=PERF_COUNT_SW_CPU_CLOCK"
"ROCPROFSYS_SAMPLING_OVERFLOW_FREQ=10000"
"ROCPROFSYS_DEBUG_THREADING_GET_ID=ON")
"ROCPROFSYS_DEBUG_THREADING_GET_ID=ON"
)
if(rocprofiler_systems_perf_event_paranoid LESS_EQUAL 3
OR rocprofiler_systems_cap_sys_admin EQUAL 0
OR rocprofiler_systems_cap_perfmon EQUAL 0)
if(
rocprofiler_systems_perf_event_paranoid LESS_EQUAL 3
OR rocprofiler_systems_cap_sys_admin EQUAL 0
OR rocprofiler_systems_cap_perfmon EQUAL 0
)
rocprofiler_systems_add_test(
SKIP_BASELINE
NAME overflow
@@ -50,5 +53,6 @@ if(rocprofiler_systems_perf_event_paranoid LESS_EQUAL 3
LABELS "perf;overflow"
SAMPLING_PASS_REGEX "sampling_wall_clock.txt"
RUNTIME_PASS_REGEX "sampling_wall_clock.txt"
REWRITE_RUN_PASS_REGEX "sampling_wall_clock.txt")
REWRITE_RUN_PASS_REGEX "sampling_wall_clock.txt"
)
endif()
+2 -2
Просмотреть файл
@@ -39,7 +39,7 @@ rocprofiler_systems_add_test(
"wall_clock .*\\|_pthread_create .* 4 .*\\|_pthread_mutex_lock .* 1000 .*\\|_pthread_mutex_unlock .* 1000 .*\\|_pthread_mutex_lock .* 1000 .*\\|_pthread_mutex_unlock .* 1000 .*\\|_pthread_mutex_lock .* 1000 .*\\|_pthread_mutex_unlock .* 1000 .*\\|_pthread_mutex_lock .* 1000 .*\\|_pthread_mutex_unlock .* 1000"
RUNTIME_PASS_REGEX
"wall_clock .*\\|_pthread_create .* 4 .*\\|_pthread_mutex_lock .* 1000 .*\\|_pthread_mutex_unlock .* 1000 .*\\|_pthread_mutex_lock .* 1000 .*\\|_pthread_mutex_unlock .* 1000 .*\\|_pthread_mutex_lock .* 1000 .*\\|_pthread_mutex_unlock .* 1000 .*\\|_pthread_mutex_lock .* 1000 .*\\|_pthread_mutex_unlock .* 1000"
)
)
rocprofiler_systems_add_test(
SKIP_RUNTIME
@@ -53,4 +53,4 @@ rocprofiler_systems_add_test(
"${_lock_environment};ROCPROFSYS_FLAT_PROFILE=ON;ROCPROFSYS_PROFILE=ON;ROCPROFSYS_TRACE=OFF;ROCPROFSYS_SAMPLING_KEEP_INTERNAL=OFF"
REWRITE_RUN_PASS_REGEX
"start_thread (.*) 4 (.*) pthread_mutex_lock (.*) 4000 (.*) pthread_mutex_unlock (.*) 4000"
)
)
+51 -28
Просмотреть файл
@@ -38,7 +38,8 @@ foreach(_VERSION ${ROCPROFSYS_PYTHON_VERSIONS})
rocprofiler_systems_find_python(
_PYTHON
ROOT_DIR "${_PYTHON_ROOT_DIR}"
COMPONENTS Interpreter)
COMPONENTS Interpreter
)
# ---------------------------------------------------------------------------------- #
# python tests
@@ -50,7 +51,8 @@ foreach(_VERSION ${ROCPROFSYS_PYTHON_VERSIONS})
FILE ${CMAKE_SOURCE_DIR}/examples/python/external.py
PROFILE_ARGS "--label" "file"
RUN_ARGS -v 10 -n 5
ENVIRONMENT "${_python_environment}")
ENVIRONMENT "${_python_environment}"
)
rocprofiler_systems_add_python_test(
NAME python-external-exclude-inefficient
@@ -59,7 +61,8 @@ foreach(_VERSION ${ROCPROFSYS_PYTHON_VERSIONS})
FILE ${CMAKE_SOURCE_DIR}/examples/python/external.py
PROFILE_ARGS -E "^inefficient$"
RUN_ARGS -v 10 -n 5
ENVIRONMENT "${_python_environment}")
ENVIRONMENT "${_python_environment}"
)
rocprofiler_systems_add_python_test(
NAME python-builtin
@@ -68,7 +71,8 @@ foreach(_VERSION ${ROCPROFSYS_PYTHON_VERSIONS})
FILE ${CMAKE_SOURCE_DIR}/examples/python/builtin.py
PROFILE_ARGS "-b" "--label" "file" "line"
RUN_ARGS -v 10 -n 5
ENVIRONMENT "${_python_environment}")
ENVIRONMENT "${_python_environment}"
)
rocprofiler_systems_add_python_test(
NAME python-builtin-noprofile
@@ -77,7 +81,8 @@ foreach(_VERSION ${ROCPROFSYS_PYTHON_VERSIONS})
FILE ${CMAKE_SOURCE_DIR}/examples/python/noprofile.py
PROFILE_ARGS "-b" "--label" "file"
RUN_ARGS -v 15 -n 5
ENVIRONMENT "${_python_environment}")
ENVIRONMENT "${_python_environment}"
)
rocprofiler_systems_add_python_test(
STANDALONE
@@ -86,7 +91,8 @@ foreach(_VERSION ${ROCPROFSYS_PYTHON_VERSIONS})
PYTHON_VERSION ${_VERSION}
FILE ${CMAKE_SOURCE_DIR}/examples/python/source.py
RUN_ARGS -v 5 -n 5 -s 3
ENVIRONMENT "${_python_environment}")
ENVIRONMENT "${_python_environment}"
)
rocprofiler_systems_add_python_test(
STANDALONE
@@ -104,16 +110,14 @@ foreach(_VERSION ${ROCPROFSYS_PYTHON_VERSIONS})
code-coverage-basic-blocks-binary-rewrite-run
code-coverage-basic-blocks-hybrid-runtime-instrument
LABELS "code-coverage"
ENVIRONMENT "${_python_environment}")
ENVIRONMENT "${_python_environment}"
)
# ---------------------------------------------------------------------------------- #
# python output tests
# ---------------------------------------------------------------------------------- #
if(CMAKE_VERSION VERSION_LESS "3.18.0")
find_program(
ROCPROFSYS_CAT_EXE
NAMES cat
PATH_SUFFIXES bin)
find_program(ROCPROFSYS_CAT_EXE NAMES cat PATH_SUFFIXES bin)
if(ROCPROFSYS_CAT_EXE)
set(ROCPROFSYS_CAT_COMMAND ${ROCPROFSYS_CAT_EXE})
@@ -131,7 +135,8 @@ foreach(_VERSION ${ROCPROFSYS_PYTHON_VERSIONS})
PASS_REGEX
"(\\\[compile\\\]).*(\\\| \\\|0>>> \\\[run\\\]\\\[external.py\\\]).*(\\\| \\\|0>>> \\\|_\\\[fib\\\]\\\[external.py\\\]).*(\\\| \\\|0>>> \\\|_\\\[inefficient\\\]\\\[external.py\\\])"
DEPENDS python-external-${_VERSION}
ENVIRONMENT "${_python_environment}")
ENVIRONMENT "${_python_environment}"
)
rocprofiler_systems_add_python_test(
NAME python-external-exclude-inefficient-check
@@ -140,7 +145,8 @@ foreach(_VERSION ${ROCPROFSYS_PYTHON_VERSIONS})
FILE rocprof-sys-tests-output/python-external-exclude-inefficient/${_VERSION}/trip_count.txt
FAIL_REGEX "(\\\|_inefficient).*(\\\|_sum)|ROCPROFSYS_ABORT_FAIL_REGEX"
DEPENDS python-external-exclude-inefficient-${_VERSION}
ENVIRONMENT "${_python_environment}")
ENVIRONMENT "${_python_environment}"
)
rocprofiler_systems_add_python_test(
NAME python-builtin-check
@@ -149,7 +155,8 @@ foreach(_VERSION ${ROCPROFSYS_PYTHON_VERSIONS})
FILE rocprof-sys-tests-output/python-builtin/${_VERSION}/trip_count.txt
PASS_REGEX "\\\[inefficient\\\]\\\[builtin.py:14\\\]"
DEPENDS python-builtin-${_VERSION}
ENVIRONMENT "${_python_environment}")
ENVIRONMENT "${_python_environment}"
)
rocprofiler_systems_add_python_test(
NAME python-builtin-noprofile-check
@@ -159,17 +166,23 @@ foreach(_VERSION ${ROCPROFSYS_PYTHON_VERSIONS})
PASS_REGEX ".(run)..(noprofile.py)."
FAIL_REGEX ".(fib|inefficient)..(noprofile.py).|ROCPROFSYS_ABORT_FAIL_REGEX"
DEPENDS python-builtin-noprofile-${_VERSION}
ENVIRONMENT "${_python_environment}")
ENVIRONMENT "${_python_environment}"
)
else()
rocprofiler_systems_message(
WARNING
"Neither 'cat' nor 'cmake -E cat' are available. Python source checks are disabled"
)
)
endif()
function(ROCPROFILER_SYSTEMS_ADD_PYTHON_VALIDATION_TEST)
cmake_parse_arguments(TEST "" "NAME;TIMEMORY_METRIC;TIMEMORY_FILE;PERFETTO_FILE"
"ARGS;PERFETTO_METRIC" ${ARGN})
cmake_parse_arguments(
TEST
""
"NAME;TIMEMORY_METRIC;TIMEMORY_FILE;PERFETTO_FILE"
"ARGS;PERFETTO_METRIC"
${ARGN}
)
rocprofiler_systems_add_python_test(
NAME ${TEST_NAME}-validate-timemory
@@ -181,7 +194,8 @@ foreach(_VERSION ${ROCPROFSYS_PYTHON_VERSIONS})
DEPENDS ${TEST_NAME}-${_VERSION}
PASS_REGEX
"rocprof-sys-tests-output/${TEST_NAME}/${_VERSION}/${TEST_TIMEMORY_FILE} validated"
ENVIRONMENT "${_python_environment}")
ENVIRONMENT "${_python_environment}"
)
rocprofiler_systems_add_python_test(
NAME ${TEST_NAME}-validate-perfetto
@@ -194,7 +208,8 @@ foreach(_VERSION ${ROCPROFSYS_PYTHON_VERSIONS})
DEPENDS ${TEST_NAME}-${_VERSION}
PASS_REGEX
"rocprof-sys-tests-output/${TEST_NAME}/${_VERSION}/${TEST_PERFETTO_FILE} validated"
ENVIRONMENT "${_python_environment}")
ENVIRONMENT "${_python_environment}"
)
endfunction()
set(python_source_labels
@@ -206,7 +221,8 @@ foreach(_VERSION ${ROCPROFSYS_PYTHON_VERSIONS})
fib
fib
inefficient
_sum)
_sum
)
set(python_source_count
5
3
@@ -216,7 +232,8 @@ foreach(_VERSION ${ROCPROFSYS_PYTHON_VERSIONS})
18
6
3
3)
3
)
set(python_source_depth
0
1
@@ -226,7 +243,8 @@ foreach(_VERSION ${ROCPROFSYS_PYTHON_VERSIONS})
5
6
2
3)
3
)
set(python_source_categories python user)
@@ -237,7 +255,8 @@ foreach(_VERSION ${ROCPROFSYS_PYTHON_VERSIONS})
PERFETTO_FILE "perfetto-trace.proto"
PERFETTO_METRIC ${python_source_categories}
ARGS -l ${python_source_labels} -c ${python_source_count} -d
${python_source_depth})
${python_source_depth}
)
set(python_builtin_labels
[run][builtin.py:28]
@@ -251,7 +270,8 @@ foreach(_VERSION ${ROCPROFSYS_PYTHON_VERSIONS})
[fib][builtin.py:10]
[fib][builtin.py:10]
[fib][builtin.py:10]
[inefficient][builtin.py:14])
[inefficient][builtin.py:14]
)
set(python_builtin_count
5
5
@@ -264,7 +284,8 @@ foreach(_VERSION ${ROCPROFSYS_PYTHON_VERSIONS})
220
80
10
5)
5
)
set(python_builtin_depth
0
1
@@ -277,7 +298,8 @@ foreach(_VERSION ${ROCPROFSYS_PYTHON_VERSIONS})
8
9
10
1)
1
)
rocprofiler_systems_add_python_validation_test(
NAME python-builtin
@@ -286,6 +308,7 @@ foreach(_VERSION ${ROCPROFSYS_PYTHON_VERSIONS})
PERFETTO_METRIC "python"
PERFETTO_FILE "perfetto-trace.proto"
ARGS -l ${python_builtin_labels} -c ${python_builtin_count} -d
${python_builtin_depth})
${python_builtin_depth}
)
math(EXPR _INDEX "${_INDEX} + 1")
endforeach()

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше