23 use,
intrinsic :: iso_c_binding
34 pfft_create_procmesh_2d, &
38 pfft_local_size_dft_r2c_3d, &
39 pfft_local_size_dft_3d, &
40 pfft_plan_dft_c2r_3d, &
41 pfft_plan_dft_r2c_3d, &
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
145 integer(C_INTPTR_T) :: tmp_n(3)
151 assert(fft_sign == pfft_forward)
154 tmp_n(1:3) = n(3:1:-1)
157 plan = pfft_plan_dft_r2c_3d(tmp_n, in, out, mpi_comm, fft_sign, &
158 pfft_transposed_out + pfft_measure + pfft_destroy_input + pfft_tune)
170 type(c_ptr),
intent(out) :: plan
171 integer,
intent(in) :: n(:)
172 complex(real64),
contiguous,
pointer,
intent(inout) :: in(:,:,:,:)
173 real(real64),
contiguous,
pointer,
intent(inout) :: out(:,:,:,:)
174 integer,
intent(in) :: fft_sign
176 integer,
intent(in) :: flags
178 integer,
intent(in) :: mpi_comm
180 integer(C_INTPTR_T) :: tmp_n(3)
185 assert(fft_sign == pfft_backward)
188 tmp_n(1:3) = n(3:1:-1)
191 plan = pfft_plan_dft_c2r_3d(tmp_n, in, out, mpi_comm, fft_sign, &
192 pfft_transposed_in + pfft_measure + pfft_destroy_input + pfft_tune)
204 type(c_ptr),
intent(out) :: plan
205 integer,
intent(in) :: n(:)
206 complex(real64),
contiguous,
pointer,
intent(inout) :: in(:,:,:,:)
207 complex(real64),
contiguous,
pointer,
intent(inout) :: out(:,:,:,:)
208 integer,
intent(in) :: fft_sign
210 integer,
intent(in) :: flags
212 integer,
intent(in) :: mpi_comm
215 integer(C_INT) :: pfft_flags
217 integer(C_INTPTR_T) :: tmp_n(3)
221 tmp_n(1:3) = n(3:1:-1)
224 if (fft_sign == pfft_forward)
then
225 pfft_flags = pfft_transposed_out
227 pfft_flags = pfft_transposed_in
230 plan = pfft_plan_dft_3d(tmp_n, in, out, mpi_comm, fft_sign, pfft_flags)
239 subroutine pfft_get_dims(rs_n_global, mpi_comm, is_real, alloc_size, fs_n_global, rs_n, fs_n, rs_istart, fs_istart)
240 integer,
intent(in) :: rs_n_global(1:3)
241 integer,
intent(in) :: mpi_comm
242 logical,
intent(in) :: is_real
243 integer(int64),
intent(out) :: alloc_size
244 integer,
intent(out) :: fs_n_global(1:3)
245 integer,
intent(out) :: rs_n(1:3)
246 integer,
intent(out) :: fs_n(1:3)
247 integer,
intent(out) :: rs_istart(1:3)
248 integer,
intent(out) :: fs_istart(1:3)
250 integer(C_INTPTR_T) :: tmp_alloc_size, tmp_n(3)
251 integer(C_INTPTR_T) :: tmp_rs_n(3), tmp_rs_istart(3)
252 integer(C_INTPTR_T) :: tmp_fs_n(3), tmp_fs_istart(3)
256 fs_n_global(1:3) = rs_n_global(1:3)
259 tmp_n(1:3) = rs_n_global(3:1:-1)
264 tmp_alloc_size = pfft_local_size_dft_r2c_3d(tmp_n, mpi_comm, pfft_transposed_out, &
265 tmp_rs_n, tmp_rs_istart, tmp_fs_n, tmp_fs_istart)
266 fs_n_global(1) = rs_n_global(1)/2 + 1
268 tmp_alloc_size = pfft_local_size_dft_3d(tmp_n, mpi_comm, pfft_transposed_out, &
269 tmp_rs_n, tmp_rs_istart, tmp_fs_n, tmp_fs_istart)
277 alloc_size = int(tmp_alloc_size, int64)
278 rs_n(1:3) = int(tmp_rs_n(3:1:-1))
279 fs_n(1:3) = int(tmp_fs_n(3:1:-1))
280 rs_istart(1:3) = int(tmp_rs_istart(3:1:-1)+1)
281 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_r2c(plan, n, in, out, fft_sign, flags, mpi_comm)
Octopus subroutine to prepare a PFFT plan real to complex.
subroutine, public pfft_prepare_plan_c2c(plan, n, in, out, fft_sign, flags, mpi_comm)
Octopus subroutine to prepare a PFFT plan real to complex.
subroutine, public pfft_decompose(n_proc, dim1, dim2)
Decompose all available processors in 2D processor grid, most equally possible.
subroutine, public pfft_prepare_plan_c2r(plan, n, in, out, fft_sign, flags, mpi_comm)
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)
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.