Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
DLR-AMR
GitHub Repository: DLR-AMR/t8code
Path: blob/main/benchmarks/CMakeLists.txt
900 views
1
# This file is part of t8code.
2
# t8code is a C library to manage a collection (a forest) of multiple
3
# connected adaptive space-trees of general element types in parallel.
4
#
5
# Copyright (C) 2025 the developers
6
#
7
# t8code is free software; you can redistribute it and/or modify
8
# it under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 2 of the License, or
10
# (at your option) any later version.
11
#
12
# t8code is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with t8code; if not, write to the Free Software Foundation, Inc.,
19
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20
21
function( add_t8_benchmark )
22
set( options "" )
23
set( oneValueArgs "NAME" )
24
set( multiValueArgs "SOURCES" )
25
cmake_parse_arguments( ADD_T8_BENCHMARK "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
26
27
# Get the path of the first file listed in the SOURCES list and use it to determine the build directory.
28
# The executable will be build in the same directory as the first source file.
29
list(GET ADD_T8_BENCHMARK_SOURCES 0 FIRST_SOURCE)
30
get_filename_component(BENCHMARK_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/${FIRST_SOURCE}" DIRECTORY)
31
file(RELATIVE_PATH BENCHMARK_RELATIVE_DIR "${CMAKE_SOURCE_DIR}" "${BENCHMARK_SOURCE_DIR}")
32
set(BENCHMARK_BUILD_DIR "${CMAKE_BINARY_DIR}/${BENCHMARK_RELATIVE_DIR}")
33
34
add_executable( ${ADD_T8_BENCHMARK_NAME} ${ADD_T8_BENCHMARK_SOURCES} )
35
target_include_directories( ${ADD_T8_BENCHMARK_NAME} PRIVATE ${PROJECT_SOURCE_DIR} )
36
target_link_libraries( ${ADD_T8_BENCHMARK_NAME} PRIVATE T8 SC::SC )
37
38
set_target_properties(${ADD_T8_BENCHMARK_NAME} PROPERTIES
39
RUNTIME_OUTPUT_DIRECTORY "${BENCHMARK_BUILD_DIR}"
40
LIBRARY_OUTPUT_DIRECTORY "${BENCHMARK_BUILD_DIR}"
41
ARCHIVE_OUTPUT_DIRECTORY "${BENCHMARK_BUILD_DIR}"
42
)
43
44
if( T8CODE_EXPORT_COMPILE_COMMANDS )
45
set_target_properties( ${ADD_T8_BENCHMARK_NAME} PROPERTIES EXPORT_COMPILE_COMMANDS ON )
46
endif( T8CODE_EXPORT_COMPILE_COMMANDS )
47
48
install( TARGETS ${ADD_T8_BENCHMARK_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR} )
49
endfunction()
50
51
add_t8_benchmark( NAME t8_time_partition SOURCES t8_time_partition.cxx )
52
add_t8_benchmark( NAME t8_time_forest_partition SOURCES t8_time_forest_partition.cxx )
53
add_t8_benchmark( NAME t8_time_prism_adapt SOURCES t8_time_prism_adapt.cxx )
54
add_t8_benchmark( NAME t8_time_fractal SOURCES t8_time_fractal.cxx )
55
add_t8_benchmark( NAME t8_time_set_join_by_vertices SOURCES t8_time_set_join_by_vertices.cxx )
56
add_t8_benchmark( NAME t8_time_new_refine SOURCES t8_time_new_refine.c )
57
58