GridFloat

Note

This class is only available if single precision support is enabled, in which case the marco SPFFT_SINGLE_PRECISION is defined in config.h.

Note

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

class spfft::GridFloat

A Grid, which provides pre-allocated memory for single precision transforms.

Public Functions

GridFloat(int maxDimX, int maxDimY, int maxDimZ, int maxNumLocalZColumns, SpfftProcessingUnitType processingUnit, int maxNumThreads)

Constructor for a local grid.

Parameters
  • [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.

Exceptions
  • GenericError: SpFFT error. Can be a derived type.

  • std::exception: Error from standard library calls. Can be a derived type.

GridFloat(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
  • [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.

Exceptions
  • GenericError: SpFFT error. Can be a derived type.

  • std::exception: Error from standard library calls. Can be a derived type.

GridFloat(const GridFloat&)

Custom copy constructor.

Creates a independent copy. Calls MPI functions for the distributed case.

GridFloat(GridFloat&&) = default

Default move constructor.

GridFloat &operator=(const GridFloat&)

Custom copy operator.

Creates a independent copy. Calls MPI functions for the distributed case.

GridFloat &operator=(GridFloat&&) = default

Default move operator.

TransformFloat create_transform(SpfftProcessingUnitType processingUnit, SpfftTransformType transformType, int dimX, int dimY, int dimZ, int localZLength, int numLocalElements, SpfftIndexFormatType indexFormat, const int *indices) const

Creates a transform from this grid object.

Thread-safe if no FFTW calls are executed concurrently.

Return

Transform

Parameters
  • [in] processingUnit: The processing unit type to use. Must be either SPFFT_PU_HOST or SPFFT_PU_GPU and be supported by the grid itself.

  • [in] transformType: The transform type (complex to complex or real to complex). Can be SPFFT_TRANS_C2C or SPFFT_TRANS_R2C.

  • [in] dimX: The dimension in x. The maximum allowed depends on the grid parameters.

  • [in] dimY: The dimension in y. The maximum allowed depends on the grid parameters.

  • [in] dimZ: The dimension in z. The maximum allowed depends on the grid parameters.

  • [in] localZLength: The length in z in space domain of the local MPI rank.

  • [in] numLocalElements: The number of elements in frequency domain of the local MPI rank.

  • [in] indexFormat: The index format. Only SPFFT_INDEX_TRIPLETS currently supported.

  • [in] indices: Pointer to the frequency indices. Posive and negative indexing is supported.

Exceptions
  • GenericError: SpFFT error. Can be a derived type.

  • std::exception: Error from standard library calls. Can be a derived type.

int max_dim_x() const

Access a grid parameter.

Return

Maximum dimension in x.

int max_dim_y() const

Access a grid parameter.

Return

Maximum dimension in y.

int max_dim_z() const

Access a grid parameter.

Return

Maximum dimension in z.

int max_num_local_z_columns() const

Access a grid parameter.

Return

Maximum number of z-columns in frequency domain of the local MPI rank.

int max_local_z_length() const

Access a grid parameter.

Return

Maximum length in z in space domain of the local MPI rank.

SpfftProcessingUnitType processing_unit() const

Access a grid parameter.

Return

The processing unit, the grid has prepared for. Can be SPFFT_PU_HOST or SPFFT_PU_GPU or SPFFT_PU_HOST | SPFFT_PU_GPU.

int device_id() const

Access a grid parameter.

Return

The GPU device id used. Always returns 0, if no GPU support is enabled.

int num_threads() const

Access a grid parameter.

Return

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.