-
Notifications
You must be signed in to change notification settings - Fork 114
Expand file tree
/
Copy pathtest-kernel-reduce-params-multi-lambda.cpp.in
More file actions
267 lines (222 loc) · 7.47 KB
/
Copy pathtest-kernel-reduce-params-multi-lambda.cpp.in
File metadata and controls
267 lines (222 loc) · 7.47 KB
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
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
// Copyright (c) Lawrence Livermore National Security, LLC and other
// RAJA Project Developers. See top-level LICENSE and COPYRIGHT
// files for dates and other details. No copyright assignment is required
// to contribute to RAJA.
//
// SPDX-License-Identifier: (BSD-3-Clause)
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
//
// test/include headers
//
#include "RAJA_test-base.hpp"
#include "RAJA_test-camp.hpp"
#include "RAJA_test-index-types.hpp"
// for data types
#include "RAJA_test-reduce-types.hpp"
#include "RAJA_test-reduceloc-types.hpp"
#include "RAJA_test-forall-data.hpp"
//
// Header for tests in ./tests directory
//
// Note: CMake adds ./tests as an include dir for these tests.
//
#include "test-kernel-reduce-params-multi-lambda.hpp"
using Lambda0Params = RAJA::Params<0, 2, 4, 7>;
using Lambda1Params = RAJA::Params<1, 3, 5, 6, 7>;
using Lambda0Segs = RAJA::Segs<0, 1>;
using Lambda1Segs = RAJA::Segs<0, 1>;
//
// Exec pols for kernel region tests
//
using SequentialKernelLocExecPols =
camp::list<
RAJA::KernelPolicy<
RAJA::statement::For<1, RAJA::seq_exec, // row
RAJA::statement::For<0, RAJA::seq_exec, // col
RAJA::statement::Lambda<0, Lambda0Segs, Lambda0Params>,
RAJA::statement::Lambda<1, Lambda1Segs, Lambda1Params>
>
>
>
>;
using SequentialKernelLocForallPols =
camp::list<
RAJA::seq_exec
>;
#if defined(RAJA_ENABLE_OPENMP)
using OpenMPKernelLocExecPols =
camp::list<
RAJA::KernelPolicy<
RAJA::statement::For<1, RAJA::seq_exec, // row
RAJA::statement::For<0, RAJA::omp_parallel_for_exec, // col
RAJA::statement::Lambda<0, Lambda0Segs, Lambda0Params>,
RAJA::statement::Lambda<1, Lambda1Segs, Lambda1Params>
>
>
>,
RAJA::KernelPolicy<
RAJA::statement::For<1, RAJA::omp_parallel_for_exec, // row
RAJA::statement::For<0, RAJA::seq_exec, // col
RAJA::statement::Lambda<0, Lambda0Segs, Lambda0Params>,
RAJA::statement::Lambda<1, Lambda1Segs, Lambda1Params>
>
>
>,
RAJA::KernelPolicy<
RAJA::statement::Collapse<RAJA::omp_parallel_collapse_exec,
RAJA::ArgList<1,0>,
RAJA::statement::Lambda<0, Lambda0Segs, Lambda0Params>,
RAJA::statement::Lambda<1, Lambda1Segs, Lambda1Params>
>
>
>;
using OpenMPKernelLocForallPols =
camp::list<
RAJA::omp_parallel_for_exec
>;
#endif // RAJA_ENABLE_OPENMP
#if defined(RAJA_ENABLE_TARGET_OPENMP)
using OpenMPTargetKernelLocExecPols =
camp::list<
RAJA::KernelPolicy<
RAJA::statement::For<1, RAJA::seq_exec, // row
RAJA::statement::For<0, RAJA::omp_target_parallel_for_exec<16>, // col
RAJA::statement::Lambda<0, Lambda0Segs, Lambda0Params>,
RAJA::statement::Lambda<1, Lambda1Segs, Lambda1Params>
>
>
>,
// TODO: Works for XLC and Clang10, but only up to input size of 362x362 matrix.
RAJA::KernelPolicy<
RAJA::statement::Collapse<RAJA::omp_target_parallel_collapse_exec,
RAJA::ArgList<1,0>,
RAJA::statement::Lambda<0, Lambda0Segs, Lambda0Params>,
RAJA::statement::Lambda<1, Lambda1Segs, Lambda1Params>
>
>
>;
using OpenMPTargetKernelLocForallPols =
camp::list<
RAJA::omp_target_parallel_for_exec<16>
>;
#endif // RAJA_ENABLE_TARGET_OPENMP
#if defined(RAJA_ENABLE_CUDA)
using CudaKernelLocExecPols =
camp::list<
// Two full grid reductions
RAJA::KernelPolicy<
RAJA::statement::CudaKernel<
RAJA::statement::For<1, RAJA::cuda_thread_x_loop, // row
RAJA::statement::For<0, RAJA::cuda_thread_y_loop, // col
RAJA::statement::Lambda<0, Lambda0Segs, Lambda0Params>,
RAJA::statement::Lambda<1, Lambda1Segs, Lambda1Params>
>
>
>
>,
// Two grid reductions in different directions, with seq exec mixed at different
// levels
RAJA::KernelPolicy<
RAJA::statement::CudaKernel<
RAJA::statement::For<1, RAJA::seq_exec, // row
RAJA::statement::For<0, RAJA::cuda_thread_x_loop, // col
RAJA::statement::Lambda<0, Lambda0Segs, Lambda0Params>,
RAJA::statement::Lambda<1, Lambda1Segs, Lambda1Params>
>
>
>
>,
RAJA::KernelPolicy<
RAJA::statement::CudaKernel<
RAJA::statement::For<1, RAJA::seq_exec, // row
RAJA::statement::For<0, RAJA::cuda_thread_y_loop, // col
RAJA::statement::Lambda<0, Lambda0Segs, Lambda0Params>,
RAJA::statement::Lambda<1, Lambda1Segs, Lambda1Params>
>
>
>
>,
RAJA::KernelPolicy<
RAJA::statement::CudaKernel<
RAJA::statement::For<1, RAJA::cuda_global_size_y_loop<32>, // row
RAJA::statement::For<0, RAJA::cuda_global_size_x_loop<32>, // col
RAJA::statement::Lambda<0, Lambda0Segs, Lambda0Params>,
RAJA::statement::Lambda<1, Lambda1Segs, Lambda1Params>
>
>
>
>
>;
using CudaKernelLocForallPols =
camp::list<
RAJA::cuda_exec<1024, true>
>;
#endif // RAJA_ENABLE_CUDA
#if defined(RAJA_ENABLE_HIP)
using HipKernelLocExecPols =
camp::list<
// Two full grid reductions
RAJA::KernelPolicy<
RAJA::statement::HipKernel<
RAJA::statement::For<1, RAJA::hip_thread_x_loop, // row
RAJA::statement::For<0, RAJA::hip_thread_y_loop, // col
RAJA::statement::Lambda<0, Lambda0Segs, Lambda0Params>,
RAJA::statement::Lambda<1, Lambda1Segs, Lambda1Params>
>
>
>
>,
// Two grid reductions in different directions, with seq exec mixed at different
// levels
RAJA::KernelPolicy<
RAJA::statement::HipKernel<
RAJA::statement::For<1, RAJA::seq_exec, // row
RAJA::statement::For<0, RAJA::hip_thread_x_loop, // col
RAJA::statement::Lambda<0, Lambda0Segs, Lambda0Params>,
RAJA::statement::Lambda<1, Lambda1Segs, Lambda1Params>
>
>
>
>,
RAJA::KernelPolicy<
RAJA::statement::HipKernel<
RAJA::statement::For<1, RAJA::seq_exec, // row
RAJA::statement::For<0, RAJA::hip_thread_y_loop, // col
RAJA::statement::Lambda<0, Lambda0Segs, Lambda0Params>,
RAJA::statement::Lambda<1, Lambda1Segs, Lambda1Params>
>
>
>
>,
RAJA::KernelPolicy<
RAJA::statement::HipKernel<
RAJA::statement::For<1, RAJA::hip_global_size_y_loop<32>, // row
RAJA::statement::For<0, RAJA::hip_global_size_x_loop<32>, // col
RAJA::statement::Lambda<0, Lambda0Segs, Lambda0Params>,
RAJA::statement::Lambda<1, Lambda1Segs, Lambda1Params>
>
>
>
>
>;
using HipKernelLocForallPols =
camp::list<
RAJA::hip_exec<1024, true>
>;
#endif // RAJA_ENABLE_HIP
//
// Cartesian product of types used in parameterized tests
//
using @BACKEND@KernelLocTypes =
Test< camp::cartesian_product<RawIdxTypeList,
ReduceDataTypeList,
@BACKEND@ResourceList,
@BACKEND@KernelLocForallPols,
@BACKEND@KernelLocExecPols>>::Types;
//
// Instantiate parameterized test
//
INSTANTIATE_TYPED_TEST_SUITE_P(@BACKEND@,
KernelParamReduceMultiLambdaTest,
@BACKEND@KernelLocTypes);