-
Notifications
You must be signed in to change notification settings - Fork 62
/
CMakeLists.txt
321 lines (271 loc) · 9.9 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
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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
if(UNIX AND NOT APPLE)
set(LINUX true)
else()
set(LINUX )
endif()
if(LINUX)
set(CMAKE_C_COMPILER gcc)
set(CMAKE_CXX_COMPILER g++)
ADD_DEFINITIONS(-D_LIBCPP_VERSION=1) # tbb clang compatibility
else()
set(CMAKE_C_COMPILER gcc)
set(CMAKE_CXX_COMPILER g++)
endif()
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
OPTION(VECTORWISE_BRANCHING "Use branching vectorwise primitives" OFF)
OPTION(AUTOVECTORIZE "Allow the compiler to autovectorize" OFF)
OPTION(DATADIR "Directory containing testdata" "")
OPTION(AVX512EXPERIMENTS OFF)
OPTION(HARDWARE_BENCHMARKS OFF)
OPTION(INTERPRET_SEPARATE OFF)
OPTION(HASH_SIZE_32 OFF)
# Compiler flags for the different targets
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -mtune=native -std=c++14 -fPIC -Wall -Wextra -Wno-psabi -fno-omit-frame-pointer -Wno-unknown-pragmas ")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -Wall -Wextra -fno-omit-frame-pointer -march=native -fdiagnostics-color ")
if(LINUX)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=address -static-libasan")
# set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ")
else()
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -fsanitize=address")
# set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ")
endif(LINUX)
string(REPLACE "-O2" "" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
string(REPLACE "-O2" "" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3")
string(REPLACE "-O2" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -O3")
#set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -fopt-info -fopt-info-missed -O3")
string(REPLACE "-O2" "" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
set(CMAKE_CFLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -O3")
set(CMAKE_MACOSX_RPATH 1)
IF(VECTORWISE_BRANCHING)
ADD_DEFINITIONS(-DBRANCHING)
ENDIF(VECTORWISE_BRANCHING)
IF(INTERPRET_SEPARATE)
ADD_DEFINITIONS(-DINTERPRET_SEPARATE)
ENDIF(INTERPRET_SEPARATE)
IF(HASH_SIZE_32)
ADD_DEFINITIONS(-DHASH_SIZE=32)
ELSE()
ADD_DEFINITIONS(-DHASH_SIZE=64)
ENDIF()
IF(AUTOVECTORIZE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftree-vectorize")
ELSE(AUTOVECTORIZE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-tree-vectorize")
ENDIF(AUTOVECTORIZE)
# Download and unpack googletest at configure time
configure_file(3rdparty/GTest.CMakeLists.txt googletest-download/CMakeLists.txt)
execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/googletest-download" )
execute_process(COMMAND "${CMAKE_COMMAND}" --build .
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/googletest-download" )
# Prevent GoogleTest from overriding our compiler/linker options
# when building with Visual Studio
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
# Add googletest directly to our build. This adds
# the following targets: gtest, gtest_main, gmock
# and gmock_main
add_subdirectory("${CMAKE_BINARY_DIR}/googletest-src"
"${CMAKE_BINARY_DIR}/googletest-build")
# The gtest/gmock targets carry header search path
# dependencies automatically when using CMake 2.8.11 or
# later. Otherwise we have to add them here ourselves.
if(CMAKE_VERSION VERSION_LESS 2.8.11)
include_directories("${gtest_SOURCE_DIR}/include"
"${gmock_SOURCE_DIR}/include")
endif()
# Now simply link your own targets against gtest, gmock,
# etc. as appropriate
project(exec_engine_comparison)
IF(DATADIR)
message(STATUS "setting datadir to user defined")
message(STATUS "${DATADIR}")
ADD_DEFINITIONS(-DDATADIR="${DATADIR}")
ELSE(DATADIR)
message(STATUS "setting datadir to proj dir ")
message(STATUS "${PROJECT_SOURCE_DIR}/data")
ADD_DEFINITIONS(-DDATADIR="${PROJECT_SOURCE_DIR}/data")
ENDIF(DATADIR)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/3rdparty/")
find_package(TBB)
include_directories(${TBB_INCLUDE_DIRS})
IF(LINUX)
add_subdirectory(3rdparty/jevents)
set(JEVENTSLIB "jevents")
ELSE(LINUX)
set(JEVENTSLIB "")
ENDIF(LINUX)
add_library(common
src/common/algebra/Operators.cpp
src/common/algebra/Types.cpp
src/common/runtime/Database.cpp
src/common/runtime/MemoryPool.cpp
src/common/runtime/Types.cpp
src/common/runtime/String.cpp
src/common/runtime/Import.cpp
src/common/runtime/Hashmap.cpp
src/common/runtime/Concurrency.cpp
src/common/runtime/Profile.cpp
)
target_include_directories(common PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
PRIVATE src)
set(HYPER_TRANSLATORS
src/hyper/codegen/operators/Map.cpp
src/hyper/codegen/operators/Print.cpp
src/hyper/codegen/operators/Scan.cpp
)
add_library(hyper
src/hyper/codegen/Translator.cpp
src/hyper/codegen/TranslatorRegistry.cpp
)
target_include_directories(hyper PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
PRIVATE src)
target_link_libraries(hyper common)
file(GLOB PRIMITIVES src/vectorwise/primitives/*.cpp)
add_library(vectorwise
src/vectorwise/Operations.cpp
src/vectorwise/Operators.cpp
${PRIMITIVES}
src/vectorwise/QueryBuilder.cpp
)
target_include_directories(vectorwise PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
PRIVATE src)
# Set architecture if AVX512 exerperiments are requested
if(AVX512EXPERIMENTS)
SET_TARGET_PROPERTIES(vectorwise PROPERTIES
COMPILE_FLAGS "-march=skylake-avx512"
)
endif()
target_link_libraries(vectorwise common)
add_executable(bench
${HYPER_TRANSLATORS}
src/bench.cpp
)
target_include_directories(bench PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
PRIVATE src)
target_link_libraries(bench hyper vectorwise common)
add_library(benchmark_config
src/benchmarks/config.cpp)
target_include_directories(benchmark_config PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
PRIVATE src)
target_link_libraries(benchmark_config vectorwise common)
file(GLOB TPCHQUERIES src/benchmarks/tpch/queries/*.cpp)
add_library(tpch
${TPCHQUERIES}
)
target_include_directories(tpch PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
PRIVATE src)
target_link_libraries(tpch benchmark_config pthread hyper ${TBB_LIBRARIES} vectorwise common)
add_executable(run_tpch
${HYPER_TRANSLATORS}
src/benchmarks/tpch/run.cpp
)
target_include_directories(run_tpch PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
PRIVATE src)
target_link_libraries(run_tpch tpch hyper vectorwise common ${JEVENTSLIB})
file(GLOB SBBQUERIES src/benchmarks/sbb/queries/*.cpp)
add_library(ssb
${SBBQUERIES}
)
target_include_directories(ssb PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
PRIVATE src)
target_link_libraries(ssb benchmark_config pthread hyper ${TBB_LIBRARIES} vectorwise common)
add_executable(run_ssb
${HYPER_TRANSLATORS}
src/benchmarks/sbb/run.cpp
)
target_include_directories(run_ssb PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
PRIVATE src)
target_link_libraries(run_ssb ssb hyper vectorwise common ${JEVENTSLIB})
add_executable(run_prim
src/benchmarks/primitives/run.cpp
)
target_include_directories(run_prim PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
PRIVATE src)
target_link_libraries(run_prim vectorwise common ${TBB_LIBRARIES} ${JEVENTSLIB})
# Enable tests
enable_testing()
set(CTEST_OUTPUT_ON_FAILURE "1")
add_executable(test_all
src/test/tpch_expected.cpp
src/test/ssb_expected.cpp
src/test/tpch.cpp
src/test/ssb.cpp
src/test/vectorwise/primitives.cpp
src/test/vectorwise/Operators.cpp
src/test/common/Hashmap.cpp
src/test/common/Database.cpp
src/test/common/PartitionedDeque.cpp
src/test/common/Mmap.cpp
src/test/common/runtime/Stack.cpp
)
target_link_libraries(test_all common hyper vectorwise tpch ssb gtest gtest_main)
if(HARDWARE_BENCHMARKS)
add_executable(latency
src/benchmarks/hardware/latency.cpp)
target_link_libraries(latency pthread)
add_executable(randomWrites
src/benchmarks/hardware/randomWrites.cpp)
target_include_directories(randomWrites PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
PRIVATE src)
target_link_libraries(randomWrites common pthread ${JEVENTSLIB})
endif()
if(AVX512EXPERIMENTS)
add_executable(simdJoin src/benchmarks/simdJoin.cpp)
SET_TARGET_PROPERTIES(simdJoin PROPERTIES
COMPILE_FLAGS "-march=skylake-avx512"
)
target_include_directories(simdJoin PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
PRIVATE src)
target_link_libraries(simdJoin common ${JEVENTSLIB})
add_executable(run_simd
src/benchmarks/primitives/simdselection.cpp
)
SET_TARGET_PROPERTIES(run_simd PROPERTIES
COMPILE_FLAGS "-march=skylake-avx512"
)
target_include_directories(run_simd PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
PRIVATE src)
target_link_libraries(run_simd vectorwise common ${TBB_LIBRARIES} ${JEVENTSLIB})
add_executable(run_join
src/benchmarks/primitives/joinmicrobench.cpp
)
SET_TARGET_PROPERTIES(run_join PROPERTIES
COMPILE_FLAGS "-march=skylake-avx512"
)
target_include_directories(run_join PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
PRIVATE src)
target_link_libraries(run_join vectorwise common ${TBB_LIBRARIES} ${JEVENTSLIB})
endif(AVX512EXPERIMENTS)