9618ddefba
* Addition of basic structure
* Reworked categories
* More causal integration additions
* Causal implementation
* Update examples
* delete virtual_speedup files
* Update perfetto submodule to v31.0
* Update dyninst submodule
* Update timemory submodule
* ElfUtils build for libdw
* OMNITRACE_LIKELY and OMNITRACE_UNLIKELY
* Update common lib join
* Examples updates for causal profiling
* config updates with causal options
- OMNITRACE_CAUSAL_FIXED_LINE
- OMNITRACE_CAUSAL_FIXED_SPEEDUP
- OMNITRACE_CAUSAL_FILE
- OMNITRACE_CAUSAL_BINARY_SCOPE
- OMNITRACE_CAUSAL_SOURCE_SCOPE
- version info in banner
- support increments in parse_numeric_range
- fix occasional deadlock in first call to get_config
* PTL general task group
* Always include PID in debug/verbose messages
* Add blocking/unblocking gotchas to runtime init bundle
* CausalState
* thread_data updates
- generic component_bundle_cache
* Improve handling of causal in category_region
* components updates
- backtrace_causal component
- backtrace::get_data member func
- decrease ignore_depth in backtrace::sample(int)
- handle "omnitrace_main" in backtrace::filter_and_patch(...)
- tweak internal thread state scope for pthread_mutex_gotcha wrappers
* simplify tracing get_instrumentation_bundles usage
* sampling updates
- include backtrace_causal component
- disable backtrace_metrics if using causal and not using perfetto
- disable backtrace and backtrace_timestamp when using causal
- post_process_causal
* causal updates
- more checks in blocking_gotcha and unblocking_gotcha start/stop
- miscellaneous overhaul of data
- experiment update
* Remove virtual speedup
* libomnitrace code_object
* causal-profiling test
* libomnitrace library.cpp updates
- handle causal profiling
- fini_bundle
* Disable causal profiling by default
* Updated causal code and example
- example: three execution variants: cpu + rng, cpu, rng
- example: three instrumentation variants: none, omni, coz
- fix blocking gotcha credit
- rework perform_experiment_impl
- get_eligible_address_ranges
- compute_eligible_lines
- support fixed lines/speedups/functions
- update selected_entry to support function mode
- fix causal::delay
- experiment updates
* omnitrace_progress / omnitrace_user_progress
- with accompanying omnitrace_annotated_progress / omnitrace_user_annotated_progress
* Update timemory submodule
* CausalMode
- mode indicated whether causal predictions source be at line-level or function-level
* code_object, config, runtime, sampling, thread_data
- code_object: address_range
- code_object: basic::line_info serialize(), name(), hash()
- config updates
- two signals for causal sampling
- thread_data init fixes
* pthread updates
- pthread_create_gotcha processes delays
- pthread_mutex_gotcha does not wrap pthread_join in causal mode
* backtrace_causal update
- dynamic delay period stats
* main wrapper uses basename of argv[0]
* update elfio submodule
* perf support (currently unused)
* Fix experiment JSON serialization
- static_vector.hpp (unused)
* causal executable + config options updates
- omnitrace-causal exe simplifies running multiple causal configs
- changed the causal config option names
* Support both throughput and latency points
* process-causal-json.py script
- will be used later for testing
* stable_vector
* Rework thread_data
* Improve omnitrace-causal exe
- better verbosity handling
- correct diagnosis of status for child process
- execvpe when only one iteration (debugging)
* Update timemory submodule
* exe --version
- omnitrace, omnitrace-avail, and omnitrace-sample all support --version on command-line
* OMNITRACE_INTERNAL_API + OMNITRACE_{LIKELY,UNLIKELY}
* omnitrace-causal cmake format
* omnitrace config update
- OMNITRACE_CAUSAL_FILE_CLOBBER
* custom exception
- wraps STL exception and gets stacktrace during construction
* exit_gotcha supports _Exit
* use global construct_on_init + max threads
- add some safety when exceeding max # of threads
* update code_object binary filter
- exclude dyninst and tbbmalloc library
* containers: c_array, static_vector, stable_vector
- moved utility::c_array to container::c_array
- created static_vector: std::vector bound to std::array
- created stable_vector: vector with stable references
* grow thread_data when new thread created
* causal updates
- data: improve compute_eligible_lines to ignore lambdas
- data: use new thread_data
- delay: use new thread_data
- experiment: properly support latency points
- experiment: support file clobber
- experiment: ensure non-zero experiment time
- progress_point: use new thread_data
- backtrace_causal: use new thread_data
* Update causal-profiling tests
* fix omnitrace-causal backslash escaping
* process-causal-json script
* restructure causal implementation
- update verbose messages for omnitrace-causal diagnose_status
- migrated causal implementation in sampling.cpp to causal/sampling.cpp
- OMNITRACE_USE_CAUSAL does not require OMNITRACE_USE_SAMPLING
- added Mode::Causal
- causal sampling uses same signals as regular sampling
- moved tracing::thread_init to implementation file
- combined tracing::thread_init and tracing::thread_init_sampling
- added causal/components folder
- pthread_create_gotcha::wrapper_config
- omnitrace_preload checks OMNITRACE_USE_CAUSAL
- updates mode accordingly
* update timemory submodule
* update timemory submodule
* causal example updates
- causal for lulesh
* perf code + utility - helpers
- relocated causal perf code
- placement new when generating unique ptr trait for potentially allocating during sampling
- additions to utility header
- removed previously added helpers.hpp
* update timemory submodule
* Default env variables for omnitrace-causal
- activate OMNITRACE_USE_KOKKOSP, etc.
* update stable_vector and static_vector
- static vector can use atomic for size tracking for thread-safe situations
* update causal example header
- CAUSAL_PROGRESS_NAMED
- use CAUSAL_ prefix for some macros
* Tweak lulesh example
- use CAUSAL_PROGRESS instead of CAUSAL_BEGIN and CAUSAL_END
* omnitrace-sample support for causal mode
- set OMNITRACE_USE_SAMPLING to off when OMNITRACE_MODE=causal
* refactor and cleanup code_object
- scope filter
- fixes to address_range
* overhaul causal data + causal config options
- full support for function and line mode
- support static vector of instruction pointers
- improve line info mapping resolution
- remove thread-locality from miscellanous functions where unnecessary
- causal options for {binary,source,function,fileline} exclusion
* causal experiment, sampling, and backtrace updates
- is_selected + unwind address array
- experiment warning about progress points
- increased buffer size for backtrace_casual sampler
- backtrace_causal only stores IP addresses instead of full unwind info
* category_region updates
- minor refactor
- local_category_region::mark
* Update causal tests
* Bump version to 1.8.0
* omnitrace-causal args + CLOBBER -> RESET
- renamed OMNITRACE_CAUSAL_FILE_CLOBBER to OMNITRACE_CAUSAL_FILE_RESET
- updated omnitrace-causal exe to support recently added configuration options
- other miscellaneous tweaks to data.cpp, experiment.cpp, and sampling.cpp
* Refactor causal and code_object
- code_object.hpp and code_object.cpp moved into binary folder
- causal components namespaced into omnitrace::causal::component
- moved sample_data out of backtrace_causal and into own file
- renamed backtrace_causal to causal::component::backtrace
* preload omnitrace_init + OMNITRACE_DEBUG_MARK
- env OMNITRACE_DEBUG_MARK
- fix omnitrace_init call when LD_PRELOAD-ing omnitrace
* Fix fileline support + line-info output names + experiment log
- line-info log files are prefixed with experiment name
- don't print experiment duration when E2E
- account for fileline scope in analysis
* KokkosP: OMNITRACE_KOKKOSP_NAME_LENGTH_MAX
- config option to limit the name of kokkos tool callbacks
- remove [kokkos] from KokkosP names
* Update causal example
- minor tweaks to decrease probability of overlapping regions in binary
* omnitrace-causal update
- prefix N / Ntot in environment printout
* Miscellaneous updates
- causal::finish_experimenting()
- OMNITRACE_CAUSAL_RANDOM_SEED
- KokkosP causal updates
- exclude some callbacks, make some callbacks unique, etc.
- address_range::operator+=(address_range)
- combine contiguous ranges in binary/analysis.cpp when file, func, line is same and address range is contiguous
- bfd_line_info reads inline info
- wait for perform_experiment_impl to complete
- causal::delay updates
- delay::process checks if experiment is active
- uses threading::get_id()
- experiment scales duration up for larger speedup experiments
- line info samples includes excluded lines
- sampler uses CLOCK_REALTIME
- blocking_gotcha updates
- is no longer fully static
- adds audit routine which sets the postblock value to zero if try/timed routine fails
- category::host was added to causal_throughput_categories_t
- pthread_create_gotcha sets new threads local parent delay
- was using internal value, now uses sequent value
* Causal improvements to KokkosP
* Updates to experiment time scaling
- use stats instead of just max
* binary/link_map.{hpp,cpp}
* update process-causal-json.py
* Folded fileline scope into source scope
* Update documentation
- Add documentation for causal profiling
- Replace 'Omnitrace' with 'OmniTrace' everywhere
* Update causal-helpers.cmake + omnitrace-testing.cmake
- split tests/CMakeLists.txt partially into omnitrace-testing.cmake
* omnitrace/causal.h
- OMNITRACE_CAUSAL_PROGRESS
- OMNITRACE_CAUSAL_PROGRESS_NAMED
- OMNITRACE_CAUSAL_BEGIN
- OMNITRACE_CAUSAL_END
* selected_entry + remove default filters for lambdas and operator()
- selected entry stores range and binary load address
* update process-causal-json.py
* format examples/lulesh/CMakeLists.txt
* causal-helpers find_package(Threads)
* OMNITRACE_KOKKOSP_KERNEL_LOGGER
- was OMNITRACE_KOKKOS_KERNEL_LOGGER
* quiet find of coz-profiler
* Fix rocm_smi exception handling
* Update timemory submodule (binutils)
- fix binutls compile error on some systems
- bump binutils to v2.40
* Fix miscellaneous tests
* OMNITRACE_KOKKOSP_PREFIX
* revert rocm_smi handling
* ElfUtils updates
- default to download version 0.188
- add -Wno-error=null-dereference due to GCC 12 compiler error
* Update causal example
* Remove OMNITRACE_VERBOSE from global workflow envs
* Reliable causal test
* disable compilation of causal perf files
* Remove set_current_selection with unwind stack
* update timemory submodule
* fix for segfault on bionic
- locking in TLS dtor was causing segfault
* remove experiment::is_selected(unwind_stack_t)
* update default init of selected_entry
* Fix for when IP is not offset by load address
* Update CMakeLists.txt
* Miscellaneous updates
- OMNITRACE_WARNING_OR_CI_THROW
- OMNITRACE_REQUIRE
- OMNITRACE_PREFER
- fixed issues with no ASLR
- added load address variable and ipaddr() func to basic/bfd line info
- removed get_basic() from dwarf_line_info
- TIMEMORY_PREFER -> OMNITRACE_PREFER
- removed previously added binary_address and range variables from selected_entry
* Removed superfluous CausalState
* Additional causal tests (lulesh + kokkos)
* filter, prefer, analysis ASLR handling
- removed default filter on cold functions
- fixed OMNITRACE_PREFER
- fixed analysis ASLR handling
* Tweak line-info output
* Removed some superfluous code
- causal/delay
- causal/selected_entry
* Exclude main.cold in function mode
* Update validate-perfetto-proto.py
- account for occasional http errors
* Add sampling test disabling tmp files
* argparser for process-causal-json
- support validation
- support filtering
* Avoid pthread_{lock,unlock} in sampling offload
- use homemade atomic_mutex/atomic_lock since contention will be low and using pthread tools might trigger our wrappers
* Rename process-causal-json.py
- validate-causal-json.py
* rework omnitrace_add_causal_test
- capable of performing validation
- added validation tests
* Fix kokkosp_begin_deep_copy + causal
* Tweak address range in bfd_line_info::read_pc
* Tweak analysis and data IP handling
- look for gaps
* Disable scaling experiment time by speedup
* Revert change in max threads during CI
* binary updates
- significant overhaul of binary analysis implementation
- removed "basic_line_info" and "bfd_line_info" in lieu of "symbol" class
- symbol class has basic BFD info + vector of inlines + vector of dwarf info
* Updated causal to use new binary analysis
- Fix symbol.cpp includes
* Updated formatting target
- include *.cmake files
* Updated causal tests
- causal tests should be stable now
* Update timemory and dyninst submodules
- TPLs are stripped + built w/o debug info
* Increase tolerance for causal validation speedups
- higher speedups have more variance (increased to +/- 5 from 3)
* Support causal output for MPI
- i.e. tag with MPI rank
* omnitrace-causal launcher argument
* improve experiment sampling output
* causal data updates
- call compute lines once
- fixed filtered cached binary info
- debugging info when experiment fails to start
* Tweaked causal validation tests
* dwarf_entry ranges
* CI updates
- increase max threads to 64
* Tweak causal E2E validation tests
- more threads
- shorter thread runtime
- more iterations
* Fix shadowed variable
* fix symbol read_bfd last PC calculation
* fix maybe-uninitialized warning
* omnitrace-causal launcher update
- only inject "omnitrace-causal --" once
- throw error if no matches found
* Update causal profiling docs for launcher
* fix address range boundaries
956 lines
34 KiB
CMake
956 lines
34 KiB
CMake
# include guard
|
|
include_guard(DIRECTORY)
|
|
|
|
# ########################################################################################
|
|
#
|
|
# External Packages are found here
|
|
#
|
|
# ########################################################################################
|
|
|
|
omnitrace_add_interface_library(
|
|
omnitrace-headers "Provides minimal set of include flags to compile with omnitrace")
|
|
omnitrace_add_interface_library(omnitrace-threading "Enables multithreading support")
|
|
omnitrace_add_interface_library(
|
|
omnitrace-dyninst
|
|
"Provides flags and libraries for Dyninst (dynamic instrumentation)")
|
|
omnitrace_add_interface_library(omnitrace-hip "Provides flags and libraries for HIP")
|
|
omnitrace_add_interface_library(omnitrace-roctracer
|
|
"Provides flags and libraries for roctracer")
|
|
omnitrace_add_interface_library(omnitrace-rocprofiler
|
|
"Provides flags and libraries for rocprofiler")
|
|
omnitrace_add_interface_library(omnitrace-rocm-smi
|
|
"Provides flags and libraries for rocm-smi")
|
|
omnitrace_add_interface_library(
|
|
omnitrace-rccl "Provides flags for ROCm Communication Collectives Library (RCCL)")
|
|
omnitrace_add_interface_library(omnitrace-mpi "Provides MPI or MPI headers")
|
|
omnitrace_add_interface_library(omnitrace-bfd "Provides Binary File Descriptor (BFD)")
|
|
omnitrace_add_interface_library(omnitrace-ptl "Enables PTL support (tasking)")
|
|
omnitrace_add_interface_library(omnitrace-papi "Enable PAPI support")
|
|
omnitrace_add_interface_library(omnitrace-ompt "Enable OMPT support")
|
|
omnitrace_add_interface_library(omnitrace-python "Enables Python support")
|
|
omnitrace_add_interface_library(omnitrace-elfutils "Provides ElfUtils")
|
|
omnitrace_add_interface_library(omnitrace-perfetto "Enables Perfetto support")
|
|
omnitrace_add_interface_library(omnitrace-timemory "Provides timemory libraries")
|
|
omnitrace_add_interface_library(omnitrace-timemory-config
|
|
"CMake interface library applied to all timemory targets")
|
|
omnitrace_add_interface_library(omnitrace-compile-definitions "Compile definitions")
|
|
|
|
# libraries with relevant compile definitions
|
|
set(OMNITRACE_EXTENSION_LIBRARIES
|
|
omnitrace::omnitrace-hip
|
|
omnitrace::omnitrace-roctracer
|
|
omnitrace::omnitrace-rocprofiler
|
|
omnitrace::omnitrace-rocm-smi
|
|
omnitrace::omnitrace-rccl
|
|
omnitrace::omnitrace-bfd
|
|
omnitrace::omnitrace-mpi
|
|
omnitrace::omnitrace-ptl
|
|
omnitrace::omnitrace-ompt
|
|
omnitrace::omnitrace-papi
|
|
omnitrace::omnitrace-perfetto)
|
|
|
|
target_include_directories(
|
|
omnitrace-headers
|
|
INTERFACE ${PROJECT_BINARY_DIR}/source/lib ${PROJECT_BINARY_DIR}/source/lib/omnitrace
|
|
${PROJECT_SOURCE_DIR}/source/lib ${PROJECT_SOURCE_DIR}/source/lib/omnitrace
|
|
${PROJECT_SOURCE_DIR}/source/lib/omnitrace-user)
|
|
|
|
# include threading because of rooflines
|
|
target_link_libraries(omnitrace-headers INTERFACE omnitrace::omnitrace-threading)
|
|
|
|
# ensure the env overrides the appending /opt/rocm later
|
|
string(REPLACE ":" ";" CMAKE_PREFIX_PATH "$ENV{CMAKE_PREFIX_PATH};${CMAKE_PREFIX_PATH}")
|
|
|
|
set(OMNITRACE_DEFAULT_ROCM_PATH
|
|
/opt/rocm
|
|
CACHE PATH "Default search path for ROCM")
|
|
if(EXISTS ${OMNITRACE_DEFAULT_ROCM_PATH})
|
|
get_filename_component(_OMNITRACE_DEFAULT_ROCM_PATH "${OMNITRACE_DEFAULT_ROCM_PATH}"
|
|
REALPATH)
|
|
|
|
if(NOT "${_OMNITRACE_DEFAULT_ROCM_PATH}" STREQUAL "${OMNITRACE_DEFAULT_ROCM_PATH}")
|
|
set(OMNITRACE_DEFAULT_ROCM_PATH
|
|
"${_OMNITRACE_DEFAULT_ROCM_PATH}"
|
|
CACHE PATH "Default search path for ROCM" FORCE)
|
|
endif()
|
|
endif()
|
|
|
|
# ----------------------------------------------------------------------------------------#
|
|
#
|
|
# Threading
|
|
#
|
|
# ----------------------------------------------------------------------------------------#
|
|
|
|
set(CMAKE_THREAD_PREFER_PTHREAD ON)
|
|
set(THREADS_PREFER_PTHREAD_FLAG OFF)
|
|
|
|
find_library(pthread_LIBRARY NAMES pthread pthreads)
|
|
find_package_handle_standard_args(pthread-library REQUIRED_VARS pthread_LIBRARY)
|
|
|
|
find_library(pthread_LIBRARY NAMES pthread pthreads)
|
|
find_package_handle_standard_args(pthread-library REQUIRED_VARS pthread_LIBRARY)
|
|
|
|
if(pthread_LIBRARY)
|
|
target_link_libraries(omnitrace-threading INTERFACE ${pthread_LIBRARY})
|
|
else()
|
|
find_package(Threads ${omnitrace_FIND_QUIETLY} ${omnitrace_FIND_REQUIREMENT})
|
|
if(Threads_FOUND)
|
|
target_link_libraries(omnitrace-threading INTERFACE Threads::Threads)
|
|
endif()
|
|
endif()
|
|
|
|
foreach(_LIB dl rt)
|
|
find_library(${_LIB}_LIBRARY NAMES ${_LIB})
|
|
find_package_handle_standard_args(${_LIB}-library REQUIRED_VARS ${_LIB}_LIBRARY)
|
|
if(${_LIB}_LIBRARY)
|
|
target_link_libraries(omnitrace-threading INTERFACE ${${_LIB}_LIBRARY})
|
|
endif()
|
|
endforeach()
|
|
|
|
# ----------------------------------------------------------------------------------------#
|
|
#
|
|
# hip version
|
|
#
|
|
# ----------------------------------------------------------------------------------------#
|
|
|
|
if(OMNITRACE_USE_HIP
|
|
OR OMNITRACE_USE_ROCTRACER
|
|
OR OMNITRACE_USE_ROCPROFILER
|
|
OR OMNITRACE_USE_ROCM_SMI)
|
|
find_package(ROCmVersion)
|
|
|
|
if(NOT ROCmVersion_FOUND)
|
|
find_package(hip ${omnitrace_FIND_QUIETLY} REQUIRED HINTS
|
|
${OMNITRACE_DEFAULT_ROCM_PATH} PATHS ${OMNITRACE_DEFAULT_ROCM_PATH})
|
|
if(SPACK_BUILD)
|
|
find_package(ROCmVersion HINTS ${ROCM_PATH} PATHS ${ROCM_PATH})
|
|
else()
|
|
find_package(ROCmVersion REQUIRED HINTS ${ROCM_PATH} PATHS ${ROCM_PATH})
|
|
endif()
|
|
endif()
|
|
|
|
if(NOT ROCmVersion_FOUND)
|
|
rocm_version_compute("${hip_VERSION}" _local)
|
|
|
|
foreach(_V ${ROCmVersion_VARIABLES})
|
|
set(_CACHE_VAR ROCmVersion_${_V}_VERSION)
|
|
set(_LOCAL_VAR _local_${_V}_VERSION)
|
|
set(ROCmVersion_${_V}_VERSION
|
|
"${${_LOCAL_VAR}}"
|
|
CACHE STRING "ROCm ${_V} version")
|
|
rocm_version_watch_for_change(${_CACHE_VAR})
|
|
endforeach()
|
|
else()
|
|
list(APPEND CMAKE_PREFIX_PATH ${ROCmVersion_DIR})
|
|
endif()
|
|
|
|
set(OMNITRACE_ROCM_VERSION ${ROCmVersion_FULL_VERSION})
|
|
set(OMNITRACE_HIP_VERSION_MAJOR ${ROCmVersion_MAJOR_VERSION})
|
|
set(OMNITRACE_HIP_VERSION_MINOR ${ROCmVersion_MINOR_VERSION})
|
|
set(OMNITRACE_HIP_VERSION_PATCH ${ROCmVersion_PATCH_VERSION})
|
|
set(OMNITRACE_HIP_VERSION ${ROCmVersion_TRIPLE_VERSION})
|
|
|
|
if(OMNITRACE_HIP_VERSION_MAJOR GREATER_EQUAL 4 AND OMNITRACE_HIP_VERSION_MINOR
|
|
GREATER 3)
|
|
set(roctracer_kfdwrapper_LIBRARY)
|
|
endif()
|
|
|
|
if(NOT roctracer_kfdwrapper_LIBRARY)
|
|
set(roctracer_kfdwrapper_LIBRARY)
|
|
endif()
|
|
|
|
omnitrace_add_feature(OMNITRACE_ROCM_VERSION "ROCm version used by omnitrace")
|
|
else()
|
|
set(OMNITRACE_HIP_VERSION "0.0.0")
|
|
set(OMNITRACE_HIP_VERSION_MAJOR 0)
|
|
set(OMNITRACE_HIP_VERSION_MINOR 0)
|
|
set(OMNITRACE_HIP_VERSION_PATCH 0)
|
|
endif()
|
|
|
|
# ----------------------------------------------------------------------------------------#
|
|
#
|
|
# HIP
|
|
#
|
|
# ----------------------------------------------------------------------------------------#
|
|
|
|
if(OMNITRACE_USE_HIP)
|
|
find_package(hip ${omnitrace_FIND_QUIETLY} REQUIRED)
|
|
omnitrace_target_compile_definitions(omnitrace-hip INTERFACE OMNITRACE_USE_HIP)
|
|
target_link_libraries(omnitrace-hip INTERFACE hip::host)
|
|
endif()
|
|
|
|
# ----------------------------------------------------------------------------------------#
|
|
#
|
|
# roctracer
|
|
#
|
|
# ----------------------------------------------------------------------------------------#
|
|
|
|
if(OMNITRACE_USE_ROCTRACER)
|
|
find_package(roctracer ${omnitrace_FIND_QUIETLY} REQUIRED)
|
|
omnitrace_target_compile_definitions(omnitrace-roctracer
|
|
INTERFACE OMNITRACE_USE_ROCTRACER)
|
|
target_link_libraries(omnitrace-roctracer INTERFACE roctracer::roctracer
|
|
omnitrace::omnitrace-hip)
|
|
endif()
|
|
|
|
# ----------------------------------------------------------------------------------------#
|
|
#
|
|
# rocprofiler
|
|
#
|
|
# ----------------------------------------------------------------------------------------#
|
|
if(OMNITRACE_USE_ROCPROFILER)
|
|
find_package(rocprofiler ${omnitrace_FIND_QUIETLY} REQUIRED)
|
|
omnitrace_target_compile_definitions(omnitrace-rocprofiler
|
|
INTERFACE OMNITRACE_USE_ROCPROFILER)
|
|
target_link_libraries(omnitrace-rocprofiler INTERFACE rocprofiler::rocprofiler)
|
|
endif()
|
|
|
|
# ----------------------------------------------------------------------------------------#
|
|
#
|
|
# rocm-smi
|
|
#
|
|
# ----------------------------------------------------------------------------------------#
|
|
|
|
if(OMNITRACE_USE_ROCM_SMI)
|
|
find_package(rocm-smi ${omnitrace_FIND_QUIETLY} REQUIRED)
|
|
omnitrace_target_compile_definitions(omnitrace-rocm-smi
|
|
INTERFACE OMNITRACE_USE_ROCM_SMI)
|
|
target_link_libraries(omnitrace-rocm-smi INTERFACE rocm-smi::rocm-smi)
|
|
endif()
|
|
|
|
# ----------------------------------------------------------------------------------------#
|
|
#
|
|
# RCCL
|
|
#
|
|
# ----------------------------------------------------------------------------------------#
|
|
if(OMNITRACE_USE_RCCL)
|
|
find_package(RCCL-Headers ${omnitrace_FIND_QUIETLY} REQUIRED)
|
|
target_link_libraries(omnitrace-rccl INTERFACE roc::rccl-headers)
|
|
omnitrace_target_compile_definitions(omnitrace-rccl INTERFACE OMNITRACE_USE_RCCL)
|
|
endif()
|
|
|
|
# ----------------------------------------------------------------------------------------#
|
|
#
|
|
# MPI
|
|
#
|
|
# ----------------------------------------------------------------------------------------#
|
|
|
|
# suppress warning during CI that MPI_HEADERS_ALLOW_MPICH was unused
|
|
set(_OMNITRACE_MPI_HEADERS_ALLOW_MPICH ${MPI_HEADERS_ALLOW_MPICH})
|
|
|
|
if(OMNITRACE_USE_MPI)
|
|
find_package(MPI ${omnitrace_FIND_QUIETLY} REQUIRED)
|
|
target_link_libraries(omnitrace-mpi INTERFACE MPI::MPI_C MPI::MPI_CXX)
|
|
omnitrace_target_compile_definitions(omnitrace-mpi INTERFACE TIMEMORY_USE_MPI=1
|
|
OMNITRACE_USE_MPI)
|
|
elseif(OMNITRACE_USE_MPI_HEADERS)
|
|
find_package(MPI-Headers ${omnitrace_FIND_QUIETLY} REQUIRED)
|
|
omnitrace_target_compile_definitions(
|
|
omnitrace-mpi INTERFACE TIMEMORY_USE_MPI_HEADERS=1 OMNITRACE_USE_MPI_HEADERS)
|
|
target_link_libraries(omnitrace-mpi INTERFACE MPI::MPI_HEADERS)
|
|
endif()
|
|
|
|
# ----------------------------------------------------------------------------------------#
|
|
#
|
|
# OMPT
|
|
#
|
|
# ----------------------------------------------------------------------------------------#
|
|
|
|
omnitrace_target_compile_definitions(
|
|
omnitrace-ompt INTERFACE OMNITRACE_USE_OMPT=$<BOOL:${OMNITRACE_USE_OMPT}>)
|
|
|
|
# ----------------------------------------------------------------------------------------#
|
|
#
|
|
# ElfUtils
|
|
#
|
|
# ----------------------------------------------------------------------------------------#
|
|
|
|
include(ElfUtils)
|
|
|
|
target_include_directories(omnitrace-elfutils SYSTEM INTERFACE ${ElfUtils_INCLUDE_DIRS})
|
|
target_compile_definitions(omnitrace-elfutils INTERFACE ${ElfUtils_DEFINITIONS})
|
|
target_link_directories(omnitrace-elfutils INTERFACE ${ElfUtils_LIBRARY_DIRS})
|
|
target_link_libraries(omnitrace-elfutils INTERFACE ${ElfUtils_LIBRARIES})
|
|
|
|
# ----------------------------------------------------------------------------------------#
|
|
#
|
|
# Dyninst
|
|
#
|
|
# ----------------------------------------------------------------------------------------#
|
|
|
|
if(OMNITRACE_BUILD_DYNINST)
|
|
omnitrace_checkout_git_submodule(
|
|
RELATIVE_PATH external/dyninst
|
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
|
REPO_URL https://github.com/jrmadsen/dyninst.git
|
|
REPO_BRANCH omnitrace)
|
|
|
|
set(DYNINST_OPTION_PREFIX ON)
|
|
set(DYNINST_BUILD_DOCS 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")
|
|
|
|
if(NOT DEFINED CMAKE_INSTALL_RPATH)
|
|
set(CMAKE_INSTALL_RPATH "")
|
|
endif()
|
|
|
|
if(NOT DEFINED CMAKE_BUILD_RPATH)
|
|
set(CMAKE_BUILD_RPATH "")
|
|
endif()
|
|
|
|
omnitrace_save_variables(
|
|
PIC VARIABLES CMAKE_POSITION_INDEPENDENT_CODE CMAKE_INSTALL_RPATH
|
|
CMAKE_BUILD_RPATH CMAKE_INSTALL_RPATH_USE_LINK_PATH)
|
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
|
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH OFF)
|
|
set(CMAKE_BUILD_RPATH "\$ORIGIN:\$ORIGIN/omnitrace")
|
|
set(CMAKE_INSTALL_RPATH "\$ORIGIN:\$ORIGIN/omnitrace")
|
|
set(DYNINST_TPL_INSTALL_PREFIX
|
|
"omnitrace"
|
|
CACHE PATH "Third-party library install-tree install prefix" FORCE)
|
|
set(DYNINST_TPL_INSTALL_LIB_DIR
|
|
"omnitrace"
|
|
CACHE PATH "Third-party library install-tree install library prefix" FORCE)
|
|
add_subdirectory(external/dyninst EXCLUDE_FROM_ALL)
|
|
omnitrace_restore_variables(
|
|
PIC VARIABLES CMAKE_POSITION_INDEPENDENT_CODE CMAKE_INSTALL_RPATH
|
|
CMAKE_BUILD_RPATH CMAKE_INSTALL_RPATH_USE_LINK_PATH)
|
|
|
|
add_library(Dyninst::Dyninst INTERFACE IMPORTED)
|
|
foreach(_LIB common dyninstAPI parseAPI instructionAPI symtabAPI stackwalk)
|
|
target_link_libraries(Dyninst::Dyninst INTERFACE Dyninst::${_LIB})
|
|
endforeach()
|
|
|
|
foreach(
|
|
_LIB
|
|
common
|
|
dynDwarf
|
|
dynElf
|
|
dyninstAPI
|
|
dyninstAPI_RT
|
|
instructionAPI
|
|
parseAPI
|
|
patchAPI
|
|
pcontrol
|
|
stackwalk
|
|
symtabAPI)
|
|
if(TARGET ${_LIB})
|
|
install(
|
|
TARGETS ${_LIB}
|
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/omnitrace
|
|
COMPONENT dyninst
|
|
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/omnitrace/dyninst)
|
|
endif()
|
|
endforeach()
|
|
|
|
omnitrace_install_tpl(dyninstAPI_RT omnitrace-rt
|
|
"${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}" core)
|
|
|
|
# for packaging
|
|
install(
|
|
DIRECTORY ${DYNINST_TPL_STAGING_PREFIX}/lib/
|
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/omnitrace
|
|
COMPONENT dyninst
|
|
FILES_MATCHING
|
|
PATTERN "*${CMAKE_SHARED_LIBRARY_SUFFIX}*")
|
|
|
|
target_link_libraries(omnitrace-dyninst INTERFACE Dyninst::Dyninst)
|
|
|
|
set(OMNITRACE_DYNINST_API_RT
|
|
${PROJECT_BINARY_DIR}/external/dyninst/dyninstAPI_RT/libdyninstAPI_RT${CMAKE_SHARED_LIBRARY_SUFFIX}
|
|
)
|
|
|
|
if(OMNITRACE_DYNINST_API_RT)
|
|
omnitrace_target_compile_definitions(
|
|
omnitrace-dyninst
|
|
INTERFACE
|
|
DYNINST_API_RT="${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}:$<TARGET_FILE_DIR:Dyninst::dyninstAPI_RT>:${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/$<TARGET_FILE_NAME:Dyninst::dyninstAPI_RT>:$<TARGET_FILE:Dyninst::dyninstAPI_RT>"
|
|
)
|
|
endif()
|
|
|
|
else()
|
|
find_package(Dyninst ${omnitrace_FIND_QUIETLY} REQUIRED
|
|
COMPONENTS dyninstAPI parseAPI instructionAPI symtabAPI)
|
|
|
|
if(TARGET Dyninst::Dyninst) # updated Dyninst CMake system was found
|
|
# useful for defining the location of the runtime API
|
|
find_library(
|
|
OMNITRACE_DYNINST_API_RT dyninstAPI_RT
|
|
HINTS ${Dyninst_ROOT_DIR} ${Dyninst_DIR}
|
|
PATHS ${Dyninst_ROOT_DIR} ${Dyninst_DIR}
|
|
PATH_SUFFIXES lib NO_CACHE)
|
|
|
|
if(OMNITRACE_DYNINST_API_RT)
|
|
omnitrace_target_compile_definitions(
|
|
omnitrace-dyninst INTERFACE DYNINST_API_RT="${OMNITRACE_DYNINST_API_RT}")
|
|
endif()
|
|
|
|
target_link_libraries(omnitrace-dyninst INTERFACE Dyninst::Dyninst)
|
|
else() # updated Dyninst CMake system was not found
|
|
set(_BOOST_COMPONENTS atomic system thread date_time)
|
|
set(omnitrace_BOOST_COMPONENTS
|
|
"${_BOOST_COMPONENTS}"
|
|
CACHE STRING "Boost components used by Dyninst in omnitrace")
|
|
set(Boost_NO_BOOST_CMAKE ON)
|
|
find_package(Boost QUIET REQUIRED COMPONENTS ${omnitrace_BOOST_COMPONENTS})
|
|
|
|
# some installs of dyninst don't set this properly
|
|
if(EXISTS "${DYNINST_INCLUDE_DIR}" AND NOT DYNINST_HEADER_DIR)
|
|
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)
|
|
endif()
|
|
|
|
# useful for defining the location of the runtime API
|
|
find_library(
|
|
OMNITRACE_DYNINST_API_RT dyninstAPI_RT
|
|
HINTS ${Dyninst_ROOT_DIR} ${Dyninst_DIR}
|
|
PATHS ${Dyninst_ROOT_DIR} ${Dyninst_DIR}
|
|
PATH_SUFFIXES lib)
|
|
|
|
# try to find TBB
|
|
find_package(TBB QUIET)
|
|
|
|
# if fail try to use the Dyninst installed FindTBB.cmake
|
|
if(NOT TBB_FOUND)
|
|
list(APPEND CMAKE_MODULE_PATH ${Dyninst_DIR}/Modules)
|
|
find_package(TBB QUIET)
|
|
endif()
|
|
|
|
if(NOT TBB_FOUND)
|
|
find_path(
|
|
TBB_INCLUDE_DIR
|
|
NAMES tbb/tbb.h
|
|
PATH_SUFFIXES include)
|
|
endif()
|
|
|
|
if(OMNITRACE_DYNINST_API_RT)
|
|
omnitrace_target_compile_definitions(
|
|
omnitrace-dyninst INTERFACE DYNINST_API_RT="${OMNITRACE_DYNINST_API_RT}")
|
|
endif()
|
|
|
|
target_link_libraries(omnitrace-dyninst INTERFACE ${DYNINST_LIBRARIES}
|
|
${Boost_LIBRARIES})
|
|
foreach(
|
|
_TARG
|
|
dyninst
|
|
dyninstAPI
|
|
instructionAPI
|
|
symtabAPI
|
|
parseAPI
|
|
headers
|
|
atomic
|
|
system
|
|
thread
|
|
date_time
|
|
TBB)
|
|
if(TARGET Dyninst::${_TARG})
|
|
target_link_libraries(omnitrace-dyninst INTERFACE Dyninst::${_TARG})
|
|
elseif(TARGET Boost::${_TARG})
|
|
target_link_libraries(omnitrace-dyninst INTERFACE Boost::${_TARG})
|
|
elseif(TARGET ${_TARG})
|
|
target_link_libraries(omnitrace-dyninst INTERFACE ${_TARG})
|
|
endif()
|
|
endforeach()
|
|
target_include_directories(
|
|
omnitrace-dyninst SYSTEM INTERFACE ${TBB_INCLUDE_DIR} ${Boost_INCLUDE_DIRS}
|
|
${DYNINST_HEADER_DIR})
|
|
omnitrace_target_compile_definitions(omnitrace-dyninst
|
|
INTERFACE OMNITRACE_USE_DYNINST)
|
|
endif()
|
|
endif()
|
|
|
|
# ----------------------------------------------------------------------------------------#
|
|
#
|
|
# Modify CMAKE_C_FLAGS and CMAKE_CXX_FLAGS with -static-libgcc and -static-libstdc++
|
|
#
|
|
# ----------------------------------------------------------------------------------------#
|
|
|
|
if(OMNITRACE_BUILD_STATIC_LIBGCC)
|
|
if(CMAKE_C_COMPILER_ID MATCHES "GNU")
|
|
omnitrace_save_variables(STATIC_LIBGCC_C VARIABLES CMAKE_C_FLAGS)
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static-libgcc")
|
|
endif()
|
|
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
|
omnitrace_save_variables(STATIC_LIBGCC_CXX VARIABLES CMAKE_CXX_FLAGS)
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc")
|
|
else()
|
|
set(OMNITRACE_BUILD_STATIC_LIBGCC OFF)
|
|
endif()
|
|
endif()
|
|
|
|
if(OMNITRACE_BUILD_STATIC_LIBSTDCXX)
|
|
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
|
omnitrace_save_variables(STATIC_LIBSTDCXX_CXX VARIABLES CMAKE_CXX_FLAGS)
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libstdc++")
|
|
else()
|
|
set(OMNITRACE_BUILD_STATIC_LIBSTDCXX OFF)
|
|
endif()
|
|
endif()
|
|
|
|
# ----------------------------------------------------------------------------------------#
|
|
#
|
|
# Perfetto
|
|
#
|
|
# ----------------------------------------------------------------------------------------#
|
|
|
|
set(perfetto_DIR ${PROJECT_SOURCE_DIR}/external/perfetto)
|
|
omnitrace_checkout_git_submodule(
|
|
RELATIVE_PATH external/perfetto
|
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
|
REPO_URL https://android.googlesource.com/platform/external/perfetto
|
|
REPO_BRANCH v17.0
|
|
TEST_FILE sdk/perfetto.cc)
|
|
|
|
include(Perfetto)
|
|
|
|
# ----------------------------------------------------------------------------------------#
|
|
#
|
|
# ELFIO
|
|
#
|
|
# ----------------------------------------------------------------------------------------#
|
|
|
|
if(OMNITRACE_BUILD_DEVICETRACE)
|
|
omnitrace_checkout_git_submodule(
|
|
RELATIVE_PATH external/elfio
|
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
|
REPO_URL https://github.com/jrmadsen/ELFIO.git
|
|
REPO_BRANCH set-offset-support)
|
|
|
|
add_subdirectory(external/elfio)
|
|
endif()
|
|
|
|
# ----------------------------------------------------------------------------------------#
|
|
#
|
|
# papi submodule
|
|
#
|
|
# ----------------------------------------------------------------------------------------#
|
|
|
|
if(OMNITRACE_USE_PAPI AND OMNITRACE_BUILD_PAPI)
|
|
include(PAPI)
|
|
endif()
|
|
|
|
# ----------------------------------------------------------------------------------------#
|
|
#
|
|
# timemory submodule
|
|
#
|
|
# ----------------------------------------------------------------------------------------#
|
|
|
|
target_compile_definitions(
|
|
omnitrace-timemory-config
|
|
INTERFACE TIMEMORY_PAPI_ARRAY_SIZE=12 TIMEMORY_USE_ROOFLINE=0 TIMEMORY_USE_ERT=0
|
|
TIMEMORY_USE_CONTAINERS=0 TIMEMORY_USE_ERT_EXTERN=0
|
|
TIMEMORY_USE_CONTAINERS_EXTERN=0)
|
|
|
|
if(OMNITRACE_BUILD_STACK_PROTECTOR)
|
|
add_target_flag_if_avail(omnitrace-timemory-config "-fstack-protector-strong"
|
|
"-Wstack-protector")
|
|
endif()
|
|
|
|
if(OMNITRACE_BUILD_DEBUG)
|
|
add_target_flag_if_avail(omnitrace-timemory-config "-fno-omit-frame-pointer" "-g3")
|
|
endif()
|
|
|
|
set(TIMEMORY_EXTERNAL_INTERFACE_LIBRARY
|
|
omnitrace-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")
|
|
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")
|
|
set(TIMEMORY_BUILD_EXCLUDE_FROM_ALL
|
|
ON
|
|
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")
|
|
|
|
# timemory feature settings
|
|
set(TIMEMORY_USE_MPI
|
|
${OMNITRACE_USE_MPI}
|
|
CACHE BOOL "Enable MPI support in timemory" FORCE)
|
|
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
|
|
${OMNITRACE_USE_OMPT}
|
|
CACHE BOOL "Enable OMPT support in timemory" FORCE)
|
|
set(TIMEMORY_USE_PAPI
|
|
${OMNITRACE_USE_PAPI}
|
|
CACHE BOOL "Enable PAPI support in timemory" FORCE)
|
|
set(TIMEMORY_USE_BFD
|
|
${OMNITRACE_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")
|
|
|
|
if(DEFINED TIMEMORY_BUILD_GOTCHA AND NOT TIMEMORY_BUILD_GOTCHA)
|
|
omnitrace_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)
|
|
set(TIMEMORY_BUILD_LIBUNWIND
|
|
${OMNITRACE_BUILD_LIBUNWIND}
|
|
CACHE BOOL "Enable building libunwind library from submodule" FORCE)
|
|
set(TIMEMORY_BUILD_EXTRA_OPTIMIZATIONS
|
|
${OMNITRACE_BUILD_EXTRA_OPTIMIZATIONS}
|
|
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)
|
|
|
|
# timemory build settings
|
|
set(TIMEMORY_TLS_MODEL
|
|
"global-dynamic"
|
|
CACHE STRING "Thread-local static model" FORCE)
|
|
set(TIMEMORY_MAX_THREADS
|
|
"${OMNITRACE_MAX_THREADS}"
|
|
CACHE STRING "Max statically-allocated threads" FORCE)
|
|
set(TIMEMORY_SETTINGS_PREFIX
|
|
"OMNITRACE_"
|
|
CACHE STRING "Prefix used for settings and environment variables")
|
|
set(TIMEMORY_PROJECT_NAME
|
|
"omnitrace"
|
|
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")
|
|
|
|
mark_as_advanced(TIMEMORY_SETTINGS_PREFIX)
|
|
mark_as_advanced(TIMEMORY_PROJECT_NAME)
|
|
|
|
omnitrace_checkout_git_submodule(
|
|
RELATIVE_PATH external/timemory
|
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
|
REPO_URL https://github.com/NERSC/timemory.git
|
|
REPO_BRANCH omnitrace)
|
|
|
|
omnitrace_save_variables(
|
|
BUILD_CONFIG VARIABLES BUILD_SHARED_LIBS BUILD_STATIC_LIBS
|
|
CMAKE_POSITION_INDEPENDENT_CODE CMAKE_PREFIX_PATH)
|
|
|
|
# ensure timemory builds PIC static libs so that we don't have to install timemory shared
|
|
# lib
|
|
set(BUILD_SHARED_LIBS OFF)
|
|
set(BUILD_STATIC_LIBS ON)
|
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
|
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)
|
|
endif()
|
|
|
|
add_subdirectory(external/timemory EXCLUDE_FROM_ALL)
|
|
|
|
install(
|
|
TARGETS gotcha
|
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/omnitrace
|
|
COMPONENT gotcha)
|
|
if(OMNITRACE_BUILD_LIBUNWIND)
|
|
install(
|
|
DIRECTORY ${PROJECT_BINARY_DIR}/external/timemory/external/libunwind/install/lib/
|
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/omnitrace
|
|
COMPONENT libunwind
|
|
FILES_MATCHING
|
|
PATTERN "*${CMAKE_SHARED_LIBRARY_SUFFIX}*")
|
|
endif()
|
|
|
|
omnitrace_restore_variables(
|
|
BUILD_CONFIG VARIABLES BUILD_SHARED_LIBS BUILD_STATIC_LIBS
|
|
CMAKE_POSITION_INDEPENDENT_CODE CMAKE_PREFIX_PATH)
|
|
|
|
if(TARGET omnitrace-papi-build)
|
|
foreach(_TARGET PAPI::papi timemory-core timemory-common timemory-papi-component
|
|
timemory-cxx)
|
|
if(TARGET "${_TARGET}")
|
|
add_dependencies(${_TARGET} omnitrace-papi-build)
|
|
endif()
|
|
foreach(_LINK shared static)
|
|
if(TARGET "${_TARGET}-${_LINK}")
|
|
add_dependencies(${_TARGET}-${_LINK} omnitrace-papi-build)
|
|
endif()
|
|
endforeach()
|
|
endforeach()
|
|
endif()
|
|
|
|
target_link_libraries(
|
|
omnitrace-timemory
|
|
INTERFACE $<BUILD_INTERFACE:timemory::timemory-headers>
|
|
$<BUILD_INTERFACE:timemory::timemory-gotcha>
|
|
$<BUILD_INTERFACE:timemory::timemory-cxx-static>)
|
|
|
|
target_link_libraries(omnitrace-bfd INTERFACE $<BUILD_INTERFACE:timemory::timemory-bfd>)
|
|
|
|
if(OMNITRACE_USE_BFD)
|
|
omnitrace_target_compile_definitions(omnitrace-bfd INTERFACE OMNITRACE_USE_BFD)
|
|
endif()
|
|
|
|
# ----------------------------------------------------------------------------------------#
|
|
#
|
|
# PTL (Parallel Tasking Library) submodule
|
|
#
|
|
# ----------------------------------------------------------------------------------------#
|
|
|
|
# timemory might provide PTL::ptl-shared
|
|
if(NOT TARGET PTL::ptl-shared)
|
|
omnitrace_checkout_git_submodule(
|
|
RELATIVE_PATH external/PTL
|
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
|
REPO_URL https://github.com/jrmadsen/PTL.git
|
|
REPO_BRANCH master)
|
|
|
|
set(PTL_BUILD_EXAMPLES OFF)
|
|
set(PTL_USE_TBB OFF)
|
|
set(PTL_USE_GPU OFF)
|
|
set(PTL_DEVELOPER_INSTALL OFF)
|
|
|
|
if(NOT DEFINED BUILD_OBJECT_LIBS)
|
|
set(BUILD_OBJECT_LIBS OFF)
|
|
endif()
|
|
omnitrace_save_variables(
|
|
BUILD_CONFIG
|
|
VARIABLES BUILD_SHARED_LIBS BUILD_STATIC_LIBS BUILD_OBJECT_LIBS
|
|
CMAKE_POSITION_INDEPENDENT_CODE CMAKE_CXX_VISIBILITY_PRESET
|
|
CMAKE_VISIBILITY_INLINES_HIDDEN)
|
|
|
|
set(BUILD_SHARED_LIBS OFF)
|
|
set(BUILD_STATIC_LIBS OFF)
|
|
set(BUILD_OBJECT_LIBS ON)
|
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
|
set(CMAKE_CXX_VISIBILITY_PRESET "hidden")
|
|
set(CMAKE_VISIBILITY_INLINES_HIDDEN ON)
|
|
|
|
add_subdirectory(external/PTL EXCLUDE_FROM_ALL)
|
|
|
|
omnitrace_restore_variables(
|
|
BUILD_CONFIG
|
|
VARIABLES BUILD_SHARED_LIBS BUILD_STATIC_LIBS BUILD_OBJECT_LIBS
|
|
CMAKE_POSITION_INDEPENDENT_CODE CMAKE_CXX_VISIBILITY_PRESET
|
|
CMAKE_VISIBILITY_INLINES_HIDDEN)
|
|
endif()
|
|
|
|
target_sources(omnitrace-ptl INTERFACE $<TARGET_OBJECTS:PTL::ptl-object>)
|
|
target_link_libraries(omnitrace-ptl INTERFACE PTL::ptl-object)
|
|
|
|
# ----------------------------------------------------------------------------------------#
|
|
#
|
|
# Restore the CMAKE_C_FLAGS and CMAKE_CXX_FLAGS in the inverse order
|
|
#
|
|
# ----------------------------------------------------------------------------------------#
|
|
|
|
# override compiler macros
|
|
include(Compilers)
|
|
|
|
if(OMNITRACE_BUILD_STATIC_LIBSTDCXX)
|
|
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
|
omnitrace_restore_variables(STATIC_LIBSTDCXX_CXX VARIABLES CMAKE_CXX_FLAGS)
|
|
endif()
|
|
endif()
|
|
|
|
if(OMNITRACE_BUILD_STATIC_LIBGCC)
|
|
if(CMAKE_C_COMPILER_ID MATCHES "GNU")
|
|
omnitrace_restore_variables(STATIC_LIBGCC_C VARIABLES CMAKE_C_FLAGS)
|
|
endif()
|
|
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
|
omnitrace_restore_variables(STATIC_LIBGCC_CXX VARIABLES CMAKE_CXX_FLAGS)
|
|
endif()
|
|
endif()
|
|
|
|
omnitrace_add_feature(CMAKE_C_FLAGS "C compiler flags")
|
|
omnitrace_add_feature(CMAKE_CXX_FLAGS "C++ compiler flags")
|
|
|
|
# ----------------------------------------------------------------------------------------#
|
|
#
|
|
# Python
|
|
#
|
|
# ----------------------------------------------------------------------------------------#
|
|
|
|
if(OMNITRACE_USE_PYTHON)
|
|
if(OMNITRACE_USE_PYTHON AND NOT OMNITRACE_BUILD_PYTHON)
|
|
find_package(pybind11 REQUIRED)
|
|
endif()
|
|
|
|
include(ConfigPython)
|
|
include(PyBind11Tools)
|
|
|
|
omnitrace_watch_for_change(OMNITRACE_PYTHON_ROOT_DIRS _PYTHON_DIRS_CHANGED)
|
|
|
|
if(_PYTHON_DIRS_CHANGED)
|
|
unset(OMNITRACE_PYTHON_VERSION CACHE)
|
|
unset(OMNITRACE_PYTHON_VERSIONS CACHE)
|
|
unset(OMNITRACE_INSTALL_PYTHONDIR CACHE)
|
|
else()
|
|
foreach(_VAR PREFIX ENVS)
|
|
omnitrace_watch_for_change(OMNITRACE_PYTHON_${_VAR} _CHANGED)
|
|
|
|
if(_CHANGED)
|
|
unset(OMNITRACE_PYTHON_ROOT_DIRS CACHE)
|
|
unset(OMNITRACE_PYTHON_VERSIONS CACHE)
|
|
unset(OMNITRACE_INSTALL_PYTHONDIR CACHE)
|
|
break()
|
|
endif()
|
|
endforeach()
|
|
endif()
|
|
|
|
if(OMNITRACE_PYTHON_PREFIX AND OMNITRACE_PYTHON_ENVS)
|
|
omnitrace_directory(
|
|
FAIL
|
|
PREFIX ${OMNITRACE_PYTHON_PREFIX}
|
|
PATHS ${OMNITRACE_PYTHON_ENVS}
|
|
OUTPUT_VARIABLE _PYTHON_ROOT_DIRS)
|
|
set(OMNITRACE_PYTHON_ROOT_DIRS
|
|
"${_PYTHON_ROOT_DIRS}"
|
|
CACHE INTERNAL "Root directories for python")
|
|
endif()
|
|
|
|
if(NOT OMNITRACE_PYTHON_VERSIONS AND OMNITRACE_PYTHON_VERSION)
|
|
set(OMNITRACE_PYTHON_VERSIONS "${OMNITRACE_PYTHON_VERSION}")
|
|
|
|
if(NOT OMNITRACE_PYTHON_ROOT_DIRS)
|
|
omnitrace_find_python(_PY VERSION ${OMNITRACE_PYTHON_VERSION})
|
|
set(OMNITRACE_PYTHON_ROOT_DIRS
|
|
"${_PY_ROOT_DIR}"
|
|
CACHE INTERNAL "" FORCE)
|
|
endif()
|
|
|
|
unset(OMNITRACE_PYTHON_VERSION CACHE)
|
|
unset(OMNITRACE_INSTALL_PYTHONDIR CACHE)
|
|
elseif(
|
|
NOT OMNITRACE_PYTHON_VERSIONS
|
|
AND NOT OMNITRACE_PYTHON_VERSION
|
|
AND OMNITRACE_PYTHON_ROOT_DIRS)
|
|
set(_PY_VERSIONS)
|
|
|
|
foreach(_DIR ${OMNITRACE_PYTHON_ROOT_DIRS})
|
|
omnitrace_find_python(_PY ROOT_DIR ${_DIR})
|
|
|
|
if(NOT _PY_FOUND)
|
|
continue()
|
|
endif()
|
|
|
|
if(NOT "${_PY_VERSION}" IN_LIST _PY_VERSIONS)
|
|
list(APPEND _PY_VERSIONS "${_PY_VERSION}")
|
|
endif()
|
|
endforeach()
|
|
|
|
set(OMNITRACE_PYTHON_VERSIONS
|
|
"${_PY_VERSIONS}"
|
|
CACHE INTERNAL "" FORCE)
|
|
elseif(
|
|
NOT OMNITRACE_PYTHON_VERSIONS
|
|
AND NOT OMNITRACE_PYTHON_VERSION
|
|
AND NOT OMNITRACE_PYTHON_ROOT_DIRS)
|
|
omnitrace_find_python(_PY REQUIRED)
|
|
set(OMNITRACE_PYTHON_ROOT_DIRS
|
|
"${_PY_ROOT_DIR}"
|
|
CACHE INTERNAL "" FORCE)
|
|
set(OMNITRACE_PYTHON_VERSIONS
|
|
"${_PY_VERSION}"
|
|
CACHE INTERNAL "" FORCE)
|
|
endif()
|
|
|
|
omnitrace_watch_for_change(OMNITRACE_PYTHON_ROOT_DIRS)
|
|
omnitrace_watch_for_change(OMNITRACE_PYTHON_VERSIONS)
|
|
|
|
omnitrace_check_python_dirs_and_versions(FAIL)
|
|
|
|
list(LENGTH OMNITRACE_PYTHON_VERSIONS _NUM_PYTHON_VERSIONS)
|
|
|
|
if(_NUM_PYTHON_VERSIONS GREATER 1)
|
|
set(OMNITRACE_INSTALL_PYTHONDIR
|
|
"${CMAKE_INSTALL_LIBDIR}/python/site-packages"
|
|
CACHE STRING "Installation prefix for python")
|
|
else()
|
|
set(OMNITRACE_INSTALL_PYTHONDIR
|
|
"${CMAKE_INSTALL_LIBDIR}/python${OMNITRACE_PYTHON_VERSIONS}/site-packages"
|
|
CACHE STRING "Installation prefix for python")
|
|
endif()
|
|
else()
|
|
set(OMNITRACE_INSTALL_PYTHONDIR
|
|
"${CMAKE_INSTALL_LIBDIR}/python/site-packages"
|
|
CACHE STRING "Installation prefix for python")
|
|
endif()
|
|
|
|
omnitrace_watch_for_change(OMNITRACE_INSTALL_PYTHONDIR)
|
|
set(CMAKE_INSTALL_PYTHONDIR ${OMNITRACE_INSTALL_PYTHONDIR})
|
|
|
|
# ----------------------------------------------------------------------------------------#
|
|
#
|
|
# Compile definitions
|
|
#
|
|
# ----------------------------------------------------------------------------------------#
|
|
|
|
if("${CMAKE_BUILD_TYPE}" MATCHES "Release" AND NOT OMNITRACE_BUILD_DEBUG)
|
|
add_target_flag_if_avail(omnitrace-compile-options "-g1")
|
|
endif()
|
|
|
|
foreach(_LIB ${OMNITRACE_EXTENSION_LIBRARIES})
|
|
get_target_property(_COMPILE_DEFS ${_LIB} INTERFACE_COMPILE_DEFINITIONS)
|
|
if(_COMPILE_DEFS)
|
|
foreach(_DEF ${_COMPILE_DEFS})
|
|
if("${_DEF}" MATCHES "OMNITRACE_")
|
|
target_compile_definitions(omnitrace-compile-definitions
|
|
INTERFACE ${_DEF})
|
|
endif()
|
|
endforeach()
|
|
endif()
|
|
endforeach()
|