QuEST #747 — Qureg checkpointing (save/load to file via ADIOS2) [unitaryHACK]#793
Open
mk0dz wants to merge 1 commit into
Open
QuEST #747 — Qureg checkpointing (save/load to file via ADIOS2) [unitaryHACK]#793mk0dz wants to merge 1 commit into
mk0dz wants to merge 1 commit into
Conversation
…OS2 (QuEST-Kit#747) Optionally (-DQUEST_ENABLE_CHECKPOINTING=ON) persist a Qureg to disk and restore it, for HPC job resilience. Stores only numQubits, isDensityMatrix and the amplitudes (as a raw byte global-array, since ADIOS2 lacks long double), plus sizeof(qcomp) for a load-time precision check. Deployment-agnostic via ADIOS2's global array + util_getGlobalIndexOfFirstLocalAmp offsets, so a file saved under one GPU/distribution scheme loads under another; one host<->device copy handles GPU. Round-trip verified exact for CPU statevector, CPU density matrix and GPU statevector.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
/claim #747
The ask
Two new API functions in
qureg.cpp:Save
numQubits, statevector/density type, and all amplitudes — but notdeployment details or derivable quantities. Handle GPU + distributed deployments
without excessive memory. Implement via ADIOS2, behind a CMake flag.
Design
numQubits,isDensityMatrix, and the global amplitude array (+sizeof(qcomp)for a load-time precision check). No deployment flags, nonumAmps.util_getGlobalIndexOfFirstLocalAmp(qureg), countnumAmpsPerNode. A file saved on N ranks/GPU loads correctly on M ranks/CPU — the restored Qureg auto-deploys viacreateQureg/createDensityQureg.syncQuregFromGpubefore save,syncQuregToGpuafter load — one host↔device copy of the already-resident local amps.adios2::ADIOS(comm_getMpiComm())+adios2::cxx_mpiwhenQUEST_ENABLE_MPI; serial ADIOS2 otherwise.int8byte array, because ADIOS2 cannot representlong double(fp80) as a native type. fp32/fp64/fp80 all work uniformly; the recordedsizeof(qcomp)guards against loading a file into a mismatched-precision build.Files changed (+207 lines, 6 files)
When checkpointing isn't compiled, both functions report a clear user error
(
validate_quregCheckpointingIsCompiled).Build & verify
Results (this machine)
Built and verified with ADIOS2 2.12.1, and additionally in a combined
-DQUEST_ENABLE_CUDA=ON -DQUEST_ENABLE_CHECKPOINTING=ONbuild (GPU path).Regression: existing QuEST test cases pass against the checkpoint build (the
changes are purely additive) —
createQureg,createDensityQureg,getQuregAmps,initRandomPureState: All tests passed (555 assertions, 4 cases).Notes for review
long double); if you'dprefer typed
std::complexstorage for fp32/fp64 with a byte fallback only forfp80, that's an easy follow-up — say the word.
it follows ADIOS2's standard global-array idiom and the existing QuEST MPI plumbing.