High-level RAII classes for distributed FFTs.
More...
|
| namespace | shafft |
| | Abstract base class for FFT Types.
|
| |
| namespace | shafft::err |
| | Public error handling utilities for SHAFFT.
|
| |
|
| using | shafft::complexf = std::complex< float > |
| | Single-precision complex type (std::complex<float>).
|
| |
| using | shafft::complexd = std::complex< double > |
| | Double-precision complex type (std::complex<double>).
|
| |
|
| enum class | shafft::FFTDirection { shafft::FFTDirection::FORWARD
, shafft::FFTDirection::BACKWARD
} |
| | FFT transform direction (FORWARD / BACKWARD). More...
|
| |
| enum class | shafft::FFTType { shafft::FFTType::C2C
, shafft::FFTType::Z2Z
} |
| | FFT element/precision type (C2C / Z2Z). More...
|
| |
| enum class | shafft::TensorLayout { shafft::TensorLayout::CURRENT
, shafft::TensorLayout::INITIAL
, shafft::TensorLayout::REDISTRIBUTED
} |
| | Tensor layout identifier (CURRENT / INITIAL / REDISTRIBUTED). More...
|
| |
| enum class | shafft::Backend { shafft::Backend::HIPFFT
, shafft::Backend::FFTW
} |
| | FFT backend identifier (HIPFFT or FFTW). More...
|
| |
| enum class | shafft::PlanState { shafft::PlanState::UNINITIALIZED
, shafft::PlanState::CONFIGURED
, shafft::PlanState::PLANNED
} |
| | Plan lifecycle states. More...
|
| |
| enum class | shafft::Status : int {
shafft::Status::SUCCESS = 0
, shafft::Status::ERR_NULLPTR = 1
, shafft::Status::ERR_INVALID_COMM = 2
, shafft::Status::ERR_NO_BUFFER = 3
,
shafft::Status::ERR_PLAN_NOT_INIT = 4
, shafft::Status::ERR_INVALID_DIM = 5
, shafft::Status::ERR_DIM_MISMATCH = 6
, shafft::Status::ERR_INVALID_DECOMP = 7
,
shafft::Status::ERR_INVALID_FFTTYPE = 8
, shafft::Status::ERR_ALLOC = 9
, shafft::Status::ERR_BACKEND = 10
, shafft::Status::ERR_MPI = 11
,
shafft::Status::ERR_INVALID_LAYOUT = 12
, shafft::Status::ERR_SIZE_OVERFLOW = 13
, shafft::Status::ERR_NOT_IMPL = 14
, shafft::Status::ERR_INVALID_STATE = 15
,
shafft::Status::ERR_INTERNAL = 16
} |
| | Status and error codes. More...
|
| |
| enum class | shafft::DecompositionStrategy { shafft::DecompositionStrategy::MAXIMIZE_NDA
, shafft::DecompositionStrategy::MINIMIZE_NDA
} |
| | Strategy for automatic decomposition selection. More...
|
| |
| enum class | shafft::PlanType { shafft::PlanType::PLAN_ND
, shafft::PlanType::PLAN_1D
} |
| | Plan type discriminator. More...
|
| |
| enum class | shafft::TransformLayout { shafft::TransformLayout::REDISTRIBUTED
, shafft::TransformLayout::INITIAL
} |
| | Output-layout policy for forward FFT transforms. More...
|
| |
| enum class | shafft::ConfigPolicy { shafft::ConfigPolicy::AUTO_ADJUST = 0
, shafft::ConfigPolicy::EXACT = 1
} |
| | Configuration resolve policy. More...
|
| |
|
| int | shafft::configurationND (const std::vector< size_t > &size, FFTType precision, std::vector< int > &commDims, int &nda, std::vector< size_t > &subsize, std::vector< size_t > &offset, int &commSize, DecompositionStrategy strategy, size_t memLimit, MPI_Comm comm) |
| | Compute process grid and local layout for N-D distributed FFT.
|
| |
| const char * | shafft::getVersionString () noexcept |
| | Get the library version as a string (e.g., "1.1.0-alpha").
|
| |
| Status | shafft::err::mapExceptionToStatus () noexcept |
| | Map any active exception in a catch block to a Status code.
|
| |
| constexpr const char * | shafft::err::statusToString (Status s) noexcept |
| | Convert a Status code to a human-readable string.
|
| |
| constexpr const char * | shafft::err::statusToString (int code) noexcept |
| | Convert an integer status code to a human-readable string.
|
| |
| constexpr Backend | shafft::backend () noexcept |
| | Get the compile-time backend.
|
| |
| constexpr const char * | shafft::backendName () noexcept |
| | Get the backend name as a string.
|
| |
| template<typename T , typename U > |
| U | shafft::product (T *array, int ndim) |
| | Product of the first ndim elements.
|
| |
Use these classes for most applications. They manage plan lifetime automatically and provide a clean object-oriented interface.
- See also
- shafft::FFT for the abstract base class
-
shafft::FFTND for N-dimensional distributed FFTs
-
shafft::FFT1D for 1D distributed FFTs
◆ complexf
Alias for std::complex<float>. Used with FFTType::C2C transforms.
◆ complexd
Alias for std::complex<double>. Used with FFTType::Z2Z transforms.
◆ FFTDirection
Specifies whether to perform a forward or backward (inverse) FFT.
| Enumerator |
|---|
| FORWARD | Forward transform (time to frequency domain).
|
| BACKWARD | Backward/inverse transform (frequency to time domain).
|
◆ FFTType
Specifies the complex data precision for the transform.
| Enumerator |
|---|
| C2C | Single-precision complex-to-complex (float).
|
| Z2Z | Double-precision complex-to-complex (double).
|
◆ TensorLayout
Identifies the data layout at different stages of the FFT lifecycle.
| Enumerator |
|---|
| CURRENT | Current layout after most recent operation.
|
| INITIAL | Layout before any transforms.
|
| REDISTRIBUTED | User-visible post-forward redistributed layout.
|
◆ Backend
Indicates which FFT library is used at compile time.
| Enumerator |
|---|
| HIPFFT | AMD hipFFT backend for GPU execution.
|
| FFTW | FFTW backend for CPU execution.
|
◆ PlanState
| Enumerator |
|---|
| UNINITIALIZED | Default-constructed, no metadata.
|
| CONFIGURED | init() succeeded, allocSize() available.
|
| PLANNED | plan() succeeded, ready for execute().
|
◆ Status
| Enumerator |
|---|
| SUCCESS | Operation succeeded.
|
| ERR_NULLPTR | A required pointer argument was null.
|
| ERR_INVALID_COMM | Invalid or unsupported MPI communicator.
|
| ERR_NO_BUFFER | Required data/work buffer was not set.
|
| ERR_PLAN_NOT_INIT | Plan or subplan not initialized.
|
| ERR_INVALID_DIM | Invalid dimension/rank/size.
|
| ERR_DIM_MISMATCH | Dimension mismatch between inputs.
|
| ERR_INVALID_DECOMP | Invalid or unsupported slab decomposition.
|
| ERR_INVALID_FFTTYPE | Unsupported FFTType.
|
| ERR_ALLOC | Memory allocation failure.
|
| ERR_BACKEND | Local FFT backend failure.
|
| ERR_MPI | MPI failure.
|
| ERR_INVALID_LAYOUT | Layout parameters don't match expected distribution.
|
| ERR_SIZE_OVERFLOW | Size exceeds INT_MAX.
|
| ERR_NOT_IMPL | Feature not yet implemented.
|
| ERR_INVALID_STATE | Operation not valid in current plan state.
|
| ERR_INTERNAL | Uncategorized internal error.
|
◆ DecompositionStrategy
| Enumerator |
|---|
| MAXIMIZE_NDA | Maximize distributed axes.
|
| MINIMIZE_NDA | Minimize distributed axes.
|
◆ PlanType
| Enumerator |
|---|
| PLAN_ND | N-dimensional distributed FFT plan.
|
| PLAN_1D | 1-dimensional distributed FFT plan
|
◆ TransformLayout
| Enumerator |
|---|
| REDISTRIBUTED | Keep post-forward redistributed layout (no final redistribution).
|
| INITIAL | Restore initial layout after forward transform.
|
◆ ConfigPolicy
| Enumerator |
|---|
| AUTO_ADJUST | Adjust hints using fallback logic (default; zero-init safe).
|
| EXACT | Fail if hints cannot be satisfied exactly.
|
◆ configurationND()
| int shafft::configurationND |
( |
const std::vector< size_t > & |
size, |
|
|
FFTType |
precision, |
|
|
std::vector< int > & |
commDims, |
|
|
int & |
nda, |
|
|
std::vector< size_t > & |
subsize, |
|
|
std::vector< size_t > & |
offset, |
|
|
int & |
commSize, |
|
|
DecompositionStrategy |
strategy, |
|
|
size_t |
memLimit, |
|
|
MPI_Comm |
comm |
|
) |
| |
Fallback order: commDims (if fully specified) -> nda -> strategy.
- Parameters
-
| size | Global tensor dimensions. |
| precision | FFT precision (C2C or Z2Z). |
| commDims | Process grid [in/out]; zeros = auto. |
| nda | Distributed axes [in/out]; 0 = auto. |
| [out] | subsize | Local extent per axis. |
| [out] | offset | Global offset per axis. |
| [out] | commSize | Active rank count. |
| strategy | Fallback: MAXIMIZE_NDA or MINIMIZE_NDA. |
| memLimit | Per-rank memory limit in bytes (0 = unlimited). |
| comm | MPI communicator. |
- Returns
- 0 on success, non-zero on error.
- Examples
- example.cpp, and example_portable.cpp.
◆ getVersionString()
| const char * shafft::getVersionString |
( |
| ) |
|
|
inlinenoexcept |
◆ mapExceptionToStatus()
| Status shafft::err::mapExceptionToStatus |
( |
| ) |
|
|
inlinenoexcept |
This function must be called from within a catch block. It rethrows the current exception and maps it to an appropriate Status code.
- Returns
- Status::ERR_ALLOC for std::bad_alloc, Status::ERR_INTERNAL otherwise.
◆ statusToString() [1/2]
| constexpr const char * shafft::err::statusToString |
( |
Status |
s | ) |
|
|
constexprnoexcept |
- Parameters
-
- Returns
- A null-terminated string representing the status.
◆ statusToString() [2/2]
| constexpr const char * shafft::err::statusToString |
( |
int |
code | ) |
|
|
constexprnoexcept |
- Parameters
-
| code | The integer status code. |
- Returns
- A null-terminated string representing the status.
◆ backend()
| constexpr Backend shafft::backend |
( |
| ) |
|
|
constexprnoexcept |
◆ backendName()
| constexpr const char * shafft::backendName |
( |
| ) |
|
|
constexprnoexcept |
Returns a human-readable name for the compile-time backend.
- Returns
- "hipFFT" or "FFTW".
◆ product()
template<typename T , typename U >
| U shafft::product |
( |
T * |
array, |
|
|
int |
ndim |
|
) |
| |
- Template Parameters
-
| T | Input element type. |
| U | Accumulator/return type. |
- Parameters
-
| array | Pointer to at least ndim elements. |
| ndim | Number of elements to multiply. |
- Returns
- Product cast to U.