| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There was a problem hiding this comment.
The two-site fallback still round-trips GPU data through the host, and the GPU SVD path lacks direct coverage.
Review effort: Balanced
Findings: 1 · 2
Moves GPU SVD work and optional outputs fully onto the selected device.
Changes:
| File | Description |
|---|---|
| src/src_method/apply.py | Exposes to_host for application results. |
| src/src_method/compress.py | Exposes to_host for compression results. |
| src/src_method/stack.py | Propagates output-device selection. |
| src/src_method/_sweep.py | Avoids unconditional host conversion. |
| src/src_method/utils/linalg.py | Runs truncation SVD on the active backend. |
| tests/test_gpu_backend.py | Tests GPU-backed outputs and chaining. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Sorry, something went wrong.
| result = exact_stack(layers, chi_out, kind) | ||
| return result if to_host else [xp.asarray(t) for t in result] |
| Returns: | ||
| The site arrays of the compressed train in right-canonical form, as numpy | ||
| arrays. | ||
| arrays if ``to_host`` is ``True``, otherwise as arrays of ``xp``.. |
| Q, R = xp.linalg.qr(matrix.T if transpose else matrix) | ||
| R_np = R.get() if hasattr(R, "get") else np.asarray(R) | ||
| U, S, _ = np.linalg.svd(R_np.T if transpose else R_np, full_matrices=False) | ||
| U, S, _ = xp.linalg.svd(R.T if transpose else R, full_matrices=False) |
| Back | FazBrowse Home | New Git URL |
Summary
Keeps data on the GPU on the device="gpu" path (closes #14 ) :
Performance
Measured on Google Colab:
Method: complex128, seed=0, random MPO × MPS, 20 sites, phys_dim=4, median of 10 runs. Each path is warmed up first, and before/after are timed in separate processes on the same session.
chi_out = 64 (input bond dim 64)
chi_out = 128 (input bond dim 128, after only)
Testing
Acceptance criteria