Nektar++
Loading...
Searching...
No Matches
FwdTransBCBlockOpDeviceKernels.hpp
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: FwdTransBCBlockOpDeviceKernels.hpp
4//
5// For more information, please see: http://www.nektar.info
6//
7// The MIT License
8//
9// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10// Department of Aeronautics, Imperial College London (UK), and Scientific
11// Computing and Imaging Institute, University of Utah (USA).
12//
13// Permission is hereby granted, free of charge, to any person obtaining a
14// copy of this software and associated documentation files (the "Software"),
15// to deal in the Software without restriction, including without limitation
16// the rights to use, copy, modify, merge, publish, distribute, sublicense,
17// and/or sell copies of the Software, and to permit persons to whom the
18// Software is furnished to do so, subject to the following conditions:
19//
20// The above copyright notice and this permission notice shall be included
21// in all copies or substantial portions of the Software.
22//
23// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29// DEALINGS IN THE SOFTWARE.
30//
31// Description:
32//
33///////////////////////////////////////////////////////////////////////////////
34
35#pragma once
36
41
43{
44#if defined(NEKTAR_ENABLE_DEVICE) && defined(DEVICE_COMPILE_ONLY)
45// Helper function
46// Workspace of the 2D kernels, which the shared tables follow.
47NEK_HOSTDEVICE_INLINE constexpr unsigned int FwdTransBCWorkSpaceSize2D(
48 const LibUtilities::ShapeType shapeType, const unsigned int nq0,
49 const unsigned int nq1)
50{
51 if (shapeType == LibUtilities::Quad)
52 {
53 return 2 * nq0 * nq1 + std::max(nq0 * nq1, 2 * nq0 + 2 * nq1) +
54 std::max(nq0, nq1);
55 }
56 else if (shapeType == LibUtilities::Tri)
57 {
58 return 3 * nq0 * nq1 + std::max(nq0, nq1);
59 }
60
61 return 0;
62}
63
64// Workspace followed by the basis table.
65inline unsigned int FwdTransBCSharedMemorySize(const unsigned int nm0,
66 const unsigned int nq0)
67{
68 return 2 * nq0 + nm0 * nq0;
69}
70
71// Workspace followed by the basis tables and, for triangles, the transposed
72// interpolation from direction 1 to direction 0.
73inline unsigned int FwdTransBCSharedMemorySize(
74 const LibUtilities::ShapeType shapeType, const unsigned int nm0,
75 const unsigned int nm1, const unsigned int nmTot, const unsigned int nq0,
76 const unsigned int nq1)
77{
78 const unsigned int wspsize = FwdTransBCWorkSpaceSize2D(shapeType, nq0, nq1);
79
80 if (shapeType == LibUtilities::Quad)
81 {
82 return wspsize + nm0 * nq0 + nm1 * nq1;
83 }
84 else if (shapeType == LibUtilities::Tri)
85 {
86 return wspsize + nm0 * nq0 + nmTot * nq1 + nq0 * nq1;
87 }
88 else if (shapeType == LibUtilities::NodalTri)
89 {
90 return 0;
91 }
92
93 return 0;
94}
95
96template <bool DEFORMED, typename TthreadBlock, typename TData>
97NEK_DEVICE_INLINE static void FwdTransBCSegSumFacTOPKernel(
98 const unsigned int nm0, const unsigned int nq0,
99 const TData *NEK_RESTRICT basis0, const TData *NEK_RESTRICT w0,
100 const unsigned int offset_seg, const TData *NEK_RESTRICT invintmass,
101 [[maybe_unused]] const TData *NEK_RESTRICT jac,
102 const TData *NEK_RESTRICT in, TData *NEK_RESTRICT out,
103 TData *NEK_RESTRICT wsp1, TData *NEK_RESTRICT wsp2,
104 const TthreadBlock &threadBlock)
105{
106 const unsigned int idx0 = getLocalIdx(threadBlock);
107 const unsigned int stride = getLocalRange(threadBlock);
108
109 // Get size of interior DoF
110 // Note nmBndSeg is correct for modified and GLL_Lagrange basis
111 const unsigned int nmBndSeg = 2;
112 const unsigned int nmInt = nm0 - nmBndSeg;
113
114 /// Step 1: Evaluate vertex contriubtion
115 /// i.e set vertex modes and evaluate mass matrix
116 // TODO need different map for right vertex when using GLL_LAGRANGE
117 for (unsigned int i = idx0; i < nmBndSeg; i += stride)
118 {
119 unsigned int idBnd = i == 0 ? 0 : nq0 - 1;
120 out[i] = in[idBnd];
121 }
122
123 // synchronize threads.
124 localBarrier(threadBlock);
125
126 // Do BwdTrans of vertex modes
127 BwdTransSegSumFacTOPKernel<false>(nm0, nq0, basis0, out, wsp2, threadBlock);
128
129 // Apply Jacobian and quadrature weights for IProduct
130 for (unsigned int i = idx0; i < nq0; i += stride)
131 {
132 if constexpr (DEFORMED)
133 {
134 wsp2[i] = (in[i] - wsp2[i]) * jac[i] * w0[i];
135 }
136 else
137 {
138 wsp2[i] = (in[i] - wsp2[i]) * w0[i];
139 }
140 }
141
142 // synchronize threads.
143 localBarrier(threadBlock);
144
145 // Do IProduct to complete Mass matrix
146 // use negative scale to subtract from Dirichlet condition
147 IProductWRTBaseSegSumFacTOPKernel<false, false>(
148 nm0, nq0, basis0, wsp2, wsp1, (TData)1.0, threadBlock);
149
150 // Step 4: Project edge interior modes onto boundary
151 // Matrix vector product with interior mass matrix
152 Nektar::MatVecSumFacTOPKernel<false, false>(
153 nmInt, invintmass, wsp1 + offset_seg, out + offset_seg, threadBlock);
154}
155
156template <bool DEFORMED, typename TthreadBlock, typename TData>
157NEK_DEVICE_INLINE static void FwdTransBCQuadSumFacTOPKernel(
158 const unsigned int nm0, const unsigned int nm1, const unsigned int nmTot,
159 const unsigned int nq0, const unsigned int nq1,
160 const TData *NEK_RESTRICT basis0, const TData *NEK_RESTRICT basis1,
161 const TData *NEK_RESTRICT w0, const TData *NEK_RESTRICT w1,
162 const unsigned int offset_seg, const TData *NEK_RESTRICT invintmass0,
163 const TData *NEK_RESTRICT invintmass1, const TData *NEK_RESTRICT tJac,
164 const unsigned int *NEK_RESTRICT tMap, const int *NEK_RESTRICT tSign,
165 const unsigned int nmTotInt, const unsigned int *iMap,
166 const TData *NEK_RESTRICT invintmass,
167 [[maybe_unused]] const TData *NEK_RESTRICT jac,
168 const TData *NEK_RESTRICT in, TData *NEK_RESTRICT out,
169 TData *NEK_RESTRICT wsp1, TData *NEK_RESTRICT wsp2,
170 TData *NEK_RESTRICT wsp3, TData *NEK_RESTRICT wsp4,
171 const TthreadBlock &threadBlock)
172{
173 const unsigned int idx0 = getLocalIdx(threadBlock);
174 const unsigned int stride = getLocalRange(threadBlock);
175
176 // Get relevant sizes in phys and coeff space
177 const unsigned int nqTot = nq0 * nq1;
178 const unsigned int nmEdgeTot = 2 * nm0 + 2 * nm1;
179
180 /// Step 1: Extract edge modes
181 for (unsigned int i = idx0; i < nq0; i += stride)
182 {
183 wsp1[i] = in[i];
184 wsp1[i + nq0 + nq1] = in[nq0 * (nq1 - 1) + i];
185 }
186 for (unsigned int i = idx0; i < nq1; i += stride)
187 {
188 wsp1[i + nq0] = in[nq0 - 1 + i * nq0];
189 wsp1[i + 2 * nq0 + nq1] = in[i * nq0];
190 }
191
192 // Zero wsp2
193 for (unsigned int i = idx0; i < nmEdgeTot; i += stride)
194 {
195 wsp2[i] = 0.0;
196 }
197
198 // synchronize threads.
199 localBarrier(threadBlock);
200
201 // Remove vertex contribution for every edge
202 // TODO Do we need a separate check (vector of booleans) whether segment
203 // is deformed?
204 FwdTransBCSegSumFacTOPKernel<false>(nm0, nq0, basis0, w0, offset_seg,
205 invintmass0, tJac, wsp1, wsp2, wsp3,
206 wsp4, threadBlock);
207 FwdTransBCSegSumFacTOPKernel<false>(nm1, nq1, basis1, w1, offset_seg,
208 invintmass1, tJac + 1, wsp1 + nq0,
209 wsp2 + nm0, wsp3, wsp4, threadBlock);
210 FwdTransBCSegSumFacTOPKernel<false>(
211 nm0, nq0, basis0, w0, offset_seg, invintmass0, tJac + 2,
212 wsp1 + nq0 + nq1, wsp2 + nm0 + nm1, wsp3, wsp4, threadBlock);
213 FwdTransBCSegSumFacTOPKernel<false>(
214 nm1, nq1, basis1, w1, offset_seg, invintmass1, tJac + 3,
215 wsp1 + 2 * nq0 + nq1, wsp2 + 2 * nm0 + nm1, wsp3, wsp4, threadBlock);
216
217 // Map edge modes (without vertex contribution) back into face
218 for (unsigned int j = idx0; j < nmEdgeTot; j += stride)
219 {
220 out[tMap[j]] = tSign[j] * wsp2[j];
221 }
222
223 // synchronize threads.
224 localBarrier(threadBlock);
225
226 /// Step 2: Evaluate edge contributions via mass matrix
227 BwdTransQuadSumFacTOPKernel<false>(nm0, nm1, nq0, nq1, nqTot, basis0,
228 basis1, out, wsp1, wsp2, threadBlock);
229
230 // Apply jacobian and quadrature weights
231 for (unsigned int idx = idx0; idx < nqTot; idx += stride)
232 {
233 const unsigned int i = idx % nq0;
234 const unsigned int j = idx / nq0;
235 if constexpr (DEFORMED)
236 {
237 wsp1[idx] = (in[idx] - wsp1[idx]) * jac[idx] * w0[i] * w1[j];
238 }
239 else
240 {
241 wsp1[idx] = (in[idx] - wsp1[idx]) * w0[i] * w1[j];
242 }
243 }
244
245 // synchronize threads.
246 localBarrier(threadBlock);
247
248 // Complete mass matrix with IProduct
249 IProductWRTBaseQuadSumFacTOPKernel<false, false>(
250 nm0, nm1, nmTot, nq0, nq1, nqTot, basis0, basis1, wsp1, wsp2, wsp3,
251 (TData)1.0, threadBlock);
252
253 /// Step 3: Project face/interior modes onto boundary
254 // Map to interior coeffs
255 for (unsigned int j = idx0; j < nmTotInt; j += stride)
256 {
257 wsp1[j] = wsp2[iMap[j]];
258 }
259
260 // synchronize threads.
261 localBarrier(threadBlock);
262
263 // Projection ie matrix vector product with inverse interior mass
264 Nektar::MatVecSumFacTOPKernel<false, false>(nmTotInt, invintmass, wsp1,
265 wsp2, threadBlock);
266
267 // Map to volume
268 for (unsigned int j = idx0; j < nmTotInt; j += stride)
269 {
270 out[iMap[j]] = wsp2[j];
271 }
272
273 // synchronize threads.
274 localBarrier(threadBlock);
275}
276
277template <bool DEFORMED, typename TthreadBlock, typename TData>
278NEK_DEVICE_INLINE static void FwdTransBCTriSumFacTOPKernel(
279 const unsigned int nm0, const unsigned int nm1, const unsigned int nmTot,
280 const unsigned int nq0, const unsigned int nq1, const bool isModified,
281 const unsigned int *NEK_RESTRICT index0, const TData *NEK_RESTRICT basis0,
282 const TData *NEK_RESTRICT basis1, const TData *NEK_RESTRICT w0,
283 const TData *NEK_RESTRICT w1, const TData *NEK_RESTRICT interp1to0T,
284 const unsigned int offset_seg, const TData *NEK_RESTRICT invintmass0,
285 const TData *NEK_RESTRICT tJac, const unsigned int *NEK_RESTRICT tMap,
286 const int *NEK_RESTRICT tSign, const unsigned int nmTotInt,
287 const unsigned int *iMap, const TData *NEK_RESTRICT invintmass,
288 [[maybe_unused]] const TData *NEK_RESTRICT jac,
289 const TData *NEK_RESTRICT in, TData *NEK_RESTRICT out,
290 TData *NEK_RESTRICT wsp1, TData *NEK_RESTRICT wsp2,
291 TData *NEK_RESTRICT wsp3, TData *NEK_RESTRICT wsp4,
292 const TthreadBlock &threadBlock)
293{
294 const unsigned int idx0 = getLocalIdx(threadBlock);
295 const unsigned int stride = getLocalRange(threadBlock);
296
297 // Get relevant sizes in phys and coeff space
298 const unsigned int nqTot = nq0 * nq1;
299 const unsigned int nmEdgeTot = nm0 + 2 * nm1;
300
301 /// Step 1: Extract edge modes
302 TData tmp, tmp2;
303 for (unsigned int i = idx0; i < nq0; i += stride)
304 {
305 // Interpolate basis1 to basis0 for edge1 and edge2
306 // Note interpolation only required if basis1 != GLL
307 // Interpolate always to avoid branching
308 tmp = 0.0, tmp2 = 0.0;
309 for (unsigned int j = 0u; j < nq1; j++)
310 {
311 tmp += in[nq0 - 1 + j * nq0] * interp1to0T[j * nq0 + i];
312 tmp2 += in[j * nq0] * interp1to0T[j * nq0 + i];
313 }
314
315 wsp1[i] = in[i];
316 wsp1[i + nq0] = tmp;
317 wsp1[i + 2 * nq0] = tmp2;
318 }
319
320 // synchronize threads.
321 localBarrier(threadBlock);
322
323 // Zero wsp2
324 for (unsigned int i = idx0; i < nmEdgeTot; i += stride)
325 {
326 wsp2[i] = 0.0;
327 }
328
329 // synchronize threads.
330 localBarrier(threadBlock);
331
332 // Compute vertex contribution for every edge
333 // TODO Do we need a separate check whether segment is deformed?
334 FwdTransBCSegSumFacTOPKernel<false>(nm0, nq0, basis0, w0, offset_seg,
335 invintmass0, tJac, wsp1, wsp2, wsp3,
336 wsp4, threadBlock);
337 FwdTransBCSegSumFacTOPKernel<false>(nm0, nq0, basis0, w0, offset_seg,
338 invintmass0, tJac + 1, wsp1 + nq0,
339 wsp2 + nm0, wsp3, wsp4, threadBlock);
340
341 // Map edge modes (without vertex contribution) back into face
342 for (unsigned int j = idx0; j < 2 * nm0; j += stride)
343 {
344 out[tMap[j]] = tSign[j] * wsp2[j];
345 }
346
347 FwdTransBCSegSumFacTOPKernel<false>(
348 nm0, nq0, basis0, w0, offset_seg, invintmass0, tJac + 2,
349 wsp1 + nq0 + nq0, wsp2 + nm0 + nm1, wsp3, wsp4, threadBlock);
350
351 // Map edge modes (without vertex contribution) back into face
352 for (unsigned int j = idx0; j < nm0; j += stride)
353 {
354 out[tMap[j + nm0 + nm1]] = tSign[j + nm0 + nm1] * wsp2[j + nm0 + nm1];
355 }
356
357 // synchronize threads.
358 localBarrier(threadBlock);
359
360 /// Step 2: Evaluate edge contributions via mass matrix
361 BwdTransTriSumFacTOPKernel<false>(nm0, nm1, nq0, nq1, nqTot, isModified,
362 basis0, basis1, out, wsp1, wsp2,
364
365 // Apply jacobian and quadrature weights
366 for (unsigned int idx = idx0; idx < nqTot; idx += stride)
367 {
368 const unsigned int i = idx % nq0;
369 const unsigned int j = idx / nq0;
370 if constexpr (DEFORMED)
371 {
372 wsp1[idx] = (in[idx] - wsp1[idx]) * jac[idx] * w0[i] * w1[j];
373 }
374 else
375 {
376 wsp1[idx] = (in[idx] - wsp1[idx]) * w0[i] * w1[j];
377 }
378 }
379
380 // synchronize threads.
381 localBarrier(threadBlock);
382
383 // Complete mass matrix with IProduct
384 IProductWRTBaseTriSumFacTOPKernel<false, false>(
385 nm0, nm1, nmTot, nq0, nq1, nqTot, isModified, index0, basis0, basis1,
386 wsp1, wsp2, wsp3, (TData)1.0, threadBlock);
387
388 /// Step 3: Project face/interior modes onto boundary
389 // Map to interior coeffs
390 for (unsigned int j = idx0; j < nmTotInt; j += stride)
391 {
392 wsp1[j] = wsp2[iMap[j]];
393 }
394
395 // synchronize threads.
396 localBarrier(threadBlock);
397
398 // Projection ie matrix vector product with inverse interior mass
399 Nektar::MatVecSumFacTOPKernel<false, false>(nmTotInt, invintmass, wsp1,
400 wsp2, threadBlock);
401
402 // Map to volume
403 for (unsigned int j = idx0; j < nmTotInt; j += stride)
404 {
405 out[iMap[j]] = wsp2[j];
406 }
407
408 // synchronize threads.
409 localBarrier(threadBlock);
410}
411
412template <bool DEFORMED, typename TthreadBlock, typename TData>
414 const unsigned int nm0, const unsigned int nq0, const size_t nelmt,
415 const TData *NEK_RESTRICT basis0, const TData *NEK_RESTRICT w0,
416 const unsigned int offset_seg, const TData *NEK_RESTRICT invintmass,
417 const TData *NEK_RESTRICT jac, const TData *NEK_RESTRICT in,
418 TData *NEK_RESTRICT out,
419 [[maybe_unused]] unsigned char *NEK_RESTRICT shmemptr,
420 const TthreadBlock &threadBlock)
421{
422 const unsigned int jacsize = DEFORMED ? nq0 : 1u;
423
424 // Copy the basis table to shared memory, past the workspace; the first
425 // barrier of the segment kernel precedes its first use.
426 TData *s_basis0 = (TData *)shmemptr + 2 * nq0;
427
428 // Copy to shared memory.
429 LoadToSharedMemory(nm0 * nq0, basis0, s_basis0, threadBlock);
430
431 // Per Element
432 size_t e = getBlockIdx(threadBlock);
433
434 while (e < nelmt)
435 {
436 const TData *jacptr = jac + jacsize * e;
437 const TData *inptr = in + nq0 * e;
438 TData *outptr = out + nm0 * e;
439
440 // Get shared memory
441 TData *s_wsp1 = (TData *)shmemptr;
442 TData *s_wsp2 = s_wsp1 + nq0;
443
444 FwdTransBCSegSumFacTOPKernel<DEFORMED>(
445 nm0, nq0, s_basis0, w0, offset_seg, invintmass, jacptr, inptr,
446 outptr, s_wsp1, s_wsp2, threadBlock);
447
448 // Increment to next element
449 e += getBlockRange(threadBlock);
450 }
451}
452
453template <LibUtilities::ShapeType SHAPE_TYPE, bool DEFORMED,
454 typename TthreadBlock, typename TData>
456 const unsigned int nm0, const unsigned int nm1, const unsigned int nmTot,
457 const unsigned int nq0, const unsigned int nq1, const size_t nelmt,
458 const bool isModified, const unsigned int *NEK_RESTRICT index0,
459 const TData *NEK_RESTRICT basis0, const TData *NEK_RESTRICT basis1,
460 const TData *NEK_RESTRICT w0, const TData *NEK_RESTRICT w1,
461 const TData *NEK_RESTRICT interp1to0, const unsigned int offset_seg,
462 const TData *NEK_RESTRICT invintmass0,
463 const TData *NEK_RESTRICT invintmass1, const TData *NEK_RESTRICT tJac,
464 const unsigned int *NEK_RESTRICT tMap, const int *NEK_RESTRICT tSign,
465 const unsigned int nmTotInt, const unsigned int *iMap,
466 const TData *NEK_RESTRICT invintmass, const TData *NEK_RESTRICT jac,
467 const TData *NEK_RESTRICT in, TData *NEK_RESTRICT out,
468 [[maybe_unused]] unsigned char *NEK_RESTRICT shmemptr,
469 const TthreadBlock &threadBlock)
470{
471 const unsigned int nqTot = nq0 * nq1;
472 const unsigned int jacsize = DEFORMED ? nqTot : 1u;
473
474 unsigned int nEdges = 0;
475 if constexpr (SHAPE_TYPE == LibUtilities::Quad)
476 {
477 nEdges = 4;
478 }
479 if constexpr (SHAPE_TYPE == LibUtilities::Tri)
480 {
481 nEdges = 3;
482 }
483
484 const unsigned int *tmapptr = tMap;
485 const int *tsignptr = tSign;
486 const unsigned int *imapptr = iMap;
487
488 // Copy the basis tables and, for triangles, the transposed interpolation
489 // to shared memory, past the workspace.
490 const unsigned int nmode1 =
491 (SHAPE_TYPE == LibUtilities::Quad) ? nm1 : nmTot;
492
493 TData *s_basis0 =
494 (TData *)shmemptr + FwdTransBCWorkSpaceSize2D(SHAPE_TYPE, nq0, nq1);
495 TData *s_basis1 = s_basis0 + nm0 * nq0;
496 TData *s_interp1to0 = s_basis1 + nmode1 * nq1;
497
498 const unsigned int idx0 = getLocalIdx(threadBlock);
499 const unsigned int stride = getLocalRange(threadBlock);
500
501 // Copy to shared memory.
502 LoadToSharedMemory(nm0 * nq0, basis0, s_basis0, threadBlock);
503 LoadToSharedMemory(nmode1 * nq1, basis1, s_basis1, threadBlock);
504
505 if constexpr (SHAPE_TYPE == LibUtilities::Tri)
506 {
507 for (unsigned int idx = idx0; idx < nq0 * nq1; idx += stride)
508 {
509 s_interp1to0[(idx % nq1) * nq0 + idx / nq1] = interp1to0[idx];
510 }
511 }
512
513 localBarrier(threadBlock);
514
515 size_t e = getBlockIdx(threadBlock);
516 while (e < nelmt)
517 {
518 const TData *tjacptr = tJac + nEdges * e;
519 const TData *massintptr =
520 (DEFORMED) ? invintmass + nmTotInt * nmTotInt * e : invintmass;
521 const TData *jacptr = jac + jacsize * e;
522 const TData *inptr = in + nqTot * e;
523 TData *outptr = out + nmTot * e;
524
525 if constexpr (SHAPE_TYPE == LibUtilities::Quad)
526 {
527 // Get shared memory
528 TData *s_wsp1 = (TData *)shmemptr;
529 TData *s_wsp2 = s_wsp1 + std::max(nqTot, 2 * nq0 + 2 * nq1);
530 TData *s_wsp3 = s_wsp2 + nqTot;
531 TData *s_wsp4 = s_wsp3 + nqTot;
532
533 FwdTransBCQuadSumFacTOPKernel<DEFORMED>(
534 nm0, nm1, nmTot, nq0, nq1, s_basis0, s_basis1, w0, w1,
535 offset_seg, invintmass0, invintmass1, tjacptr, tmapptr,
536 tsignptr, nmTotInt, imapptr, massintptr, jacptr, inptr, outptr,
537 s_wsp1, s_wsp2, s_wsp3, s_wsp4, threadBlock);
538 }
539 else if constexpr (SHAPE_TYPE == LibUtilities::Tri)
540 {
541 // Get shared memory
542 TData *s_wsp1 = (TData *)shmemptr;
543 TData *s_wsp2 = s_wsp1 + nqTot;
544 TData *s_wsp3 = s_wsp2 + nqTot;
545 TData *s_wsp4 = s_wsp3 + nqTot;
546
547 FwdTransBCTriSumFacTOPKernel<DEFORMED>(
548 nm0, nm1, nmTot, nq0, nq1, isModified, index0, s_basis0,
549 s_basis1, w0, w1, s_interp1to0, offset_seg, invintmass0,
550 tjacptr, tmapptr, tsignptr, nmTotInt, imapptr, massintptr,
551 jacptr, inptr, outptr, s_wsp1, s_wsp2, s_wsp3, s_wsp4,
553 }
554
555 // Increment to next element
556 e += getBlockRange(threadBlock);
557 }
558}
559
560// Kernel Launchers.
561template <bool DEFORMED, typename TthreadBlock, typename TData>
562NEK_DEVICE_KERNEL void FwdTransBC1DKernelLauncher(
563 const unsigned int nm0, const unsigned int nq0, const size_t nelmt,
564 const TData *NEK_RESTRICT basis0, const TData *NEK_RESTRICT w0,
565 const unsigned int offset_seg, const TData *NEK_RESTRICT invintmass,
566 const TData *NEK_RESTRICT jac, const TData *NEK_RESTRICT in,
567 TData *NEK_RESTRICT out, unsigned char *shmemptr,
568 const TthreadBlock &threadBlock)
569{
571
572 FwdTransBC1DKernel<DEFORMED>(nm0, nq0, nelmt, basis0, w0, offset_seg,
573 invintmass, jac, in, out, shmemptr,
575}
576
577// Kernel Launchers.
578template <LibUtilities::ShapeType SHAPE_TYPE, bool DEFORMED,
579 typename TthreadBlock, typename TData>
580NEK_DEVICE_KERNEL void FwdTransBC2DKernelLauncher(
581 const unsigned int nm0, const unsigned int nm1, const unsigned int nmTot,
582 const unsigned int nq0, const unsigned int nq1, const size_t nelmt,
583 const bool isModified, const unsigned int *NEK_RESTRICT index0,
584 const TData *NEK_RESTRICT basis0, const TData *NEK_RESTRICT basis1,
585 const TData *NEK_RESTRICT w0, const TData *NEK_RESTRICT w1,
586 const TData *NEK_RESTRICT interp1to0, const unsigned int offsetSeg,
587 const TData *NEK_RESTRICT invintmass0,
588 const TData *NEK_RESTRICT invintmass1, const TData *NEK_RESTRICT tJac,
589 const unsigned int *NEK_RESTRICT tMap, const int *NEK_RESTRICT tSign,
590 const unsigned int nmTotInt, const unsigned int *iMap,
591 const TData *NEK_RESTRICT invintmass, const TData *NEK_RESTRICT jac,
592 const TData *NEK_RESTRICT in, TData *NEK_RESTRICT out,
593 unsigned char *shmemptr, const TthreadBlock &threadBlock)
594{
596
597 FwdTransBC2DKernel<SHAPE_TYPE, DEFORMED>(
598 nm0, nm1, nmTot, nq0, nq1, nelmt, isModified, index0, basis0, basis1,
599 w0, w1, interp1to0, offsetSeg, invintmass0, invintmass1, tJac, tMap,
600 tSign, nmTotInt, iMap, invintmass, jac, in, out, shmemptr, threadBlock);
601}
602#endif
603
604} // namespace Nektar::MultiRegions::detail
#define NEK_RESTRICT
Definition Backends.hpp:254
#define NEK_DEVICE_INLINE
Definition Backends.hpp:283
#define NEK_HOSTDEVICE_INLINE
Definition Backends.hpp:268
#define NEK_DEVICE_KERNEL
Definition Backends.hpp:297
Device SumFacTOP kernels of the backward transform: one element, or a group of them,...
Device SumFacTOP kernels of the inner product with the basis: one element, or a group of them,...
NEK_DEVICE_KERNEL void const TData *NEK_RESTRICT const TData *NEK_RESTRICT const size_t const unsigned int const unsigned int const unsigned int const unsigned int const size_t const TData *NEK_RESTRICT const TData *NEK_RESTRICT const TUseSharedWsp TData *NEK_RESTRICT const TData *NEK_RESTRICT TData *NEK_RESTRICT const bool const bool unsigned char const TthreadBlock & threadBlock
static NEK_FORCE_INLINE void FwdTransBC1DKernel(const unsigned int nm0, const unsigned int nq0, const typename simd_type::scalarType *basis0, const typename simd_type::scalarType *w0, const unsigned int offset_seg, const simd_type *invintmass, const simd_type *jac, const simd_type *in, simd_type *out, simd_type *wsp1, simd_type *wsp2)
static NEK_FORCE_INLINE void FwdTransBC2DKernel(const unsigned int nm0, const unsigned int nm1, const unsigned int nq0, const unsigned int nq1, const bool isModified, const typename simd_type::scalarType *basis0, const typename simd_type::scalarType *basis1, const typename simd_type::scalarType *w0, const typename simd_type::scalarType *w1, const typename simd_type::scalarType *interp1to0, const unsigned int offset_seg, const simd_type *invintmass0, const simd_type *invintmass1, const simd_type *tJac, const unsigned int *tMap, const int *tSign, const unsigned int nmTotInt, const unsigned int *iMap, const simd_type *invintmass, const simd_type *jac, const simd_type *in, simd_type *out, simd_type *wsp1, simd_type *wsp2, simd_type *wsp3, simd_type *wsp4)
NEK_DEVICE_KERNEL void const TData *NEK_RESTRICT const TData *NEK_RESTRICT const size_t const unsigned int const unsigned int const unsigned int const unsigned int const size_t const TData *NEK_RESTRICT const TData *NEK_RESTRICT const TUseSharedWsp TData *NEK_RESTRICT const TData *NEK_RESTRICT in
NEK_DEVICE_KERNEL void const TData *NEK_RESTRICT const TData *NEK_RESTRICT const size_t const unsigned int const unsigned int const unsigned int const unsigned int const size_t const TData *NEK_RESTRICT const TData *NEK_RESTRICT const TUseSharedWsp TData *NEK_RESTRICT const TData *NEK_RESTRICT TData *NEK_RESTRICT const bool const bool unsigned char * shmemptr
NEK_DEVICE_KERNEL void const TData *NEK_RESTRICT const TData *NEK_RESTRICT const size_t const unsigned int const unsigned int const unsigned int const unsigned int const size_t const TData *NEK_RESTRICT const TData *NEK_RESTRICT jac
NEK_DEVICE_KERNEL void const TData *NEK_RESTRICT const TData *NEK_RESTRICT const size_t nelmt
NEK_DEVICE_KERNEL void const TData *NEK_RESTRICT const TData *NEK_RESTRICT const size_t const unsigned int const unsigned int const unsigned int const unsigned int const size_t const TData *NEK_RESTRICT const TData *NEK_RESTRICT const TUseSharedWsp TData *NEK_RESTRICT const TData *NEK_RESTRICT TData *NEK_RESTRICT out