mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-10-05 01:49:02 +00:00
81 lines
3.3 KiB
CMake
81 lines
3.3 KiB
CMake
##============================================================================
|
|
## Copyright (c) Kitware, Inc.
|
|
## All rights reserved.
|
|
## See LICENSE.txt for details.
|
|
##
|
|
## This software is distributed WITHOUT ANY WARRANTY; without even
|
|
## the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
## PURPOSE. See the above copyright notice for more information.
|
|
##============================================================================
|
|
|
|
#Find Google Benchmark.Note that benchmark_DIR must be pointed at an
|
|
#installation, not a build directory.
|
|
find_package(benchmark REQUIRED)
|
|
|
|
function(add_benchmark)
|
|
set(options)
|
|
set(oneValueArgs NAME FILE)
|
|
set(multiValueArgs LIBS)
|
|
cmake_parse_arguments(VTKm_AB
|
|
"${options}" "${oneValueArgs}" "${multiValueArgs}"
|
|
${ARGN}
|
|
)
|
|
set(exe_name ${VTKm_AB_NAME})
|
|
|
|
add_executable(${exe_name} ${VTKm_AB_FILE})
|
|
target_link_libraries(${exe_name} PRIVATE ${VTKm_AB_LIBS})
|
|
target_link_libraries(${exe_name} PRIVATE benchmark::benchmark)
|
|
vtkm_add_drop_unused_function_flags(${exe_name})
|
|
vtkm_add_target_information(${exe_name})
|
|
|
|
set_target_properties(${exe_name} PROPERTIES
|
|
RUNTIME_OUTPUT_DIRECTORY ${VTKm_EXECUTABLE_OUTPUT_PATH}
|
|
CXX_VISIBILITY_PRESET "hidden"
|
|
CUDA_VISIBILITY_PRESET "hidden"
|
|
)
|
|
|
|
vtkm_add_target_information(${exe_name} DEVICE_SOURCES ${VTKm_AB_FILE})
|
|
endfunction()
|
|
|
|
set(benchmarks
|
|
BenchmarkArrayTransfer
|
|
BenchmarkAtomicArray
|
|
BenchmarkCopySpeeds
|
|
BenchmarkDeviceAdapter
|
|
BenchmarkFieldAlgorithms
|
|
BenchmarkFilters
|
|
BenchmarkODEIntegrators
|
|
BenchmarkTopologyAlgorithms
|
|
)
|
|
|
|
set(VTKm_BENCHS_RANGE_LOWER_BOUNDARY 4096 CACHE STRING "Smallest sample for input size bench for BenchmarkDeviceAdapter")
|
|
set(VTKm_BENCHS_RANGE_UPPER_BOUNDARY 134217728 CACHE STRING "Biggest sample for input size bench for BenchmarkDeviceAdapter")
|
|
mark_as_advanced(VTKm_BENCHS_RANGE_LOWER_BOUNDARY VTKm_BENCHS_RANGE_UPPER_BOUNDARY)
|
|
|
|
foreach (benchmark ${benchmarks})
|
|
add_benchmark(NAME ${benchmark} FILE ${benchmark}.cxx LIBS vtkm_source vtkm_filter vtkm_io)
|
|
endforeach ()
|
|
|
|
target_compile_definitions(BenchmarkDeviceAdapter PUBLIC VTKm_BENCHS_RANGE_LOWER_BOUNDARY=${VTKm_BENCHS_RANGE_LOWER_BOUNDARY})
|
|
target_compile_definitions(BenchmarkDeviceAdapter PUBLIC VTKm_BENCHS_RANGE_UPPER_BOUNDARY=${VTKm_BENCHS_RANGE_UPPER_BOUNDARY})
|
|
|
|
if(TARGET vtkm_rendering)
|
|
add_benchmark(NAME BenchmarkRayTracing FILE BenchmarkRayTracing.cxx LIBS vtkm_rendering vtkm_source)
|
|
add_benchmark(NAME BenchmarkInSitu FILE BenchmarkInSitu.cxx LIBS vtkm_rendering vtkm_source vtkm_filter vtkm_io)
|
|
endif()
|
|
|
|
if(VTKm_ENABLE_PERFORMANCE_TESTING)
|
|
include("${VTKm_SOURCE_DIR}/CMake/testing/VTKmPerformanceTest.cmake")
|
|
add_benchmark_test(BenchmarkFilters
|
|
BenchThreshold
|
|
BenchContour/IsStructuredDataSet:1/NIsoVals:12/MergePts:1/GenNormals:0
|
|
BenchContour/IsStructuredDataSet:1/NIsoVals:12/MergePts:0/GenNormals:1/FastNormals:1
|
|
BenchContour/IsStructuredDataSet:0/NIsoVals:12/MergePts:1/GenNormals:0
|
|
BenchContour/IsStructuredDataSet:0/NIsoVals:12/MergePts:0/GenNormals:/FastNormals:1
|
|
BenchTetrahedralize
|
|
BenchVertexClustering/NumDivs:256)
|
|
if(TARGET vtkm_rendering)
|
|
add_benchmark_test(BenchmarkInSitu "BenchContour")
|
|
endif()
|
|
endif()
|