23 use,
intrinsic :: iso_c_binding
34 pfft_create_procmesh_2d, &
38 pfft_local_size_many_dft_r2c, &
39 pfft_local_size_many_dft, &
40 pfft_plan_many_dft_c2r, &
41 pfft_plan_many_dft_r2c, &
50 pfft_transposed_out, &
62 integer(C_INTPTR_T),
parameter :: FFTW_MPI_DEFAULT_BLOCK = 0
74 use,
intrinsic :: iso_c_binding
95 integer,
intent(in) :: n_proc
96 integer,
intent(out) :: dim1
97 integer,
intent(out) :: dim2
115 if (mod(np,i) /= 0.or.(.not.
is_prime(i)))
then
120 if (dim1 <= dim2)
then
128 assert(dim1*dim2 == n_proc)
136 type(C_PTR),
intent(out) :: plan
137 integer,
intent(in) :: n(:)
138 real(real64),
contiguous,
pointer,
intent(inout) :: in(:,:,:,:)
139 complex(real64),
contiguous,
pointer,
intent(inout) :: out(:,:,:,:)
140 integer,
intent(in) :: fft_sign
141 integer,
intent(in) :: flags
143 integer,
intent(in) :: mpi_comm
144 integer,
intent(in) :: howmany
146 integer(C_INTPTR_T) :: tmp_n(3)
148 integer(C_INTPTR_T) :: default_blocks(3)
155 assert(fft_sign == pfft_forward)
158 tmp_n(1:3) = n(3:1:-1)
164 default_blocks(1:3) = 0_c_intptr_t
166 plan = pfft_plan_many_dft_r2c(3, tmp_n, tmp_n, tmp_n, int(howmany, c_intptr_t), &
167 default_blocks, default_blocks, in, out, mpi_comm, fft_sign, &
168 pfft_transposed_out + pfft_measure + pfft_destroy_input + pfft_tune)
180 type(c_ptr),
intent(out) :: plan
181 integer,
intent(in) :: n(:)
182 complex(real64),
contiguous,
pointer,
intent(inout) :: in(:,:,:,:)
183 real(real64),
contiguous,
pointer,
intent(inout) :: out(:,:,:,:)
184 integer,
intent(in) :: fft_sign
186 integer,
intent(in) :: flags
188 integer,
intent(in) :: mpi_comm
189 integer,
intent(in) :: howmany
191 integer(C_INTPTR_T) :: tmp_n(3)
193 integer(C_INTPTR_T) :: default_blocks(3)
199 assert(fft_sign == pfft_backward)
202 tmp_n(1:3) = n(3:1:-1)
205 default_blocks(1:3) = 0_c_intptr_t
207 plan = pfft_plan_many_dft_c2r(3, tmp_n, tmp_n, tmp_n, int(howmany, c_intptr_t), &
208 default_blocks, default_blocks, in, out, mpi_comm, fft_sign, &
209 pfft_transposed_in + pfft_measure + pfft_destroy_input + pfft_tune)
221 type(c_ptr),
intent(out) :: plan
222 integer,
intent(in) :: n(:)
223 complex(real64),
contiguous,
pointer,
intent(inout) :: in(:,:,:,:)
224 complex(real64),
contiguous,
pointer,
intent(inout) :: out(:,:,:,:)
225 integer,
intent(in) :: fft_sign
227 integer,
intent(in) :: flags
229 integer,
intent(in) :: mpi_comm
230 integer,
intent(in) :: howmany
233 integer(C_INT) :: pfft_flags
234 integer(C_INTPTR_T) :: default_blocks(3)
236 integer(C_INTPTR_T) :: tmp_n(3)
240 tmp_n(1:3) = n(3:1:-1)
243 if (fft_sign == pfft_forward)
then
244 pfft_flags = pfft_transposed_out
246 pfft_flags = pfft_transposed_in
249 default_blocks(1:3) = 0_c_intptr_t
251 plan = pfft_plan_many_dft(3, tmp_n, tmp_n, tmp_n, int(howmany, c_intptr_t), &
252 default_blocks, default_blocks, in, out, mpi_comm, fft_sign, pfft_flags)
261 subroutine pfft_get_dims(rs_n_global, mpi_comm, is_real, alloc_size, fs_n_global, rs_n, fs_n, rs_istart, fs_istart, howmany)
262 integer,
intent(in) :: rs_n_global(1:3)
263 integer,
intent(in) :: mpi_comm
264 logical,
intent(in) :: is_real
265 integer(int64),
intent(out) :: alloc_size
266 integer,
intent(out) :: fs_n_global(1:3)
267 integer,
intent(out) :: rs_n(1:3)
268 integer,
intent(out) :: fs_n(1:3)
269 integer,
intent(out) :: rs_istart(1:3)
270 integer,
intent(out) :: fs_istart(1:3)
271 integer,
intent(in) :: howmany
273 integer(C_INTPTR_T) :: tmp_alloc_size, tmp_n(3)
274 integer(C_INTPTR_T) :: tmp_rs_n(3), tmp_rs_istart(3)
275 integer(C_INTPTR_T) :: tmp_fs_n(3), tmp_fs_istart(3)
277 integer(C_INTPTR_T) :: default_blocks(3)
282 fs_n_global(1:3) = rs_n_global(1:3)
285 tmp_n(1:3) = rs_n_global(3:1:-1)
294 default_blocks(1:3) = 0_c_intptr_t
296 tmp_alloc_size = pfft_local_size_many_dft_r2c(3, tmp_n, tmp_n, tmp_n, int(howmany, c_intptr_t), &
297 default_blocks, default_blocks, mpi_comm, pfft_transposed_out, &
298 tmp_rs_n, tmp_rs_istart, tmp_fs_n, tmp_fs_istart)
299 fs_n_global(1) = rs_n_global(1)/2 + 1
301 tmp_alloc_size = pfft_local_size_many_dft(3, tmp_n, tmp_n, tmp_n, int(howmany, c_intptr_t), &
302 default_blocks, default_blocks, mpi_comm, pfft_transposed_out, &
303 tmp_rs_n, tmp_rs_istart, tmp_fs_n, tmp_fs_istart)
311 alloc_size = int(tmp_alloc_size, int64)
312 rs_n(1:3) = int(tmp_rs_n(3:1:-1))
313 fs_n(1:3) = int(tmp_fs_n(3:1:-1))
314 rs_istart(1:3) = int(tmp_rs_istart(3:1:-1)+1)
315 fs_istart(1:3) = int(tmp_fs_istart(3:1:-1)+1)
This module is intended to contain "only mathematical" functions and procedures.
logical function, public is_prime(n)
The low level module to work with the PFFT library. http:
subroutine, public pfft_prepare_plan_c2c(plan, n, in, out, fft_sign, flags, mpi_comm, howmany)
Octopus subroutine to prepare a PFFT plan real to complex.
subroutine, public pfft_get_dims(rs_n_global, mpi_comm, is_real, alloc_size, fs_n_global, rs_n, fs_n, rs_istart, fs_istart, howmany)
subroutine, public pfft_decompose(n_proc, dim1, dim2)
Decompose all available processors in 2D processor grid, most equally possible.
subroutine, public pfft_prepare_plan_r2c(plan, n, in, out, fft_sign, flags, mpi_comm, howmany)
Octopus subroutine to prepare a PFFT plan real to complex.
subroutine, public pfft_prepare_plan_c2r(plan, n, in, out, fft_sign, flags, mpi_comm, howmany)
Octopus subroutine to prepare a PFFT plan real to complex.
The includes for the PFFT.
subroutine, public profiling_out(label)
Increment out counter and sum up difference between entry and exit time.
subroutine, public profiling_in(label, exclude)
Increment in counter and save entry time.