pycc.device
Device / precision manager for PyCC wavefunctions.
A single object that owns the device (‘CPU’/’GPU’) and precision
(‘SP’/’DP’) policy: it validates the kwargs, resolves the storage (device0)
and compute (device1) handles, builds the contraction backend, and applies
the dtype/placement cast policy through seed_compute() / seed_store().
This centralizes logic that was previously duplicated across ccwfn.__init__
(the SP real-casts and the GPU torch casts) and the contraction backend’s
__init__ (a third copy of the device resolution). In the 2026-06 refactor the
manager is created in ccwfn.__init__; it moves to the Wavefunction base in
Phase 3.
Notes
GPU tensors are seeded real (float32/64). Complex arithmetic appears only
transiently during RT-CC propagation; ContractionBackend and
utils.dot upcast the real operands to complex per-contraction, since torch
(unlike NumPy) does not promote real<->complex in einsum/matmul/dot.
Classes
|
A device-aware wrapper around |
|
Owns the device/precision policy and the contraction backend. |