Closed hakonanes closed 1 month ago
I believe they are related to these changes in band_detect_cl.py
: https://github.com/USNavalResearchLaboratory/PyEBSDIndex/commit/88136e60b8bc6a6c53c507bfc4dda1a39163e864#diff-b1a7457abbba36e579c00423396bc962373e6fcb044b4c43a3c2ad0384cca8be
What is the data type of your dask array?
In this example it is uint8.
Trying to figure out exactly what is up ... I see Numba error, but seems like it is failing on making an opencl buffer?
Ah - I see what is up ... I think. When it fails to run the OpenCL version, it attempts the numba version. Both are failing for similar reasons. Let me look at what I can do here.
Thank you for having a look, really appreciate it! Any potentially useful information you have about the problem is useful.
If only all the fixes where this easy (at least I hope it is this easy). Maybe not the most elegant solution, but it looks like throwing an image = np.asarray(image)
at the top of the radon functions should work. This will make a copy of the chunk of patterns read in, but I think I was doing that before anyway. While I have made many improvements on making PyEBSDIndex faster, I have not worried much about the memory efficiency.
Some insight:
Thus, I stoped converting to float on the CPU (which would have made a copy in this case), and tried sending a version as is to the GPU. OpenCL and Numba will work with numpy, but not Dask arrays ... thus the issue on both pipelines.
I will send in a PR for you to test.
BTW - old version on my machine: 780 pats/s, new 1180 pats/s
Your changes in https://github.com/USNavalResearchLaboratory/PyEBSDIndex/pull/60 fixes my issue here, thanks!
PyEBSDIndex 0.3.2 is now out on PyPi and conda-forge, and should be the fix for this issue.
Thank you so much for the quick handling of my issue here. Have a good weekend!
Hough indexing of lazy EBSD patterns, where the patterns are in a Dask array, work fine with PyEBSDIndex 0.2. This was because every EBSD pattern was converted to a NumPy array by PyEBSDIndex (as a side-effect!) before being passed to Numba for further processing.
Numba requires NumPy arrays. In PyEBSDIndex 0.3, our Dask array is not converted before being passed to Numba, resulting in an error.
@drowenhorst-nrl: Do you have any suggestions for how we can solve this? It was very nice to be able to pass the entire Dask array to PyEBSDIndex so that you could operate on it chunk by chunk, without using having to write it into memory.
A minimal working example: