makeFactory()#

#include <hpk/fft/makeFactory.hpp>

This header provides the function makeFactory() for making a concrete factory. Constants useful to those wishing to dynamically load shared objects with dlopen() are also defined.

See Also:

MACRO DEFINITION

LIBHPK_MAJOR_VERSION_C_STR "0"#

The major version of this release of the Hpk library, as a C string.


CONSTANTS

constexpr char hpk::fft::avx2_fp32_so[] = "libhpk_fft_avx2_fp32.so.0"#

Library filename for AVX2 shared object supporting 32 bit precision.

constexpr char hpk::fft::avx2_fp64_so[] = "libhpk_fft_avx2_fp64.so.0"#

Library filename for AVX2 shared object supporting 64 bit precision.

constexpr char hpk::fft::avx512_fp16_so[] = "libhpk_fft_avx512_fp16.so.0"#

Library filename for AVX512_FP16 shared object supporting 16 bit precision.

constexpr char hpk::fft::avx512_fp32_so[] = "libhpk_fft_avx512_fp32.so.0"#

Library filename for AVX512 shared object supporting 32 bit precision.

constexpr char hpk::fft::avx512_fp64_so[] = "libhpk_fft_avx512_fp64.so.0"#

Library filename for AVX512 shared object supporting 64 bit precision.

constexpr char hpk::fft::sve256_fp16_so[] = "libhpk_fft_sve256_fp16.so.0"#

Library filename for SVE256 shared object supporting 16 bit precision.

constexpr char hpk::fft::sve256_fp32_so[] = "libhpk_fft_sve256_fp32.so.0"#

Library filename for SVE256 shared object supporting 32 bit precision.

constexpr char hpk::fft::sve256_fp64_so[] = "libhpk_fft_sve256_fp64.so.0"#

Library filename for SVE256 shared object supporting 64 bit precision.

constexpr char hpk::fft::iomp_so[] = "libhpk_fft_iomp.so.0"#

Library filename for shared object utilizing Intel’s OpenMP library.

constexpr char hpk::fft::omp_so[] = "libhpk_fft_omp.so.0"#

Library filename for shared object utilizing LLVM’s OpenMP library.


FUNCTION

template<typename math_t, typename time_t = add_complex_t<math_t>, typename freq_t = add_complex_t<math_t>, typename ...Handles>
auto hpk::fft::makeFactory(const Configuration &cfg = Configuration(), Handles... handles)#

Makes a concrete instance of an hpk::fft::Factory.

The first template parameter must be specified. It is the floating point math type used for FFT computations and it is the type of the scale factor if scaling is later applied. (If math_t is complex, std::complex will be removed from the type.)

The second and third template parameters, which specify the data type in the time domain and frequency domain respectively, default to the complex number type of the first template parameter. Therefore, if only the first template parameter is specified, the factory will make FFTs that compute complex-to-complex transforms.

Examples:

// Single precision, complex time domain, complex freq domain
auto factory1 = hpk::fft::makeFactory<float>();

// As above, but uses the AVX2 library regardless of AVX512 presence.
// Moreover, this factory will be owned by a shared_ptr, and so copies
// can be made (e.g., using the shared_ptr copy constructor).
std::shared_ptr factory2 =
        hpk::fft::makeFactory<float>({hpk::Architecture::avx2});

// As above, and also single-threaded.
hpk::Configuration cfg{hpk::Architecture::avx2,
                       {hpk::Parameter::threads, 1}};
std::shared_ptr factory3 = hpk::fft::makeFactory<float>(cfg);

// Double precision, real time domain, complex freq domain
std::unique_ptr factory4 =
        hpk::fft::makeFactory<double, double, std::complex<double>>();

// Since freq_t defaults to complex, the following is exactly the same
// as factory4.  Although factory5 requires fewer keystrokes, it is
// probably less readable.
auto factory5 = hpk::fft::makeFactory<double, double>();

Parameters:
  • cfg – Optionally provides a Configuration instance specifying parameters and values.

  • handles – Optionally provides dynamic shared object handles as returned by dlopen().

Returns:

std::unique_ptr that owns a Factory or, in case of failure, is empty.