Uh oh!
There was an error while loading. Please reload this page.
Make e3PIE dispatch on the array module instead of forcing cupy - #93
Merged
Conversation
e3PIE could not run at all. Three separate causes, each verified independently by reverting just that part and watching the e3PIE golden fail. 1. initializeReconstructionParams() built the transfer function under a hardcoded `if True: import cupy as xp`, with the numpy version of the same block sitting above it behind `if False:`. On CPU that produced a cupy H which then met numpy arrays in the position loop: TypeError: Unsupported type <class 'numpy.ndarray'>. Without cupy installed it was an ImportError instead. It now uses getArrayModule(self.reconstruction.probe), like every other engine. 2. It set self.params.betaProbe / betaObject, but reconstruct() and objectPatchUpdate() read self.betaProbe / self.betaObject: AttributeError: 'e3PIE' object has no attribute 'betaProbe'. Setting them on the engine matches ePIE and the rest. 3. H was not in Reconstruction.possible_GPU_fields, so it stayed on the host when the engine moved to the GPU. With (1) and (2) fixed the CPU run passes and the GPU run still fails; adding H fixes it. H is built from __init__, before _checkGPU runs, so it is created on the host either way and travels with the rest of the state. Adds an e3PIE multislice golden (nslice=3), the configuration the transfer function exists for. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Third in the series building a safety net before performance work. Follows #90, #91.
The problem
e3PIE could not run at all, on either backend. Three independent causes.
1. cupy was hardcoded
initializeReconstructionParams()built the multislice transfer function like this:So a CPU run produced a cupy
H, which then met numpy arrays inside the position loop:On a machine without CuPy it was an
ImportErrorinstead. Now usesgetArrayModule(self.reconstruction.probe), like every other engine.2. betaProbe was set on the wrong object
Now set on the engine, matching ePIE and the rest.
3. H never moved to the GPU
Hwas missing fromReconstruction.possible_GPU_fields, so it stayed on the host whileeverything else moved to the device.
It is built from
__init__, before_checkGPUruns, so it is created on the host either wayand now travels with the rest of the state.
Verification
Each cause was reverted on its own to confirm it is actually load-bearing:
maintoday)TypeErrorTypeErrorHnot in GPU fields)TypeErrorbetaProbeon params)AttributeErrorAttributeErrorAdds an e3PIE multislice golden (
nslice=3), the configuration the transfer function existsfor. Suite goes 30 → 32 passing.
Version
0.2.6→0.2.7. This publishes automatically on merge (#92).