Skip to content

Introduce standalone SkalaXC with ABI-isolated CPU, CUDA, MPI, and language bindings - #129

Draft
Jens (JensWehner) wants to merge 108 commits into
mainfrom
gauxc_migration
Draft

Introduce standalone SkalaXC with ABI-isolated CPU, CUDA, MPI, and language bindings#129
Jens (JensWehner) wants to merge 108 commits into
mainfrom
gauxc_migration

Conversation

@JensWehner

@JensWehner Jens (JensWehner) commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR introduces SkalaXC, a standalone C++17 shared library for evaluating Skala exchange-correlation functionals. It reuses GauXC’s lower-level numerical infrastructure while keeping GauXC, LibTorch, Eigen, and other implementation dependencies behind a stable, ABI-isolated public boundary.

The change also replaces the previous GauXC integration examples and Python export tooling with maintained C++, C, Fortran, and Python SkalaXC interfaces, dedicated packaging, and comprehensive CI coverage.

Standalone SkalaXC library

  • Adds host-side UKS evaluation for:
    • XC energy
    • scalar and spin-density XC potentials
    • XC nuclear gradients
  • Loads and owns the selected TorchScript model for the lifetime of each integrator.
  • Uses GauXC’s grid, load-balancing, collocation, molecular-weight, and local-work infrastructure.
  • Keeps model features, derivative propagation, matrix assembly, and Skala-specific transformations within SkalaXC.

Public APIs and ABI isolation

  • Adds C++, C, and Fortran interfaces.
  • Adds a nanobind-based Python binding.
  • Keeps public matrices column-major and uses caller-owned output buffers at the C and Fortran boundaries.
  • Embeds private dependencies and restricts exported symbols through hidden visibility, linker export maps, and archive exclusion.

Host, MPI, and CUDA execution

  • Adds OpenMP-parallel host evaluation.
  • Assigns complete atomic grid domains to MPI ranks and performs only final result reductions.
  • Broadcasts model archive bytes from communicator rank zero so only that rank needs filesystem access to the model.
  • Adds optional CUDA kernels and device-side feature, potential, and gradient orchestration.

CUDA and host-compiler compatibility

  • Separates the CUDA build toolchains from unrestricted CPU toolchains.
  • Locks the currently validated combinations:
    • CUDA 12.8/12.9 with GCC 14
    • CUDA 13.x with GCC 15
    • CUDA 13.x with Clang 20
  • Constrains cuda-compiler to the same major family as the CUDA headers and runtime libraries, preventing mixed CUDA 12 headers with CUDA 13 nvcc.- Applies a temporary Clang compatibility patch to a generated build-tree copy of GauXC’s grid_to_center.cu, removing the C++17-invalid register specifier without modifying the pinned GauXC submodule.

Packaging and dependency management

  • Adds Pixi environments for host, MPI, CUDA 12, CUDA 13, Clang, packaging, and development tools.
  • Adds a Rattler Build split-package recipe producing:
    • libskalaxc
    • skalaxc-fortran
    • skalaxc-python
  • Keeps CUDA 12 and CUDA 13 in separate custom Pixi platform solutions.
  • Bundles the validated baseline and Skala model archives.
  • Adds relocatable CMake package metadata and separate core/full installation components.

Testing and CI

  • Adds Catch2 unit and integration coverage for:
    • model loading and reuse
    • host and CUDA evaluation
    • LDA, PBE, and TPSS behavior
    • matrix views and reordering
    • spin transformations
    • gradients
    • diagnostics
    • OpenMP stress behavior
    • MPI subcommunicators
  • Adds black-box C++, C, and Fortran API tests.
  • Adds CPU and GPU parity tests against the existing PySCF/GPU4PySCF implementations.
  • Adds ABI checks for exported symbols and public consumer dependencies.
  • Adds sanitizer, Clang release, clang-tidy, Doxygen, host, MPI, CUDA, and package workflows.

Documentation and examples

  • Adds comprehensive architecture, build, API, diagnostics, threading, MPI, CUDA, and packaging documentation.
  • Adds minimal public API examples for C++, C, and Fortran.
  • Updates the LibTorch and FTorch examples to use the revised model and interface contracts.
  • Updates repository-level installation and model-card references.

Legacy cleanup

  • Removes the old gauxc Python export package, duplicated GauXC documentation, and external integration examples.
  • Replaces the old GauXC example workflow with dedicated SkalaXC workflows.
  • Keeps GauXC as a pinned source-tree implementation dependency under SkalaXC rather than exposing or modifying GauXC’s public API.

@JensWehner
Jens (JensWehner) force-pushed the gauxc_migration branch 2 times, most recently from ef41033 to 5277ab5 Compare August 26, 2026 11:43
Base automatically changed from restructure to main August 27, 2026 07:22
@JensWehner Jens (JensWehner) changed the title Gauxc migration Introduce standalone SkalaXC with ABI-isolated CPU, CUDA, MPI, and language bindings Aug 28, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename file

with:
name: ${{ matrix.package }}-pkg
path: dist/
- name: Publish distribution to PyPI

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert this deletion

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-format only.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

format only

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

format only

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

format only.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename to .cpp

@@ -0,0 +1,575 @@
#include <nanobind/nanobind.h>
#include <nanobind/ndarray.h>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nanobind has an eigen header that should be a lot easier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant