f17ff12a66
* omnitrace namespace
* Kokkos + Lulesh example/tests
* Sampling support + more
- OMNITRACE_BUILD_TESTING option
- sampling support
- pthread_gotcha
- fixes to labels for mpi_gotcha, fork_gotcha, omnitrace_component
- tasking::block_signals, tasking::unblock_signals
- instrumentation mode option in omnitrace exe
- argument option groups in omnitrace exe
- categories in omnitrace settings
- remove TIMEMORY_ prefixed options
* Release workflow updates
* Updated settings printing
* Fixed defaults in README
* Tweak setting defaults in README
* CMake fixes
* cmake-format
* clang-format
* LULESH_USE_MPI OFF
* LULESH_USE_MPI fix
* timemory add_secondary fix
* timemory ambiguous internal namespace fix
* Update timemory submodule
* Handle output path/prefix in omnitrace
- updated timemory
- updated test environment
* sampling + papi fix
* Fix to sampling without PAPI
* Fix for using too many processors in CI
* formatting
* Updated CI
- minor cmake tweaks
- updated timemory submodule
* Updated CI
* Updated CI
* CI + timemory updates
- data race fixes
* CI updates + debug for sampling
* Sampling updates
- moved tasking::{block,unblock}_signals to sampling namespace
- improvements to sampling w.r.t. thread-locality
* Minimum OMNITRACE_THREAD_COUNT of 128
* Handle multiple dims in sampler data
* Configure libunwind support for timemory
* Improved safeguards for sampling
- updated CI
- lulesh runtime-instrument test tweak
* formatting
* CI updates + sampler updates + misc
- fixed stack-buffer-overflow in omnitrace (get_*file_line_info)
- test labels
- steady_clock instead of system_clock in sampler
- update dyninst submodule with upgradePlaceholder fix
- disable OMNITRACE_BUILD_TESTING by default
* Updated timemory submodule
- hidden visibility for timemory
- storage finalizers do not capture this
* Update timemory submodule
- component visibility updates
* Reworked header includes
- use <...> for timemory headers
- always include <library/defines.hpp>
* Rename some config options
* Update PTL submodule
* Update kokkos submodule
* Updated sampling
* Updated CI
* Reworked instrumentation exe
- lowered min-address-range threshold to 256
- extended whole function exclude
* CI fix + timemory submodule update
- TIMEMORY_VISIBLE on component base
- RelWithDebugInfo -> RelWithDebInfo
- Info output for parallel-overhead
* Sampling flags + transpose update + CI update
- disable critical trace for parallel-overhead in CI
- SA_RESTART only in sampler
- reworked transpose example to use fewer threads
* CI update
- removed ubuntu-focal-external-debug
- reduced data artifacts upload
* CI timeouts
- updated timemory submodule
- minor tweaks to omnitrace exe logging
* LICENSE updates (partial)
* CI Test stage timeout extension
* Docker and Packaging updates
* Miscellaneous fixes/tweaks
- gpu.hpp / gpu.cpp
- disable roctracer component if no devices
- re-enable InstrStackFrames by default
- disable sampling by default
- pthread_gotcha::m_enable_sampling is false by default
- timemory submodule update w/ sampler and pop(tid) updates
- fix minor bug in sampler logic
- CMake: OMNITRACE_USE_HIP option
- roctracer + timemory fix
* Replaced OMNITRACE_USE_ROCTRACER with OMNITRACE_USE_HIP where appropriate
* cmake format
* Sampler deadlock fixes
* Removed debug messages from sampler
* Fix for MPI detection + test tweaks + misc
* Sampler deadlock fixes + misc
- removed papi_tot_ins
- pthread_gotcha blocks signals globally until sampler is setup
- metadata specialization for sampling components
- OMNITRACE_INSTRUMENTATION_MODE -> OMNITRACE_MODE
- default sampling delay increased to 0.05 from 1.0e-6
- removed {block,unblock}_signals from critical_trace and ptl
- no longer necessary to use
- sampling delay minimum is 1.0e-3
- OMNITRACE_BUILD_HIDDEN_VISIBILITY
* omnitrace-avail + libunwind update + restructure
- restructured omnitrace components
- build custom omnitrace-avail executable
- updated libunwind to avoid malloc in get_unw_backtrace
* Fix remaining reorganization issues
- removed some duplicate code
- fixed some trait specializations after implicit instatiation
- formatting
* ensure_storage fix + avail improvements
- fix ensure_storage when component not avail
- suppress irrelevant info in omnitrace-avail
* Delay settings initialization
- slight tweak to tests w/ MPI
* Disable OpenMPI testing w/ ubuntu-bionic
- MPI testing is hanging bc of network interface issue on system:
> [[20462,1],0]: A high-performance Open MPI point-to-point messaging module
> was unable to find any relevant network interfaces:
> Module: OpenFabrics (openib)
> Host: fv-az19-371
> Another transport will be used instead, although this may result in
> lower performance.
> NOTE: You can disable this warning by setting the MCA parameter
> btl_base_warn_component_unused to 0.
[ROCm/rocprofiler-systems commit: 778af2a760]
316 라인
12 KiB
CMake
316 라인
12 KiB
CMake
# include guard
|
|
include_guard(DIRECTORY)
|
|
|
|
# MacroUtilities - useful macros and functions for generic tasks
|
|
#
|
|
|
|
include(CMakeDependentOption)
|
|
include(CMakeParseArguments)
|
|
|
|
# -----------------------------------------------------------------------
|
|
# function - capitalize - make a string capitalized (first letter is capital) usage:
|
|
# capitalize("SHARED" CShared) message(STATUS "-- CShared is \"${CShared}\"") $ -- CShared
|
|
# is "Shared"
|
|
function(CAPITALIZE str var)
|
|
# make string lower
|
|
string(TOLOWER "${str}" str)
|
|
string(SUBSTRING "${str}" 0 1 _first)
|
|
string(TOUPPER "${_first}" _first)
|
|
string(SUBSTRING "${str}" 1 -1 _remainder)
|
|
string(CONCAT str "${_first}" "${_remainder}")
|
|
set(${var}
|
|
"${str}"
|
|
PARENT_SCOPE)
|
|
endfunction()
|
|
|
|
# ----------------------------------------------------------------------------------------#
|
|
# macro CHECKOUT_GIT_SUBMODULE()
|
|
#
|
|
# Run "git submodule update" if a file in a submodule does not exist
|
|
#
|
|
# ARGS: RECURSIVE (option) -- add "--recursive" flag RELATIVE_PATH (one value) --
|
|
# typically the relative path to submodule from PROJECT_SOURCE_DIR WORKING_DIRECTORY (one
|
|
# value) -- (default: PROJECT_SOURCE_DIR) TEST_FILE (one value) -- file to check for
|
|
# (default: CMakeLists.txt) ADDITIONAL_CMDS (many value) -- any addition commands to pass
|
|
#
|
|
function(CHECKOUT_GIT_SUBMODULE)
|
|
# parse args
|
|
cmake_parse_arguments(
|
|
CHECKOUT "RECURSIVE"
|
|
"RELATIVE_PATH;WORKING_DIRECTORY;TEST_FILE;REPO_URL;REPO_BRANCH"
|
|
"ADDITIONAL_CMDS" ${ARGN})
|
|
|
|
if(NOT CHECKOUT_WORKING_DIRECTORY)
|
|
set(CHECKOUT_WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
|
|
endif()
|
|
|
|
if(NOT CHECKOUT_TEST_FILE)
|
|
set(CHECKOUT_TEST_FILE "Makefile")
|
|
endif()
|
|
|
|
# default assumption
|
|
if(NOT CHECKOUT_REPO_BRANCH)
|
|
set(CHECKOUT_REPO_BRANCH "master")
|
|
endif()
|
|
|
|
find_package(Git)
|
|
set(_DIR "${CHECKOUT_WORKING_DIRECTORY}/${CHECKOUT_RELATIVE_PATH}")
|
|
# ensure the (possibly empty) directory exists
|
|
if(NOT EXISTS "${_DIR}")
|
|
if(NOT CHECKOUT_REPO_URL)
|
|
message(FATAL_ERROR "submodule directory does not exist")
|
|
endif()
|
|
endif()
|
|
|
|
# if this file exists --> project has been checked out if not exists --> not been
|
|
# checked out
|
|
set(_TEST_FILE "${_DIR}/${CHECKOUT_TEST_FILE}")
|
|
# assuming a .gitmodules file exists
|
|
set(_SUBMODULE "${PROJECT_SOURCE_DIR}/.gitmodules")
|
|
|
|
set(_TEST_FILE_EXISTS OFF)
|
|
if(EXISTS "${_TEST_FILE}" AND NOT IS_DIRECTORY "${_TEST_FILE}")
|
|
set(_TEST_FILE_EXISTS ON)
|
|
endif()
|
|
|
|
if(_TEST_FILE_EXISTS)
|
|
return()
|
|
endif()
|
|
|
|
find_package(Git REQUIRED)
|
|
|
|
set(_SUBMODULE_EXISTS OFF)
|
|
if(EXISTS "${_SUBMODULE}" AND NOT IS_DIRECTORY "${_SUBMODULE}")
|
|
set(_SUBMODULE_EXISTS ON)
|
|
endif()
|
|
|
|
set(_HAS_REPO_URL OFF)
|
|
if(NOT "${CHECKOUT_REPO_URL}" STREQUAL "")
|
|
set(_HAS_REPO_URL ON)
|
|
endif()
|
|
|
|
# if the module has not been checked out
|
|
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}
|
|
WORKING_DIRECTORY ${CHECKOUT_WORKING_DIRECTORY}
|
|
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}")
|
|
message(STATUS "function(CHECKOUT_GIT_SUBMODULE) failed.")
|
|
message(FATAL_ERROR "Command: \"${_CMD}\"")
|
|
else()
|
|
set(_TEST_FILE_EXISTS ON)
|
|
endif()
|
|
endif()
|
|
|
|
if(NOT _TEST_FILE_EXISTS AND _HAS_REPO_URL)
|
|
message(
|
|
STATUS "Checking out '${CHECKOUT_REPO_URL}' @ '${CHECKOUT_REPO_BRANCH}'...")
|
|
|
|
# remove the existing directory
|
|
if(EXISTS "${_DIR}")
|
|
execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory ${_DIR})
|
|
endif()
|
|
|
|
# perform the checkout
|
|
execute_process(
|
|
COMMAND
|
|
${GIT_EXECUTABLE} clone -b ${CHECKOUT_REPO_BRANCH}
|
|
${CHECKOUT_ADDITIONAL_CMDS} ${CHECKOUT_REPO_URL} ${CHECKOUT_RELATIVE_PATH}
|
|
WORKING_DIRECTORY ${CHECKOUT_WORKING_DIRECTORY}
|
|
RESULT_VARIABLE RET)
|
|
|
|
# perform the submodule update
|
|
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)
|
|
endif()
|
|
|
|
# check the return code
|
|
if(RET GREATER 0)
|
|
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()
|
|
set(_TEST_FILE_EXISTS ON)
|
|
endif()
|
|
endif()
|
|
|
|
if(NOT EXISTS "${_TEST_FILE}" OR NOT _TEST_FILE_EXISTS)
|
|
message(
|
|
FATAL_ERROR
|
|
"Error checking out submodule: '${CHECKOUT_RELATIVE_PATH}' to '${_DIR}'")
|
|
endif()
|
|
|
|
endfunction()
|
|
|
|
# ----------------------------------------------------------------------------------------#
|
|
# require variable
|
|
#
|
|
function(CHECK_REQUIRED VAR)
|
|
if(NOT DEFINED ${VAR} OR "${${VAR}}" STREQUAL "")
|
|
message(FATAL_ERROR "Variable '${VAR}' must be defined and not empty")
|
|
endif()
|
|
endfunction()
|
|
|
|
# -----------------------------------------------------------------------
|
|
# function add_feature(<NAME> <DOCSTRING>) Add a project feature, whose activation is
|
|
# specified by the existence of the variable <NAME>, to the list of enabled/disabled
|
|
# features, plus a docstring describing the feature
|
|
#
|
|
function(ADD_FEATURE _var _description)
|
|
set(EXTRA_DESC "")
|
|
foreach(currentArg ${ARGN})
|
|
if(NOT "${currentArg}" STREQUAL "${_var}" AND NOT "${currentArg}" STREQUAL
|
|
"${_description}")
|
|
set(EXTRA_DESC "${EXTA_DESC}${currentArg}")
|
|
endif()
|
|
endforeach()
|
|
|
|
set_property(GLOBAL APPEND PROPERTY ${PROJECT_NAME}_FEATURES ${_var})
|
|
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}@")
|
|
endif()
|
|
endfunction()
|
|
|
|
# ----------------------------------------------------------------------------------------#
|
|
# function add_option(<OPTION_NAME> <DOCSRING> <DEFAULT_SETTING> [NO_FEATURE]) Add an
|
|
# option and add as a feature if NO_FEATURE is not provided
|
|
#
|
|
function(ADD_OPTION _NAME _MESSAGE _DEFAULT)
|
|
option(${_NAME} "${_MESSAGE}" ${_DEFAULT})
|
|
if("NO_FEATURE" IN_LIST ARGN)
|
|
mark_as_advanced(${_NAME})
|
|
else()
|
|
add_feature(${_NAME} "${_MESSAGE}")
|
|
endif()
|
|
if("ADVANCED" IN_LIST ARGN)
|
|
mark_as_advanced(${_NAME})
|
|
endif()
|
|
endfunction()
|
|
|
|
# ----------------------------------------------------------------------------------------#
|
|
# function print_enabled_features() Print enabled features plus their docstrings.
|
|
#
|
|
function(PRINT_ENABLED_FEATURES)
|
|
set(_basemsg "The following features are defined/enabled (+):")
|
|
set(_currentFeatureText "${_basemsg}")
|
|
get_property(_features GLOBAL PROPERTY ${PROJECT_NAME}_FEATURES)
|
|
if(NOT "${_features}" STREQUAL "")
|
|
list(REMOVE_DUPLICATES _features)
|
|
list(SORT _features)
|
|
endif()
|
|
foreach(_feature ${_features})
|
|
if(${_feature})
|
|
# add feature to text
|
|
set(_currentFeatureText "${_currentFeatureText}\n ${_feature}")
|
|
# get description
|
|
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")
|
|
set(_currentFeatureText
|
|
"${_currentFeatureText}: ${_desc} -- [\"${${_feature}}\"]")
|
|
else()
|
|
string(REGEX REPLACE "^${PROJECT_NAME}_USE_" "" _feature_tmp
|
|
"${_feature}")
|
|
string(TOLOWER "${_feature_tmp}" _feature_tmp_l)
|
|
capitalize("${_feature_tmp}" _feature_tmp_c)
|
|
foreach(_var _feature _feature_tmp _feature_tmp_l _feature_tmp_c)
|
|
set(_ver "${${${_var}}_VERSION}")
|
|
if(NOT "${_ver}" STREQUAL "")
|
|
set(_desc "${_desc} -- [found version ${_ver}]")
|
|
break()
|
|
endif()
|
|
unset(_ver)
|
|
endforeach()
|
|
set(_currentFeatureText "${_currentFeatureText}: ${_desc}")
|
|
endif()
|
|
set(_desc NOTFOUND)
|
|
endif()
|
|
endif()
|
|
endforeach()
|
|
|
|
if(NOT "${_currentFeatureText}" STREQUAL "${_basemsg}")
|
|
message(STATUS "${_currentFeatureText}\n")
|
|
endif()
|
|
endfunction()
|
|
|
|
# ----------------------------------------------------------------------------------------#
|
|
# function print_disabled_features() Print disabled features plus their docstrings.
|
|
#
|
|
function(PRINT_DISABLED_FEATURES)
|
|
set(_basemsg "The following features are NOT defined/enabled (-):")
|
|
set(_currentFeatureText "${_basemsg}")
|
|
get_property(_features GLOBAL PROPERTY ${PROJECT_NAME}_FEATURES)
|
|
if(NOT "${_features}" STREQUAL "")
|
|
list(REMOVE_DUPLICATES _features)
|
|
list(SORT _features)
|
|
endif()
|
|
foreach(_feature ${_features})
|
|
if(NOT ${_feature})
|
|
set(_currentFeatureText "${_currentFeatureText}\n ${_feature}")
|
|
get_property(_desc GLOBAL PROPERTY ${_feature}_DESCRIPTION)
|
|
if(_desc)
|
|
set(_currentFeatureText "${_currentFeatureText}: ${_desc}")
|
|
set(_desc NOTFOUND)
|
|
endif(_desc)
|
|
endif()
|
|
endforeach(_feature)
|
|
|
|
if(NOT "${_currentFeatureText}" STREQUAL "${_basemsg}")
|
|
message(STATUS "${_currentFeatureText}\n")
|
|
endif()
|
|
endfunction()
|
|
|
|
# ----------------------------------------------------------------------------------------#
|
|
# function print_features() Print all features plus their docstrings.
|
|
#
|
|
function(PRINT_FEATURES)
|
|
message(STATUS "")
|
|
print_enabled_features()
|
|
print_disabled_features()
|
|
endfunction()
|
|
|
|
# ----------------------------------------------------------------------------------------#
|
|
# macro ADD_SUBPROJECT() Does a git submodule update + add_subdirectory
|
|
#
|
|
macro(ADD_SUBPROJECT PACKAGE_NAME)
|
|
# parse args
|
|
cmake_parse_arguments(PACKAGE "SUBMODULE" "DIRECTORY" "" ${ARGN})
|
|
if(NOT PACKAGE_DIRECTORY)
|
|
set(PACKAGE_DIRECTORY ${PACKAGE_NAME})
|
|
endif()
|
|
# if specified in options
|
|
if("${PACKAGE_NAME}" IN_LIST PROJECTS)
|
|
if(PACKAGE_SUBMODULE)
|
|
checkout_git_submodule(RECURSIVE RELATIVE_PATH ${PACKAGE_DIRECTORY})
|
|
endif()
|
|
if(NOT EXISTS "${PROJECT_SOURCE_DIR}/${PACKAGE_DIRECTORY}/CMakeLists.txt")
|
|
message(
|
|
STATUS
|
|
"Warning! '${PROJECT_SOURCE_DIR}/${PACKAGE_DIRECTORY}/CMakeLists.txt' does not exist!"
|
|
)
|
|
else()
|
|
add_subdirectory(${PACKAGE_DIRECTORY})
|
|
endif()
|
|
endif()
|
|
endmacro()
|