Neko-TOP
A portable framework for high-order spectral element flow toplogy optimization.
Loading...
Searching...
No Matches
cuda_mma_math.f90
Go to the documentation of this file.
1
34!
35module cuda_mma_math
36 use num_types, only: rp, c_rp
37 use, intrinsic :: iso_c_binding, only: c_int, c_ptr
38
39 implicit none
40 public
41
42 interface
43 subroutine mma_update_hessian_z_cuda(Hess_d, a_d, m) &
44 bind(C, name="mma_update_hessian_z_cuda")
45 use iso_c_binding
46 type(c_ptr), value :: Hess_d
47 type(c_ptr), value :: a_d
48 integer(c_int) :: m
49 end subroutine mma_update_hessian_z_cuda
50
51
52 subroutine mma_prepare_aa_matrix_cuda(AA, s, lambda, d, mu, y, a, zeta, &
53 z, m) bind(c, name="mma_prepare_aa_matrix_cuda")
54 import c_rp, c_ptr, c_int
55 type(c_ptr), value :: AA, s, lambda, d, mu, y, a
56 real(c_rp) :: zeta, z
57 integer(c_int) :: m
58 end subroutine mma_prepare_aa_matrix_cuda
59
60 subroutine mma_prepare_hessian_cuda(Hess, y, mu, lambda, m) &
61 bind(c, name="mma_prepare_hessian_cuda")
62 import c_ptr, c_int
63 type(c_ptr), value :: Hess, y, mu, lambda
64 integer(c_int) :: m
65 end subroutine mma_prepare_hessian_cuda
66
67 subroutine cuda_custom_solver(A_d, b_d, n, info) &
68 bind(c, name = 'cuda_custom_solver')
69 import c_int, c_ptr
70 type(c_ptr), value :: A_d, b_d
71 integer(c_int), value :: n
72 integer(c_int) :: info
73 end subroutine cuda_custom_solver
74
75 subroutine cusolver_wrapper(A_d, b_d, n, info) &
76 bind(c, name = 'cuSOLVER_wrapper')
77 import c_int, c_ptr
78 type(c_ptr), value :: A_d, b_d
79 integer(c_int), value :: n
80 integer(c_int) :: info
81 end subroutine cusolver_wrapper
82
83 subroutine delta_1dbeam_cuda(Delta_d, L_total, Le, offset, n) &
84 bind(c, name = 'delta_1dbeam_cuda')
85 import c_rp, c_int, c_ptr
86 type(c_ptr), value :: Delta_d
87 real(c_rp) :: L_total, Le
88 integer(c_int) :: offset, n
89 end subroutine delta_1dbeam_cuda
90
91 subroutine cuda_hess(Hess_d, hijx_d, Ljjxinv_d, n, m) bind(c, name = 'cuda_Hess')
92 import c_int, c_ptr
93 type(c_ptr), value :: Hess_d, hijx_d, Ljjxinv_d
94 integer(c_int) :: n, m
95 end subroutine cuda_hess
96
97 subroutine mma_ljjxinv_cuda(Ljjxinv_d,pjlambda_d, qjlambda_d, x_d, &
98 low_d, upp_d, alpha_d, beta_d, n) bind(c, name = 'mma_Ljjxinv_cuda')
99 import c_int, c_ptr
100 type(c_ptr), value :: Ljjxinv_d, x_d, pjlambda_d, qjlambda_d, low_d, &
101 upp_d, alpha_d, beta_d
102 integer(c_int) :: n
103 end subroutine mma_ljjxinv_cuda
104
105 subroutine mma_dipsolvesub1_cuda(x_d, pjlambda_d, qjlambda_d, low_d, &
106 upp_d, alpha_d, beta_d, n) bind(c, name = 'mma_dipsolvesub1_cuda')
107 import c_int, c_ptr
108 type(c_ptr), value :: x_d, pjlambda_d, qjlambda_d, low_d, &
109 upp_d, alpha_d, beta_d
110 integer(c_int) :: n
111 end subroutine mma_dipsolvesub1_cuda
112
113 subroutine mattrans_v_mul_cuda(output_d, pij_d, lambda_d, m, n) &
114 bind(c, name = 'mattrans_v_mul_cuda')
115 import c_rp, c_int, c_ptr
116 type(c_ptr), value :: output_d, pij_d, lambda_d
117 integer(c_int) :: m, n
118 end subroutine mattrans_v_mul_cuda
119
120 subroutine mma_gensub1_cuda(low_d, upp_d, x_d, xmin_d, xmax_d, asyinit, n)&
121 bind(c, name = 'mma_gensub1_cuda')
122 import c_rp, c_int, c_ptr
123 type(c_ptr), value :: low_d, upp_d, x_d, xmin_d, xmax_d
124 real(c_rp) :: asyinit
125 integer(c_int) :: n
126 end subroutine mma_gensub1_cuda
127
128 subroutine mma_gensub2_cuda(low_d, upp_d, x_d, xold1_d, xold2_d, xdiff_d, &
129 asydecr, asyincr, n) bind(c, name = 'mma_gensub2_cuda')
130 import c_rp, c_int, c_ptr
131 type(c_ptr), value :: low_d, upp_d, x_d, xold1_d, xold2_d, xdiff_d
132 real(c_rp) :: asydecr, asyincr
133 integer(c_int) :: n
134 end subroutine mma_gensub2_cuda
135
136 subroutine mma_gensub3_cuda(x_d, df0dx_d, dfdx_d, low_d, upp_d, min_d, &
137 max_d, alpha_d, beta_d, p0j_d, q0j_d, pij_d, qij_d, n, m) &
138 bind(c, name = 'mma_gensub3_cuda')
139 import c_int, c_ptr
140 type(c_ptr), value :: x_d, df0dx_d, dfdx_d, low_d, upp_d, min_d, max_d, &
141 alpha_d, beta_d, p0j_d, q0j_d, pij_d, qij_d
142 integer(c_int) :: n, m
143 end subroutine mma_gensub3_cuda
144
146 subroutine mma_gensub3_dip_cuda(x_d, df0dx_d, dfdx_d, low_d, upp_d, &
147 min_d, max_d, alpha_d, beta_d, p0j_d, q0j_d, pij_d, qij_d, n, m) &
148 bind(c, name = 'mma_gensub3_dip_cuda')
149 import c_int, c_ptr
150 type(c_ptr), value :: x_d, df0dx_d, dfdx_d, low_d, upp_d, min_d, max_d, &
151 alpha_d, beta_d, p0j_d, q0j_d, pij_d, qij_d
152 integer(c_int) :: n, m
153 end subroutine mma_gensub3_dip_cuda
154
155 subroutine mma_gensub4_cuda(x_d, low_d, upp_d, pij_d, qij_d, n, m, bi_d) &
156 bind(c, name = 'mma_gensub4_cuda')
157 import c_int, c_ptr
158 type(c_ptr), value :: x_d, low_d, upp_d, pij_d, qij_d, bi_d
159 integer(c_int) :: n, m
160 end subroutine mma_gensub4_cuda
161
162 subroutine cuda_mma_max(xsi_d, x_d, alpha_d, n) &
163 bind(c, name = 'cuda_mma_max')
164 import c_int, c_ptr
165 type(c_ptr), value :: xsi_d, x_d, alpha_d
166 integer(c_int) :: n
167 end subroutine cuda_mma_max
168
169 subroutine cuda_rex(rex_d, x_d, low_d, upp_d, pij_d, p0j_d, qij_d, q0j_d, &
170 lambda_d, xsi_d, eta_d, n, m) bind(c, name = 'cuda_rex')
171 import c_int, c_ptr
172 type(c_ptr), value :: rex_d, x_d, low_d, upp_d, pij_d, p0j_d, qij_d, &
173 q0j_d, lambda_d, xsi_d, eta_d
174 integer(c_int) :: n, m
175 end subroutine cuda_rex
176
177 subroutine cuda_relambda(relambda_d, x_d, upp_d, low_d, pij_d, qij_d, n, &
178 m) bind(c, name = 'cuda_relambda')
179 import c_int, c_ptr
180 type(c_ptr), value :: relambda_d, x_d, upp_d, low_d, pij_d, qij_d
181 integer(c_int) :: n, m
182 end subroutine cuda_relambda
183
184 subroutine cuda_sub2cons2(rexsi_d, xsi_d, x_d, alpha_d, epsi, n) &
185 bind(c, name = 'cuda_sub2cons2')
186 import c_rp, c_int, c_ptr
187 type(c_ptr), value :: rexsi_d, xsi_d, x_d, alpha_d
188 real(c_rp) :: epsi
189 integer(c_int) :: n
190 end subroutine cuda_sub2cons2
191
192 real(c_rp) function cuda_maxval(rex_d, n) bind(c, name = 'cuda_maxval')
193 import c_rp, c_int, c_ptr
194 type(c_ptr), value :: rex_d
195 integer(c_int) :: n
196 end function cuda_maxval
197
198 real(c_rp) function cuda_norm(rex_d, n) bind(c, name = 'cuda_norm')
199 import c_rp, c_int, c_ptr
200 type(c_ptr), value :: rex_d
201 integer(c_int) :: n
202 end function cuda_norm
203
204 subroutine cuda_delx(delx_d, x_d, low_d, upp_d, pij_d, qij_d, p0j_d, &
205 q0j_d, alpha_d, beta_d, lambda_d, epsi, n, m) &
206 bind(c, name = 'cuda_delx')
207 import c_rp, c_int, c_ptr
208 type(c_ptr), value :: delx_d, x_d, low_d, upp_d, pij_d, qij_d, p0j_d, &
209 q0j_d, alpha_d, beta_d, lambda_d
210 real(c_rp) :: epsi
211 integer(c_int) :: n, m
212 end subroutine cuda_delx
213
214
215
216 subroutine cuda_gg(GG_d, x_d, low_d, upp_d, pij_d, qij_d, n, m) &
217 bind(c, name = 'cuda_GG')
218 import c_int, c_ptr
219 type(c_ptr), value :: GG_d, x_d, low_d, upp_d, pij_d, qij_d
220 integer(c_int) :: n, m
221 end subroutine cuda_gg
222
223 subroutine cuda_diagx(diagx_d, x_d, xsi_d, low_d, upp_d, p0j_d, q0j_d, &
224 pij_d, qij_d, alpha_d, beta_d, eta_d, lambda_d, n, m) &
225 bind(c, name = 'cuda_diagx')
226 import c_int, c_ptr
227 type(c_ptr), value :: diagx_d, x_d, xsi_d, low_d, upp_d, p0j_d, q0j_d, &
228 pij_d, qij_d, alpha_d, beta_d, eta_d, lambda_d
229 integer(c_int) :: n, m
230 end subroutine cuda_diagx
231
232 subroutine cuda_bb(bb_d, GG_d, delx_d, diagx_d, n, m) &
233 bind(c, name = 'cuda_bb')
234 import c_int, c_ptr
235 type(c_ptr), value :: bb_d, GG_d, delx_d, diagx_d
236 integer(c_int) :: n, m
237 end subroutine cuda_bb
238
239 subroutine cuda_aa(AA_d, GG_d, diagx_d, n, m) bind(c, name = 'cuda_AA')
240 import c_int, c_ptr
241 type(c_ptr), value :: AA_d, GG_d, diagx_d
242 integer(c_int) :: n, m
243 end subroutine cuda_aa
244
245 subroutine cuda_dx(dx_d, delx_d, diagx_d, GG_d, dlambda_d, n, m) &
246 bind(c, name = 'cuda_dx')
247 import c_int, c_ptr
248 type(c_ptr), value :: dx_d, delx_d, diagx_d, GG_d, dlambda_d
249 integer(c_int) :: n, m
250 end subroutine cuda_dx
251
252 subroutine cuda_dxsi(dxsi_d, xsi_d, dx_d, x_d, alpha_d, epsi, n) &
253 bind(c, name = 'cuda_dxsi')
254 import c_rp, c_int, c_ptr
255 type(c_ptr), value :: dxsi_d, xsi_d, dx_d, x_d, alpha_d
256 real(c_rp) :: epsi
257 integer(c_int) :: n
258 end subroutine cuda_dxsi
259
260 subroutine cuda_deta(deta_d, eta_d, dx_d, x_d, beta_d, epsi, n) &
261 bind(c, name = 'cuda_deta')
262 import c_rp, c_int, c_ptr
263 type(c_ptr), value :: deta_d, eta_d, dx_d, x_d, beta_d
264 real(c_rp) :: epsi
265 integer(c_int) :: n
266 end subroutine cuda_deta
267
268 real(c_rp) function cuda_maxval2(dxx_d, xx_d, cons, n) &
269 bind(c, name = 'cuda_maxval2')
270 import c_rp, c_int, c_ptr
271 type(c_ptr), value :: dxx_d, xx_d
272 real(c_rp) :: cons
273 integer(c_int) :: n
274 end function cuda_maxval2
275
276 real(c_rp) function cuda_maxval3(dx_d, x_d, alpha_d, cons, n) &
277 bind(c, name = 'cuda_maxval3')
278 import c_rp, c_int, c_ptr
279 type(c_ptr), value :: dx_d, x_d, alpha_d
280 real(c_rp) :: cons
281 integer(c_int) :: n
282 end function cuda_maxval3
283
284 subroutine cuda_kkt_rex(rex_d, df0dx_d, dfdx_d, xsi_d, eta_d, lambda_d, &
285 n, m) bind(c, name = 'cuda_kkt_rex')
286 import c_int, c_ptr
287 type(c_ptr), value :: rex_d, df0dx_d, dfdx_d, xsi_d, eta_d, lambda_d
288 integer(c_int) :: n, m
289 end subroutine cuda_kkt_rex
290
292 subroutine mma_dip_kkt_cuda(res_d, x_d, df0dx_d, dfdx_d, xmin_d, xmax_d, &
293 lambda_d, n, m) bind(c, name = 'mma_dip_kkt_cuda')
294 import c_int, c_ptr
295 type(c_ptr), value :: res_d, x_d, df0dx_d, dfdx_d, xmin_d, xmax_d, &
296 lambda_d
297 integer(c_int) :: n, m
298 end subroutine mma_dip_kkt_cuda
299
300
301 subroutine cuda_maxcons(a_d, b, c, d_d, n) bind(c, name = 'cuda_maxcons')
302 import c_rp, c_int, c_ptr
303 type(c_ptr), value :: a_d, d_d
304 real(c_rp) :: b, c
305 integer(c_int) :: n
306 end subroutine cuda_maxcons
307
308
309 real(c_rp) function cuda_lcsc2(a_d, b_d, n) bind(c, name = 'cuda_lcsc2')
310 import c_rp, c_int, c_ptr
311 type(c_ptr), value :: a_d, b_d
312 integer(c_int) :: n
313 end function cuda_lcsc2
314
315 subroutine cuda_mpisum(a_d, n) bind(c, name = 'cuda_mpisum')
316 import c_int, c_ptr
317 type(c_ptr), value :: a_d
318 integer(c_int) :: n
319 end subroutine cuda_mpisum
320
321 subroutine cuda_add2inv2(a_d, b_d, c, n) bind(c, name = 'cuda_add2inv2')
322 import c_rp, c_int, c_ptr
323 type(c_ptr), value :: a_d, b_d
324 integer(c_int) :: n
325 real(c_rp) :: c
326 end subroutine cuda_add2inv2
327
328 subroutine cuda_max2(a_d, b, c_d, d, n) bind(c, name = 'cuda_max2')
329 import c_rp, c_int, c_ptr
330 type(c_ptr), value :: a_d, c_d
331 integer(c_int) :: n
332 real(c_rp) :: b, d
333 end subroutine cuda_max2
334
335 subroutine cuda_updatebb(bb_d, dellambda_d, dely_d, d_d, mu_d, y_d, delz, &
336 m) bind(c, name = 'cuda_updatebb')
337 import c_rp, c_int, c_ptr
338 type(c_ptr), value :: bb_d, dellambda_d, dely_d, d_d, mu_d, y_d
339 integer(c_int) :: m
340 real(c_rp) :: delz
341 end subroutine cuda_updatebb
342
343 subroutine cuda_updateaa(AA_d, globaltmp_mm_d, s_d, lambda_d, d_d, mu_d, &
344 y_d, a_d, zeta, z, m) bind(c, name = 'cuda_updateAA')
345 import c_rp, c_int, c_ptr
346 type(c_ptr), value :: AA_d, globaltmp_mm_d, s_d, lambda_d, d_d, mu_d, &
347 y_d, a_d
348 integer(c_int) :: m
349 real(c_rp) :: zeta, z
350 end subroutine cuda_updateaa
351
352 subroutine cuda_dy(dy_d, dely_d, dlambda_d, d_d, mu_d, y_d, n) &
353 bind(c, name = 'cuda_dy')
354 import c_int, c_ptr
355 type(c_ptr), value :: dy_d, dely_d, dlambda_d, d_d, mu_d, y_d
356 integer(c_int) :: n
357 end subroutine cuda_dy
358
359 end interface
360
361end module cuda_mma_math
Binding of mma_dip_kkt_cuda, see device_mma_dip_kkt.
Binding of mma_gensub3_dip_cuda, see device_mma_gensub3_dip.