mirror of
https://github.com/NVIDIA/nvbench.git
synced 2026-03-14 20:27:24 +00:00
Squashed commit of the following:
commitc5b2fc0a8bAuthor: Allison Piper <alliepiper16@gmail.com> Date: Sat Apr 6 21:48:20 2024 +0000 Add supported compilers and tools in README.md. commit92fe366da5Author: Allison Piper <alliepiper16@gmail.com> Date: Sat Apr 6 20:45:30 2024 +0000 Fix issues discovered by header tests. commitf7f6c92143Author: Allison Piper <alliepiper16@gmail.com> Date: Sat Apr 6 20:45:06 2024 +0000 Setup header tests, add C++20 header tests + examples. The core library will always be built with C++17, but we test our headers / examples under 17 and 20. commit4b24f26b66Author: Allison Piper <alliepiper16@gmail.com> Date: Sat Apr 6 16:21:42 2024 +0000 Pass CUDA FLAGS to install tests. commit4fb672ae91Author: Allison Piper <alliepiper16@gmail.com> Date: Sat Apr 6 15:43:41 2024 +0000 Add newer GCC (13) and Clang (17, 18).
This commit is contained in:
@@ -14,47 +14,58 @@ set(example_srcs
|
||||
add_custom_target(nvbench.example.all)
|
||||
add_dependencies(nvbench.all nvbench.example.all)
|
||||
|
||||
foreach(example_src IN LISTS example_srcs)
|
||||
get_filename_component(example_name "${example_src}" NAME_WLE)
|
||||
string(PREPEND example_name "nvbench.example.")
|
||||
add_executable(${example_name} "${example_src}")
|
||||
nvbench_config_target(${example_name})
|
||||
target_include_directories(${example_name} PRIVATE "${CMAKE_CURRENT_LIST_DIR}")
|
||||
target_link_libraries(${example_name} PRIVATE nvbench::main)
|
||||
set_target_properties(${example_name} PROPERTIES COMPILE_FEATURES cuda_std_17)
|
||||
add_test(NAME ${example_name}
|
||||
COMMAND "$<TARGET_FILE:${example_name}>" --timeout 0.1 --min-time 1e-5
|
||||
|
||||
function (nvbench_add_examples_target target_prefix cuda_std)
|
||||
add_custom_target(${target_prefix}.all)
|
||||
add_dependencies(nvbench.example.all ${target_prefix}.all)
|
||||
|
||||
foreach(example_src IN LISTS example_srcs)
|
||||
get_filename_component(example_name "${example_src}" NAME_WLE)
|
||||
string(PREPEND example_name "${target_prefix}.")
|
||||
add_executable(${example_name} "${example_src}")
|
||||
nvbench_config_target(${example_name})
|
||||
target_include_directories(${example_name} PRIVATE "${CMAKE_CURRENT_LIST_DIR}")
|
||||
target_link_libraries(${example_name} PRIVATE nvbench::main)
|
||||
set_target_properties(${example_name} PROPERTIES COMPILE_FEATURES cuda_std_${cuda_std})
|
||||
add_test(NAME ${example_name}
|
||||
COMMAND "$<TARGET_FILE:${example_name}>" --timeout 0.1 --min-time 1e-5
|
||||
)
|
||||
|
||||
# These should not deadlock. If they do, it may be that the CUDA context was created before
|
||||
# setting CUDA_MODULE_LOAD=EAGER in main, see NVIDIA/nvbench#136.
|
||||
set_tests_properties(${example_name} PROPERTIES
|
||||
FAIL_REGULAR_EXPRESSION "Possible Deadlock Detected"
|
||||
)
|
||||
|
||||
add_dependencies(${target_prefix}.all ${example_name})
|
||||
endforeach()
|
||||
|
||||
# Silence some warnings from old thrust headers:
|
||||
set(thrust_examples
|
||||
auto_throughput
|
||||
axes
|
||||
custom_criterion
|
||||
exec_tag_sync
|
||||
exec_tag_timer
|
||||
skip
|
||||
stream
|
||||
throughput
|
||||
)
|
||||
foreach (example IN LISTS thrust_examples)
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
# C4324: structure was padded due to alignment specifier
|
||||
nvbench_add_cxx_flag(${target_prefix}.${example} PRIVATE "/wd4324")
|
||||
|
||||
# These should not deadlock. If they do, it may be that the CUDA context was created before
|
||||
# setting CUDA_MODULE_LOAD=EAGER in main, see NVIDIA/nvbench#136.
|
||||
set_tests_properties(${example_name} PROPERTIES
|
||||
FAIL_REGULAR_EXPRESSION "Possible Deadlock Detected"
|
||||
)
|
||||
|
||||
add_dependencies(nvbench.example.all ${example_name})
|
||||
endforeach()
|
||||
|
||||
# Silence some warnings from old thrust headers:
|
||||
set(thrust_examples
|
||||
auto_throughput
|
||||
axes
|
||||
custom_criterion
|
||||
exec_tag_sync
|
||||
exec_tag_timer
|
||||
skip
|
||||
stream
|
||||
throughput
|
||||
)
|
||||
foreach (example IN LISTS thrust_examples)
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
# C4324: structure was padded due to alignment specifier
|
||||
nvbench_add_cxx_flag(nvbench.example.${example} PRIVATE "/wd4324")
|
||||
|
||||
# warning C4201: nonstandard extension used: nameless struct/union:
|
||||
# Fixed in Thrust 1.12.0 (CTK 11.4, NV HPC 21.3)
|
||||
if (${CUDAToolkit_VERSION} VERSION_LESS 11.4)
|
||||
nvbench_add_cxx_flag(nvbench.example.${example} PRIVATE "/wd4201")
|
||||
# warning C4201: nonstandard extension used: nameless struct/union:
|
||||
# Fixed in Thrust 1.12.0 (CTK 11.4, NV HPC 21.3)
|
||||
if (${CUDAToolkit_VERSION} VERSION_LESS 11.4)
|
||||
nvbench_add_cxx_flag(${target_prefix}.${example} PRIVATE "/wd4201")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
|
||||
foreach (std IN LISTS NVBench_DETECTED_CUDA_STANDARDS)
|
||||
nvbench_add_examples_target(nvbench.example.cpp${std} ${std})
|
||||
endforeach()
|
||||
|
||||
Reference in New Issue
Block a user