Use gersemi for CMake formatting (#257)

* Replace `cmake-format` with `gersemi`

Signed-off-by: David Galiffi <David.Galiffi@amd.com>

* Remove .cmake-format.yaml

Signed-off-by: David Galiffi <David.Galiffi@amd.com>

* Update workflow to use gersemi

Signed-off-by: David Galiffi <David.Galiffi@amd.com>

* Update CONTRIBUTING.md

* Update helper scripts

* Don't include `*/external/*` in workflows

---------

Signed-off-by: David Galiffi <David.Galiffi@amd.com>

[ROCm/rocprofiler-systems commit: 122623a929]
此提交包含在:
David Galiffi
2025-06-22 10:44:33 -04:00
提交者 GitHub
父節點 0403aaa97f
當前提交 8fcf3a50b0
共有 106 個檔案被更改,包括 5116 行新增3156 行删除
+4 -7
查看文件
@@ -3,9 +3,7 @@ cmake_minimum_required(VERSION 3.18.4 FATAL_ERROR)
project(rocprofiler-systems-examples LANGUAGES C CXX)
if("${CMAKE_BUILD_TYPE}" STREQUAL "")
set(CMAKE_BUILD_TYPE
"RelWithDebInfo"
CACHE STRING "Build type" FORCE)
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Build type" FORCE)
endif()
string(TOUPPER "${CMAKE_BUILD_TYPE}" BUILD_TYPE)
@@ -28,7 +26,8 @@ if(CMAKE_PROJECT_NAME STREQUAL "rocprofiler-systems")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
rocprofiler_systems_add_option(ROCPROFSYS_INSTALL_EXAMPLES
"Install rocprofiler-systems examples" OFF)
"Install rocprofiler-systems examples" OFF
)
else()
option(ROCPROFSYS_INSTALL_EXAMPLES "Install rocprofiler-systems examples" ON)
endif()
@@ -37,9 +36,7 @@ if(ROCPROFSYS_INSTALL_EXAMPLES)
include(GNUInstallDirs)
endif()
set(ROCPROFSYS_EXAMPLE_ROOT_DIR
${CMAKE_CURRENT_LIST_DIR}
CACHE INTERNAL "")
set(ROCPROFSYS_EXAMPLE_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR} CACHE INTERNAL "")
# defines function for creating causal profiling exes
include(${CMAKE_CURRENT_LIST_DIR}/causal-helpers.cmake)
+82 -42
查看文件
@@ -17,7 +17,12 @@ endif()
function(rocprofiler_systems_causal_example_executable _NAME)
cmake_parse_arguments(
CAUSAL "" "" "SOURCES;DEFINITIONS;INCLUDE_DIRECTORIES;LINK_LIBRARIES" ${ARGN})
CAUSAL
""
""
"SOURCES;DEFINITIONS;INCLUDE_DIRECTORIES;LINK_LIBRARIES"
${ARGN}
)
function(rocprofiler_systems_causal_example_interface _TARGET)
if(NOT TARGET ${_TARGET})
@@ -30,74 +35,108 @@ function(rocprofiler_systems_causal_example_executable _NAME)
rocprofiler_systems_causal_example_interface(rocprofsys-causal-example-lib-debug)
rocprofiler_systems_causal_example_interface(rocprofsys-causal-example-lib-no-debug)
target_compile_options(rocprofsys-causal-example-lib-debug
INTERFACE -g3 -fno-omit-frame-pointer)
target_compile_options(
rocprofsys-causal-example-lib-debug
INTERFACE -g3 -fno-omit-frame-pointer
)
target_compile_options(rocprofsys-causal-example-lib-no-debug INTERFACE -g0)
add_executable(${_NAME} ${CAUSAL_SOURCES})
target_compile_definitions(${_NAME} PRIVATE USE_COZ=0 USE_OMNI=0
${CAUSAL_DEFINITIONS})
target_include_directories(${_NAME} PRIVATE ${ROCPROFSYS_EXAMPLE_ROOT_DIR}/causal
${CAUSAL_INCLUDE_DIRECTORIES})
target_compile_definitions(
${_NAME}
PRIVATE USE_COZ=0 USE_OMNI=0 ${CAUSAL_DEFINITIONS}
)
target_include_directories(
${_NAME}
PRIVATE ${ROCPROFSYS_EXAMPLE_ROOT_DIR}/causal ${CAUSAL_INCLUDE_DIRECTORIES}
)
target_link_libraries(
${_NAME}
PRIVATE ${CAUSAL_LINK_LIBRARIES}
rocprofiler-systems::rocprofiler-systems-user-library
rocprofsys-causal-example-lib-debug)
PRIVATE
${CAUSAL_LINK_LIBRARIES}
rocprofiler-systems::rocprofiler-systems-user-library
rocprofsys-causal-example-lib-debug
)
add_executable(${_NAME}-rocprofsys ${CAUSAL_SOURCES})
target_compile_definitions(${_NAME}-rocprofsys PRIVATE USE_COZ=0 USE_OMNI=1
${CAUSAL_DEFINITIONS})
target_compile_definitions(
${_NAME}-rocprofsys
PRIVATE USE_COZ=0 USE_OMNI=1 ${CAUSAL_DEFINITIONS}
)
target_include_directories(
${_NAME}-rocprofsys PRIVATE ${ROCPROFSYS_EXAMPLE_ROOT_DIR}/causal
${CAUSAL_INCLUDE_DIRECTORIES})
${_NAME}-rocprofsys
PRIVATE ${ROCPROFSYS_EXAMPLE_ROOT_DIR}/causal ${CAUSAL_INCLUDE_DIRECTORIES}
)
target_link_libraries(
${_NAME}-rocprofsys
PRIVATE ${CAUSAL_LINK_LIBRARIES}
rocprofiler-systems::rocprofiler-systems-user-library
rocprofsys-causal-example-lib-debug)
PRIVATE
${CAUSAL_LINK_LIBRARIES}
rocprofiler-systems::rocprofiler-systems-user-library
rocprofsys-causal-example-lib-debug
)
add_executable(${_NAME}-ndebug ${CAUSAL_SOURCES})
target_compile_definitions(${_NAME}-ndebug PRIVATE USE_COZ=0 USE_OMNI=0
${CAUSAL_DEFINITIONS})
target_compile_definitions(
${_NAME}-ndebug
PRIVATE USE_COZ=0 USE_OMNI=0 ${CAUSAL_DEFINITIONS}
)
target_include_directories(
${_NAME}-ndebug PRIVATE ${ROCPROFSYS_EXAMPLE_ROOT_DIR}/causal
${CAUSAL_INCLUDE_DIRECTORIES})
${_NAME}-ndebug
PRIVATE ${ROCPROFSYS_EXAMPLE_ROOT_DIR}/causal ${CAUSAL_INCLUDE_DIRECTORIES}
)
target_link_libraries(
${_NAME}-ndebug
PRIVATE ${CAUSAL_LINK_LIBRARIES}
rocprofiler-systems::rocprofiler-systems-user-library
rocprofsys-causal-example-lib-no-debug)
PRIVATE
${CAUSAL_LINK_LIBRARIES}
rocprofiler-systems::rocprofiler-systems-user-library
rocprofsys-causal-example-lib-no-debug
)
add_executable(${_NAME}-rocprofsys-ndebug ${CAUSAL_SOURCES})
target_compile_definitions(${_NAME}-rocprofsys-ndebug PRIVATE USE_COZ=0 USE_OMNI=1
${CAUSAL_DEFINITIONS})
target_compile_definitions(
${_NAME}-rocprofsys-ndebug
PRIVATE USE_COZ=0 USE_OMNI=1 ${CAUSAL_DEFINITIONS}
)
target_include_directories(
${_NAME}-rocprofsys-ndebug PRIVATE ${ROCPROFSYS_EXAMPLE_ROOT_DIR}/causal
${CAUSAL_INCLUDE_DIRECTORIES})
${_NAME}-rocprofsys-ndebug
PRIVATE ${ROCPROFSYS_EXAMPLE_ROOT_DIR}/causal ${CAUSAL_INCLUDE_DIRECTORIES}
)
target_link_libraries(
${_NAME}-rocprofsys-ndebug
PRIVATE ${CAUSAL_LINK_LIBRARIES}
rocprofiler-systems::rocprofiler-systems-user-library
rocprofsys-causal-example-lib-no-debug)
PRIVATE
${CAUSAL_LINK_LIBRARIES}
rocprofiler-systems::rocprofiler-systems-user-library
rocprofsys-causal-example-lib-no-debug
)
add_dependencies(rocprofsys-causal-examples ${_NAME} ${_NAME}-rocprofsys
${_NAME}-ndebug ${_NAME}-rocprofsys-ndebug)
add_dependencies(
rocprofsys-causal-examples
${_NAME}
${_NAME}-rocprofsys
${_NAME}-ndebug
${_NAME}-rocprofsys-ndebug
)
if(coz-profiler_FOUND)
rocprofiler_systems_causal_example_interface(rocprofsys-causal-example-lib-coz)
target_compile_options(rocprofsys-causal-example-lib-coz
INTERFACE -g3 -gdwarf-3 -fno-omit-frame-pointer)
target_compile_options(
rocprofsys-causal-example-lib-coz
INTERFACE -g3 -gdwarf-3 -fno-omit-frame-pointer
)
add_executable(${_NAME}-coz ${CAUSAL_SOURCES})
target_compile_definitions(${_NAME}-coz PRIVATE USE_COZ=1 USE_OMNI=0
${CAUSAL_DEFINITIONS})
target_compile_definitions(
${_NAME}-coz
PRIVATE USE_COZ=1 USE_OMNI=0 ${CAUSAL_DEFINITIONS}
)
target_include_directories(
${_NAME}-coz PRIVATE ${ROCPROFSYS_EXAMPLE_ROOT_DIR}/causal
${CAUSAL_INCLUDE_DIRECTORIES})
${_NAME}-coz
PRIVATE ${ROCPROFSYS_EXAMPLE_ROOT_DIR}/causal ${CAUSAL_INCLUDE_DIRECTORIES}
)
target_link_libraries(
${_NAME}-coz PRIVATE ${CAUSAL_LINK_LIBRARIES}
rocprofsys-causal-example-lib-coz coz::coz)
${_NAME}-coz
PRIVATE ${CAUSAL_LINK_LIBRARIES} rocprofsys-causal-example-lib-coz coz::coz
)
add_dependencies(rocprofsys-causal-examples ${_NAME}-coz)
endif()
@@ -107,6 +146,7 @@ function(rocprofiler_systems_causal_example_executable _NAME)
TARGETS ${_NAME} ${_NAME}-rocprofsys ${_NAME}-coz
DESTINATION bin
COMPONENT rocprofiler-systems-examples
OPTIONAL)
OPTIONAL
)
endif()
endfunction()
+18 -9
查看文件
@@ -5,8 +5,10 @@ project(rocprofiler-systems-causal-example LANGUAGES CXX)
if(ROCPROFSYS_DISABLE_EXAMPLES)
get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME)
if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST
ROCPROFSYS_DISABLE_EXAMPLES)
if(
${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
OR ${_DIR} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
)
return()
endif()
endif()
@@ -18,25 +20,32 @@ if(NOT TARGET rocprofiler-systems::rocprofiler-systems-user-library)
endif()
add_library(causal-interface-library INTERFACE)
target_compile_options(causal-interface-library INTERFACE -g3 -gdwarf-3
-fno-omit-frame-pointer)
target_link_libraries(causal-interface-library INTERFACE Threads::Threads
${CMAKE_DL_LIBS})
target_compile_options(
causal-interface-library
INTERFACE -g3 -gdwarf-3 -fno-omit-frame-pointer
)
target_link_libraries(
causal-interface-library
INTERFACE Threads::Threads ${CMAKE_DL_LIBS}
)
rocprofiler_systems_causal_example_executable(
"causal-both"
SOURCES causal.cpp impl.cpp
LINK_LIBRARIES causal-interface-library
DEFINITIONS USE_RNG=1 USE_CPU=1)
DEFINITIONS USE_RNG=1 USE_CPU=1
)
rocprofiler_systems_causal_example_executable(
"causal-rng"
SOURCES causal.cpp impl.cpp
LINK_LIBRARIES causal-interface-library
DEFINITIONS USE_RNG=1 USE_CPU=0)
DEFINITIONS USE_RNG=1 USE_CPU=0
)
rocprofiler_systems_causal_example_executable(
"causal-cpu"
SOURCES causal.cpp impl.cpp
LINK_LIBRARIES causal-interface-library
DEFINITIONS USE_RNG=0 USE_CPU=1)
DEFINITIONS USE_RNG=0 USE_CPU=1
)
+12 -9
查看文件
@@ -5,8 +5,10 @@ project(rocprofiler-systems-code-coverage-example LANGUAGES CXX)
if(ROCPROFSYS_DISABLE_EXAMPLES)
get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME)
if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST
ROCPROFSYS_DISABLE_EXAMPLES)
if(
${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
OR ${_DIR} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
)
return()
endif()
endif()
@@ -20,10 +22,7 @@ target_link_libraries(code-coverage PRIVATE Threads::Threads)
target_compile_options(code-coverage PRIVATE ${_FLAGS})
if(ROCPROFSYS_INSTALL_EXAMPLES)
install(
TARGETS code-coverage
DESTINATION bin
COMPONENT rocprofiler-systems-examples)
install(TARGETS code-coverage DESTINATION bin COMPONENT rocprofiler-systems-examples)
endif()
set(PYTHON_FILES code-coverage.py)
@@ -34,14 +33,18 @@ if(Python3_FOUND)
set(PYTHON_EXECUTABLE "${Python3_EXECUTABLE}")
foreach(_FILE ${PYTHON_FILES})
configure_file(${PROJECT_SOURCE_DIR}/${_FILE} ${PROJECT_BINARY_DIR}/${_FILE}
@ONLY)
configure_file(
${PROJECT_SOURCE_DIR}/${_FILE}
${PROJECT_BINARY_DIR}/${_FILE}
@ONLY
)
if(ROCPROFSYS_INSTALL_EXAMPLES)
install(
PROGRAMS ${PROJECT_BINARY_DIR}/${_FILE}
DESTINATION bin
COMPONENT rocprofiler-systems-examples)
COMPONENT rocprofiler-systems-examples
)
endif()
endforeach()
endif()
+5 -6
查看文件
@@ -8,13 +8,12 @@ string(REPLACE " " ";" _FLAGS "${CMAKE_CXX_FLAGS_DEBUG}")
find_package(Threads REQUIRED)
find_package(rocprofiler-systems REQUIRED COMPONENTS user)
add_executable(fork-example fork.cpp)
target_link_libraries(fork-example PRIVATE Threads::Threads
rocprofiler-systems::rocprofiler-systems)
target_link_libraries(
fork-example
PRIVATE Threads::Threads rocprofiler-systems::rocprofiler-systems
)
target_compile_options(fork-example PRIVATE ${_FLAGS})
if(ROCPROFSYS_INSTALL_EXAMPLES)
install(
TARGETS fork-example
DESTINATION bin
COMPONENT rocprofiler-systems-examples)
install(TARGETS fork-example DESTINATION bin COMPONENT rocprofiler-systems-examples)
endif()
+17 -17
查看文件
@@ -52,8 +52,10 @@ string(REPLACE " " ";" _FLAGS "${CMAKE_CXX_FLAGS_DEBUG}")
if(ROCPROFSYS_DISABLE_EXAMPLES)
get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME)
if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST
ROCPROFSYS_DISABLE_EXAMPLES)
if(
${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
OR ${_DIR} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
)
return()
endif()
endif()
@@ -76,24 +78,24 @@ function(copy_image_files_and_make_copies)
foreach(file ${image_files})
get_filename_component(filename ${file} NAME)
foreach(i RANGE 1 ${NUM_COPIES})
file(COPY ${file}
DESTINATION ${CMAKE_BINARY_DIR}/images/${filename}_copy${i}.jpg)
file(
COPY ${file}
DESTINATION ${CMAKE_BINARY_DIR}/images/${filename}_copy${i}.jpg
)
endforeach()
endforeach()
else()
message(
AUTHOR_WARNING
"Source directory ${ROCmVersion_DIR}/share/rocjpeg/images does not exist")
"Source directory ${ROCmVersion_DIR}/share/rocjpeg/images does not exist"
)
endif()
endfunction()
# threads
find_package(Threads REQUIRED)
if(HIP_FOUND
AND ROCJPEG_FOUND
AND Threads_FOUND
AND rocprofiler-register_FOUND)
if(HIP_FOUND AND ROCJPEG_FOUND AND Threads_FOUND AND rocprofiler-register_FOUND)
# HIP
set(LINK_LIBRARY_LIST ${LINK_LIBRARY_LIST} hip::host)
# threads
@@ -116,19 +118,17 @@ if(HIP_FOUND
copy_image_files_and_make_copies()
if(ROCPROFSYS_INSTALL_EXAMPLES)
install(
TARGETS jpegdecode
DESTINATION bin
COMPONENT rocprofiler-systems-examples)
install(TARGETS jpegdecode DESTINATION bin COMPONENT rocprofiler-systems-examples)
install(
FILES ${CMAKE_BINARY_DIR}/images
DESTINATION share/rocprofiler-systems/tests/images
COMPONENT rocprofiler-systems-examples)
COMPONENT rocprofiler-systems-examples
)
endif()
else()
message(
"-- ERROR!: ${PROJECT_NAME} excluded! please install all the dependencies and try again!"
)
)
if(NOT HIP_FOUND)
message(FATAL_ERROR "-- ERROR!: HIP Not Found! - please install ROCm and HIP!")
endif()
@@ -141,7 +141,7 @@ else()
if(NOT rocprofiler-register_FOUND)
message(
FATAL_ERROR
"-- ERROR!: rocprofiler-register Not Found! - please install rocprofiler-register!"
)
"-- ERROR!: rocprofiler-register Not Found! - please install rocprofiler-register!"
)
endif()
endif()
+27 -13
查看文件
@@ -5,15 +5,22 @@ project(rocprofiler-systems-lulesh-example LANGUAGES C CXX)
if(ROCPROFSYS_DISABLE_EXAMPLES)
get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME)
if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST
ROCPROFSYS_DISABLE_EXAMPLES)
if(
${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
OR ${_DIR} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
)
return()
endif()
endif()
set(CMAKE_BUILD_TYPE "RelWithDebInfo")
string(REGEX REPLACE " -g(|[0-2]) " " -g3 " CMAKE_CXX_FLAGS_RELWITHDEBINFO
"${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
string(
REGEX REPLACE
" -g(|[0-2]) "
" -g3 "
CMAKE_CXX_FLAGS_RELWITHDEBINFO
"${CMAKE_CXX_FLAGS_RELWITHDEBINFO}"
)
list(INSERT CMAKE_MODULE_PATH 0 ${PROJECT_SOURCE_DIR}/cmake/Modules)
@@ -29,8 +36,13 @@ if(LULESH_BUILD_KOKKOS)
find_program(
HIPCC_EXECUTABLE
NAMES hipcc
HINTS ${ROCmVersion_DIR} ${ROCM_PATH} ENV ROCM_PATH /opt/rocm
PATHS ${ROCmVersion_DIR} ${ROCM_PATH} ENV ROCM_PATH /opt/rocm)
HINTS ${ROCmVersion_DIR} ${ROCM_PATH}
ENV ROCM_PATH
/opt/rocm
PATHS ${ROCmVersion_DIR} ${ROCM_PATH}
ENV ROCM_PATH
/opt/rocm
)
mark_as_advanced(HIPCC_EXECUTABLE)
endif()
kokkos_compilation(PROJECT COMPILER ${HIPCC_EXECUTABLE})
@@ -43,9 +55,7 @@ endif()
set(CMAKE_CXX_EXTENSIONS OFF)
if("${CMAKE_BUILD_TYPE}" STREQUAL "")
set(CMAKE_BUILD_TYPE
"Release"
CACHE STRING "CMake build type" FORCE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "CMake build type" FORCE)
endif()
option(LULESH_USE_MPI "Enable MPI" OFF)
@@ -69,15 +79,19 @@ rocprofiler_systems_causal_example_executable(
"lulesh"
SOURCES ${sources} ${headers}
LINK_LIBRARIES Kokkos::kokkos lulesh-mpi
INCLUDE_DIRECTORIES ${PROJECT_SOURCE_DIR}/includes)
INCLUDE_DIRECTORIES ${PROJECT_SOURCE_DIR}/includes
)
if(ROCPROFSYS_INSTALL_EXAMPLES)
if(LULESH_BUILD_KOKKOS)
install(
TARGETS kokkoscore kokkoscontainers
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT rocprofiler-systems-examples)
set_target_properties(lulesh PROPERTIES INSTALL_RPATH
"\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}")
COMPONENT rocprofiler-systems-examples
)
set_target_properties(
lulesh
PROPERTIES INSTALL_RPATH "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}"
)
endif()
endif()
+26 -19
查看文件
@@ -17,9 +17,7 @@ function(CAPITALIZE str var)
string(TOUPPER "${_first}" _first)
string(SUBSTRING "${str}" 1 -1 _remainder)
string(CONCAT str "${_first}" "${_remainder}")
set(${var}
"${str}"
PARENT_SCOPE)
set(${var} "${str}" PARENT_SCOPE)
endfunction()
# ----------------------------------------------------------------------------------------#
@@ -35,9 +33,12 @@ endfunction()
function(CHECKOUT_GIT_SUBMODULE)
# parse args
cmake_parse_arguments(
CHECKOUT "RECURSIVE"
CHECKOUT
"RECURSIVE"
"RELATIVE_PATH;WORKING_DIRECTORY;TEST_FILE;REPO_URL;REPO_BRANCH"
"ADDITIONAL_CMDS" ${ARGN})
"ADDITIONAL_CMDS"
${ARGN}
)
if(NOT CHECKOUT_WORKING_DIRECTORY)
set(CHECKOUT_WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
@@ -97,15 +98,19 @@ function(CHECKOUT_GIT_SUBMODULE)
if(NOT _TEST_FILE_EXISTS AND _SUBMODULE_EXISTS)
# perform the checkout
execute_process(
COMMAND ${GIT_EXECUTABLE} submodule update --init ${_RECURSE}
${CHECKOUT_ADDITIONAL_CMDS} ${CHECKOUT_RELATIVE_PATH}
COMMAND
${GIT_EXECUTABLE} submodule update --init ${_RECURSE}
${CHECKOUT_ADDITIONAL_CMDS} ${CHECKOUT_RELATIVE_PATH}
WORKING_DIRECTORY ${CHECKOUT_WORKING_DIRECTORY}
RESULT_VARIABLE RET)
RESULT_VARIABLE RET
)
# check the return code
if(RET GREATER 0)
set(_CMD "${GIT_EXECUTABLE} submodule update --init ${_RECURSE}
${CHECKOUT_ADDITIONAL_CMDS} ${CHECKOUT_RELATIVE_PATH}")
set(_CMD
"${GIT_EXECUTABLE} submodule update --init ${_RECURSE}
${CHECKOUT_ADDITIONAL_CMDS} ${CHECKOUT_RELATIVE_PATH}"
)
message(STATUS "function(CHECKOUT_GIT_SUBMODULE) failed.")
message(FATAL_ERROR "Command: \"${_CMD}\"")
else()
@@ -115,7 +120,9 @@ function(CHECKOUT_GIT_SUBMODULE)
if(NOT _TEST_FILE_EXISTS AND _HAS_REPO_URL)
message(
STATUS "Checking out '${CHECKOUT_REPO_URL}' @ '${CHECKOUT_REPO_BRANCH}'...")
STATUS
"Checking out '${CHECKOUT_REPO_URL}' @ '${CHECKOUT_REPO_BRANCH}'..."
)
# remove the existing directory
if(EXISTS "${_DIR}")
@@ -128,16 +135,16 @@ function(CHECKOUT_GIT_SUBMODULE)
${GIT_EXECUTABLE} clone -b ${CHECKOUT_REPO_BRANCH}
${CHECKOUT_ADDITIONAL_CMDS} ${CHECKOUT_REPO_URL} ${CHECKOUT_RELATIVE_PATH}
WORKING_DIRECTORY ${CHECKOUT_WORKING_DIRECTORY}
RESULT_VARIABLE RET)
RESULT_VARIABLE RET
)
# perform the submodule update
if(CHECKOUT_RECURSIVE
AND EXISTS "${_DIR}"
AND IS_DIRECTORY "${_DIR}")
if(CHECKOUT_RECURSIVE AND EXISTS "${_DIR}" AND IS_DIRECTORY "${_DIR}")
execute_process(
COMMAND ${GIT_EXECUTABLE} submodule update --init ${_RECURSE}
WORKING_DIRECTORY ${_DIR}
RESULT_VARIABLE RET)
RESULT_VARIABLE RET
)
endif()
# check the return code
@@ -145,7 +152,7 @@ function(CHECKOUT_GIT_SUBMODULE)
set(_CMD
"${GIT_EXECUTABLE} clone -b ${CHECKOUT_REPO_BRANCH}
${CHECKOUT_ADDITIONAL_CMDS} ${CHECKOUT_REPO_URL} ${CHECKOUT_RELATIVE_PATH}"
)
)
message(STATUS "function(CHECKOUT_GIT_SUBMODULE) failed.")
message(FATAL_ERROR "Command: \"${_CMD}\"")
else()
@@ -156,7 +163,7 @@ function(CHECKOUT_GIT_SUBMODULE)
if(NOT EXISTS "${_TEST_FILE}" OR NOT _TEST_FILE_EXISTS)
message(
FATAL_ERROR
"Error checking out submodule: '${CHECKOUT_RELATIVE_PATH}' to '${_DIR}'")
"Error checking out submodule: '${CHECKOUT_RELATIVE_PATH}' to '${_DIR}'"
)
endif()
endfunction()
+26 -11
查看文件
@@ -5,8 +5,10 @@ project(rocprofiler-systems-mpi-examples LANGUAGES C CXX)
if(ROCPROFSYS_DISABLE_EXAMPLES)
get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME)
if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST
ROCPROFSYS_DISABLE_EXAMPLES)
if(
${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
OR ${_DIR} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
)
return()
endif()
endif()
@@ -18,8 +20,10 @@ if(NOT MPI_FOUND)
else()
set(_MSG_TYPE AUTHOR_WARNING)
endif()
message(${_MSG_TYPE}
"MPI could not be found. Cannot build rocprofiler-systems-mpi target")
message(
${_MSG_TYPE}
"MPI could not be found. Cannot build rocprofiler-systems-mpi target"
)
return()
endif()
@@ -31,8 +35,10 @@ add_library(mpi-c-interface-library INTERFACE)
target_link_libraries(
mpi-c-interface-library
INTERFACE
Threads::Threads MPI::MPI_C
$<TARGET_NAME_IF_EXISTS:rocprofiler-systems::rocprofiler-systems-compile-options>)
Threads::Threads
MPI::MPI_C
$<TARGET_NAME_IF_EXISTS:rocprofiler-systems::rocprofiler-systems-compile-options>
)
target_compile_options(mpi-c-interface-library INTERFACE -Wno-double-promotion)
add_executable(mpi-allgather allgather.c)
@@ -62,16 +68,25 @@ add_library(mpi-cxx-interface-library INTERFACE)
target_link_libraries(
mpi-cxx-interface-library
INTERFACE
Threads::Threads MPI::MPI_CXX
$<TARGET_NAME_IF_EXISTS:rocprofiler-systems::rocprofiler-systems-compile-options>)
Threads::Threads
MPI::MPI_CXX
$<TARGET_NAME_IF_EXISTS:rocprofiler-systems::rocprofiler-systems-compile-options>
)
add_executable(mpi-example mpi.cpp)
target_link_libraries(mpi-example PRIVATE mpi-cxx-interface-library)
if(ROCPROFSYS_INSTALL_EXAMPLES)
install(
TARGETS mpi-example mpi-allgather mpi-bcast mpi-all2all mpi-reduce
mpi-scatter-gather mpi-send-recv
TARGETS
mpi-example
mpi-allgather
mpi-bcast
mpi-all2all
mpi-reduce
mpi-scatter-gather
mpi-send-recv
DESTINATION bin
COMPONENT rocprofiler-systems-examples)
COMPONENT rocprofiler-systems-examples
)
endif()
+42 -18
查看文件
@@ -5,8 +5,10 @@ project(rocprofiler-systems-openmp LANGUAGES CXX)
if(ROCPROFSYS_DISABLE_EXAMPLES)
get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME)
if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST
ROCPROFSYS_DISABLE_EXAMPLES)
if(
${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
OR ${_DIR} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
)
return()
endif()
endif()
@@ -15,10 +17,16 @@ file(GLOB common_source ${CMAKE_CURRENT_SOURCE_DIR}/common/*.cpp)
add_library(openmp-common OBJECT ${common_source})
target_include_directories(openmp-common PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/common)
add_executable(openmp-cg ${CMAKE_CURRENT_SOURCE_DIR}/CG/cg.cpp
$<TARGET_OBJECTS:openmp-common>)
add_executable(openmp-lu ${CMAKE_CURRENT_SOURCE_DIR}/LU/lu.cpp
$<TARGET_OBJECTS:openmp-common>)
add_executable(
openmp-cg
${CMAKE_CURRENT_SOURCE_DIR}/CG/cg.cpp
$<TARGET_OBJECTS:openmp-common>
)
add_executable(
openmp-lu
${CMAKE_CURRENT_SOURCE_DIR}/LU/lu.cpp
$<TARGET_OBJECTS:openmp-common>
)
option(USE_CLANG_OMP "Use the clang OpenMP if available" ON)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
@@ -26,33 +34,48 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
target_link_libraries(openmp-common PUBLIC OpenMP::OpenMP_CXX)
set(ROCPROFSYS_OPENMP_USING_LIBOMP_LIBRARY
ON
CACHE INTERNAL "Used by rocprofiler-systems testing" FORCE)
CACHE INTERNAL
"Used by rocprofiler-systems testing"
FORCE
)
else()
find_program(CLANGXX_EXECUTABLE NAMES clang++)
find_library(
LIBOMP_LIBRARY
NAMES omp omp5 ${CMAKE_SHARED_LIBRARY_PREFIX}omp${CMAKE_SHARED_LIBRARY_SUFFIX}.5)
if(CLANGXX_EXECUTABLE
AND LIBOMP_LIBRARY
AND COMMAND rocprofiler_systems_custom_compilation
AND USE_CLANG_OMP)
NAMES omp omp5 ${CMAKE_SHARED_LIBRARY_PREFIX}omp${CMAKE_SHARED_LIBRARY_SUFFIX}.5
)
if(
CLANGXX_EXECUTABLE
AND LIBOMP_LIBRARY
AND COMMAND rocprofiler_systems_custom_compilation
AND USE_CLANG_OMP
)
target_compile_options(openmp-common PUBLIC -W -Wall -fopenmp=libomp)
target_link_libraries(openmp-common PUBLIC ${LIBOMP_LIBRARY})
rocprofiler_systems_custom_compilation(COMPILER ${CLANGXX_EXECUTABLE}
TARGET openmp-common)
TARGET openmp-common
)
rocprofiler_systems_custom_compilation(COMPILER ${CLANGXX_EXECUTABLE}
TARGET openmp-cg)
TARGET openmp-cg
)
rocprofiler_systems_custom_compilation(COMPILER ${CLANGXX_EXECUTABLE}
TARGET openmp-lu)
TARGET openmp-lu
)
set(ROCPROFSYS_OPENMP_USING_LIBOMP_LIBRARY
ON
CACHE INTERNAL "Used by rocprofiler-systems testing" FORCE)
CACHE INTERNAL
"Used by rocprofiler-systems testing"
FORCE
)
else()
find_package(OpenMP REQUIRED)
target_link_libraries(openmp-common PUBLIC OpenMP::OpenMP_CXX)
set(ROCPROFSYS_OPENMP_USING_LIBOMP_LIBRARY
OFF
CACHE INTERNAL "Used by rocprofiler-systems testing" FORCE)
CACHE INTERNAL
"Used by rocprofiler-systems testing"
FORCE
)
endif()
endif()
@@ -63,7 +86,8 @@ if(ROCPROFSYS_INSTALL_EXAMPLES)
install(
TARGETS openmp-cg openmp-lu
DESTINATION bin
COMPONENT rocprofiler-systems-examples)
COMPONENT rocprofiler-systems-examples
)
endif()
if(ROCPROFSYS_DISABLE_EXAMPLES)
+27 -17
查看文件
@@ -4,15 +4,22 @@ if(NOT OMP_TARGET_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)
HINTS ${ROCM_PATH}
ENV ROCM_PATH
/opt/rocm
PATHS ${ROCM_PATH}
ENV ROCM_PATH
/opt/rocm
PATH_SUFFIXES bin llvm/bin
)
mark_as_advanced(amdclangpp_EXECUTABLE)
if(amdclangpp_EXECUTABLE)
set(OMP_TARGET_COMPILER
"${amdclangpp_EXECUTABLE}"
CACHE FILEPATH "OpenMP target compiler")
CACHE FILEPATH
"OpenMP target compiler"
)
else()
message(WARNING "OpenMP target compiler not found. Skipping this example.")
return()
@@ -36,11 +43,10 @@ set(DEFAULT_GPU_TARGETS
"gfx1010"
"gfx1100"
"gfx1101"
"gfx1102")
"gfx1102"
)
set(GPU_TARGETS
"${DEFAULT_GPU_TARGETS}"
CACHE STRING "GPU targets to compile for")
set(GPU_TARGETS "${DEFAULT_GPU_TARGETS}" CACHE STRING "GPU targets to compile for")
find_package(Threads REQUIRED)
@@ -67,13 +73,15 @@ if(NOT EXISTS ${OMP_TARGET_COMPILER_DIR}/llvm/lib)
endif()
set_target_properties(
openmp-target-lib
PROPERTIES BUILD_RPATH
"${OMP_TARGET_COMPILER_DIR}/llvm/lib:${OMP_TARGET_COMPILER_DIR}/lib"
OUTPUT_NAME "openmp-target"
POSITION_INDEPENDENT_CODE ON)
PROPERTIES
BUILD_RPATH "${OMP_TARGET_COMPILER_DIR}/llvm/lib:${OMP_TARGET_COMPILER_DIR}/lib"
OUTPUT_NAME "openmp-target"
POSITION_INDEPENDENT_CODE ON
)
rocprofiler_systems_custom_compilation(TARGET openmp-target-lib
COMPILER ${OMP_TARGET_COMPILER})
COMPILER ${OMP_TARGET_COMPILER}
)
add_executable(openmp-target)
target_sources(openmp-target PRIVATE main.cpp)
@@ -82,9 +90,11 @@ target_compile_options(openmp-target PRIVATE -ggdb)
set_target_properties(
openmp-target
PROPERTIES BUILD_RPATH
"${OMP_TARGET_COMPILER_DIR}/llvm/lib:${OMP_TARGET_COMPILER_DIR}/lib"
POSITION_INDEPENDENT_CODE ON)
PROPERTIES
BUILD_RPATH "${OMP_TARGET_COMPILER_DIR}/llvm/lib:${OMP_TARGET_COMPILER_DIR}/lib"
POSITION_INDEPENDENT_CODE ON
)
rocprofiler_systems_custom_compilation(TARGET openmp-target
COMPILER ${OMP_TARGET_COMPILER})
COMPILER ${OMP_TARGET_COMPILER}
)
+14 -7
查看文件
@@ -5,8 +5,10 @@ project(rocprofiler-systems-parallel-overhead-example LANGUAGES CXX)
if(ROCPROFSYS_DISABLE_EXAMPLES)
get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME)
if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST
ROCPROFSYS_DISABLE_EXAMPLES)
if(
${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
OR ${_DIR} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
)
return()
endif()
endif()
@@ -18,17 +20,22 @@ add_library(parallel-overhead-compile-options INTERFACE)
target_compile_options(parallel-overhead-compile-options INTERFACE -g)
add_executable(parallel-overhead parallel-overhead.cpp)
target_link_libraries(parallel-overhead PRIVATE Threads::Threads
parallel-overhead-compile-options)
target_link_libraries(
parallel-overhead
PRIVATE Threads::Threads parallel-overhead-compile-options
)
add_executable(parallel-overhead-locks parallel-overhead.cpp)
target_link_libraries(parallel-overhead-locks PRIVATE Threads::Threads
parallel-overhead-compile-options)
target_link_libraries(
parallel-overhead-locks
PRIVATE Threads::Threads parallel-overhead-compile-options
)
target_compile_definitions(parallel-overhead-locks PRIVATE USE_LOCKS=1)
if(ROCPROFSYS_INSTALL_EXAMPLES)
install(
TARGETS parallel-overhead parallel-overhead-locks
DESTINATION bin
COMPONENT rocprofiler-systems-examples)
COMPONENT rocprofiler-systems-examples
)
endif()
+18 -6
查看文件
@@ -5,13 +5,21 @@ project(rocprofiler-systems-python)
if(ROCPROFSYS_DISABLE_EXAMPLES)
get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME)
if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST
ROCPROFSYS_DISABLE_EXAMPLES)
if(
${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
OR ${_DIR} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
)
return()
endif()
endif()
set(PYTHON_FILES builtin.py external.py source.py noprofile.py fill.py)
set(PYTHON_FILES
builtin.py
external.py
source.py
noprofile.py
fill.py
)
find_package(Python3 COMPONENTS Interpreter)
@@ -19,14 +27,18 @@ if(Python3_FOUND)
set(PYTHON_EXECUTABLE "${Python3_EXECUTABLE}")
foreach(_FILE ${PYTHON_FILES})
configure_file(${PROJECT_SOURCE_DIR}/${_FILE} ${PROJECT_BINARY_DIR}/${_FILE}
@ONLY)
configure_file(
${PROJECT_SOURCE_DIR}/${_FILE}
${PROJECT_BINARY_DIR}/${_FILE}
@ONLY
)
if(ROCPROFSYS_INSTALL_EXAMPLES)
install(
PROGRAMS ${PROJECT_BINARY_DIR}/${_FILE}
DESTINATION bin
COMPONENT rocprofiler-systems-examples)
COMPONENT rocprofiler-systems-examples
)
endif()
endforeach()
endif()
+30 -20
查看文件
@@ -5,16 +5,20 @@ project(rocprofiler-systems-rccl-example LANGUAGES CXX)
if(ROCPROFSYS_DISABLE_EXAMPLES)
get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME)
if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST
ROCPROFSYS_DISABLE_EXAMPLES)
if(
${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
OR ${_DIR} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
)
return()
endif()
endif()
function(rccl_message _MSG_TYPE)
if("${CMAKE_PROJECT_NAME}" STREQUAL "rocprofiler-systems"
AND "$ENV{ROCPROFSYS_CI}"
AND "${_MSG_TYPE}" MATCHES "WARNING")
if(
"${CMAKE_PROJECT_NAME}" STREQUAL "rocprofiler-systems"
AND "$ENV{ROCPROFSYS_CI}"
AND "${_MSG_TYPE}" MATCHES "WARNING"
)
set(_MSG_TYPE STATUS) # don't generate warnings during CI
endif()
if("${CMAKE_PROJECT_NAME}" STREQUAL "rocprofiler-systems")
@@ -31,10 +35,10 @@ if(NOT hip_FOUND)
return()
endif()
if("${CMAKE_PROJECT_NAME}" STREQUAL "rocprofiler-systems"
AND ("$ENV{ROCPROFSYS_CI}"
OR ROCPROFSYS_CI
OR ROCPROFSYS_BUILD_CI))
if(
"${CMAKE_PROJECT_NAME}" STREQUAL "rocprofiler-systems"
AND ("$ENV{ROCPROFSYS_CI}" OR ROCPROFSYS_CI OR ROCPROFSYS_BUILD_CI)
)
find_package(rccl QUIET) # avoid generating warning in CI
else()
find_package(rccl)
@@ -47,11 +51,11 @@ endif()
if(hip_FOUND AND rccl_FOUND)
include(FetchContent)
fetchcontent_declare(rccl-tests GIT_REPOSITORY https://github.com/ROCm/rccl-tests.git)
FetchContent_Declare(rccl-tests GIT_REPOSITORY https://github.com/ROCm/rccl-tests.git)
# After the following call, the CMake targets defined by googletest and Catch2 will be
# available to the rest of the build
fetchcontent_populate(rccl-tests)
FetchContent_Populate(rccl-tests)
get_filename_component(rccl_ROOT_DIR "${rccl_INCLUDE_DIR}" DIRECTORY)
@@ -62,29 +66,35 @@ if(hip_FOUND AND rccl_FOUND)
RESULT_VARIABLE _RCCL_BUILD_RET
ERROR_VARIABLE _RCCL_BUILD_ERR
OUTPUT_VARIABLE _RCCL_BUILD_OUT
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_STRIP_TRAILING_WHITESPACE)
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_STRIP_TRAILING_WHITESPACE
)
if(NOT _RCCL_BUILD_RET EQUAL 0)
rccl_message(${_RCCL_BUILD_OUT})
rccl_message(AUTHOR_WARNING "Failed to build rccl-tests: ${_RCCL_BUILD_ERR}")
else()
file(GLOB RCCL_TEST_EXECUTABLES
${CMAKE_BINARY_DIR}/_deps/rccl-tests-src/build/*_perf)
file(
GLOB RCCL_TEST_EXECUTABLES
${CMAKE_BINARY_DIR}/_deps/rccl-tests-src/build/*_perf
)
set(_RCCL_TEST_TARGETS)
foreach(_EXE ${RCCL_TEST_EXECUTABLES})
get_filename_component(_EXE_NAME "${_EXE}" NAME)
execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${_EXE}
${CMAKE_CURRENT_BINARY_DIR}/${_EXE_NAME})
execute_process(
COMMAND
${CMAKE_COMMAND} -E copy ${_EXE}
${CMAKE_CURRENT_BINARY_DIR}/${_EXE_NAME}
)
add_executable(rccl-tests::${_EXE_NAME} IMPORTED GLOBAL)
set_property(
TARGET rccl-tests::${_EXE_NAME}
PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/${_EXE_NAME})
PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/${_EXE_NAME}
)
list(APPEND _RCCL_TEST_TARGETS "rccl-tests::${_EXE_NAME}")
endforeach()
set(RCCL_TEST_TARGETS
"${_RCCL_TEST_TARGETS}"
CACHE INTERNAL "rccl-test targets")
set(RCCL_TEST_TARGETS "${_RCCL_TEST_TARGETS}" CACHE INTERNAL "rccl-test targets")
endif()
endif()
+5 -6
查看文件
@@ -5,8 +5,10 @@ project(rocprofiler-systems-rewrite-caller-example LANGUAGES CXX)
if(ROCPROFSYS_DISABLE_EXAMPLES)
get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME)
if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST
ROCPROFSYS_DISABLE_EXAMPLES)
if(
${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
OR ${_DIR} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
)
return()
endif()
endif()
@@ -17,8 +19,5 @@ add_executable(rewrite-caller rewrite-caller.cpp)
target_compile_options(rewrite-caller PRIVATE ${_FLAGS})
if(ROCPROFSYS_INSTALL_EXAMPLES)
install(
TARGETS rewrite-caller
DESTINATION bin
COMPONENT rocprofiler-systems-examples)
install(TARGETS rewrite-caller DESTINATION bin COMPONENT rocprofiler-systems-examples)
endif()
+6 -3
查看文件
@@ -5,8 +5,10 @@ project(rocprofiler-systems-trace-time-window-example LANGUAGES CXX)
if(ROCPROFSYS_DISABLE_EXAMPLES)
get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME)
if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST
ROCPROFSYS_DISABLE_EXAMPLES)
if(
${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
OR ${_DIR} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
)
return()
endif()
endif()
@@ -20,5 +22,6 @@ if(ROCPROFSYS_INSTALL_EXAMPLES)
install(
TARGETS trace-time-window
DESTINATION bin
COMPONENT rocprofiler-systems-examples)
COMPONENT rocprofiler-systems-examples
)
endif()
+32 -20
查看文件
@@ -5,8 +5,10 @@ project(rocprofiler-systems-transpose-example LANGUAGES CXX)
if(ROCPROFSYS_DISABLE_EXAMPLES)
get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME)
if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST
ROCPROFSYS_DISABLE_EXAMPLES)
if(
${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
OR ${_DIR} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
)
return()
endif()
endif()
@@ -16,8 +18,14 @@ find_package(hip QUIET HINTS ${ROCmVersion_DIR} PATHS ${ROCmVersion_DIR})
find_program(
HIPCC_EXECUTABLE
NAMES hipcc
HINTS ${ROCmVersion_DIR} ${ROCM_PATH} ENV ROCM_PATH /opt/rocm
PATHS ${ROCmVersion_DIR} ${ROCM_PATH} ENV ROCM_PATH /opt/rocm NO_CACHE)
HINTS ${ROCmVersion_DIR} ${ROCM_PATH}
ENV ROCM_PATH
/opt/rocm
PATHS ${ROCmVersion_DIR} ${ROCM_PATH}
ENV ROCM_PATH
/opt/rocm
NO_CACHE
)
mark_as_advanced(HIPCC_EXECUTABLE)
if(NOT HIPCC_EXECUTABLE)
@@ -26,17 +34,21 @@ if(NOT HIPCC_EXECUTABLE)
endif()
if(NOT CMAKE_CXX_COMPILER_IS_HIPCC AND HIPCC_EXECUTABLE)
if(CMAKE_CXX_COMPILER STREQUAL HIPCC_EXECUTABLE OR "${CMAKE_CXX_COMPILER}" MATCHES
"hipcc")
set(CMAKE_CXX_COMPILER_IS_HIPCC
1
CACHE BOOL "HIP compiler")
if(
CMAKE_CXX_COMPILER STREQUAL HIPCC_EXECUTABLE
OR "${CMAKE_CXX_COMPILER}" MATCHES "hipcc"
)
set(CMAKE_CXX_COMPILER_IS_HIPCC 1 CACHE BOOL "HIP compiler")
endif()
endif()
if((NOT CMAKE_CXX_COMPILER_IS_HIPCC OR (NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang"
AND NOT hip_FOUND))
AND (NOT COMMAND rocprofiler_systems_custom_compilation AND NOT HIPCC_EXECUTABLE))
if(
(
NOT CMAKE_CXX_COMPILER_IS_HIPCC
OR (NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT hip_FOUND)
)
AND (NOT COMMAND rocprofiler_systems_custom_compilation AND NOT HIPCC_EXECUTABLE)
)
message(AUTHOR_WARNING "transpose target could not be built")
return()
endif()
@@ -51,15 +63,18 @@ endif()
add_executable(transpose transpose.cpp)
target_link_libraries(transpose PRIVATE Threads::Threads)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang"
AND NOT CMAKE_CXX_COMPILER_IS_HIPCC
AND NOT HIPCC_EXECUTABLE)
if(
CMAKE_CXX_COMPILER_ID MATCHES "Clang"
AND NOT CMAKE_CXX_COMPILER_IS_HIPCC
AND NOT HIPCC_EXECUTABLE
)
target_link_libraries(
transpose
PRIVATE
$<TARGET_NAME_IF_EXISTS:rocprofiler-systems::rocprofiler-systems-compile-options>
$<TARGET_NAME_IF_EXISTS:hip::host>
$<TARGET_NAME_IF_EXISTS:hip::device>)
$<TARGET_NAME_IF_EXISTS:hip::device>
)
else()
target_compile_options(transpose PRIVATE -W -Wall)
endif()
@@ -79,8 +94,5 @@ if(NOT CMAKE_CXX_COMPILER_IS_HIPCC AND HIPCC_EXECUTABLE)
endif()
if(ROCPROFSYS_INSTALL_EXAMPLES)
install(
TARGETS transpose
DESTINATION bin
COMPONENT rocprofiler-systems-examples)
install(TARGETS transpose DESTINATION bin COMPONENT rocprofiler-systems-examples)
endif()
+8 -8
查看文件
@@ -5,8 +5,10 @@ project(rocprofiler-systems-user-api-example LANGUAGES CXX)
if(ROCPROFSYS_DISABLE_EXAMPLES)
get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME)
if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST
ROCPROFSYS_DISABLE_EXAMPLES)
if(
${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
OR ${_DIR} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
)
return()
endif()
endif()
@@ -18,12 +20,10 @@ if(NOT TARGET rocprofiler-systems::rocprofiler-systems-user-library)
endif()
add_executable(user-api user-api.cpp)
target_link_libraries(
user-api PRIVATE Threads::Threads
rocprofiler-systems::rocprofiler-systems-user-library)
user-api
PRIVATE Threads::Threads rocprofiler-systems::rocprofiler-systems-user-library
)
if(ROCPROFSYS_INSTALL_EXAMPLES)
install(
TARGETS user-api
DESTINATION bin
COMPONENT rocprofiler-systems-examples)
install(TARGETS user-api DESTINATION bin COMPONENT rocprofiler-systems-examples)
endif()
+21 -22
查看文件
@@ -30,16 +30,20 @@ string(REPLACE " " ";" _FLAGS "${CMAKE_CXX_FLAGS_DEBUG}")
if(ROCPROFSYS_DISABLE_EXAMPLES)
get_filename_component(_DIR ${CMAKE_CURRENT_LIST_DIR} NAME)
if(${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES OR ${_DIR} IN_LIST
ROCPROFSYS_DISABLE_EXAMPLES)
if(
${PROJECT_NAME} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
OR ${_DIR} IN_LIST ROCPROFSYS_DISABLE_EXAMPLES
)
return()
endif()
endif()
function(videodecode_message _MSG_TYPE)
if("${CMAKE_PROJECT_NAME}" STREQUAL "rocprofiler-systems"
AND "$ENV{ROCPROFSYS_CI}"
AND "${_MSG_TYPE}" MATCHES "WARNING")
if(
"${CMAKE_PROJECT_NAME}" STREQUAL "rocprofiler-systems"
AND "$ENV{ROCPROFSYS_CI}"
AND "${_MSG_TYPE}" MATCHES "WARNING"
)
set(_MSG_TYPE STATUS) # don't generate warnings during CI
endif()
if("${CMAKE_PROJECT_NAME}" STREQUAL "rocprofiler-systems")
@@ -67,7 +71,8 @@ if(EXISTS "${ROCmVersion_DIR}/share/rocdecode/video")
else()
videodecode_message(
AUTHOR_WARNING
"Source directory ${ROCmVersion_DIR}/share/rocdecode/video does not exist")
"Source directory ${ROCmVersion_DIR}/share/rocdecode/video does not exist"
)
endif()
# Find FFMPEG
@@ -86,19 +91,11 @@ find_path(
FFMPEG_INCLUDE_DIR
NAMES libavcodec/avcodec.h libavformat/avformat.h libavutil/avutil.h
PATHS ${FFMPEG_INCLUDE_DIRS}
PATH_SUFFIXES ffmpeg libav)
find_library(
AVCODEC_LIBRARY
NAMES avcodec
PATHS ${FFMPEG_LIBRARY_DIRS})
find_library(
AVFORMAT_LIBRARY
NAMES avformat
PATHS ${FFMPEG_LIBRARY_DIRS})
find_library(
AVUTIL_LIBRARY
NAMES avutil
PATHS ${FFMPEG_LIBRARY_DIRS})
PATH_SUFFIXES ffmpeg libav
)
find_library(AVCODEC_LIBRARY NAMES avcodec PATHS ${FFMPEG_LIBRARY_DIRS})
find_library(AVFORMAT_LIBRARY NAMES avformat PATHS ${FFMPEG_LIBRARY_DIRS})
find_library(AVUTIL_LIBRARY NAMES avutil PATHS ${FFMPEG_LIBRARY_DIRS})
set(FFMPEG_LIBRARIES ${AVCODEC_LIBRARY} ${AVFORMAT_LIBRARY} ${AVUTIL_LIBRARY})
set(FFMPEG_INCLUDE_DIRS ${FFMPEG_INCLUDE_DIR})
@@ -143,16 +140,18 @@ if(FFMPEG_FOUND AND ROCDECODE_FOUND)
install(
TARGETS videodecode
DESTINATION bin
COMPONENT rocprofiler-systems-examples)
COMPONENT rocprofiler-systems-examples
)
install(
FILES ${CMAKE_BINARY_DIR}/videos
DESTINATION share/rocprofiler-systems/tests/videos
COMPONENT rocprofiler-systems-examples)
COMPONENT rocprofiler-systems-examples
)
endif()
else()
message(
"-- ERROR!: videodecode excluded! please install all the dependencies and try again!"
)
)
if(NOT FFMPEG_FOUND)
message(WARNING "-- ERROR!: FFMPEG Not Found! - please install FFMPEG!")
endif()