Other Methods#

(online) LTO Database Creation#

cufftdx::utils::get_database_and_ltoir() returns a tuple containing:

  • Database string (std::string) to be inserted into the cuFFTDx headers.

  • Vector of LTOIRs (std::vector<std::vector<char>>) for building device functions for the specified FFT operation.

  • Required CUDA block dimensions (Dim3) for executing the FFT operation.

  • Required shared memory size (unsigned, in bytes) for executing the FFT operation.

std::tuple<std::string, std::vector<std::vector<char>>, Dim3, unsigned>
cufftdx::utils::get_database_and_ltoir(unsigned fft_size,
                                       cufftDescriptionDirection dir,
                                       cufftDescriptionType type,
                                       unsigned sm,
                                       cufftDescriptionExecOp op,
                                       cufftDescriptionPrecision prec = CUFFT_DESC_SINGLE,
                                       cufftDescriptionRealMode rmode = CUFFT_DESC_NORMAL,
                                       unsigned fft_ept = 0 /* use heuristic */,
                                       unsigned ffts_per_block = 1 /* 0: use suggested ffts_per_block */);

For definitions of each input parameter, see cufftDescriptionTrait.

Example

// Assuming the following FFT operator is defined in the NVRTC-compiled code:
// using FFT = decltype(cufftdx::Block() +
//                      cufftdx::Size<128>() +
//                      cufftdx::Type<cufftdx::fft_type::c2c>() +
//                      cufftdx::Direction<cufftdx::fft_direction::forward>() +
//                      cufftdx::Precision<float>() +
//                      cufftdx::ElementsPerThread<8>() +
//                      cufftdx::FFTsPerBlock<2>() +
//                      cufftdx::SM<700>());

// You can get the database string and LTOIRs for the FFT operation by calling:
auto [lto_db, ltoirs, block_dim, sm_size] =
   cufftdx::utils::get_database_and_ltoir(128,
                                          CUFFT_DESC_FORWARD,
                                          CUFFT_DESC_C2C,
                                          700,
                                          CUFFT_DESC_BLOCK,
                                          CUFFT_DESC_SINGLE,
                                          CUFFT_DESC_NORMAL,
                                          8,
                                          2);

After obtaining the database string and LTOIRs, you can insert the database string into the cuFFTDx header file and link the LTOIRs to the user code as shown in Use Case II: Online Kernel Generation.

Note

The cufftdx::utils::get_database_and_ltoir() function is a wrapper around cuFFT Device APIs (see cuFFT Device API Reference). To use this function:

  1. Define CUFFTDX_ENABLE_CUFFT_DEPENDENCY.

  2. Link against the cuFFT library.