3638351b4c
* Callback based handler for counter collection * source formatting (clang-format v11) (#507) Co-authored-by: bwelton <bwelton@users.noreply.github.com> * cmake formatting (cmake-format) (#508) Co-authored-by: bwelton <bwelton@users.noreply.github.com> * Doc fix * Minor doc fix * More doc fixes * More doc fixes * More doc fixes * Update CI * Changes to the API per comments * Mutex exception for HSA * source formatting (clang-format v11) (#511) Co-authored-by: bwelton <bwelton@users.noreply.github.com> * Doc fix --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: bwelton <bwelton@users.noreply.github.com>
113 lines
4.0 KiB
CMake
113 lines
4.0 KiB
CMake
#
|
|
#
|
|
#
|
|
cmake_minimum_required(VERSION 3.21.0 FATAL_ERROR)
|
|
|
|
if(NOT CMAKE_HIP_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 NO_CACHE)
|
|
mark_as_advanced(amdclangpp_EXECUTABLE)
|
|
|
|
if(amdclangpp_EXECUTABLE)
|
|
set(CMAKE_HIP_COMPILER "${amdclangpp_EXECUTABLE}")
|
|
endif()
|
|
endif()
|
|
|
|
project(rocprofiler-sdk-samples-counter-collection LANGUAGES CXX HIP)
|
|
|
|
foreach(_TYPE DEBUG MINSIZEREL RELEASE RELWITHDEBINFO)
|
|
if("${CMAKE_HIP_FLAGS_${_TYPE}}" STREQUAL "")
|
|
set(CMAKE_HIP_FLAGS_${_TYPE} "${CMAKE_CXX_FLAGS_${_TYPE}}")
|
|
endif()
|
|
endforeach()
|
|
|
|
find_package(rocprofiler-sdk REQUIRED)
|
|
|
|
add_library(counter-collection-buffer-client SHARED)
|
|
target_sources(counter-collection-buffer-client PRIVATE client.cpp client.hpp)
|
|
target_link_libraries(
|
|
counter-collection-buffer-client
|
|
PUBLIC rocprofiler::samples-build-flags
|
|
PRIVATE rocprofiler-sdk::rocprofiler-sdk rocprofiler::samples-common-library)
|
|
|
|
set_source_files_properties(main.cpp PROPERTIES LANGUAGE HIP)
|
|
add_executable(counter-collection-buffer)
|
|
target_sources(counter-collection-buffer PRIVATE main.cpp)
|
|
target_link_libraries(counter-collection-buffer PRIVATE counter-collection-buffer-client
|
|
Threads::Threads)
|
|
|
|
add_test(NAME counter-collection-buffer COMMAND $<TARGET_FILE:counter-collection-buffer>)
|
|
|
|
set_tests_properties(
|
|
counter-collection-buffer
|
|
PROPERTIES
|
|
TIMEOUT
|
|
600
|
|
LABELS
|
|
"samples"
|
|
ENVIRONMENT
|
|
"${ROCPROFILER_MEMCHECK_PRELOAD_ENV};HSA_TOOLS_LIB=$<TARGET_FILE:rocprofiler::rocprofiler-shared-library>"
|
|
FAIL_REGULAR_EXPRESSION
|
|
"threw an exception")
|
|
|
|
add_library(counter-collection-callback-client SHARED)
|
|
target_sources(counter-collection-callback-client PRIVATE callback_client.cpp client.hpp)
|
|
target_link_libraries(
|
|
counter-collection-callback-client
|
|
PUBLIC rocprofiler::samples-build-flags
|
|
PRIVATE rocprofiler-sdk::rocprofiler-sdk rocprofiler::samples-common-library)
|
|
|
|
set_source_files_properties(main.cpp PROPERTIES LANGUAGE HIP)
|
|
add_executable(counter-collection-callback)
|
|
target_sources(counter-collection-callback PRIVATE main.cpp)
|
|
target_link_libraries(counter-collection-callback
|
|
PRIVATE counter-collection-callback-client Threads::Threads)
|
|
|
|
add_test(NAME counter-collection-callback
|
|
COMMAND $<TARGET_FILE:counter-collection-callback>)
|
|
|
|
set_tests_properties(
|
|
counter-collection-callback
|
|
PROPERTIES
|
|
TIMEOUT
|
|
600
|
|
LABELS
|
|
"samples"
|
|
ENVIRONMENT
|
|
"${ROCPROFILER_MEMCHECK_PRELOAD_ENV};HSA_TOOLS_LIB=$<TARGET_FILE:rocprofiler::rocprofiler-shared-library>"
|
|
FAIL_REGULAR_EXPRESSION
|
|
"threw an exception")
|
|
|
|
add_library(counter-collection-functional-counter-client SHARED)
|
|
target_sources(counter-collection-functional-counter-client
|
|
PRIVATE print_functional_counters.cpp client.hpp)
|
|
target_link_libraries(
|
|
counter-collection-functional-counter-client
|
|
PUBLIC rocprofiler::samples-build-flags
|
|
PRIVATE rocprofiler-sdk::rocprofiler-sdk rocprofiler::samples-common-library)
|
|
|
|
add_executable(counter-collection-print-functional-counters)
|
|
target_sources(counter-collection-print-functional-counters PRIVATE main.cpp)
|
|
target_link_libraries(
|
|
counter-collection-print-functional-counters
|
|
PRIVATE counter-collection-functional-counter-client Threads::Threads)
|
|
|
|
add_test(NAME counter-collection-print-functional-counters
|
|
COMMAND $<TARGET_FILE:counter-collection-print-functional-counters>)
|
|
|
|
set_tests_properties(
|
|
counter-collection-print-functional-counters
|
|
PROPERTIES
|
|
TIMEOUT
|
|
300
|
|
LABELS
|
|
"samples"
|
|
ENVIRONMENT
|
|
"${ROCPROFILER_MEMCHECK_PRELOAD_ENV};HSA_TOOLS_LIB=$<TARGET_FILE:rocprofiler::rocprofiler-shared-library>"
|
|
FAIL_REGULAR_EXPRESSION
|
|
"threw an exception")
|