Fix rocprofiler installation (#73)
- install rocprofiler library - define AMD_INTERNAL_BUILD when including hsa/hsa.h - install include/rocprofiler/registration.h header - fix samples/pc_sampling cmake via installed rocprofiler - fix samples/api_callback_tracing cmake via installed rocprofiler - fix samples/api_buffered_tracing cmake via installed rocprofiler - set cmake_minimum_required in samples/CMakeLists.txt - find dependent packages in rocprofiler-config.cmake.in - AMDDeviceLibs - amd_comgr - hsa-runtime64 - hip - export rocprofiler-hip and rocprofiler-hsa-runtime libraries - add Test Install Build step to CI workflow
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
78425069e8
Коммит
8be4ca1a04
@@ -100,7 +100,7 @@ jobs:
|
||||
${{ matrix.ci-flags }}
|
||||
--
|
||||
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }}
|
||||
-DCMAKE_INSTALL_PREFIX="${{ env.ROCM_PATH }}"
|
||||
-DCMAKE_INSTALL_PREFIX=/opt/rocprofiler/v2
|
||||
-DCPACK_GENERATOR='DEB;RPM;TGZ'
|
||||
-DPython3_EXECUTABLE=$(which python3)
|
||||
|
||||
@@ -109,6 +109,13 @@ jobs:
|
||||
run:
|
||||
cmake --build build --target install --parallel 8
|
||||
|
||||
- name: Test Install Build
|
||||
timeout-minutes: 10
|
||||
shell: bash
|
||||
run: |
|
||||
CMAKE_PREFIX_PATH=/opt/rocprofiler/v2 cmake -B build-samples samples
|
||||
cmake --build build-samples --target all --parallel 8
|
||||
|
||||
- name: Build Packaging
|
||||
timeout-minutes: 10
|
||||
run:
|
||||
|
||||
@@ -21,6 +21,56 @@ set(@PROJECT_NAME@_LIBRARIES)
|
||||
|
||||
add_library(@PROJECT_NAME@::@PROJECT_NAME@ INTERFACE IMPORTED)
|
||||
|
||||
find_package(
|
||||
AMDDeviceLibs
|
||||
REQUIRED
|
||||
CONFIG
|
||||
HINTS
|
||||
@AMDDeviceLibs_DIR@
|
||||
@rocm_version_DIR@
|
||||
PATHS
|
||||
@AMDDeviceLibs_DIR@
|
||||
@rocm_version_DIR@)
|
||||
|
||||
find_package(
|
||||
amd_comgr
|
||||
@amd_comgr_VERSION@
|
||||
EXACT
|
||||
REQUIRED
|
||||
CONFIG
|
||||
HINTS
|
||||
@amd_comgr_DIR@
|
||||
@rocm_version_DIR@
|
||||
PATHS
|
||||
@amd_comgr_DIR@
|
||||
@rocm_version_DIR@)
|
||||
|
||||
find_package(
|
||||
hsa-runtime64
|
||||
@hsa-runtime64_VERSION@
|
||||
EXACT
|
||||
REQUIRED
|
||||
CONFIG
|
||||
HINTS
|
||||
@hsa-runtime64_DIR@
|
||||
@rocm_version_DIR@
|
||||
PATHS
|
||||
@hsa-runtime64_DIR@
|
||||
@rocm_version_DIR@)
|
||||
|
||||
find_package(
|
||||
hip
|
||||
@hip_VERSION@
|
||||
EXACT
|
||||
REQUIRED
|
||||
CONFIG
|
||||
HINTS
|
||||
@hip_DIR@
|
||||
@rocm_version_DIR@
|
||||
PATHS
|
||||
@hip_DIR@
|
||||
@rocm_version_DIR@)
|
||||
|
||||
include("${@PROJECT_NAME@_CMAKE_DIR}/@PROJECT_NAME@-library-targets.cmake")
|
||||
|
||||
# Library dependencies
|
||||
@@ -39,8 +89,7 @@ if(@PROJECT_NAME@_FIND_COMPONENTS)
|
||||
if(TARGET ${TARG})
|
||||
set(@PROJECT_NAME@_${COMP}_FOUND 1)
|
||||
list(APPEND @PROJECT_NAME@_LIBRARIES ${TARG})
|
||||
target_link_libraries(@PROJECT_NAME@::@PROJECT_NAME@
|
||||
INTERFACE ${TARG})
|
||||
target_link_libraries(@PROJECT_NAME@::@PROJECT_NAME@ INTERFACE ${TARG})
|
||||
else()
|
||||
set(@PROJECT_NAME@_${COMP}_FOUND 0)
|
||||
endif()
|
||||
@@ -51,6 +100,7 @@ include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(
|
||||
@PROJECT_NAME@
|
||||
FOUND_VAR @PROJECT_NAME@_FOUND
|
||||
REQUIRED_VARS @PROJECT_NAME@_ROOT_DIR @PROJECT_NAME@_INCLUDE_DIR @PROJECT_NAME@_LIBRARIES
|
||||
REQUIRED_VARS @PROJECT_NAME@_ROOT_DIR @PROJECT_NAME@_INCLUDE_DIR
|
||||
@PROJECT_NAME@_LIBRARIES
|
||||
VERSION_VAR @PROJECT_NAME@_VERSION
|
||||
HANDLE_COMPONENTS)
|
||||
|
||||
@@ -42,8 +42,8 @@ rocprofiler_add_interface_library(rocprofiler-dl
|
||||
"Build flags for dynamic linking library" INTERNAL)
|
||||
rocprofiler_add_interface_library(rocprofiler-rt "Build flags for runtime library"
|
||||
INTERNAL)
|
||||
rocprofiler_add_interface_library(rocprofiler-hip "HIP library" INTERNAL)
|
||||
rocprofiler_add_interface_library(rocprofiler-hsa-runtime "HSA runtime library" INTERNAL)
|
||||
rocprofiler_add_interface_library(rocprofiler-hip "HIP library")
|
||||
rocprofiler_add_interface_library(rocprofiler-hsa-runtime "HSA runtime library")
|
||||
rocprofiler_add_interface_library(rocprofiler-amd-comgr "AMD comgr library" INTERNAL)
|
||||
rocprofiler_add_interface_library(rocprofiler-gtest "Google Test library" INTERNAL)
|
||||
rocprofiler_add_interface_library(rocprofiler-glog "Google Log library" INTERNAL)
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
cmake_minimum_required(VERSION 3.21.0 FATAL_ERROR)
|
||||
|
||||
project(rocprofiler-samples LANGUAGES C CXX)
|
||||
|
||||
# add_subdirectory(api_tracing)
|
||||
|
||||
@@ -25,6 +25,10 @@ foreach(_TYPE DEBUG MINSIZEREL RELEASE RELWITHDEBINFO)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(NOT TARGET rocprofiler::rocprofiler-library)
|
||||
find_package(rocprofiler REQUIRED)
|
||||
endif()
|
||||
|
||||
add_library(buffered-api-tracing-client SHARED)
|
||||
target_sources(buffered-api-tracing-client PRIVATE client.cpp client.hpp)
|
||||
target_link_libraries(buffered-api-tracing-client
|
||||
|
||||
@@ -25,6 +25,10 @@ foreach(_TYPE DEBUG MINSIZEREL RELEASE RELWITHDEBINFO)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(NOT TARGET rocprofiler::rocprofiler-library)
|
||||
find_package(rocprofiler REQUIRED)
|
||||
endif()
|
||||
|
||||
add_library(callback-api-tracing-client SHARED)
|
||||
target_sources(callback-api-tracing-client PRIVATE client.cpp client.hpp)
|
||||
target_link_libraries(callback-api-tracing-client
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
cmake_minimum_required(VERSION 3.21.0 FATAL_ERROR)
|
||||
|
||||
project(rocprofiler-samples-pc-sampling LANGUAGES C CXX)
|
||||
|
||||
if(NOT TARGET rocprofiler::rocprofiler-library)
|
||||
find_package(rocprofiler REQUIRED)
|
||||
endif()
|
||||
|
||||
add_executable(pc_sampling_single-user-host-trap)
|
||||
target_sources(pc_sampling_single-user-host-trap PRIVATE common.h
|
||||
single-user-host-trap.cpp)
|
||||
|
||||
@@ -28,6 +28,7 @@ set(ROCPROFILER_HEADER_FILES
|
||||
marker.h
|
||||
pc_sampling.h
|
||||
profile_config.h
|
||||
registration.h
|
||||
spm.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/version.h)
|
||||
|
||||
|
||||
@@ -22,12 +22,26 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
// without AMD_INTERNAL_BUILD defined, including the hsa/hsa.h looks for headers in inc/ folder
|
||||
// so we always want it defined but we set ROCPROFILER_DEFINED_AMD_INTERNAL_BUILD to 1 to tell
|
||||
// us that after this include, we should undefine it
|
||||
#ifndef AMD_INTERNAL_BUILD
|
||||
# define AMD_INTERNAL_BUILD
|
||||
# ifndef ROCPROFILER_DEFINED_AMD_INTERNAL_BUILD
|
||||
# define ROCPROFILER_DEFINED_AMD_INTERNAL_BUILD 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <rocprofiler/hsa/api_args.h>
|
||||
#include <rocprofiler/hsa/api_id.h>
|
||||
#include <rocprofiler/hsa/table_api_id.h>
|
||||
|
||||
#include <hsa/hsa.h>
|
||||
|
||||
#if defined(ROCPROFILER_DEFINED_AMD_INTERNAL_BUILD) && ROCPROFILER_DEFINED_AMD_INTERNAL_BUILD > 0
|
||||
# undef AMD_INTERNAL_BUILD
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef struct hsa_kernel_dispatch_packet_s hsa_kernel_dispatch_packet_t;
|
||||
|
||||
@@ -28,4 +28,11 @@ set_target_properties(
|
||||
PROPERTIES OUTPUT_NAME rocprofiler64
|
||||
SOVERSION ${PROJECT_VERSION_MAJOR}
|
||||
VERSION ${PROJECT_VERSION}
|
||||
INSTALL_RPATH "\$ORIGIN"
|
||||
DEFINE_SYMBOL rocprofiler_EXPORTS)
|
||||
|
||||
install(
|
||||
TARGETS rocprofiler-library
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
COMPONENT core
|
||||
EXPORT ${PROJECT_NAME}-library-targets)
|
||||
|
||||
Ссылка в новой задаче
Block a user