Warning, /acts/Detray/tests/benchmarks/cpu/CMakeLists.txt is written in an unsupported language. File is not indexed.
0001 # This file is part of the ACTS project.
0002 #
0003 # Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 #
0005 # This Source Code Form is subject to the terms of the Mozilla Public
0006 # License, v. 2.0. If a copy of the MPL was not distributed with this
0007 # file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008
0009 message(STATUS "Building detray host benchmarks")
0010
0011 # Set up the benchmarking options.
0012 option(DETRAY_BENCHMARK_MULTITHREAD "Enable multithreaded benchmarks" OFF)
0013 option(DETRAY_BENCHMARK_PRINTOUTS "Enable printouts in the benchmarks" OFF)
0014
0015 # Look for openMP, which is used for the CPU propagation benchmark
0016 find_package(OpenMP)
0017
0018 # Macro setting up the CPU benchmarks for a specific algebra plugin.
0019 macro(detray_add_cpu_benchmark algebra)
0020 message(STATUS "Building 'detray::benchmark_cpu_${algebra}' component")
0021
0022 # Build the linear algebra benchmark executables
0023 detray_add_executable(benchmark_cpu_linear_algebra_${algebra}
0024 "linear_algebra.cpp"
0025 LINK_LIBRARIES benchmark::benchmark benchmark::benchmark_main vecmem::core detray::benchmarks detray::core_${algebra}
0026 )
0027
0028 target_compile_options(
0029 detray_benchmark_cpu_linear_algebra_${algebra}
0030 PRIVATE "-march=native" "-ftree-vectorize"
0031 )
0032
0033 # Build the benchmark executable.
0034 detray_add_executable(benchmark_cpu_${algebra}
0035 "find_volume.cpp"
0036 "grid.cpp"
0037 "intersect_all.cpp"
0038 "intersect_surfaces.cpp"
0039 "masks.cpp"
0040 LINK_LIBRARIES benchmark::benchmark benchmark::benchmark_main vecmem::core detray::benchmarks
0041 detray::core_${algebra} detray::test_common
0042 )
0043
0044 target_compile_options(
0045 detray_benchmark_cpu_${algebra}
0046 PRIVATE "-march=native" "-ftree-vectorize"
0047 )
0048
0049 # Set the benchmark specific compilation options.
0050 if(DETRAY_BENCHMARKS_MULTITHREAD)
0051 target_compile_definitions(
0052 detray_benchmark_cpu_${algebra}
0053 PRIVATE DETRAY_BENCHMARKS_MULTITHREAD
0054 )
0055 endif()
0056
0057 if(DETRAY_BENCHMARK_PRINTOUTS)
0058 target_compile_definitions(
0059 detray_benchmark_cpu_${algebra}
0060 PRIVATE DETRAY_BENCHMARK_PRINTOUTS
0061 )
0062 endif()
0063
0064 # Build the benchmark executable for the propagation
0065 detray_add_executable( benchmark_cpu_propagation_${algebra}
0066 "propagation.cpp"
0067 LINK_LIBRARIES detray::benchmark_cpu benchmark::benchmark_main
0068 vecmem::core detray::core_${algebra} detray::test_common
0069 )
0070
0071 target_compile_options(
0072 detray_benchmark_cpu_propagation_${algebra}
0073 PRIVATE "-march=native" "-ftree-vectorize"
0074 )
0075
0076 if(OpenMP_CXX_FOUND)
0077 target_link_libraries(
0078 detray_benchmark_cpu_propagation_${algebra}
0079 PRIVATE OpenMP::OpenMP_CXX
0080 )
0081 endif()
0082 endmacro()
0083
0084 # Build the array benchmark.
0085 detray_add_cpu_benchmark( array )
0086
0087 # Build the Eigen benchmark executable.
0088 if(DETRAY_EIGEN_PLUGIN)
0089 detray_add_cpu_benchmark( eigen )
0090 endif()
0091
0092 # Build the Fastor benchmark executable.
0093 if(DETRAY_FASTOR_PLUGIN)
0094 detray_add_cpu_benchmark( fastor )
0095 endif()
0096
0097 # Build the SMatrix benchmark executable.
0098 if(DETRAY_SMATRIX_PLUGIN)
0099 detray_add_cpu_benchmark( smatrix )
0100 endif()
0101
0102 # Build the Vc benchmark executable.
0103 if(DETRAY_VC_AOS_PLUGIN)
0104 detray_add_cpu_benchmark( vc_aos )
0105
0106 target_compile_options(
0107 detray_benchmark_cpu_linear_algebra_vc_aos
0108 INTERFACE ${Vc_COMPILE_FLAGS} ${Vc_ARCHITECTURE_FLAGS}
0109 )
0110 endif()
0111
0112 if(DETRAY_VC_SOA_PLUGIN)
0113 message(STATUS "Building 'detray::benchmark_cpu_vc_soa' component")
0114
0115 # Build the linear algebra benchmark executables
0116 detray_add_executable(benchmark_cpu_linear_algebra_vc_soa
0117 "soa/linear_algebra.cpp"
0118 LINK_LIBRARIES benchmark::benchmark benchmark::benchmark_main vecmem::core detray::benchmarks detray::core_vc_soa
0119 )
0120
0121 target_compile_options(
0122 detray_benchmark_cpu_linear_algebra_vc_soa
0123 PRIVATE "-march=native"
0124 )
0125
0126 target_compile_options(
0127 detray_benchmark_cpu_linear_algebra_vc_soa
0128 INTERFACE ${Vc_COMPILE_FLAGS} ${Vc_ARCHITECTURE_FLAGS}
0129 )
0130
0131 # Build the intersector benchmark per algebra plugin
0132 macro(detray_add_soa_benchmark algebra)
0133 # Build the benchmark executable.
0134 detray_add_executable(benchmark_cpu_vc_soa_vs_${algebra}
0135 "soa/intersectors.cpp"
0136 LINK_LIBRARIES detray::benchmark_cpu benchmark::benchmark benchmark::benchmark_main vecmem::core detray::core_vc_soa detray::core_vc_aos detray::core_${algebra}
0137 detray::test_common
0138 )
0139
0140 target_compile_options(
0141 detray_benchmark_cpu_vc_soa_vs_${algebra}
0142 PRIVATE "-march=native"
0143 )
0144
0145 # Add Vc specific flags
0146 target_compile_options(
0147 detray_benchmark_cpu_vc_soa_vs_${algebra}
0148 INTERFACE ${Vc_COMPILE_FLAGS} ${Vc_ARCHITECTURE_FLAGS}
0149 )
0150
0151 # Set the benchmark specific compilation options.
0152 if(DETRAY_BENCHMARKS_MULTITHREAD)
0153 target_compile_definitions(
0154 detray_benchmark_cpu_vc_soa_vs_${algebra}
0155 PRIVATE DETRAY_BENCHMARKS_MULTITHREAD
0156 )
0157 endif()
0158
0159 if(DETRAY_BENCHMARK_PRINTOUTS)
0160 target_compile_definitions(
0161 detray_benchmark_cpu_vc_soa_vs_${algebra}
0162 PRIVATE DETRAY_BENCHMARK_PRINTOUTS
0163 )
0164 endif()
0165 endmacro()
0166
0167 detray_add_soa_benchmark( array )
0168 # detray_add_soa_benchmark( eigen )
0169 # detray_add_soa_benchmark( vc_aos )
0170 endif()