2023-11-13 22:30:15 -06:00
|
|
|
#
|
|
|
|
|
#
|
|
|
|
|
#
|
|
|
|
|
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()
|
|
|
|
|
|
2023-11-29 20:43:18 -06:00
|
|
|
project(rocprofiler-sdk-samples-code-object-tracing LANGUAGES CXX HIP)
|
2023-11-13 22:30:15 -06:00
|
|
|
|
|
|
|
|
foreach(_TYPE DEBUG MINSIZEREL RELEASE RELWITHDEBINFO)
|
|
|
|
|
if("${CMAKE_HIP_FLAGS_${_TYPE}}" STREQUAL "")
|
|
|
|
|
set(CMAKE_HIP_FLAGS_${_TYPE} "${CMAKE_CXX_FLAGS_${_TYPE}}")
|
|
|
|
|
endif()
|
|
|
|
|
endforeach()
|
|
|
|
|
|
2023-11-29 20:43:18 -06:00
|
|
|
find_package(rocprofiler-sdk REQUIRED)
|
2023-11-13 22:30:15 -06:00
|
|
|
|
|
|
|
|
add_library(code-object-tracing-client SHARED)
|
|
|
|
|
target_sources(code-object-tracing-client PRIVATE client.cpp)
|
|
|
|
|
target_link_libraries(
|
|
|
|
|
code-object-tracing-client
|
2024-01-25 23:47:40 -06:00
|
|
|
PRIVATE rocprofiler-sdk::rocprofiler-sdk rocprofiler::samples-build-flags
|
2023-11-28 10:04:37 -06:00
|
|
|
rocprofiler::samples-common-library)
|
2023-11-13 22:30:15 -06:00
|
|
|
|
|
|
|
|
set_source_files_properties(main.cpp PROPERTIES LANGUAGE HIP)
|
|
|
|
|
find_package(Threads REQUIRED)
|
|
|
|
|
|
|
|
|
|
add_executable(code-object-tracing)
|
|
|
|
|
target_sources(code-object-tracing PRIVATE main.cpp)
|
|
|
|
|
target_link_libraries(
|
|
|
|
|
code-object-tracing PRIVATE code-object-tracing-client Threads::Threads
|
2023-11-28 10:04:37 -06:00
|
|
|
rocprofiler::samples-build-flags)
|
2023-11-13 22:30:15 -06:00
|
|
|
|
|
|
|
|
add_test(NAME code-object-tracing COMMAND $<TARGET_FILE:code-object-tracing>)
|
|
|
|
|
|
|
|
|
|
set_tests_properties(
|
|
|
|
|
code-object-tracing
|
|
|
|
|
PROPERTIES
|
|
|
|
|
TIMEOUT
|
|
|
|
|
45
|
|
|
|
|
LABELS
|
|
|
|
|
"samples"
|
|
|
|
|
ENVIRONMENT
|
2023-11-21 11:35:39 -06:00
|
|
|
"${ROCPROFILER_MEMCHECK_PRELOAD_ENV};HSA_TOOLS_LIB=$<TARGET_FILE:rocprofiler::rocprofiler-shared-library>"
|
2023-11-13 22:30:15 -06:00
|
|
|
FAIL_REGULAR_EXPRESSION
|
2024-03-07 22:21:26 -06:00
|
|
|
"${ROCPROFILER_DEFAULT_FAIL_REGEX}")
|