Skip to content

Commit

Permalink
Babelstream benchmark activation and refactoring
Browse files Browse the repository at this point in the history
Co-authored-by: René Widera <[email protected]>
Co-authored-by: Simeon Ehrig <[email protected]>
  • Loading branch information
2 people authored and mehmetyusufoglu committed Sep 16, 2024
1 parent b4dc73a commit 1840791
Show file tree
Hide file tree
Showing 11 changed files with 1,054 additions and 942 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ endif()
option(alpaka_INSTALL_TEST_HEADER "Install headers of the namespace alpaka::test. Attention, headers are not designed for production code, see documentation." OFF)

include(CMakeDependentOption)

cmake_dependent_option(alpaka_CHECK_HEADERS "Check all alpaka headers as part of the tests whether they can be compiled standalone." OFF BUILD_TESTING OFF)
cmake_dependent_option(alpaka_USE_INTERNAL_CATCH2 "Use internally shipped Catch2" ON BUILD_TESTING OFF)
cmake_dependent_option(alpaka_USE_INTERNAL_CATCH2 "Use internally shipped Catch2" ON "BUILD_TESTING OR alpaka_BUILD_BENCHMARKS" OFF)

################################################################################
# Internal variables.
Expand Down
5 changes: 5 additions & 0 deletions benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,9 @@ project("alpakaBenchmarks" LANGUAGES CXX)
# Add subdirectories.
################################################################################

if(NOT BUILD_TESTING)
# Testing is not enabled therefore CATCH2 which is part of common must be pulled.
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../test/common "${CMAKE_BINARY_DIR}/test/common")
endif()

add_subdirectory("babelstream/")
32 changes: 27 additions & 5 deletions benchmarks/babelstream/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,31 @@ if(NOT TARGET alpaka::alpaka)
endif()
endif()

alpaka_add_executable(${PROJECT_NAME} src/main.cpp src/Stream.h src/AlpakaStream.cpp src/AlpakaStream.h)
target_compile_definitions(${PROJECT_NAME} PUBLIC ALPAKA)
target_link_libraries(${PROJECT_NAME} PUBLIC alpaka::alpaka)
set_target_properties(${PROJECT_NAME} PROPERTIES FOLDER benchmarks)

# add_test(NAME ${_TARGET_NAME} COMMAND ${_TARGET_NAME})
set(_TARGET_NAME "babelstream")
append_recursive_files_add_to_src_group("src/" "src/" "cpp" _FILES_SOURCE)

alpaka_add_executable(
${_TARGET_NAME}
${_FILES_SOURCE})

target_include_directories(
${_TARGET_NAME}
PRIVATE "src")

target_link_libraries(
${_TARGET_NAME}
PRIVATE common)

set_target_properties(${_TARGET_NAME} PROPERTIES FOLDER benchmarks/babelstream)

#Run as a ctest
if(alpaka_CI)
# Only run for release builds since this is a benchmark
if(CMAKE_BUILD_TYPE STREQUAL "Release")
add_test(NAME ${_TARGET_NAME} COMMAND ${_TARGET_NAME})
endif()
else()
# For a normal benchmark test, number of samples should be equal to the default value.
add_test(NAME ${_TARGET_NAME} COMMAND ${_TARGET_NAME})
endif()
230 changes: 0 additions & 230 deletions benchmarks/babelstream/src/AlpakaStream.cpp

This file was deleted.

63 changes: 0 additions & 63 deletions benchmarks/babelstream/src/AlpakaStream.h

This file was deleted.

Loading

0 comments on commit 1840791

Please sign in to comment.