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
Require PyOpenCL context for HI of LazyEBSD #615
Conversation
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
@ericpre: I would be very greatful if you could give your opinion on whether the following fixes #614: Relevant part of PyEBSDIndex' PyOpenCL context setup: https://github.com/USNavalResearchLaboratory/PyEBSDIndex/blob/main/pyebsdindex/opencl/openclparam.py#L67. |
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.
@ericpre: I would be very greatful if you could give your opinion on whether the following fixes #614
I have left some comments but I don't have more time than this. One way to check is to push a branch of the https://github.com/hyperspy/hyperspy-extensions-list repo on github using this branch of kikuchipy and removing the corresponding tests being skipped.
kikuchipy/__init__.py
Outdated
from pyebsdindex.opencl.openclparam import OpenClParam | ||
|
||
clparams = OpenClParam() | ||
clparams.get_context() |
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.
I would use pyopencl
directly instead, because the return of clparams.get_context()
could be regarded as an implementation details of pyebsdindex
.
I would expect that pyopencl
have a clean approach to do this.
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.
Agreed. I've done this instead.
kikuchipy/__init__.py
Outdated
|
||
clparams = OpenClParam() | ||
clparams.get_context() | ||
assert clparams.ctx is not None # pragma: no cover |
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.
Off the top of my head: using assert
is intended for development and testing and is not a good pattern to catch runtime errors.
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.
Thanks, I've replaced it with an if/else.
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
Thanks for the tip, the kikuchipy test suite passes in the "dev" runs when this PR's branch is used: https://github.com/hakonanes/hyperspy-extensions-list/actions/runs/4204973562/jobs/7296399979 |
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
Signed-off-by: Håkon Wiik Ånes <hwaanes@gmail.com>
Description of the change
This PR should fix #614 by requiring PyOpenCL and a
compatible drivercontext to be available when trying to perform Hough indexing of a Dask array with PyEBSDIndex. By doing this check early, we ensure that PyEBSDIndex can use PyOpenCL and that it will not fall back to its CPU implementation, which then calls Numba and errors.Will make a v0.8.1 release as soon as this PR is merged.
Progress of the PR
Minimal example of the bug fix or new feature
Error message that should be raised when PyOpenCL is installed but no compatible driver is available (error message copy/pasted):
For reviewers
__init__.py
.section in
CHANGELOG.rst
.release.py
,.zenodo.json
and.all-contributorsrc
with the table regenerated.