Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Auto-fetch benchmark when not available #1039

Merged
merged 1 commit into from
Mar 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,32 @@ find_package(Boost 1.56.0 REQUIRED COMPONENTS program_options)

# FIXME: when we start requiring benchmark >= 1.8.0, reenable
# "readability-redundant-string-cstr" check in .clang-tidy
find_package(benchmark 1.5.4 REQUIRED)
message(STATUS "Found benchmark: ${benchmark_DIR} (version \"${benchmark_VERSION}\")")
find_package(benchmark QUIET 1.5.4)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with

find_package(benchmark QUIET 1.5.4 NO_DEFAULT_PATH)

if(benchmark_FOUND)
message(STATUS "Found benchmark: ${benchmark_DIR} (version \"${benchmark_VERSION}\")")
else()
message(STATUS "benchmark not found, fetching from GitHub")
include(FetchContent)
set(BENCHMARK_ENABLE_TESTING OFF)

list(APPEND CMAKE_MESSAGE_INDENT "[benchmark] ")
FetchContent_Declare(
googlebenchmark
DOWNLOAD_EXTRACT_TIMESTAMP FALSE
URL https://github.com/google/benchmark/archive/refs/tags/v1.8.0.tar.gz
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you comment on the version you picked?

Copy link
Contributor Author

@aprokop aprokop Mar 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I decided to up the version so that when we fix the comment about (about reenabling clang-tidy check), we would not need to change this. No other reason. The latest Google Benchmark is 1.8.3, so same major.

I am aware of the discussion in Kokkos about problems with fetching new versions in the original PR (something to do with Windows). I'm not sure whether that is still an issue.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI benchmark Windows issue is still open: google/benchmark#1441. Kokkos deals with it by simply disabling benchmarks in Windows CI 😉

URL_HASH MD5=8ddf8571d3f6198d37852bcbd964f817
)
FetchContent_MakeAvailable(googlebenchmark)
list(POP_BACK CMAKE_MESSAGE_INDENT)

# Suppress clang-tidy diagnostics on code that we do not have control over
IF(CMAKE_CXX_CLANG_TIDY)
set_target_properties(benchmark PROPERTIES CXX_CLANG_TIDY "")
ENDIF()

target_compile_options(benchmark PRIVATE -w)
target_compile_options(benchmark_main PRIVATE -w)
ENDIF()

add_subdirectory(brute_force_vs_bvh)
add_subdirectory(dbscan)
Expand Down
Loading