Skip to content

Commit

Permalink
Fixed CMake linting
Browse files Browse the repository at this point in the history
  • Loading branch information
Beanavil committed Dec 3, 2024
1 parent f08ccc0 commit e702427
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 11 deletions.
6 changes: 4 additions & 2 deletions Tutorials/reduction/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,16 @@ if("${GPU_RUNTIME}" STREQUAL "CUDA")
else()
cmake_minimum_required(VERSION 3.21)
if(WIN32)
message(STATUS "The reduction tutorial is not supported on Windows. Not building.")
message(
STATUS
"The reduction tutorial is not supported on Windows. Not building."
)
return()
endif()
endif()

project(Reduction LANGUAGES CXX)


file(RELATIVE_PATH folder_bin ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/${folder_bin})

Expand Down
14 changes: 10 additions & 4 deletions Tutorials/reduction/benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,24 @@ list(APPEND include_dirs "${PROJECT_SOURCE_DIR}")
if("${GPU_RUNTIME}" STREQUAL "CUDA")
# For examples targeting NVIDIA, include the HIP header directory.
list(APPEND include_dirs "${ROCM_ROOT}/include")

# Some CUDA versions have issues when compiling for C++20 on Windows, check if we are using those
if(WIN32)
find_package(CUDA)
if(CUDA_FOUND)
set(FAULTY_CUDA_VERSION "12.5")
if(CUDA_VERSION VERSION_LESS_EQUAL ${FAULTY_CUDA_VERSION})
message(WARNING "CUDA version ${CUDA_VERSION} has issues when compiling for C++20. Not building reduction benchmarks.")
message(
WARNING
"CUDA version ${CUDA_VERSION} has issues when compiling for C++20. Not building reduction benchmarks."
)
return()
endif()
else()
message(STATUS "CUDA Toolkit not found. Not building reduction benchmarks.")
message(
STATUS
"CUDA Toolkit not found. Not building reduction benchmarks."
)
return()
endif()
endif()
Expand Down Expand Up @@ -158,7 +164,7 @@ foreach(VER RANGE 0 10)
${Sources}
PROPERTIES LANGUAGE ${GPU_RUNTIME}
)
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ROCM_ROOT}/cmake)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ROCM_ROOT}/cmake)
find_package(HIP MODULE REQUIRED)
target_include_directories(
${TargetName}
Expand Down
10 changes: 8 additions & 2 deletions Tutorials/reduction/example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,17 @@ if("${GPU_RUNTIME}" STREQUAL "CUDA")
if(CUDA_FOUND)
set(FAULTY_CUDA_VERSION "12.5")
if(CUDA_VERSION VERSION_LESS_EQUAL ${FAULTY_CUDA_VERSION})
message(WARNING "CUDA version ${CUDA_VERSION} has issues when compiling for C++20. Not building reduction examples.")
message(
WARNING
"CUDA version ${CUDA_VERSION} has issues when compiling for C++20. Not building reduction examples."
)
return()
endif()
else()
message(STATUS "CUDA Toolkit not found. Not building reduction examples.")
message(
STATUS
"CUDA Toolkit not found. Not building reduction examples."
)
return()
endif()
endif()
Expand Down
12 changes: 9 additions & 3 deletions Tutorials/reduction/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,17 @@ if("${GPU_RUNTIME}" STREQUAL "CUDA")
if(CUDA_FOUND)
set(FAULTY_CUDA_VERSION "12.5")
if(CUDA_VERSION VERSION_LESS_EQUAL ${FAULTY_CUDA_VERSION})
message(WARNING "CUDA version ${CUDA_VERSION} has issues when compiling for C++20. Not building reduction tests.")
message(
WARNING
"CUDA version ${CUDA_VERSION} has issues when compiling for C++20. Not building reduction tests."
)
return()
endif()
else()
message(STATUS "CUDA Toolkit not found. Not building reduction tests.")
message(
STATUS
"CUDA Toolkit not found. Not building reduction tests."
)
return()
endif()
endif()
Expand Down Expand Up @@ -179,7 +185,7 @@ foreach(VER RANGE 1 10)
${Sources}
PROPERTIES LANGUAGE ${GPU_RUNTIME}
)
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ROCM_ROOT}/cmake)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ROCM_ROOT}/cmake)
find_package(HIP MODULE REQUIRED)
target_include_directories(
${TargetName}
Expand Down

0 comments on commit e702427

Please sign in to comment.