-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ProjectionOperator Bug Fix (Issue #1990) #2065
base: master
Are you sure you want to change the base?
Conversation
… not case-sensitive. Added case sensitivity and unit tests for ProjectionOperator inputs. Updated environment .yml files and env creation script to include new unittest-parametrize library used in tests. Updated developer guide to include example of parametrized test usage. Added name to NOTICE.txt.
formatting Signed-off-by: M-A-Demir <[email protected]>
PS: In CIL/scripts/create_local_env_for_cil_development.sh, I couldn't install the pip module (unittest-parametrize) directly with the 'conda create' command , so I have changed it to use the requirements_test.yml file if $test_deps != 0. I tried an alternative, which is to have a separate list of pip dependencies, use conda create, then activate the conda environment and perform in GitHub Actions, Tests using unittest-parametrize produce a TypeError: TestAstraProjectors.test_ProjectionOperator_2Ddata() missing 3 required positional arguments: 'device', 'no_error_raised', and 'err_type' Thought this may be due to an ASTRA dependency, so added No issues running tests in local env:
|
…/CIL into projectionop_bug_1990
…raProjectors inherit from ParametrizedTestCase
UPDATE: Fixed the TypeError issue on test - the version I pushed did not have the TestAstraProjectors class inherit from unittest_parametrize.ParametrizedTestCase, which is required to run the parametrized tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a really nice addition thanks @M-A-Demir!
In addition to the small comments, could you test this on windows. @hrobarts should be able to help you out.
ProjectionOperator(image_geometry=None, acquisition_geometry=None, device='gpu') | ||
|
||
@parametrize("device, no_error_raised, err_type", | ||
[param('cpu', True, None, id="cpu_NoError"), param('CPU', True, None, id="CPU_NoError"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if you pass "GPU" and don't have an nvidia gpu or the astra-gpu library?
I'm guessing it doesn't return very cleanly, but I wonder if it's something we could catch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gfardell The output if you pass "gpu"/"GPU" without the NVidia GPU is:
`Warning: Unable to get available GPU memory. Defaulting to 1GB.
Error: maxBlockDimension getDevice: CUDA error 35: CUDA driver version is insufficient for CUDA runtime version.
Warning: Error querying device
Floating point exception (core dumped)`
Which don't seem to be python-raised errors, so I'm not sure I can use that in the tests I have.
I can add some checks for NVidia GPU and astra-gpu in the ProjectionOperator class
…ecutes pip install if list is not empty
Description
Update in response to issue #1990: ProjectionOperator device input is not case-sensitive. Added case sensitivity and unit tests for ProjectionOperator inputs. Updated environment .yml files and env creation script to include new unittest-parametrize library used in tests. Updated developer guide to include example of parametrized test usage. Added name to NOTICE.txt.
Issue: #1990
Example Usage
ProjectionOperator(ig, ag, device="GPU")
device name passed is now case insensitive
❤️ Thanks for your contribution!