Skip to content

Bath compression#228

Open
kbidzhiev wants to merge 22 commits into
mainfrom
kb/bath_compression
Open

Bath compression#228
kbidzhiev wants to merge 22 commits into
mainfrom
kb/bath_compression

Conversation

@kbidzhiev
Copy link
Copy Markdown
Contributor

@kbidzhiev kbidzhiev commented Mar 12, 2026

In this PR, I introduce a new method for packing Hermitian objects of the shape (χ, m , χ), specifically energy baths.

The main idea is to avoid storing the full Hermitian matrix. Instead, we store only the lower triangular part, including the main diagonal. The upper triangular part can then be reconstructed from the lower triangular entries using complex conjugation. Lower triangular columns are stacked to m vectors of length $$\chi(\chi+1)/2$$

This reduces the memory footprint of an $$\chi \times \chi$$ matrix from $$\chi^2$$ to $$\chi(\chi+1)/2$$.

The PR closes #95
(I've tried decompositions like SVD, eigh, cholesky. No compression, baths are ~full rank tensors)

the following part contains results for 5x5 quench_performance_gpu from our benchmark suit.
Memory measurement is done with get_max_rss in emu_base/utils.py, which is using torch.cuda.max_memory_allocated(...). In the following I'm going to tests the new code with .memory_allocated(...) vs .max_memory_allocated(...)

Results

torch.cuda.memory_allocated(...):
Returns the current GPU memory occupied by tensors in bytes for a given device.

Before
image
After
image

torch.cuda.max_memory_allocated(...): <- MAX allocation:
Return the maximum GPU memory occupied by tensors in bytes for a given device. By default, this returns the peak allocated memory since the beginning of this program.

Before
image
After
image

NB on performance.

every Hermitean bath tensor is validated on hermiticity. That can be weakened

Outcome

The real GPU memory occupation is reduced asymptotically by factor 2, though the peak memory occupation is still high and is not addressed here. The peak memory is hidden in operator application in Krylov routines

@kbidzhiev kbidzhiev mentioned this pull request Mar 27, 2026
@kbidzhiev kbidzhiev marked this pull request as ready for review April 2, 2026 08:50
Comment thread emu_base/__init__.py
from .math.brents_root_finding import find_root_brents
from .math.krylov_exp import krylov_exp, DEFAULT_MAX_KRYLOV_DIM
from .jump_lindblad_operators import compute_noise_from_lindbladians
from .math.brents_root_finding import find_root_brents
Copy link
Copy Markdown
Contributor Author

@kbidzhiev kbidzhiev Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the file is sorted in alphabetic order

@kbidzhiev kbidzhiev requested review from a-quelle-pasqal and elmerhej and removed request for a-quelle-pasqal April 30, 2026 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bath compression

1 participant