Neko 1.99.9
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
device_coupled_vector_bc_projector.F90
Go to the documentation of this file.
1! Copyright (c) 2026, The Neko Authors
2! All rights reserved.
3!
4! Redistribution and use in source and binary forms, with or without
5! modification, are permitted provided that the following conditions
6! are met:
7!
8! * Redistributions of source code must retain the above copyright
9! notice, this list of conditions and the following disclaimer.
10!
11! * Redistributions in binary form must reproduce the above
12! copyright notice, this list of conditions and the following
13! disclaimer in the documentation and/or other materials provided
14! with the distribution.
15!
16! * Neither the name of the authors nor the names of its
17! contributors may be used to endorse or promote products derived
18! from this software without specific prior written permission.
19!
20! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21! "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22! LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23! FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24! COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25! INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26! BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27! LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28! CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29! LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30! ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31! POSSIBILITY OF SUCH DAMAGE.
32!
34 use utils, only : neko_error
35 use, intrinsic :: iso_c_binding, only : c_ptr, c_int
36 implicit none
37 private
38
39#ifdef HAVE_HIP
40 interface
41 subroutine hip_coupled_vector_bc_projector_apply(mixed_msk, x, y, z, &
42 constraint_n, constraint_t1, constraint_t2, n, t1, t2, m, strm) &
43 bind(c, name = 'hip_coupled_vector_bc_projector_apply')
44 use, intrinsic :: iso_c_binding, only : c_ptr, c_int
45 implicit none
46 integer(c_int) :: m
47 type(c_ptr), value :: mixed_msk, x, y, z
48 type(c_ptr), value :: constraint_n, constraint_t1, constraint_t2
49 type(c_ptr), value :: n, t1, t2, strm
51 end interface
52#elif HAVE_CUDA
53 interface
54 subroutine cuda_coupled_vector_bc_projector_apply(mixed_msk, x, y, z, &
55 constraint_n, constraint_t1, constraint_t2, n, t1, t2, m, strm) &
56 bind(c, name = 'cuda_coupled_vector_bc_projector_apply')
57 use, intrinsic :: iso_c_binding, only : c_ptr, c_int
58 implicit none
59 integer(c_int) :: m
60 type(c_ptr), value :: mixed_msk, x, y, z
61 type(c_ptr), value :: constraint_n, constraint_t1, constraint_t2
62 type(c_ptr), value :: n, t1, t2, strm
64 end interface
65#elif HAVE_OPENCL
66 interface
67 subroutine opencl_coupled_vector_bc_projector_apply(mixed_msk, x, y, z, &
68 constraint_n, constraint_t1, constraint_t2, n, t1, t2, m, strm) &
69 bind(c, name = 'opencl_coupled_vector_bc_projector_apply')
70 use, intrinsic :: iso_c_binding, only : c_ptr, c_int
71 implicit none
72 integer(c_int) :: m
73 type(c_ptr), value :: mixed_msk, x, y, z
74 type(c_ptr), value :: constraint_n, constraint_t1, constraint_t2
75 type(c_ptr), value :: n, t1, t2, strm
77 end interface
78#elif HAVE_METAL
79 interface
80 subroutine metal_coupled_vector_bc_projector_apply(mixed_msk, x, y, z, &
81 constraint_n, constraint_t1, constraint_t2, n, t1, t2, m, strm) &
82 bind(c, name = 'metal_coupled_vector_bc_projector_apply')
83 use, intrinsic :: iso_c_binding, only : c_ptr, c_int
84 implicit none
85 integer(c_int) :: m
86 type(c_ptr), value :: mixed_msk, x, y, z
87 type(c_ptr), value :: constraint_n, constraint_t1, constraint_t2
88 type(c_ptr), value :: n, t1, t2, strm
89 end subroutine metal_coupled_vector_bc_projector_apply
90 end interface
91#endif
92
94
95contains
96
97 subroutine device_coupled_vector_bc_projector_apply(mixed_msk, x, y, z, &
98 constraint_n, constraint_t1, constraint_t2, n, t1, t2, m, strm)
99 integer, intent(in) :: m
100 type(c_ptr), intent(in) :: mixed_msk, x, y, z
101 type(c_ptr), intent(in) :: constraint_n, constraint_t1, constraint_t2
102 type(c_ptr), intent(in) :: n, t1, t2
103 type(c_ptr), intent(in) :: strm
104
105#ifdef HAVE_HIP
106 call hip_coupled_vector_bc_projector_apply(mixed_msk, x, y, z, &
107 constraint_n, constraint_t1, constraint_t2, n, t1, t2, m, strm)
108#elif HAVE_CUDA
109 call cuda_coupled_vector_bc_projector_apply(mixed_msk, x, y, z, &
110 constraint_n, constraint_t1, constraint_t2, n, t1, t2, m, strm)
111#elif HAVE_OPENCL
112 call opencl_coupled_vector_bc_projector_apply(mixed_msk, x, y, z, &
113 constraint_n, constraint_t1, constraint_t2, n, t1, t2, m, strm)
114#elif HAVE_METAL
115 call metal_coupled_vector_bc_projector_apply(mixed_msk, x, y, z, &
116 constraint_n, constraint_t1, constraint_t2, n, t1, t2, m, strm)
117#else
118 call neko_error('No device backend configured for coupled vector BC apply')
119#endif
120
122
void opencl_coupled_vector_bc_projector_apply(void *mixed_msk, void *x, void *y, void *z, void *constraint_n, void *constraint_t1, void *constraint_t2, void *n, void *t1, void *t2, int *m, cl_command_queue cmd_queue)
void cuda_coupled_vector_bc_projector_apply(void *mixed_msk, void *x, void *y, void *z, void *constraint_n, void *constraint_t1, void *constraint_t2, void *n, void *t1, void *t2, int *m, cudaStream_t strm)
subroutine, public device_coupled_vector_bc_projector_apply(mixed_msk, x, y, z, constraint_n, constraint_t1, constraint_t2, n, t1, t2, m, strm)
Utilities.
Definition utils.f90:35