CMake Configuration Options#

This section provides an overview of the available CMake configuration options for building GauXC with Skala support, as well as the required dependencies for each configuration.

GauXC dependencies#

The following dependencies are required for building GauXC with Skala support:

  • C/C++ compiler (with C++17 support)

  • CMake (version 3.20 or higher)

  • exchcxx* (version 1 or higher)

  • libxc* (version 7 or higher)

  • integratorxx* (version 1 or higher)

  • gau2grid* (version 2.0.6 or higher)

  • libtorch (CPU or CUDA version depending on your configuration)

  • nlohmann_json* (version 3.9.1 or higher)

  • BLAS library (like OpenBLAS, MKL, etc.)

When building with Fortran support via GAUXC_ENABLE_FORTRAN (default off), a Fortran compiler is also required.

When building with MPI support via GAUXC_ENABLE_MPI (default off), the following dependencies are also required:

  • MPI implementation (like OpenMPI, MPICH, etc.)

When building with CUDA support via GAUXC_ENABLE_CUDA (default off), the following dependencies are also required:

When building with HDF5 support via GAUXC_ENABLE_HDF5 (default on), the following dependencies are also required:

All libraries marked with a * can be automatically fetched by the GauXC build system and do not need to be installed manually.

Available configurations for CMake build#

GAUXC_ENABLE_OPENMP#

Enable OpenMP support in GauXC (default: ON)

GAUXC_ENABLE_MPI#

Enable MPI support in GauXC (default: OFF)

GAUXC_ENABLE_ONEDFT#

Enable Skala support in GauXC (default: OFF)

GAUXC_ENABLE_CUDA#

Enable CUDA support in GauXC (default: OFF) Requires ExchCXX to be built with CUDA support as well (EXCHCXX_ENABLE_CUDA CMake option). Cannot be enabled with HIP support at the same time.

GAUXC_ENABLE_HIP#

Enable HIP support in GauXC (default: OFF) Requires ExchCXX to be built with HIP support as well (EXCHCXX_ENABLE_HIP CMake option). Cannot be enabled with CUDA support at the same time.

GAUXC_ENABLE_C#

Enable C bindings for GauXC (default: OFF)

GAUXC_ENABLE_FORTRAN#

Enable Fortran bindings for GauXC (default: OFF) Requires Fortran compiler and GAUXC_ENABLE_C to be enabled as well.

GAUXC_ENABLE_TESTS#

Enable building of GauXC tests (default: ON) Requires catch2 library to be installed and available.

GAUXC_ENABLE_HDF5#

Enable HDF5 support in GauXC (default: ON) Requires HDF5 library and HighFive library to be installed and available.

GAUXC_ENABLE_MAGMA#

Enable MAGMA support in GauXC (default: OFF) Requires MAGMA library to be installed and available. Requires CUDA or HIP support to be enabled as well.

GAUXC_ENABLE_NCCL#

Enable NCCL support in GauXC (default: OFF) Requires NCCL library to be installed and available. Requires CUDA support to be enabled as well.

GAUXC_ENABLE_CUTLASS#

Enable CUTLASS support in GauXC (default: OFF) Requires CUTLASS library to be installed and available. Requires CUDA support to be enabled as well.

GAUXC_ENABLE_GAU2GRID#

Enable Gau2Grid support in GauXC (default: ON) Always enabled since Gau2Grid is a required dependency for GauXC.

EXCHCXX_ENABLE_CUDA#

Enable CUDA support in ExchCXX (default: OFF) Required for GauXC CUDA support. Cannot be enabled with HIP support at the same time.

EXCHCXX_ENABLE_HIP#

Enable HIP support in ExchCXX (default: OFF) Required for GauXC HIP support. Cannot be enabled with CUDA support at the same time.

Integrating GauXC into your build system#

Using an installed GauXC#

To integrate GauXC into your build system, you can use CMake’s find_package command to locate the GauXC package and link against it in your CMakeLists.txt file. Make sure that the CMAKE_PREFIX_PATH variable includes the path to your GauXC installation (e.g., ${CONDA_PREFIX} if installed via Conda).

find_package(gauxc CONFIG REQUIRED)

if(NOT GAUXC_HAS_ONEDFT)
  message(FATAL_ERROR "GauXC found but Skala/OneDFT was not enabled during the build")
endif()

target_link_libraries(my_dft_driver PRIVATE gauxc::gauxc)

The imported target propagates include directories, compile definitions, and linkage against BLAS, Torch, and optional MPI/CUDA components.

Note

Use the provided CMake variables like GAUXC_HAS_ONEDFT to check for specific features or configurations in GauXC before linking against it.

Embedding GauXC via FetchContent#

If you need to vendor GauXC directly from your build, use FetchContent while mirroring the options chosen above. A possible approach for fetching GauXC with Skala support during the CMake configuration step is shown below.

cmake/skala-gauxc.cmake#
if(NOT DEFINED Skala_GauXC_URL)
  include(skala-dep-versions)
endif()
find_package(gauxc QUIET CONFIG)
if(NOT gauxc_FOUND)
  include(FetchContent)

  message(STATUS "Could not find GauXC... Building GauXC from source")
  message(STATUS "GAUXC URL: ${Skala_GauXC_URL}")

  set(GAUXC_ENABLE_ONEDFT ON CACHE BOOL "" FORCE)
  set(GAUXC_ENABLE_TESTS OFF CACHE BOOL "" FORCE)
  set(GAUXC_ENABLE_HDF5 ON CACHE BOOL "" FORCE)
  set(GAUXC_ENABLE_OPENMP ${Skala_GauXC_ENABLE_OPENMP} CACHE BOOL "" FORCE)
  set(GAUXC_ENABLE_MPI ${Skala_GauXC_ENABLE_MPI} CACHE BOOL "" FORCE)
  set(GAUXC_ENABLE_CUDA ${Skala_GauXC_ENABLE_CUDA} CACHE BOOL "" FORCE)

  FetchContent_Declare(
    gauxc
    URL ${Skala_GauXC_URL}
    URL_HASH SHA256=${Skala_GauXC_SHA256}
    DOWNLOAD_EXTRACT_TIMESTAMP ON
  )
  FetchContent_MakeAvailable(gauxc)

endif()
if(NOT GAUXC_HAS_ONEDFT)
  message(FATAL_ERROR "GauXC found but without Skala support enabled")
endif()
if(NOT GAUXC_HAS_HDF5)
  message(FATAL_ERROR "GauXC found but without HDF5 support enabled")
endif()
if(Skala_GauXC_ENABLE_OPENMP AND NOT GAUXC_HAS_OPENMP)
  message(FATAL_ERROR "GauXC found without OpenMP support but Skala_GauXC_ENABLE_OPENMP is ON")
endif()
if(Skala_GauXC_ENABLE_MPI AND NOT GAUXC_HAS_MPI)
  message(FATAL_ERROR "GauXC found without MPI support but Skala_GauXC_ENABLE_MPI is ON")
endif()
if(Skala_GauXC_ENABLE_CUDA AND NOT GAUXC_HAS_CUDA)
  message(FATAL_ERROR "GauXC found without CUDA support but Skala_GauXC_ENABLE_CUDA is ON")
endif()

It is recommended to define the GauXC source URL with its SHA256 hash in a separate CMake file (e.g., skala-gauxc-versions.cmake).

cmake/skala-dep-versions.cmake#
set(Skala_GauXC_URL "https://github.com/microsoft/skala/releases/download/v1.1.1/gauxc-skala-r1.tar.gz")
set(Skala_GauXC_SHA256 "01f8856502e136281b0837f5d19973f02e32e2f0c97561a5bb42962344e0f944")

In the main CMakeLists.txt, include the version definitions and the GauXC fetching logic.

include(cmake/skala-gauxc.cmake)

target_link_libraries(my_dft_driver PRIVATE gauxc::gauxc)