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.
- Parameters:
grid – [out] Handle to grid.
maxDimX – [in] Maximum dimension in x.
maxDimY – [in] Maximum dimension in y.
maxDimZ – [in] Maximum dimension in z.
maxNumLocalZColumns – [in] Maximum number of z-columns in frequency domain.
processingUnit – [in] The processing unit type to prepare for. Can be SPFFT_PU_HOST or SPFFT_PU_GPU or SPFFT_PU_HOST | SPFFT_PU_GPU.
maxNumThreads – [in] The maximum number of threads, transforms created with this grid are allowed to use. If smaller than 1, the OpenMP default value is used.
- Returns:
Error code or SPFFT_SUCCESS.
-
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.
- Parameters:
grid – [out] Handle to grid.
maxDimX – [in] Maximum dimension in x.
maxDimY – [in] Maximum dimension in y.
maxDimZ – [in] Maximum dimension in z.
maxNumLocalZColumns – [in] Maximum number of z-columns in frequency domain of the local MPI rank.
maxLocalZLength – [in] Maximum length in z in space domain for the local MPI rank.
processingUnit – [in] The processing unit type to prepare for. Can be SPFFT_PU_HOST or SPFFT_PU_GPU or SPFFT_PU_HOST | SPFFT_PU_GPU.
maxNumThreads – [in] The maximum number of threads, transforms created with this grid are allowed to use. If smaller than 1, the OpenMP default value is used.
comm – [in] The MPI communicator to use. Will be duplicated for internal use.
exchangeType – [in] The type of MPI exchange to use. Possible values are SPFFT_EXCH_DEFAULT, SPFFT_EXCH_BUFFERED, SPFFT_EXCH_COMPACT_BUFFERED and SPFFT_EXCH_UNBUFFERED.
- Returns:
Error code or SPFFT_SUCCESS.
-
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).
- Parameters:
grid – [in] Handle to grid.
- Returns:
Error code or SPFFT_SUCCESS.
-
SpfftError spfft_grid_max_dim_x(SpfftGrid grid, int *dimX)
Access a grid parameter.
- Parameters:
grid – [in] Handle to grid.
dimX – [out] Maximum dimension in x.
- Returns:
Error code or SPFFT_SUCCESS.
-
SpfftError spfft_grid_max_dim_y(SpfftGrid grid, int *dimY)
Access a grid parameter.
- Parameters:
grid – [in] Handle to grid.
dimY – [out] Maximum dimension in y.
- Returns:
Error code or SPFFT_SUCCESS.
-
SpfftError spfft_grid_max_dim_z(SpfftGrid grid, int *dimZ)
Access a grid parameter.
- Parameters:
grid – [in] Handle to grid.
dimZ – [out] Maximum dimension in z.
- Returns:
Error code or SPFFT_SUCCESS.
-
SpfftError spfft_grid_max_num_local_z_columns(SpfftGrid grid, int *maxNumLocalZColumns)
Access a grid parameter.
- Parameters:
grid – [in] Handle to grid.
maxNumLocalZColumns – [out] Maximum number of z-columns in frequency domain of the local MPI rank.
- Returns:
Error code or SPFFT_SUCCESS.
-
SpfftError spfft_grid_max_local_z_length(SpfftGrid grid, int *maxLocalZLength)
Access a grid parameter.
- Parameters:
grid – [in] Handle to grid.
maxLocalZLength – [out] Maximum length in z in space domain of the local MPI rank. rank.
- Returns:
Error code or SPFFT_SUCCESS.
-
SpfftError spfft_grid_processing_unit(SpfftGrid grid, SpfftProcessingUnitType *processingUnit)
Access a grid parameter.
- Parameters:
grid – [in] Handle to grid.
processingUnit – [out] The processing unit, the grid has prepared for. Can be SPFFT_PU_HOST or SPFFT_PU_GPU or SPFFT_PU_HOST | SPFFT_PU_GPU.
- Returns:
Error code or SPFFT_SUCCESS.
-
SpfftError spfft_grid_device_id(SpfftGrid grid, int *deviceId)
Access a grid parameter.
- Parameters:
grid – [in] Handle to grid.
deviceId – [out] The GPU device id used. Returns always 0, if no GPU support is enabled.
- Returns:
Error code or SPFFT_SUCCESS.
-
SpfftError spfft_grid_num_threads(SpfftGrid grid, int *numThreads)
Access a grid parameter.
- Parameters:
grid – [in] Handle to grid.
numThreads – [out] 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.
- Returns:
Error code or SPFFT_SUCCESS.
-
SpfftError spfft_grid_communicator(SpfftGrid grid, MPI_Comm *comm)
Access a grid parameter.
- Parameters:
grid – [in] Handle to grid.
comm – [out] The internal MPI communicator.
- Returns:
Error code or SPFFT_SUCCESS.