fulqrum.gpu.full_strs.FullStrsGPUHamiltonian¶
- class FullStrsGPUHamiltonian(operator, keys, *, comm=None, engine='auto', _options=None)[source]¶
GPU-backed real type-2 Hamiltonian on an explicit set of full determinants.
Use with
distributed_primme_eigshto solve eigenvalue problems on one or more ranks. Full determinants must use block spin ordering, with alpha in the low bits and beta in the high bits, equal sector widths of 1–128 orbitals, fixed sector electron counts and supported spin-conserving terms. Unsupported operator groups are rejected.keysis a uint64 array of shape(n, 2W). W is 1 for up to 64 orbitals per spin sector and 2 for 65 to 128. Each key holds the W alpha words, then the W beta words, low word first. Bit k of word w is set when orbital 64w + k is occupied. The determinants need not form a complete tensor-product subspace.The keys can be unsorted and can contain duplicates. The constructor removes duplicates, sorts the keys and distributes them for the selected layout. After construction,
keysholds this rank’s keys in their final order,n_localis the number of determinants this rank owns, androw_startis the global index of its first determinant. Local vectors anddiag_localuse the same order: entry i belongs tokeys[i].- Parameters:
operator – Real type-2
QubitOperatorin the block layout above.keys – This rank’s input determinants, uint64 shape
(n, 2W). Input assignment and order may change during construction.comm – MPI or
LocalCommcommunicator for all participating ranks.NoneusesMPI.COMM_SELF.engine –
"auto"(default),"tile"or"general"."tile"uses the fasterTileGPUResidentHamiltonianand needs a Cartesian-product subspace: the keys must hold every alpha string paired with every beta string."general"works for any set of keys."auto"uses"tile"when it can, and"general"otherwise."tile"raises an error when it cannot run. Theengineattribute shows the engine in use. Both engines use the same key order. For only a few matvecs, use"general": the tile engine can take longer to build at high orbital counts.
- Raises:
ValueError – Keys, operator terms or the engine are unsupported.
ImportError – CuPy or required native components are unavailable.
MemoryError – GPU allocations cannot fit in available device memory.
RuntimeError – Device or communication setup fails.
Methods
compute_rdms(x, *[, rank, spin_summed])Collectively compute RDMs from this rank's NumPy or CuPy state slice, shape
(n_local,)inkeysorder.matvec(x)Collectively apply the operator to this rank's local vector of shape
(n_local,)inkeysorder.Attributes
The device memory of the stored groups, tables, keys, diagonal and matvec buffers, in bytes.
Return this rank's post-distribution keys as a uint64
(n_local, 2W)copy, alpha words then beta words, sorted by(beta, alpha).The number of remote rows that this rank reads (0 with one rank).
The number of orbitals per spin sector.
The number of key slices streamed from host memory at every matvec.
- compute_rdms(x, *, rank=1, spin_summed=False)[source]¶
Collectively compute RDMs from this rank’s NumPy or CuPy state slice, shape
(n_local,)inkeysorder. Every rank receives full host NumPy arrays after device work and collectives complete;rankselects the RDM order (1 or 2), and no normalization is applied. Spin blocks, spin-summed forms, and conventions follow PySCFmake_rdm12s(reorder=True).
- property device_bytes¶
The device memory of the stored groups, tables, keys, diagonal and matvec buffers, in bytes.
- property keys¶
Return this rank’s post-distribution keys as a uint64
(n_local, 2W)copy, alpha words then beta words, sorted by(beta, alpha).
- matvec(x)[source]¶
Collectively apply the operator to this rank’s local vector of shape
(n_local,)inkeysorder. NumPy input returns NumPy output; CuPy input returns CuPy output.
- property num_halo¶
The number of remote rows that this rank reads (0 with one rank).
- property num_orbitals¶
The number of orbitals per spin sector.
- property num_streamed_slices¶
The number of key slices streamed from host memory at every matvec.