* Restructured tests

- support standalone compilation
- move tests/kernel-tracing/serialization.hpp to tests/common/serialization.hpp
- created tests/common library
- handle cloning of cereal library in standalone build

* Update install and packaging

* Update cmake/rocprofiler_config_packaging.cmake

- condense core, samples, development, and tools install components into single rocprofiler-sdk package
- keep tests install component in separate rocprofiler-sdk-tests package

* Update CI workflow to test install and packaging

* Update CI workflow

- install newer cmake for packaging checks

* Update cmake/rocprofiler_config_packaging.cmake

- disable auto-generation of shared-lib deps and provides for tests package

* Update CI workflow

- add sbin to PATH for dpkg install

* Update CI workflow

- remove using github.workspace when installing packages

* Update CI workflow

- hack to fix ordering of dpkg install

* Update CI workflow

- whitespace cleanup

[ROCm/rocprofiler-sdk commit: 8ed68ce4f3]
Tento commit je obsažen v:
Jonathan R. Madsen
2023-12-15 14:39:13 -06:00
odevzdal GitHub
rodič 633a80ec1b
revize 309a8e069b
21 změnil soubory, kde provedl 412 přidání a 77 odebrání
+32 -5
Zobrazit soubor
@@ -94,6 +94,7 @@ jobs:
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 20 --slave /usr/bin/g++ g++ /usr/bin/g++-12
python3 -m pip install -r requirements.txt
python3 -m pip install pytest
python3 -m pip install 'cmake>=3.22.0'
- name: List Files
shell: bash
@@ -118,6 +119,7 @@ jobs:
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }}
-DCMAKE_INSTALL_PREFIX=/opt/rocprofiler/v2
-DCPACK_GENERATOR='DEB;RPM;TGZ'
-DCPACK_PACKAGING_INSTALL_PREFIX="$(realpath /opt/rocm)"
-DPython3_EXECUTABLE=$(which python3)
- name: Install
@@ -125,17 +127,42 @@ jobs:
run:
cmake --build build --target install --parallel 8
- name: Build Packaging
timeout-minutes: 10
run:
cmake --build build --target package --parallel 8
- name: Test Install Build
timeout-minutes: 10
shell: bash
run: |
CMAKE_PREFIX_PATH=/opt/rocprofiler/v2 cmake -B build-samples samples
CMAKE_PREFIX_PATH=/opt/rocprofiler/v2 cmake -B build-tests tests
export LD_LIBRARY_PATH=/opt/rocprofiler/v2/lib:${LD_LIBRARY_PATH}
cmake --build build-samples --target all --parallel 8
cmake --build build-tests --target all --parallel 8
ctest --test-dir build-samples --output-on-failure
ctest --test-dir build-tests --output-on-failure
- name: Build Packaging
timeout-minutes: 10
run:
cmake --build build --target package --parallel 8
- name: Install Packages
timeout-minutes: 5
shell: bash
run: |
export PATH=${PATH}:/usr/local/sbin:/usr/sbin:/sbin
ls -la
ls -la ./build
for i in $(ls -S ./build/rocprofiler-sdk*.deb); do dpkg -i ${i}; done;
- name: Test Installed Packages
timeout-minutes: 20
shell: bash
run: |
CMAKE_PREFIX_PATH=/opt/rocm cmake -B build-samples-deb /opt/rocm/share/rocprofiler-sdk/samples
CMAKE_PREFIX_PATH=/opt/rocm cmake -B build-tests-deb /opt/rocm/share/rocprofiler-sdk/tests
cmake --build build-samples-deb --target all --parallel 8
cmake --build build-tests-deb --target all --parallel 8
ctest --test-dir build-samples-deb --output-on-failure
ctest --test-dir build-tests-deb --output-on-failure
- name: Archive production artifacts
uses: actions/upload-artifact@v3
@@ -173,7 +200,7 @@ jobs:
container:
image: compute-artifactory.amd.com:5000/rocm-plus-docker/compute-rocm-dkms-no-npi-hipclang:${{ needs.get_latest_mainline_build_number.outputs.LATEST_BUILD_NUMBER }}-${{ matrix.os }}-stg1
options: --ipc=host --device=/dev/kfd --device=/dev/dri --group-add video --cap-add=SYS_PTRACE --cap-add CAP_SYS_PTRACE --cap-add CAP_SYS_ADMIN --security-opt seccomp=unconfined
# container:
# image: compute-artifactory.amd.com:5000/rocm-plus-docker/compute-rocm-dkms-no-npi-hipclang:${{ needs.get_latest_mainline_build_number.outputs.LATEST_BUILD_NUMBER }}-${{ matrix.os }}-stg1
# options: --memory=128g --cpus=32 --ipc=host --device=/dev/kfd --device=/dev/dri${{ matrix.device }} --group-add video --cap-add=SYS_PTRACE --cap-add CAP_SYS_PTRACE --cap-add CAP_SYS_ADMIN --security-opt seccomp=unconfined
+2
Zobrazit soubor
@@ -30,6 +30,8 @@ project(
DESCRIPTION "ROCm GPU performance analysis"
HOMEPAGE_URL "https://github.com/ROCm-Developer-Tools/rocprofiler-v2-internal")
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "core")
find_package(Git)
if(Git_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
+13 -5
Zobrazit soubor
@@ -5,14 +5,22 @@ include(CMakePackageConfigHelpers)
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME config)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/samples
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}-sdk)
install(
DIRECTORY ${PROJECT_SOURCE_DIR}/samples
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}-sdk
COMPONENT samples)
install(
DIRECTORY ${PROJECT_SOURCE_DIR}/tests
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}-sdk
COMPONENT tests)
install(
EXPORT rocprofiler-sdk-library-targets
FILE rocprofiler-sdk-library-targets.cmake
NAMESPACE rocprofiler::
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PROJECT_NAME}-sdk)
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PROJECT_NAME}-sdk
COMPONENT development)
# ------------------------------------------------------------------------------#
# install tree
@@ -37,9 +45,9 @@ write_basic_package_version_file(
install(
FILES
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PROJECT_NAME}-sdk/${PROJECT_NAME}-sdk-config.cmake
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PROJECT_NAME}-sdk/${PROJECT_NAME}-sdk-version.cmake
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PROJECT_NAME}-sdk/${PROJECT_NAME}-sdk-config-version.cmake
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PROJECT_NAME}-sdk
OPTIONAL)
COMPONENT development)
export(PACKAGE ${PROJECT_NAME})
+98 -2
Zobrazit soubor
@@ -3,15 +3,16 @@
#
# Add packaging directives
set(CPACK_PACKAGE_NAME ${PROJECT_NAME})
set(CPACK_PACKAGE_NAME ${PROJECT_NAME}-sdk)
set(CPACK_PACKAGE_VENDOR "Advanced Micro Devices, Inc.")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PROJECT_DESCRIPTION}")
set(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}")
set(CPACK_PACKAGE_CONTACT "jonathan.madsen@amd.com")
set(CPACK_PACKAGE_CONTACT "ROCm Profiler Support <dl.ROCm-Profiler.support@amd.com>")
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF)
set(CPACK_STRIP_FILES OFF) # eventually this should be set to ON
set(ROCPROFILER_CPACK_SYSTEM_NAME
"${CMAKE_SYSTEM_NAME}"
CACHE STRING "System name, e.g. Linux or Ubuntu-18.04")
@@ -29,12 +30,101 @@ set(ROCPROFILER_PACKAGE_FILE_NAME
)
rocprofiler_add_feature(ROCPROFILER_PACKAGE_FILE_NAME "CPack filename")
get_cmake_property(ROCPROFILER_PACKAGING_COMPONENTS COMPONENTS)
rocprofiler_add_feature(ROCPROFILER_PACKAGING_COMPONENTS "Packaging components")
list(REMOVE_ITEM ROCPROFILER_PACKAGING_COMPONENTS "Development" "Unspecified")
list(LENGTH ROCPROFILER_PACKAGING_COMPONENTS NUM_ROCPROFILER_PACKAGING_COMPONENTS)
# the packages we will generate
set(ROCPROFILER_COMPONENT_GROUPS "core" "tests")
set(COMPONENT_GROUP_core_COMPONENTS "core" "development" "samples" "tools" "Development"
"Unspecified")
set(COMPONENT_GROUP_tests_COMPONENTS "tests")
# variables for each component group. Note: eventually we will probably want to separate
# the core to just be the runtime libraries, development to be the headers and cmake
# files, the samples to just be the samples, and tools just be the tool files but right
# now we are just combining core, development, samples, and tools into one package
set(COMPONENT_NAME_core "")
set(COMPONENT_NAME_development "dev")
set(COMPONENT_NAME_samples "samples")
set(COMPONENT_NAME_tools "tools")
set(COMPONENT_NAME_tests "tests")
set(COMPONENT_SEP_core "")
set(COMPONENT_SEP_development "-")
set(COMPONENT_SEP_samples "-")
set(COMPONENT_SEP_tools "-")
set(COMPONENT_SEP_tests "-")
set(COMPONENT_DEP_core "")
set(COMPONENT_DEP_development "rocprofiler-sdk")
set(COMPONENT_DEP_samples "rocprofiler-sdk")
set(COMPONENT_DEP_tools "rocprofiler-sdk")
set(COMPONENT_DEP_tests "rocprofiler-sdk")
set(COMPONENT_DESC_core "rocprofiler-sdk libraries, headers, samples, and tools")
set(COMPONENT_DESC_development "rocprofiler-sdk development files")
set(COMPONENT_DESC_samples "rocprofiler-sdk samples")
set(COMPONENT_DESC_tools "rocprofiler-sdk tools")
set(COMPONENT_DESC_tests "rocprofiler-sdk tests")
if(NOT NUM_ROCPROFILER_PACKAGING_COMPONENTS EQUAL 5)
message(
FATAL_ERROR
"Error new install component needs COMPONENT_NAME_* and COMPONENT_SEP_* entries"
)
endif()
if(ROCM_DEP_ROCMCORE OR ROCPROFILER_DEP_ROCMCORE)
set(CPACK_DEBIAN_PACKAGE_DEPENDS "rocm-core")
set(CPACK_RPM_PACKAGE_REQUIRES "rocm-core")
else()
set(CPACK_DEBIAN_PACKAGE_DEPENDS "")
set(CPACK_RPM_PACKAGE_REQUIRES "")
endif()
foreach(COMPONENT_GROUP ${ROCPROFILER_COMPONENT_GROUPS})
set(_SEP "${COMPONENT_SEP_${COMPONENT_GROUP}}")
set(_DEP "${COMPONENT_DEP_${COMPONENT_GROUP}}")
set(_NAME "${COMPONENT_NAME_${COMPONENT_GROUP}}")
set(_DESC "${COMPONENT_DESC_${COMPONENT_GROUP}}")
cpack_add_component_group(
${COMPONENT_GROUP}
DISPLAY_NAME "${_NAME}"
DESCRIPTION "${_DESC}")
if(ROCM_DEP_ROCMCORE OR ROCPROFILER_DEP_ROCMCORE)
list(INSERT _DEP 0 "rocm-core")
endif()
string(TOUPPER "${COMPONENT_GROUP}" UCOMPONENT)
set(CPACK_DEBIAN_${UCOMPONENT}_PACKAGE_NAME "${PROJECT_NAME}-sdk${_SEP}${_NAME}")
set(CPACK_DEBIAN_${UCOMPONENT}_PACKAGE_DEPENDS "${_DEP}")
set(CPACK_RPM_${UCOMPONENT}_PACKAGE_NAME "${PROJECT_NAME}-sdk${_SEP}${_NAME}")
set(CPACK_RPM_${UCOMPONENT}_PACKAGE_REQUIRES "${_DEP}")
foreach(COMPONENT ${COMPONENT_GROUP_${COMPONENT_GROUP}_COMPONENTS})
cpack_add_component(${COMPONENT} REQUIRED GROUP "${COMPONENT_GROUP}")
endforeach()
endforeach()
# -------------------------------------------------------------------------------------- #
#
# Debian package specific variables
#
# -------------------------------------------------------------------------------------- #
set(CPACK_DEBIAN_PACKAGE_EPOCH 0)
set(CPACK_DEB_COMPONENT_INSTALL ON)
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) # auto-generate deps based on shared libs
set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS ON) # generate list of shared libs provided by
# package
set(CPACK_DEBIAN_TESTS_PACKAGE_SHLIBDEPS OFF) # disable for tests package
set(CPACK_DEBIAN_TESTS_PACKAGE_GENERATE_SHLIBS OFF) # disable for tests package
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "${PROJECT_HOMEPAGE_URL}")
set(CPACK_DEBIAN_PACKAGE_RELEASE
"${ROCPROFILER_CPACK_SYSTEM_NAME}${ROCPROFILER_CPACK_PACKAGE_SUFFIX}")
@@ -69,6 +159,12 @@ if(DEFINED CPACK_PACKAGING_INSTALL_PREFIX)
set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "${CPACK_PACKAGING_INSTALL_PREFIX}")
endif()
set(CPACK_RPM_PACKAGE_EPOCH 0)
set(CPACK_RPM_COMPONENT_INSTALL ON)
set(CPACK_RPM_PACKAGE_AUTOREQ ON) # auto-generate deps based on shared libs
set(CPACK_RPM_PACKAGE_AUTOPROV ON) # generate list of shared libs provided by package
set(CPACK_RPM_TESTS_PACKAGE_AUTOREQ OFF) # disable for tests package
set(CPACK_RPM_TESTS_PACKAGE_AUTOPROV OFF) # disable for tests package
set(CPACK_RPM_PACKAGE_RELEASE
"${ROCPROFILER_CPACK_SYSTEM_NAME}${ROCPROFILER_CPACK_PACKAGE_SUFFIX}")
string(REGEX REPLACE "([a-zA-Z])-([0-9])" "\\1\\2" CPACK_RPM_PACKAGE_RELEASE
+1
Zobrazit soubor
@@ -5,6 +5,7 @@ cmake_minimum_required(VERSION 3.21.0 FATAL_ERROR)
project(rocprofiler-sdk-samples LANGUAGES C CXX)
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "samples")
if(CMAKE_BUILD_TYPE STREQUAL "")
set(CMAKE_BUILD_TYPE
"RelWithDebInfo"
+1 -1
Zobrazit soubor
@@ -9,4 +9,4 @@ install(
FILES rocprofv3
DESTINATION ${CMAKE_INSTALL_BINDIR}
PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
COMPONENT runtime)
COMPONENT tools)
+2
Zobrazit soubor
@@ -1,4 +1,6 @@
#
#
#
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "development")
add_subdirectory(rocprofiler-sdk)
+4 -2
Zobrazit soubor
@@ -33,8 +33,10 @@ set(ROCPROFILER_HEADER_FILES
spm.h
${CMAKE_CURRENT_BINARY_DIR}/version.h)
install(FILES ${ROCPROFILER_HEADER_FILES}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/rocprofiler-sdk)
install(
FILES ${ROCPROFILER_HEADER_FILES}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/rocprofiler-sdk
COMPONENT development)
add_subdirectory(hip)
add_subdirectory(hsa)
@@ -5,5 +5,7 @@
#
set(ROCPROFILER_HIP_HEADER_FILES api_args.h api_id.h)
install(FILES ${ROCPROFILER_HIP_HEADER_FILES}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/rocprofiler-sdk/hip)
install(
FILES ${ROCPROFILER_HIP_HEADER_FILES}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/rocprofiler-sdk/hip
COMPONENT development)
@@ -5,5 +5,7 @@
#
set(ROCPROFILER_HSA_HEADER_FILES api_args.h api_id.h table_api_id.h)
install(FILES ${ROCPROFILER_HSA_HEADER_FILES}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/rocprofiler-sdk/hsa)
install(
FILES ${ROCPROFILER_HSA_HEADER_FILES}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/rocprofiler-sdk/hsa
COMPONENT development)
@@ -5,5 +5,7 @@
#
set(ROCPROFILER_MARKER_HEADER_FILES api_args.h api_id.h)
install(FILES ${ROCPROFILER_MARKER_HEADER_FILES}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/rocprofiler-sdk/marker)
install(
FILES ${ROCPROFILER_MARKER_HEADER_FILES}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/rocprofiler-sdk/marker
COMPONENT development)
+3
Zobrazit soubor
@@ -1,8 +1,11 @@
#
#
#
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "core")
add_subdirectory(common)
add_subdirectory(rocprofiler-sdk)
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "tools")
add_subdirectory(rocprofiler-sdk-tool)
add_subdirectory(plugins)
+17 -24
Zobrazit soubor
@@ -3,43 +3,36 @@
#
cmake_minimum_required(VERSION 3.21.0 FATAL_ERROR)
project(rocprofiler-tests LANGUAGES C CXX)
if(COMMAND rocprofiler_deactivate_clang_tidy)
rocprofiler_deactivate_clang_tidy()
endif()
if(NOT TARGET rocprofiler::cereal)
get_filename_component(ROCPROFILER_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/.."
REALPATH)
project(rocprofiler-tests LANGUAGES C CXX)
rocprofiler_checkout_git_submodule(
RECURSIVE
RELATIVE_PATH external/cereal
WORKING_DIRECTORY ${ROCPROFILER_SOURCE_DIR}
REPO_URL https://github.com/jrmadsen/cereal.git
REPO_BRANCH "rocprofiler")
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "tests")
add_library(rocprofiler-cereal INTERFACE)
add_library(rocprofiler::cereal ALIAS rocprofiler-cereal)
target_compile_definitions(rocprofiler-cereal
INTERFACE $<BUILD_INTERFACE:CEREAL_THREAD_SAFE=1>)
target_include_directories(
rocprofiler-cereal
INTERFACE $<BUILD_INTERFACE:${ROCPROFILER_SOURCE_DIR}/external/cereal/include>)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE
"Release"
CACHE STRING "" FORCE)
endif()
add_library(rocprofiler-tests-build-flags INTERFACE)
add_library(rocprofiler::tests-build-flags ALIAS rocprofiler-tests-build-flags)
target_compile_options(rocprofiler-tests-build-flags INTERFACE -W -Wall -Wextra -Wshadow)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_HIP_STANDARD 17)
set(CMAKE_HIP_EXTENSIONS OFF)
set(CMAKE_HIP_STANDARD_REQUIRED ON)
if(ROCPROFILER_BUILD_CI OR ROCPROFILER_BUILD_WERROR)
target_compile_options(rocprofiler-tests-build-flags INTERFACE -Werror)
endif()
enable_testing()
include(CTest)
# needed for validation
find_package(Python3 REQUIRED)
# common utilities
add_subdirectory(common)
# applications used by integration tests
add_subdirectory(apps)
@@ -52,4 +52,4 @@ endif()
install(
TARGETS reproducible-runtime
DESTINATION bin
COMPONENT rocprofiler-test-apps)
COMPONENT tests)
+1 -1
Zobrazit soubor
@@ -51,4 +51,4 @@ endif()
install(
TARGETS transpose
DESTINATION bin
COMPONENT rocprofiler-test-apps)
COMPONENT tests)
+84
Zobrazit soubor
@@ -0,0 +1,84 @@
#
# common utilities for tests
#
# build flags
add_library(rocprofiler-tests-build-flags INTERFACE)
add_library(rocprofiler::tests-build-flags ALIAS rocprofiler-tests-build-flags)
target_compile_options(rocprofiler-tests-build-flags INTERFACE -W -Wall -Wextra -Wshadow)
target_compile_features(rocprofiler-tests-build-flags INTERFACE cxx_std_17)
if(ROCPROFILER_BUILD_CI OR ROCPROFILER_BUILD_WERROR)
target_compile_options(rocprofiler-tests-build-flags INTERFACE -Werror)
endif()
# serialization library
if(NOT TARGET rocprofiler::cereal)
get_filename_component(ROCPROFILER_SOURCE_DIR "${PROJECT_SOURCE_DIR}/.." REALPATH)
add_library(rocprofiler-cereal INTERFACE)
add_library(rocprofiler::cereal ALIAS rocprofiler-cereal)
target_compile_definitions(rocprofiler-cereal
INTERFACE $<BUILD_INTERFACE:CEREAL_THREAD_SAFE=1>)
if(EXISTS ${ROCPROFILER_SOURCE_DIR}/external AND COMMAND
rocprofiler_checkout_git_submodule)
rocprofiler_checkout_git_submodule(
RECURSIVE
RELATIVE_PATH external/cereal
WORKING_DIRECTORY ${ROCPROFILER_SOURCE_DIR}
REPO_URL https://github.com/jrmadsen/cereal.git
REPO_BRANCH "rocprofiler")
target_include_directories(
rocprofiler-cereal SYSTEM
INTERFACE $<BUILD_INTERFACE:${ROCPROFILER_SOURCE_DIR}/external/cereal/include>
)
else()
include(FetchContent)
set(FETCHCONTENT_BASE_DIR ${PROJECT_BINARY_DIR}/external)
fetchcontent_declare(
cereal
GIT_REPOSITORY https://github.com/jrmadsen/cereal.git
GIT_TAG rocprofiler
SOURCE_DIR ${PROJECT_BINARY_DIR}/external/cereal BINARY_DIR
${PROJECT_BINARY_DIR}/external/build/cereal-build SUBBUILD_DIR
${PROJECT_BINARY_DIR}/external/build/cereal-subdir)
# This particular version of projD requires workarounds
fetchcontent_getproperties(cereal)
if(NOT cereal_POPULATED)
fetchcontent_populate(cereal)
endif()
target_include_directories(
rocprofiler-cereal SYSTEM
INTERFACE $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/external/cereal/include>)
endif()
endif()
# common utilities
cmake_path(GET CMAKE_CURRENT_SOURCE_DIR PARENT_PATH COMMON_LIBRARY_INCLUDE_DIR)
add_library(rocprofiler-tests-common-library INTERFACE)
add_library(rocprofiler::tests-common-library ALIAS rocprofiler-tests-common-library)
target_link_libraries(rocprofiler-tests-common-library
INTERFACE rocprofiler::tests-build-flags rocprofiler::cereal)
target_compile_features(rocprofiler-tests-common-library INTERFACE cxx_std_17)
target_include_directories(rocprofiler-tests-common-library
INTERFACE ${COMMON_LIBRARY_INCLUDE_DIR})
set(EXTERNAL_SUBMODULE_DIR "${PROJECT_SOURCE_DIR}/../external")
cmake_path(ABSOLUTE_PATH EXTERNAL_SUBMODULE_DIR NORMALIZE)
if(EXISTS ${EXTERNAL_SUBMODULE_DIR}/filesystem/include/ghc/filesystem.hpp)
target_compile_definitions(
rocprofiler-tests-common-library
INTERFACE $<BUILD_INTERFACE:ROCPROFILER_SAMPLES_HAS_GHC_LIB_FILESYSTEM=1>)
target_include_directories(
rocprofiler-tests-common-library SYSTEM
INTERFACE $<BUILD_INTERFACE:${EXTERNAL_SUBMODULE_DIR}/filesystem/include>)
endif()
+40
Zobrazit soubor
@@ -0,0 +1,40 @@
// MIT License
//
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#pragma once
#define ROCPROFILER_CALL(result, msg) \
{ \
rocprofiler_status_t CHECKSTATUS = result; \
if(CHECKSTATUS != ROCPROFILER_STATUS_SUCCESS) \
{ \
std::string status_name = rocprofiler_get_status_name(CHECKSTATUS); \
std::string status_msg = rocprofiler_get_status_string(CHECKSTATUS); \
std::cerr << "[" #result "][" << __FILE__ << ":" << __LINE__ << "] " << msg \
<< " failed with error code " << status_name << " (" << CHECKSTATUS \
<< "): " << status_msg << std::endl; \
std::stringstream errmsg{}; \
errmsg << "[" #result "][" << __FILE__ << ":" << __LINE__ << "] " << msg " failure (" \
<< status_name << ": " << status_msg << ")"; \
throw std::runtime_error(errmsg.str()); \
} \
}
+77
Zobrazit soubor
@@ -0,0 +1,77 @@
// MIT License
//
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#pragma once
#if !defined(ROCPROFILER_TESTS_HAS_GHC_LIB_FILESYSTEM)
# if defined __has_include
# if __has_include(<ghc/filesystem.hpp>)
# define ROCPROFILER_TESTS_HAS_GHC_LIB_FILESYSTEM 1
# else
# define ROCPROFILER_TESTS_HAS_GHC_LIB_FILESYSTEM 0
# endif
# else
# define ROCPROFILER_TESTS_HAS_GHC_LIB_FILESYSTEM 0
# endif
#endif
#if ROCPROFILER_TESTS_HAS_GHC_LIB_FILESYSTEM == 0
# if defined __has_include
# if __has_include(<version>)
# include <version>
# endif
# endif
# if defined(__cpp_lib_filesystem)
# define ROCPROFILER_TESTS_HAS_CPP_LIB_FILESYSTEM 1
# else
# if defined __has_include
# if __has_include(<filesystem>)
# define ROCPROFILER_TESTS_HAS_CPP_LIB_FILESYSTEM 1
# endif
# endif
# endif
#endif
// include the correct filesystem header
#if defined(ROCPROFILER_TESTS_HAS_GHC_LIB_FILESYSTEM) && \
ROCPROFILER_TESTS_HAS_GHC_LIB_FILESYSTEM > 0
# include <ghc/filesystem.hpp>
#elif defined(ROCPROFILER_TESTS_HAS_CPP_LIB_FILESYSTEM) && \
ROCPROFILER_TESTS_HAS_CPP_LIB_FILESYSTEM > 0
# include <filesystem>
#else
# include <experimental/filesystem>
#endif
namespace common
{
#if defined(ROCPROFILER_TESTS_HAS_GHC_LIB_FILESYSTEM) && \
ROCPROFILER_TESTS_HAS_GHC_LIB_FILESYSTEM > 0
namespace fs = ::ghc::filesystem; // NOLINT
#elif defined(ROCPROFILER_TESTS_HAS_CPP_LIB_FILESYSTEM) && \
ROCPROFILER_TESTS_HAS_CPP_LIB_FILESYSTEM > 0
namespace fs = ::std::filesystem; // NOLINT
#else
namespace fs = ::std::experimental::filesystem; // NOLINT
#endif
} // namespace common
@@ -56,15 +56,17 @@
#include <cereal/types/variant.hpp>
#include <cereal/types/vector.hpp>
#define SAVE_DATA_FIELD(FIELD) ar(cereal::make_nvp(#FIELD, data.FIELD))
#define SAVE_DATA_VALUE(NAME, VALUE) ar(cereal::make_nvp(NAME, data.VALUE))
#define SAVE_DATA_CSTR(FIELD) ar(cereal::make_nvp(#FIELD, std::string{data.FIELD}))
#define SAVE_DATA_FIELD(FIELD) ar(make_nvp(#FIELD, data.FIELD))
#define SAVE_DATA_VALUE(NAME, VALUE) ar(make_nvp(NAME, data.VALUE))
#define SAVE_DATA_CSTR(FIELD) ar(make_nvp(#FIELD, std::string{data.FIELD}))
#define SAVE_DATA_BITFIELD(NAME, VALUE) \
{ \
auto _val = data.VALUE; \
ar(cereal::make_nvp(NAME, _val)); \
ar(make_nvp(NAME, _val)); \
}
namespace cereal
{
template <typename ArchiveT>
void
save(ArchiveT& ar, rocprofiler_context_id_t data)
@@ -441,12 +443,13 @@ save(ArchiveT& ar, const rocprofiler_agent_t& data)
vec.reserve(size);
for(uint64_t i = 0; i < size; ++i)
vec.emplace_back(value[i]);
ar(cereal::make_nvp(name, vec));
ar(make_nvp(name, vec));
};
generate("mem_banks", data.mem_banks, data.mem_banks_count);
generate("caches", data.caches, data.caches_count);
generate("io_links", data.io_links, data.io_links_count);
}
} // namespace cereal
#undef SAVE_DATA_FIELD
+13 -6
Zobrazit soubor
@@ -3,7 +3,10 @@
#
cmake_minimum_required(VERSION 3.21.0 FATAL_ERROR)
project(rocprofiler-tests-kernel-tracing LANGUAGES CXX)
project(
rocprofiler-tests-kernel-tracing
LANGUAGES CXX
VERSION 0.0.0)
find_package(rocprofiler-sdk REQUIRED)
@@ -11,16 +14,20 @@ add_library(kernel-tracing-test-tool SHARED)
target_sources(kernel-tracing-test-tool PRIVATE kernel-tracing.cpp)
target_link_libraries(
kernel-tracing-test-tool
PRIVATE rocprofiler::rocprofiler rocprofiler::cereal
$<TARGET_NAME_IF_EXISTS:rocprofiler::tests-build-flags>)
PRIVATE rocprofiler::rocprofiler rocprofiler::cereal rocprofiler::tests-build-flags
rocprofiler::tests-common-library)
set_target_properties(
kernel-tracing-test-tool PROPERTIES INSTALL_RPATH "\$ORIGIN:\$ORIGIN/.."
INSTALL_RPATH_USE_LINK_PATH ON)
kernel-tracing-test-tool
PROPERTIES INSTALL_RPATH "\$ORIGIN:\$ORIGIN/.."
INSTALL_RPATH_USE_LINK_PATH ON
SOVERSION ${PROJECT_VERSION_MINOR}
VERSION
${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
install(
TARGETS kernel-tracing-test-tool
DESTINATION lib/rocprofiler-sdk
COMPONENT rocprofiler-test-libs)
COMPONENT tests)
if(ROCPROFILER_MEMCHECK_PRELOAD_ENV)
set(PRELOAD_ENV
+3 -19
Zobrazit soubor
@@ -31,8 +31,9 @@
* @brief Test rocprofiler tool
*/
#include "lib/common/filesystem.hpp"
#include "serialization.hpp"
#include "common/defines.hpp"
#include "common/filesystem.hpp"
#include "common/serialization.hpp"
#include <rocprofiler-sdk/buffer.h>
#include <rocprofiler-sdk/callback_tracing.h>
@@ -62,23 +63,6 @@
#include <variant>
#include <vector>
#define ROCPROFILER_CALL(result, msg) \
{ \
rocprofiler_status_t CHECKSTATUS = result; \
if(CHECKSTATUS != ROCPROFILER_STATUS_SUCCESS) \
{ \
std::string status_name = rocprofiler_get_status_name(CHECKSTATUS); \
std::string status_msg = rocprofiler_get_status_string(CHECKSTATUS); \
std::cerr << "[" #result "][" << __FILE__ << ":" << __LINE__ << "] " << msg \
<< " failed with error code " << status_name << " (" << CHECKSTATUS \
<< "): " << status_msg << std::endl; \
std::stringstream errmsg{}; \
errmsg << "[" #result "][" << __FILE__ << ":" << __LINE__ << "] " << msg " failure (" \
<< status_name << ": " << status_msg << ")"; \
throw std::runtime_error(errmsg.str()); \
} \
}
namespace client
{
namespace