CMakeLists.txt 4.9 KB

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