Neko 1.99.9
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
device_gradient_jump_penalty.F90
Go to the documentation of this file.
1! Copyright (c) 2024, 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 num_types, only : c_rp, rp
35 use utils, only : neko_error
36 use device, only : glb_cmd_queue
37 use, intrinsic :: iso_c_binding, only : c_ptr, c_int
38 implicit none
39 private
40
41#ifdef HAVE_HIP
42 interface
43 subroutine hip_pick_facet_value_hex(b_d, a_d, nx, nelv) &
44 bind(c, name = 'hip_pick_facet_value_hex')
45 use, intrinsic :: iso_c_binding
46 import c_rp
47 implicit none
48 type(c_ptr), value :: a_d, b_d
49 integer(c_int) :: nx, nelv
50 end subroutine hip_pick_facet_value_hex
51 end interface
52 interface
53 subroutine hip_gradient_jump_penalty_finalize(penalty_d, &
54 penalty_facet_d, &
55 dphidxi_d, &
56 nx, nelv) &
57 bind(c, name = 'hip_gradient_jump_penalty_finalize')
58 use, intrinsic :: iso_c_binding
59 import c_rp
60 implicit none
61 type(c_ptr), value :: penalty_d, &
62 penalty_facet_d, dphidxi_d
63 integer(c_int) :: nx, nelv
65 end interface
66#elif HAVE_CUDA
67 interface
68 subroutine cuda_pick_facet_value_hex(b_d, a_d, nx, nelv) &
69 bind(c, name = 'cuda_pick_facet_value_hex')
70 use, intrinsic :: iso_c_binding
71 import c_rp
72 implicit none
73 type(c_ptr), value :: a_d, b_d
74 integer(c_int) :: nx, nelv
75 end subroutine cuda_pick_facet_value_hex
76 end interface
77 interface
78 subroutine cuda_gradient_jump_penalty_finalize(penalty_d, &
79 penalty_facet_d, &
80 dphidxi_d, &
81 nx, nelv) &
82 bind(c, name = 'cuda_gradient_jump_penalty_finalize')
83 use, intrinsic :: iso_c_binding
84 import c_rp
85 implicit none
86 type(c_ptr), value :: penalty_d, &
87 penalty_facet_d, dphidxi_d
88 integer(c_int) :: nx, nelv
90 end interface
91#elif HAVE_OPENCL
92 interface
93 subroutine opencl_pick_facet_value_hex(b_d, a_d, nx, nelv) &
94 bind(c, name = 'opencl_pick_facet_value_hex')
95 use, intrinsic :: iso_c_binding
96 import c_rp
97 implicit none
98 type(c_ptr), value :: a_d, b_d
99 integer(c_int) :: nx, nelv
100 end subroutine opencl_pick_facet_value_hex
101 end interface
102 interface
103 subroutine opencl_gradient_jump_penalty_finalize(penalty_d, &
104 penalty_facet_d, &
105 dphidxi_d, &
106 nx, nelv) &
107 bind(c, name = 'opencl_gradient_jump_penalty_finalize')
108 use, intrinsic :: iso_c_binding
109 import c_rp
110 implicit none
111 type(c_ptr), value :: penalty_d, &
112 penalty_facet_d, dphidxi_d
113 integer(c_int) :: nx, nelv
115 end interface
116#elif HAVE_METAL
117 interface
118 subroutine metal_pick_facet_value_hex(b_d, a_d, nx, nelv) &
119 bind(c, name = 'metal_pick_facet_value_hex')
120 use, intrinsic :: iso_c_binding
121 import c_rp
122 implicit none
123 type(c_ptr), value :: a_d, b_d
124 integer(c_int) :: nx, nelv
125 end subroutine metal_pick_facet_value_hex
126 end interface
127 interface
128 subroutine metal_gradient_jump_penalty_finalize(penalty_d, &
129 penalty_facet_d, &
130 dphidxi_d, &
131 nx, nelv) &
132 bind(c, name = 'metal_gradient_jump_penalty_finalize')
133 use, intrinsic :: iso_c_binding
134 import c_rp
135 implicit none
136 type(c_ptr), value :: penalty_d, &
137 penalty_facet_d, dphidxi_d
138 integer(c_int) :: nx, nelv
139 end subroutine metal_gradient_jump_penalty_finalize
140 end interface
141#endif
142
143 public :: device_pick_facet_value_hex, &
145
146contains
147
148 subroutine device_pick_facet_value_hex(b_d, a_d, nx, nelv)
149 integer, intent(in) :: nx, nelv
150 type(c_ptr) :: a_d, b_d
151#ifdef HAVE_HIP
152 call hip_pick_facet_value_hex(b_d, a_d, nx, nelv)
153#elif HAVE_CUDA
154 call cuda_pick_facet_value_hex(b_d, a_d, nx, nelv)
155#elif HAVE_OPENCL
156 call opencl_pick_facet_value_hex(b_d, a_d, nx, nelv)
157#elif HAVE_METAL
158 call metal_pick_facet_value_hex(b_d, a_d, nx, nelv)
159#else
160 call neko_error('No device backend configured')
161#endif
162
163 end subroutine device_pick_facet_value_hex
164
166 penalty_facet_d, &
167 dphidxi_d, &
168 nx, nelv)
169 integer, intent(in) :: nx, nelv
170 type(c_ptr) :: penalty_d, penalty_facet_d, dphidxi_d
171#ifdef HAVE_HIP
172 call hip_gradient_jump_penalty_finalize(penalty_d, &
173 penalty_facet_d, &
174 dphidxi_d, &
175 nx, nelv)
176#elif HAVE_CUDA
178 penalty_facet_d, &
179 dphidxi_d, &
180 nx, nelv)
181#elif HAVE_OPENCL
183 penalty_facet_d, &
184 dphidxi_d, &
185 nx, nelv)
186#elif HAVE_METAL
187 call metal_gradient_jump_penalty_finalize(penalty_d, &
188 penalty_facet_d, &
189 dphidxi_d, &
190 nx, nelv)
191#else
192 call neko_error('No device backend configured')
193#endif
194
196
void opencl_gradient_jump_penalty_finalize(void *penalty_d, void *penalty_facet_d, void *dphidxi_d, int *nx, int *nel)
void opencl_pick_facet_value_hex(void *b, void *a, int *nx, int *nel)
void cuda_gradient_jump_penalty_finalize(void *penalty_d, void *penalty_facet_d, void *dphidxi_d, int *nx, int *nel)
void cuda_pick_facet_value_hex(void *b, void *a, int *nx, int *nel)
subroutine, public device_gradient_jump_penalty_finalize(penalty_d, penalty_facet_d, dphidxi_d, nx, nelv)
subroutine, public device_pick_facet_value_hex(b_d, a_d, nx, nelv)
Device abstraction, common interface for various accelerators.
Definition device.F90:34
type(c_ptr), bind(C), public glb_cmd_queue
Global command queue.
Definition device.F90:52
integer, parameter, public c_rp
Definition num_types.f90:15
integer, parameter, public rp
Global precision used in computations.
Definition num_types.f90:14
Utilities.
Definition utils.f90:35