Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
2d1a6fb
v4.1 (#622)
TysonRayJones May 28, 2025
4d44ec8
post v4.1
TysonRayJones May 28, 2025
9d7618d
v4.2 (#692)
TysonRayJones Oct 14, 2025
eb8b64a
feat: add Qureg checkpointing via ADIOS2 (#747)
ashmitjsg Jun 4, 2026
fdec5e1
Adding adios2 download to CMake
TysonRayJones Jun 5, 2026
acfd187
Trigger checkpoint tests
TysonRayJones Jun 5, 2026
adf6427
fix: route checkpointing flag through config.h (QUEST_COMPILE_CHECKPO…
ashmitjsg Jun 5, 2026
4c4c3dd
fix: collective MPI checkpointing + CUDA-off build, rank-safe test cl…
ashmitjsg Jun 8, 2026
764af45
Merge branch 'main' of https://github.com/ashmitjsg/QuEST into feat/q…
ashmitjsg Jun 8, 2026
921d24d
renamed option to QUEST_ENABLE_CHECKPOINTING, fixed extern C linkage …
ashmitjsg Jun 8, 2026
2409686
fix: disable ADIOS2 streaming engines to stop Linux CI OOM
ashmitjsg Jun 9, 2026
be3de77
Free space before ADIOS2 installation
TysonRayJones Jun 11, 2026
b849ba4
restrict pre-ADIOS2 memory free to linux
TysonRayJones Jun 11, 2026
122e35e
Force serial compilation to shrink memory
TysonRayJones Jun 11, 2026
f0dcb21
renamed CHECKPOINTING to ADIOS2
TysonRayJones Jun 19, 2026
8d5399d
move from qureg to experimental group
TysonRayJones Jun 19, 2026
6c3d9c4
make ADIOS use QuEST communicator
TysonRayJones Jun 19, 2026
0858ef2
improve validation
TysonRayJones Jun 19, 2026
8ad17ba
demand saved and new distributions match
TysonRayJones Jun 19, 2026
e12a9bd
add saveQuregToFile test
TysonRayJones Jun 20, 2026
64976db
workaround ADIOS2 bug
TysonRayJones Jun 20, 2026
72ec86a
add createQuregFromFile test
TysonRayJones Jun 20, 2026
c3bd8a5
avoid ADIOS2 hang
TysonRayJones Jun 20, 2026
5e57188
added QUEST_DOWNLOAD_ADIOS2, updated doc
TysonRayJones Jun 20, 2026
72e6d17
add C++ std::string overloads
TysonRayJones Jun 20, 2026
2187105
addressed TODOs
TysonRayJones Jun 20, 2026
8b670c4
adjusting doc
TysonRayJones Jun 20, 2026
099f78b
added missing C++ guards
TysonRayJones Jun 20, 2026
e0c4756
temporarily duplicate James' CI patch
TysonRayJones Jun 20, 2026
f3f1759
patch Windows saveQuregToFile validation test
TysonRayJones Jun 21, 2026
69a1176
revert duplicated CI patch
TysonRayJones Jun 22, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/compile.yml
Original file line numberDiff line numberDiff line change
Expand Up@@ -47,6 +47,7 @@ jobs:
${{ matrix.cuda == 'ON' && 'CUDA' || '' }}
${{ matrix.hip == 'ON' && 'HIP' || '' }}
${{ matrix.cuquantum == 'ON' && 'CUQ' || '' }}
${{ matrix.adios2 == 'ON' && 'CKPT' || '' }}

runs-on: ${{ matrix.os }}

Expand All@@ -67,6 +68,7 @@ jobs:
cuda: [ON, OFF]
hip: [ON, OFF]
cuquantum: [ON, OFF]
adios2: [ON, OFF]
mpilib: ['', 'mpich', 'ompi', 'impi', 'msmpi']

# disable deprecated API on MSVC, and assign unique compilers,
Expand DownExpand Up@@ -249,14 +251,16 @@ jobs:
-DQUEST_ENABLE_CUDA=${{ matrix.cuda }}
-DQUEST_ENABLE_HIP=${{ matrix.hip }}
-DQUEST_ENABLE_CUQUANTUM=${{ matrix.cuquantum }}
-DQUEST_ENABLE_ADIOS2=${{ matrix.adios2 }}
-DCMAKE_CUDA_ARCHITECTURES=${{ env.cuda_arch }}
-DCMAKE_HIP_ARCHITECTURES=${{ env.hip_arch }}
-DCMAKE_CXX_COMPILER=${{ matrix.compiler }}
-DCMAKE_CXX_FLAGS=${{ matrix.mpi == 'ON' && matrix.cuda == 'ON' && '-fno-lto' || '' }}

# force 'Release' build (needed by MSVC to enable optimisations)
# force 'Release' build (needed by MSVC to enable optimisations),
# and force serial compilation to avoid ADIOS2 OOM error
- name: Compile
run: cmake --build ${{ env.build_dir }} --config Release --parallel
run: cmake --build ${{ env.build_dir }} --config Release --parallel 1

# run all compiled isolated examples to test for link-time errors,
# continuing if any fail (since some deliberately fail)
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/test_free.yml
Original file line numberDiff line numberDiff line change
Expand Up@@ -59,7 +59,7 @@ jobs:
- name: Get QuEST
uses: actions/checkout@main

# compile serial unit tests, optionally include deprecated test
# compile serial unit tests, optionally include deprecated test, always including ADIOS2
- name: Configure CMake
run: >
cmake -B ${{ env.build_dir }}
Expand All@@ -68,16 +68,18 @@ jobs:
-DQUEST_ENABLE_DEPRECATED_API=${{ matrix.version == 3 && 'ON' || 'OFF' }}
-DQUEST_DISABLE_DEPRECATION_WARNINGS=${{ matrix.version == 3 && 'ON' || 'OFF' }}
-DQUEST_FLOAT_PRECISION=${{ matrix.precision }}
-DQUEST_ENABLE_ADIOS2=ON

# force 'Release' build (needed by MSVC to enable optimisations)
# force 'Release' build (needed by MSVC to enable optimisations), and force serial (to avoid ADIOS2 OOM)
- name: Compile
run: cmake --build ${{ env.build_dir }} --config Release --parallel
run: cmake --build ${{ env.build_dir }} --config Release --parallel 1

# run v4 unit tests in random order, excluding the integration tests,
# using the default environment variables (e.g. test all permutations)
# TODO:
# ctest currently doesn't know of our Catch2 tags, so we
# are manually excluding each integration test by name

- name: Run v4 tests
if: ${{ matrix.version == 4 }}
run: ctest -j2 --output-on-failure --schedule-random -C Release -E "density evolution"
Expand Down
92 changes: 91 additions & 1 deletion CMakeLists.txt
Original file line numberDiff line numberDiff line change
Expand Up@@ -187,7 +187,6 @@ message(STATUS "AMD GPU acceleration is turned ${QUEST_ENABLE_HIP}. Set QUEST_EN

# GPU Performance Tuning
# (We do not print this value when configuring CMake as it is for advanced users only)

set(quest_tpb_description # (the games we play for multi-line set() strings!)
"The default number of threads per block QuEST will use when offloading to a GPU. Set to 128 by default. "
"Must be a multiple of 32 (on NVIDIA GPUs) or 64 (on AMD GPUs). Can be overridden at executable launch "
Expand All@@ -199,6 +198,21 @@ set(QUEST_DEFAULT_NUM_GPU_THREADS_PER_BLOCK 128
mark_as_advanced(QUEST_DEFAULT_NUM_GPU_THREADS_PER_BLOCK)


# Checkpointing with ADIOS2
option(
QUEST_ENABLE_ADIOS2
"Whether QuEST will be built with ADIOS2, enabling checkpointing (via saveQuregToFile / createQuregFromFile). Turned OFF by default."
OFF
)
message(STATUS "ADIOS2 integration is turned ${QUEST_ENABLE_ADIOS2}. Set QUEST_ENABLE_ADIOS2 to modify.")

option(
QUEST_DOWNLOAD_ADIOS2
"Whether ADIOS2 will be downloaded if it is enabled but not found. Turned ON by default."
ON
)


# Deprecated API
option(
QUEST_ENABLE_DEPRECATED_API
Expand DownExpand Up@@ -543,6 +557,81 @@ endif()



# Checkpointing (ADIOS2)
if (QUEST_ENABLE_ADIOS2)

find_package(adios2 QUIET)

# A distributed QuEST needs an MPI-enabled ADIOS2 (which provides the
# adios2::cxx_mpi target). A serial system install lacks it, so in that case we
# ignore the found package and fetch an MPI-enabled build instead of failing.
set(quest_use_found_adios2 ${adios2_FOUND})
if (adios2_FOUND AND QUEST_ENABLE_MPI AND NOT TARGET adios2::cxx_mpi)
message(STATUS "Found ADIOS2 lacks MPI support (no adios2::cxx_mpi target); fetching an MPI-enabled build instead")
set(quest_use_found_adios2 FALSE)
endif()

if(NOT quest_use_found_adios2 AND QUEST_DOWNLOAD_ADIOS2)
message(STATUS "fetching ADIOS2 via FetchContent")

include(FetchContent)
FetchContent_Declare(
adios2
GIT_REPOSITORY https://github.com/ornladios/ADIOS2.git
GIT_TAG v2.12.1
)

# Match ADIOS2's MPI to QuEST's so distributed runs write per-rank slices
# into one shared file. ADIOS2's CUDA support is deliberately left OFF:
# checkpointing copies amps to host memory (syncQuregFromGpu/syncQuregToGpu)
# before any I/O, so ADIOS2 never touches device pointers. Building it with
# CUDA is unnecessary and stalls the Windows CUDA CI job.
set(ADIOS2_USE_MPI ${QUEST_ENABLE_MPI} CACHE BOOL "" FORCE)
set(ADIOS2_USE_CUDA OFF CACHE BOOL "" FORCE)

# Forego unused facilities
set(ADIOS2_BUILD_TESTING OFF CACHE BOOL "" FORCE)
set(ADIOS2_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
set(ADIOS2_USE_SODIUM OFF CACHE BOOL "" FORCE)
set(ADIOS2_USE_Fortran OFF CACHE BOOL "" FORCE)
set(ADIOS2_USE_HDF5 OFF CACHE BOOL "" FORCE)
set(ADIOS2_USE_ZeroMQ OFF CACHE BOOL "" FORCE)
set(ADIOS2_USE_SST OFF CACHE BOOL "" FORCE)
set(ADIOS2_USE_DataMan OFF CACHE BOOL "" FORCE)
set(ADIOS2_USE_SSC OFF CACHE BOOL "" FORCE)
set(ADIOS2_USE_MHS OFF CACHE BOOL "" FORCE)
set(ADIOS2_USE_DAOS OFF CACHE BOOL "" FORCE)
set(ADIOS2_USE_MGARD OFF CACHE BOOL "" FORCE)
set(ADIOS2_USE_BZip2 OFF CACHE BOOL "" FORCE)
set(ADIOS2_USE_Blosc OFF CACHE BOOL "" FORCE)
set(ADIOS2_USE_Blosc2 OFF CACHE BOOL "" FORCE)
set(ADIOS2_USE_SZ OFF CACHE BOOL "" FORCE)
set(ADIOS2_USE_ZFP OFF CACHE BOOL "" FORCE)
set(ADIOS2_USE_PNG OFF CACHE BOOL "" FORCE)
set(ADIOS2_USE_Profiling OFF CACHE BOOL "" FORCE)
set(ADIOS2_USE_Python OFF CACHE BOOL "" FORCE)

FetchContent_MakeAvailable(adios2)

else()
# re-run non-QUIET so configuration fails with a clear error if the package
# somehow became unavailable between the two calls
find_package(adios2 REQUIRED)
endif()

# In distributed builds link ADIOS2's MPI-enabled C++ interface: it defines
# ADIOS2_USE_MPI, which exposes the adios2::ADIOS(MPI_Comm) constructor used in
# qureg.cpp for collective per-rank I/O. The serial target lacks it.
if (QUEST_ENABLE_MPI)
target_link_libraries(QuEST PRIVATE adios2::cxx_mpi)
else()
target_link_libraries(QuEST PRIVATE adios2::cxx)
endif()
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON)
endif()



# ===============================
# Set options to save in config.h
# ===============================
Expand All@@ -553,6 +642,7 @@ set(QUEST_COMPILE_OMP ${QUEST_ENABLE_OMP})
set(QUEST_COMPILE_MPI ${QUEST_ENABLE_MPI})
set(QUEST_COMPILE_SUBCOMM ${QUEST_ENABLE_SUBCOMM})
set(QUEST_COMPILE_CUQUANTUM ${QUEST_ENABLE_CUQUANTUM})
set(QUEST_COMPILE_ADIOS2 ${QUEST_ENABLE_ADIOS2})
set(QUEST_INCLUDE_DEPRECATED_FUNCTIONS ${QUEST_ENABLE_DEPRECATED_API})


Expand Down
2 changes: 2 additions & 0 deletions docs/cmake.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -44,6 +44,8 @@ make
| `QUEST_ENABLE_CUDA` | (`OFF`), `ON` | Determines whether QuEST will be built with support for NVIDIA GPU acceleration. If turned on, `CMAKE_CUDA_ARCHITECTURES` should probably also be set. |
| `QUEST_ENABLE_CUQUANTUM` | (`OFF`), `ON` | Determines whether QuEST will make use of the NVIDIA CuQuantum library. Cannot be turned on if `QUEST_ENABLE_CUDA` is off. |
| `QUEST_ENABLE_HIP` | (`OFF`), `ON` | Determines whether QuEST will be built with support for AMD GPU acceleration. If turned on, `CMAKE_HIP_ARCHITECTURES` should probably also be set. |
| `QUEST_ENABLE_ADIOS2` | (`OFF`), `ON` | Determines whether QuEST will be built with ADIOS2 to enable checkpointing, via functions `saveQuregToFile()` and `createQuregFromFile()`. |
| `QUEST_DOWNLOAD_ADIOS2` | (`ON`), `OFF` | Determines whether to download ADIOS2 from Github, when ADIOS2 is enabled but not found. |
| `QUEST_ENABLE_DEPRECATED_API` | (`OFF`), `ON` | Determines whether QuEST will be built with support for the deprecated (v3) API. ***Note**: this will generate compiler warnings and is not supported by MSVC.* |
| `QUEST_DISABLE_DEPRECATION_WARNINGS` | (`OFF`), `ON` | Whether to disable the compile-time deprecation warnings when using the deprecated (v3) API. |
| `USER_SOURCE_NAMES` | (Undefined), String | The source file for a user program which will be compiled alongside QuEST. `USER_OUTPUT_EXE_NAME` *must* also be defined. |
Expand Down
30 changes: 30 additions & 0 deletions docs/compile.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -45,6 +45,7 @@ Compiling is configured with variables supplied by the [`-D` flag](https://cmake
> - <a href="#compile_cuquantum">cuQuantum</a>
> - <a href="#compile_distribution">Distribution</a>
> - <a href="#compile_multi-gpu">Multi-GPU</a>
> - <a href="#compile_checkpointing">Checkpointing</a>

> **See also**:
> - [`cmake.md`](cmake.md) for the full list of passable compiler variables.
Expand DownExpand Up@@ -689,3 +690,32 @@ Note that distributed executables are launched in a distinct way to the other de
> - UCX
> - launch flags
> - checking via reportenv




------------------


<!-- permit doxygen to reference section -->
<a id="compile_checkpointing"></a>

## Checkpointing

QuEST has optional facilities for _checkpointing_ a `Qureg`; writing its state to a file with [`saveQuregToFile()`](https://quest-kit.github.io/QuEST/group__experimental.html#gaf9a1aec34fdfdb3c650dc60e5a8ac9d9), to be later restored into a new `Qureg` with [`createQuregFromFile()`](https://quest-kit.github.io/QuEST/group__experimental.html#gab1ebe89e2ff15470fa340d4c2ced5703). This is useful for long-running jobs which risk timeout or failure - an evolving `Qureg` can be periodically saved and resumed in a subsequent process.

Checkpointing is built upon [ADIOS2](https://github.com/ornladios/ADIOS2) and is _disabled_ by default. To enable it, simply specify `QUEST_ENABLE_ADIOS2` at configuration:
```bash
# configure
cmake .. -D QUEST_ENABLE_ADIOS2=ON

# build
cmake --build . --parallel
```

If a compatible ADIOS2 is not found, it will be automatically downloaded and installed from the ADIOS2 [Github](https://github.com/ornladios/ADIOS2), unless `QUEST_DOWNLOAD_ADIOS2` is overridden to be `OFF`. If an existing ADIOS2 is installed in a non-standard location (such as `~/.local`), pass its prefix via [`CMAKE_PREFIX_PATH`](https://cmake.org/cmake/help/latest/variable/CMAKE_PREFIX_PATH.html):
> ```bash
> cmake .. -D QUEST_ENABLE_ADIOS2=ON -D CMAKE_PREFIX_PATH=$HOME/.local
> ```

Calling `saveQuregToFile()` or `createQuregFromFile()` in a build _without_ checkpointing enabled will trigger a runtime validation error.
4 changes: 4 additions & 0 deletions quest/include/config.h.in
Original file line numberDiff line numberDiff line change
Expand Up@@ -41,6 +41,7 @@
defined(QUEST_COMPILE_CUDA) || \
defined(QUEST_COMPILE_HIP) || \
defined(QUEST_COMPILE_CUQUANTUM) || \
defined(QUEST_COMPILE_ADIOS2) || \
defined(QUEST_ENABLE_NUMA) || \
defined(QUEST_INCLUDE_DEPRECATED_FUNCTIONS) || \
defined(QUEST_DISABLE_DEPRECATION_WARNINGS)
Expand DownExpand Up@@ -84,6 +85,7 @@
#cmakedefine01 QUEST_COMPILE_CUDA
#cmakedefine01 QUEST_COMPILE_CUQUANTUM
#cmakedefine01 QUEST_COMPILE_HIP
#cmakedefine01 QUEST_COMPILE_ADIOS2


// crucial to QuEST source (informs optional NUMA usage)
Expand DownExpand Up@@ -125,6 +127,7 @@
! defined(QUEST_COMPILE_CUDA) || \
! defined(QUEST_COMPILE_HIP) || \
! defined(QUEST_COMPILE_CUQUANTUM) || \
! defined(QUEST_COMPILE_ADIOS2) || \
! defined(QUEST_ENABLE_NUMA) || \
! defined(QUEST_INCLUDE_DEPRECATED_FUNCTIONS) || \
! defined(QUEST_DISABLE_DEPRECATION_WARNINGS)
Expand DownExpand Up@@ -152,6 +155,7 @@
! (QUEST_COMPILE_CUDA == 0 || QUEST_COMPILE_CUDA == 1) || \
! (QUEST_COMPILE_HIP == 0 || QUEST_COMPILE_HIP == 1) || \
! (QUEST_COMPILE_CUQUANTUM == 0 || QUEST_COMPILE_CUQUANTUM == 1) || \
! (QUEST_COMPILE_ADIOS2 == 0 || QUEST_COMPILE_ADIOS2 == 1) || \
! (QUEST_ENABLE_NUMA == 0 || QUEST_ENABLE_NUMA == 1) || \
! (QUEST_INCLUDE_DEPRECATED_FUNCTIONS == 0 || QUEST_INCLUDE_DEPRECATED_FUNCTIONS == 1) || \
! (QUEST_DISABLE_DEPRECATION_WARNINGS == 0 || QUEST_DISABLE_DEPRECATION_WARNINGS == 1)
Expand Down
Loading