Neko-TOP
A portable framework for high-order spectral element flow toplogy optimization.
Loading...
Searching...
No Matches
device_heaviside_mapping.f90
Go to the documentation of this file.
1
34!
35module device_heaviside_mapping
36 use utils, only: neko_error
37 use num_types, only: rp, c_rp
38 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
39 implicit none
40 private
41
42 public :: device_heaviside_mapping_apply, &
43 device_heaviside_mapping_apply_backward
44
45#if HAVE_HIP
46 interface
47
48 subroutine hip_heaviside_mapping_apply(beta, eta, X_out_d, &
49 X_in_d, n) bind(c, name = 'hip_heaviside_mapping_apply')
50 import c_rp, c_ptr, c_int
51 real(c_rp) :: beta
52 real(c_rp) :: eta
53 type(c_ptr), value :: X_out_d
54 type(c_ptr), value :: X_in_d
55 integer(c_int) :: n
56 end subroutine hip_heaviside_mapping_apply
57 end interface
58
59 interface
60
61 subroutine hip_heaviside_mapping_apply_backward(beta, eta, &
62 sens_out_d, sens_in_d, X_in_d, n) &
63 bind(c, name = 'hip_heaviside_mapping_apply_backward')
64 import c_rp, c_ptr, c_int
65 real(c_rp) :: beta
66 real(c_rp) :: eta
67 type(c_ptr), value :: sens_out_d
68 type(c_ptr), value :: sens_in_d
69 type(c_ptr), value :: X_in_d
70 integer(c_int) :: n
72 end interface
73#elif HAVE_CUDA
74 interface
75
76 subroutine cuda_heaviside_mapping_apply(beta, eta, X_out_d, &
77 X_in_d, n) bind(c, name = 'cuda_heaviside_mapping_apply')
78 import c_rp, c_ptr, c_int
79 real(c_rp) :: beta
80 real(c_rp) :: eta
81 type(c_ptr), value :: X_out_d
82 type(c_ptr), value :: X_in_d
83 integer(c_int) :: n
84 end subroutine cuda_heaviside_mapping_apply
85 end interface
86
87 interface
88
89 subroutine cuda_heaviside_mapping_apply_backward(beta, eta, &
90 sens_out_d, sens_in_d, X_in_d, n) &
91 bind(c, name = 'cuda_heaviside_mapping_apply_backward')
92 import c_rp, c_ptr, c_int
93 real(c_rp) :: beta
94 real(c_rp) :: eta
95 type(c_ptr), value :: sens_out_d
96 type(c_ptr), value :: sens_in_d
97 type(c_ptr), value :: X_in_d
98 integer(c_int) :: n
100 end interface
101#elif HAVE_OPENCL
102#endif
103
104contains
105
112 subroutine device_heaviside_mapping_apply(beta, eta, X_out_d, &
113 X_in_d, n)
114 real(kind=rp), intent(in) :: beta
115 real(kind=rp), intent(in) :: eta
116 type(c_ptr) :: x_out_d
117 type(c_ptr) :: x_in_d
118 integer :: n
119#if HAVE_HIP
120 call hip_heaviside_mapping_apply(beta, eta, x_out_d, x_in_d, n)
121#elif HAVE_CUDA
122 call cuda_heaviside_mapping_apply(beta, eta, x_out_d, x_in_d, n)
123#else
124 call neko_error('No device backend configured')
125#endif
126 end subroutine device_heaviside_mapping_apply
127
135 subroutine device_heaviside_mapping_apply_backward(beta, eta, &
136 sens_out_d, sens_in_d, X_in_d, n)
137 real(kind=rp), intent(in) :: beta
138 real(kind=rp), intent(in) :: eta
139 type(c_ptr) :: sens_out_d
140 type(c_ptr) :: sens_in_d
141 type(c_ptr) :: x_in_d
142 integer :: n
143#if HAVE_HIP
144 call hip_heaviside_mapping_apply_backward(beta, eta, sens_out_d, &
145 sens_in_d, x_in_d, n)
146#elif HAVE_CUDA
147 call cuda_heaviside_mapping_apply_backward(beta, eta, sens_out_d, &
148 sens_in_d, x_in_d, n)
149#else
150 call neko_error('No device backend configured')
151#endif
152 end subroutine device_heaviside_mapping_apply_backward
153
154end module device_heaviside_mapping
void cuda_heaviside_mapping_apply_backward(real *beta, real *eta, void *sens_out_d, void *sens_in_d, void *X_in_d, int *n)
void cuda_heaviside_mapping_apply(real *beta, real *eta, void *X_out_d, void *X_in_d, int *n)
void hip_heaviside_mapping_apply_backward(real *beta, real *eta, void *sens_out_d, void *sens_in_d, void *X_in_d, int *n)
void hip_heaviside_mapping_apply(real *beta, real *eta, void *X_out_d, void *X_in_d, int *n)