File size: 1,101 Bytes
8ae5fc5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
  # MSVC builds fail at runtime. Benchmarks are linux-only for now.
  message(STATUS "Thrust benchmarking is not available on MSVC.")
  return()
endif()

add_custom_target(thrust.all.bench)

foreach(thrust_target IN LISTS THRUST_TARGETS)
  thrust_get_target_property(config_host ${thrust_target} HOST)
  thrust_get_target_property(config_device ${thrust_target} DEVICE)
  thrust_get_target_property(config_prefix ${thrust_target} PREFIX)

  # Skip non cpp.cuda targets:
  if (NOT config_host   STREQUAL "CPP" OR
      NOT config_device STREQUAL "CUDA")
    continue()
  endif()

  set(bench_target ${config_prefix}.bench)

  add_executable(${bench_target} bench.cu)
  target_link_libraries(${bench_target} PRIVATE ${thrust_target})
  target_include_directories(${bench_target} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}")
  thrust_clone_target_properties(${bench_target} ${thrust_target})
  thrust_fix_clang_nvcc_build_for(${bench_target})

  add_dependencies(thrust.all.bench ${bench_target})
  add_dependencies(${config_prefix}.all ${bench_target})
endforeach()