Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions projects/rocprofiler-sdk/samples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,4 @@ add_subdirectory(external_correlation_id_request)
add_subdirectory(pc_sampling)
add_subdirectory(openmp_target)
add_subdirectory(thread_trace)
add_subdirectory(spm_counter_collection)
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
#
#
#
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-spm-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()

if(NOT ROCPROFILER_MEMCHECK STREQUAL "")
set(SANITIZER True)
else()
set(SANITIZER False)
endif()

find_package(rocprofiler-sdk REQUIRED)

rocprofiler_sdk_spm_disabled(IS_SPM_DISABLED)
if(${SANITIZER})
set(IS_SPM_DISABLED True)
endif()
set(IS_DISABLED False)

add_library(spm-counter-collection-buffer-client SHARED)
target_sources(spm-counter-collection-buffer-client PRIVATE buffered_client.cpp
client.hpp)
target_link_libraries(
spm-counter-collection-buffer-client
PUBLIC rocprofiler-sdk::samples-build-flags
PRIVATE rocprofiler-sdk::rocprofiler-sdk rocprofiler-sdk::samples-common-library)

set_source_files_properties(main.cpp PROPERTIES LANGUAGE HIP)
add_executable(spm-counter-collection-buffer)
target_sources(spm-counter-collection-buffer PRIVATE main.cpp)
target_link_libraries(spm-counter-collection-buffer
PRIVATE spm-counter-collection-buffer-client Threads::Threads)

rocprofiler_samples_get_ld_library_path_env(LIBRARY_PATH_ENV)
rocprofiler_samples_get_preload_env(PRELOAD_ENV spm-counter-collection-buffer-client)

set(SPM_ENV ROCPROFILER_SPM_BETA_ENABLED=True)
set(spm-counter-collection-buffer-env "${SPM_ENV}" "${PRELOAD_ENV}" "${LIBRARY_PATH_ENV}")

add_test(NAME spm-counter-collection-buffer
COMMAND $<TARGET_FILE:spm-counter-collection-buffer>)

set_tests_properties(
spm-counter-collection-buffer
PROPERTIES TIMEOUT
120
LABELS
"samples"
ENVIRONMENT
"${spm-counter-collection-buffer-env}"
FAIL_REGULAR_EXPRESSION
"${ROCPROFILER_DEFAULT_FAIL_REGEX}"
DISABLED
${IS_DISABLED})

add_library(spm-counter-collection-callback-client SHARED)
target_sources(spm-counter-collection-callback-client PRIVATE callback_client.cpp
client.hpp)
target_link_libraries(
spm-counter-collection-callback-client
PUBLIC rocprofiler-sdk::samples-build-flags
PRIVATE rocprofiler-sdk::rocprofiler-sdk rocprofiler-sdk::samples-common-library)

set_source_files_properties(main.cpp PROPERTIES LANGUAGE HIP)
add_executable(spm-counter-collection-callback)
target_sources(spm-counter-collection-callback PRIVATE main.cpp)
target_link_libraries(spm-counter-collection-callback
PRIVATE spm-counter-collection-callback-client Threads::Threads)

rocprofiler_samples_get_preload_env(PRELOAD_ENV spm-counter-collection-callback-client)

set(spm-counter-collection-callback-env "${SPM_ENV}" "${PRELOAD_ENV}"
"${LIBRARY_PATH_ENV}")

add_test(NAME spm-counter-collection-callback
COMMAND $<TARGET_FILE:spm-counter-collection-callback>)

set_tests_properties(
spm-counter-collection-callback
PROPERTIES TIMEOUT
120
LABELS
"samples"
ENVIRONMENT
"${spm-counter-collection-callback-env}"
FAIL_REGULAR_EXPRESSION
"${ROCPROFILER_DEFAULT_FAIL_REGEX}"
DISABLED
${IS_DISABLED})
Loading
Loading