Quick Installation Guide#

The cuFFTDx library is distributed as a part of the MathDx package. To download the most recent release of the MathDx package including cuFFTDx go to the https://developer.nvidia.com/cufftdx-downloads website.

Note

MathDx package contains:

  • cuBLASDx for selected linear algebra functions like General Matrix Multiplication (GEMM),

  • cuFFTDx for FFT calculations,

  • cuSolverDx for selected dense matrix factorization and solve routines,

  • cuRANDDx for random number generation.

MathDx libraries are designed to work together in a single project.

Note that for a project where multiple device extensions libraries are used all the libraries must come from the same MathDx release. Examples of such fusion are included in the package.

cuFFTDx In Your Project#

cuFFTDx is a header-only library, thus to use it users just need to the include the directory with cufftdx.hpp and commonDx into their compilation commands. All other requirements are listed in the Requirements section. The easiest way is to use the MathDx include directory:

nvcc -std=c++17 -arch sm_XY (...) -I<mathdx_include_dir> <your_source_file>.cu -o <your_binary>

When you unpack MathDx YY.MM package tarball into in <your_directory>, cufftdx.hpp file will be available at the following locations:

  • <your_directory>/nvidia/mathdx/yy.mm/include/

You can review Makefile shipped alongside cuFFTDx examples to check how they are compiled.

Note

Since version 1.2.1 cuFFTDx has indirect dependency on CUTLASS library. If no other Dx library is used, the dependency can be disabled by defining CUFFTDX_DISABLE_CUTLASS_DEPENDENCY macro. Defining CUFFTDX_DISABLE_CUTLASS_DEPENDENCY if other Dx libraries are used can lead to compilation errors. Since cuFFTDx 1.3.0, due to version incompatibilities, it is recommended to disable the dependency when using CUDA toolkits with versions earlier than 11.4.

Note

Since version 1.3.0 cuFFTDx provides a way to optimize the final binary size for user projects. This works by linking all executables to a shared object with pre-calculated constants required for FFT calculations thus sharing them between translation units. It is especially recommended when including a large number of translation units (.cu source files) with cuFFTDx kernels in an executable. To compile with this new optimization it’s enough to add -DCUFFTDX_USE_SEPARATE_TWIDDLES -rtc=true to the compilation command as well as including <mathdx_dir>/src/cufftdx/lut.cu to be compiled.

nvcc -DCUFFTDX_USE_SEPARATE_TWIDDLES -std=c++17 -arch sm_XY (...) -rtc=true -I<mathdx_include_dir> <cufftdx_include_dir>/liblut/lut.cu <your_source_file>.cu <mathdx_include_dir> -o <your_binary>

The Makefile included alongside cuFFTDx examples contains these additional compilation flags. The following command will build the examples with this optimization.

make all_twiddles

cuFFTDx In Your CMake Project#

The MathDx package provides configuration files that simplify using cuFFTDx in other CMake projects. After finding mathdx using find_package, users have to link mathdx::cufftdx to their target. This propagates the include directory cufftdx_INCLUDE_DIRS, the mathdx::commondx dependency, and the C++17 requirement to their target.

find_package(mathdx REQUIRED COMPONENTS cufftdx CONFIG)
target_link_libraries(YourProgram mathdx::cufftdx)

You can pass the path to MathDx package using PATHS option:

find_package(mathdx REQUIRED COMPONENTS cufftdx CONFIG PATHS "<your_directory>/nvidia/mathdx/yy.mm/")

Alternatively, you can set mathdx_ROOT during cmake configuration of your project:

cmake -Dmathdx_ROOT="<your_directory>/nvidia/mathdx/yy.mm/" (...)

Note

Since version 1.2.1 cuFFTDx has indirect dependency on CUTLASS library. If no other Dx library is used, the dependency can be disabled by adding set(mathdx_cufftdx_DISABLE_CUTLASS TRUE) before find_package(...). Disabling the dependency on CUTLASS if other Dx libraries are used can lead to compilation errors.

Note

Since version 1.3.0 a new target is provided that allows the optimization of the final binary size when including cuFFTDx. This works by linking all executables to a shared object with pre-calculated constants required for FFT calculations thus sharing them between translation units. It is especially recommended when including a large number of translation units (.cu source files) with cuFFTDx kernels in an executable. You have to set the architectures for compilation of that target by adding set(cufftdx_SEPARATE_TWIDDLES_CUDA_ARCHITECTURES <your cuda architectures>) or setting the default variable CMAKE_CUDA_ARCHITECTURES, for example, set(cufftdx_SEPARATE_TWIDDLES_CUDA_ARCHITECTURES 90-real). It must be made set before find_package(...) is performed. Also, as a separate object file is created for the pre-calculated values, your executable target should enable cuda separable compilation: set_property(TARGET YourProgram PROPERTY CUDA_SEPARABLE_COMPILATION ON).

set(cufftdx_SEPARATE_TWIDDLES_CUDA_ARCHITECTURES YourChosenArchitecture)
find_package(mathdx REQUIRED COMPONENTS cufftdx CONFIG)
target_link_libraries(YourProgram mathdx::cufftdx_separate_twiddles_lut)
set_property(TARGET YourProgram PROPERTY CUDA_SEPARABLE_COMPILATION ON)

Defined Variables#

mathdx_cufftdx_FOUND, cufftdx_FOUND

True if cuFFTDx was found.

cufftdx_INCLUDE_DIRS

cuFFTDx include directories.

mathdx_INCLUDE_DIRS

MathDx include directories.

mathdx_cutlass_INCLUDE_DIR

CUTLASS include directory.

mathdx_VERSION

MathDx package version number in X.Y.Z format.

cuFFTDx_VERSION

cuFFTDx version number in X.Y.Z format.

MathDx/cuFFTDx version matrix

MathDx

cuFFTDx

22.02

1.0.0

22.11

1.1.0

24.01

1.1.1

24.04

1.2.0

24.08

1.2.1

25.01

1.3.0

1.3.1

1.3.1