1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210
|
# ---------------------------------------------------------------------------
# Copyright (c) 2013 Kyle Lutz <kyle.r.lutz@gmail.com>
#
# Distributed under the Boost Software License, Version 1.0
# See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt
#
# ---------------------------------------------------------------------------
include_directories(../include)
set(PERF_BOOST_COMPONENTS system timer chrono program_options)
if (${BOOST_COMPUTE_USE_OFFLINE_CACHE})
set(PERF_BOOST_COMPONENTS ${PERF_BOOST_COMPONENTS} filesystem)
endif()
if(${BOOST_COMPUTE_THREAD_SAFE} AND NOT ${BOOST_COMPUTE_USE_CPP11})
set(PERF_BOOST_COMPONENTS ${PERF_BOOST_COMPONENTS} thread)
elseif(${BOOST_COMPUTE_HAVE_BOLT} AND ${BOOST_COMPUTE_USE_CPP11})
set(PERF_BOOST_COMPONENTS ${PERF_BOOST_COMPONENTS} thread)
endif()
if(${BOOST_COMPUTE_HAVE_BOLT} AND ${BOOST_COMPUTE_USE_CPP11})
set(PERF_BOOST_COMPONENTS ${PERF_BOOST_COMPONENTS} date_time)
endif()
if(PERF_BOOST_COMPONENTS)
list(REMOVE_DUPLICATES PERF_BOOST_COMPONENTS)
endif()
find_package(Boost 1.54 REQUIRED COMPONENTS ${PERF_BOOST_COMPONENTS})
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
set(BENCHMARKS
accumulate
bernoulli_distribution
binary_find
cart_to_polar
comparison_sort
copy_if
copy_to_device
count
discrete_distribution
erase_remove
exclusive_scan
fill
find
find_end
includes
inner_product
is_permutation
is_sorted
max_element
merge
next_permutation
nth_element
partial_sum
partition
partition_point
prev_permutation
reverse
reverse_copy
rotate
rotate_copy
host_sort
random_number_engine
reduce_by_key
saxpy
search
search_n
set_difference
set_intersection
set_symmetric_difference
set_union
sort
sort_by_key
sort_float
stable_partition
uniform_int_distribution
unique
unique_copy
)
foreach(BENCHMARK ${BENCHMARKS})
set(PERF_TARGET perf_${BENCHMARK})
add_executable(${PERF_TARGET} perf_${BENCHMARK}.cpp)
target_link_libraries(${PERF_TARGET} ${OpenCL_LIBRARIES} ${Boost_LIBRARIES})
endforeach()
# stl benchmarks (for comparison)
set(STL_BENCHMARKS
stl_accumulate
stl_count
stl_find
stl_find_end
stl_includes
stl_inner_product
stl_max_element
stl_merge
stl_next_permutation
stl_partial_sum
stl_partition
stl_prev_permutation
stl_reverse
stl_reverse_copy
stl_rotate
stl_rotate_copy
stl_saxpy
stl_search
stl_search_n
stl_set_difference
stl_set_intersection
stl_set_symmetric_difference
stl_set_union
stl_sort
stl_stable_partition
stl_unique
stl_unique_copy
)
# stl benchmarks which require c++11
if(${BOOST_COMPUTE_USE_CPP11})
list(APPEND
STL_BENCHMARKS
stl_is_permutation
stl_partition_point
)
endif()
foreach(BENCHMARK ${STL_BENCHMARKS})
set(PERF_TARGET perf_${BENCHMARK})
add_executable(${PERF_TARGET} perf_${BENCHMARK}.cpp)
target_link_libraries(${PERF_TARGET} ${Boost_LIBRARIES})
endforeach()
# cuda/thrust benchmarks (for comparison)
if(${BOOST_COMPUTE_HAVE_CUDA})
find_package(CUDA 5.0 REQUIRED)
set(CUDA_BENCHMARKS
thrust_accumulate
thrust_count
thrust_exclusive_scan
thrust_find
thrust_inner_product
thrust_merge
thrust_partial_sum
thrust_partition
thrust_reduce_by_key
thrust_reverse
thrust_reverse_copy
thrust_rotate
thrust_saxpy
thrust_set_difference
thrust_sort
thrust_unique
)
foreach(BENCHMARK ${CUDA_BENCHMARKS})
set(PERF_TARGET perf_${BENCHMARK})
cuda_add_executable(${PERF_TARGET} perf_${BENCHMARK}.cu)
target_link_libraries(${PERF_TARGET} ${CUDA_LIBRARIES} ${Boost_LIBRARIES})
endforeach()
endif()
# intel tbb benchmarks (for comparison)
if(${BOOST_COMPUTE_HAVE_TBB})
find_package(TBB REQUIRED)
include_directories(SYSTEM ${TBB_INCLUDE_DIRS})
set(TBB_BENCHMARKS
tbb_accumulate
tbb_merge
tbb_sort
)
foreach(BENCHMARK ${TBB_BENCHMARKS})
set(PERF_TARGET perf_${BENCHMARK})
add_executable(${PERF_TARGET} perf_${BENCHMARK}.cpp)
target_link_libraries(${PERF_TARGET} ${TBB_LIBRARIES} ${Boost_LIBRARIES})
endforeach()
endif()
# bolt c++ template lib benchmarks (for comparison)
if(${BOOST_COMPUTE_HAVE_BOLT} AND ${BOOST_COMPUTE_USE_CPP11})
find_package(Bolt REQUIRED)
include_directories(SYSTEM ${BOLT_INCLUDE_DIRS})
set(BOLT_BENCHMARKS
bolt_accumulate
bolt_count
bolt_exclusive_scan
bolt_fill
bolt_inner_product
bolt_max_element
bolt_merge
bolt_partial_sum
bolt_reduce_by_key
bolt_saxpy
bolt_sort
)
foreach(BENCHMARK ${BOLT_BENCHMARKS})
set(PERF_TARGET perf_${BENCHMARK})
add_executable(${PERF_TARGET} perf_${BENCHMARK}.cpp)
target_link_libraries(${PERF_TARGET} ${OpenCL_LIBRARIES} ${BOLT_LIBRARIES} ${Boost_LIBRARIES})
endforeach()
elseif(${BOOST_COMPUTE_HAVE_BOLT} AND NOT ${BOOST_COMPUTE_USE_CPP11})
message(WARNING "BOOST_COMPUTE_USE_CPP11 must be ON for building Bolt C++ Template Library performance tests.")
endif()
|