Repository navigation
Fit moba on a card, and check pics there through the reference command - #125
Merged
Merged
Conversation
apps.moba made its starting point, its reference and its coil coefficients on the host whatever device the k-space was on, so a fit given CUDA k-space failed on its first Gauss-Newton step with a device mismatch. They are now made on the k-space's device. The two moba tests that fit with and without known coils run on each device. scripts/check_device.py called bartorch.tools.pics, which the apps assemble now; its three pics checks run the reference command instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
apps.moba(src/bartorch/apps/_moba.py): the starting point and reference (model.initial(...)) and the zero coil coefficients are made onkspace.device.tests/test_apps.py:test_moba_fits_the_decay_behind_known_coilsandtest_moba_estimates_the_coils_with_the_decaytake thedevicefixture and check that the fitted maps come back on it.scripts/check_device.py: the threepicschecks callbartorch._reference.pics(withtraj=andtoeplitz=False) in place of the removedbartorch.tools.pics.Why
A fit given CUDA k-space failed on its first Gauss-Newton step: the iterate was on the host and the data on the card. With torchsim's protocol fix (pulserver/blochsim#27) the model follows the maps too, so moba now fits on a card end to end.
check_device.pystopped at 6/9 becausetools.picsmoved toapps.Validation
On an RTX 4060 Laptop, CUDA 12.8 build (
BARTORCH_CUDA=ON, sm_89), torch 2.13+cu130:pytest -k moba tests/test_apps.py tests/test_cli.py: 79 passed (the CUDA legs included; they need torchsim#27).python scripts/check_device.py: 9/9.moba -T -l2, 128², 8 coils, 8 echoes: the app on CUDA returns the CPU app's maps (R2 error against the truth 2.4e-03 median, 1.8e-02 max, on both devices). Under load from other jobs on the machine it took 30–40 s on the card against 371 s on the host; the command with-gtook 2.7 s at its default 8 steps, which do not converge on this phantom (about 12 do).ruff format --checkandruff checkon the changed files: clean.Not in this PR
Most of the app's time on a card is TorchSim's model evaluated about six times per conjugate-gradient step: the bundle's members are
TorchOperators, which evaluate with gradients tracked so that their own derivatives can be served by autograd, so a Jacobian built once per Gauss-Newton step cannot be used without making the derivative by the point wrong. Reaching the command's speed needs the bundle members as an operator linear in the tangent, with the second-order terms on demand.Documentation impact
None.
🤖 Generated with Claude Code