Neko 0.9.99
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
opencl_math.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: rp, c_rp
35 implicit none
36 public
37
38 interface
39 subroutine opencl_copy(a_d, b_d, n) &
40 bind(c, name = 'opencl_copy')
41 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
42 type(c_ptr), value :: a_d, b_d
43 integer(c_int) :: n
44 end subroutine opencl_copy
45
46 subroutine opencl_masked_copy(a_d, b_d, mask_d, n, m) &
47 bind(c, name = 'opencl_masked_copy')
48 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
49 type(c_ptr), value :: a_d, b_d, mask_d
50 integer(c_int) :: n, m
51 end subroutine opencl_masked_copy
52
53 subroutine opencl_cfill_mask(a_d, c, size, mask_d, mask_size) &
54 bind(c, name = 'opencl_cfill_mask')
55 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
56 import c_rp
57 type(c_ptr), value :: a_d
58 real(c_rp) :: c
59 integer(c_int) :: size
60 type(c_ptr), value :: mask_d
61 integer(c_int) :: mask_size
62 end subroutine opencl_cfill_mask
63
64 subroutine opencl_cmult(a_d, c, n) &
65 bind(c, name = 'opencl_cmult')
66 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
67 import c_rp
68 type(c_ptr), value :: a_d
69 real(c_rp) :: c
70 integer(c_int) :: n
71 end subroutine opencl_cmult
72
73 subroutine opencl_cmult2(a_d, b_d, c, n) &
74 bind(c, name = 'opencl_cmult2')
75 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
76 import c_rp
77 type(c_ptr), value :: a_d, b_d
78 real(c_rp) :: c
79 integer(c_int) :: n
80 end subroutine opencl_cmult2
81
82 subroutine opencl_cadd(a_d, c, n) &
83 bind(c, name = 'opencl_cadd')
84 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
85 import c_rp
86 type(c_ptr), value :: a_d
87 real(c_rp) :: c
88 integer(c_int) :: n
89 end subroutine opencl_cadd
90
91 subroutine opencl_cadd2(a_d, b_d, c, n) &
92 bind(c, name = 'opencl_cadd2')
93 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
94 import c_rp
95 type(c_ptr), value :: a_d
96 type(c_ptr), value :: b_d
97 real(c_rp) :: c
98 integer(c_int) :: n
99 end subroutine opencl_cadd2
100
101 subroutine opencl_cfill(a_d, c, n) &
102 bind(c, name = 'opencl_cfill')
103 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
104 import c_rp
105 type(c_ptr), value :: a_d
106 real(c_rp) :: c
107 integer(c_int) :: n
108 end subroutine opencl_cfill
109
110 subroutine opencl_rzero(a_d, n) &
111 bind(c, name = 'opencl_rzero')
112 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
113 type(c_ptr), value :: a_d
114 integer(c_int) :: n
115 end subroutine opencl_rzero
116
117 subroutine opencl_rone(a_d, n) &
118 bind(c, name = 'opencl_rone')
119 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
120 type(c_ptr), value :: a_d
121 integer(c_int) :: n
122 end subroutine opencl_rone
123
124 subroutine opencl_add2(a_d, b_d, n) &
125 bind(c, name = 'opencl_add2')
126 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
127 implicit none
128 type(c_ptr), value :: a_d, b_d
129 integer(c_int) :: n
130 end subroutine opencl_add2
131
132 subroutine opencl_add4(a_d, b_d, c_d, d_d, n) &
133 bind(c, name = 'opencl_add4')
134 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
135 implicit none
136 type(c_ptr), value :: a_d, b_d, c_d, d_d
137 integer(c_int) :: n
138 end subroutine opencl_add4
139
140 subroutine opencl_add2s1(a_d, b_d, c1, n) &
141 bind(c, name = 'opencl_add2s1')
142 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
143 import c_rp
144 implicit none
145 type(c_ptr), value :: a_d, b_d
146 real(c_rp) :: c1
147 integer(c_int) :: n
148 end subroutine opencl_add2s1
149
150 subroutine opencl_add2s2(a_d, b_d, c1, n) &
151 bind(c, name = 'opencl_add2s2')
152 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
153 import c_rp
154 implicit none
155 type(c_ptr), value :: a_d, b_d
156 real(c_rp) :: c1
157 integer(c_int) :: n
158 end subroutine opencl_add2s2
159
160 subroutine opencl_add2s2_many(y_d, x_d_d, a_d, j, n) &
161 bind(c, name = 'opencl_add2s2_many')
162 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
163 import c_rp
164 implicit none
165 type(c_ptr), value :: y_d, x_d_d, a_d
166 integer(c_int) :: j, n
167 end subroutine opencl_add2s2_many
168
169 subroutine opencl_addsqr2s2(a_d, b_d, c1, n) &
170 bind(c, name = 'opencl_addsqr2s2')
171 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
172 import c_rp
173 implicit none
174 type(c_ptr), value :: a_d, b_d
175 real(c_rp) :: c1
176 integer(c_int) :: n
177 end subroutine opencl_addsqr2s2
178
179 subroutine opencl_add3s2(a_d, b_d, c_d, c1, c2, n) &
180 bind(c, name = 'opencl_add3s2')
181 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
182 import c_rp
183 implicit none
184 type(c_ptr), value :: a_d, b_d, c_d
185 real(c_rp) :: c1, c2
186 integer(c_int) :: n
187 end subroutine opencl_add3s2
188
189 subroutine opencl_invcol1(a_d, n) &
190 bind(c, name = 'opencl_invcol1')
191 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
192 implicit none
193 type(c_ptr), value :: a_d
194 integer(c_int) :: n
195 end subroutine opencl_invcol1
196
197 subroutine opencl_invcol2(a_d, b_d, n) &
198 bind(c, name = 'opencl_invcol2')
199 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
200 implicit none
201 type(c_ptr), value :: a_d, b_d
202 integer(c_int) :: n
203 end subroutine opencl_invcol2
204
205 subroutine opencl_col2(a_d, b_d, n) &
206 bind(c, name = 'opencl_col2')
207 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
208 implicit none
209 type(c_ptr), value :: a_d, b_d
210 integer(c_int) :: n
211 end subroutine opencl_col2
212
213 subroutine opencl_col3(a_d, b_d, c_d, n) &
214 bind(c, name = 'opencl_col3')
215 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
216 implicit none
217 type(c_ptr), value :: a_d, b_d, c_d
218 integer(c_int) :: n
219 end subroutine opencl_col3
220
221 subroutine opencl_subcol3(a_d, b_d, c_d, n) &
222 bind(c, name = 'opencl_subcol3')
223 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
224 implicit none
225 type(c_ptr), value :: a_d, b_d, c_d
226 integer(c_int) :: n
227 end subroutine opencl_subcol3
228
229 subroutine opencl_sub2(a_d, b_d, n) &
230 bind(c, name = 'opencl_sub2')
231 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
232 implicit none
233 type(c_ptr), value :: a_d, b_d
234 integer(c_int) :: n
235 end subroutine opencl_sub2
236
237 subroutine opencl_sub3(a_d, b_d, c_d, n) &
238 bind(c, name = 'opencl_sub3')
239 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
240 implicit none
241 type(c_ptr), value :: a_d, b_d, c_d
242 integer(c_int) :: n
243 end subroutine opencl_sub3
244
245 subroutine opencl_add3(a_d, b_d, c_d, n) &
246 bind(c, name = 'opencl_add3')
247 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
248 implicit none
249 type(c_ptr), value :: a_d, b_d, c_d
250 integer(c_int) :: n
251 end subroutine opencl_add3
252
253 subroutine opencl_addcol3(a_d, b_d, c_d, n) &
254 bind(c, name = 'opencl_addcol3')
255 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
256 implicit none
257 type(c_ptr), value :: a_d, b_d, c_d
258 integer(c_int) :: n
259 end subroutine opencl_addcol3
260
261 subroutine opencl_addcol4(a_d, b_d, c_d, d_d, n) &
262 bind(c, name = 'opencl_addcol4')
263 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
264 implicit none
265 type(c_ptr), value :: a_d, b_d, c_d, d_d
266 integer(c_int) :: n
267 end subroutine opencl_addcol4
268
269 subroutine opencl_vdot3(dot_d, u1_d, u2_d, u3_d, v1_d, v2_d, v3_d, n) &
270 bind(c, name = 'opencl_vdot3')
271 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
272 implicit none
273 type(c_ptr), value :: dot_d, u1_d, u2_d, u3_d, v1_d, v2_d, v3_d
274 integer(c_int) :: n
275 end subroutine opencl_vdot3
276
277 real(c_rp) function opencl_glsc3(a_d, b_d, c_d, n) &
278 bind(c, name = 'opencl_glsc3')
279 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
280 import c_rp
281 implicit none
282 type(c_ptr), value :: a_d, b_d, c_d
283 integer(c_int) :: n
284 end function opencl_glsc3
285
286 subroutine opencl_glsc3_many(h, w_d, v_d_d, mult_d, j, n) &
287 bind(c, name = 'opencl_glsc3_many')
288 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
289 import c_rp
290 implicit none
291 integer(c_int) :: j, n
292 type(c_ptr), value :: w_d, v_d_d, mult_d
293 real(c_rp) :: h(j)
294 end subroutine opencl_glsc3_many
295
296 real(c_rp) function opencl_glsc2(a_d, b_d, n) &
297 bind(c, name = 'opencl_glsc2')
298 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
299 import c_rp
300 implicit none
301 type(c_ptr), value :: a_d, b_d
302 integer(c_int) :: n
303 end function opencl_glsc2
304
305 real(c_rp) function opencl_glsum(a_d, n) &
306 bind(c, name = 'opencl_glsum')
307 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
308 import c_rp
309 implicit none
310 type(c_ptr), value :: a_d
311 integer(c_int) :: n
312 end function opencl_glsum
313 end interface
314
315end module opencl_math
integer, parameter, public c_rp
Definition num_types.f90:13
integer, parameter, public rp
Global precision used in computations.
Definition num_types.f90:12