forked from unisa-hpc/sycl-bench
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
152 lines (128 loc) · 4.96 KB
/
CMakeLists.txt
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
cmake_minimum_required (VERSION 3.5)
project(sycl-bench)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "CMake Build Type" FORCE)
endif()
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# Due to CMake limitations, AdaptiveCpp requires C++ standard to be set manually
set(CMAKE_SYCL_FLAGS "${CMAKE_SYCL_FLAGS} -std=c++17")
if(CMAKE_GENERATOR STREQUAL "Ninja")
set(CMAKE_SYCL_FLAGS "${CMAKE_SYCL_FLAGS} -fdiagnostics-color=always")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=always")
set(COMPUTECPP_USER_FLAGS "${COMPUTECPP_USER_FLAGS} -fdiagnostics-color=always")
endif()
include(InstallRequiredSystemLibraries)
include(CPack)
include_directories(${CMAKE_SOURCE_DIR}/include)
include_directories(${CMAKE_SOURCE_DIR}/polybench/common)
set(supported_implementations
ComputeCpp
AdaptiveCpp
LLVM
LLVM-CUDA
LLVM-MLIR
triSYCL
)
list(FIND supported_implementations ${SYCL_IMPL} impl_idx)
if(NOT SYCL_IMPL OR impl_idx EQUAL -1)
message(FATAL_ERROR "Please specify SYCL_IMPL (one of: ${supported_implementations})")
endif()
option(SYCL_RAISE_HOST "Whether to raise SYCL host code during compilation if the SYCL implementation allows that" FALSE)
if(SYCL_RAISE_HOST AND NOT SYCL_IMPL STREQUAL "LLVM-MLIR")
message(WARNING "SYCL_RAISE_HOST option not compatible with provided SYCL implementation (${SYCL_IMPL}). Option will not take effect.")
endif()
if(SYCL_IMPL STREQUAL "ComputeCpp")
find_package(ComputeCpp MODULE REQUIRED)
elseif(SYCL_IMPL STREQUAL "AdaptiveCpp")
find_package(AdaptiveCpp CONFIG REQUIRED)
elseif(SYCL_IMPL STREQUAL "LLVM")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Xclang -fsycl-disable-range-rounding -fsycl -fsycl-device-code-split=per_kernel")
elseif(SYCL_IMPL STREQUAL "LLVM-CUDA")
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -fsycl -fsycl-targets=nvptx64-nvidia-cuda-sycldevice")
elseif(SYCL_IMPL STREQUAL "LLVM-MLIR")
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -Xclang -fsycl-disable-range-rounding -fsycl -fsycl-targets=spir64-unknown-unknown-syclmlir -w -fsycl-device-code-split=per_kernel")
if(SYCL_RAISE_HOST)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsycl-raise-host")
endif()
elseif(SYCL_IMPL STREQUAL "triSYCL")
find_package(TriSYCL MODULE REQUIRED)
endif()
set(benchmarks
micro/arith.cpp
micro/DRAM.cpp
micro/host_device_bandwidth.cpp
micro/pattern_L2.cpp
micro/sf.cpp
micro/local_mem.cpp
single-kernel/median.cpp
single-kernel/scalar_prod.cpp
single-kernel/sobel.cpp
single-kernel/sobel5.cpp
single-kernel/sobel7.cpp
single-kernel/vec_add.cpp
single-kernel/lin_reg_error.cpp
single-kernel/lin_reg_coeff.cpp
single-kernel/kmeans.cpp
single-kernel/mol_dyn.cpp
single-kernel/nbody.cpp
pattern/segmentedreduction.cpp
pattern/reduction.cpp
runtime/dag_task_throughput_sequential.cpp
runtime/dag_task_throughput_independent.cpp
runtime/blocked_transform.cpp
runtime/matmulchain.cpp
polybench/2DConvolution.cpp
polybench/2mm.cpp
polybench/3DConvolution.cpp
polybench/3mm.cpp
polybench/atax.cpp
polybench/bicg.cpp
polybench/correlation.cpp
polybench/covariance.cpp
polybench/fdtd2d.cpp
polybench/gemm.cpp
polybench/gesummv.cpp
polybench/gramschmidt.cpp
polybench/mvt.cpp
polybench/syr2k.cpp
polybench/syrk.cpp
#compiletime/compiletime.cpp
)
foreach(benchmark IN LISTS benchmarks)
get_filename_component(target ${benchmark} NAME_WE)
add_executable(${target} ${benchmark})
if(SYCL_IMPL STREQUAL "ComputeCpp" OR SYCL_IMPL STREQUAL "AdaptiveCpp")
add_sycl_to_target(TARGET ${target} SOURCES ${benchmark})
endif()
if(SYCL_IMPL STREQUAL "ComputeCpp" AND COMPUTECPP_BITCODE STREQUAL "ptx64")
target_compile_definitions(${target} PRIVATE SYCL_BENCH_ENABLE_QUEUE_PROFILING)
endif()
if(SYCL_IMPL STREQUAL "LLVM")
target_compile_definitions(${target} PRIVATE __LLVM_SYCL__)
target_compile_definitions(${target} PRIVATE SYCL_BENCH_ENABLE_QUEUE_PROFILING)
endif()
if(SYCL_IMPL STREQUAL "LLVM-MLIR")
target_compile_definitions(${target} PRIVATE __LLVM_SYCL_MLIR__)
target_compile_definitions(${target} PRIVATE SYCL_BENCH_ENABLE_QUEUE_PROFILING)
endif()
if(SYCL_IMPL STREQUAL "LLVM-CUDA")
target_compile_definitions(${target} PRIVATE __LLVM_SYCL_CUDA__)
endif()
if(SYCL_IMPL STREQUAL "triSYCL")
add_sycl_to_target(${target})
target_compile_definitions(${target} PRIVATE __TRISYCL__)
endif()
install(TARGETS ${target} RUNTIME DESTINATION bin/benchmarks/)
get_filename_component(dir ${benchmark} DIRECTORY)
set_property(TARGET ${target} PROPERTY FOLDER ${dir})
endforeach(benchmark)
# The "compiletime" target should only be used in the context of the compile time evaluation script
#set_target_properties(compiletime PROPERTIES EXCLUDE_FROM_ALL 1)
install(PROGRAMS bin/run-suite DESTINATION bin/)
install(FILES ${PROJECT_SOURCE_DIR}/Brommy.bmp DESTINATION share/)