estimate_workspace_size#

nvmath.fft.estimate_workspace_size(
key: tuple[tuple, tuple | None, tuple],
*,
technique: str = 'default',
handle: int | None = None,
) int[source]#

Estimate the workspace size in bytes for the given FFT key.

Parameters:
  • key – The FFT key returned by FFT.create_key().

  • technique

    The estimation technique to use.

    • "default": Uses cufftEstimateMany, which returns the workspace size for default plan settings without requiring a handle. Does not support half or bfloat16 precision keys.

    • "refined": Uses cufftXtGetSizeMany, which requires a handle and returns the workspace size accounting for any settings in the handle (e.g., plan properties). With a freshly-created handle, this returns the same value as "default".

  • handle – A cuFFT handle as returned by nvmath.bindings.cufft.create(). Required when technique="refined"; ignored otherwise. The caller is responsible to ensure the handle was created on the same CUDA device that the key targets.

Returns:

The estimated workspace size in bytes.

Return type:

int

Semantics:
  • This function does not create a full plan. The callback data (prolog/epilog) in the key is ignored, as the underlying cuFFT size estimation APIs do not account for callbacks.

  • The returned value is 0 in two cases: (1) the key specifies CPU execution, since workspace management is not applicable to the CPU backend, or (2) the key specifies CUDA execution but no temporary workspace is needed for the given FFT configuration.

See also

FFT.create_key()