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
145 subroutine mma_gensub4_cuda(x_d, low_d, upp_d, pij_d, qij_d, n, m, bi_d) &
146 bind(c, name = 'mma_gensub4_cuda')
147 import c_int, c_ptr
148 type(c_ptr), value :: x_d, low_d, upp_d, pij_d, qij_d, bi_d
149 integer(c_int) :: n, m
150 end subroutine mma_gensub4_cuda
151
152 subroutine cuda_mma_max(xsi_d, x_d, alpha_d, n) &
153 bind(c, name = 'cuda_mma_max')
154 import c_int, c_ptr
155 type(c_ptr), value :: xsi_d, x_d, alpha_d
156 integer(c_int) :: n
157 end subroutine cuda_mma_max
158
159 subroutine cuda_rex(rex_d, x_d, low_d, upp_d, pij_d, p0j_d, qij_d, q0j_d, &
160 lambda_d, xsi_d, eta_d, n, m) bind(c, name = 'cuda_rex')
161 import c_int, c_ptr
162 type(c_ptr), value :: rex_d, x_d, low_d, upp_d, pij_d, p0j_d, qij_d, &
163 q0j_d, lambda_d, xsi_d, eta_d
164 integer(c_int) :: n, m
165 end subroutine cuda_rex
166
167 subroutine cuda_relambda(relambda_d, x_d, upp_d, low_d, pij_d, qij_d, n, &
168 m) bind(c, name = 'cuda_relambda')
169 import c_int, c_ptr
170 type(c_ptr), value :: relambda_d, x_d, upp_d, low_d, pij_d, qij_d
171 integer(c_int) :: n, m
172 end subroutine cuda_relambda
173
174 subroutine cuda_sub2cons2(rexsi_d, xsi_d, x_d, alpha_d, epsi, n) &
175 bind(c, name = 'cuda_sub2cons2')
176 import c_rp, c_int, c_ptr
177 type(c_ptr), value :: rexsi_d, xsi_d, x_d, alpha_d
178 real(c_rp) :: epsi
179 integer(c_int) :: n
180 end subroutine cuda_sub2cons2
181
182 real(c_rp) function cuda_maxval(rex_d, n) bind(c, name = 'cuda_maxval')
183 import c_rp, c_int, c_ptr
184 type(c_ptr), value :: rex_d
185 integer(c_int) :: n
186 end function cuda_maxval
187
188 real(c_rp) function cuda_norm(rex_d, n) bind(c, name = 'cuda_norm')
189 import c_rp, c_int, c_ptr
190 type(c_ptr), value :: rex_d
191 integer(c_int) :: n
192 end function cuda_norm
193
194 subroutine cuda_delx(delx_d, x_d, low_d, upp_d, pij_d, qij_d, p0j_d, &
195 q0j_d, alpha_d, beta_d, lambda_d, epsi, n, m) &
196 bind(c, name = 'cuda_delx')
197 import c_rp, c_int, c_ptr
198 type(c_ptr), value :: delx_d, x_d, low_d, upp_d, pij_d, qij_d, p0j_d, &
199 q0j_d, alpha_d, beta_d, lambda_d
200 real(c_rp) :: epsi
201 integer(c_int) :: n, m
202 end subroutine cuda_delx
203
204
205
206 subroutine cuda_gg(GG_d, x_d, low_d, upp_d, pij_d, qij_d, n, m) &
207 bind(c, name = 'cuda_GG')
208 import c_int, c_ptr
209 type(c_ptr), value :: GG_d, x_d, low_d, upp_d, pij_d, qij_d
210 integer(c_int) :: n, m
211 end subroutine cuda_gg
212
213 subroutine cuda_diagx(diagx_d, x_d, xsi_d, low_d, upp_d, p0j_d, q0j_d, &
214 pij_d, qij_d, alpha_d, beta_d, eta_d, lambda_d, n, m) &
215 bind(c, name = 'cuda_diagx')
216 import c_int, c_ptr
217 type(c_ptr), value :: diagx_d, x_d, xsi_d, low_d, upp_d, p0j_d, q0j_d, &
218 pij_d, qij_d, alpha_d, beta_d, eta_d, lambda_d
219 integer(c_int) :: n, m
220 end subroutine cuda_diagx
221
222 subroutine cuda_bb(bb_d, GG_d, delx_d, diagx_d, n, m) &
223 bind(c, name = 'cuda_bb')
224 import c_int, c_ptr
225 type(c_ptr), value :: bb_d, GG_d, delx_d, diagx_d
226 integer(c_int) :: n, m
227 end subroutine cuda_bb
228
229 subroutine cuda_aa(AA_d, GG_d, diagx_d, n, m) bind(c, name = 'cuda_AA')
230 import c_int, c_ptr
231 type(c_ptr), value :: AA_d, GG_d, diagx_d
232 integer(c_int) :: n, m
233 end subroutine cuda_aa
234
235 subroutine cuda_dx(dx_d, delx_d, diagx_d, GG_d, dlambda_d, n, m) &
236 bind(c, name = 'cuda_dx')
237 import c_int, c_ptr
238 type(c_ptr), value :: dx_d, delx_d, diagx_d, GG_d, dlambda_d
239 integer(c_int) :: n, m
240 end subroutine cuda_dx
241
242 subroutine cuda_dxsi(dxsi_d, xsi_d, dx_d, x_d, alpha_d, epsi, n) &
243 bind(c, name = 'cuda_dxsi')
244 import c_rp, c_int, c_ptr
245 type(c_ptr), value :: dxsi_d, xsi_d, dx_d, x_d, alpha_d
246 real(c_rp) :: epsi
247 integer(c_int) :: n
248 end subroutine cuda_dxsi
249
250 subroutine cuda_deta(deta_d, eta_d, dx_d, x_d, beta_d, epsi, n) &
251 bind(c, name = 'cuda_deta')
252 import c_rp, c_int, c_ptr
253 type(c_ptr), value :: deta_d, eta_d, dx_d, x_d, beta_d
254 real(c_rp) :: epsi
255 integer(c_int) :: n
256 end subroutine cuda_deta
257
258 real(c_rp) function cuda_maxval2(dxx_d, xx_d, cons, n) &
259 bind(c, name = 'cuda_maxval2')
260 import c_rp, c_int, c_ptr
261 type(c_ptr), value :: dxx_d, xx_d
262 real(c_rp) :: cons
263 integer(c_int) :: n
264 end function cuda_maxval2
265
266 real(c_rp) function cuda_maxval3(dx_d, x_d, alpha_d, cons, n) &
267 bind(c, name = 'cuda_maxval3')
268 import c_rp, c_int, c_ptr
269 type(c_ptr), value :: dx_d, x_d, alpha_d
270 real(c_rp) :: cons
271 integer(c_int) :: n
272 end function cuda_maxval3
273
274 subroutine cuda_kkt_rex(rex_d, df0dx_d, dfdx_d, xsi_d, eta_d, lambda_d, &
275 n, m) bind(c, name = 'cuda_kkt_rex')
276 import c_int, c_ptr
277 type(c_ptr), value :: rex_d, df0dx_d, dfdx_d, xsi_d, eta_d, lambda_d
278 integer(c_int) :: n, m
279 end subroutine cuda_kkt_rex
280
281
282 subroutine cuda_maxcons(a_d, b, c, d_d, n) bind(c, name = 'cuda_maxcons')
283 import c_rp, c_int, c_ptr
284 type(c_ptr), value :: a_d, d_d
285 real(c_rp) :: b, c
286 integer(c_int) :: n
287 end subroutine cuda_maxcons
288
289
290 real(c_rp) function cuda_lcsc2(a_d, b_d, n) bind(c, name = 'cuda_lcsc2')
291 import c_rp, c_int, c_ptr
292 type(c_ptr), value :: a_d, b_d
293 integer(c_int) :: n
294 end function cuda_lcsc2
295
296 subroutine cuda_mpisum(a_d, n) bind(c, name = 'cuda_mpisum')
297 import c_int, c_ptr
298 type(c_ptr), value :: a_d
299 integer(c_int) :: n
300 end subroutine cuda_mpisum
301
302 subroutine cuda_add2inv2(a_d, b_d, c, n) bind(c, name = 'cuda_add2inv2')
303 import c_rp, c_int, c_ptr
304 type(c_ptr), value :: a_d, b_d
305 integer(c_int) :: n
306 real(c_rp) :: c
307 end subroutine cuda_add2inv2
308
309 subroutine cuda_max2(a_d, b, c_d, d, n) bind(c, name = 'cuda_max2')
310 import c_rp, c_int, c_ptr
311 type(c_ptr), value :: a_d, c_d
312 integer(c_int) :: n
313 real(c_rp) :: b, d
314 end subroutine cuda_max2
315
316 subroutine cuda_updatebb(bb_d, dellambda_d, dely_d, d_d, mu_d, y_d, delz, &
317 m) bind(c, name = 'cuda_updatebb')
318 import c_rp, c_int, c_ptr
319 type(c_ptr), value :: bb_d, dellambda_d, dely_d, d_d, mu_d, y_d
320 integer(c_int) :: m
321 real(c_rp) :: delz
322 end subroutine cuda_updatebb
323
324 subroutine cuda_updateaa(AA_d, globaltmp_mm_d, s_d, lambda_d, d_d, mu_d, &
325 y_d, a_d, zeta, z, m) bind(c, name = 'cuda_updateAA')
326 import c_rp, c_int, c_ptr
327 type(c_ptr), value :: AA_d, globaltmp_mm_d, s_d, lambda_d, d_d, mu_d, &
328 y_d, a_d
329 integer(c_int) :: m
330 real(c_rp) :: zeta, z
331 end subroutine cuda_updateaa
332
333 subroutine cuda_dy(dy_d, dely_d, dlambda_d, d_d, mu_d, y_d, n) &
334 bind(c, name = 'cuda_dy')
335 import c_int, c_ptr
336 type(c_ptr), value :: dy_d, dely_d, dlambda_d, d_d, mu_d, y_d
337 integer(c_int) :: n
338 end subroutine cuda_dy
339
340 end interface
341
342end module cuda_mma_math