forked from kokkos/kokkos-kernels
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
306 lines (249 loc) · 11.8 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
INCLUDE(TribitsETISupport)
#
# Define the package
#
TRIBITS_PACKAGE(KokkosKernels)
# If building in debug mode, define the HAVE_KOKKOSKERNELS_DEBUG macro.
TRIBITS_ADD_DEBUG_OPTION()
#
# Set up subpackage-specific configuration options
#
#
# "Optimization level" for KokkosKernels computational kernels. The
# higher the level, the more code variants get generated, and thus the
# longer the compile times. However, more code variants mean both
# better performance overall, and more uniform performance for corner
# cases. Values of current interest (24 Apr 2014) are 0, 1, and 2.
#
TRIBITS_ADD_OPTION_AND_DEFINE( KokkosLinAlg_Opt_Level
KOKKOSLINALG_OPT_LEVEL
"Optimization level for KokkosKernels computational kernels: a nonnegative integer. Higher levels result in better performance that is more uniform for corner cases, but increase build time and library size. The default value is 1, which should give performance within ten percent of optimal on most platforms, for most problems."
"1"
)
# Enable experimental features of KokkosKernels if set at configure
# time. Default is no.
TRIBITS_ADD_OPTION_AND_DEFINE(
${PACKAGE_NAME}_ENABLE_Experimental
HAVE_KOKKOSKERNELS_EXPERIMENTAL
"Enable building and installation of experimental KokkosKernels features."
NO )
# Define what execution spaces KokkosKernels enables.
# KokkosKernels may enable fewer execution spaces than
# Kokkos enables. This can reduce build and test times.
ASSERT_DEFINED (Kokkos_ENABLE_Cuda)
SET(${PACKAGE_NAME}_INST_EXECSPACE_CUDA_DEFAULT ${Kokkos_ENABLE_Cuda})
ASSERT_DEFINED (Kokkos_ENABLE_OpenMP)
SET(${PACKAGE_NAME}_INST_EXECSPACE_OPENMP_DEFAULT ${Kokkos_ENABLE_OpenMP})
ASSERT_DEFINED (Kokkos_ENABLE_Pthread)
SET(${PACKAGE_NAME}_INST_EXECSPACE_THREADS_DEFAULT ${Kokkos_ENABLE_Pthread})
ASSERT_DEFINED (Kokkos_ENABLE_Serial)
SET(${PACKAGE_NAME}_INST_EXECSPACE_SERIAL_DEFAULT ${Kokkos_ENABLE_Serial})
IF(${Kokkos_ENABLE_Cuda})
TRIBITS_ADD_OPTION_AND_DEFINE(
${PACKAGE_NAME}_INST_EXECSPACE_CUDA
KOKKOSKERNELS_INST_EXECSPACE_CUDA
"Whether to pre instantiate kernels for the execution space Kokkos::Cuda. This option is KokkosKernels_INST_EXECSPACE_CUDA=${Kokkos_ENABLE_Cuda} by default. Disabling this when Kokkos_ENABLE_Cuda is enabled may increase build times."
${${PACKAGE_NAME}_INST_EXECSPACE_CUDA_DEFAULT}
)
TRIBITS_ADD_OPTION_AND_DEFINE(
${PACKAGE_NAME}_INST_MEMSPACE_CUDAUVMSPACE
KOKKOSKERNELS_INST_MEMSPACE_CUDAUVMSPACE
"Whether to pre instantiate kernels for the memory space Kokkos::CudaUVMSpace. This option is KokkosKernels_INST_EXECSPACE_CUDAUVMSPACE=${Kokkos_ENABLE_Cuda} by default. Disabling this when Kokkos_ENABLE_Cuda is enabled may increase build times."
${${PACKAGE_NAME}_INST_EXECSPACE_CUDA_DEFAULT}
)
TRIBITS_ADD_OPTION_AND_DEFINE(
${PACKAGE_NAME}_INST_MEMSPACE_CUDASPACE
KOKKOSKERNELS_INST_MEMSPACE_CUDASPACE
"Whether to pre instantiate kernels for the memory space Kokkos::CudaSpace. This option is KokkosKernels_INST_EXECSPACE_CUDASPACE=${Kokkos_ENABLE_Cuda} by default. Disabling this when Kokkos_ENABLE_Cuda is enabled may increase build times."
${${PACKAGE_NAME}_INST_EXECSPACE_CUDA_DEFAULT}
)
IF(${${PACKAGE_NAME}_INST_EXECSPACE_CUDA} AND ${${PACKAGE_NAME}_INST_MEMSPACE_CUDASPACE})
LIST(APPEND DEVICE_LIST "<Cuda,CudaSpace>")
ENDIF()
IF(${${PACKAGE_NAME}_INST_EXECSPACE_CUDA} AND ${${PACKAGE_NAME}_INST_MEMSPACE_CUDAUVMSPACE})
LIST(APPEND DEVICE_LIST "<Cuda,CudaUVMSpace>")
ENDIF()
ENDIF()
IF(${Kokkos_ENABLE_Serial} OR ${Kokkos_ENABLE_Pthread} OR ${Kokkos_ENABLE_OpenMP})
TRIBITS_ADD_OPTION_AND_DEFINE(
${PACKAGE_NAME}_INST_MEMSPACE_HOSTSPACE
KOKKOSKERNELS_INST_MEMSPACE_HOSTSPACE
"Whether to pre instantiate kernels for the memory space Kokkos::HostSpace. This option is KokkosKernels_INST_EXECSPACE_HOSTSPACE=(${Kokkos_ENABLE_OpenMP} OR ${Kokkos_ENABLE_Pthread} OR ${Kokkos_ENABLE_Serial}) by default. Disabling this when one of the Host execution spaces is enabled may increase build times."
ON
)
ENDIF()
IF(${Kokkos_ENABLE_OpenMP})
TRIBITS_ADD_OPTION_AND_DEFINE(
${PACKAGE_NAME}_INST_EXECSPACE_OPENMP
KOKKOSKERNELS_INST_EXECSPACE_OPENMP
"Whether to pre instantiate kernels for the execution space Kokkos::OpenMP. This option is KokkosKernels_INST_EXECSPACE_OPENMP=${Kokkos_ENABLE_OpenMP} by default. Disabling this when Kokkos_ENABLE_OpenMP is enabled may increase build times."
${${PACKAGE_NAME}_INST_EXECSPACE_OPENMP_DEFAULT}
)
IF(${${PACKAGE_NAME}_INST_EXECSPACE_OPENMP} AND ${${PACKAGE_NAME}_INST_MEMSPACE_HOSTSPACE})
LIST(APPEND DEVICE_LIST "<OpenMP,HostSpace>")
ENDIF()
ENDIF()
IF(${Kokkos_ENABLE_Pthread})
TRIBITS_ADD_OPTION_AND_DEFINE(
${PACKAGE_NAME}_INST_EXECSPACE_THREADS
KOKKOSKERNELS_INST_EXECSPACE_THREADS
"Whether to build kernels for the execution space Kokkos::Threads. This option is Kokkos_ENABLE_Pthread=${Kokkos_ENABLE_Pthread} by default. If explicit template instantiation (ETI) is enabled in Trilinos, disabling this when Kokkos_ENABLE_Pthread is enabled may increase build times."
${${PACKAGE_NAME}_INST_EXECSPACE_THREADS_DEFAULT}
)
IF(${${PACKAGE_NAME}_INST_EXECSPACE_THREADS} AND ${${PACKAGE_NAME}_INST_MEMSPACE_HOSTSPACE})
LIST(APPEND DEVICE_LIST "<Threads,HostSpace>")
ENDIF()
ENDIF()
IF(${Kokkos_ENABLE_Serial})
TRIBITS_ADD_OPTION_AND_DEFINE(
${PACKAGE_NAME}_INST_EXECSPACE_SERIAL
KOKKOSKERNELS_INST_EXECSPACE_SERIAL
"Whether to build kernels for the execution space Kokkos::Serial. This option is Kokkos_ENABLE_Serial=${Kokkos_ENABLE_Serial} by default. If explicit template instantiation (ETI) is enabled in Trilinos, disabling this when Kokkos_ENABLE_Serial is enabled may increase build times."
${${PACKAGE_NAME}_INST_EXECSPACE_SERIAL_DEFAULT}
)
IF(${${PACKAGE_NAME}_INST_EXECSPACE_SERIAL} AND ${${PACKAGE_NAME}_INST_MEMSPACE_HOSTSPACE})
LIST(APPEND DEVICE_LIST "<Serial,HostSpace>")
ENDIF()
ENDIF()
# ==================================================================
# Enable Scalar Types for ETI
# ==================================================================
TRIBITS_ADD_OPTION_AND_DEFINE(
${PACKAGE_NAME}_ETI_Only
KOKKOSKERNELS_ETI_ONLY
"Whether to restrict availability of kernels to ETI types only. This is off by default, i.e. any type combination can be instantiated. Turning this on guarantees that kernels are never build inside of object files which simply call KokkosKernels functions."
OFF
)
TRIBITS_ADD_OPTION_AND_DEFINE(
${PACKAGE_NAME}_Test_ETI_Only
KOKKOSKERNELS_TEST_ETI_ONLY
"Whether to restrict testing to ETI types."
ON
)
TRIBITS_ADD_OPTION_AND_DEFINE(
${PACKAGE_NAME}_INST_DOUBLE
KOKKOSKERNELS_INST_DOUBLE
"Whether to pre instantiate kernels for the scalar type double. This option is KokkosKernels_INST_DOUBLE=ON by default. Disabling this may increase build times."
ON
)
IF (Trilinos_ENABLE_FLOAT)
GLOBAL_SET(KokkosKernels_INST_FLOAT_DEFAULT ON)
ELSE()
GLOBAL_SET(KokkosKernels_INST_FLOAT_DEFAULT OFF)
ENDIF()
TRIBITS_ADD_OPTION_AND_DEFINE(
${PACKAGE_NAME}_INST_FLOAT
KOKKOSKERNELS_INST_FLOAT
"Whether to pre instantiate kernels for the scalar type float. This option is KokkosKernels_INST_FLOAT=Trilinos_ENABLE_FLOAT by default. Disabling this may increase build times."
${KokkosKernels_INST_FLOAT_DEFAULT}
)
IF (KokkosKernels_INST_DOUBLE AND Trilinos_ENABLE_COMPLEX_DOUBLE)
GLOBAL_SET(KokkosKernels_INST_COMPLEX_DOUBLE_DEFAULT ON)
ELSE()
GLOBAL_SET(KokkosKernels_INST_COMPLEX_DOUBLE_DEFAULT OFF)
ENDIF()
IF (KokkosKernels_INST_FLOAT AND Trilinos_ENABLE_COMPLEX_FLOAT)
GLOBAL_SET(KokkosKernels_INST_COMPLEX_FLOAT_DEFAULT ON)
ELSE()
GLOBAL_SET(KokkosKernels_INST_COMPLEX_FLOAT_DEFAULT OFF)
ENDIF()
TRIBITS_ADD_OPTION_AND_DEFINE(
${PACKAGE_NAME}_INST_COMPLEX_DOUBLE
KOKKOSKERNELS_INST_COMPLEX_DOUBLE
"Whether to pre instantiate kernels for the scalar type complex<double>. This option is KokkosKernels_INST_COMPLEX_DOUBLE=${Trilinos_ENABLE_COMPLEX_DOUBLE} by default. Disabling this may increase build times."
${KokkosKernels_INST_COMPLEX_DOUBLE_DEFAULT}
)
TRIBITS_ADD_OPTION_AND_DEFINE(
${PACKAGE_NAME}_INST_COMPLEX_FLOAT
KOKKOSKERNELS_INST_COMPLEX_FLOAT
"Whether to pre instantiate kernels for the scalar type complex<float>. This option is KokkosKernels_INST_COMPLEX_FLOAT=${Trilinos_ENABLE_COMPLEX_FLOAT} by default. Disabling this may increase build times."
${KokkosKernels_INST_COMPLEX_FLOAT_DEFAULT}
)
IF (KokkosKernels_INST_DOUBLE)
LIST(APPEND SCALAR_LIST "double")
ENDIF()
IF (KokkosKernels_INST_FLOAT)
LIST(APPEND SCALAR_LIST "float")
ENDIF()
IF (KokkosKernels_INST_COMPLEX_DOUBLE)
LIST(APPEND SCALAR_LIST "complex<double>")
ENDIF()
IF (KokkosKernels_INST_FLOAT)
LIST(APPEND SCALAR_LIST "complex<float>")
ENDIF()
TRIBITS_ADD_OPTION_AND_DEFINE(
${PACKAGE_NAME}_INST_LAYOUTLEFT
KOKKOSKERNELS_INST_LAYOUTLEFT
"Whether to pre instantiate kernels for the view layout LayoutLeft. This option is KokkosKernels_INST_LAYOUTLEFT=ON by default. Disabling this may increase build times."
ON
)
TRIBITS_ADD_OPTION_AND_DEFINE(
${PACKAGE_NAME}_INST_LAYOUTRIGHT
KOKKOSKERNELS_INST_LAYOUTRIGHT
"Whether to pre instantiate kernels for the view layout LayoutRight. This option is KokkosKernels_INST_LAYOUTRIGHT=OFF by default. Disabling this may increase build times."
OFF
)
# ==================================================================
# Enable Ordinal Types for ETI
# ==================================================================
GLOBAL_SET(KokkosKernels_INST_ORDINAL_INT_DEFAULT ON)
GLOBAL_SET(KokkosKernels_INST_ORDINAL_INT64_T_DEFAULT OFF)
TRIBITS_ADD_OPTION_AND_DEFINE(
${PACKAGE_NAME}_INST_ORDINAL_INT
KOKKOSKERNELS_INST_ORDINAL_INT
"Whether to pre instantiate kernels for the ordinal type int. This option is KokkosKernels_INST_ORDINAL_INT=ON by default."
${KokkosKernels_INST_ORDINAL_INT_DEFAULT}
)
TRIBITS_ADD_OPTION_AND_DEFINE(
${PACKAGE_NAME}_INST_ORDINAL_INT64_T
KOKKOSKERNELS_INST_ORDINAL_INT64_T
"Whether to pre instantiate kernels for the ordinal type int64_t. This option is KokkosKernels_INST_ORDINAL_INT64_T=OFF by default."
${KokkosKernels_INST_ORDINAL_INT64_T_DEFAULT}
)
IF (KokkosKernels_INST_ORDINAL_INT)
LIST(APPEND ORDINAL_LIST "int")
ENDIF()
IF (KokkosKernels_INST_ORDINAL_INT64_T)
LIST(APPEND ORDINAL_LIST "int64_t")
ENDIF()
# ==================================================================
# Enable Offset Types for ETI
# ==================================================================
GLOBAL_SET(KokkosKernels_INST_OFFSET_SIZE_T_DEFAULT ON)
GLOBAL_SET(KokkosKernels_INST_OFFSET_INT_DEFAULT ON)
#GLOBAL_SET(KokkosKernels_INST_OFFSET_INT64_T_DEFAULT OFF)
TRIBITS_ADD_OPTION_AND_DEFINE(
${PACKAGE_NAME}_INST_OFFSET_INT
KOKKOSKERNELS_INST_OFFSET_INT
"Whether to pre instantiate kernels for the offset type int. This option is KokkosKernels_INST_OFFSET_INT=ON by default."
${KokkosKernels_INST_OFFSET_INT_DEFAULT}
)
TRIBITS_ADD_OPTION_AND_DEFINE(
${PACKAGE_NAME}_INST_OFFSET_SIZE_T
KOKKOSKERNELS_INST_OFFSET_SIZE_T
"Whether to pre instantiate kernels for the offset type size_t. This option is KokkosKernels_INST_OFFSET_SIZE_T=OFF by default."
${KokkosKernels_INST_OFFSET_SIZE_T_DEFAULT}
)
IF (KokkosKernels_INST_OFFSET_INT)
LIST(APPEND OFFSET_LIST "int")
ENDIF()
IF (KokkosKernels_INST_OFFSET_SIZE_T)
LIST(APPEND OFFSET_LIST "size_t")
ENDIF()
MESSAGE("")
MESSAGE("=======================")
MESSAGE("KokkosKernels ETI Types")
MESSAGE(" Devices: ${DEVICE_LIST}")
MESSAGE(" Scalars: ${SCALAR_LIST}")
MESSAGE(" Ordinals: ${ORDINAL_LIST}")
MESSAGE(" Offsets: ${OFFSET_LIST}")
MESSAGE("=======================")
MESSAGE("")
# ==================================================================
# Process subdirectories
# ==================================================================
ADD_SUBDIRECTORY(src)
TRIBITS_ADD_TEST_DIRECTORIES(perf_test)
TRIBITS_ADD_TEST_DIRECTORIES(unit_test)
#TRIBITS_ADD_EXAMPLE_DIRECTORIES(example)
TRIBITS_PACKAGE_POSTPROCESS()