Skip to content

adam_fnl_poisson_fft_object ​

ADAM, FNL FFT Poisson solver on uniform periodic grids (cuFFT).

Extends poisson_fft_object (issue #81, P2): the gather to rank 0, the placement and the scatter of phi with its ghosts are the CPU ones; the spectral solve runs on rank 0's GPU through cuFFT (-D_CUFFT, -cudalib=cufft). The global source goes to the device, a D2Z transform, the division by the eigenvalues of L_h (the same host-computed lam1..3 as the CPU solver), a Z2D transform, and the potential comes back. cuFFT runs on the stream of the synchronous OpenACC queue, so the transforms and the kernel between them are ordered.

Isolated boundaries (issue #81, M8-P4): the transforms are the padded ones (m), the kernel's spectrum khat is computed once on the device (transform_kernel) and stays there (enter data, released by destroy_plans); the solve multiplies by it instead of dividing by the eigenvalues.

cuFFT is NVIDIA only: built without _CUFFT (an AMD build), making the plans stops the run.

Source: src/lib/fnl/adam_fnl_poisson_fft_object.F90

Dependencies

Contents ​

Derived Types ​

poisson_fft_fnl_object ​

FNL FFT Poisson solver on uniform periodic grids (cuFFT).

Inheritance

Extends: poisson_fft_object

Components ​

NameTypeAttributesDescription
is_initializedlogicalInitialization status.
ninteger(kind=I4P)Global cells per direction.
minteger(kind=I4P)Transform cells per direction: n, or 2 (n + ngc) isolated.
isolatedlogicalIsolated boundaries (zero padding), else periodic.
dirichletlogicalHomogeneous Dirichlet boundaries (odd extension, #87).
ntinteger(kind=I4P)Cells of the periodic transform the eigenvalues refer to: n,
nijkinteger(kind=I4P)Cells per block per direction.
ngcinteger(kind=I4P)Ghost cells per side.
levelinteger(kind=I4P)Level of every block.
dxyzreal(kind=R8P)Cell spacing per direction.
lam1real(kind=R8P)allocatableEigenvalue part along x [0:n(1)/2].
lam2real(kind=R8P)allocatableEigenvalue part along y [0:n(2)-1].
lam3real(kind=R8P)allocatableEigenvalue part along z [0:n(3)-1].
f_globalreal(kind=R8P)allocatableRank 0: the source, then the potential [m(1),m(2),m(3)].
f_sourcereal(kind=R8P)allocatableRank 0: a copy of the source, for the energy.
f_hatcomplex(kind=R8P)allocatableRank 0: the transform [m(1)/2+1,m(2),m(3)].
khatreal(kind=R8P)allocatableRank 0, isolated: the kernel's spectrum over prod(m).
plan_r2ctype(c_ptr)FFTW forward plan (rank 0).
plan_c2rtype(c_ptr)FFTW backward plan (rank 0).
plan_d2zinteger(kind=c_int)cuFFT forward plan (rank 0).
plan_z2dinteger(kind=c_int)cuFFT backward plan (rank 0).
has_planslogicalThe cuFFT plans exist.
khat_on_devicelogicalkhat is on the device (isolated).

Type-Bound Procedures ​

NameAttributesDescription
destroypass(self)Destroy the solver.
initializepass(self)Check the grid, size the solver, make the plans.
solvepass(self)Solve for phi from one variable of q.
solve_packedpass(self)Solve for phi from the packed interior source.
initialize_blockspass(self)Size the solver from block counts and spacing (no grid, no field).
solve_blockspass(self)Solve from an explicit list of blocks (coordinates and source).
destroy_planspass(self)Destroy the cuFFT plans.
make_planspass(self)Make the cuFFT plans (rank 0).
transformpass(self)The spectral solve on the GPU (rank 0).
transform_kernelpass(self)The kernel's spectrum on the GPU (isolated).

Subroutines ​

destroy_plans_fnl ​

Destroy the cuFFT plans.

fortran
subroutine destroy_plans_fnl(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(poisson_fft_fnl_object)inoutThe solver.

make_plans_fnl ​

Make the cuFFT plans (D2Z and Z2D, cuFFT is row-major: the slowest dimension first) on the synchronous queue.

fortran
subroutine make_plans_fnl(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(poisson_fft_fnl_object)inoutThe solver.

Call graph

transform_fnl ​

Rank 0: f_global <- factor * L_h^-1 f_global on the GPU, the modes of zero eigenvalue (the mean) set to zero.

fortran
subroutine transform_fnl(self, factor)

Arguments

NameTypeIntentAttributesDescription
selfclass(poisson_fft_fnl_object)inoutThe solver.
factorreal(kind=R8P)inSource factor.

Call graph

transform_kernel_fnl ​

Rank 0, isolated: khat <- FFT(f_global) / prod(m) on the GPU (real: the kernel is even); khat stays on the device for every solve.

fortran
subroutine transform_kernel_fnl(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(poisson_fft_fnl_object)inoutThe solver.

Call graph