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>
このコミットが含まれているのは:
@@ -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)
|
||||
|
||||
@@ -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}
|
||||
)
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする