Neko 1.99.11
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
constrain_mixed_bc.cu
Go to the documentation of this file.
1/*
2 Copyright (c) 2026, The Neko Authors
3 All rights reserved.
4
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions
7 are met:
8
9 * Redistributions of source code must retain the above copyright
10 notice, this list of conditions and the following disclaimer.
11
12 * Redistributions in binary form must reproduce the above
13 copyright notice, this list of conditions and the following
14 disclaimer in the documentation and/or other materials provided
15 with the distribution.
16
17 * Neither the name of the authors nor the names of its
18 contributors may be used to endorse or promote products derived
19 from this software without specific prior written permission.
20
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 POSSIBILITY OF SUCH DAMAGE.
33*/
34
36#include <device/cuda/check.h>
37
39
40extern "C" {
41
42 void cuda_constrain_mixed_bc_zero(void *mixed_msk, void *x, void *y,
43 void *z, int *constraint_n,
44 int *constraint_t1, int *constraint_t2,
45 void *n, void *t1, void *t2, int *m,
46 cudaStream_t strm) {
47
48 if (*m <= 0)
49 return;
50
51 const dim3 nthrds(1024, 1, 1);
52 const dim3 nblcks(((*m) + 1024 - 1) / 1024, 1, 1);
53
55 <<<nblcks, nthrds, 0, strm>>>((const int *) mixed_msk,
56 (real *) x,
57 (real *) y,
58 (real *) z,
59 *constraint_n,
60 *constraint_t1,
61 *constraint_t2,
62 (const real *) n,
63 (const real *) t1,
64 (const real *) t2,
65 *m);
66 CUDA_CHECK(cudaGetLastError());
67 }
68
69 void cuda_constrain_mixed_bc_set(void *mixed_msk, void *x, void *y,
70 void *z, int *constraint_n,
71 int *constraint_t1, int *constraint_t2,
72 void *n, void *t1, void *t2,
73 void *values_n, void *values_t1,
74 void *values_t2, int *m, cudaStream_t strm) {
75
76 if (*m <= 0)
77 return;
78
79 const dim3 nthrds(1024, 1, 1);
80 const dim3 nblcks(((*m) + 1024 - 1) / 1024, 1, 1);
81
83 <<<nblcks, nthrds, 0, strm>>>((const int *) mixed_msk,
84 (real *) x,
85 (real *) y,
86 (real *) z,
87 *constraint_n,
88 *constraint_t1,
89 *constraint_t2,
90 (const real *) n,
91 (const real *) t1,
92 (const real *) t2,
93 (const real *) values_n,
94 (const real *) values_t1,
95 (const real *) values_t2,
96 *m);
97 CUDA_CHECK(cudaGetLastError());
98 }
99
100 void cuda_constrain_mixed_bc_set_const(void *mixed_msk, void *x, void *y,
101 void *z, int *constraint_n,
102 int *constraint_t1,
103 int *constraint_t2, void *n,
104 void *t1, void *t2, real *value_n,
105 real *value_t1, real *value_t2,
106 int *m, cudaStream_t strm) {
107
108 if (*m <= 0)
109 return;
110
111 const dim3 nthrds(1024, 1, 1);
112 const dim3 nblcks(((*m) + 1024 - 1) / 1024, 1, 1);
113
115 <<<nblcks, nthrds, 0, strm>>>((const int *) mixed_msk,
116 (real *) x,
117 (real *) y,
118 (real *) z,
119 *constraint_n,
120 *constraint_t1,
121 *constraint_t2,
122 (const real *) n,
123 (const real *) t1,
124 (const real *) t2,
125 *value_n,
126 *value_t1,
127 *value_t2,
128 *m);
129 CUDA_CHECK(cudaGetLastError());
130 }
131
132}
void cuda_constrain_mixed_bc_zero(void *mixed_msk, void *x, void *y, void *z, int *constraint_n, int *constraint_t1, int *constraint_t2, void *n, void *t1, void *t2, int *m, cudaStream_t strm)
void cuda_constrain_mixed_bc_set(void *mixed_msk, void *x, void *y, void *z, int *constraint_n, int *constraint_t1, int *constraint_t2, void *n, void *t1, void *t2, void *values_n, void *values_t1, void *values_t2, int *m, cudaStream_t strm)
void cuda_constrain_mixed_bc_set_const(void *mixed_msk, void *x, void *y, void *z, int *constraint_n, int *constraint_t1, int *constraint_t2, void *n, void *t1, void *t2, real *value_n, real *value_t1, real *value_t2, int *m, cudaStream_t strm)
__global__ void const T *__restrict__ x
#define CUDA_CHECK(err)
Definition check.h:6
__global__ void constrain_mixed_bc_zero_kernel(const int *__restrict__ mixed_msk, T *__restrict__ x, T *__restrict__ y, T *__restrict__ z, const int constraint_n, const int constraint_t1, const int constraint_t2, const T *__restrict__ n, const T *__restrict__ t1, const T *__restrict__ t2, const int m)
__global__ void constrain_mixed_bc_set_kernel(const int *__restrict__ mixed_msk, T *__restrict__ x, T *__restrict__ y, T *__restrict__ z, const int constraint_n, const int constraint_t1, const int constraint_t2, const T *__restrict__ n, const T *__restrict__ t1, const T *__restrict__ t2, const T *__restrict__ values_n, const T *__restrict__ values_t1, const T *__restrict__ values_t2, const int m)
__global__ void constrain_mixed_bc_set_const_kernel(const int *__restrict__ mixed_msk, T *__restrict__ x, T *__restrict__ y, T *__restrict__ z, const int constraint_n, const int constraint_t1, const int constraint_t2, const T *__restrict__ n, const T *__restrict__ t1, const T *__restrict__ t2, const T value_n, const T value_t1, const T value_t2, const int m)
double real