Skip to content

Commit

Permalink
update C++ standard for CUDA and HIP
Browse files Browse the repository at this point in the history
  • Loading branch information
upsj committed May 1, 2024
1 parent d67b426 commit 6b2393e
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions cmake/build_helpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ function(ginkgo_compile_features name)
target_compile_features("${name}" PUBLIC cxx_std_17)
# we set these properties regardless of the enabled backends,
# because unknown properties are ignored
set_target_properties("${name}" PROPERTIES HIP_STANDARD 14)
set_target_properties("${name}" PROPERTIES CUDA_STANDARD 14)
set_target_properties("${name}" PROPERTIES HIP_STANDARD 17)
set_target_properties("${name}" PROPERTIES CUDA_STANDARD 17)
if(GINKGO_WITH_CLANG_TIDY AND GINKGO_CLANG_TIDY_PATH)
set_property(TARGET "${name}" PROPERTY CXX_CLANG_TIDY "${GINKGO_CLANG_TIDY_PATH};-checks=*")
endif()
Expand Down
4 changes: 2 additions & 2 deletions cmake/create_test.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ function(ginkgo_set_test_target_properties test_target_name test_library_suffix)
target_compile_features(${test_target_name} PUBLIC cxx_std_14)
# we set these properties regardless of the enabled backends,
# because unknown properties are ignored
set_target_properties(${test_target_name} PROPERTIES HIP_STANDARD 14)
set_target_properties(${test_target_name} PROPERTIES CUDA_STANDARD 14)
set_target_properties(${test_target_name} PROPERTIES HIP_STANDARD 17)
set_target_properties(${test_target_name} PROPERTIES CUDA_STANDARD 17)
target_include_directories(${test_target_name} PRIVATE ${Ginkgo_BINARY_DIR} ${set_properties_ADDITIONAL_INCLUDES})
target_link_libraries(${test_target_name} PRIVATE ginkgo GTest::GTest ${set_properties_ADDITIONAL_LIBRARIES})
endfunction()
Expand Down
2 changes: 1 addition & 1 deletion cmake/hip.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,4 @@ find_package(ROCTX)
if(GINKGO_HIP_AMD_UNSAFE_ATOMIC AND GINKGO_HIP_VERSION VERSION_GREATER_EQUAL 5)
set(CMAKE_HIP_FLAGS "${CMAKE_HIP_FLAGS} -munsafe-fp-atomics -Wno-unused-command-line-argument")
endif()
set(CMAKE_HIP_STANDARD 14)
set(CMAKE_HIP_STANDARD 17)
2 changes: 1 addition & 1 deletion examples/custom-matrix-format/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ if(NOT (GINKGO_BUILD_CUDA AND GINKGO_BUILD_OMP))
"This example needs Ginkgo built with CUDA and OpenMP support")
endif()

set(CMAKE_CUDA_STANDARD 14)
set(CMAKE_CUDA_STANDARD 17)
set(CMAKE_CUDA_STANDARD_REQUIRED ON)

add_executable(custom-matrix-format custom-matrix-format.cpp stencil_kernel.cu)
Expand Down
4 changes: 2 additions & 2 deletions test/test_install/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ if(GINKGO_BUILD_CUDA)
enable_language(CUDA)
configure_file(test_install.cpp test_install.cu COPYONLY)
add_executable(test_install_cuda ${CMAKE_CURRENT_BINARY_DIR}/test_install.cu)
set_target_properties(test_install_cuda PROPERTIES CUDA_STANDARD 14)
set_target_properties(test_install_cuda PROPERTIES CUDA_STANDARD 17)
target_compile_definitions(test_install_cuda PRIVATE HAS_CUDA=1)
target_compile_definitions(test_install_cuda PRIVATE HAS_REFERENCE=${HAS_REFERENCE})
target_link_libraries(test_install_cuda PRIVATE Ginkgo::ginkgo)
Expand All @@ -49,7 +49,7 @@ if(GINKGO_BUILD_HIP)
configure_file(test_install.cpp test_install.hip.cpp COPYONLY)
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/test_install.hip.cpp PROPERTIES LANGUAGE HIP)
add_executable(test_install_hip ${CMAKE_CURRENT_BINARY_DIR}/test_install.hip.cpp)
set_target_properties(test_install_hip PROPERTIES HIP_STANDARD 14)
set_target_properties(test_install_hip PROPERTIES HIP_STANDARD 17)

target_link_libraries(test_install_hip PRIVATE Ginkgo::ginkgo)
target_compile_definitions(test_install_hip PRIVATE HAS_HIP=1)
Expand Down

0 comments on commit 6b2393e

Please sign in to comment.