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