quchip.utils.memory¶
Memory estimates, and checks against the memory available to this process.
Call sites name what they allocate, for example the eigensystem of a matrix of
dimension D, and the estimators below turn that into bytes. Each backend
adds the cost of its own lowering and solvers. require_memory() refuses
an allocation that cannot fit before quchip makes it.
Functions
Return the memory this process can still allocate, or |
|
|
Return the bytes of |
|
Return the peak bytes of the dense Hermitian eigensystem of a square matrix. |
|
Return whether an estimated allocation fits, and |
|
Return the bytes of a Krylov basis. |
|
Return the bytes of a table that gives the level of each device in each product state. |
|
Raise |
|
Return a low estimate of the bytes of the sparse LU factors of a square matrix. |
- quchip.utils.memory.dense_bytes(*shape, copies=1, itemsize=16)[source]¶
Return the bytes of
copiesdense arrays ofshape.
- quchip.utils.memory.eigensystem_bytes(dimension)[source]¶
Return the peak bytes of the dense Hermitian eigensystem of a square matrix.
- Parameters:
dimension (int) – Number of rows of the matrix.
- quchip.utils.memory.level_table_bytes(states, devices)[source]¶
Return the bytes of a table that gives the level of each device in each product state.
- quchip.utils.memory.sparse_lu_bytes(matrix)[source]¶
Return a low estimate of the bytes of the sparse LU factors of a square matrix.
SuperLU knows its fill only after the factorization, so the estimate is a quarter of the reverse Cuthill-McKee envelope of the symmetrized pattern. For a few modes with many levels the envelope grows faster than the fill, and the estimate can exceed the fill of a resonator with many hundreds of levels.
- Parameters:
matrix (scipy.sparse matrix or array) – Square matrix.
- quchip.utils.memory.available_memory_bytes()[source]¶
Return the memory this process can still allocate, or
Nonewhen unknown.The value is the available system memory that
psutilreports. Under a cgroup v2 memory limit, as in many Linux containers, the value is the remaining limit when that is smaller.