Quick Installation Guide#

cuBLASDx is distributed as a part of the MathDx package. To download the most recent release of the MathDx package including cuBLASDx, go to the https://developer.nvidia.com/cublasdx-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.

cuBLASDx In Your Project#

cuBLASDx is a header-only library. To leverage it users just need to include the directories with cublasdx.hpp and its dependencies commonDx and CUTLASS, which are shipped with the MathDx package, into their compilation commands. All exact requirements are listed in the Requirements section.

The easiest way is to use the MathDx and CUTLASS include directories:

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

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

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

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

The commonDx headers will be available at the following location:

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

The CUTLASS headers will be available at the following location:

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

cuBLASDx In Your CMake Project#

The MathDx package provides configuration files that simplify using cuBLASDx in other CMake projects. After finding mathdx using find_package, users have to link mathdx::cublasdx to their target. This propagates the include directory cublasdx_INCLUDE_DIRS, both dependencies - commonDx and CUTLASSS, and the C++17 requirement to their target.

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

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

find_package(mathdx REQUIRED COMPONENTS cublasdx 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/" (...)

Using Custom CUTLASS#

It’s possible to use CUTLASS other than the one shipped with MathDx package as long as the version meets the requirements listed in the Requirements section. It can be done in two ways:

  1. Define NvidiaCutlass_ROOT cmake variable or environment variable pointing to the directory with installed CUTLASS. This will allow MathDx to find NvidiaCutlass package.

  2. Define mathdx_CUTLASS_ROOT cmake variable or environment variable pointing to the directory with CUTLASS headers.

Defined Variables#

mathdx_cublasdx_FOUND, cublasdx_FOUND

True if cuBLASDx was found.

cublasdx_INCLUDE_DIRS

cuBLASDx include directories.

mathdx_cutlass_INCLUDE_DIR, cublasdx_cutlass_INCLUDE_DIR

CUTLASS include directory.

mathdx_INCLUDE_DIRS

MathDx include directories.

mathdx_VERSION

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

cublasdx_VERSION

cuBLASDx version number in X.Y.Z format.

MathDx/cuBLASDx version matrix

MathDx

cuBLASDx

23.07

0.1.0

24.08

0.2.0

25.01

0.3.0