33module device_simp_mapping
34 use utils,
only: neko_error
35 use num_types,
only: rp, c_rp
36 use,
intrinsic :: iso_c_binding, only: c_ptr, c_int
40 public :: device_simp_mapping_apply, device_simp_mapping_apply_backward
45 subroutine hip_simp_mapping_apply(f_min, f_max, p, &
47 bind(c, name =
'hip_SIMP_mapping_apply')
48 import c_rp, c_ptr, c_int
52 type(c_ptr),
value :: X_out_d
53 type(c_ptr),
value :: X_in_d
55 end subroutine hip_simp_mapping_apply
59 subroutine hip_simp_mapping_apply_backward(f_min, f_max, p, &
60 sense_out_d, sens_in_d, X_in_d, n) &
61 bind(c, name =
'hip_SIMP_mapping_apply_backward')
62 import c_rp, c_ptr, c_int
66 type(c_ptr),
value :: sense_out_d
67 type(c_ptr),
value :: sens_in_d
68 type(c_ptr),
value :: X_in_d
70 end subroutine hip_simp_mapping_apply_backward
76 subroutine cuda_simp_mapping_apply(f_min, f_max, p, &
78 bind(c, name =
'cuda_SIMP_mapping_apply')
79 import c_rp, c_ptr, c_int
83 type(c_ptr),
value :: X_out_d
84 type(c_ptr),
value :: X_in_d
86 end subroutine cuda_simp_mapping_apply
90 subroutine cuda_simp_mapping_apply_backward(f_min, f_max, p, &
91 sense_out_d, sens_in_d, X_in_d, n) &
92 bind(c, name =
'cuda_SIMP_mapping_apply_backward')
93 import c_rp, c_ptr, c_int
97 type(c_ptr),
value :: sense_out_d
98 type(c_ptr),
value :: sens_in_d
99 type(c_ptr),
value :: X_in_d
101 end subroutine cuda_simp_mapping_apply_backward
110 subroutine device_simp_mapping_apply(f_min, f_max, p, &
112 real(kind=rp),
intent(in) :: f_min
113 real(kind=rp),
intent(in) :: f_max
114 real(kind=rp),
intent(in) :: p
115 type(c_ptr) :: X_out_d
116 type(c_ptr) :: X_in_d
119 call hip_simp_mapping_apply(f_min, f_max, p, &
122 call cuda_simp_mapping_apply(f_min, f_max, p, &
125 call neko_error(
'No device backend configured')
127 end subroutine device_simp_mapping_apply
129 subroutine device_simp_mapping_apply_backward(f_min, f_max, p, &
130 sense_out_d, sens_in_d, X_in_d, n)
131 real(kind=rp),
intent(in) :: f_min
132 real(kind=rp),
intent(in) :: f_max
133 real(kind=rp),
intent(in) :: p
134 type(c_ptr) :: sense_out_d
135 type(c_ptr) :: sens_in_d
136 type(c_ptr) :: X_in_d
139 call hip_simp_mapping_apply_backward(f_min, f_max, p, &
140 sense_out_d, sens_in_d, x_in_d, n)
142 call cuda_simp_mapping_apply_backward(f_min, f_max, p, &
143 sense_out_d, sens_in_d, x_in_d, n)
145 call neko_error(
'No device backend configured')
147 end subroutine device_simp_mapping_apply_backward
149end module device_simp_mapping