/* automatically generated by rust-bindgen 0.72.1 */
pub const CUFFT_VER_MAJOR: u32 = 12;
pub const CUFFT_VER_MINOR: u32 = 2;
pub const CUFFT_VER_PATCH: u32 = 0;
pub const CUFFT_VER_BUILD: u32 = 37;
pub const CUFFT_VERSION: u32 = 12200;
pub const CUFFT_FORWARD: i32 = -1;
pub const CUFFT_INVERSE: u32 = 1;
pub const CUFFT_PLAN_NULL: i32 = -1;
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Default, Copy, Clone, PartialOrd, PartialEq)]
pub struct float2 {
pub x: f32,
pub y: f32,
}
#[repr(C)]
#[repr(align(16))]
#[derive(Debug, Default, Copy, Clone, PartialOrd, PartialEq)]
pub struct double2 {
pub x: f64,
pub y: f64,
}
pub type cuFloatComplex = float2;
pub type cuDoubleComplex = double2;
pub type cuComplex = cuFloatComplex;
pub type size_t = ::core::ffi::c_ulong;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct CUstream_st {
_unused: [u8; 0],
}
/// All cuFFT Library return values except for [`cufftResult::CUFFT_SUCCESS`] indicate that the current API call failed and the user should reconfigure to correct the problem. The possible return values are defined as follows.
#[repr(u32)]
#[derive(
Debug,
Copy,
Clone,
Hash,
PartialOrd,
Ord,
PartialEq,
Eq,
TryFromPrimitive,
IntoPrimitive,
)]
pub enum cufftResult_t {
/// The cuFFT operation was successful.
CUFFT_SUCCESS = 0,
/// cuFFT was passed an invalid plan handle.
CUFFT_INVALID_PLAN = 1,
/// cuFFT failed to allocate GPU or CPU memory.
CUFFT_ALLOC_FAILED = 2,
/// The cuFFT type provided is unsupported.
CUFFT_INVALID_TYPE = 3,
/// User specified an invalid pointer or parameter.
CUFFT_INVALID_VALUE = 4,
/// Driver or internal cuFFT library error.
CUFFT_INTERNAL_ERROR = 5,
/// Failed to execute an FFT on the GPU.
CUFFT_EXEC_FAILED = 6,
/// The cuFFT library failed to initialize.
CUFFT_SETUP_FAILED = 7,
/// User specified an invalid transform size.
CUFFT_INVALID_SIZE = 8,
/// Not currently in use.
CUFFT_UNALIGNED_DATA = 9,
/// Execution of a plan was on different GPU than plan creation.
CUFFT_INVALID_DEVICE = 11,
/// No workspace has been provided prior to plan execution.
CUFFT_NO_WORKSPACE = 13,
/// Function does not implement functionality for parameters given.
CUFFT_NOT_IMPLEMENTED = 14,
/// Operation is not supported for parameters given.
CUFFT_NOT_SUPPORTED = 16,
/// cuFFT is unable to find a dependency.
CUFFT_MISSING_DEPENDENCY = 17,
/// An NVRTC failure was encountered during a cuFFT operation.
CUFFT_NVRTC_FAILURE = 18,
/// An nvJitLink failure was encountered during a cuFFT operation.
CUFFT_NVJITLINK_FAILURE = 19,
/// An NVSHMEM failure was encountered during a cuFFT operation.
CUFFT_NVSHMEM_FAILURE = 20,
}
pub use self::cufftResult_t as cufftResult;
/// A single-precision, floating-point real data type.
pub type cufftReal = f32;
/// A double-precision, floating-point real data type.
pub type cufftDoubleReal = f64;
/// A single-precision, floating-point complex data type that consists of interleaved real and imaginary components.
pub type cufftComplex = cuComplex;
/// A double-precision, floating-point complex data type that consists of interleaved real and imaginary components.
pub type cufftDoubleComplex = cuDoubleComplex;
/// The cuFFT library supports complex- and real-data transforms. The `cufftType` data type is an enumeration of the types of transform data supported by cuFFT.
#[repr(u32)]
#[derive(
Debug,
Copy,
Clone,
Hash,
PartialOrd,
Ord,
PartialEq,
Eq,
TryFromPrimitive,
IntoPrimitive,
)]
pub enum cufftType_t {
/// Real to complex (interleaved).
CUFFT_R2C = 42,
/// Complex (interleaved) to real.
CUFFT_C2R = 44,
/// Complex to complex (interleaved).
CUFFT_C2C = 41,
/// Double to double-complex (interleaved).
CUFFT_D2Z = 106,
/// Double-complex (interleaved) to double.
CUFFT_Z2D = 108,
/// Double-complex to double-complex (interleaved).
CUFFT_Z2Z = 105,
}
pub use self::cufftType_t as cufftType;
#[repr(u32)]
#[derive(
Debug,
Copy,
Clone,
Hash,
PartialOrd,
Ord,
PartialEq,
Eq,
TryFromPrimitive,
IntoPrimitive,
)]
pub enum cufftCompatibility_t {
CUFFT_COMPATIBILITY_FFTW_PADDING = 1,
}
pub use self::cufftCompatibility_t as cufftCompatibility;
/// A handle type used to store and access cuFFT plans. The user receives a handle after creating a cuFFT plan and uses this handle to execute the plan.
pub type cufftHandle = ::core::ffi::c_int;
unsafe extern "C" {
/// Creates a 1D FFT plan configuration for a specified signal size and data type. The `batch` input parameter tells cuFFT how many 1D transforms to configure.
///
/// This call can only be used once for a given handle. It will fail and return [`cufftResult::CUFFT_INVALID_PLAN`] if the plan is locked, i.e. the handle was previously used with a different `cufftPlan` or `cufftMakePlan` call.
///
/// # Parameters
///
/// - `plan`: Pointer to an uninitialized [`cufftHandle`] object.
///
/// Contains a cuFFT 1D plan handle value.
/// - `nx`: The transform size (e.g. 256 for a 256-point FFT).
/// - `batch`: Number of transforms of size `nx`. Please consider using [`cufftPlanMany`] for multiple transforms.
///
/// # Return value
///
/// - [`cufftResult::CUFFT_ALLOC_FAILED`]: The allocation of GPU resources for the plan failed.
/// - [`cufftResult::CUFFT_INTERNAL_ERROR`]: An internal driver error was detected.
/// - [`cufftResult::CUFFT_INVALID_PLAN`]: The `plan` parameter is not a valid handle. Handle is not valid when the plan is locked.
/// - [`cufftResult::CUFFT_INVALID_SIZE`]: The `nx` or `batch` parameter is not a supported size.
/// - [`cufftResult::CUFFT_INVALID_VALUE`]: One or more invalid parameters were passed to the API.
/// - [`cufftResult::CUFFT_MISSING_DEPENDENCY`]: The cuFFT library was unable to find a dependency either because it is missing or the version found is incompatible.
/// - [`cufftResult::CUFFT_NVJITLINK_FAILURE`]: nvJitLink encountered an error during planning.
/// - [`cufftResult::CUFFT_NVRTC_FAILURE`]: NVRTC encountered an error during planning.
/// - [`cufftResult::CUFFT_SETUP_FAILED`]: The cuFFT library failed to initialize.
/// - [`cufftResult::CUFFT_SUCCESS`]: cuFFT successfully created the FFT plan.
pub fn cufftPlan1d(
plan: *mut cufftHandle,
nx: ::core::ffi::c_int,
type_: cufftType,
batch: ::core::ffi::c_int,
) -> cufftResult;
}
unsafe extern "C" {
/// Creates a 2D FFT plan configuration according to specified signal sizes and data type.
///
/// This call can only be used once for a given handle. It will fail and return [`cufftResult::CUFFT_INVALID_PLAN`] if the plan is locked, i.e. the handle was previously used with a different `cufftPlan` or `cufftMakePlan` call.
///
/// # Parameters
///
/// - `plan`: Pointer to an uninitialized [`cufftHandle`] object.
///
/// Contains a cuFFT 2D plan handle value.
/// - `nx`: The transform size in the *x* dimension This is slowest changing dimension of a transform (strided in memory).
/// - `ny`: The transform size in the *y* dimension. This is fastest changing dimension of a transform (contiguous in memory).
///
/// # Return value
///
/// - [`cufftResult::CUFFT_ALLOC_FAILED`]: The allocation of GPU resources for the plan failed.
/// - [`cufftResult::CUFFT_INTERNAL_ERROR`]: An internal driver error was detected.
/// - [`cufftResult::CUFFT_INVALID_PLAN`]: The `plan` parameter is not a valid handle. Handle is not valid when the plan is locked.
/// - [`cufftResult::CUFFT_INVALID_SIZE`]: Either or both of the `nx` or `ny` parameters is not a supported size.
/// - [`cufftResult::CUFFT_INVALID_VALUE`]: One or more invalid parameters were passed to the API.
/// - [`cufftResult::CUFFT_MISSING_DEPENDENCY`]: The cuFFT library was unable to find a dependency either because it is missing or the version found is incompatible.
/// - [`cufftResult::CUFFT_NVJITLINK_FAILURE`]: nvJitLink encountered an error during planning.
/// - [`cufftResult::CUFFT_NVRTC_FAILURE`]: NVRTC encountered an error during planning.
/// - [`cufftResult::CUFFT_SETUP_FAILED`]: The cuFFT library failed to initialize.
/// - [`cufftResult::CUFFT_SUCCESS`]: cuFFT successfully created the FFT plan.
pub fn cufftPlan2d(
plan: *mut cufftHandle,
nx: ::core::ffi::c_int,
ny: ::core::ffi::c_int,
type_: cufftType,
) -> cufftResult;
}
unsafe extern "C" {
/// Creates a 3D FFT plan configuration according to specified signal sizes and data type. This function is the same as [`cufftPlan2d`] except that it takes a third size parameter `nz`.
///
/// This call can only be used once for a given handle. It will fail and return [`cufftResult::CUFFT_INVALID_PLAN`] if the plan is locked, i.e. the handle was previously used with a different `cufftPlan` or `cufftMakePlan` call.
///
/// # Parameters
///
/// - `plan`: Pointer to an uninitialized [`cufftHandle`] object.
///
/// Contains a cuFFT 3D plan handle value.
/// - `nx`: The transform size in the *x* dimension. This is slowest changing dimension of a transform (strided in memory).
/// - `ny`: The transform size in the *y* dimension.
/// - `nz`: The transform size in the *z* dimension. This is fastest changing dimension of a transform (contiguous in memory).
///
/// # Return value
///
/// - [`cufftResult::CUFFT_ALLOC_FAILED`]: The allocation of GPU resources for the plan failed.
/// - [`cufftResult::CUFFT_INTERNAL_ERROR`]: An internal driver error was detected.
/// - [`cufftResult::CUFFT_INVALID_PLAN`]: The `plan` parameter is not a valid handle. Handle is not valid when the plan is locked.
/// - [`cufftResult::CUFFT_INVALID_SIZE`]: One or more of the `nx`, `ny`, or `nz` parameters is not a supported size.
/// - [`cufftResult::CUFFT_INVALID_VALUE`]: One or more invalid parameters were passed to the API.
/// - [`cufftResult::CUFFT_MISSING_DEPENDENCY`]: The cuFFT library was unable to find a dependency either because it is missing or the version found is incompatible.
/// - [`cufftResult::CUFFT_NVJITLINK_FAILURE`]: nvJitLink encountered an error during planning.
/// - [`cufftResult::CUFFT_NVRTC_FAILURE`]: NVRTC encountered an error during planning.
/// - [`cufftResult::CUFFT_SETUP_FAILED`]: The cuFFT library failed to initialize.
/// - [`cufftResult::CUFFT_SUCCESS`]: cuFFT successfully created the FFT plan.
pub fn cufftPlan3d(
plan: *mut cufftHandle,
nx: ::core::ffi::c_int,
ny: ::core::ffi::c_int,
nz: ::core::ffi::c_int,
type_: cufftType,
) -> cufftResult;
}
unsafe extern "C" {
/// Creates a FFT plan configuration of dimension `rank`, with sizes specified in the array `n`. The `batch` input parameter tells cuFFT how many transforms to configure. With this function, batched plans of 1, 2, or 3 dimensions may be created.
///
/// The [`cufftPlanMany`] API supports more complicated input and output data layouts via the advanced data layout parameters: `inembed`, `istride`, `idist`, `onembed`, `ostride`, and `odist`.
///
/// If `inembed` and `onembed` are set to `NULL`, all other stride information is ignored, and default strides are used. The default assumes contiguous data arrays.
///
/// All arrays are assumed to be in CPU memory.
///
/// Please note that behavior of [`cufftPlanMany`] function when `inembed` and `onembed` is `NULL` is different than corresponding function in FFTW library `fftw_plan_many_dft`.
///
/// This call can only be used once for a given handle. It will fail and return [`cufftResult::CUFFT_INVALID_PLAN`] if the plan is locked, i.e. the handle was previously used with a different `cufftPlan` or `cufftMakePlan` call.
///
/// # Parameters
///
/// - `plan`: Pointer to an uninitialized [`cufftHandle`] object.
///
/// Contains a cuFFT plan handle.
/// - `rank`: Dimensionality of the transform (1, 2, or 3).
/// - `n`: Array of size `rank`, describing the size of each dimension, `n\[0\]` being the size of the outermost and `n\[rank-1\]` innermost (contiguous) dimension of a transform.
/// - `inembed`: Pointer of size `rank` that indicates the storage dimensions of the input data in memory. If set to NULL all other advanced data layout parameters are ignored.
/// - `istride`: Indicates the distance between two successive input elements in the least significant (i.e., innermost) dimension.
/// - `idist`: Indicates the distance between the first element of two consecutive signals in a batch of the input data.
/// - `onembed`: Pointer of size `rank` that indicates the storage dimensions of the output data in memory. If set to NULL all other advanced data layout parameters are ignored.
/// - `ostride`: Indicates the distance between two successive output elements in the output array in the least significant (i.e., innermost) dimension.
/// - `odist`: Indicates the distance between the first element of two consecutive signals in a batch of the output data.
/// - `batch`: Batch size for this transform.
///
/// # Return value
///
/// - [`cufftResult::CUFFT_ALLOC_FAILED`]: The allocation of GPU resources for the plan failed.
/// - [`cufftResult::CUFFT_INTERNAL_ERROR`]: An internal driver error was detected.
/// - [`cufftResult::CUFFT_INVALID_PLAN`]: The `plan` parameter is not a valid handle. Handle is not valid when the plan is locked.
/// - [`cufftResult::CUFFT_INVALID_SIZE`]: One or more of the parameters is not a supported size.
/// - [`cufftResult::CUFFT_INVALID_VALUE`]: One or more invalid parameters were passed to the API.
/// - [`cufftResult::CUFFT_MISSING_DEPENDENCY`]: The cuFFT library was unable to find a dependency either because it is missing or the version found is incompatible.
/// - [`cufftResult::CUFFT_NVJITLINK_FAILURE`]: nvJitLink encountered an error during planning.
/// - [`cufftResult::CUFFT_NVRTC_FAILURE`]: NVRTC encountered an error during planning.
/// - [`cufftResult::CUFFT_SETUP_FAILED`]: The cuFFT library failed to initialize.
/// - [`cufftResult::CUFFT_SUCCESS`]: cuFFT successfully created the FFT plan.
pub fn cufftPlanMany(
plan: *mut cufftHandle,
rank: ::core::ffi::c_int,
n: *mut ::core::ffi::c_int,
inembed: *mut ::core::ffi::c_int,
istride: ::core::ffi::c_int,
idist: ::core::ffi::c_int,
onembed: *mut ::core::ffi::c_int,
ostride: ::core::ffi::c_int,
odist: ::core::ffi::c_int,
type_: cufftType,
batch: ::core::ffi::c_int,
) -> cufftResult;
}
unsafe extern "C" {
/// Following a call to [`cufftCreate`] makes a 1D FFT plan configuration for a specified signal size and data type. The `batch` input parameter tells cuFFT how many 1D transforms to configure.
///
/// This call can only be used once for a given handle. It will fail and return [`cufftResult::CUFFT_INVALID_PLAN`] if the plan is locked, i.e. the handle was previously used with a different `cufftPlan` or `cufftMakePlan` call.
///
/// If `cufftXtSetGPUs()` was called prior to this call with multiple GPUs, then `workSize` will contain multiple sizes. See sections on multiple GPUs for more details.
///
/// # Parameters
///
/// - `plan`: [`cufftHandle`] returned by [`cufftCreate`].
/// - `nx`: The transform size (e.g. 256 for a 256-point FFT). For multiple GPUs, this must be a power of 2.
/// - `batch`: Number of transforms of size `nx`. Please consider using [`cufftMakePlanMany`] for multiple transforms.
/// - `workSize`: Pointer to the size(s), in bytes, of the work areas. For example for two GPUs worksize must be declared to have two elements.
///
/// Pointer to the size(s) of the work areas.
///
/// # Return value
///
/// - [`cufftResult::CUFFT_ALLOC_FAILED`]: The allocation of GPU resources for the plan failed.
/// - [`cufftResult::CUFFT_INTERNAL_ERROR`]: An internal driver error was detected.
/// - [`cufftResult::CUFFT_INVALID_PLAN`]: The `plan` parameter is not a valid handle. Handle is not valid when the plan is locked or multi-GPU restrictions are not met.
/// - [`cufftResult::CUFFT_INVALID_SIZE`]: The `nx` or `batch` parameter is not a supported size.
/// - [`cufftResult::CUFFT_INVALID_VALUE`]: One or more invalid parameters were passed to the API.
/// - [`cufftResult::CUFFT_MISSING_DEPENDENCY`]: The cuFFT library was unable to find a dependency either because it is missing or the version found is incompatible.
/// - [`cufftResult::CUFFT_NVJITLINK_FAILURE`]: nvJitLink encountered an error during planning.
/// - [`cufftResult::CUFFT_NVRTC_FAILURE`]: NVRTC encountered an error during planning.
/// - [`cufftResult_t::CUFFT_SETUP_FAILED`]`: The cuFFT library failed to initialize.
/// - [`cufftResult::CUFFT_SUCCESS`]: cuFFT successfully created the FFT plan.
pub fn cufftMakePlan1d(
plan: cufftHandle,
nx: ::core::ffi::c_int,
type_: cufftType,
batch: ::core::ffi::c_int,
workSize: *mut size_t,
) -> cufftResult;
}
unsafe extern "C" {
/// Following a call to [`cufftCreate`] makes a 2D FFT plan configuration according to specified signal sizes and data type.
///
/// This call can only be used once for a given handle. It will fail and return [`cufftResult::CUFFT_INVALID_PLAN`] if the plan is locked, i.e. the handle was previously used with a different `cufftPlan` or `cufftMakePlan` call.
///
/// If `cufftXtSetGPUs()` was called prior to this call with multiple GPUs, then `workSize` will contain multiple sizes. See sections on multiple GPUs for more details.
///
/// # Parameters
///
/// - `plan`: [`cufftHandle`] returned by [`cufftCreate`].
/// - `nx`: The transform size in the *x* dimension. This is slowest changing dimension of a transform (strided in memory). For multiple GPUs, this must be factorable into primes less than or equal to 127.
/// - `ny`: The transform size in the *y* dimension. This is fastest changing dimension of a transform (contiguous in memory). For 2 GPUs, this must be factorable into primes less than or equal to 127.
/// - `workSize`: Pointer to the size(s), in bytes, of the work areas. For example for two GPUs worksize must be declared to have two elements.
///
/// Pointer to the size(s) of the work areas.
///
/// # Return value
///
/// - [`cufftResult::CUFFT_ALLOC_FAILED`]: The allocation of GPU resources for the plan failed.
/// - [`cufftResult::CUFFT_INTERNAL_ERROR`]: An internal driver error was detected.
/// - [`cufftResult::CUFFT_INVALID_PLAN`]: The `plan` parameter is not a valid handle.
/// - [`cufftResult::CUFFT_INVALID_SIZE`]: Either or both of the `nx` or `ny` parameters is not a supported size.
/// - [`cufftResult::CUFFT_INVALID_VALUE`]: One or more invalid parameters were passed to the API.
/// - [`cufftResult::CUFFT_MISSING_DEPENDENCY`]: The cuFFT library was unable to find a dependency either because it is missing or the version found is incompatible.
/// - [`cufftResult::CUFFT_NVJITLINK_FAILURE`]: nvJitLink encountered an error during planning.
/// - [`cufftResult::CUFFT_NVRTC_FAILURE`]: NVRTC encountered an error during planning.
/// - [`cufftResult::CUFFT_SETUP_FAILED`]: The cuFFT library failed to initialize.
/// - [`cufftResult::CUFFT_SUCCESS`]: cuFFT successfully created the FFT plan.
pub fn cufftMakePlan2d(
plan: cufftHandle,
nx: ::core::ffi::c_int,
ny: ::core::ffi::c_int,
type_: cufftType,
workSize: *mut size_t,
) -> cufftResult;
}
unsafe extern "C" {
/// Following a call to [`cufftCreate`] makes a 3D FFT plan configuration according to specified signal sizes and data type. This function is the same as [`cufftPlan2d`] except that it takes a third size parameter `nz`.
///
/// This call can only be used once for a given handle. It will fail and return [`cufftResult::CUFFT_INVALID_PLAN`] if the plan is locked, i.e. the handle was previously used with a different `cufftPlan` or `cufftMakePlan` call.
///
/// If `cufftXtSetGPUs()` was called prior to this call with multiple GPUs, then `workSize` will contain multiple sizes. See sections on multiple GPUs for more details.
///
/// # Parameters
///
/// - `plan`: [`cufftHandle`] returned by [`cufftCreate`].
/// - `nx`: The transform size in the *x* dimension. This is slowest changing dimension of a transform (strided in memory). For multiple GPUs, this must be factorable into primes less than or equal to 127.
/// - `ny`: The transform size in the *y* dimension. For multiple GPUs, this must be factorable into primes less than or equal to 127.
/// - `nz`: The transform size in the *z* dimension. This is fastest changing dimension of a transform (contiguous in memory). For multiple GPUs, this must be factorable into primes less than or equal to 127.
/// - `workSize`: Pointer to the size(s), in bytes, of the work areas. For example for two GPUs worksize must be declared to have two elements.
///
/// Pointer to the size(s) of the work area(s).
///
/// # Return value
///
/// - [`cufftResult::CUFFT_ALLOC_FAILED`]: The allocation of GPU resources for the plan failed.
/// - [`cufftResult::CUFFT_INTERNAL_ERROR`]: An internal driver error was detected.
/// - [`cufftResult::CUFFT_INVALID_PLAN`]: The `plan` parameter is not a valid handle.
/// - [`cufftResult::CUFFT_INVALID_SIZE`]: One or more of the `nx`, `ny`, or `nz` parameters is not a supported size.
/// - [`cufftResult::CUFFT_INVALID_VALUE`]: One or more invalid parameters were passed to the API.
/// - [`cufftResult::CUFFT_MISSING_DEPENDENCY`]: The cuFFT library was unable to find a dependency either because it is missing or the version found is incompatible.
/// - [`cufftResult::CUFFT_NVJITLINK_FAILURE`]: nvJitLink encountered an error during planning.
/// - [`cufftResult::CUFFT_NVRTC_FAILURE`]: NVRTC encountered an error during planning.
/// - [`cufftResult::CUFFT_SETUP_FAILED`]: The cuFFT library failed to initialize.
/// - [`cufftResult::CUFFT_SUCCESS`]: cuFFT successfully created the FFT plan.
pub fn cufftMakePlan3d(
plan: cufftHandle,
nx: ::core::ffi::c_int,
ny: ::core::ffi::c_int,
nz: ::core::ffi::c_int,
type_: cufftType,
workSize: *mut size_t,
) -> cufftResult;
}
unsafe extern "C" {
/// Following a call to [`cufftCreate`] makes a FFT plan configuration of dimension `rank`, with sizes specified in the array `n`. The `batch` input parameter tells cuFFT how many transforms to configure. With this function, batched plans of 1, 2, or 3 dimensions may be created.
///
/// The [`cufftPlanMany`] API supports more complicated input and output data layouts via the advanced data layout parameters: `inembed`, `istride`, `idist`, `onembed`, `ostride`, and `odist`.
///
/// If `inembed` and `onembed` are set to `NULL`, all other stride information is ignored, and default strides are used. The default assumes contiguous data arrays.
///
/// This call can only be used once for a given handle. It will fail and return [`cufftResult::CUFFT_INVALID_PLAN`] if the plan is locked, i.e. the handle was previously used with a different `cufftPlan` or `cufftMakePlan` call.
///
/// If `cufftXtSetGPUs()` was called prior to this call with multiple GPUs, then `workSize` will contain multiple sizes. See sections on multiple GPUs for more details.
///
/// All arrays are assumed to be in CPU memory.
///
/// # Parameters
///
/// - `plan`: [`cufftHandle`] returned by [`cufftCreate`].
/// - `rank`: Dimensionality of the transform (1, 2, or 3).
/// - `n`: Array of size `rank`, describing the size of each dimension, `n\[0\]` being the size of the outermost and `n\[rank-1\]` innermost (contiguous) dimension of a transform. For multiple GPUs and rank equal to 1, the sizes must be a power of 2. For multiple GPUs and rank equal to 2 or 3, the sizes must be factorable into primes less than or equal to 127.
/// - `inembed`: Pointer of size `rank` that indicates the storage dimensions of the input data in memory, `inembed\[0\]` being the storage dimension of the outermost dimension. If set to NULL all other advanced data layout parameters are ignored.
/// - `istride`: Indicates the distance between two successive input elements in the least significant (i.e., innermost) dimension.
/// - `idist`: Indicates the distance between the first element of two consecutive signals in a batch of the input data.
/// - `onembed`: Pointer of size `rank` that indicates the storage dimensions of the output data in memory, `onembed\[0\]` being the storage dimension of the outermost dimension. If set to NULL all other advanced data layout parameters are ignored.
/// - `ostride`: Indicates the distance between two successive output elements in the output array in the least significant (i.e., innermost) dimension.
/// - `odist`: Indicates the distance between the first element of two consecutive signals in a batch of the output data.
/// - `batch`: Batch size for this transform.
/// - `workSize`: Pointer to the size(s), in bytes, of the work areas. For example for two GPUs worksize must be declared to have two elements.
///
/// Pointer to the size(s) of the work areas.
///
/// # Return value
///
/// - [`cufftResult::CUFFT_ALLOC_FAILED`]: The allocation of GPU resources for the plan failed.
/// - [`cufftResult::CUFFT_INTERNAL_ERROR`]: An internal driver error was detected.
/// - [`cufftResult::CUFFT_INVALID_PLAN`]: The `plan` parameter is not a valid handle. Handle is not valid when the plan is locked or multi-GPU restrictions are not met.
/// - [`cufftResult::CUFFT_INVALID_SIZE`]: One or more of the parameters is not a supported size.
/// - [`cufftResult::CUFFT_INVALID_VALUE`]: One or more invalid parameters were passed to the API.
/// - [`cufftResult::CUFFT_MISSING_DEPENDENCY`]: The cuFFT library was unable to find a dependency either because it is missing or the version found is incompatible.
/// - [`cufftResult::CUFFT_NVJITLINK_FAILURE`]: nvJitLink encountered an error during planning.
/// - [`cufftResult::CUFFT_NVRTC_FAILURE`]: NVRTC encountered an error during planning.
/// - [`cufftResult::CUFFT_SETUP_FAILED`]: The cuFFT library failed to initialize.
/// - [`cufftResult::CUFFT_SUCCESS`]: cuFFT successfully created the FFT plan.
pub fn cufftMakePlanMany(
plan: cufftHandle,
rank: ::core::ffi::c_int,
n: *mut ::core::ffi::c_int,
inembed: *mut ::core::ffi::c_int,
istride: ::core::ffi::c_int,
idist: ::core::ffi::c_int,
onembed: *mut ::core::ffi::c_int,
ostride: ::core::ffi::c_int,
odist: ::core::ffi::c_int,
type_: cufftType,
batch: ::core::ffi::c_int,
workSize: *mut size_t,
) -> cufftResult;
}
unsafe extern "C" {
/// Following a call to [`cufftCreate`] makes a FFT plan configuration of dimension `rank`, with sizes specified in the array `n`. The `batch` input parameter tells cuFFT how many transforms to configure. With this function, batched plans of 1, 2, or 3 dimensions may be created.
///
/// This API is identical to [`cufftMakePlanMany`] except that the arguments specifying sizes and strides are 64 bit integers. This API makes very large transforms possible. cuFFT includes kernels that use 32 bit indexes, and kernels that use 64 bit indexes. cuFFT planning selects 32 bit kernels whenever possible to avoid any overhead due to 64 bit arithmetic.
///
/// All sizes and types of transform are supported by this interface, with two exceptions. For transforms whose size exceeds 4G elements, the dimensions specified in the array `n` must be factorable into primes that are less than or equal to 127. For real to complex and complex to real transforms whose size exceeds 4G elements, the fastest changing dimension must be even.
///
/// The `cufftPlanMany64()` API supports more complicated input and output data layouts via the advanced data layout parameters: `inembed`, `istride`, `idist`, `onembed`, `ostride`, and `odist`.
///
/// If `inembed` and `onembed` are set to `NULL`, all other stride information is ignored, and default strides are used. The default assumes contiguous data arrays.
///
/// This call can only be used once for a given handle. It will fail and return [`cufftResult::CUFFT_INVALID_PLAN`] if the plan is locked, i.e. the handle was previously used with a different `cufftPlan` or `cufftMakePlan` call.
///
/// If `cufftXtSetGPUs()` was called prior to this call with multiple GPUs, then `workSize` will contain multiple sizes. See sections on multiple GPUs for more details.
///
/// All arrays are assumed to be in CPU memory.
///
/// # Parameters
///
/// - `plan`: [`cufftHandle`] returned by [`cufftCreate`].
/// - `rank`: Dimensionality of the transform (1, 2, or 3).
/// - `n`: Array of size `rank`, describing the size of each dimension. For multiple GPUs and rank equal to 1, the sizes must be a power of 2. For multiple GPUs and rank equal to 2 or 3, the sizes must be factorable into primes less than or equal to 127.
/// - `inembed`: Pointer of size `rank` that indicates the storage dimensions of the input data in memory. If set to NULL all other advanced data layout parameters are ignored.
/// - `istride`: Indicates the distance between two successive input elements in the least significant (i.e., innermost) dimension.
/// - `idist`: Indicates the distance between the first element of two consecutive signals in a batch of the input data.
/// - `onembed`: Pointer of size `rank` that indicates the storage dimensions of the output data in memory. If set to NULL all other advanced data layout parameters are ignored.
/// - `ostride`: Indicates the distance between two successive output elements in the output array in the least significant (i.e., innermost) dimension.
/// - `odist`: Indicates the distance between the first element of two consecutive signals in a batch of the output data.
/// - `batch`: Batch size for this transform.
/// - `workSize`: Pointer to the size(s), in bytes, of the work areas. For example for two GPUs worksize must be declared to have two elements.
///
/// Pointer to the size(s) of the work areas.
///
/// # Return value
///
/// - [`cufftResult::CUFFT_ALLOC_FAILED`]: The allocation of GPU resources for the plan failed.
/// - [`cufftResult::CUFFT_INTERNAL_ERROR`]: An internal driver error was detected.
/// - [`cufftResult::CUFFT_INVALID_PLAN`]: The `plan` parameter is not a valid handle. Handle is not valid when the plan is locked or multi-GPU restrictions are not met.
/// - [`cufftResult::CUFFT_INVALID_SIZE`]: One or more of the parameters is not a supported size.
/// - [`cufftResult::CUFFT_INVALID_VALUE`]: One or more invalid parameters were passed to the API.
/// - [`cufftResult::CUFFT_MISSING_DEPENDENCY`]: The cuFFT library was unable to find a dependency either because it is missing or the version found is incompatible.
/// - [`cufftResult::CUFFT_NVJITLINK_FAILURE`]: nvJitLink encountered an error during planning.
/// - [`cufftResult::CUFFT_NVRTC_FAILURE`]: NVRTC encountered an error during planning.
/// - [`cufftResult::CUFFT_SETUP_FAILED`]: The cuFFT library failed to initialize.
/// - [`cufftResult::CUFFT_SUCCESS`]: cuFFT successfully created the FFT plan.
pub fn cufftMakePlanMany64(
plan: cufftHandle,
rank: ::core::ffi::c_int,
n: *mut ::core::ffi::c_longlong,
inembed: *mut ::core::ffi::c_longlong,
istride: ::core::ffi::c_longlong,
idist: ::core::ffi::c_longlong,
onembed: *mut ::core::ffi::c_longlong,
ostride: ::core::ffi::c_longlong,
odist: ::core::ffi::c_longlong,
type_: cufftType,
batch: ::core::ffi::c_longlong,
workSize: *mut size_t,
) -> cufftResult;
}
unsafe extern "C" {
/// This call gives a more accurate estimate of the work area size required for a plan than `cufftEstimateSizeMany()`, given the specified parameters, and taking into account any plan settings that may have been made. If a work area size of 0 is returned it means no temporary storage is needed for evaluation.
///
/// This API is identical to [`cufftMakePlanMany`] except that the arguments specifying sizes and strides are 64 bit integers. This API makes very large transforms possible. cuFFT includes kernels that use 32 bit indexes, and kernels that use 64 bit indexes. cuFFT planning selects 32 bit kernels whenever possible to avoid any overhead due to 64 bit arithmetic.
///
/// All sizes and types of transform are supported by this interface, with two exceptions. For transforms whose total size exceeds 4G elements, the dimensions specified in the array `n` must be factorable into primes that are less than or equal to 127. For real to complex and complex to real transforms whose total size exceeds 4G elements, the fastest changing dimension must be even.
///
/// # Parameters
///
/// - `plan`: [`cufftHandle`] returned by [`cufftCreate`].
/// - `rank`: Dimensionality of the transform (1, 2, or 3).
/// - `n`: Array of size `rank`, describing the size of each dimension.
/// - `inembed`: Pointer of size `rank` that indicates the storage dimensions of the input data in memory. If set to NULL all other advanced data layout parameters are ignored.
/// - `istride`: Indicates the distance between two successive input elements in the least significant (i.e., innermost) dimension.
/// - `idist`: Indicates the distance between the first element of two consecutive signals in a batch of the input data.
/// - `onembed`: Pointer of size `rank` that indicates the storage dimensions of the output data in memory. If set to NULL all other advanced data layout parameters are ignored.
/// - `ostride`: Indicates the distance between two successive output elements in the output array in the least significant (i.e., innermost) dimension.
/// - `odist`: Indicates the distance between the first element of two consecutive signals in a batch of the output data.
/// - `batch`: Batch size for this transform.
/// - `workSize`: Pointer to the size(s), in bytes, of the work areas. For example for two GPUs worksize must be declared to have two elements.
///
/// Pointer to the size of the work area.
///
/// # Return value
///
/// - [`cufftResult::CUFFT_ALLOC_FAILED`]: The allocation of GPU resources for the plan failed.
/// - [`cufftResult::CUFFT_INTERNAL_ERROR`]: An internal driver error was detected.
/// - [`cufftResult::CUFFT_INVALID_PLAN`]: The `plan` parameter is not a valid handle.
/// - [`cufftResult::CUFFT_INVALID_SIZE`]: One or more of the parameters is not a supported size.
/// - [`cufftResult::CUFFT_INVALID_VALUE`]: One or more invalid parameters were passed to the API.
/// - [`cufftResult::CUFFT_SETUP_FAILED`]: The cuFFT library failed to initialize.
/// - [`cufftResult::CUFFT_SUCCESS`]: cuFFT successfully returned the size of the work space.
pub fn cufftGetSizeMany64(
plan: cufftHandle,
rank: ::core::ffi::c_int,
n: *mut ::core::ffi::c_longlong,
inembed: *mut ::core::ffi::c_longlong,
istride: ::core::ffi::c_longlong,
idist: ::core::ffi::c_longlong,
onembed: *mut ::core::ffi::c_longlong,
ostride: ::core::ffi::c_longlong,
odist: ::core::ffi::c_longlong,
type_: cufftType,
batch: ::core::ffi::c_longlong,
workSize: *mut size_t,
) -> cufftResult;
}
unsafe extern "C" {
/// During plan execution, cuFFT requires a work area for temporary storage of intermediate results. This call returns an estimate for the size of the work area required, given the specified parameters, and assuming default plan settings.
///
/// # Parameters
///
/// - `nx`: The transform size (e.g. 256 for a 256-point FFT).
/// - `batch`: Number of transforms of size `nx`. Please consider using [`cufftEstimateMany`] for multiple transforms.
/// - `workSize`: Pointer to the size, in bytes, of the work space.
///
/// Pointer to the size of the work space.
///
/// # Return value
///
/// - [`cufftResult::CUFFT_ALLOC_FAILED`]: The allocation of GPU resources for the plan failed.
/// - [`cufftResult::CUFFT_INTERNAL_ERROR`]: An internal driver error was detected.
/// - [`cufftResult::CUFFT_INVALID_SIZE`]: The `nx` parameter is not a supported size.
/// - [`cufftResult::CUFFT_INVALID_VALUE`]: One or more invalid parameters were passed to the API.
/// - [`cufftResult::CUFFT_MISSING_DEPENDENCY`]: The cuFFT library was unable to find a dependency either because it is missing or the version found is incompatible.
/// - [`cufftResult::CUFFT_NVJITLINK_FAILURE`]: nvJitLink encountered an error during planning.
/// - [`cufftResult::CUFFT_NVRTC_FAILURE`]: NVRTC encountered an error during planning.
/// - [`cufftResult::CUFFT_SETUP_FAILED`]: The cuFFT library failed to initialize.
/// - [`cufftResult::CUFFT_SUCCESS`]: cuFFT successfully returned the size of the work space.
pub fn cufftEstimate1d(
nx: ::core::ffi::c_int,
type_: cufftType,
batch: ::core::ffi::c_int,
workSize: *mut size_t,
) -> cufftResult;
}
unsafe extern "C" {
/// During plan execution, cuFFT requires a work area for temporary storage of intermediate results. This call returns an estimate for the size of the work area required, given the specified parameters, and assuming default plan settings. If a work area size of 0 is returned it means no temporary storage is needed for evaluation.
///
/// # Parameters
///
/// - `nx`: The transform size in the *x* dimension (number of rows).
/// - `ny`: The transform size in the *y* dimension (number of columns).
/// - `workSize`: Pointer to the size, in bytes, of the work space.
///
/// Pointer to the size of the work space.
///
/// # Return value
///
/// - [`cufftResult::CUFFT_ALLOC_FAILED`]: The allocation of GPU resources for the plan failed.
/// - [`cufftResult::CUFFT_INTERNAL_ERROR`]: An internal driver error was detected.
/// - [`cufftResult::CUFFT_INVALID_SIZE`]: Either or both of the `nx` or `ny` parameters is not a supported size.
/// - [`cufftResult::CUFFT_INVALID_VALUE`]: One or more invalid parameters were passed to the API.
/// - [`cufftResult::CUFFT_MISSING_DEPENDENCY`]: The cuFFT library was unable to find a dependency either because it is missing or the version found is incompatible.
/// - [`cufftResult::CUFFT_NVJITLINK_FAILURE`]: nvJitLink encountered an error during planning.
/// - [`cufftResult::CUFFT_NVRTC_FAILURE`]: NVRTC encountered an error during planning.
/// - [`cufftResult::CUFFT_SETUP_FAILED`]: The cuFFT library failed to initialize.
/// - [`cufftResult::CUFFT_SUCCESS`]: cuFFT successfully returned the size of the work space.
pub fn cufftEstimate2d(
nx: ::core::ffi::c_int,
ny: ::core::ffi::c_int,
type_: cufftType,
workSize: *mut size_t,
) -> cufftResult;
}
unsafe extern "C" {
/// During plan execution, cuFFT requires a work area for temporary storage of intermediate results. This call returns an estimate for the size of the work area required, given the specified parameters, and assuming default plan settings. If a work area size of 0 is returned it means no temporary storage is needed for evaluation.
///
/// # Parameters
///
/// - `nx`: The transform size in the *x* dimension.
/// - `ny`: The transform size in the *y* dimension.
/// - `nz`: The transform size in the *z* dimension.
/// - `workSize`: Pointer to the size, in bytes, of the work space.
///
/// Pointer to the size of the work space.
///
/// # Return value
///
/// - [`cufftResult::CUFFT_ALLOC_FAILED`]: The allocation of GPU resources for the plan failed.
/// - [`cufftResult::CUFFT_INTERNAL_ERROR`]: An internal driver error was detected.
/// - [`cufftResult::CUFFT_INVALID_SIZE`]: One or more of the `nx`, `ny`, or `nz` parameters is not a supported size.
/// - [`cufftResult::CUFFT_INVALID_VALUE`]: One or more invalid parameters were passed to the API.
/// - [`cufftResult::CUFFT_MISSING_DEPENDENCY`]: The cuFFT library was unable to find a dependency either because it is missing or the version found is incompatible.
/// - [`cufftResult::CUFFT_NVJITLINK_FAILURE`]: nvJitLink encountered an error during planning.
/// - [`cufftResult::CUFFT_NVRTC_FAILURE`]: NVRTC encountered an error during planning.
/// - [`cufftResult::CUFFT_SETUP_FAILED`]: The cuFFT library failed to initialize.
/// - [`cufftResult::CUFFT_SUCCESS`]: cuFFT successfully returned the size of the work space.
pub fn cufftEstimate3d(
nx: ::core::ffi::c_int,
ny: ::core::ffi::c_int,
nz: ::core::ffi::c_int,
type_: cufftType,
workSize: *mut size_t,
) -> cufftResult;
}
unsafe extern "C" {
/// During plan execution, cuFFT requires a work area for temporary storage of intermediate results. This call returns an estimate for the size of the work area required, given the specified parameters, and assuming default plan settings. If a work area size of 0 is returned it means no temporary storage is needed for evaluation.
///
/// The [`cufftEstimateMany`] API supports more complicated input and output data layouts via the advanced data layout parameters: `inembed`, `istride`, `idist`, `onembed`, `ostride`, and `odist`.
///
/// All arrays are assumed to be in CPU memory.
///
/// # Parameters
///
/// - `rank`: Dimensionality of the transform (1, 2, or 3).
/// - `n`: Array of size `rank`, describing the size of each dimension.
/// - `inembed`: Pointer of size `rank` that indicates the storage dimensions of the input data in memory. If set to NULL all other advanced data layout parameters are ignored.
/// - `istride`: Indicates the distance between two successive input elements in the least significant (i.e., innermost) dimension.
/// - `idist`: Indicates the distance between the first element of two consecutive signals in a batch of the input data.
/// - `onembed`: Pointer of size `rank` that indicates the storage dimensions of the output data in memory. If set to NULL all other advanced data layout parameters are ignored.
/// - `ostride`: Indicates the distance between two successive output elements in the output array in the least significant (i.e., innermost) dimension.
/// - `odist`: Indicates the distance between the first element of two consecutive signals in a batch of the output data.
/// - `batch`: Batch size for this transform.
/// - `workSize`: Pointer to the size, in bytes, of the work space.
///
/// Pointer to the size of the work space.
///
/// # Return value
///
/// - [`cufftResult::CUFFT_ALLOC_FAILED`]: The allocation of GPU resources for the plan failed.
/// - [`cufftResult::CUFFT_INTERNAL_ERROR`]: An internal driver error was detected.
/// - [`cufftResult::CUFFT_INVALID_SIZE`]: One or more of the parameters is not a supported size.
/// - [`cufftResult::CUFFT_INVALID_VALUE`]: One or more invalid parameters were passed to the API.
/// - [`cufftResult::CUFFT_MISSING_DEPENDENCY`]: The cuFFT library was unable to find a dependency either because it is missing or the version found is incompatible.
/// - [`cufftResult::CUFFT_NVJITLINK_FAILURE`]: nvJitLink encountered an error during planning.
/// - [`cufftResult::CUFFT_NVRTC_FAILURE`]: NVRTC encountered an error during planning.
/// - [`cufftResult::CUFFT_SETUP_FAILED`]: The cuFFT library failed to initialize.
/// - [`cufftResult::CUFFT_SUCCESS`]: cuFFT successfully returned the size of the work space.
pub fn cufftEstimateMany(
rank: ::core::ffi::c_int,
n: *mut ::core::ffi::c_int,
inembed: *mut ::core::ffi::c_int,
istride: ::core::ffi::c_int,
idist: ::core::ffi::c_int,
onembed: *mut ::core::ffi::c_int,
ostride: ::core::ffi::c_int,
odist: ::core::ffi::c_int,
type_: cufftType,
batch: ::core::ffi::c_int,
workSize: *mut size_t,
) -> cufftResult;
}
unsafe extern "C" {
/// Creates only an opaque handle, and allocates small data structures on the host. The `cufftMakePlan*()` calls actually do the plan generation.
///
/// # Return value
///
/// - [`cufftResult::CUFFT_ALLOC_FAILED`]: The allocation of resources for the plan failed.
/// - [`cufftResult::CUFFT_INTERNAL_ERROR`]: An internal driver error was detected.
/// - [`cufftResult::CUFFT_INVALID_VALUE`]: One or more invalid parameters were passed to the API.
/// - [`cufftResult::CUFFT_SETUP_FAILED`]: The cuFFT library failed to initialize.
/// - [`cufftResult::CUFFT_SUCCESS`]: cuFFT successfully created the FFT plan.
pub fn cufftCreate(handle: *mut cufftHandle) -> cufftResult;
}
unsafe extern "C" {
/// This call gives a more accurate estimate of the work area size required for a plan than [`cufftEstimate1d`], given the specified parameters, and taking into account any plan settings that may have been made. If a work area size of 0 is returned it means no temporary storage is needed for evaluation.
///
/// # Parameters
///
/// - `nx`: The transform size (e.g. 256 for a 256-point FFT).
/// - `batch`: Number of transforms of size `nx`. Please consider using [`cufftGetSizeMany`] for multiple transforms.
/// - `workSize`: Pointer to the size(s), in bytes, of the work areas. For example for two GPUs worksize must be declared to have two elements.
///
/// Pointer to the size of the work space.
///
/// # Return value
///
/// - [`cufftResult::CUFFT_ALLOC_FAILED`]: The allocation of GPU resources for the plan failed.
/// - [`cufftResult::CUFFT_INTERNAL_ERROR`]: An internal driver error was detected.
/// - [`cufftResult::CUFFT_INVALID_PLAN`]: The `plan` parameter is not a valid handle.
/// - [`cufftResult::CUFFT_INVALID_SIZE`]: The `nx` parameter is not a supported size.
/// - [`cufftResult::CUFFT_INVALID_VALUE`]: One or more invalid parameters were passed to the API.
/// - [`cufftResult::CUFFT_SETUP_FAILED`]: The cuFFT library failed to initialize.
/// - [`cufftResult::CUFFT_SUCCESS`]: cuFFT successfully returned the size of the work space.
pub fn cufftGetSize1d(
handle: cufftHandle,
nx: ::core::ffi::c_int,
type_: cufftType,
batch: ::core::ffi::c_int,
workSize: *mut size_t,
) -> cufftResult;
}
unsafe extern "C" {
/// This call gives a more accurate estimate of the work area size required for a plan than [`cufftEstimate2d`], given the specified parameters, and taking into account any plan settings that may have been made. If a work area size of 0 is returned it means no temporary storage is needed for evaluation.
///
/// # Parameters
///
/// - `nx`: The transform size in the *x* dimension (number of rows).
/// - `ny`: The transform size in the *y* dimension (number of columns).
/// - `workSize`: Pointer to the size(s), in bytes, of the work areas. For example for two GPUs worksize must be declared to have two elements.
///
/// Pointer to the size of the work space.
///
/// # Return value
///
/// - [`cufftResult::CUFFT_ALLOC_FAILED`]: The allocation of GPU resources for the plan failed.
/// - [`cufftResult::CUFFT_INTERNAL_ERROR`]: An internal driver error was detected.
/// - [`cufftResult::CUFFT_INVALID_PLAN`]: The `plan` parameter is not a valid handle.
/// - [`cufftResult::CUFFT_INVALID_SIZE`]: Either or both of the `nx` or `ny` parameters is not a supported size.
/// - [`cufftResult::CUFFT_INVALID_VALUE`]: One or more invalid parameters were passed to the API.
/// - [`cufftResult::CUFFT_SETUP_FAILED`]: The cuFFT library failed to initialize.
/// - [`cufftResult::CUFFT_SUCCESS`]: cuFFT successfully returned the size of the work space.
pub fn cufftGetSize2d(
handle: cufftHandle,
nx: ::core::ffi::c_int,
ny: ::core::ffi::c_int,
type_: cufftType,
workSize: *mut size_t,
) -> cufftResult;
}
unsafe extern "C" {
/// This call gives a more accurate estimate of the work area size required for a plan than [`cufftEstimate3d`], given the specified parameters, and taking into account any plan settings that may have been made. If a work area size of 0 is returned it means no temporary storage is needed for evaluation.
///
/// # Parameters
///
/// - `nx`: The transform size in the *x* dimension.
/// - `ny`: The transform size in the *y* dimension.
/// - `nz`: The transform size in the *z* dimension.
/// - `workSize`: Pointer to the size(s), in bytes, of the work areas. For example for two GPUs worksize must be declared to have two elements.
///
/// Pointer to the size of the work space.
///
/// # Return value
///
/// - [`cufftResult::CUFFT_ALLOC_FAILED`]: The allocation of GPU resources for the plan failed.
/// - [`cufftResult::CUFFT_INTERNAL_ERROR`]: An internal driver error was detected.
/// - [`cufftResult::CUFFT_INVALID_PLAN`]: The `plan` parameter is not a valid handle.
/// - [`cufftResult::CUFFT_INVALID_SIZE`]: One or more of the `nx`, `ny`, or `nz` parameters is not a supported size.
/// - [`cufftResult::CUFFT_INVALID_VALUE`]: One or more invalid parameters were passed to the API.
/// - [`cufftResult::CUFFT_SETUP_FAILED`]: The cuFFT library failed to initialize.
/// - [`cufftResult::CUFFT_SUCCESS`]: cuFFT successfully returned the size of the work space.
pub fn cufftGetSize3d(
handle: cufftHandle,
nx: ::core::ffi::c_int,
ny: ::core::ffi::c_int,
nz: ::core::ffi::c_int,
type_: cufftType,
workSize: *mut size_t,
) -> cufftResult;
}
unsafe extern "C" {
/// This call gives a more accurate estimate of the work area size required for a plan than `cufftEstimateSizeMany()`, given the specified parameters, and taking into account any plan settings that may have been made. If a work area size of 0 is returned it means no temporary storage is needed for evaluation.
///
/// # Parameters
///
/// - `rank`: Dimensionality of the transform (1, 2, or 3).
/// - `n`: Array of size `rank`, describing the size of each dimension.
/// - `inembed`: Pointer of size `rank` that indicates the storage dimensions of the input data in memory. If set to NULL all other advanced data layout parameters are ignored.
/// - `istride`: Indicates the distance between two successive input elements in the least significant (i.e., innermost) dimension.
/// - `idist`: Indicates the distance between the first element of two consecutive signals in a batch of the input data.
/// - `onembed`: Pointer of size `rank` that indicates the storage dimensions of the output data in memory. If set to NULL all other advanced data layout parameters are ignored.
/// - `ostride`: Indicates the distance between two successive output elements in the output array in the least significant (i.e., innermost) dimension.
/// - `odist`: Indicates the distance between the first element of two consecutive signals in a batch of the output data.
/// - `batch`: Batch size for this transform.
///
/// # Return value
///
/// - [`cufftResult::CUFFT_ALLOC_FAILED`]: The allocation of GPU resources for the plan failed.
/// - [`cufftResult::CUFFT_INTERNAL_ERROR`]: An internal driver error was detected.
/// - [`cufftResult::CUFFT_INVALID_PLAN`]: The `plan` parameter is not a valid handle.
/// - [`cufftResult::CUFFT_INVALID_SIZE`]: One or more of the parameters is not a supported size.
/// - [`cufftResult::CUFFT_INVALID_VALUE`]: One or more invalid parameters were passed to the API.
/// - [`cufftResult::CUFFT_SETUP_FAILED`]: The cuFFT library failed to initialize.
/// - [`cufftResult::CUFFT_SUCCESS`]: cuFFT successfully returned the size of the work space.
pub fn cufftGetSizeMany(
handle: cufftHandle,
rank: ::core::ffi::c_int,
n: *mut ::core::ffi::c_int,
inembed: *mut ::core::ffi::c_int,
istride: ::core::ffi::c_int,
idist: ::core::ffi::c_int,
onembed: *mut ::core::ffi::c_int,
ostride: ::core::ffi::c_int,
odist: ::core::ffi::c_int,
type_: cufftType,
batch: ::core::ffi::c_int,
workArea: *mut size_t,
) -> cufftResult;
}
unsafe extern "C" {
/// Once plan generation has been done, either with the original API or the extensible API, this call returns the actual size of the work area required to support the plan. Callers who choose to manage work area allocation within their application must use this call after plan generation, and after any `cufftSet*()` calls subsequent to plan generation, if those calls might alter the required work space size.
///
/// # Parameters
///
/// - `workSize`: Pointer to the size(s), in bytes, of the work areas. For example for two GPUs worksize must be declared to have two elements.
///
/// Pointer to the size of the work area.
///
/// # Return value
///
/// - [`cufftResult::CUFFT_INTERNAL_ERROR`]: An internal driver error was detected.
/// - [`cufftResult::CUFFT_INVALID_PLAN`]: The `plan` parameter is not a valid handle.
/// - [`cufftResult::CUFFT_SUCCESS`]: cuFFT successfully returned the size of the work space.
pub fn cufftGetSize(handle: cufftHandle, workSize: *mut size_t) -> cufftResult;
}
unsafe extern "C" {
/// [`cufftSetWorkArea`] overrides the work area pointer associated with a plan. If the work area was auto-allocated, cuFFT frees the auto-allocated space. The `cufftExec*()` calls assume that the work area pointer is valid and that it points to a contiguous region in device memory that does not overlap with any other work area. If this is not the case, results are indeterminate.
///
/// # Parameters
///
/// - `plan`: [`cufftHandle`] returned by [`cufftCreate`].
/// - `workArea`: Pointer to `workArea`. For multiple GPUs, multiple work area pointers must be given.
///
/// # Return value
///
/// - [`cufftResult::CUFFT_INTERNAL_ERROR`]: An internal driver error was detected.
/// - [`cufftResult::CUFFT_INVALID_PLAN`]: The `plan` parameter is not a valid handle.
/// - [`cufftResult::CUFFT_SETUP_FAILED`]: The cuFFT library failed to initialize.
/// - [`cufftResult::CUFFT_SUCCESS`]: cuFFT successfully returned the size of the work space.
pub fn cufftSetWorkArea(
plan: cufftHandle,
workArea: *mut ::core::ffi::c_void,
) -> cufftResult;
}
unsafe extern "C" {
/// [`cufftSetAutoAllocation`] indicates that the caller intends to allocate and manage work areas for plans that have been generated. cuFFT default behavior is to allocate the work area at plan generation time. If [`cufftSetAutoAllocation`] has been called with autoAllocate set to 0 (“false”) prior to one of the `cufftMakePlan*()` calls, cuFFT does not allocate the work area. This is the preferred sequence for callers wishing to manage work area allocation.
///
/// # Parameters
///
/// - `plan`: [`cufftHandle`] returned by [`cufftCreate`].
/// - `autoAllocate`: Indicates whether to allocate work area.
///
/// # Return value
///
/// - [`cufftResult::CUFFT_INTERNAL_ERROR`]: An internal driver error was detected.
/// - [`cufftResult::CUFFT_INVALID_PLAN`]: The `plan` parameter is not a valid handle.
/// - [`cufftResult::CUFFT_SUCCESS`]: cuFFT successfully returned the size of the work space.
pub fn cufftSetAutoAllocation(
plan: cufftHandle,
autoAllocate: ::core::ffi::c_int,
) -> cufftResult;
}
unsafe extern "C" {
/// [`cufftExecC2C`] ([`cufftExecZ2Z`]) executes a single-precision (double-precision) complex-to-complex transform plan in the transform direction as specified by `direction` parameter. cuFFT uses the GPU memory pointed to by the `idata` parameter as input data. This function stores the Fourier coefficients in the `odata` array. If `idata` and `odata` are the same, this method does an in-place transform.
///
/// # Parameters
///
/// - `plan`: [`cufftHandle`] returned by [`cufftCreate`].
/// - `idata`: Pointer to the complex input data (in GPU memory) to transform.
/// - `odata`: Pointer to the complex output data (in GPU memory).
///
/// ontains the complex Fourier coefficients.
/// - `direction`: The transform direction: [`CUFFT_FORWARD`] or [`CUFFT_INVERSE`].
///
/// # Return value
///
/// - [`cufftResult::CUFFT_EXEC_FAILED`]: cuFFT failed to execute the transform on the GPU.
/// - [`cufftResult::CUFFT_INTERNAL_ERROR`]: An internal driver error was detected.
/// - [`cufftResult::CUFFT_INVALID_PLAN`]: The `plan` parameter is not a valid handle.
/// - [`cufftResult::CUFFT_INVALID_VALUE`]: At least one of the parameters `idata`, `odata`, and `direction` is not valid.
/// - [`cufftResult::CUFFT_SETUP_FAILED`]: The cuFFT library failed to initialize.
/// - [`cufftResult::CUFFT_SUCCESS`]: cuFFT successfully returned the size of the work space.
pub fn cufftExecC2C(
plan: cufftHandle,
idata: *mut cufftComplex,
odata: *mut cufftComplex,
direction: ::core::ffi::c_int,
) -> cufftResult;
}
unsafe extern "C" {
/// [`cufftExecR2C`] ([`cufftExecD2Z`]) executes a single-precision (double-precision) real-to-complex, implicitly forward, cuFFT transform plan. cuFFT uses as input data the GPU memory pointed to by the `idata` parameter. This function stores the nonredundant Fourier coefficients in the `odata` array. Pointers to `idata` and `odata` are both required to be aligned to [`cufftComplex`] data type in single-precision transforms and [`cufftDoubleComplex`] data type in double-precision transforms. If `idata` and `odata` are the same, this method does an in-place transform. Note the data layout differences between in-place and out-of-place transforms as described in Parameter cufftType.
///
/// # Parameters
///
/// - `plan`: [`cufftHandle`] returned by [`cufftCreate`].
/// - `idata`: Pointer to the real input data (in GPU memory) to transform.
/// - `odata`: Pointer to the complex output data (in GPU memory).
///
/// Contains the complex Fourier coefficients.
///
/// # Return value
///
/// - [`cufftResult::CUFFT_EXEC_FAILED`]: cuFFT failed to execute the transform on the GPU.
/// - [`cufftResult::CUFFT_INTERNAL_ERROR`]: An internal driver error was detected.
/// - [`cufftResult::CUFFT_INVALID_PLAN`]: The `plan` parameter is not a valid handle.
/// - [`cufftResult::CUFFT_INVALID_VALUE`]: At least one of the parameters `idata` and `odata` is not valid.
/// - [`cufftResult::CUFFT_SETUP_FAILED`]: The cuFFT library failed to initialize.
/// - [`cufftResult::CUFFT_SUCCESS`]: cuFFT successfully returned the size of the work space.
pub fn cufftExecR2C(
plan: cufftHandle,
idata: *mut cufftReal,
odata: *mut cufftComplex,
) -> cufftResult;
}
unsafe extern "C" {
/// [`cufftExecC2R`] ([`cufftExecZ2D`]) executes a single-precision (double-precision) complex-to-real, implicitly inverse, cuFFT transform plan. cuFFT uses as input data the GPU memory pointed to by the `idata` parameter. The input array holds only the nonredundant complex Fourier coefficients. This function stores the real output values in the `odata` array. and pointers are both required to be aligned to [`cufftComplex`] data type in single-precision transforms and [`cufftDoubleComplex`] type in double-precision transforms. If `idata` and `odata` are the same, this method does an in-place transform.
///
/// # Parameters
///
/// - `plan`: [`cufftHandle`] returned by [`cufftCreate`].
/// - `idata`: Pointer to the complex input data (in GPU memory) to transform.
/// - `odata`: Pointer to the real output data (in GPU memory).
///
/// Contains the real output data.
///
/// # Return value
///
/// - [`cufftResult::CUFFT_EXEC_FAILED`]: cuFFT failed to execute the transform on the GPU.
/// - [`cufftResult::CUFFT_INTERNAL_ERROR`]: An internal driver error was detected.
/// - [`cufftResult::CUFFT_INVALID_PLAN`]: The `plan` parameter is not a valid handle.
/// - [`cufftResult::CUFFT_INVALID_VALUE`]: At least one of the parameters `idata` and `odata` is not valid.
/// - [`cufftResult::CUFFT_SETUP_FAILED`]: The cuFFT library failed to initialize.
/// - [`cufftResult::CUFFT_SUCCESS`]: cuFFT successfully executed the FFT plan.
pub fn cufftExecC2R(
plan: cufftHandle,
idata: *mut cufftComplex,
odata: *mut cufftReal,
) -> cufftResult;
}
unsafe extern "C" {
/// [`cufftExecC2C`] ([`cufftExecZ2Z`]) executes a single-precision (double-precision) complex-to-complex transform plan in the transform direction as specified by `direction` parameter. cuFFT uses the GPU memory pointed to by the `idata` parameter as input data. This function stores the Fourier coefficients in the `odata` array. If `idata` and `odata` are the same, this method does an in-place transform.
///
/// # Parameters
///
/// - `plan`: [`cufftHandle`] returned by [`cufftCreate`].
/// - `idata`: Pointer to the complex input data (in GPU memory) to transform.
/// - `odata`: Pointer to the complex output data (in GPU memory).
///
/// ontains the complex Fourier coefficients.
/// - `direction`: The transform direction: [`CUFFT_FORWARD`] or [`CUFFT_INVERSE`].
///
/// # Return value
///
/// - [`cufftResult::CUFFT_EXEC_FAILED`]: cuFFT failed to execute the transform on the GPU.
/// - [`cufftResult::CUFFT_INTERNAL_ERROR`]: An internal driver error was detected.
/// - [`cufftResult::CUFFT_INVALID_PLAN`]: The `plan` parameter is not a valid handle.
/// - [`cufftResult::CUFFT_INVALID_VALUE`]: At least one of the parameters `idata`, `odata`, and `direction` is not valid.
/// - [`cufftResult::CUFFT_SETUP_FAILED`]: The cuFFT library failed to initialize.
/// - [`cufftResult::CUFFT_SUCCESS`]: cuFFT successfully returned the size of the work space.
pub fn cufftExecZ2Z(
plan: cufftHandle,
idata: *mut cufftDoubleComplex,
odata: *mut cufftDoubleComplex,
direction: ::core::ffi::c_int,
) -> cufftResult;
}
unsafe extern "C" {
/// [`cufftExecR2C`] ([`cufftExecD2Z`]) executes a single-precision (double-precision) real-to-complex, implicitly forward, cuFFT transform plan. cuFFT uses as input data the GPU memory pointed to by the `idata` parameter. This function stores the nonredundant Fourier coefficients in the `odata` array. Pointers to `idata` and `odata` are both required to be aligned to [`cufftComplex`] data type in single-precision transforms and [`cufftDoubleComplex`] data type in double-precision transforms. If `idata` and `odata` are the same, this method does an in-place transform. Note the data layout differences between in-place and out-of-place transforms as described in Parameter cufftType.
///
/// # Parameters
///
/// - `plan`: [`cufftHandle`] returned by [`cufftCreate`].
/// - `idata`: Pointer to the real input data (in GPU memory) to transform.
/// - `odata`: Pointer to the complex output data (in GPU memory).
///
/// Contains the complex Fourier coefficients.
///
/// # Return value
///
/// - [`cufftResult::CUFFT_EXEC_FAILED`]: cuFFT failed to execute the transform on the GPU.
/// - [`cufftResult::CUFFT_INTERNAL_ERROR`]: An internal driver error was detected.
/// - [`cufftResult::CUFFT_INVALID_PLAN`]: The `plan` parameter is not a valid handle.
/// - [`cufftResult::CUFFT_INVALID_VALUE`]: At least one of the parameters `idata` and `odata` is not valid.
/// - [`cufftResult::CUFFT_SETUP_FAILED`]: The cuFFT library failed to initialize.
/// - [`cufftResult::CUFFT_SUCCESS`]: cuFFT successfully returned the size of the work space.
pub fn cufftExecD2Z(
plan: cufftHandle,
idata: *mut cufftDoubleReal,
odata: *mut cufftDoubleComplex,
) -> cufftResult;
}
unsafe extern "C" {
/// [`cufftExecC2R`] ([`cufftExecZ2D`]) executes a single-precision (double-precision) complex-to-real, implicitly inverse, cuFFT transform plan. cuFFT uses as input data the GPU memory pointed to by the `idata` parameter. The input array holds only the nonredundant complex Fourier coefficients. This function stores the real output values in the `odata` array. and pointers are both required to be aligned to [`cufftComplex`] data type in single-precision transforms and [`cufftDoubleComplex`] type in double-precision transforms. If `idata` and `odata` are the same, this method does an in-place transform.
///
/// # Parameters
///
/// - `plan`: [`cufftHandle`] returned by [`cufftCreate`].
/// - `idata`: Pointer to the complex input data (in GPU memory) to transform.
/// - `odata`: Pointer to the real output data (in GPU memory).
///
/// Contains the real output data.
///
/// # Return value
///
/// - [`cufftResult::CUFFT_EXEC_FAILED`]: cuFFT failed to execute the transform on the GPU.
/// - [`cufftResult::CUFFT_INTERNAL_ERROR`]: An internal driver error was detected.
/// - [`cufftResult::CUFFT_INVALID_PLAN`]: The `plan` parameter is not a valid handle.
/// - [`cufftResult::CUFFT_INVALID_VALUE`]: At least one of the parameters `idata` and `odata` is not valid.
/// - [`cufftResult::CUFFT_SETUP_FAILED`]: The cuFFT library failed to initialize.
/// - [`cufftResult::CUFFT_SUCCESS`]: cuFFT successfully executed the FFT plan.
pub fn cufftExecZ2D(
plan: cufftHandle,
idata: *mut cufftDoubleComplex,
odata: *mut cufftDoubleReal,
) -> cufftResult;
}
unsafe extern "C" {
/// Associates a CUDA stream with a cuFFT plan. All kernel launches made during plan execution are now done through the associated stream, enabling overlap with activity in other streams (e.g. data copying). The association remains until the plan is destroyed or the stream is changed with another call to [`cufftSetStream`].
///
/// Note that starting from CUDA 11.2 (cuFFT 10.4.0), [`cufftSetStream`] is supported on multi-GPU plans. When associating a stream with a plan, `cufftXtMemcpy()` remains synchronous across the multiple GPUs. For previous versions of cuFFT, [`cufftSetStream`] will return an error in multiple GPU plans.
///
/// Note that starting from CUDA 12.2 (cuFFT 11.0.8), on multi-GPU plans, `stream` can be associated with any context on any GPU. However, repeated calls to [`cufftSetStream`] with streams from different contexts incur a small time penalty. Optimal performance is obtained when repeated calls to [`cufftSetStream`] use streams from the same CUDA context.
///
/// # Parameters
///
/// - `plan`: The [`cufftHandle`] object to associate with the stream.
/// - `stream`: A valid CUDA stream created with `cudaStreamCreate()`; `0` for the default stream.
///
/// # Return value
///
/// - [`cufftResult::CUFFT_INVALID_PLAN`]: The `plan` parameter is not a valid handle, or plan is multi-gpu in cuFFT version prior to 10.4.0.
/// - [`cufftResult::CUFFT_SUCCESS`]: The stream was associated with the plan.
pub fn cufftSetStream(plan: cufftHandle, stream: cudaStream_t) -> cufftResult;
}
unsafe extern "C" {
/// Frees all GPU resources associated with a cuFFT plan and destroys the internal plan data structure. This function should be called once a plan is no longer needed, to avoid wasting GPU memory.
/// In the case of multi-GPU plans, the plan created first should be destroyed last.
///
/// # Parameters
///
/// - `plan`: The [`cufftHandle`] object of the plan to be destroyed.
///
/// # Return value
///
/// - [`cufftResult::CUFFT_INVALID_PLAN`]: The `plan` parameter is not a valid handle.
/// - [`cufftResult::CUFFT_SUCCESS`]: cuFFT successfully destroyed the FFT plan.
pub fn cufftDestroy(plan: cufftHandle) -> cufftResult;
}
unsafe extern "C" {
/// Returns the version number of cuFFT.
///
/// # Parameters
///
/// - `version`: Pointer to the version number.
///
/// Contains the version number.
pub fn cufftGetVersion(version: *mut ::core::ffi::c_int) -> cufftResult;
}
unsafe extern "C" {
/// Return in `*value` the number for the property described by `type` of the dynamically linked CUFFT library.
///
/// # Parameters
///
/// - `value`: Contains the integer value for the requested property.
///
/// # Return value
///
/// - [`cufftResult::CUFFT_INVALID_TYPE`]: The property type is not recognized.
/// - [`cufftResult::CUFFT_INVALID_VALUE`]: `value` is `NULL`.
/// - [`cufftResult::CUFFT_SUCCESS`]: The property value was successfully returned.
pub fn cufftGetProperty(
type_: libraryPropertyType,
value: *mut ::core::ffi::c_int,
) -> cufftResult;
}
#[repr(u32)]
#[derive(
Debug,
Copy,
Clone,
Hash,
PartialOrd,
Ord,
PartialEq,
Eq,
TryFromPrimitive,
IntoPrimitive,
)]
pub enum cufftProperty_t {
NVFFT_PLAN_PROPERTY_INT64_PATIENT_JIT = 1,
NVFFT_PLAN_PROPERTY_INT64_MAX_NUM_HOST_THREADS = 2,
}
pub use self::cufftProperty_t as cufftProperty;
unsafe extern "C" {
/// Associates a cuFFT plan with a property identified by the key `property`. The value for the property is given by value `propertyValueInt64`, which is a signed long long integer.
///
/// # Parameters
///
/// - `plan`: [`cufftHandle`] returned by [`cufftCreate`].
/// - `property`: The property identifier, of type `cufftPlanProperty`.
///
/// # Return value
///
/// - [`cufftResult::CUFFT_INVALID_PLAN`]: The `plan` parameter is not a valid handle.
/// - [`cufftResult::CUFFT_INVALID_VALUE`]: Invalid property or value with which to set the property.
/// - [`cufftResult::CUFFT_NOT_SUPPORTED`]: The property is not supported, or it cannot be set at the time (e.g. some properties cannot be set after calling a planning routine for the plan, see cuFFT Plan Properties).
/// - [`cufftResult::CUFFT_SUCCESS`]: cuFFT successfully set the property.
pub fn cufftSetPlanPropertyInt64(
plan: cufftHandle,
property: cufftProperty,
inputValueInt: ::core::ffi::c_longlong,
) -> cufftResult;
}
unsafe extern "C" {
/// Retrieves the property value identified by the key `property` associated with the cuFFT plan `plan`. The value for the property, which is a signed long long integer, is set in the address space pointed by `propertyValueInt64`.
///
/// # Parameters
///
/// - `plan`: [`cufftHandle`] returned by [`cufftCreate`].
/// - `property`: The property identifier, of type `cufftPlanProperty`.
///
/// # Return value
///
/// - [`cufftResult::CUFFT_INVALID_PLAN`]: The `plan` parameter is not a valid handle.
/// - [`cufftResult::CUFFT_INVALID_VALUE`]: Invalid property, or pointer `propertyValueInt64` is null.
/// - [`cufftResult::CUFFT_NOT_SUPPORTED`]: The property is not supported.
/// - [`cufftResult::CUFFT_SUCCESS`]: cuFFT successfully retrieved the property value.
pub fn cufftGetPlanPropertyInt64(
plan: cufftHandle,
property: cufftProperty,
returnPtrValue: *mut ::core::ffi::c_longlong,
) -> cufftResult;
}
unsafe extern "C" {
/// Resets the value of the property identified by the key `property`, associated with the cuFFT plan `plan`, to its default value.
///
/// # Parameters
///
/// - `plan`: [`cufftHandle`] returned by [`cufftCreate`].
/// - `property`: The property identifier, of type `cufftPlanProperty`.
///
/// # Return value
///
/// - [`cufftResult::CUFFT_INVALID_PLAN`]: The `plan` parameter is not a valid handle.
/// - [`cufftResult::CUFFT_INVALID_VALUE`]: Invalid property.
/// - [`cufftResult::CUFFT_NOT_SUPPORTED`]: The property is not supported for `plan`, or cannot be reset at present time (see Behavior column on cuFFT Plan Properties).
/// - [`cufftResult::CUFFT_SUCCESS`]: cuFFT successfully reset the property value.
pub fn cufftResetPlanProperty(
plan: cufftHandle,
property: cufftProperty,
) -> cufftResult;
}