18 USE iso_c_binding,
ONLY: c_char,&
26#include "../base/base_uses.f90"
42 FUNCTION pw_fpga_initialize()
RESULT(stat) &
43 BIND(C, name="pw_fpga_initialize_")
45 INTEGER(KIND=C_INT) :: stat
46 END FUNCTION pw_fpga_initialize
51 SUBROUTINE pw_fpga_final() &
52 BIND(C, name="pw_fpga_final_")
53 END SUBROUTINE pw_fpga_final
64 FUNCTION pw_fpga_check_bitstream(data_path, n)
RESULT(res) &
65 BIND(C, name="pw_fpga_check_bitstream_")
67 CHARACTER(KIND=C_CHAR) :: data_path(*)
68 INTEGER(KIND=C_INT) :: n(3)
69 INTEGER(KIND=C_INT) :: res
70 END FUNCTION pw_fpga_check_bitstream
81 SUBROUTINE pw_fpga_fft3d_sp(dir, n, c_in_sp) &
82 BIND(C, name="pw_fpga_fft3d_sp_")
84 INTEGER(KIND=C_INT),
VALUE :: dir
85 INTEGER(KIND=C_INT) :: n(3)
86 COMPLEX(KIND=C_FLOAT_COMPLEX) :: c_in_sp(n(1), n(2), n(3))
87 END SUBROUTINE pw_fpga_fft3d_sp
97 SUBROUTINE pw_fpga_fft3d_dp(dir, n, c_in_dp) &
98 BIND(C, name="pw_fpga_fft3d_dp_")
100 INTEGER(KIND=C_INT),
VALUE :: dir
101 INTEGER(KIND=C_INT) :: n(3)
102 COMPLEX(KIND=C_DOUBLE_COMPLEX) :: c_in_dp(n(1), n(2), n(3))
103 END SUBROUTINE pw_fpga_fft3d_dp
112#if defined (__PW_FPGA)
115#if defined(__OFFLOAD) && !defined(__NO_OFFLOAD_PW)
116#error "OFFLOAD and FPGA cannot be configured concurrently! Recompile with -D__NO_OFFLOAD_PW."
117 cpabort(
"OFFLOAD and FPGA cannot be configured concurrently! Recompile with -D__NO_OFFLOAD_PW.")
119 stat = pw_fpga_initialize()
121 cpabort(
"pw_fpga_init: failed")
125#if (__PW_FPGA_SP && !(__PW_FPGA))
126#error "Define both __PW_FPGA_SP and __PW_FPGA"
127 cpabort(
"Define both __PW_FPGA_SP and __PW_FPGA")
136#if defined (__PW_FPGA)
147 INTEGER,
DIMENSION(:),
INTENT(IN) :: n
148 COMPLEX(KIND=dp),
INTENT(INOUT) :: c_out(n(1), n(2), n(3))
150#if ! defined (__PW_FPGA)
156 CHARACTER(len=*),
PARAMETER :: routinex =
'fw_fft_fpga_r3dc1d_dp'
158 CALL timeset(routinex, handle3)
159 CALL pw_fpga_fft3d_dp(+1, n, c_out)
160 CALL timestop(handle3)
171 INTEGER,
DIMENSION(:),
INTENT(IN) :: n
172 COMPLEX(KIND=dp),
INTENT(INOUT) :: c_out(n(1), n(2), n(3))
174#if ! defined (__PW_FPGA)
180 CHARACTER(len=*),
PARAMETER :: routinex =
'bw_fft_fpga_c1dr3d_dp'
182 CALL timeset(routinex, handle3)
183 CALL pw_fpga_fft3d_dp(-1, n, c_out)
184 CALL timestop(handle3)
195 INTEGER,
DIMENSION(:),
INTENT(IN) :: n
196 COMPLEX(KIND=dp),
INTENT(INOUT) :: c_out(n(1), n(2), n(3))
198#if ! defined (__PW_FPGA)
202 COMPLEX,
DIMENSION(:, :, :),
POINTER :: c_in_sp
205 CHARACTER(len=*),
PARAMETER :: routinex =
'fw_fft_fpga_r3dc1d_sp'
207 ALLOCATE (c_in_sp(n(1), n(2), n(3)))
209 c_in_sp = cmplx(c_out, kind=
sp)
211 CALL timeset(routinex, handle3)
212 CALL pw_fpga_fft3d_sp(+1, n, c_in_sp)
213 CALL timestop(handle3)
217 c_out = cmplx(c_in_sp, kind=
dp)
229 INTEGER,
DIMENSION(:),
INTENT(IN) :: n
230 COMPLEX(KIND=dp),
INTENT(INOUT) :: c_out(n(1), n(2), n(3))
232#if ! defined (__PW_FPGA)
237 COMPLEX,
DIMENSION(:, :, :),
POINTER :: c_in_sp
240 CHARACTER(len=*),
PARAMETER :: routinex =
'bw_fft_fpga_c1dr3d_sp'
242 ALLOCATE (c_in_sp(n(1), n(2), n(3)))
244 c_in_sp = cmplx(c_out, kind=
sp)
246 CALL timeset(routinex, handle3)
247 CALL pw_fpga_fft3d_sp(-1, n, c_in_sp)
248 CALL timestop(handle3)
251 c_out = cmplx(c_in_sp, kind=
dp)
264 INTEGER,
DIMENSION(:),
INTENT(IN) :: n
267#if ! defined (__PW_FPGA)
272 CHARACTER(len=100) :: data_path
273 INTEGER :: data_path_len
276 data_path_len = len_trim(data_path)
278 res = pw_fpga_check_bitstream(data_path, n)
const char * get_data_dir()
Returns path of data directory if set, otherwise an empty string.
Utility routines to open and close files. Tracking of preconnections.
Defines the basic variable types.
integer, parameter, public dp
integer, parameter, public sp
subroutine, public pw_fpga_finalize()
Releases resources on the fpga device.
integer function, public pw_fpga_init_bitstream(n)
Invoke the pw_fpga_check_bitstream C function passing the path to the data dir.
subroutine, public pw_fpga_r3dc1d_3d_dp(n, c_out)
perform an in-place double precision fft3d on the FPGA
subroutine, public pw_fpga_r3dc1d_3d_sp(n, c_out)
perform an in-place single precision fft3d on the FPGA
subroutine, public pw_fpga_c1dr3d_3d_dp(n, c_out)
perform an in-place double precision inverse fft3d on the FPGA
subroutine, public pw_fpga_c1dr3d_3d_sp(n, c_out)
perform an in-place single precision inverse fft3d on the FPGA
subroutine, public pw_fpga_init()
Allocates resources on the fpga device.