Grid

Note

A Grid handle can be safely destroyed after Transform handles have been created, since internal reference counting used to prevent the release of resources while still in use.

Typedefs

typedef void *SpfftGrid

Grid handle.

Functions

SpfftError spfft_grid_create(SpfftGrid *grid, int maxDimX, int maxDimY, int maxDimZ, int maxNumLocalZColumns, SpfftProcessingUnitType processingUnit, int maxNumThreads)

Constructor for a local grid.

Return

Error code or SPFFT_SUCCESS.

Parameters
  • [out] grid: Handle to grid.

  • [in] maxDimX: Maximum dimension in x.

  • [in] maxDimY: Maximum dimension in y.

  • [in] maxDimZ: Maximum dimension in z.

  • [in] maxNumLocalZColumns: Maximum number of z-columns in frequency domain.

  • [in] processingUnit: The processing unit type to prepare for. Can be SPFFT_PU_HOST or SPFFT_PU_GPU or SPFFT_PU_HOST | SPFFT_PU_GPU.

  • [in] maxNumThreads: The maximum number of threads, transforms created with this grid are allowed to use. If smaller than 1, the OpenMP default value is used.

SpfftError spfft_grid_create_distributed(SpfftGrid *grid, int maxDimX, int maxDimY, int maxDimZ, int maxNumLocalZColumns, int maxLocalZLength, SpfftProcessingUnitType processingUnit, int maxNumThreads, MPI_Comm comm, SpfftExchangeType exchangeType)

Constructor for a distributed grid.

Thread-safe if MPI thread support is set to MPI_THREAD_MULTIPLE.

Return

Error code or SPFFT_SUCCESS.

Parameters
  • [out] grid: Handle to grid.

  • [in] maxDimX: Maximum dimension in x.

  • [in] maxDimY: Maximum dimension in y.

  • [in] maxDimZ: Maximum dimension in z.

  • [in] maxNumLocalZColumns: Maximum number of z-columns in frequency domain of the local MPI rank.

  • [in] maxLocalZLength: Maximum length in z in space domain for the local MPI rank.

  • [in] processingUnit: The processing unit type to prepare for. Can be SPFFT_PU_HOST or SPFFT_PU_GPU or SPFFT_PU_HOST | SPFFT_PU_GPU.

  • [in] maxNumThreads: The maximum number of threads, transforms created with this grid are allowed to use. If smaller than 1, the OpenMP default value is used.

  • [in] comm: The MPI communicator to use. Will be duplicated for internal use.

  • [in] exchangeType: The type of MPI exchange to use. Possible values are SPFFT_EXCH_DEFAULT, SPFFT_EXCH_BUFFERED, SPFFT_EXCH_COMPACT_BUFFERED and SPFFT_EXCH_UNBUFFERED.

SpfftError spfft_grid_destroy(SpfftGrid grid)

Destroy a grid.

A grid can be safely destroyed independet from any related transforms. The internal memory is released, once all associated transforms are destroyed as well (through internal reference counting).

Return

Error code or SPFFT_SUCCESS.

Parameters
  • [in] grid: Handle to grid.

SpfftError spfft_grid_max_dim_x(SpfftGrid grid, int *dimX)

Access a grid parameter.

Return

Error code or SPFFT_SUCCESS.

Parameters
  • [in] grid: Handle to grid.

  • [out] dimX: Maximum dimension in x.

SpfftError spfft_grid_max_dim_y(SpfftGrid grid, int *dimY)

Access a grid parameter.

Return

Error code or SPFFT_SUCCESS.

Parameters
  • [in] grid: Handle to grid.

  • [out] dimY: Maximum dimension in y.

SpfftError spfft_grid_max_dim_z(SpfftGrid grid, int *dimZ)

Access a grid parameter.

Return

Error code or SPFFT_SUCCESS.

Parameters
  • [in] grid: Handle to grid.

  • [out] dimZ: Maximum dimension in z.

SpfftError spfft_grid_max_num_local_z_columns(SpfftGrid grid, int *maxNumLocalZColumns)

Access a grid parameter.

Return

Error code or SPFFT_SUCCESS.

Parameters
  • [in] grid: Handle to grid.

  • [out] maxNumLocalZColumns: Maximum number of z-columns in frequency domain of the local MPI rank.

SpfftError spfft_grid_max_local_z_length(SpfftGrid grid, int *maxLocalZLength)

Access a grid parameter.

Return

Error code or SPFFT_SUCCESS.

Parameters
  • [in] grid: Handle to grid.

  • [out] maxLocalZLength: Maximum length in z in space domain of the local MPI rank. rank.

SpfftError spfft_grid_processing_unit(SpfftGrid grid, SpfftProcessingUnitType *processingUnit)

Access a grid parameter.

Return

Error code or SPFFT_SUCCESS.

Parameters
  • [in] grid: Handle to grid.

  • [out] processingUnit: The processing unit, the grid has prepared for. Can be SPFFT_PU_HOST or SPFFT_PU_GPU or SPFFT_PU_HOST | SPFFT_PU_GPU.

SpfftError spfft_grid_device_id(SpfftGrid grid, int *deviceId)

Access a grid parameter.

Return

Error code or SPFFT_SUCCESS.

Parameters
  • [in] grid: Handle to grid.

  • [out] deviceId: The GPU device id used. Returns always 0, if no GPU support is enabled.

SpfftError spfft_grid_num_threads(SpfftGrid grid, int *numThreads)

Access a grid parameter.

Return

Error code or SPFFT_SUCCESS.

Parameters
  • [in] grid: Handle to grid.

  • [out] numThreads: The exact number of threads used by transforms created from this grid. May be less than the maximum given to the constructor. Always 1, if not compiled with OpenMP support.

SpfftError spfft_grid_communicator(SpfftGrid grid, MPI_Comm *comm)

Access a grid parameter.

Return

Error code or SPFFT_SUCCESS.

Parameters
  • [in] grid: Handle to grid.

  • [out] comm: The internal MPI communicator.