Uh oh!
There was an error while loading. Please reload this page.
Fix the tutorial example that crashes on GPU, and the PyPI logo - #263
Open
gomezzz wants to merge 2 commits into
Open
Fix the tutorial example that crashes on GPU, and the PyPI logo#263gomezzz wants to merge 2 commits into
gomezzz wants to merge 2 commits into
Conversation
The vectorized-integrand example built its helper tensors with the legacy
torch.Tensor(...) constructor, which ignores the torch.set_default_device("cuda")
that set_up_backend performs. On any CUDA machine the helpers stayed on the CPU
while the sample points were on the GPU, so the example died in einsum with
"Expected all tensors to be on the same device". Switched to torch.tensor and
torch.stack, and added a note, since the distinction bites in user code just as
easily.
The import block pulled in matplotlib, which is not a runtime dependency, so it
failed after the installation the README documents. Flagged as a prerequisite
rather than promoted to a dependency.
The README logo was a repository-relative path and so did not render on the PyPI
project page; it now uses an absolute URL like the performance figures already do.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YP9oDLmw636HhPSAD6Nv3pCoverage Report
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Review follow-up. The logo was not the only relative link that breaks on the PyPI project page: environment.yml, environment_all_backends.yml (twice), benchmarking/genz_functions.py and CONTRIBUTING.md all resolve against pypi.org and 404 there. Fixing only the logo would have shipped the same class of bug the PR is named after. The device note referenced :func:`set_up_backend` unqualified. tutorial.rst has no py:module context, so Sphinx could not resolve it and rendered it as plain text -- silently, since unresolved python xrefs are not warnings, which is why the -W gate stayed green. Now qualified, and verified to emit a real link in the built HTML. The note also sat at the end of section 7 while the trap is reachable from section 1. It gains a label, and the set_up_backend block near the top now points at it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YP9oDLmw636HhPSAD6Nv3p
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 freeto 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.
Three documentation defects found while validating the 0.6.0 release on real
hardware. Docs only — no library code changes.
It built its helper tensors with the legacy
torch.Tensor(...)constructor,which ignores the
torch.set_default_device("cuda")thatset_up_backendperforms, while
torch.tensor(...)honours it. The helpers stayed on the CPU,the sample points were on the GPU, and the example died in
torch.einsumwithRuntimeError: Expected all tensors to be on the same device. Reproduced on anRTX 4060 Ti, then confirmed fixed — the example now prints the
Trueit claims.A note was added because this bites in user code exactly as readily.
matplotlib.pyplot, but matplotlib is only in thedevextra, so a user whoran the README's
pip install torchquad torchhitModuleNotFoundErroron thefirst code block. Called out as a prerequisite rather than promoted to a runtime
dependency — 0.6.0 deliberately dropped it as one.
repository-relative
<img src="logos/...">; PyPI cannot resolve relative pathsin a long description. Now an absolute
?raw=trueURL, matching what the sevenperformance figures already do. Pre-existing — 0.5.0's project page has the same
broken image.
Related to #258.
Numerical behaviour
None. The example's computed values are unchanged; only where its helper tensors
are allocated changed.
Test plan
corrected version on the same machine:
all close -> True, withgrid,resultandresult_vectorizedall oncuda:0in float64.sphinx-build -W -b html docs/source— build succeeded, no warnings.Note for merging
This touches
CHANGELOG.md's[Unreleased]section, as does #262, so whicheverlands second will have a small conflict there. The two entries are independent.
What changed after review
environment.yml,environment_all_backends.yml(twice),benchmarking/genz_functions.pyandCONTRIBUTING.mdare all repository-relative and 404 on the PyPI project pagefor the same reason. All five are now absolute; fixing only the logo would have
shipped the same class of bug this PR is named after.
:func:set_up_backendwas unqualified**, and `tutorial.rst` has no `py:module` context, so Sphinx silently rendered it as plain text — unresolved Python xrefs are not warnings, which is why the `-W` gate stayed green. Now `:func:`torchquad.set_up_backend, and verified to emit a real anchor in thebuilt HTML.
trap is hit from section 1. It now carries a label, and the
set_up_backendblock near the top links to it. Both the label target and the
:ref:link wereconfirmed present in the generated HTML.
Not addressed here
Nothing executes the tutorial's code blocks, which is why this survived several
releases, and the failure is GPU-only so no CI job would catch it either. A
two-line version of this example belongs in
release_testing/, which alreadyruns on a GPU box during release validation. Worth its own issue rather than
widening a docs PR.