parkipy.ewald.EwaldOptions

class parkipy.ewald.EwaldOptions(
box: List[float],
periodicity: Literal[0, 1, 2, 3],
tolerance: float,
execution_space: pykokkos.ExecutionSpace | Literal['CUDA', 'HIP', 'OPENMP'],
p2p_method: Literal['GM-1D', 'GM-2D', 'SM-1D', 'SM-2D'] = 'GM-1D',
p2g_method: Literal['BASE', 'SOURCE', 'GRID', 'HYBRID'] = 'HYBRID',
g2p_method: Literal['BASE', 'TARGET'] = 'TARGET',
fft_type: Literal['R2C', 'C2C'] = 'R2C',
torch_fft: int = False,
p2p_threads_x: int = 128,
p2p_threads_y: int = 1,
p2g_threads: int = 128,
g2p_threads: int = 128,
cell_size: int | None = None,
rc: float | None = None,
return_walltime: bool = False,
return_params: bool = False,
)

Data class for providing options to the stokes_comb() and laplace() Ewald kernels.

Parameters:
  • box (List[float]) – Computational box lengths for Ewald summation. The computational box is centered at the origin with size lengths i=0,1,2 given by box[i].

  • periodicity ({'0','1','2','3'}) – Periodicity of the computational box. Periodicity j means that box[j:] represents periodic dimensions and box[:j] represents free space.

  • tolerance (float) – Tolerance for Ewald summation. Used to set internal Ewald parameters.

  • execution_space (pykokkos.ExecutionSpace | {‘CUDA’, ‘HIP’, ‘OPENMP’}) – Device for the Kokkos backend. May be pykokkos execution space type or a string.

  • p2p_method ({'GM-1D', 'GM-2D', 'SM-1D', 'SM-2D'} , optional) – The algorithmic method for p2p, one of 'GM-1D', 'GM-2D', 'SM-1D', or 'SM-2D'. All methods read both sources and targets in parkipy.CellList ordering. 'GM'/'SM' determines if the sources are read from global-memory/shared-memory, while '1D'/'2D' determines whether parallelisation is soley over the targets (1D) or over the targets and the sources (2D). The default is 'GM-1D'.

  • p2g_method ({'BASE', 'SOURCE', 'GRID', 'HYBRID'}, optional) – The algorithmic method for p2g, one of 'BASE', 'SOURCE', 'GRID', or 'HYBRID'. The 'BASE' method does a simple OpenMP syle parallelization over the unordered source points, 'SOURCE' does the same parallelization but with sources in a parkipy.CellList ordering, 'GRID' does a parallelization over the output grid points, and 'HYBRID' does a parallel read of the sources, calls a synchronization barrier, and does a parallel write over the grid points. The default is 'HYBRID'.

  • g2p_method ({'BASE', 'TARGET'}, optional) – The algorithmic method for g2p, one of 'BASE' or 'TARGET'. Both 'BASE' and 'TARGET' are parallel over the output target points; the 'BASE' method reads over the targets in an unordered fashion while the 'TARGET' method reads over the targets in a parkipy.CellList order. The default is 'TARGET'.

  • fft_type ({'R2C', 'C2C'}, optional) – The type of fft to preform. Must be one of 'R2C' or 'C2C'. The default is 'R2C'.

  • torch_fft (bool, optional) – Use PyTroch for the fft and ifft stages. The default is False.

  • p2p_threads_x (int, optional) – Number of threads per block used to parallelize over the targets in the p2p algorithm. Resets to 1 for the OpenMP execution space. The default is 128.

  • p2p_threads_y (int, optional) – Number of threads per block used to parallelize over the sources in the p2p algorithm. Resets to 1 for 1D methods and for the OpenMP execution space. The default is 1.

  • p2g_threads (int, optional) – Number of threads per block used to parallelize the p2g method. The default is 128.

  • g2p_threads (int, optional) – Number of threads per block used to parallelize the g2p method. The default is 128.

  • cell_size (int | None, optional) – Near field cell size. If None, rc must be provided. The defaults to None.

  • rc (float | None, optional) – Near field cutoff radius. If None, cell_size must be provided. The defaults to None.

  • return_walltime (bool, optional) – Flag to return the walltime dict of Ewald stage wall-clock times. If true, the parkipy.ewald.PerfHistory object will be the second item returned for a kernel call. The default is False.

  • return_params (bool, optional) – Flag to return the params struct for the parameters of the Ewald algorithm. If, true, the params struct will be the last item returned for a kernel call. The default is False.