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